createTempVariable
abstract fun createTempVariable(recordTempVariable: (node: Identifier) -> Unit?, reservedInNestedScopes: Boolean = definedExternally): Identifier(source)
Create a unique temporary variable.
Parameters
recordTempVariable
An optional callback used to record the temporary variable name. This should usually be a reference to hoistVariableDeclaration
from a TransformationContext
, but can be undefined
if you plan to record the temporary variable manually.
reservedInNestedScopes
When true
, reserves the temporary variable name in all nested scopes during emit so that the variable can be referenced in a nested function body. This is an alternative to setting EmitFlags.ReuseTempVariableScope
on the nested function itself.