This commit is contained in:
cooldome
2018-03-20 10:14:47 +00:00
committed by Andreas Rumpf
parent a581118d0e
commit 23230572e2
2 changed files with 17 additions and 2 deletions

View File

@@ -965,6 +965,7 @@ proc genAsmOrEmitStmt(p: BProc, t: PNode, isAsmStmt=false): Rope =
elif sym.kind == skType:
res.add($getTypeDesc(p.module, sym.typ))
else:
discard getTypeDesc(p.module, skipTypes(sym.typ, abstractPtrs))
var r = sym.loc.r
if r == nil:
# if no name has already been given,
@@ -975,10 +976,10 @@ proc genAsmOrEmitStmt(p: BProc, t: PNode, isAsmStmt=false): Rope =
of nkTypeOfExpr:
res.add($getTypeDesc(p.module, t.sons[i].typ))
else:
discard getTypeDesc(p.module, skipTypes(t[i].typ, abstractPtrs))
var a: TLoc
initLocExpr(p, t.sons[i], a)
initLocExpr(p, t[i], a)
res.add($a.rdLoc)
#internalError(t.sons[i].info, "genAsmOrEmitStmt()")
if isAsmStmt and hasGnuAsm in CC[cCompiler].props:
for x in splitLines(res):

View File

@@ -13,3 +13,17 @@ type AnotherType = object
let x = AnotherType(f: newMyRefObject("hello"))
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)