feat: validate argument type in Fn.new and add runtime error test

Add type checking to the `fn_new` native function to ensure the argument
passed to `Fn.new` is either a function or closure. Previously, passing
an invalid type like an integer would silently succeed. Now it returns
a clear runtime error message: "Argument must be a function."

Also remove two stale TODO comments about newline handling in the
compiler that were no longer relevant to current parsing logic.
This commit is contained in:
Bob Nystrom
2014-04-05 01:13:13 +00:00
parent 093da7befb
commit 4c4f32b5b2
3 changed files with 6 additions and 6 deletions
@@ -0,0 +1 @@
new Fn(3) // expect runtime error: Argument must be a function.