Search in sources :

Example 6 with OrdinaryObject

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

the class ReflectParser method createSourceLocation.

private OrdinaryObject createSourceLocation(Node node) {
    OrdinaryObject loc = createEmptyNode();
    addProperty(loc, "start", createPosition(node.getBeginLine(), node.getBeginColumn()));
    addProperty(loc, "end", createPosition(node.getEndLine(), node.getEndColumn()));
    addProperty(loc, "source", sourceInfo != null ? sourceInfo : NULL);
    return loc;
}
Also used : OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)

Example 7 with OrdinaryObject

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

the class ReflectParser method toAssignmentExpression.

private Object toAssignmentExpression(Node left, Expression right, Void value) {
    EmptyExpression empty = new EmptyExpression(left.getBeginPosition(), right.getEndPosition());
    Object left_ = left.accept(this, value);
    Object right_ = right.accept(this, value);
    String operator = AssignmentExpression.Operator.ASSIGN.getName();
    if (hasBuilder(Type.AssignmentExpression)) {
        return call(Type.AssignmentExpression, empty, operator, left_, right_);
    }
    OrdinaryObject expression = createExpression(empty, Type.AssignmentExpression);
    addProperty(expression, "left", left_);
    addProperty(expression, "right", right_);
    addProperty(expression, "operator", operator);
    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 8 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(ComputedPropertyName node, Void value) {
    Object expr = node.getExpression().accept(this, value);
    if (hasBuilder(Type.ComputedName)) {
        return call(Type.ComputedName, node, expr);
    }
    OrdinaryObject propertyName = createNode(node, Type.ComputedName);
    addProperty(propertyName, "name", expr);
    return propertyName;
}
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 9 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(AssignmentProperty node, Void value) {
    Object key;
    if (node.getPropertyName() == null) {
        key = node.getTarget().accept(this, value);
    } else {
        key = node.getPropertyName().accept(this, value);
    }
    Object _value;
    if (node.getInitializer() == null) {
        _value = node.getTarget().accept(this, value);
    } else {
        _value = toAssignmentExpression(node.getTarget(), node.getInitializer(), value);
    }
    String kind = "init";
    boolean method = false;
    boolean shorthand = node.getPropertyName() == null;
    boolean computed = node.getPropertyName() instanceof ComputedPropertyName;
    if (hasBuilder(Type.PropertyPattern)) {
        return call(Type.PropertyPattern, node, kind, key, _value);
    }
    // not PropertyPattern!
    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 10 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(TemplateCharacters node, Void value) {
    String raw = node.getRawValue();
    String cooked = node.getValue();
    if (hasBuilder(Type.TemplateLiteral)) {
        return call(Type.TemplateLiteral, node, raw, cooked);
    }
    OrdinaryObject expression = createExpression(node, Type.TemplateLiteral);
    addProperty(expression, "raw", raw);
    addProperty(expression, "cooked", cooked);
    return expression;
}
Also used : OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)

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