Start adding support for runtime errors:
- Primitives can now signal an error. - An error prints a callstack and ends the current (and right now only) fiber. - Arithmetic operators error if the operand is not a number. - Real error for method not found. - Associate source file name, and method names with functions. - Debug line number info for functions. Unfortunately, this regresses perf on fib about 15%, mostly because of the better checking in arithmetic ops. There's still a bunch of clean up to do, but this is a big step in the right direction.
This commit is contained in:
+1
-7
@@ -274,8 +274,7 @@ void* wrenReallocate(WrenVM* vm, void* memory, size_t oldSize, size_t newSize);
|
||||
|
||||
// Mark [value] as reachable and still in use. This should only be called
|
||||
// during the sweep phase of a garbage collection.
|
||||
// TODO: Expose markObj instead?
|
||||
void wrenMarkValue(WrenVM* vm, Value value);
|
||||
void wrenMarkObj(WrenVM* vm, Obj* obj);
|
||||
|
||||
// Sets the current Compiler being run to [compiler].
|
||||
void wrenSetCompiler(WrenVM* vm, Compiler* compiler);
|
||||
@@ -315,9 +314,4 @@ const char* getSymbolName(SymbolTable* symbols, int symbol);
|
||||
// Returns the global variable named [name].
|
||||
Value findGlobal(WrenVM* vm, const char* name);
|
||||
|
||||
// Pushes [function] onto [fiber]'s callstack and invokes it. Expects [numArgs]
|
||||
// arguments (including the receiver) to be on the top of the stack already.
|
||||
// [function] can be an `ObjFn` or `ObjClosure`.
|
||||
void wrenCallFunction(ObjFiber* fiber, Obj* function, int numArgs);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user