Search in sources :

Example 6 with MethodName

use of com.github.anba.es6draft.compiler.assembler.MethodName in project es6draft by anba.

the class BlockDeclarationInstantiationGenerator method generate.

/**
     * stack: [env] {@literal ->} [env]
     * 
     * @param node
     *            the switch statement
     * @param mv
     *            the code visitor
     */
void generate(SwitchStatement node, CodeVisitor mv) {
    int declarations = LexicallyDeclaredNames(node).size();
    if (declarations > INLINE_LIMIT) {
        MethodName method = codegen.compile(node, this);
        // stack: [env] -> [env]
        mv.dup();
        mv.loadExecutionContext();
        mv.invoke(method);
    } else {
        generateInline(LexicallyScopedDeclarations(node), mv);
    }
}
Also used : MethodName(com.github.anba.es6draft.compiler.assembler.MethodName)

Example 7 with MethodName

use of com.github.anba.es6draft.compiler.assembler.MethodName in project es6draft by anba.

the class ClassPropertyGenerator method visit.

@Override
public Void visit(MethodDefinitionsMethod node, CodeVisitor mv) {
    MethodName method = codegen.compile(node, decorators != null, mv);
    boolean hasResume = node.hasResumePoint();
    // stack: [] -> []
    // 0 = hint for stacktraces to omit this frame
    mv.lineInfo(0);
    if (hasResume) {
        mv.callWithSuspend(method, constructor, prototype, decoratorsOrNull(mv));
    } else {
        mv.call(method, constructor, prototype, decoratorsOrNull(mv));
    }
    return null;
}
Also used : MethodName(com.github.anba.es6draft.compiler.assembler.MethodName)

Example 8 with MethodName

use of com.github.anba.es6draft.compiler.assembler.MethodName in project es6draft by anba.

the class ExpressionGenerator method visit.

/**
     * 14.2.10 Runtime Semantics: Evaluation
     */
@Override
public ValType visit(ArrowFunction node, CodeVisitor mv) {
    MethodName method = codegen.compile(node);
    /* steps 1-4 */
    mv.invoke(method);
    mv.loadExecutionContext();
    mv.invoke(Methods.ScriptRuntime_EvaluateArrowFunction);
    /* step 5 */
    return ValType.Object;
}
Also used : MethodName(com.github.anba.es6draft.compiler.assembler.MethodName)

Example 9 with MethodName

use of com.github.anba.es6draft.compiler.assembler.MethodName in project es6draft by anba.

the class ExpressionGenerator method visit.

/**
     * Extension: Async Generator Function Definitions
     */
@Override
public ValType visit(AsyncGeneratorExpression node, CodeVisitor mv) {
    MethodName method = codegen.compile(node);
    /* steps 1-5/10 */
    mv.invoke(method);
    mv.loadExecutionContext();
    mv.invoke(Methods.ScriptRuntime_EvaluateAsyncGeneratorExpression);
    /* step 6/11 */
    return ValType.Object;
}
Also used : MethodName(com.github.anba.es6draft.compiler.assembler.MethodName)

Example 10 with MethodName

use of com.github.anba.es6draft.compiler.assembler.MethodName in project es6draft by anba.

the class ExpressionGenerator method visit.

/**
     * Extension: Async Function Definitions
     */
@Override
public ValType visit(AsyncFunctionExpression node, CodeVisitor mv) {
    MethodName method = codegen.compile(node);
    /* steps 1-5/10 */
    mv.invoke(method);
    mv.loadExecutionContext();
    mv.invoke(Methods.ScriptRuntime_EvaluateAsyncFunctionExpression);
    /* step 6/11 */
    return ValType.Object;
}
Also used : MethodName(com.github.anba.es6draft.compiler.assembler.MethodName)

Aggregations

MethodName (com.github.anba.es6draft.compiler.assembler.MethodName)27 Declaration (com.github.anba.es6draft.ast.Declaration)2 HoistableDeclaration (com.github.anba.es6draft.ast.HoistableDeclaration)2 LabelState (com.github.anba.es6draft.compiler.CodeVisitor.LabelState)2 ArrayObject (com.github.anba.es6draft.runtime.types.builtins.ArrayObject)2 OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)2 ComputedPropertyName (com.github.anba.es6draft.ast.ComputedPropertyName)1 LegacyGeneratorDeclaration (com.github.anba.es6draft.ast.LegacyGeneratorDeclaration)1 BlockScope (com.github.anba.es6draft.ast.scope.BlockScope)1 Name (com.github.anba.es6draft.ast.scope.Name)1 FieldName (com.github.anba.es6draft.compiler.assembler.FieldName)1 InstructionAssembler (com.github.anba.es6draft.compiler.assembler.InstructionAssembler)1 DeclarativeEnvironmentRecord (com.github.anba.es6draft.runtime.DeclarativeEnvironmentRecord)1 ScriptObject (com.github.anba.es6draft.runtime.types.ScriptObject)1 FunctionObject (com.github.anba.es6draft.runtime.types.builtins.FunctionObject)1 OrdinaryConstructorFunction (com.github.anba.es6draft.runtime.types.builtins.OrdinaryConstructorFunction)1 ArrayList (java.util.ArrayList)1