Closure
Closure with explicit captures.
If flags.typed
is true
, this is a typed closure with a ClosureType
. In that case, flags.arrow
must be true
, and restParam
must be None
. Typed closures cannot be passed to JavaScript code. This is enforced at the type system level, since ClosureType
s are not subtypes of AnyType
. The only meaningful operation one can perform on a typed closure is to call it using ApplyTypedClosure
.
If flags.typed
is false
, this is a JavaScript closure with type AnyNotNullType
. In that case, the ptpe
or all params
and resultType
must all be AnyType
.
If flags.arrow
is true
, the closure is an Arrow Function (=>
), which does not have a this
parameter, and cannot be constructed (called with new
). If false
, it is a regular Function (function
), which does have a this
parameter of type AnyType
. Typed closures are always Arrow functions, since they do not have a this
parameter.
If flags.async
is true
, it is an async
closure. Async closures return a Promise
of their body, and can contain JSAwait nodes. flags.typed
and flags.async
cannot both be true
.
Attributes
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Treetrait TreeOrJSSpreadclass IRNodeclass Objecttrait Matchableclass Any