JS codegen bugfix: don't crash on wrong importcpp patterns

This commit is contained in:
Andreas Rumpf
2018-01-25 16:02:13 +01:00
parent cd26d02882
commit 1d9087245c

View File

@@ -1344,6 +1344,9 @@ proc genArgs(p: PProc, n: PNode, r: var TCompRes; start=1) =
proc genOtherArg(p: PProc; n: PNode; i: int; typ: PType;
generated: var int; r: var TCompRes) =
if i >= n.len:
globalError(n.info, "wrong importcpp pattern; expected parameter at position " & $i &
" but got only: " & $(n.len-1))
let it = n[i]
var paramType: PNode = nil
if i < sonsLen(typ):