Exec implements the InterpretableV2 interface method.
(frame *ExecutionFrame)
| 460 | |
| 461 | // Exec implements the InterpretableV2 interface method. |
| 462 | func (eq *evalEq) Exec(frame *ExecutionFrame) ref.Val { |
| 463 | lVal := eq.lhs.Exec(frame) |
| 464 | if isError(lVal) { |
| 465 | // To preserve legacy cost tracking behavior for == |
| 466 | // track this cost, but it will be removed in the future. |
| 467 | if costs := frame.CostTracker(); costs != nil { |
| 468 | costs.EvalBinary(frame, eq.id, eq, lVal, types.UnknownType, lVal) |
| 469 | } |
| 470 | return lVal |
| 471 | } |
| 472 | rVal := eq.rhs.Exec(frame) |
| 473 | if isError(rVal) { |
| 474 | // To preserve legacy cost tracking behavior for ==, |
| 475 | // track this cost, but it will be removed in the future. |
| 476 | if costs := frame.CostTracker(); costs != nil { |
| 477 | costs.EvalBinary(frame, eq.id, eq, lVal, rVal, rVal) |
| 478 | } |
| 479 | return rVal |
| 480 | } |
| 481 | if isUnknown(lVal) || isUnknown(rVal) { |
| 482 | unk := mergeBinaryUnknowns(lVal, rVal) |
| 483 | if costs := frame.CostTracker(); costs != nil { |
| 484 | costs.EvalBinary(frame, eq.id, eq, lVal, rVal, unk) |
| 485 | } |
| 486 | return unk |
| 487 | } |
| 488 | res := types.Equal(lVal, rVal) |
| 489 | if costs := frame.CostTracker(); costs != nil { |
| 490 | costs.EvalBinary(frame, eq.id, eq, lVal, rVal, res) |
| 491 | } |
| 492 | return res |
| 493 | } |
| 494 | |
| 495 | // Eval implements the Interpretable interface method. |
| 496 | func (eq *evalEq) Eval(ctx Activation) ref.Val { |
nothing calls this directly
no test coverage detected