Make sure that field usage preserves the original line info (#19751)
Currently `struct.field` will generate a node with `info` that points to the symbol definition instead of having the actual node location.
This commit is contained in:
parent
8bfc396a4d
commit
e4a2c2d474
2 changed files with 17 additions and 0 deletions
|
|
@ -1436,8 +1436,10 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
|||
# is the access to a public field or in the same module or in a friend?
|
||||
markUsed(c, n[1].info, f)
|
||||
onUse(n[1].info, f)
|
||||
let info = n[1].info
|
||||
n[0] = makeDeref(n[0])
|
||||
n[1] = newSymNode(f) # we now have the correct field
|
||||
n[1].info = info # preserve the original info
|
||||
n.typ = f.typ
|
||||
if check == nil:
|
||||
result = n
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue