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:
Bob Nystrom
2014-01-01 13:25:24 -08:00
parent 45456733aa
commit 48db3a9620
18 changed files with 563 additions and 376 deletions
@@ -0,0 +1 @@
1 / false // expect runtime error: TypeError: Right operand must be Num.
@@ -0,0 +1 @@
1 - false // expect runtime error: TypeError: Right operand must be Num.
+1
View File
@@ -0,0 +1 @@
1 % false // expect runtime error: TypeError: Right operand must be Num.
@@ -0,0 +1 @@
1 * false // expect runtime error: TypeError: Right operand must be Num.
@@ -0,0 +1,3 @@
1 + false // expect runtime error: TypeError: Right operand must be Num.
// TODO: What about a string on the RHS?