From 5b42b3be63de04007c92959b8a9fa7c129c35000 Mon Sep 17 00:00:00 2001 From: Vedat Can Keklik Date: Sat, 23 Dec 2023 02:41:38 +0300 Subject: [PATCH] fix: TokenType removed from AST --- server/src/lang/ast/expr.rs | 58 +++++++-- server/src/lang/parser.rs | 10 +- server/src/lang/serializer.rs | 14 +-- server/src/lang/tests/generic/binary.rs | 4 +- server/src/lang/tests/generic/grouping.rs | 16 +-- server/src/lang/tests/generic/unary.rs | 4 +- server/src/lang/tests/sql/select_join.rs | 55 ++++++++ .../src/lang/tests/sql/select_projection.rs | 16 +-- server/src/runtime/eval.rs | 118 +++++++++--------- server/src/runtime/interpreter.rs | 24 ++-- server/src/runtime/resolver.rs | 6 +- 11 files changed, 202 insertions(+), 123 deletions(-) diff --git a/server/src/lang/ast/expr.rs b/server/src/lang/ast/expr.rs index 6380550a..4ca34739 100644 --- a/server/src/lang/ast/expr.rs +++ b/server/src/lang/ast/expr.rs @@ -1,7 +1,51 @@ use std::rc::Rc; +use serde::{Deserialize, Serialize}; + use super::{sql::SqlSelect, stmt::StmtId, Literal}; -use crate::lang::token::{Span, Spanned, Token, TokenType}; +use crate::lang::token::{Keyword, Span, Spanned, Symbol, Token, TokenType}; + +#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub enum Operation { + Add, + Subtract, + Multiply, + Divide, + Equal, + NotEqual, + Greater, + GreaterEqual, + Less, + LessEqual, + And, + Or, + Not, +} + +pub fn tok_type_to_op(tok_t: TokenType) -> Operation { + match tok_t { + TokenType::Symbol(sym) => match sym { + Symbol::Plus => Operation::Add, + Symbol::Minus => Operation::Subtract, + Symbol::Star => Operation::Multiply, + Symbol::Slash => Operation::Divide, + Symbol::EqualEqual => Operation::Equal, + Symbol::BangEqual => Operation::NotEqual, + Symbol::Greater => Operation::Greater, + Symbol::GreaterEqual => Operation::GreaterEqual, + Symbol::Less => Operation::Less, + Symbol::LessEqual => Operation::LessEqual, + Symbol::Bang => Operation::Not, + _ => unreachable!(), + }, + TokenType::Keyword(kw) => match kw { + Keyword::And => Operation::And, + Keyword::Or => Operation::Or, + _ => unreachable!(), + }, + _ => unreachable!(), + } +} #[derive(Debug, Eq, PartialEq)] pub enum Expr { @@ -30,12 +74,12 @@ pub enum Expr { }, Binary { left: ExprId, - operator: TokenType, + operation: Operation, right: ExprId, span: Span, }, Unary { - operator: TokenType, + operation: Operation, expr: ExprId, span: Span, }, @@ -46,7 +90,7 @@ pub enum Expr { }, Logical { left: ExprId, - operator: TokenType, + operation: Operation, right: ExprId, span: Span, }, @@ -87,12 +131,12 @@ impl Spanned for Expr { } | Expr::Binary { left: _, - operator: _, + operation: _, right: _, span, } | Expr::Unary { - operator: _, + operation: _, expr: _, span, } @@ -103,7 +147,7 @@ impl Spanned for Expr { } | Expr::Logical { left: _, - operator: _, + operation: _, right: _, span, } diff --git a/server/src/lang/parser.rs b/server/src/lang/parser.rs index a051896b..7677094f 100644 --- a/server/src/lang/parser.rs +++ b/server/src/lang/parser.rs @@ -1,4 +1,4 @@ -use super::ast::expr::{Expr, ExprId}; +use super::ast::expr::{tok_type_to_op, Expr, ExprId}; use super::ast::sql::{ SqlCollectionSubquery, SqlCompoundOperator, SqlDistinct, SqlExpr, SqlJoin, SqlJoinType, SqlLimitClause, SqlOrderByClause, SqlOrdering, SqlProjection, SqlSelect, SqlSelectCompound, @@ -50,7 +50,7 @@ macro_rules! binary { current_expr = $self.arena.expression(Expr::Binary { left, - operator: token.tok_type, + operation: tok_type_to_op(token.tok_type), right, span: $self.get_merged_span( $self.arena.get_expression(left), @@ -409,7 +409,7 @@ impl<'a> Parser<'a> { let right = self.and()?; return Ok(self.arena.expression(Expr::Logical { left: expr, - operator: op.tok_type.clone(), + operation: tok_type_to_op(op.tok_type.clone()), right, span: self.get_merged_span( self.arena.get_expression(expr), @@ -427,7 +427,7 @@ impl<'a> Parser<'a> { let right = self.equality()?; return Ok(self.arena.expression(Expr::Logical { left: expr, - operator: op.tok_type.clone(), + operation: tok_type_to_op(op.tok_type.clone()), right, span: self.get_merged_span( self.arena.get_expression(expr), @@ -468,7 +468,7 @@ impl<'a> Parser<'a> { let token = (*self.peek_bw(1)).clone(); let unary = self.unary()?; return Ok(self.arena.expression(Expr::Unary { - operator: token.tok_type, + operation: tok_type_to_op(token.tok_type), expr: unary, span: self .get_merged_span(&token.span, &self.arena.get_expression(unary).get_span()), diff --git a/server/src/lang/serializer.rs b/server/src/lang/serializer.rs index a5015c55..94bb0737 100644 --- a/server/src/lang/serializer.rs +++ b/server/src/lang/serializer.rs @@ -130,7 +130,7 @@ impl<'a> ImmutableVisitor for ProgramSerializer<'a> { .map(|x| { json!({ "core": self.visit_sql_select_core(&x.core), - "operator": format!("{:?}", x.operator), + "operation": format!("{:?}", x.operator), }) }) .collect(); @@ -200,18 +200,18 @@ impl<'a> ImmutableVisitor for ProgramSerializer<'a> { }) } Expr::Unary { - operator, + operation, expr, span: _, } => { json!({ "type": "Expr::Unary", - "operator": operator, + "operation": operation, "expr": self.visit_expr(*expr)?, }) } Expr::Binary { - operator, + operation, left, right, span: _, @@ -219,7 +219,7 @@ impl<'a> ImmutableVisitor for ProgramSerializer<'a> { json!({ "type": "Expr::Binary", "left": self.visit_expr(*left)?, - "operator": operator, + "operation": operation, "right": self.visit_expr(*right)?, }) } @@ -238,14 +238,14 @@ impl<'a> ImmutableVisitor for ProgramSerializer<'a> { } Expr::Logical { left, - operator, + operation, right, span: _, } => { json!({ "type": "Expr::Logical", "left": self.visit_expr(*left)?, - "operator": operator, + "operation": operation, "right": self.visit_expr(*right)?, }) } diff --git a/server/src/lang/tests/generic/binary.rs b/server/src/lang/tests/generic/binary.rs index 67f77427..ebb8bd2c 100644 --- a/server/src/lang/tests/generic/binary.rs +++ b/server/src/lang/tests/generic/binary.rs @@ -17,14 +17,12 @@ assert_parsing! { "type": "Stmt::Expression", "expr": { "type": "Expr::Binary", + "operation": "Add", "left": { "type": "Expr::Literal", "value": "Num(1.0)", "raw": "1" }, - "operator": { - "Symbol": "Plus" - }, "right": { "type": "Expr::Literal", "value": "Num(2.0)", diff --git a/server/src/lang/tests/generic/grouping.rs b/server/src/lang/tests/generic/grouping.rs index 5ecc76d1..4970e574 100644 --- a/server/src/lang/tests/generic/grouping.rs +++ b/server/src/lang/tests/generic/grouping.rs @@ -18,18 +18,17 @@ assert_parsing! { "type": "Stmt::Expression", "expr": { "type": "Expr::Binary", + "operation": "Multiply", "left": { "type": "Expr::Grouping", "expr": { "type": "Expr::Binary", + "operation": "Add", "left": { "raw": "1", "type": "Expr::Literal", "value": "Num(1.0)" }, - "operator": { - "Symbol": "Plus" - }, "right": { "raw": "2", "type": "Expr::Literal", @@ -37,33 +36,26 @@ assert_parsing! { } } }, - "operator": { - "Symbol": "Star" - }, "right": { "type": "Expr::Grouping", "expr": { "type": "Expr::Binary", + "operation": "Divide", "left": { "raw": "3", "type": "Expr::Literal", "value": "Num(3.0)" }, - "operator": { - "Symbol": "Slash" - }, "right": { "type": "Expr::Grouping", "expr": { "type": "Expr::Binary", + "operation": "Subtract", "left": { "raw": "4", "type": "Expr::Literal", "value": "Num(4.0)" }, - "operator": { - "Symbol": "Minus" - }, "right": { "raw": "7", "type": "Expr::Literal", diff --git a/server/src/lang/tests/generic/unary.rs b/server/src/lang/tests/generic/unary.rs index 59491fda..8a6985ca 100644 --- a/server/src/lang/tests/generic/unary.rs +++ b/server/src/lang/tests/generic/unary.rs @@ -17,9 +17,7 @@ assert_parsing! { "type": "Stmt::Expression", "expr": { "type": "Expr::Unary", - "operator": { - "Symbol": "Minus" - }, + "operation": "Subtract", "expr": { "type": "Expr::Literal", "value": "Num(1.0)", diff --git a/server/src/lang/tests/sql/select_join.rs b/server/src/lang/tests/sql/select_join.rs index a6ecde85..69400268 100644 --- a/server/src/lang/tests/sql/select_join.rs +++ b/server/src/lang/tests/sql/select_join.rs @@ -54,5 +54,60 @@ assert_parsing! { } ] } + }, + constraint: { + "SELECT * from users inner join orders on users.id = orders.user_id inner join order_items on orders.id = carts.order_id;" => { + "type": "Stmt::Program", + "body": [ + { + "type": "Stmt::Expression", + "expr": { + "type": "Expr::Select", + "value": { + "core": { + "from": { + "type": "Join", + "subquery": { + "type": "Group", + "subqueries": [{ + "type": "Collection", + "alias": null, + "name": "users", + "namespace": null, + }] + }, + "joins": [{ + "type": "Inner", + "subquery": { + "type": "Collection", + "alias": null, + "name": "orders", + "namespace": null, + }, + "constraint": null + },{ + "type": "Inner", + "subquery": { + "type": "Collection", + "alias": null, + "name": "order_items", + "namespace": null, + }, + "constraint": null + }] + }, + "projection": [{ + "type": "All", + "collection": null + }] + }, + "compound": [], + "limit": null, + "order_by": null + } + } + } + ] + } } } diff --git a/server/src/lang/tests/sql/select_projection.rs b/server/src/lang/tests/sql/select_projection.rs index 4486c687..501bcb87 100644 --- a/server/src/lang/tests/sql/select_projection.rs +++ b/server/src/lang/tests/sql/select_projection.rs @@ -200,9 +200,7 @@ assert_parsing! { "value": "Num(5.0)", "raw": "5" }, - "operator": { - "Symbol": "Plus" - }, + "operation": "Add", "right": { "type": "Expr::Literal", "value": "Num(27.0)", @@ -220,9 +218,7 @@ assert_parsing! { "value": "Num(4.0)", "raw": "4" }, - "operator": { - "Symbol": "Slash" - }, + "operation": "Divide", "right": { "type": "Expr::Literal", "value": "Num(2.0)", @@ -261,9 +257,7 @@ assert_parsing! { "value": "Num(5.0)", "raw": "5" }, - "operator": { - "Symbol": "Plus" - }, + "operation": "Add", "right": { "type": "Expr::Literal", "value": "Num(27.0)", @@ -281,9 +275,7 @@ assert_parsing! { "value": "Num(4.0)", "raw": "4" }, - "operator": { - "Symbol": "Slash" - }, + "operation": "Divide", "right": { "type": "Expr::Literal", "value": "Num(2.0)", diff --git a/server/src/runtime/eval.rs b/server/src/runtime/eval.rs index f2d903a1..6f9d4aef 100644 --- a/server/src/runtime/eval.rs +++ b/server/src/runtime/eval.rs @@ -1,8 +1,6 @@ use std::rc::Rc; -use crate::lang::token::Symbol::*; -use crate::lang::token::TokenType; -use crate::lang::token::TokenType::Symbol; +use crate::lang::ast::expr::Operation; use crate::runtime::types::RV; #[macro_export] @@ -37,87 +35,87 @@ pub fn coerce2number(val: RV) -> Option { } #[inline(always)] -pub fn eval_binary(left_eval: RV, right_eval: RV, symbol: &TokenType) -> RV { - let tok_type = symbol.clone(); - - let (left_coerced, right_coerced) = match (&left_eval, &tok_type, &right_eval) { +pub fn eval_binary(left_eval: RV, right_eval: RV, operation: Operation) -> RV { + let (left_coerced, right_coerced) = match (&left_eval, &operation, &right_eval) { (RV::Num(n), _, RV::Bool(bool)) => (RV::Num(*n), RV::Num(bool2num!(*bool))), (RV::Bool(bool), _, RV::Num(n)) => (RV::Num(bool2num!(*bool)), RV::Num(*n)), - (RV::Bool(l), Symbol(Plus), RV::Bool(r)) - | (RV::Bool(l), Symbol(Minus), RV::Bool(r)) - | (RV::Bool(l), Symbol(Star), RV::Bool(r)) - | (RV::Bool(l), Symbol(Slash), RV::Bool(r)) => { + (RV::Bool(l), Operation::Add, RV::Bool(r)) + | (RV::Bool(l), Operation::Subtract, RV::Bool(r)) + | (RV::Bool(l), Operation::Multiply, RV::Bool(r)) + | (RV::Bool(l), Operation::Divide, RV::Bool(r)) => { (RV::Num(bool2num!(*l)), RV::Num(bool2num!(*r))) } (_, _, _) => (left_eval, right_eval), }; - match (left_coerced, tok_type, right_coerced) { - (RV::Null, Symbol(EqualEqual), RV::Null) => RV::Bool(true), - (RV::Null, Symbol(BangEqual), RV::Null) => RV::Bool(false), + match (left_coerced, operation, right_coerced) { + (RV::Null, Operation::Equal, RV::Null) => RV::Bool(true), + (RV::Null, Operation::NotEqual, RV::Null) => RV::Bool(false), // - (_, Symbol(EqualEqual), RV::Null) | (RV::Null, Symbol(EqualEqual), _) => RV::Bool(false), + (_, Operation::Equal, RV::Null) | (RV::Null, Operation::Equal, _) => RV::Bool(false), // - (RV::NaN, Symbol(Plus), _) - | (_, Symbol(Plus), RV::NaN) - | (RV::NaN, Symbol(Minus), _) - | (_, Symbol(Minus), RV::NaN) - | (RV::NaN, Symbol(Star), _) - | (_, Symbol(Star), RV::NaN) - | (RV::NaN, Symbol(Slash), _) - | (_, Symbol(Slash), RV::NaN) => RV::NaN, + (RV::NaN, Operation::Add, _) + | (_, Operation::Add, RV::NaN) + | (RV::NaN, Operation::Subtract, _) + | (_, Operation::Subtract, RV::NaN) + | (RV::NaN, Operation::Multiply, _) + | (_, Operation::Multiply, RV::NaN) + | (RV::NaN, Operation::Divide, _) + | (_, Operation::Divide, RV::NaN) => RV::NaN, // - (RV::Num(l), Symbol(Plus), RV::Num(r)) => RV::Num(l + r), - (RV::Num(l), Symbol(Minus), RV::Num(r)) => RV::Num(l - r), - (RV::Num(l), Symbol(Star), RV::Num(r)) => RV::Num(l * r), - (RV::Num(l), Symbol(Slash), RV::Num(r)) => RV::Num(l / r), - (RV::Num(l), Symbol(Less), RV::Num(r)) => RV::Bool(l < r), - (RV::Num(l), Symbol(LessEqual), RV::Num(r)) => RV::Bool(l <= r), - (RV::Num(l), Symbol(Greater), RV::Num(r)) => RV::Bool(l > r), - (RV::Num(l), Symbol(GreaterEqual), RV::Num(r)) => RV::Bool(l >= r), - (RV::Num(l), Symbol(BangEqual), RV::Num(r)) => RV::Bool(l != r), - (RV::Num(l), Symbol(EqualEqual), RV::Num(r)) => RV::Bool(l == r), + (RV::Num(l), Operation::Add, RV::Num(r)) => RV::Num(l + r), + (RV::Num(l), Operation::Subtract, RV::Num(r)) => RV::Num(l - r), + (RV::Num(l), Operation::Multiply, RV::Num(r)) => RV::Num(l * r), + (RV::Num(l), Operation::Divide, RV::Num(r)) => RV::Num(l / r), + (RV::Num(l), Operation::Less, RV::Num(r)) => RV::Bool(l < r), + (RV::Num(l), Operation::LessEqual, RV::Num(r)) => RV::Bool(l <= r), + (RV::Num(l), Operation::Greater, RV::Num(r)) => RV::Bool(l > r), + (RV::Num(l), Operation::GreaterEqual, RV::Num(r)) => RV::Bool(l >= r), + (RV::Num(l), Operation::NotEqual, RV::Num(r)) => RV::Bool(l != r), + (RV::Num(l), Operation::Equal, RV::Num(r)) => RV::Bool(l == r), // - (RV::Str(l), Symbol(Plus), RV::Str(r)) => RV::Str(Rc::new(l.to_string() + &r.to_string())), - (RV::Str(l), Symbol(Less), RV::Str(r)) => RV::Bool(l < r), - (RV::Str(l), Symbol(LessEqual), RV::Str(r)) => RV::Bool(l <= r), - (RV::Str(l), Symbol(Greater), RV::Str(r)) => RV::Bool(l > r), - (RV::Str(l), Symbol(GreaterEqual), RV::Str(r)) => RV::Bool(l >= r), - (RV::Str(l), Symbol(BangEqual), RV::Str(r)) => RV::Bool(l != r), - (RV::Str(l), Symbol(EqualEqual), RV::Str(r)) => RV::Bool(l == r), + (RV::Str(l), Operation::Add, RV::Str(r)) => { + RV::Str(Rc::new(l.to_string() + &r.to_string())) + } + (RV::Str(l), Operation::Less, RV::Str(r)) => RV::Bool(l < r), + (RV::Str(l), Operation::LessEqual, RV::Str(r)) => RV::Bool(l <= r), + (RV::Str(l), Operation::Greater, RV::Str(r)) => RV::Bool(l > r), + (RV::Str(l), Operation::GreaterEqual, RV::Str(r)) => RV::Bool(l >= r), + (RV::Str(l), Operation::NotEqual, RV::Str(r)) => RV::Bool(l != r), + (RV::Str(l), Operation::Equal, RV::Str(r)) => RV::Bool(l == r), // - (RV::Bool(l), Symbol(Less), RV::Bool(r)) => RV::Bool(!l & r), - (RV::Bool(l), Symbol(LessEqual), RV::Bool(r)) => RV::Bool(l <= r), - (RV::Bool(l), Symbol(Greater), RV::Bool(r)) => RV::Bool(l & !r), - (RV::Bool(l), Symbol(GreaterEqual), RV::Bool(r)) => RV::Bool(l >= r), - (RV::Bool(l), Symbol(BangEqual), RV::Bool(r)) => RV::Bool(l != r), - (RV::Bool(l), Symbol(EqualEqual), RV::Bool(r)) => RV::Bool(l == r), + (RV::Bool(l), Operation::Less, RV::Bool(r)) => RV::Bool(!l & r), + (RV::Bool(l), Operation::LessEqual, RV::Bool(r)) => RV::Bool(l <= r), + (RV::Bool(l), Operation::Greater, RV::Bool(r)) => RV::Bool(l & !r), + (RV::Bool(l), Operation::GreaterEqual, RV::Bool(r)) => RV::Bool(l >= r), + (RV::Bool(l), Operation::NotEqual, RV::Bool(r)) => RV::Bool(l != r), + (RV::Bool(l), Operation::NotEqual, RV::Bool(r)) => RV::Bool(l == r), // - (RV::Str(s), Symbol(Plus), RV::Num(num)) => { + (RV::Str(s), Operation::Add, RV::Num(num)) => { RV::Str(Rc::new(s.to_string() + &num.to_string())) } - (RV::Num(num), Symbol(Plus), RV::Str(s)) => { + (RV::Num(num), Operation::Add, RV::Str(s)) => { RV::Str(Rc::new(num.to_string() + &s.to_string())) } // - (RV::Str(s), Symbol(Plus), RV::Bool(bool)) => { + (RV::Str(s), Operation::Add, RV::Bool(bool)) => { RV::Str(Rc::new(s.to_string() + &bool.to_string())) } - (RV::Bool(bool), Symbol(Plus), RV::Str(s)) => { + (RV::Bool(bool), Operation::Add, RV::Str(s)) => { RV::Str(Rc::new(bool.to_string() + &s.to_string())) } // - (_, Symbol(Less), _) - | (_, Symbol(LessEqual), _) - | (_, Symbol(Greater), _) - | (_, Symbol(GreaterEqual), _) - | (_, Symbol(EqualEqual), _) - | (_, Symbol(BangEqual), _) => RV::Bool(false), + (_, Operation::Less, _) + | (_, Operation::LessEqual, _) + | (_, Operation::Greater, _) + | (_, Operation::GreaterEqual, _) + | (_, Operation::Equal, _) + | (_, Operation::NotEqual, _) => RV::Bool(false), // - (_, Symbol(Plus), _) - | (_, Symbol(Minus), _) - | (_, Symbol(Star), _) - | (_, Symbol(Slash), _) => RV::NaN, + (_, Operation::Add, _) + | (_, Operation::Subtract, _) + | (_, Operation::Multiply, _) + | (_, Operation::Divide, _) => RV::NaN, // (_, _, _) => RV::Undefined, } diff --git a/server/src/runtime/interpreter.rs b/server/src/runtime/interpreter.rs index 9f9649fa..c104bceb 100644 --- a/server/src/runtime/interpreter.rs +++ b/server/src/runtime/interpreter.rs @@ -2,7 +2,7 @@ use rustc_hash::FxHashMap; use super::eval::{coerce2number, eval_binary, is_value_truthy}; use super::resolver::Resolver; -use crate::lang::ast::expr::{Expr, ExprId}; +use crate::lang::ast::expr::{Expr, ExprId, Operation}; use crate::lang::ast::stmt::{Stmt, StmtId}; use crate::lang::ast::{Literal, ParserArena, Visitor}; use crate::lang::token::TokenType; @@ -152,8 +152,8 @@ impl Interpreter { } } - fn eval_unary(&mut self, symbol: &TokenType, eidx: ExprId) -> Result { - if *symbol == sym!(Minus) { + fn eval_unary(&mut self, operation: &Operation, eidx: ExprId) -> Result { + if *operation == Operation::Subtract { if let Some(num) = coerce2number(self.visit_expr(eidx)?) { return Ok(RV::Num(-num)); } @@ -167,12 +167,12 @@ impl Interpreter { &mut self, lidx: ExprId, ridx: ExprId, - symbol: TokenType, + operation: Operation, ) -> Result { let left_eval = self.visit_expr(lidx)?; let right_eval = self.visit_expr(ridx)?; - Ok(eval_binary(left_eval, right_eval, &symbol)) + Ok(eval_binary(left_eval, right_eval, operation)) } fn look_up_variable(&self, name: &str, eid: ExprId) -> Result { @@ -258,16 +258,16 @@ impl Visitor for Interpreter { } => Ok(self.literal_to_rv(&value)), Expr::Grouping { expr, span: _ } => self.visit_expr(*expr), Expr::Unary { - operator: symbol, + operation, expr, span: _, - } => self.eval_unary(&symbol, *expr), + } => self.eval_unary(operation, *expr), Expr::Binary { - operator: symbol, + operation, left, right, span: _, - } => self.eval_binary(*left, *right, symbol.clone()), + } => self.eval_binary(*left, *right, *operation), Expr::Variable { name, span: _ } => { self.look_up_variable(name.lexeme.as_ref().unwrap(), eidx) } @@ -292,13 +292,15 @@ impl Visitor for Interpreter { } Expr::Logical { left, - operator: symbol, + operation, right, span: _, } => { let is_true = is_value_truthy(self.visit_expr(*left)?); - if (*symbol == kw!(Or) && is_true) || (*symbol == kw!(And) && !is_true) { + if (*operation == Operation::Or && is_true) + || (*operation == Operation::And && !is_true) + { return Ok(RV::Bool(is_true)); } diff --git a/server/src/runtime/resolver.rs b/server/src/runtime/resolver.rs index fac26595..bff6ecc0 100644 --- a/server/src/runtime/resolver.rs +++ b/server/src/runtime/resolver.rs @@ -92,12 +92,12 @@ impl Visitor for Resolver { } => (), Expr::Grouping { expr, span: _ } => self.resolve_expr(*expr), Expr::Unary { - operator: _, + operation: _, expr, span: _, } => self.resolve_expr(*expr), Expr::Binary { - operator: _, + operation: _, left, right, span: _, @@ -125,7 +125,7 @@ impl Visitor for Resolver { } Expr::Logical { left, - operator: _, + operation: _, right, span: _, } => {