MCPcopy Index your code
hub / github.com/endbasic/endbasic / emit_default

Method emit_default

core/src/compiler/codegen.rs:114–122  ·  view source on GitHub ↗

Emits code to set `reg` to the default value for `vtype`.

(&mut self, reg: Register, vtype: ExprType, pos: LineCol)

Source from the content-addressed store, hash-verified

112
113 /// Emits code to set `reg` to the default value for `vtype`.
114 pub(super) fn emit_default(&mut self, reg: Register, vtype: ExprType, pos: LineCol) {
115 let instr = match vtype {
116 ExprType::Boolean | ExprType::Double | ExprType::Integer => {
117 bytecode::make_load_integer(reg, 0)
118 }
119 ExprType::Text => bytecode::make_alloc(reg, ExprType::Text),
120 };
121 self.emit(instr, pos);
122 }
123
124 /// Emits code to set `reg` to the specific `datum` value.
125 pub(super) fn emit_value(

Callers 3

compile_stmtFunction · 0.80
prepare_globalsFunction · 0.80
define_new_argFunction · 0.80

Calls 1

emitMethod · 0.80

Tested by

no test coverage detected