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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations