Exec implements the InterpretableV2 interface method.
(frame *ExecutionFrame)
| 874 | |
| 875 | // Exec implements the InterpretableV2 interface method. |
| 876 | func (o *evalObj) Exec(frame *ExecutionFrame) ref.Val { |
| 877 | fieldVals := make(map[string]ref.Val, len(o.fields)) |
| 878 | // If any argument is unknown or error early terminate. |
| 879 | for i, field := range o.fields { |
| 880 | val := o.vals[i].Exec(frame) |
| 881 | if types.IsUnknownOrError(val) { |
| 882 | return val |
| 883 | } |
| 884 | if o.hasOptionals && o.optionals[i] { |
| 885 | optVal, ok := val.(*types.Optional) |
| 886 | if !ok { |
| 887 | return types.LabelErrNode(o.id, invalidOptionalEntryInit(field, val)) |
| 888 | } |
| 889 | if !optVal.HasValue() { |
| 890 | delete(fieldVals, field) |
| 891 | continue |
| 892 | } |
| 893 | val = optVal.GetValue() |
| 894 | } |
| 895 | fieldVals[field] = val |
| 896 | } |
| 897 | return types.LabelErrNode(o.id, o.provider.NewValue(o.typeName, fieldVals)) |
| 898 | } |
| 899 | |
| 900 | // Eval implements the Interpretable interface method. |
| 901 | func (o *evalObj) Eval(ctx Activation) ref.Val { |
no test coverage detected