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 {