fixes #3359
This commit is contained in:
parent
0906bf5d73
commit
2210060965
2 changed files with 4 additions and 3 deletions
|
|
@ -62,7 +62,7 @@ proc evalTemplateArgs(n: PNode, s: PSym): PNode =
|
||||||
# if the template has zero arguments, it can be called without ``()``
|
# if the template has zero arguments, it can be called without ``()``
|
||||||
# `n` is then a nkSym or something similar
|
# `n` is then a nkSym or something similar
|
||||||
var totalParams = case n.kind
|
var totalParams = case n.kind
|
||||||
of nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: <n.len
|
of nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: n.len-1
|
||||||
else: 0
|
else: 0
|
||||||
|
|
||||||
var
|
var
|
||||||
|
|
@ -90,8 +90,7 @@ proc evalTemplateArgs(n: PNode, s: PSym): PNode =
|
||||||
# not supplied by the user
|
# not supplied by the user
|
||||||
for i in givenRegularParams+1 .. expectedRegularParams:
|
for i in givenRegularParams+1 .. expectedRegularParams:
|
||||||
let default = s.typ.n.sons[i].sym.ast
|
let default = s.typ.n.sons[i].sym.ast
|
||||||
internalAssert default != nil
|
if default.isNil or default.kind == nkEmpty:
|
||||||
if default.kind == nkEmpty:
|
|
||||||
localError(n.info, errWrongNumberOfArguments)
|
localError(n.info, errWrongNumberOfArguments)
|
||||||
addSon(result, ast.emptyNode)
|
addSon(result, ast.emptyNode)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -855,6 +855,8 @@ proc initEffects(effects: PNode; s: PSym; t: var TEffects) =
|
||||||
newSeq(effects.sons, effectListLen)
|
newSeq(effects.sons, effectListLen)
|
||||||
effects.sons[exceptionEffects] = newNodeI(nkArgList, s.info)
|
effects.sons[exceptionEffects] = newNodeI(nkArgList, s.info)
|
||||||
effects.sons[tagEffects] = newNodeI(nkArgList, s.info)
|
effects.sons[tagEffects] = newNodeI(nkArgList, s.info)
|
||||||
|
effects.sons[usesEffects] = ast.emptyNode
|
||||||
|
effects.sons[writeEffects] = ast.emptyNode
|
||||||
|
|
||||||
t.exc = effects.sons[exceptionEffects]
|
t.exc = effects.sons[exceptionEffects]
|
||||||
t.tags = effects.sons[tagEffects]
|
t.tags = effects.sons[tagEffects]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue