fixes double object field symbol lookups (no test case available) (#10450)

This commit is contained in:
cooldome
2019-01-25 08:25:11 +00:00
committed by Andreas Rumpf
parent 43613ff49d
commit 1c2abb8d88

View File

@@ -1291,7 +1291,11 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
if ty.sons[0] == nil: break
ty = skipTypes(ty.sons[0], skipPtrs)
if f != nil:
if fieldVisible(c, f):
let visibilityCheckNeeded =
if n[1].kind == nkSym and n[1].sym == f:
false # field lookup was done already, likely by hygienic template or bindSym
else: true
if not visibilityCheckNeeded or fieldVisible(c, f):
# is the access to a public field or in the same module or in a friend?
markUsed(c.config, n.sons[1].info, f, c.graph.usageSym)
onUse(n.sons[1].info, f)