Retoor software development Projects Research SearchXNG
Register Sign In

3 lines
87 B
Plaintext
Raw Normal View History

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 15:51:16 +01:00
var a = 123
new a // expect runtime error: Must provide a class to 'new' to construct.
Reference in New Issue Copy Permalink
f2edb03389
wren/test/new/new_on_nonclass.wren
Response time: 52ms
Mail Licenses API