From 69c0a9c6fb688d382d83c165860006977dd6bf04 Mon Sep 17 00:00:00 2001 From: jcosborn Date: Tue, 30 Oct 2018 00:41:12 -0500 Subject: getTypeImpl now returns pragmas for object types (#9538) --- compiler/vmdeps.nim | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'compiler') diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index 2dfe2d91f..8aac5fb87 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -82,12 +82,9 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo; id template newIdentDefs(s): untyped = newIdentDefs(s, s.typ) - if inst: - if t.sym != nil: # if this node has a symbol - if not allowRecursion: # getTypeInst behavior: return symbol - return atomicType(t.sym) - #else: # getTypeImpl behavior: turn off recursion - # allowRecursion = false + if inst and not allowRecursion and t.sym != nil: + # getTypeInst behavior: return symbol + return atomicType(t.sym) case t.kind of tyNone: result = atomicType("none", mNone) @@ -160,9 +157,10 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo; of tyObject: if inst: result = newNodeX(nkObjectTy) - result.add newNodeI(nkEmpty, info) # pragmas not reconstructed yet - if t.sons[0] == nil: result.add newNodeI(nkEmpty, info) # handle parent object - else: + result.add t.sym.ast[2][0].copyTree # copy object pragmas + if t.sons[0] == nil: + result.add newNodeI(nkEmpty, info) + else: # handle parent object var nn = newNodeX(nkOfInherit) nn.add mapTypeToAst(t.sons[0], info) result.add nn -- cgit 1.4.1-2-gfad0