From 6fd02e74dd82bb74309ae4730a79802e51c51f7f Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 28 Aug 2021 10:25:02 +0200 Subject: [PATCH] DSL: rename assert to asserting Too much of a clash with the assert builtin. --- src/syndicate.nim | 2 +- src/syndicate/drivers/timers.nim | 4 ++-- tests/test_dsl.nim | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/syndicate.nim b/src/syndicate.nim index 84cb9ec..d9e00f7 100644 --- a/src/syndicate.nim +++ b/src/syndicate.nim @@ -153,7 +153,7 @@ template onStop*(body: untyped): untyped = proc getCurrentFacet(): Facet {.inject, used.} = facet body -template assert*(a: Preserve): untyped = +template asserting*(a: Preserve): untyped = mixin getCurrentFacet getCurrentFacet().addEndpoint do (_: Facet) -> EndpointSpec: result.assertion = a diff --git a/src/syndicate/drivers/timers.nim b/src/syndicate/drivers/timers.nim index e5e8489..e567bdb 100644 --- a/src/syndicate/drivers/timers.nim +++ b/src/syndicate/drivers/timers.nim @@ -24,8 +24,8 @@ syndicate timerDriver: if period > 0: getCurrentFacet().beginExternalTask() addTimer(period.int, oneshot = true) do (fd: AsyncFD) -> bool: - react: assert(TimeLaterThan % deadline) + react: asserting(TimeLaterThan % deadline) getCurrentFacet().endExternalTask() true else: - react: assert(TimeLaterThan % deadline) + react: asserting(TimeLaterThan % deadline) diff --git a/tests/test_dsl.nim b/tests/test_dsl.nim index 5c6117a..25ff257 100644 --- a/tests/test_dsl.nim +++ b/tests/test_dsl.nim @@ -12,7 +12,7 @@ syndicate testDsl: spawn "box": field(currentValue, int, 0) - assert(BoxState.init currentValue.get) + asserting(BoxState.init currentValue.get) stopIf currentValue.get == 10: echo "box: terminating" onMessage(SetBox % `?*`) do (newValue: int):