Fix parser to allow binary operators for binding syntax (#3326)
Previously, the precedence of `as` binding was higher than the binary
operators. This results in unexpected behaviors, `1 + 2 as $x | -$x`
was `-1` instead of `-3`. The commit 92daac90f6 (PR #3053) changed
the behavior to emit syntax error on this case. Now, this commit allows
binary operators with `as` binding. This fixes #2446, and fixes #3284.
This commit is contained in:
1 parent
4e3088f188
commit
aaace5432a
3 files changed
+522
-524
No files matched your search
+1
-1
@@ -325,7 +325,7 @@ Query:
|
||||
FuncDef Query %prec FUNCDEF {
|
||||
$$ = block_bind_referenced($1, $2, OP_IS_CALL_PSEUDO);
|
||||
} |
|
||||
Term "as" Patterns '|' Query {
|
||||
Expr "as" Patterns '|' Query {
|
||||
$$ = gen_destructure($1, $3, $5);
|
||||
} |
|
||||
"label" BINDING '|' Query {
|
||||
|
||||
Reference in new issue
Block a user