feat: add conditional operator and fn toString to wren compiler and core
Add TOKEN_QUESTION token type and implement conditional() parsing function in wren_compiler.c to support the ternary conditional operator (condition ? then : else). Register fn_toString native in wren_core.c to return "<fn>" string for function objects. Include comprehensive test suite covering precedence, short-circuit evaluation, and error cases for missing tokens.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
true ? IO.print("ok") : IO.print("no") // expect: ok
|
||||
false ? IO.print("no") : IO.print("ok") // expect: ok
|
||||
Reference in New Issue
Block a user