mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 02:12:11 +00:00
@@ -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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user