feat: add logical OR operator with short-circuit evaluation and token support
Add TOKEN_PIPEPIPE token for '||' syntax, implement or() parsing function with CODE_OR bytecode, and add VM interpreter logic that short-circuits on truthy left operand. Update .gitignore to exclude *.xccheckout files, extend test coverage for falsy behavior in and.wren and if.wren, and add comprehensive or.wren test suite verifying short-circuit semantics and truthiness rules.
This commit is contained in:
@@ -44,3 +44,8 @@ if (true) class Foo {} // no error
|
||||
// Definition in else arm.
|
||||
if (false) null else var a = io.write("ok") // expect: ok
|
||||
if (true) null else class Foo {} // no error
|
||||
|
||||
// Only false is falsy.
|
||||
if (0) io.write(0) // expect: 0
|
||||
if (null) io.write(null) // expect: null
|
||||
if ("") io.write("empty") // expect: empty
|
||||
|
||||
Reference in New Issue
Block a user