Handle empty (or comment-only) files. Fix #57.

This commit is contained in:
Bob Nystrom
2015-01-04 13:00:53 -08:00
parent 005688da96
commit a9bb2387a1
5 changed files with 5 additions and 9 deletions
+1 -3
View File
@@ -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);