about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-02-28T11·01+0200
committertazjin <mail@tazj.in>2021-02-28T11·14+0000
commit47c1a9a2804ebbc5acb83ab40ef75beb319f28e3 (patch)
tree3df064916755090166f5a9ba7aba69d489a74ed7 /users
parent995d024f03d99726de5b22bdf5aaa04a88e00b4a (diff)
fix(tazjin/rlox): Fix selection of next parser precedence rule r/2248
Without this fix we would keep parsing in the same precedence level
and get weird things like:

    10 - -10 + 10
    => 10

Change-Id: If2bed4569fbf566027011037165a9b3c09b7427c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2567
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
Diffstat (limited to 'users')
-rw-r--r--users/tazjin/rlox/src/bytecode/compiler.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/users/tazjin/rlox/src/bytecode/compiler.rs b/users/tazjin/rlox/src/bytecode/compiler.rs
index ca56bfe7cf50..4c6a99a181c6 100644
--- a/users/tazjin/rlox/src/bytecode/compiler.rs
+++ b/users/tazjin/rlox/src/bytecode/compiler.rs
@@ -166,7 +166,7 @@ impl<T: Iterator<Item = Token>> Compiler<T> {
 
         // Compile the right operand
         let rule: ParseRule<T> = rule_for(&operator);
-        self.parse_precedence(rule.precedence)?;
+        self.parse_precedence(rule.precedence.next())?;
 
         // Emit operator instruction
         match operator {