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());
}
Aggregations