use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.
the class ReflectParser method visit.
@Override
public Object visit(PropertyNameDefinition node, Void value) {
Object key = node.getPropertyName().accept(this, value);
Object _value = key;
String kind = "init";
boolean method = false;
boolean shorthand = true;
boolean computed = false;
if (hasBuilder(Type.Property)) {
return call(Type.Property, node, kind, key, _value);
}
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(ForOfStatement node, Void value) {
Object forOfStatement;
Object left = node.getHead().accept(this, value);
Object right = node.getExpression().accept(this, value);
Object body = node.getStatement().accept(this, value);
if (hasBuilder(Type.ForOfStatement)) {
forOfStatement = call(Type.ForOfStatement, node, left, right, body);
} else {
OrdinaryObject statement = createStatement(node, Type.ForOfStatement);
addProperty(statement, "left", left);
addProperty(statement, "right", right);
addProperty(statement, "body", body);
forOfStatement = statement;
}
return createLabelledStatement(node, forOfStatement);
}
use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.
the class ReflectParser method visit.
@Override
public Object visit(BindingIdentifier node, Void value) {
String name = node.getName().getIdentifier();
if (hasBuilder(Type.Identifier)) {
return call(Type.Identifier, node, name);
}
OrdinaryObject binding = createBinding(node, Type.Identifier);
addProperty(binding, "name", name);
return binding;
}
use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.
the class ReflectParser method visit.
@Override
public Object visit(ComprehensionFor node, Void value) {
Object left = node.getBinding().accept(this, value);
Object right = node.getExpression().accept(this, value);
boolean each = false;
boolean of = true;
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(FunctionDeclaration node, Void value) {
Object id = acceptOrNull(node.getIdentifier(), value);
ArrayObject params = createList(getParameterBindings(node.getParameters()), value);
ArrayObject defaults = createListWithNull(getParameterDefaults(node.getParameters()), value);
Object rest = acceptOrNull(getRestParameter(node.getParameters()), value);
Object body = createFunctionBody(node, value);
boolean generator = false;
boolean expression = false;
if (hasBuilder(Type.FunctionDeclaration)) {
return call(Type.FunctionDeclaration, node, id, params, body, generator, expression);
}
OrdinaryObject function = createFunction(node, Type.FunctionDeclaration);
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