DSL: rename assert to asserting

Too much of a clash with the assert builtin.
This commit is contained in:
Emery Hemingway 2021-08-28 10:25:02 +02:00
parent 2a09e61f2b
commit 6fd02e74dd
3 changed files with 4 additions and 4 deletions

View File

@ -153,7 +153,7 @@ template onStop*(body: untyped): untyped =
proc getCurrentFacet(): Facet {.inject, used.} = facet proc getCurrentFacet(): Facet {.inject, used.} = facet
body body
template assert*(a: Preserve): untyped = template asserting*(a: Preserve): untyped =
mixin getCurrentFacet mixin getCurrentFacet
getCurrentFacet().addEndpoint do (_: Facet) -> EndpointSpec: getCurrentFacet().addEndpoint do (_: Facet) -> EndpointSpec:
result.assertion = a result.assertion = a

View File

@ -24,8 +24,8 @@ syndicate timerDriver:
if period > 0: if period > 0:
getCurrentFacet().beginExternalTask() getCurrentFacet().beginExternalTask()
addTimer(period.int, oneshot = true) do (fd: AsyncFD) -> bool: addTimer(period.int, oneshot = true) do (fd: AsyncFD) -> bool:
react: assert(TimeLaterThan % deadline) react: asserting(TimeLaterThan % deadline)
getCurrentFacet().endExternalTask() getCurrentFacet().endExternalTask()
true true
else: else:
react: assert(TimeLaterThan % deadline) react: asserting(TimeLaterThan % deadline)

View File

@ -12,7 +12,7 @@ syndicate testDsl:
spawn "box": spawn "box":
field(currentValue, int, 0) field(currentValue, int, 0)
assert(BoxState.init currentValue.get) asserting(BoxState.init currentValue.get)
stopIf currentValue.get == 10: stopIf currentValue.get == 10:
echo "box: terminating" echo "box: terminating"
onMessage(SetBox % `?*`) do (newValue: int): onMessage(SetBox % `?*`) do (newValue: int):