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
commit 44657b78c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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