parent
a581118d0e
commit
23230572e2
2 changed files with 17 additions and 2 deletions
|
|
@ -965,6 +965,7 @@ proc genAsmOrEmitStmt(p: BProc, t: PNode, isAsmStmt=false): Rope =
|
||||||
elif sym.kind == skType:
|
elif sym.kind == skType:
|
||||||
res.add($getTypeDesc(p.module, sym.typ))
|
res.add($getTypeDesc(p.module, sym.typ))
|
||||||
else:
|
else:
|
||||||
|
discard getTypeDesc(p.module, skipTypes(sym.typ, abstractPtrs))
|
||||||
var r = sym.loc.r
|
var r = sym.loc.r
|
||||||
if r == nil:
|
if r == nil:
|
||||||
# if no name has already been given,
|
# if no name has already been given,
|
||||||
|
|
@ -975,10 +976,10 @@ proc genAsmOrEmitStmt(p: BProc, t: PNode, isAsmStmt=false): Rope =
|
||||||
of nkTypeOfExpr:
|
of nkTypeOfExpr:
|
||||||
res.add($getTypeDesc(p.module, t.sons[i].typ))
|
res.add($getTypeDesc(p.module, t.sons[i].typ))
|
||||||
else:
|
else:
|
||||||
|
discard getTypeDesc(p.module, skipTypes(t[i].typ, abstractPtrs))
|
||||||
var a: TLoc
|
var a: TLoc
|
||||||
initLocExpr(p, t.sons[i], a)
|
initLocExpr(p, t[i], a)
|
||||||
res.add($a.rdLoc)
|
res.add($a.rdLoc)
|
||||||
#internalError(t.sons[i].info, "genAsmOrEmitStmt()")
|
|
||||||
|
|
||||||
if isAsmStmt and hasGnuAsm in CC[cCompiler].props:
|
if isAsmStmt and hasGnuAsm in CC[cCompiler].props:
|
||||||
for x in splitLines(res):
|
for x in splitLines(res):
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,17 @@ type AnotherType = object
|
||||||
let x = AnotherType(f: newMyRefObject("hello"))
|
let x = AnotherType(f: newMyRefObject("hello"))
|
||||||
echo $x.f
|
echo $x.f
|
||||||
|
|
||||||
|
|
||||||
|
# bug #7363
|
||||||
|
|
||||||
|
type
|
||||||
|
Foo = object
|
||||||
|
a: cint
|
||||||
|
Foo2 = object
|
||||||
|
b: cint
|
||||||
|
|
||||||
|
proc f(foo: ptr Foo, foo2: ptr Foo2): cint =
|
||||||
|
if foo != nil: {.emit: "`result` = `foo`->a;".}
|
||||||
|
if foo2 != nil: {.emit: [result, " = ", foo2[], ".b;"].}
|
||||||
|
|
||||||
|
discard f(nil, nil)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue