Search in sources :

Example 1 with FunctionDefinition

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

the class ScriptLoader method function.

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

Aggregations

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