emission for func dec

This commit is contained in:
Meyer Simon
2025-05-05 20:18:23 -04:00
parent 0446b0ae6b
commit 0114e1d65f
3 changed files with 16 additions and 0 deletions

View File

@ -167,6 +167,7 @@ TNodeOrConst *tn_or_const(Discriminant d, void *tnc) {
return count;
}
static void emit_helper(void) {
Instruction *inst = calloc(1, sizeof(*inst));
if (begin == NULL) {
@ -179,6 +180,11 @@ static void emit_helper(void) {
current = inst;
}
}
void emit_function_dec(TableNode * name){
emit_helper();
current->opcode = E_FUNC_DEC;
current->result = name;
}
void emit_binary_op(
Op op,
@ -405,6 +411,13 @@ void emit_as_file(FILE *out_file, Instruction *i) {
return;
}
switch (i->opcode) {
case E_FUNC_DEC:
fprintf(out_file,
"%4.d: func_dec : %s\n",
i->index,
getName(i->result));
break;
case E_FUNC_START:
fprintf(out_file,
"%4.d: func : %s\n",