fixes #4358
This commit is contained in:
parent
84c3830c6b
commit
4f7a2e9def
1 changed files with 6 additions and 3 deletions
|
|
@ -1065,8 +1065,11 @@ proc semSym(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
|
||||||
result = newSymNode(s, n.info)
|
result = newSymNode(s, n.info)
|
||||||
result.typ = makeTypeDesc(c, s.typ)
|
result.typ = makeTypeDesc(c, s.typ)
|
||||||
of skField:
|
of skField:
|
||||||
if c.p != nil and c.p.selfSym != nil:
|
var p = c.p
|
||||||
var ty = skipTypes(c.p.selfSym.typ, {tyGenericInst, tyVar, tyPtr, tyRef})
|
while p != nil and p.selfSym == nil:
|
||||||
|
p = p.next
|
||||||
|
if p != nil and p.selfSym != nil:
|
||||||
|
var ty = skipTypes(p.selfSym.typ, {tyGenericInst, tyVar, tyPtr, tyRef})
|
||||||
while tfBorrowDot in ty.flags: ty = ty.skipTypes({tyDistinct})
|
while tfBorrowDot in ty.flags: ty = ty.skipTypes({tyDistinct})
|
||||||
var check: PNode = nil
|
var check: PNode = nil
|
||||||
if ty.kind == tyObject:
|
if ty.kind == tyObject:
|
||||||
|
|
@ -1079,7 +1082,7 @@ proc semSym(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
|
||||||
markUsed(n.info, f)
|
markUsed(n.info, f)
|
||||||
styleCheckUse(n.info, f)
|
styleCheckUse(n.info, f)
|
||||||
result = newNodeIT(nkDotExpr, n.info, f.typ)
|
result = newNodeIT(nkDotExpr, n.info, f.typ)
|
||||||
result.add makeDeref(newSymNode(c.p.selfSym))
|
result.add makeDeref(newSymNode(p.selfSym))
|
||||||
result.add newSymNode(f) # we now have the correct field
|
result.add newSymNode(f) # we now have the correct field
|
||||||
if check != nil:
|
if check != nil:
|
||||||
check.sons[0] = result
|
check.sons[0] = result
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue