Do not emit object definition it if used only by ref or ptr
This commit is contained in:
parent
a9f21cffdf
commit
70b28a39fe
4 changed files with 32 additions and 1 deletions
|
|
@ -1364,6 +1364,7 @@ proc genOf(p: BProc, x: PNode, typ: PType, d: var TLoc) =
|
|||
if t.kind notin {tyVar, tyLent} or not p.module.compileToCpp:
|
||||
r = rfmt(nil, "(*$1)", r)
|
||||
t = skipTypes(t.lastSon, typedescInst)
|
||||
discard getTypeDesc(p.module, t)
|
||||
if not p.module.compileToCpp:
|
||||
while t.kind == tyObject and t.sons[0] != nil:
|
||||
add(r, ~".Sup")
|
||||
|
|
@ -2062,6 +2063,7 @@ proc upConv(p: BProc, n: PNode, d: var TLoc) =
|
|||
|
||||
proc downConv(p: BProc, n: PNode, d: var TLoc) =
|
||||
if p.module.compileToCpp:
|
||||
discard getTypeDesc(p.module, skipTypes(n[0].typ, abstractPtrs))
|
||||
expr(p, n.sons[0], d) # downcast does C++ for us
|
||||
else:
|
||||
var dest = skipTypes(n.typ, abstractPtrs)
|
||||
|
|
@ -2070,6 +2072,7 @@ proc downConv(p: BProc, n: PNode, d: var TLoc) =
|
|||
while arg.kind == nkObjDownConv: arg = arg.sons[0]
|
||||
|
||||
var src = skipTypes(arg.typ, abstractPtrs)
|
||||
discard getTypeDesc(p.module, src)
|
||||
var a: TLoc
|
||||
initLocExpr(p, arg, a)
|
||||
var r = rdLoc(a)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue