From fa7dac1eaf6b8cc8bb1746afc4e7e971dfb6a2b5 Mon Sep 17 00:00:00 2001 From: Cheol Jeon Date: Sun, 21 Sep 2025 14:01:30 +0200 Subject: [PATCH] Fix: Only assign 'this' to slot 0 if currentClass is not null --- c/compiler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/compiler.c b/c/compiler.c index 463bea79f..21cb1c232 100644 --- a/c/compiler.c +++ b/c/compiler.c @@ -326,7 +326,7 @@ static void initCompiler(Compiler* compiler, FunctionType type) { local->name.length = 0; */ //> Methods and Initializers slot-zero - if (type != TYPE_FUNCTION) { + if (currentClass != NULL && type != TYPE_FUNCTION) { local->name.start = "this"; local->name.length = 4; } else {