Handle empty (or comment-only) files. Fix #57.
This commit is contained in:
+1
-3
@@ -2747,7 +2747,7 @@ ObjFn* wrenCompile(WrenVM* vm, const char* sourcePath, const char* source)
|
||||
|
||||
WREN_UNPIN(vm);
|
||||
|
||||
for (;;)
|
||||
while (!match(&compiler, TOKEN_EOF))
|
||||
{
|
||||
definition(&compiler);
|
||||
|
||||
@@ -2757,8 +2757,6 @@ ObjFn* wrenCompile(WrenVM* vm, const char* sourcePath, const char* source)
|
||||
consume(&compiler, TOKEN_EOF, "Expect end of file.");
|
||||
break;
|
||||
}
|
||||
|
||||
if (match(&compiler, TOKEN_EOF)) break;
|
||||
}
|
||||
|
||||
emit(&compiler, CODE_NULL);
|
||||
|
||||
Reference in New Issue
Block a user