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

Method Call

runtime/sam/expr/function/fusion.go:21–37  ·  view source on GitHub ↗
(args []super.Value)

Source from the content-addressed store, hash-verified

19}
20
21func (f *fusion) Call(args []super.Value) super.Value {
22 superVal, subTypeVal := args[0], args[1]
23 if _, ok := super.TypeUnder(subTypeVal.Type()).(*super.TypeOfType); !ok {
24 return f.sctx.WrapError("fusion: super type argument not a type", subTypeVal)
25 }
26 subType, err := f.sctx.LookupByValue(subTypeVal.Bytes())
27 if err != nil {
28 panic(err)
29 }
30 if _, ok := f.downcast.Cast(superVal, subType); !ok {
31 return f.sctx.WrapError("fusion: value not a supertype of subtype arg: "+sup.FormatType(subType), superVal)
32 }
33 typ := f.sctx.LookupTypeFusion(superVal.Type())
34 var b scode.Builder
35 super.BuildFusion(&b, superVal.Bytes(), subTypeVal.Bytes())
36 return super.NewValue(typ, b.Bytes().Body())
37}

Callers

nothing calls this directly

Calls 12

BytesMethod · 0.95
TypeUnderFunction · 0.92
FormatTypeFunction · 0.92
BuildFusionFunction · 0.92
NewValueFunction · 0.92
WrapErrorMethod · 0.80
LookupByValueMethod · 0.80
LookupTypeFusionMethod · 0.80
BodyMethod · 0.80
TypeMethod · 0.65
CastMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected