compiler: Handle nkCheckedFieldExpr better in dfa (#19616)
Simply recurse into their first child, which is always a nkDotExpr instead of treating them seperately. This fixes the rhs sym of a nkCheckedFieldExpr being checked twice in aliases. This double checking didn't cause any issues, but was unintentional and redundant.
This commit is contained in:
parent
7b811deeff
commit
3e83d73f27
1 changed files with 2 additions and 4 deletions
|
|
@ -605,11 +605,11 @@ proc aliases*(obj, field: PNode): AliasKind =
|
||||||
var n = n
|
var n = n
|
||||||
while true:
|
while true:
|
||||||
case n.kind
|
case n.kind
|
||||||
of PathKinds0 - {nkDotExpr, nkCheckedFieldExpr, nkBracketExpr}:
|
of PathKinds0 - {nkDotExpr, nkBracketExpr}:
|
||||||
n = n[0]
|
n = n[0]
|
||||||
of PathKinds1:
|
of PathKinds1:
|
||||||
n = n[1]
|
n = n[1]
|
||||||
of nkDotExpr, nkCheckedFieldExpr, nkBracketExpr:
|
of nkDotExpr, nkBracketExpr:
|
||||||
result.add n
|
result.add n
|
||||||
n = n[0]
|
n = n[0]
|
||||||
of nkSym:
|
of nkSym:
|
||||||
|
|
@ -642,8 +642,6 @@ proc aliases*(obj, field: PNode): AliasKind =
|
||||||
if currFieldPath.sym != currObjPath.sym: return no
|
if currFieldPath.sym != currObjPath.sym: return no
|
||||||
of nkDotExpr:
|
of nkDotExpr:
|
||||||
if currFieldPath[1].sym != currObjPath[1].sym: return no
|
if currFieldPath[1].sym != currObjPath[1].sym: return no
|
||||||
of nkCheckedFieldExpr:
|
|
||||||
if currFieldPath[0][1].sym != currObjPath[0][1].sym: return no
|
|
||||||
of nkBracketExpr:
|
of nkBracketExpr:
|
||||||
if currFieldPath[1].kind in nkLiterals and currObjPath[1].kind in nkLiterals:
|
if currFieldPath[1].kind in nkLiterals and currObjPath[1].kind in nkLiterals:
|
||||||
if currFieldPath[1].intVal != currObjPath[1].intVal:
|
if currFieldPath[1].intVal != currObjPath[1].intVal:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue