mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
Fix named argument handling
Instead of trying to use the whole parameter, it uses just the RHS, as expected
This commit is contained in:
@@ -149,10 +149,19 @@ macro check*(conditions: stmt): stmt {.immediate.} =
|
||||
inc counter
|
||||
var arg = newIdentNode(":p" & $counter)
|
||||
var argStr = exp[i].toStrLit
|
||||
var paramAst = exp[i]
|
||||
if exp[i].kind in nnkCallKinds: inspectArgs(exp[i])
|
||||
argsAsgns.add getAst(asgn(arg, exp[i]))
|
||||
if exp[i].kind == nnkExprEqExpr:
|
||||
# ExprEqExpr
|
||||
# Ident !"v"
|
||||
# IntLit 2
|
||||
paramAst = exp[i][1]
|
||||
argsAsgns.add getAst(asgn(arg, paramAst))
|
||||
argsPrintOuts.add getAst(print(argStr, arg))
|
||||
exp[i] = arg
|
||||
if exp[i].kind != nnkExprEqExpr:
|
||||
exp[i] = arg
|
||||
else:
|
||||
exp[i][1] = arg
|
||||
|
||||
case checked.kind
|
||||
of nnkCallKinds:
|
||||
|
||||
Reference in New Issue
Block a user