new move analyser2 (#20471)
* produce better code for closure environment creation * new 'first write' analysis; * scope based move analyser * code cleanup Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
This commit is contained in:
parent
cfff454cf9
commit
8d47bf1822
19 changed files with 472 additions and 684 deletions
|
|
@ -183,7 +183,7 @@ type
|
|||
arLentValue, # lent value
|
||||
arStrange # it is a strange beast like 'typedesc[var T]'
|
||||
|
||||
proc exprRoot*(n: PNode): PSym =
|
||||
proc exprRoot*(n: PNode; allowCalls = true): PSym =
|
||||
var it = n
|
||||
while true:
|
||||
case it.kind
|
||||
|
|
@ -204,7 +204,7 @@ proc exprRoot*(n: PNode): PSym =
|
|||
if it.len > 0 and it.typ != nil: it = it.lastSon
|
||||
else: break
|
||||
of nkCallKinds:
|
||||
if it.typ != nil and it.typ.kind in {tyVar, tyLent} and it.len > 1:
|
||||
if allowCalls and it.typ != nil and it.typ.kind in {tyVar, tyLent} and it.len > 1:
|
||||
# See RFC #7373, calls returning 'var T' are assumed to
|
||||
# return a view into the first argument (if there is one):
|
||||
it = it[1]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue