diff options
-rw-r--r-- | lib/pure/future.nim | 4 | ||||
-rw-r--r-- | tests/closure/tclosuremacro.nim | 40 |
2 files changed, 22 insertions, 22 deletions
diff --git a/lib/pure/future.nim b/lib/pure/future.nim index 1eb95df2c..2401c4f72 100644 --- a/lib/pure/future.nim +++ b/lib/pure/future.nim @@ -54,7 +54,7 @@ macro `=>`*(p, b: expr): expr {.immediate.} = ## ## passTwoAndTwo((x, y) => x + y) # 4 - echo treeRepr(p) + #echo treeRepr(p) #echo(treeRepr(b)) var params: seq[PNimrodNode] = @[newIdentNode("auto")] @@ -92,7 +92,7 @@ macro `=>`*(p, b: expr): expr {.immediate.} = error("Incorrect procedure parameter list.") result = newProc(params = params, body = b, procType = nnkLambda) #echo(result.treeRepr) - echo(result.toStrLit()) + #echo(result.toStrLit()) #return result # TODO: Bug? macro `->`*(p, b: expr): expr {.immediate.} = diff --git a/tests/closure/tclosuremacro.nim b/tests/closure/tclosuremacro.nim index 80d89a090..008078bbb 100644 --- a/tests/closure/tclosuremacro.nim +++ b/tests/closure/tclosuremacro.nim @@ -10,34 +10,34 @@ noReturn import future -when false: - proc twoParams(x: (int, int) -> int): int = - result = x(5, 5) +proc twoParams(x: (int, int) -> int): int = + result = x(5, 5) - proc oneParam(x: int -> int): int = - x(5) +proc oneParam(x: int -> int): int = + x(5) - proc noParams(x: () -> int): int = - result = x() +proc noParams(x: () -> int): int = + result = x() - proc noReturn(x: () -> void) = - x() +proc noReturn(x: () -> void) = + x() - proc doWithOneAndTwo(f: (int, int) -> int): int = - f(1,2) +proc doWithOneAndTwo(f: (int, int) -> int): int = + f(1,2) - echo twoParams(proc (a, b): auto = a + b) - echo twoParams((x, y) => x + y) +echo twoParams(proc (a, b): auto = a + b) +echo twoParams((x, y) => x + y) - echo oneParam(x => x+5) +echo oneParam(x => x+5) - echo noParams(() => 3) +echo noParams(() => 3) - echo doWithOneAndTwo((x, y) => x + y) +echo doWithOneAndTwo((x, y) => x + y) - noReturn(() -> void => echo("noReturn")) +noReturn(() -> void => echo("noReturn")) -proc pass2(f: (int, int) -> int): (int) -> int = - (x: int) -> int => f(2, x) +when false: + proc pass2(f: (int, int) -> int): (int) -> int = + (x: int) -> int => f(2, x) -#echo pass2((x, y) => x + y) + #echo pass2((x, y) => x + y) |