Search in sources :

Example 1 with GeneratorDefinition

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());
}
Also used : AsyncGeneratorDefinition(com.github.anba.es6draft.ast.AsyncGeneratorDefinition) GeneratorDefinition(com.github.anba.es6draft.ast.GeneratorDefinition) Parser(com.github.anba.es6draft.parser.Parser)

Aggregations

AsyncGeneratorDefinition (com.github.anba.es6draft.ast.AsyncGeneratorDefinition)1 GeneratorDefinition (com.github.anba.es6draft.ast.GeneratorDefinition)1 Parser (com.github.anba.es6draft.parser.Parser)1