correctly backport 613ea6e

This commit is contained in:
narimiran
2020-04-25 15:44:38 +02:00
parent 71027936e8
commit 46d785aa40
2 changed files with 14 additions and 5 deletions

View File

@@ -573,10 +573,19 @@ proc putArgInto(arg: PNode, formal: PType): TPutArgInto =
case arg.kind
of nkEmpty..nkNilLit:
result = paDirectMapping
of nkPar, nkTupleConstr, nkCurly, nkBracket:
result = paFastAsgn
for i in 0 ..< len(arg):
if putArgInto(arg.sons[i], formal) != paDirectMapping: return
of nkDotExpr, nkDerefExpr, nkHiddenDeref, nkAddr, nkHiddenAddr:
result = putArgInto(arg[0], formal)
of nkCurly, nkBracket:
for i in 0..<arg.len:
if putArgInto(arg[i], formal) != paDirectMapping:
return paFastAsgn
result = paDirectMapping
of nkPar, nkTupleConstr, nkObjConstr:
for i in 0..<arg.len:
let a = if arg[i].kind == nkExprColonExpr: arg[i][1]
else: arg[0]
if putArgInto(a, formal) != paDirectMapping:
return paFastAsgn
result = paDirectMapping
else:
if skipTypes(formal, abstractInst).kind in {tyVar, tyLent}: result = paVarAsgn

View File

@@ -10,7 +10,7 @@ a: @[4, 2, 3]
0
30
true
41 41'''
40 40'''
"""
import allocators