Beispiel #1
0
func visitPhi(inst *ssa.Phi, fr *frame) {
	// In the case of channels, find the last defined channel and replace it.
	if _, ok := inst.Type().(*types.Chan); ok {
		//preds := inst.Block().Preds // PredBlocks: order is significant.
		fr.locals[inst], _ = fr.get(inst.Edges[0])
		fr.phi[inst] = inst.Edges
	}
}
Beispiel #2
0
func visitPhi(instr *ssa.Phi, infer *TypeInfer, ctx *Context) {
	loopDetectBounds(instr, infer, ctx)
	if _, ok := instr.Type().(*types.Chan); ok {
		// Replace existing non-edge extra args with the same name.
		for _, e := range instr.Edges {
		EALOOP:
			for i, ea := range ctx.F.extraargs {
				if e.Name() == ea.Name() {
					ctx.F.extraargs = append(ctx.F.extraargs[:i], ctx.F.extraargs[i+1:]...)
					break EALOOP
				}
			}
		}
		ctx.F.extraargs = append(ctx.F.extraargs, instr)
	}
}