privateAccess now works with ref | ptr (#17760)
This commit is contained in:
parent
d6c8efa5d4
commit
0a10af5a2c
8 changed files with 149 additions and 15 deletions
|
|
@ -578,9 +578,9 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode,
|
|||
n[0].sym.magic = mSubU
|
||||
result = n
|
||||
of mPrivateAccess:
|
||||
let sym = n[1].typ[0].sym
|
||||
assert sym != nil
|
||||
c.currentScope.allowPrivateAccess.add sym
|
||||
var t = n[1].typ[0]
|
||||
if t.kind in {tyRef, tyPtr}: t = t[0]
|
||||
c.currentScope.allowPrivateAccess.add t.sym
|
||||
result = newNodeIT(nkEmpty, n.info, getSysType(c.graph, n.info, tyVoid))
|
||||
else:
|
||||
result = n
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue