From e01d2244e41603e0818dea8a98f4b23f9b3cf387 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 21 Mar 2017 13:02:38 +0100 Subject: [PATCH] make semObjConstr robust for nimsuggest --- compiler/semexprs.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 32f74e0509..39113079ab 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -2084,9 +2084,8 @@ proc checkInitialized(n: PNode, ids: IntSet, info: TLineInfo) = proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = var t = semTypeNode(c, n.sons[0], nil) - result = n - result.typ = t - result.kind = nkObjConstr + result = newNodeIT(nkObjConstr, n.info, t) + result.add n.sons[0] t = skipTypes(t, {tyGenericInst, tyAlias}) if t.kind == tyRef: t = skipTypes(t.sons[0], {tyGenericInst, tyAlias}) if t.kind != tyObject: @@ -2125,6 +2124,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = else: localError(it.info, errUndeclaredFieldX, id.s) it.sons[1] = e + result.add it # XXX object field name check for 'case objects' if the kind is static? if tfNeedsInit in objType.flags: while true: