use of com.github.anba.es6draft.runtime.types.builtins.ArrayObject in project es6draft by anba.
the class ReflectParser method visit.
@Override
public Object visit(LetStatement node, Void value) {
ArrayObject head = createList(node.getBindings(), value);
Object body = node.getStatement().accept(this, value);
if (hasBuilder(Type.LetStatement)) {
return call(Type.LetStatement, node, head, body);
}
OrdinaryObject statement = createStatement(node, Type.LetStatement);
addProperty(statement, "head", head);
addProperty(statement, "body", body);
return statement;
}
use of com.github.anba.es6draft.runtime.types.builtins.ArrayObject in project es6draft by anba.
the class ReflectParser method visit.
@Override
public Object visit(ArrowFunction node, Void value) {
Object id = NULL;
ArrayObject params = createList(getParameterBindings(node.getParameters()), value);
ArrayObject defaults = createListWithNull(getParameterDefaults(node.getParameters()), value);
Object rest = acceptOrNull(getRestParameter(node.getParameters()), value);
Object body;
if (node.getExpression() == null) {
body = createFunctionBody(node, value);
} else {
body = node.getExpression().accept(this, value);
}
boolean generator = false;
boolean expression = node.getExpression() != null;
if (hasBuilder(Type.ArrowFunctionExpression)) {
return call(Type.ArrowFunctionExpression, node, id, params, body, generator, expression);
}
OrdinaryObject function = createFunction(node, Type.ArrowFunctionExpression);
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;
}
use of com.github.anba.es6draft.runtime.types.builtins.ArrayObject in project es6draft by anba.
the class ReflectParser method visit.
@Override
public Object visit(ObjectAssignmentPattern node, Void value) {
ArrayObject properties = createList(node.getProperties(), value);
// TODO: rest property
if (hasBuilder(Type.ObjectPattern)) {
return call(Type.ObjectPattern, node, properties);
}
OrdinaryObject pattern = createPattern(node, Type.ObjectPattern);
addProperty(pattern, "properties", properties);
return pattern;
}
use of com.github.anba.es6draft.runtime.types.builtins.ArrayObject in project es6draft by anba.
the class ReflectParser method visit.
@Override
public Object visit(SwitchClause node, Void value) {
Object test = acceptOrNull(node.getExpression(), value);
ArrayObject consequent = createList(node.getStatements(), value);
if (hasBuilder(Type.SwitchCase)) {
return call(Type.SwitchCase, node, test, consequent);
}
OrdinaryObject switchCase = createNode(node, Type.SwitchCase);
addProperty(switchCase, "test", test);
addProperty(switchCase, "consequent", consequent);
return switchCase;
}
use of com.github.anba.es6draft.runtime.types.builtins.ArrayObject in project es6draft by anba.
the class ReflectParser method visit.
@Override
public Object visit(AsyncArrowFunction node, Void value) {
Object id = NULL;
ArrayObject params = createList(getParameterBindings(node.getParameters()), value);
ArrayObject defaults = createListWithNull(getParameterDefaults(node.getParameters()), value);
Object rest = acceptOrNull(getRestParameter(node.getParameters()), value);
Object body;
if (node.getExpression() == null) {
body = createFunctionBody(node, value);
} else {
body = node.getExpression().accept(this, value);
}
// TODO: flag for async
boolean generator = false;
boolean expression = node.getExpression() != null;
if (hasBuilder(Type.ArrowFunctionExpression)) {
return call(Type.ArrowFunctionExpression, node, id, params, body, generator, expression);
}
OrdinaryObject function = createFunction(node, Type.ArrowFunctionExpression);
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;
}
Aggregations