diff options
| author | mryouse | 2023-05-26 02:27:02 +0000 |
|---|---|---|
| committer | mryouse | 2023-05-26 02:27:02 +0000 |
| commit | 11e9f1d854602aae7cb895cfb2f9fc5dd338e6f8 (patch) | |
| tree | d56db3e93a918b3a3cbb9b31d65245e6660b9417 /vm.d | |
| parent | 46a9b83a118207f414f2f7e4c0391785dc440fa4 (diff) | |
start making errors a bit nicer
Diffstat (limited to 'vm.d')
| -rw-r--r-- | vm.d | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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?) |
