make semObjConstr robust for nimsuggest
This commit is contained in:
parent
d862d22723
commit
e01d2244e4
1 changed files with 3 additions and 3 deletions
|
|
@ -2084,9 +2084,8 @@ proc checkInitialized(n: PNode, ids: IntSet, info: TLineInfo) =
|
||||||
|
|
||||||
proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||||
var t = semTypeNode(c, n.sons[0], nil)
|
var t = semTypeNode(c, n.sons[0], nil)
|
||||||
result = n
|
result = newNodeIT(nkObjConstr, n.info, t)
|
||||||
result.typ = t
|
result.add n.sons[0]
|
||||||
result.kind = nkObjConstr
|
|
||||||
t = skipTypes(t, {tyGenericInst, tyAlias})
|
t = skipTypes(t, {tyGenericInst, tyAlias})
|
||||||
if t.kind == tyRef: t = skipTypes(t.sons[0], {tyGenericInst, tyAlias})
|
if t.kind == tyRef: t = skipTypes(t.sons[0], {tyGenericInst, tyAlias})
|
||||||
if t.kind != tyObject:
|
if t.kind != tyObject:
|
||||||
|
|
@ -2125,6 +2124,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||||
else:
|
else:
|
||||||
localError(it.info, errUndeclaredFieldX, id.s)
|
localError(it.info, errUndeclaredFieldX, id.s)
|
||||||
it.sons[1] = e
|
it.sons[1] = e
|
||||||
|
result.add it
|
||||||
# XXX object field name check for 'case objects' if the kind is static?
|
# XXX object field name check for 'case objects' if the kind is static?
|
||||||
if tfNeedsInit in objType.flags:
|
if tfNeedsInit in objType.flags:
|
||||||
while true:
|
while true:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue