Search in sources :

Example 31 with OrdinaryObject

use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.

the class ReflectParser method visit.

@Override
public Object visit(ReturnStatement node, Void value) {
    Object argument = acceptOrNull(node.getExpression(), value);
    if (hasBuilder(Type.ReturnStatement)) {
        return call(Type.ReturnStatement, node, argument);
    }
    OrdinaryObject statement = createStatement(node, Type.ReturnStatement);
    addProperty(statement, "argument", argument);
    return statement;
}
Also used : OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) ScriptObject(com.github.anba.es6draft.runtime.types.ScriptObject) RegExpObject(com.github.anba.es6draft.runtime.objects.text.RegExpObject) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) ArrayObject(com.github.anba.es6draft.runtime.types.builtins.ArrayObject)

Example 32 with OrdinaryObject

use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.

the class ReflectParser method visit.

@Override
public Object visit(ExportDeclaration node, Void value) {
    Object declaration = NULL;
    Object expression = NULL;
    Object specifiers = NULL;
    Object source = NULL;
    switch(node.getType()) {
        case All:
            specifiers = createListFromValues(Collections.singletonList(createNode(Type.ExportBatchSpecifier)));
            source = createLiteral(node.getModuleSpecifier());
            break;
        case External:
            // TODO: default entry and namespace export
            specifiers = node.getExportClause().accept(this, value);
            source = createLiteral(node.getModuleSpecifier());
            break;
        case Local:
            specifiers = node.getExportClause().accept(this, value);
            break;
        case Variable:
            declaration = node.getVariableStatement().accept(this, value);
            break;
        case Declaration:
            declaration = node.getDeclaration().accept(this, value);
            break;
        case DefaultHoistableDeclaration:
            declaration = node.getHoistableDeclaration().accept(this, value);
            break;
        case DefaultClassDeclaration:
            declaration = node.getClassDeclaration().accept(this, value);
            break;
        case DefaultExpression:
            expression = node.getExpression().accept(this, value);
            break;
        default:
            throw new AssertionError();
    }
    OrdinaryObject exportDecl = createModuleItem(node, Type.ExportDeclaration);
    addProperty(exportDecl, "declaration", declaration);
    addProperty(exportDecl, "expression", expression);
    addProperty(exportDecl, "specifiers", specifiers);
    addProperty(exportDecl, "source", source);
    return exportDecl;
}
Also used : OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) ScriptObject(com.github.anba.es6draft.runtime.types.ScriptObject) RegExpObject(com.github.anba.es6draft.runtime.objects.text.RegExpObject) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) ArrayObject(com.github.anba.es6draft.runtime.types.builtins.ArrayObject)

Example 33 with OrdinaryObject

use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.

the class ReflectParser method createIdentifier.

private Object createIdentifier(String name) {
    if (hasBuilder(Type.Identifier)) {
        return call(Type.Identifier, null, name);
    }
    OrdinaryObject identifier = createNode(Type.Identifier);
    addProperty(identifier, "name", name);
    return identifier;
}
Also used : OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)

Example 34 with OrdinaryObject

use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.

the class ReflectParser method visit.

@Override
public Object visit(ConditionalExpression node, Void value) {
    Object test = node.getTest().accept(this, value);
    Object consequent = node.getThen().accept(this, value);
    Object alternate = node.getOtherwise().accept(this, value);
    if (hasBuilder(Type.ConditionalExpression)) {
        return call(Type.ConditionalExpression, node, test, consequent, alternate);
    }
    OrdinaryObject expression = createExpression(node, Type.ConditionalExpression);
    addProperty(expression, "test", test);
    addProperty(expression, "consequent", consequent);
    addProperty(expression, "alternate", alternate);
    return expression;
}
Also used : OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) ScriptObject(com.github.anba.es6draft.runtime.types.ScriptObject) RegExpObject(com.github.anba.es6draft.runtime.objects.text.RegExpObject) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) ArrayObject(com.github.anba.es6draft.runtime.types.builtins.ArrayObject)

Example 35 with OrdinaryObject

use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.

the class ReflectParser method visit.

@Override
public Object visit(ElementAccessor node, Void value) {
    Object object = node.getBase().accept(this, value);
    Object property = node.getElement().accept(this, value);
    boolean computed = true;
    if (hasBuilder(Type.MemberExpression)) {
        return call(Type.MemberExpression, node, object, property, computed);
    }
    OrdinaryObject expression = createExpression(node, Type.MemberExpression);
    addProperty(expression, "object", object);
    addProperty(expression, "property", property);
    addProperty(expression, "computed", computed);
    return expression;
}
Also used : OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) ScriptObject(com.github.anba.es6draft.runtime.types.ScriptObject) RegExpObject(com.github.anba.es6draft.runtime.objects.text.RegExpObject) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) ArrayObject(com.github.anba.es6draft.runtime.types.builtins.ArrayObject)

Aggregations

OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)141 ArrayObject (com.github.anba.es6draft.runtime.types.builtins.ArrayObject)102 ScriptObject (com.github.anba.es6draft.runtime.types.ScriptObject)98 RegExpObject (com.github.anba.es6draft.runtime.objects.text.RegExpObject)84 Intrinsics (com.github.anba.es6draft.runtime.types.Intrinsics)14 Property (com.github.anba.es6draft.runtime.types.Property)5 CompilationException (com.github.anba.es6draft.compiler.CompilationException)3 ParserException (com.github.anba.es6draft.parser.ParserException)3 GlobalEnvironmentRecord (com.github.anba.es6draft.runtime.GlobalEnvironmentRecord)3 RuntimeInfo (com.github.anba.es6draft.runtime.internal.RuntimeInfo)3 ScriptLoader (com.github.anba.es6draft.runtime.internal.ScriptLoader)3 Source (com.github.anba.es6draft.runtime.internal.Source)3 FunctionConstructor.functionSource (com.github.anba.es6draft.runtime.objects.FunctionConstructor.functionSource)3 AsyncGeneratorFunctionConstructor (com.github.anba.es6draft.runtime.objects.async.iteration.AsyncGeneratorFunctionConstructor)3 AsyncGeneratorFunctionPrototype (com.github.anba.es6draft.runtime.objects.async.iteration.AsyncGeneratorFunctionPrototype)3 AtomicsObject (com.github.anba.es6draft.runtime.objects.atomics.AtomicsObject)3 IntlObject (com.github.anba.es6draft.runtime.objects.intl.IntlObject)3 ArrayList (java.util.ArrayList)3 MethodCode (com.github.anba.es6draft.compiler.assembler.Code.MethodCode)2 MethodName (com.github.anba.es6draft.compiler.assembler.MethodName)2