Search in sources :

Example 11 with Completion

use of com.github.anba.es6draft.compiler.StatementGenerator.Completion in project es6draft by anba.

the class CodeGenerator method generatorBody.

private boolean generatorBody(FunctionNode node) {
    MethodCode method = newMethod(node, FunctionName.Code);
    GeneratorCodeVisitor body = new GeneratorCodeVisitor(method, node);
    body.lineInfo(node);
    body.begin();
    GeneratorState generatorState = body.generatorPrologue();
    body.enterFunction(node);
    Completion result = statements(node.getStatements(), body);
    body.exitFunction();
    if (!result.isAbrupt()) {
        // fall-thru, return undefined from function
        body.loadUndefined();
        body._return();
    }
    body.generatorEpilogue(generatorState);
    body.end();
    return body.hasTailCalls();
}
Also used : Completion(com.github.anba.es6draft.compiler.StatementGenerator.Completion) MethodCode(com.github.anba.es6draft.compiler.assembler.Code.MethodCode) GeneratorState(com.github.anba.es6draft.compiler.CodeVisitor.GeneratorState)

Aggregations

Completion (com.github.anba.es6draft.compiler.StatementGenerator.Completion)11 MethodCode (com.github.anba.es6draft.compiler.assembler.Code.MethodCode)6 Jump (com.github.anba.es6draft.compiler.assembler.Jump)5 GeneratorState (com.github.anba.es6draft.compiler.CodeVisitor.GeneratorState)3 LegacyComprehensionFor (com.github.anba.es6draft.ast.LegacyComprehensionFor)2 BlockScope (com.github.anba.es6draft.ast.scope.BlockScope)2 LabelState (com.github.anba.es6draft.compiler.CodeVisitor.LabelState)2 MutableValue (com.github.anba.es6draft.compiler.assembler.MutableValue)2 LexicalEnvironment (com.github.anba.es6draft.runtime.LexicalEnvironment)2 ScriptIterator (com.github.anba.es6draft.runtime.internal.ScriptIterator)2 SimpleImmutableEntry (java.util.AbstractMap.SimpleImmutableEntry)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ComprehensionFor (com.github.anba.es6draft.ast.ComprehensionFor)1 IterationKind (com.github.anba.es6draft.ast.LegacyComprehensionFor.IterationKind)1 SwitchClause (com.github.anba.es6draft.ast.SwitchClause)1 Name (com.github.anba.es6draft.ast.scope.Name)1 BreakLabel (com.github.anba.es6draft.compiler.Labels.BreakLabel)1 TempLabel (com.github.anba.es6draft.compiler.Labels.TempLabel)1 MethodName (com.github.anba.es6draft.compiler.assembler.MethodName)1