use of com.github.anba.es6draft.ast.GeneratorDefinition in project es6draft by anba.
the class ScriptLoader method generator.
/**
* Parses and compiles the javascript generator function.
*
* @param source
* the script source descriptor
* @param formals
* the formal parameters
* @param bodyText
* the generator function body
* @return the compiled generator function
* @throws ParserException
* if the source contains any syntax errors
* @throws CompilationException
* if the parsed source could not be compiled
*/
public CompiledFunction generator(Source source, String formals, String bodyText) throws ParserException, CompilationException {
Parser parser = new Parser(context, source);
GeneratorDefinition generatorDef = parser.parseGenerator(formals, bodyText);
return compile(generatorDef, nextFunctionName());
}
Aggregations