use of com.github.anba.es6draft.runtime.objects.text.RegExpObject in project es6draft by anba.
the class SourceBuilder method source.
private String source(ExecutionContext cx, HashSet<ScriptObject> stack, Object value) {
switch(Type.of(value)) {
case Null:
return "null";
case Boolean:
return Type.booleanValue(value) ? "true" : "false";
case String:
return Strings.quote(Type.stringValue(value).toString());
case Symbol:
return Type.symbolValue(value).toString();
case Number:
return ToFlatString(cx, value);
case SIMD:
return Type.simdValue(value).toString();
case Object:
ScriptObject objValue = Type.objectValue(value);
if (IsCallable(objValue)) {
return ((Callable) objValue).toSource(cx);
}
if (stack.contains(objValue) || stack.size() > maxStackDepth) {
return "« ... »";
}
stack.add(objValue);
try {
if (objValue instanceof DateObject) {
return DatePrototype.Properties.toString(cx, value).toString();
} else if (objValue instanceof RegExpObject) {
return RegExpPrototype.Properties.toString(cx, value).toString();
} else if (objValue instanceof ArrayObject) {
return arrayToSource(cx, stack, objValue);
} else {
return objectToSource(cx, stack, objValue);
}
} finally {
stack.remove(objValue);
}
case Undefined:
default:
return "(void 0)";
}
}
use of com.github.anba.es6draft.runtime.objects.text.RegExpObject in project es6draft by anba.
the class ReflectParser method visit.
@Override
public Object visit(RegularExpressionLiteral node, Void value) {
RegExpObject _value = RegExpCreate(cx, node.getRegexp(), node.getFlags());
if (hasBuilder(Type.Literal)) {
return call(Type.Literal, node, _value);
}
OrdinaryObject expression = createExpression(node, Type.Literal);
addProperty(expression, "value", _value);
return expression;
}
Aggregations