More minor changes
This commit is contained in:
committed by
Ilmir Usmanov
parent
6a150fffe6
commit
4d1545d522
@@ -1282,7 +1282,7 @@ abstract class RestrictedSuspendLambda(
|
|||||||
) : RestrictedContinuationImpl(completion), FunctionBase<Any?>, SuspendFunction
|
) : RestrictedContinuationImpl(completion), FunctionBase<Any?>, SuspendFunction
|
||||||
```
|
```
|
||||||
the only difference from `SuspendLambda` is superclass. `SuspendLambda` inherits `ContinuationImpl`, while
|
the only difference from `SuspendLambda` is superclass. `SuspendLambda` inherits `ContinuationImpl`, while
|
||||||
`RestrictedSuspendLambda` inherits `RestrictedSuspendLambda`.
|
`RestrictedSuspendLambda` inherits `RestrictedContinuationImpl`.
|
||||||
|
|
||||||
#### SuspendFunction{N}
|
#### SuspendFunction{N}
|
||||||
Every suspending lambda has a special suspend functional type: `SuspendFunction{N}`, where `{N}` is the number of lambda parameters. They
|
Every suspending lambda has a special suspend functional type: `SuspendFunction{N}`, where `{N}` is the number of lambda parameters. They
|
||||||
@@ -1894,8 +1894,8 @@ fun invokeSuspend($result: Any?): Any? {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
After we resume the coroutine (its `label` value is `1`), `$result` is `42`, and it will get printed. That is right, a function returning
|
After we resume the coroutine (its `label` value is `1`), `$result` is `42`, and it will get printed. That is right, a function returning
|
||||||
`Unit` appers returning non-`Unit`. To fix the issue, we replace returns unit markers with `POP; GETSTATIC kotlin/Unit.INSTANCE` sequence.
|
`Unit` appears returning non-`Unit`. To fix the issue, we replace returns unit markers with `POP; GETSTATIC kotlin/Unit.INSTANCE` sequence.
|
||||||
That way, we ignore the value, passed to `resume` the same way as if the was no suspension. By the way, we do the same in `callSuspend` and
|
That way, we ignore the value, passed to `resume` the same way as if there was no suspension. By the way, we do the same in `callSuspend` and
|
||||||
`callSuspendBy` functions.
|
`callSuspendBy` functions.
|
||||||
|
|
||||||
However, we cannot always do the replacement, as shown in the following example:
|
However, we cannot always do the replacement, as shown in the following example:
|
||||||
|
|||||||
Reference in New Issue
Block a user