feat: enable custom bitwise operators | and & in wren compiler and add test
Add INFIX_OPERATOR entries for TOKEN_PIPE and TOKEN_AMP with PREC_BITWISE precedence in the compiler's grammar rules, replacing the previous UNUSED entries. This allows user-defined classes to implement custom `|` and `&` operator methods. Include a new test file `test/custom_operators/bitwise.wren` that defines Amp and Pipe classes with their respective operator methods to validate the feature works correctly.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
class Amp {
|
||||
& that {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
class Pipe {
|
||||
| that {
|
||||
return
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user