This commit is contained in:
Araq
2015-09-23 22:47:09 +02:00
parent 0906bf5d73
commit 2210060965
2 changed files with 4 additions and 3 deletions

View File

@@ -62,7 +62,7 @@ proc evalTemplateArgs(n: PNode, s: PSym): PNode =
# if the template has zero arguments, it can be called without ``()``
# `n` is then a nkSym or something similar
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
var
@@ -90,8 +90,7 @@ proc evalTemplateArgs(n: PNode, s: PSym): PNode =
# not supplied by the user
for i in givenRegularParams+1 .. expectedRegularParams:
let default = s.typ.n.sons[i].sym.ast
internalAssert default != nil
if default.kind == nkEmpty:
if default.isNil or default.kind == nkEmpty:
localError(n.info, errWrongNumberOfArguments)
addSon(result, ast.emptyNode)
else:

View File

@@ -855,6 +855,8 @@ proc initEffects(effects: PNode; s: PSym; t: var TEffects) =
newSeq(effects.sons, effectListLen)
effects.sons[exceptionEffects] = 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.tags = effects.sons[tagEffects]