Skip to content

Commit f68b529

Browse files
committed
feat: implement bytecode generation for expressions and compiler infrastructure
1 parent 29ccc9a commit f68b529

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/compiler/bytecode_gen.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,13 @@ static void genFunction(BytecodeGen* gen, Stmt* stmt, bool defineVar) {
479479
funcCompiler.function->isStatic = stmt->as.func_decl.isStatic;
480480
funcCompiler.function->isAbstract = stmt->as.func_decl.isAbstract;
481481

482+
if (stmt->as.func_decl.name != NULL) {
483+
funcCompiler.function->name = copyString(stmt->as.func_decl.name, strlen(stmt->as.func_decl.name));
484+
}
485+
486+
bool isInitDebug = (stmt->as.func_decl.name != NULL && strcmp(stmt->as.func_decl.name, "init") == 0);
487+
fprintf(stderr, "Compiling function '%s' (isInit: %d)\n", stmt->as.func_decl.name ? stmt->as.func_decl.name : "NULL", isInitDebug);
488+
482489
beginScope(gen);
483490

484491
StringList* params = (StringList*)stmt->as.func_decl.params;

0 commit comments

Comments
 (0)