From 18fe188c3e47a7662fa58a4066a9c3f7d9676cac Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Aug 2022 02:38:19 +0300 Subject: [PATCH] feat(tvix/compiler): implement parens precedence Change-Id: I8944354b3690d7504e4fe4254f14be5b849b9bcf Reviewed-on: https://cl.tvl.fyi/c/depot/+/6076 Tested-by: BuildkiteCI Reviewed-by: grfn --- tvix/eval/src/compiler.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs index d71eda43a..17fd01637 100644 --- a/tvix/eval/src/compiler.rs +++ b/tvix/eval/src/compiler.rs @@ -6,7 +6,7 @@ use crate::errors::EvalResult; use crate::opcode::OpCode; use crate::value::Value; use rnix; -use rnix::types::TypedNode; +use rnix::types::{TypedNode, Wrapper}; struct Compiler { chunk: Chunk, @@ -36,6 +36,11 @@ impl Compiler { self.compile_unary_op(op) } + rnix::SyntaxKind::NODE_PAREN => { + let op = rnix::types::Paren::cast(node).unwrap(); + self.compile(op.inner().unwrap()) + } + kind => { println!("visiting unsupported node: {:?}", kind); Ok(())