diff options
author | cooldome <cdome@bk.ru> | 2020-03-16 12:40:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 13:40:40 +0100 |
commit | 613ea6e85e8289fee92c396e07f8f1b2a991167f (patch) | |
tree | 41316bed21fa3a3ad5230f9183b401597863cbaf /compiler | |
parent | fe53f6ef4f4fe296d70c68b8c56d3c8afa06a168 (diff) | |
download | Nim-613ea6e85e8289fee92c396e07f8f1b2a991167f.tar.gz |
fixes #12747 [backport] (#13651)
* fixes #12747 * fix tests * improve code style Co-authored-by: cooldome <ariabushenko@bk.ru>
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/transf.nim | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/compiler/transf.nim b/compiler/transf.nim index cd5eaa100..c1af6c23f 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -565,10 +565,19 @@ proc putArgInto(arg: PNode, formal: PType): TPutArgInto = case arg.kind of nkEmpty..nkNilLit: result = paDirectMapping - of nkPar, nkTupleConstr, nkCurly, nkBracket: - result = paFastAsgn + 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 + 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 |