public final class AsyncTransformHelper
extends Object
Shared AST utilities for the async/await/defer language features.
Centralises AST node construction for the parser (AstBuilder).
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static Expression |
buildAsyncCall(Expression closure)Builds AsyncSupport.async(closure) — starts immediately, returns Awaitable. |
|
public static Expression |
buildAsyncGeneratorCall(Expression closure)Builds AsyncSupport.asyncGenerator(closure) — starts immediately, returns Iterable. |
|
public static Expression |
buildAwaitCall(Expression arg)Builds AsyncSupport.await(arg) or for multi-arg:
AsyncSupport.await(Awaitable.all(arg1, arg2, ...)). |
|
public static Expression |
buildCloseIterableCall(Expression source)Builds AsyncSupport.closeIterable(source). |
|
public static Expression |
buildDeferCall(Expression action)Builds AsyncSupport.defer($__deferScope__, action). |
|
public static Expression |
buildToIterableCall(Expression source)Builds AsyncSupport.toIterable(source). |
|
public static Expression |
buildYieldReturnCall(Expression arg)Builds AsyncSupport.yieldReturn($__asyncGen__, expr). |
|
public static boolean |
containsDefer(Statement stmt)Returns true if the statement tree contains a defer call,
without descending into nested closures. |
|
public static boolean |
containsYieldReturn(Statement stmt)Returns true if the statement tree contains a yield return
call, without descending into nested closures. |
|
public static Parameter |
createGenParam()Creates the synthetic generator parameter $__asyncGen__. |
|
public static void |
injectGenParamIntoYieldReturnCalls(Statement stmt, Parameter genParam)Rewrites yieldReturn(expr) calls to yieldReturn($__asyncGen__, expr)
by injecting the generator parameter reference. |
|
public void |
visitClosureExpression(ClosureExpression expression) |
|
public void |
visitClosureExpression(ClosureExpression expression) |
|
public void |
visitClosureExpression(ClosureExpression expression) |
|
public void |
visitStaticMethodCallExpression(StaticMethodCallExpression call) |
|
public void |
visitStaticMethodCallExpression(StaticMethodCallExpression call) |
|
public void |
visitStaticMethodCallExpression(StaticMethodCallExpression call) |
|
public static Statement |
wrapWithDeferScope(Statement body)Wraps a statement block with defer scope management: |
Builds AsyncSupport.async(closure) — starts immediately, returns Awaitable.
Builds AsyncSupport.asyncGenerator(closure) — starts immediately, returns Iterable.
Builds AsyncSupport.await(arg) or for multi-arg:
AsyncSupport.await(Awaitable.all(arg1, arg2, ...)).
Builds AsyncSupport.closeIterable(source).
Builds AsyncSupport.defer($__deferScope__, action).
Builds AsyncSupport.toIterable(source).
Builds AsyncSupport.yieldReturn($__asyncGen__, expr).
Returns true if the statement tree contains a defer call,
without descending into nested closures.
Returns true if the statement tree contains a yield return
call, without descending into nested closures.
Creates the synthetic generator parameter $__asyncGen__.
Rewrites yieldReturn(expr) calls to yieldReturn($__asyncGen__, expr)
by injecting the generator parameter reference.