Search in sources :

Example 46 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(LexicalBinding node, Void value) {
    Object id = node.getBinding().accept(this, value);
    Object init = acceptOrNull(node.getInitializer(), value);
    if (hasBuilder(Type.VariableDeclarator)) {
        return call(Type.VariableDeclarator, node, id, init);
    }
    OrdinaryObject declarator = createNode(node, Type.VariableDeclarator);
    addProperty(declarator, "id", id);
    addProperty(declarator, "init", init);
    return declarator;
}
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 47 with OrdinaryObject

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

the class ReflectParser method createNode.

private OrdinaryObject createNode(Node node, Type type) {
    OrdinaryObject object = createEmptyNode();
    addNodeInfo(object, node, type);
    return object;
}
Also used : OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)

Example 48 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(UnaryExpression node, Void value) {
    Object argument = node.getOperand().accept(this, value);
    String operator = node.getOperator().getName();
    boolean prefix = !node.getOperator().isPostfix();
    if (hasBuilder(type(node))) {
        return call(type(node), node, operator, argument, prefix);
    }
    OrdinaryObject expression = createExpression(node, type(node));
    addProperty(expression, "argument", argument);
    addProperty(expression, "operator", operator);
    addProperty(expression, "prefix", prefix);
    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 49 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(ImportDeclaration node, Void value) {
    Object specifiers = NULL;
    Object source = NULL;
    switch(node.getType()) {
        case ImportFrom:
            specifiers = node.getImportClause().accept(this, value);
            source = createLiteral(node.getModuleSpecifier());
            break;
        case ImportModule:
            specifiers = createList(Collections.<Node>emptyList(), value);
            source = createLiteral(node.getModuleSpecifier());
            break;
        default:
            throw new AssertionError();
    }
    OrdinaryObject importDecl = createModuleItem(node, Type.ImportDeclaration);
    addProperty(importDecl, "specifiers", specifiers);
    addProperty(importDecl, "source", source);
    return importDecl;
}
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 50 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(TryStatement node, Void value) {
    Object block = node.getTryBlock().accept(this, value);
    Object handler = acceptOrNull(node.getCatchNode(), value);
    ArrayObject guardedHandlers = createList(node.getGuardedCatchNodes(), value);
    Object finalizer = acceptOrNull(node.getFinallyBlock(), value);
    if (hasBuilder(Type.TryStatement)) {
        return call(Type.TryStatement, node, block, guardedHandlers, handler, finalizer);
    }
    OrdinaryObject statement = createStatement(node, Type.TryStatement);
    addProperty(statement, "block", block);
    addProperty(statement, "handler", handler);
    addProperty(statement, "guardedHandlers", guardedHandlers);
    addProperty(statement, "finalizer", finalizer);
    return statement;
}
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