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