Exemplo n.º 1
0
func visitMakeInterface(inst *ssa.MakeInterface, fr *frame) {
	switch vd, kind := fr.get(inst.X); kind {
	case Struct, LocalStruct:
		fmt.Fprintf(os.Stderr, "   %s <-(struct/iface)- %s %s = %s\n", cyan(reg(inst)), reg(inst.X), inst.String(), vd.String())
		fr.locals[inst] = vd

	case Array, LocalArray:
		fmt.Fprintf(os.Stderr, "   %s <-(array/iface)- %s %s = %s\n", cyan(reg(inst)), reg(inst.X), inst.String(), vd.String())
		fr.locals[inst] = vd

	default:
		fmt.Fprintf(os.Stderr, "   # %s <- %s\n", red(reg(inst)), inst.String())
	}
}
Exemplo n.º 2
0
func visitMakeInterface(instr *ssa.MakeInterface, infer *TypeInfer, ctx *Context) {
	iface, ok := ctx.F.locals[instr.X]
	if !ok {
		if c, ok := instr.X.(*ssa.Const); ok {
			ctx.F.locals[instr.X] = &Const{c}
		} else {
			infer.Logger.Fatalf("make-iface: %s: %s", ErrUnknownValue, instr.X)
			return
		}
	}
	ctx.F.locals[instr] = iface
	infer.Logger.Print(ctx.F.Sprintf(SkipSymbol+"%s = make-iface %s", ctx.F.locals[instr], instr.String()))
}