(args []super.Value)
| 19 | } |
| 20 | |
| 21 | func (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 | } |
nothing calls this directly
no test coverage detected