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