Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh0g0-1758 committed Aug 23, 2024
1 parent 7f604db commit 54e1997
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions pkg/hintrunner/zero/hintparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,26 +197,27 @@ func (expression ArithExp) Evaluate() (hinter.Reference, error) {
leftResult = leftResult.AddOffset(off)
}
return leftResult.(hinter.Reference), nil
} else {
for _, term := range expression.AddExp {
rightExp, err := term.TermExp.Evaluate()
if err != nil {
return nil, err
}
}

op, err := parseOperator(term.Operator)
if err != nil {
return nil, err
}
for _, term := range expression.AddExp {
rightExp, err := term.TermExp.Evaluate()
if err != nil {
return nil, err
}

leftExp = hinter.BinaryOp{
Operator: op,
Lhs: leftExp,
Rhs: rightExp,
}
op, err := parseOperator(term.Operator)
if err != nil {
return nil, err
}

leftExp = hinter.BinaryOp{
Operator: op,
Lhs: leftExp,
Rhs: rightExp,
}
return leftExp, nil
}

return leftExp, nil
}

func (expression TermExp) Evaluate() (hinter.Reference, error) {
Expand Down

0 comments on commit 54e1997

Please sign in to comment.