Commit Graph

1 Commits

Author SHA1 Message Date
Bob Nystrom
f942da2723 fix: add runtime error when new is called on non-class argument
In the interpreter's NEW opcode handler, check if the top-of-stack value is a class before attempting construction. If not, raise a runtime error with a descriptive message instead of silently failing or crashing.

Also add a test case (test/new_on_nonclass.wren) that verifies the error is correctly triggered when calling new on a non-class value like an integer.
2014-03-06 14:51:16 +00:00