Function
parseCode
(key string, code interface{})
Source from the content-addressed store, hash-verified
| 230 | } |
| 231 | |
| 232 | func parseCode(key string, code interface{}) map[string]interface{} { |
| 233 | switch c := code.(type) { |
| 234 | case string: |
| 235 | l := newLexer(c) |
| 236 | result := l.parseDict() |
| 237 | if l.err != nil { |
| 238 | args := map[string]interface{}{} |
| 239 | args[key] = c |
| 240 | return args |
| 241 | } |
| 242 | return result |
| 243 | case map[string]interface{}: |
| 244 | return c |
| 245 | case map[interface{}]interface{}: |
| 246 | return util.MaybeMap(c) |
| 247 | } |
| 248 | return map[string]interface{}{key: code} |
| 249 | } |
Tested by
no test coverage detected