(loc ast.Node, typ *super.TypeMap, bytes scode.Bytes)
| 554 | } |
| 555 | |
| 556 | func mapToExpr(loc ast.Node, typ *super.TypeMap, bytes scode.Bytes) Expr { |
| 557 | keyType := super.TypeUnder(typ.KeyType) |
| 558 | valType := super.TypeUnder(typ.ValType) |
| 559 | var entries []Entry |
| 560 | for it := bytes.Iter(); !it.Done(); { |
| 561 | key := valueToExpr(loc, keyType, it.Next()) |
| 562 | val := valueToExpr(loc, valType, it.Next()) |
| 563 | entries = append(entries, Entry{Key: key, Value: val}) |
| 564 | |
| 565 | } |
| 566 | return &MapExpr{ |
| 567 | Node: loc, |
| 568 | Entries: entries, |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | func NewCast(loc ast.Node, e Expr, typ super.Type) Expr { |
| 573 | args := []Expr{e, NewLiteral(loc, super.NewTypeValue(typ))} |
no test coverage detected