This commit is contained in:
Araq
2013-01-08 18:20:40 +01:00
parent 20a5e37169
commit e6fc044107
2 changed files with 15 additions and 2 deletions

View File

@@ -146,7 +146,7 @@ proc genClosureCall(p: BProc, le, ri: PNode, d: var TLoc) =
proc addComma(r: PRope): PRope =
result = if r == nil: r else: con(r, ", ")
const CallPattern = "$1.ClEnv? $1.ClPrc($3$1.ClEnv) : (($4)($1.ClPrc))($2);$n"
const CallPattern = "$1.ClEnv? $1.ClPrc($3$1.ClEnv) : (($4)($1.ClPrc))($2)"
var op: TLoc
initLocExpr(p, ri.sons[0], op)
var pl: PRope
@@ -164,7 +164,7 @@ proc genClosureCall(p: BProc, le, ri: PNode, d: var TLoc) =
if i < length - 1: app(pl, ", ")
template genCallPattern =
lineF(p, cpsStmts, CallPattern, op.r, pl, pl.addComma, rawProc)
lineF(p, cpsStmts, CallPattern & ";$n", op.r, pl, pl.addComma, rawProc)
let rawProc = getRawProcType(p, typ)
if typ.sons[0] != nil:

View File

@@ -0,0 +1,13 @@
import json, tables
proc run(json_params: TTable) =
let json_elems = json_params["files"].elems
# These fail compilation.
var files = each(json_elems, proc (x: PJsonNode): string = x.str)
#var files = json_elems.each do (x: PJsonNode) -> string: x.str
echo "Hey!"
when isMainModule:
let text = """{"files": ["a", "b", "c"]}"""
run(toTable((text.parseJson).fields))