hotfix: don't crash for wrong template calls
This commit is contained in:
parent
4e72e71284
commit
1d44fee399
2 changed files with 2 additions and 1 deletions
|
|
@ -79,7 +79,7 @@ proc evalTemplateArgs(n: PNode, s: PSym; fromHlo: bool): PNode =
|
|||
else: s.ast[genericParamsPos].len
|
||||
expectedRegularParams = <s.typ.len
|
||||
givenRegularParams = totalParams - genericParams
|
||||
|
||||
if givenRegularParams < 0: givenRegularParams = 0
|
||||
if totalParams > expectedRegularParams + genericParams:
|
||||
globalError(n.info, errWrongNumberOfArguments)
|
||||
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ proc describeArgs*(c: PContext, n: PNode, startIdx = 1;
|
|||
add(result, renderTree(n.sons[i].sons[0]))
|
||||
add(result, ": ")
|
||||
if arg.typ.isNil and arg.kind notin {nkStmtList, nkDo}:
|
||||
# XXX we really need to 'tryExpr' here!
|
||||
arg = c.semOperand(c, n.sons[i].sons[1])
|
||||
n.sons[i].typ = arg.typ
|
||||
n.sons[i].sons[1] = arg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue