mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 22:33:49 +00:00
correctly backport 613ea6e
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -10,7 +10,7 @@ a: @[4, 2, 3]
|
||||
0
|
||||
30
|
||||
true
|
||||
41 41'''
|
||||
40 40'''
|
||||
"""
|
||||
|
||||
import allocators
|
||||
|
||||
Reference in New Issue
Block a user