From 5450760a3feddd7c0939ef30a605c19aa7e49d54 Mon Sep 17 00:00:00 2001 From: Smooth Operator Date: Mon, 3 Oct 2022 10:54:20 -0400 Subject: [PATCH] 0.6.2: support broken nim compilers --- cps.nim | 21 +++++++++++---------- cps.nimble | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cps.nim b/cps.nim index face9f3c..daa42c68 100644 --- a/cps.nim +++ b/cps.nim @@ -301,13 +301,14 @@ template recover*(c: Continuation): untyped {.used.} = ## Returns the result, i.e. the return value, of a continuation. discard -{.push experimental: "callOperator".} - -macro `()`*[C; R; P](callback: Callback[C, R, P]; arguments: varargs[typed]): R = - ## Allows for natural use of call syntax to invoke a callback and - ## recover its result in a single statement, inside a continuation. - let call = bindSym"call" - result = newCall(call, callback) - for argument in arguments.items: - result.add argument - result = newCall(bindSym"recover", callback, result) +when not defined cpsNoCallOperator: + {.push experimental: "callOperator".} + + macro `()`*[C; R; P](callback: Callback[C, R, P]; arguments: varargs[typed]): R = + ## Allows for natural use of call syntax to invoke a callback and + ## recover its result in a single statement, inside a continuation. + let call = bindSym"call" + result = newCall(call, callback) + for argument in arguments.items: + result.add argument + result = newCall(bindSym"recover", callback, result) diff --git a/cps.nimble b/cps.nimble index d1ef7090..3d63b315 100644 --- a/cps.nimble +++ b/cps.nimble @@ -1,4 +1,4 @@ -version = "0.6.1" +version = "0.6.2" author = "disruptek" description = "continuation-passing style" license = "MIT"