Change the map key parsing precedence from PREC_PRIMARY to PREC_UNARY in wren_compiler.c, enabling method calls (e.g., name.count), subscript access (name[0]), and unary operators (-1, ~3) as valid map keys. Add two test files: precedence.wren verifying the new key types work correctly, and bad_key_precedence.wren confirming that binary operators like addition still produce a parse error.
4 lines
49 B
Plaintext
4 lines
49 B
Plaintext
var map = {
|
|
1 + 2: "bad key" // expect error
|
|
}
|