Search in sources :

Example 11 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(PropertyNameDefinition node, Void value) {
    Object key = node.getPropertyName().accept(this, value);
    Object _value = key;
    String kind = "init";
    boolean method = false;
    boolean shorthand = true;
    boolean computed = false;
    if (hasBuilder(Type.Property)) {
        return call(Type.Property, node, kind, key, _value);
    }
    OrdinaryObject property = createNode(node, Type.Property);
    addProperty(property, "key", key);
    addProperty(property, "value", _value);
    addProperty(property, "kind", kind);
    addProperty(property, "method", method);
    addProperty(property, "shorthand", shorthand);
    addProperty(property, "computed", computed);
    return property;
}
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 12 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(ForOfStatement node, Void value) {
    Object forOfStatement;
    Object left = node.getHead().accept(this, value);
    Object right = node.getExpression().accept(this, value);
    Object body = node.getStatement().accept(this, value);
    if (hasBuilder(Type.ForOfStatement)) {
        forOfStatement = call(Type.ForOfStatement, node, left, right, body);
    } else {
        OrdinaryObject statement = createStatement(node, Type.ForOfStatement);
        addProperty(statement, "left", left);
        addProperty(statement, "right", right);
        addProperty(statement, "body", body);
        forOfStatement = statement;
    }
    return createLabelledStatement(node, forOfStatement);
}
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 13 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(BindingIdentifier node, Void value) {
    String name = node.getName().getIdentifier();
    if (hasBuilder(Type.Identifier)) {
        return call(Type.Identifier, node, name);
    }
    OrdinaryObject binding = createBinding(node, Type.Identifier);
    addProperty(binding, "name", name);
    return binding;
}
Also used : OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)

Example 14 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(ComprehensionFor node, Void value) {
    Object left = node.getBinding().accept(this, value);
    Object right = node.getExpression().accept(this, value);
    boolean each = false;
    boolean of = true;
    if (hasBuilder(Type.ComprehensionBlock)) {
        return call(Type.ComprehensionBlock, node, left, right, each);
    }
    OrdinaryObject comprehensionBlock = createNode(node, Type.ComprehensionBlock);
    addProperty(comprehensionBlock, "left", left);
    addProperty(comprehensionBlock, "right", right);
    addProperty(comprehensionBlock, "each", each);
    addProperty(comprehensionBlock, "of", of);
    return comprehensionBlock;
}
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 15 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(FunctionDeclaration node, Void value) {
    Object id = acceptOrNull(node.getIdentifier(), value);
    ArrayObject params = createList(getParameterBindings(node.getParameters()), value);
    ArrayObject defaults = createListWithNull(getParameterDefaults(node.getParameters()), value);
    Object rest = acceptOrNull(getRestParameter(node.getParameters()), value);
    Object body = createFunctionBody(node, value);
    boolean generator = false;
    boolean expression = false;
    if (hasBuilder(Type.FunctionDeclaration)) {
        return call(Type.FunctionDeclaration, node, id, params, body, generator, expression);
    }
    OrdinaryObject function = createFunction(node, Type.FunctionDeclaration);
    addProperty(function, "id", id);
    addProperty(function, "params", params);
    addProperty(function, "defaults", defaults);
    addProperty(function, "body", body);
    addProperty(function, "rest", rest);
    addProperty(function, "generator", generator);
    addProperty(function, "expression", expression);
    return function;
}
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)

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