fixes #299
This commit is contained in:
parent
20a5e37169
commit
e6fc044107
2 changed files with 15 additions and 2 deletions
|
|
@ -146,7 +146,7 @@ proc genClosureCall(p: BProc, le, ri: PNode, d: var TLoc) =
|
||||||
proc addComma(r: PRope): PRope =
|
proc addComma(r: PRope): PRope =
|
||||||
result = if r == nil: r else: con(r, ", ")
|
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
|
var op: TLoc
|
||||||
initLocExpr(p, ri.sons[0], op)
|
initLocExpr(p, ri.sons[0], op)
|
||||||
var pl: PRope
|
var pl: PRope
|
||||||
|
|
@ -164,7 +164,7 @@ proc genClosureCall(p: BProc, le, ri: PNode, d: var TLoc) =
|
||||||
if i < length - 1: app(pl, ", ")
|
if i < length - 1: app(pl, ", ")
|
||||||
|
|
||||||
template genCallPattern =
|
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)
|
let rawProc = getRawProcType(p, typ)
|
||||||
if typ.sons[0] != nil:
|
if typ.sons[0] != nil:
|
||||||
|
|
|
||||||
13
tests/compile/tclosure4.nim
Normal file
13
tests/compile/tclosure4.nim
Normal 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))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue