bugfix: c++ pattern #@ could index out of bounds

This commit is contained in:
Araq 2015-03-10 21:00:49 +01:00
commit 1bbd13f729

View file

@ -339,7 +339,8 @@ proc genPatternCall(p: BProc; ri: PNode; pat: string; typ: PType): PRope =
let typ = skipTypes(ri.sons[0].typ, abstractInst) let typ = skipTypes(ri.sons[0].typ, abstractInst)
if pat[i+1] == '+': result.app genArgNoParam(p, ri.sons[0]) if pat[i+1] == '+': result.app genArgNoParam(p, ri.sons[0])
result.app(~"(") result.app(~"(")
result.app genOtherArg(p, ri, 1, typ) if 1 < ri.len:
result.app genOtherArg(p, ri, 1, typ)
for k in j+1 .. < ri.len: for k in j+1 .. < ri.len:
result.app(~", ") result.app(~", ")
result.app genOtherArg(p, ri, k, typ) result.app genOtherArg(p, ri, k, typ)