refactor(ssa): rename namedIntf to originType and simplify interface type handling
- Renamed parameter from `namedIntf` to `originType` for clarity - Removed redundant nil check since `b.abiType()` can handle both Named and Interface types - Simplified logic by always passing the origin type directly to `b.abiType()` 🤖 Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
This commit is contained in:
@@ -43,16 +43,11 @@ func (b Builder) newItab(tintf, typ Expr) Expr {
|
|||||||
return b.Call(b.Pkg.rtFunc("NewItab"), tintf, typ)
|
return b.Call(b.Pkg.rtFunc("NewItab"), tintf, typ)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b Builder) unsafeInterface(rawIntf *types.Interface, namedIntf types.Type, t Expr, data llvm.Value) llvm.Value {
|
func (b Builder) unsafeInterface(rawIntf *types.Interface, originType types.Type, t Expr, data llvm.Value) llvm.Value {
|
||||||
if rawIntf.Empty() {
|
if rawIntf.Empty() {
|
||||||
return b.unsafeEface(t.impl, data)
|
return b.unsafeEface(t.impl, data)
|
||||||
}
|
}
|
||||||
var tintf Expr
|
tintf := b.abiType(originType)
|
||||||
if namedIntf != nil {
|
|
||||||
tintf = b.abiType(namedIntf)
|
|
||||||
} else {
|
|
||||||
tintf = b.abiType(rawIntf)
|
|
||||||
}
|
|
||||||
itab := b.newItab(tintf, t)
|
itab := b.newItab(tintf, t)
|
||||||
return b.unsafeIface(itab.impl, data)
|
return b.unsafeIface(itab.impl, data)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user