Search in sources :

Example 91 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(ArrayComprehension node, Void value) {
    // Comprehension/LegacyComprehension already created a partial result
    OrdinaryObject expression = (OrdinaryObject) node.getComprehension().accept(this, value);
    if (hasBuilder(Type.ComprehensionExpression)) {
        Object body = Get(cx, expression, "body");
        Object blocks = Get(cx, expression, "blocks");
        Object filter = Get(cx, expression, "filter");
        return call(Type.ComprehensionExpression, node, body, blocks, filter);
    }
    addNodeInfo(expression, node, Type.ComprehensionExpression);
    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 92 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(SpreadProperty node, Void value) {
    Object expr = node.getExpression().accept(this, value);
    if (hasBuilder(Type.SpreadExpression)) {
        return call(Type.SpreadExpression, node, expr);
    }
    OrdinaryObject expression = createNode(node, Type.SpreadExpression);
    addProperty(expression, "expression", expr);
    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 93 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(Script node, Void value) {
    ArrayObject body = createList(node.getStatements(), value);
    if (hasBuilder(Type.Program)) {
        return call(Type.Program, node, body);
    }
    OrdinaryObject program = createNode(node, Type.Program);
    addProperty(program, "body", body);
    addProperty(program, "sourceType", "script");
    return program;
}
Also used : ArrayObject(com.github.anba.es6draft.runtime.types.builtins.ArrayObject) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)

Example 94 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(LetExpression node, Void value) {
    ArrayObject head = createList(node.getBindings(), value);
    Object body = node.getExpression().accept(this, value);
    if (hasBuilder(Type.LetExpression)) {
        return call(Type.LetExpression, node, head, body);
    }
    OrdinaryObject expression = createExpression(node, Type.LetExpression);
    addProperty(expression, "head", head);
    addProperty(expression, "body", body);
    return expression;
}
Also used : ArrayObject(com.github.anba.es6draft.runtime.types.builtins.ArrayObject) 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 95 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(ForInStatement node, Void value) {
    Object forInStatement;
    Object left = node.getHead().accept(this, value);
    Object right = node.getExpression().accept(this, value);
    Object body = node.getStatement().accept(this, value);
    boolean each = false;
    if (hasBuilder(Type.ForInStatement)) {
        forInStatement = call(Type.ForInStatement, node, left, right, body, each);
    } else {
        OrdinaryObject statement = createStatement(node, Type.ForInStatement);
        addProperty(statement, "left", left);
        addProperty(statement, "right", right);
        addProperty(statement, "body", body);
        addProperty(statement, "each", each);
        forInStatement = statement;
    }
    return createLabelledStatement(node, forInStatement);
}
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