Exec implements the InterpretableV2 interface method.
(frame *ExecutionFrame)
| 525 | |
| 526 | // Exec implements the InterpretableV2 interface method. |
| 527 | func (ne *evalNe) Exec(frame *ExecutionFrame) ref.Val { |
| 528 | lVal := ne.lhs.Exec(frame) |
| 529 | if isError(lVal) { |
| 530 | // To preserve legacy cost tracking behavior for !=, |
| 531 | // track this cost, but it will be removed in the future. |
| 532 | if costs := frame.CostTracker(); costs != nil { |
| 533 | costs.EvalBinary(frame, ne.id, ne, lVal, types.UnknownType, lVal) |
| 534 | } |
| 535 | return lVal |
| 536 | } |
| 537 | rVal := ne.rhs.Exec(frame) |
| 538 | if isError(rVal) { |
| 539 | // To preserve legacy cost tracking behavior for !=, |
| 540 | // track this cost, but it will be removed in the future. |
| 541 | if costs := frame.CostTracker(); costs != nil { |
| 542 | costs.EvalBinary(frame, ne.id, ne, lVal, rVal, rVal) |
| 543 | } |
| 544 | return rVal |
| 545 | } |
| 546 | if isUnknown(lVal) || isUnknown(rVal) { |
| 547 | unk := mergeBinaryUnknowns(lVal, rVal) |
| 548 | if costs := frame.CostTracker(); costs != nil { |
| 549 | costs.EvalBinary(frame, ne.id, ne, lVal, rVal, unk) |
| 550 | } |
| 551 | return unk |
| 552 | } |
| 553 | res := types.Bool(types.Equal(lVal, rVal) != types.True) |
| 554 | if costs := frame.CostTracker(); costs != nil { |
| 555 | costs.EvalBinary(frame, ne.id, ne, lVal, rVal, res) |
| 556 | } |
| 557 | return res |
| 558 | } |
| 559 | |
| 560 | // Eval implements the Interpretable interface method. |
| 561 | func (ne *evalNe) Eval(ctx Activation) ref.Val { |
nothing calls this directly
no test coverage detected