diff options
Diffstat (limited to 'clox/src/compiler.c')
-rw-r--r-- | clox/src/compiler.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clox/src/compiler.c b/clox/src/compiler.c index 75ed697..f31d015 100644 --- a/clox/src/compiler.c +++ b/clox/src/compiler.c @@ -4,6 +4,7 @@ #include "common.h" #include "compiler.h" +#include "memory.h" #include "scanner.h" #ifdef DEBUG_PRINT_CODE @@ -827,3 +828,11 @@ ObjFunction *compile(const char *source) { ObjFunction *function = endCompiler(); return parser.hadError ? NULL : function; } + +void markCompilerRoots() { + Compiler *compiler = current; + while (compiler != NULL) { + markObject((Obj *)compiler->function); + compiler = compiler->enclosing; + } +} |