Search in sources :

Example 26 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(ClassExpression node, Void value) {
    Object id = acceptOrNull(node.getIdentifier(), value);
    Object superClass = acceptOrNull(node.getHeritage(), value);
    Object body = createClassBody(node, value);
    OrdinaryObject classDef = createClass(node, Type.ClassExpression);
    addProperty(classDef, "id", id);
    addProperty(classDef, "superClass", superClass);
    addProperty(classDef, "body", body);
    return classDef;
}
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 27 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(LegacyComprehensionFor node, Void value) {
    Object left = node.getBinding().accept(this, value);
    Object right = node.getExpression().accept(this, value);
    boolean each = node.getIterationKind() == LegacyComprehensionFor.IterationKind.EnumerateValues;
    boolean of = node.getIterationKind() == LegacyComprehensionFor.IterationKind.Iterate;
    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 28 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(SuperNewExpression node, Void value) {
    Object callee = superNode(node);
    ArrayObject arguments = createList(node.getArguments(), value);
    if (hasBuilder(Type.NewExpression)) {
        return call(Type.NewExpression, node, callee, arguments);
    }
    OrdinaryObject expression = createExpression(node, Type.NewExpression);
    addProperty(expression, "callee", callee);
    addProperty(expression, "arguments", arguments);
    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 29 with OrdinaryObject

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

the class ReflectParser method createClassMethod.

private OrdinaryObject createClassMethod(MethodDefinition node, Void value) {
    Object name = node.getPropertyName().accept(this, null);
    Object body = toFunctionExpression(node, value);
    String kind = methodKind(node, "method");
    OrdinaryObject property = createNode(node, Type.ClassMethod);
    addProperty(property, "name", name);
    addProperty(property, "body", body);
    addProperty(property, "kind", kind);
    addProperty(property, "static", node.isStatic());
    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 30 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(LegacyComprehension node, Void value) {
    // Extract the single if-qualifier, if present
    Expression test = null;
    List<ComprehensionQualifier> qualifiers = node.getList();
    ComprehensionQualifier last = lastElement(qualifiers);
    if (last instanceof ComprehensionIf) {
        test = ((ComprehensionIf) last).getTest();
        qualifiers = qualifiers.subList(0, qualifiers.size() - 1);
    }
    Object body = node.getExpression().accept(this, value);
    ArrayObject blocks = createList(qualifiers, value);
    Object filter = acceptOrNull(test, value);
    OrdinaryObject expression = createEmptyNode();
    addProperty(expression, "body", body);
    addProperty(expression, "blocks", blocks);
    addProperty(expression, "filter", filter);
    addProperty(expression, "style", "legacy");
    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)

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