Search in sources :

Example 1 with AsyncFunctionDefinition

use of com.github.anba.es6draft.ast.AsyncFunctionDefinition in project es6draft by anba.

the class ScriptLoader method asyncFunction.

/**
 * Parses and compiles the javascript async function.
 *
 * @param source
 *            the script source descriptor
 * @param formals
 *            the formal parameters
 * @param bodyText
 *            the async function body
 * @return the compiled async function
 * @throws ParserException
 *             if the source contains any syntax errors
 * @throws CompilationException
 *             if the parsed source could not be compiled
 */
public CompiledFunction asyncFunction(Source source, String formals, String bodyText) throws ParserException, CompilationException {
    Parser parser = new Parser(context, source);
    AsyncFunctionDefinition asyncDef = parser.parseAsyncFunction(formals, bodyText);
    return compile(asyncDef, nextFunctionName());
}
Also used : AsyncFunctionDefinition(com.github.anba.es6draft.ast.AsyncFunctionDefinition) Parser(com.github.anba.es6draft.parser.Parser)

Aggregations

AsyncFunctionDefinition (com.github.anba.es6draft.ast.AsyncFunctionDefinition)1 Parser (com.github.anba.es6draft.parser.Parser)1