MCPcopy Create free account
hub / github.com/brimdata/super / mapToExpr

Function mapToExpr

compiler/semantic/sem/expr.go:556–570  ·  view source on GitHub ↗
(loc ast.Node, typ *super.TypeMap, bytes scode.Bytes)

Source from the content-addressed store, hash-verified

554}
555
556func 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
572func NewCast(loc ast.Node, e Expr, typ super.Type) Expr {
573 args := []Expr{e, NewLiteral(loc, super.NewTypeValue(typ))}

Callers 1

valueToExprFunction · 0.85

Calls 5

TypeUnderFunction · 0.92
valueToExprFunction · 0.85
IterMethod · 0.80
DoneMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected