Skip to content

Commit d554e9d

Browse files
feat(interpreter): use the immutable reference of Context in the execute method (#291)
Co-authored-by: ADD-SP <add_sp@outlook.com>
1 parent d7e6bba commit d554e9d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/interpreter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use crate::ast::{BinaryOperator, Expression, LogicalExpression, Predicate, Value
22
use crate::context::{Context, Match};
33

44
pub trait Execute {
5-
fn execute(&self, ctx: &mut Context, m: &mut Match) -> bool;
5+
fn execute(&self, ctx: &Context, m: &mut Match) -> bool;
66
}
77

88
impl Execute for Expression {
9-
fn execute(&self, ctx: &mut Context, m: &mut Match) -> bool {
9+
fn execute(&self, ctx: &Context, m: &mut Match) -> bool {
1010
match self {
1111
Expression::Logical(l) => match l.as_ref() {
1212
LogicalExpression::And(l, r) => l.execute(ctx, m) && r.execute(ctx, m),
@@ -19,7 +19,7 @@ impl Execute for Expression {
1919
}
2020

2121
impl Execute for Predicate {
22-
fn execute(&self, ctx: &mut Context, m: &mut Match) -> bool {
22+
fn execute(&self, ctx: &Context, m: &mut Match) -> bool {
2323
let lhs_values = match ctx.value_of(&self.lhs.var_name) {
2424
None => return false,
2525
Some(v) => v,

0 commit comments

Comments
 (0)