cl: _testcgo/any
This commit is contained in:
@@ -324,11 +324,12 @@ func (p *context) compileInstrAndValue(b llssa.Builder, iv instrAndValue) (ret l
|
||||
}
|
||||
ret = b.Alloc(p.prog.Type(t), v.Heap)
|
||||
case *ssa.MakeInterface:
|
||||
const (
|
||||
delayExpr = true // varargs: don't need to convert an expr to any
|
||||
)
|
||||
t := v.Type()
|
||||
if isAny(t) { // varargs: don't need to convert an expr to any
|
||||
return
|
||||
}
|
||||
panic("todo")
|
||||
x := p.compileValue(b, v.X)
|
||||
ret = b.MakeInterface(t, x, delayExpr)
|
||||
case *ssa.TypeAssert:
|
||||
x := p.compileValue(b, v.X)
|
||||
ret = b.TypeAssert(x, p.prog.Type(v.AssertedType), v.CommaOk)
|
||||
@@ -417,6 +418,9 @@ func (p *context) compileVArg(ret []llssa.Expr, b llssa.Builder, v ssa.Value) []
|
||||
switch v := v.(type) {
|
||||
case *ssa.Slice: // varargs: this is a varargs slice
|
||||
if args, ok := p.isVArgs(v.X); ok {
|
||||
for i, arg := range args {
|
||||
args[i] = arg.Do(true)
|
||||
}
|
||||
return append(ret, args...)
|
||||
}
|
||||
case *ssa.Const:
|
||||
@@ -431,7 +435,7 @@ func (p *context) compileValues(b llssa.Builder, vals []ssa.Value, hasVArg int)
|
||||
n := len(vals) - hasVArg
|
||||
ret := make([]llssa.Expr, n)
|
||||
for i := 0; i < n; i++ {
|
||||
ret[i] = p.compileValue(b, vals[i])
|
||||
ret[i] = p.compileValue(b, vals[i]).Do(false)
|
||||
}
|
||||
if hasVArg > 0 {
|
||||
ret = p.compileVArg(ret, b, vals[n])
|
||||
|
||||
Reference in New Issue
Block a user