allow referencing other parameters in default parameter values

fix #7756
fix #1201
fix #7000
fix #3002
fix #1046
This commit is contained in:
Zahary Karadjov 2018-06-16 03:51:31 +03:00
commit 31651ecd61
10 changed files with 244 additions and 31 deletions

View file

@ -402,7 +402,9 @@ proc updateDefaultParams(call: PNode) =
for i in countdown(call.len - 1, 1):
if nfDefaultParam notin call[i].flags:
return
call[i] = calleeParams[i].sym.ast
let def = calleeParams[i].sym.ast
if nfDefaultRefsParam in def.flags: call.flags.incl nfDefaultRefsParam
call[i] = def
proc semResolvedCall(c: PContext, x: TCandidate,
n: PNode, flags: TExprFlags): PNode =