privateAccess now works with ref | ptr (#17760)

This commit is contained in:
Timothee Cour 2021-04-18 15:15:58 -07:00 • committed by GitHub
commit 0a10af5a2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 149 additions and 15 deletions

View file

@ -258,7 +258,9 @@ proc fieldVisible*(c: PContext, f: PSym): bool {.inline.} =
for module in c.friendModules:
if fmoduleId == module.id: return true
if f.kind == skField:
let symObj = f.owner
var symObj = f.owner
if symObj.typ.kind in {tyRef, tyPtr}:
symObj = symObj.typ[0].sym
for scope in allScopes(c.currentScope):
for sym in scope.allowPrivateAccess:
if symObj.id == sym.id: return true