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:
@@ -57,3 +57,5 @@ An `||` ("logical or") expression is reversed. If the left-hand argument is trut
|
||||
:::wren
|
||||
io.write(false || 1) // 1
|
||||
io.write(1 || 2) // 1
|
||||
|
||||
**TODO: Conditional operator.**
|
||||
|
||||
Reference in New Issue
Block a user