@@ -609,15 +609,16 @@ proc aliases*(obj, field: PNode): bool =
609
609
610
610
proc useInstrTargets* (ins: Instr; loc: PNode): bool =
611
611
assert ins.kind == use
612
- sameTrees(ins.n, loc) or
613
- ins.n.aliases(loc) or loc.aliases(ins.n) # We can come here if loc is 'x.f' and ins.n is 'x' or the other way round.
612
+ result = sameTrees(ins.n, loc) or
613
+ ins.n.aliases(loc) or loc.aliases(ins.n)
614
+ # We can come here if loc is 'x.f' and ins.n is 'x' or the other way round.
614
615
# use x.f; question: does it affect the full 'x'? No.
615
616
# use x; question does it affect 'x.f'? Yes.
616
617
617
618
proc defInstrTargets* (ins: Instr; loc: PNode): bool =
618
619
assert ins.kind == def
619
- sameTrees(ins.n, loc) or
620
- ins.n.aliases(loc) # We can come here if loc is 'x.f' and ins.n is 'x' or the other way round.
620
+ result = sameTrees(ins.n, loc) or ins.n.aliases(loc)
621
+ # We can come here if loc is 'x.f' and ins.n is 'x' or the other way round.
621
622
# def x.f; question: does it affect the full 'x'? No.
622
623
# def x; question: does it affect the 'x.f'? Yes.
623
624
@@ -678,6 +679,10 @@ proc genDef(c: var Con; n: PNode) =
678
679
c.code.add Instr(n: n, kind: def)
679
680
elif isAnalysableFieldAccess(n, c.owner):
680
681
c.code.add Instr(n: n, kind: def)
682
+ else :
683
+ # bug #13314: An assignment to t5.w = -5 is a usage of 't5'
684
+ # we still need to gather the use information:
685
+ gen(c, n)
681
686
682
687
proc genCall(c: var Con; n: PNode) =
683
688
gen(c, n[0 ])
0 commit comments