summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-04-11 02:27:12 +0200
committerAraq <rumpf_a@web.de>2015-04-11 10:01:10 +0200
commit670367e13b5310f627bb114973d7f99d4942bcc8 (patch)
treeb33d983ec4a9e5134ee5ced55584379bc5cb5ebd
parent65e01c8b687feeef20da1c3c1daded5667c9ff3b (diff)
downloadNim-670367e13b5310f627bb114973d7f99d4942bcc8.tar.gz
fixes #2508
-rw-r--r--compiler/semstmts.nim20
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 50bcca9eb..a8463cbed 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -687,6 +687,16 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) =
         #debug s.typ
       s.ast = a
       popOwner()
+    let aa = a.sons[2]
+    if aa.kind in {nkRefTy, nkPtrTy} and aa.len == 1 and
+       aa.sons[0].kind == nkObjectTy:
+      # give anonymous object a dummy symbol:
+      var st = s.typ
+      if st.kind == tyGenericBody: st = st.lastSon
+      internalAssert st.kind in {tyPtr, tyRef}
+      internalAssert st.lastSon.sym == nil
+      st.lastSon.sym = newSym(skType, getIdent(s.name.s & ":ObjectType"),
+                              getCurrOwner(), s.info)
 
 proc checkForMetaFields(n: PNode) =
   template checkMeta(t) =
@@ -730,16 +740,6 @@ proc typeSectionFinalPass(c: PContext, n: PNode) =
       checkConstructedType(s.info, s.typ)
       if s.typ.kind in {tyObject, tyTuple} and not s.typ.n.isNil:
         checkForMetaFields(s.typ.n)
-    let aa = a.sons[2]
-    if aa.kind in {nkRefTy, nkPtrTy} and aa.len == 1 and
-       aa.sons[0].kind == nkObjectTy:
-      # give anonymous object a dummy symbol:
-      var st = s.typ
-      if st.kind == tyGenericBody: st = st.lastSon
-      internalAssert st.kind in {tyPtr, tyRef}
-      internalAssert st.lastSon.sym == nil
-      st.lastSon.sym = newSym(skType, getIdent(s.name.s & ":ObjectType"),
-                              getCurrOwner(), s.info)
 
 proc semTypeSection(c: PContext, n: PNode): PNode =
   ## Processes a type section. This must be done in separate passes, in order