callback cannot be nil (#17718)

`Task.callback` cannot be nil, we need to raise it at debug and release mode

Situations:
- if users create a Task object without using `toTask` and invoke the Task
- if users already move the Task and invoke the Task
This commit is contained in:
flywind
2021-04-15 01:14:14 +08:00
committed by GitHub
parent 58f44c8b4e
commit 44657b78c4

View File

@@ -75,6 +75,7 @@ proc `=destroy`*(t: var Task) {.inline.} =
proc invoke*(task: Task) {.inline.} =
## Invokes the `task`.
assert task.callback != nil
task.callback(task.args)
template checkIsolate(scratchAssignList: seq[NimNode], procParam, scratchDotExpr: NimNode) =