feat: remove PRIM_CALL result type and add METHOD_FN_CALL for function call special-casing

Replace the special "call" primitive result type (PRIM_CALL) with a new METHOD_FN_CALL method type that marks function call methods. Add checkArity helper to validate argument count before invoking function closures, and update the interpreter dispatch to handle the new method type instead of relying on the removed PRIM_CALL result.
This commit is contained in:
Bob Nystrom
2015-10-04 02:04:11 +00:00
parent d463507b6e
commit 4d1d6d03f4
4 changed files with 94 additions and 87 deletions
@@ -1,2 +1,2 @@
var f2 = Fn.new {|a, b| System.print(a, b) }
var f2 = Fn.new {|a, b| System.print(a + b) }
f2.call("a") // expect runtime error: Function expects more arguments.