aboutsummaryrefslogtreecommitdiff
path: root/vm.d
diff options
context:
space:
mode:
Diffstat (limited to 'vm.d')
-rw-r--r--vm.d8
1 files changed, 8 insertions, 0 deletions
diff --git a/vm.d b/vm.d
index c14c746..dcacd28 100644
--- a/vm.d
+++ b/vm.d
@@ -9,6 +9,7 @@ import compiler;
//import obj;
import dbg;
+
enum InterpretResult {
OK,
COMPILE_ERROR,
@@ -569,6 +570,13 @@ InterpretResult interpret(string source, VM vm) {
Compiler compiler = new Compiler(ObjType.SCRIPT, &parser);
Function func = compiler.compile();
+ if (compiler.errors.length > 0) {
+ foreach (CompileError err ; compiler.errors) {
+ writefln("error: %s", printableCompilerError(err));
+ }
+ return InterpretResult.COMPILE_ERROR;
+ }
+
// vm.globals[":int"] = makeTypeValue(":int");
// reset the frame count (why do i need to do this?)