Exec implements the InterpretableV2 interface method.
(frame *ExecutionFrame)
| 252 | |
| 253 | // Exec implements the InterpretableV2 interface method. |
| 254 | func (test *evalTestOnly) Exec(frame *ExecutionFrame) ref.Val { |
| 255 | val, err := test.Resolve(frame) |
| 256 | var res ref.Val |
| 257 | // Return an error if the resolve step fails |
| 258 | if err != nil { |
| 259 | res = types.LabelErrNode(test.id, types.WrapErr(err)) |
| 260 | } else if optVal, isOpt := val.(*types.Optional); isOpt { |
| 261 | res = types.Bool(optVal.HasValue()) |
| 262 | } else { |
| 263 | res = test.Adapter().NativeToValue(val) |
| 264 | } |
| 265 | if costs := frame.CostTracker(); costs != nil { |
| 266 | costs.EvalAttribute(test.id, true, res) |
| 267 | } |
| 268 | return res |
| 269 | } |
| 270 | |
| 271 | // Eval implements the Interpretable interface method. |
| 272 | func (test *evalTestOnly) Eval(ctx Activation) ref.Val { |
nothing calls this directly
no test coverage detected