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 c23bdc7 commit 9250490
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pkg/hintrunner/zero/hintparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,21 @@ func (expression ProdExp) Evaluate() (hinter.Reference, error) {
return nil, err
}

if leftOp, ok := leftExp.(hinter.Reference); ok {
if rightOp, ok := rightExp.(hinter.Reference); ok {
switch left := leftExp.(type) {
case hinter.ApCellRef, hinter.FpCellRef:
return nil, fmt.Errorf("invalid product expression")
default:
switch right := rightExp.(type) {
case hinter.ApCellRef, hinter.FpCellRef:
return nil, fmt.Errorf("invalid product expression")
default:
return hinter.BinaryOp{
Operator: hinter.Mul,
Lhs: leftOp,
Rhs: rightOp,
Lhs: left,
Rhs: right,
}, nil
}
}
return nil, fmt.Errorf("unexpected product expression")
}

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

0 comments on commit 9250490

Please sign in to comment.