Exec implements the InterpretableV2 interface method.
(frame *ExecutionFrame)
| 1125 | |
| 1126 | // Exec implements the InterpretableV2 interface method. |
| 1127 | func (m *evalMap) Exec(frame *ExecutionFrame) ref.Val { |
| 1128 | entries := make(map[ref.Val]ref.Val, len(m.keys)) |
| 1129 | var unk *types.Unknown |
| 1130 | if !m.hasOptionals { |
| 1131 | for i, key := range m.keys { |
| 1132 | keyVal := key.Exec(frame) |
| 1133 | switch v := keyVal.(type) { |
| 1134 | case *types.Err: |
| 1135 | return v |
| 1136 | case *types.Unknown: |
| 1137 | if unk == nil { |
| 1138 | unk = v |
| 1139 | } else { |
| 1140 | unk = types.MergeUnknowns(unk, v) |
| 1141 | } |
| 1142 | } |
| 1143 | |
| 1144 | valVal := m.vals[i].Exec(frame) |
| 1145 | switch v := valVal.(type) { |
| 1146 | case *types.Err: |
| 1147 | return v |
| 1148 | case *types.Unknown: |
| 1149 | if unk == nil { |
| 1150 | unk = v |
| 1151 | } else { |
| 1152 | unk = types.MergeUnknowns(unk, v) |
| 1153 | } |
| 1154 | } |
| 1155 | entries[keyVal] = valVal |
| 1156 | } |
| 1157 | if unk != nil { |
| 1158 | trackCostCreateMap(frame, m.id, unk) |
| 1159 | return unk |
| 1160 | } |
| 1161 | res := types.NewRefValMap(m.adapter, entries) |
| 1162 | trackCostCreateMap(frame, m.id, res) |
| 1163 | return res |
| 1164 | } |
| 1165 | |
| 1166 | for i, key := range m.keys { |
| 1167 | keyVal := key.Exec(frame) |
| 1168 | switch v := keyVal.(type) { |
| 1169 | case *types.Err: |
| 1170 | return v |
| 1171 | case *types.Unknown: |
| 1172 | if unk == nil { |
| 1173 | unk = v |
| 1174 | } else { |
| 1175 | unk = types.MergeUnknowns(unk, v) |
| 1176 | } |
| 1177 | } |
| 1178 | |
| 1179 | valVal := m.vals[i].Exec(frame) |
| 1180 | switch v := valVal.(type) { |
| 1181 | case *types.Err: |
| 1182 | return v |
| 1183 | case *types.Unknown: |
| 1184 | if unk == nil { |
nothing calls this directly
no test coverage detected