mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 02:07:35 +00:00
Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
This commit is contained in:
parent
6e19ab2bbc
commit
57dc179b1f
597 changed files with 1973 additions and 1972 deletions
|
@ -3443,7 +3443,7 @@ Completion ImportCall::execute(Interpreter& interpreter) const
|
|||
// 4. If supportedAssertions contains key, then
|
||||
if (supported_assertions.contains_slow(property_key.to_string())) {
|
||||
// a. Append { [[Key]]: key, [[Value]]: value } to assertions.
|
||||
assertions.empend(property_key.to_string(), value.as_string().string());
|
||||
assertions.empend(property_key.to_string(), value.as_string().deprecated_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ void BasicBlock::dump(Bytecode::Executable const& executable) const
|
|||
if (!m_name.is_empty())
|
||||
warnln("{}:", m_name);
|
||||
while (!it.at_end()) {
|
||||
warnln("[{:4x}] {}", it.offset(), (*it).to_string(executable));
|
||||
warnln("[{:4x}] {}", it.offset(), (*it).to_deprecated_string(executable));
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ struct CodeGenerationError {
|
|||
ASTNode const* failing_node { nullptr };
|
||||
StringView reason_literal;
|
||||
|
||||
DeprecatedString to_string();
|
||||
DeprecatedString to_deprecated_string();
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -316,7 +316,7 @@ Label Generator::perform_needed_unwinds_for_labelled_continue_and_return_target_
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
DeprecatedString CodeGenerationError::to_string()
|
||||
DeprecatedString CodeGenerationError::to_deprecated_string()
|
||||
{
|
||||
return DeprecatedString::formatted("CodeGenerationError in {}: {}", failing_node ? failing_node->class_name() : "<unknown node>", reason_literal);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
bool is_terminator() const;
|
||||
Type type() const { return m_type; }
|
||||
size_t length() const;
|
||||
DeprecatedString to_string(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string(Bytecode::Executable const&) const;
|
||||
ThrowCompletionOr<void> execute(Bytecode::Interpreter&) const;
|
||||
void replace_references(BasicBlock const&, BasicBlock const&);
|
||||
void replace_references(Register, Register);
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
|
||||
namespace JS::Bytecode {
|
||||
|
||||
DeprecatedString Instruction::to_string(Bytecode::Executable const& executable) const
|
||||
DeprecatedString Instruction::to_deprecated_string(Bytecode::Executable const& executable) const
|
||||
{
|
||||
#define __BYTECODE_OP(op) \
|
||||
case Instruction::Type::op: \
|
||||
return static_cast<Bytecode::Op::op const&>(*this).to_string_impl(executable);
|
||||
return static_cast<Bytecode::Op::op const&>(*this).to_deprecated_string_impl(executable);
|
||||
|
||||
switch (type()) {
|
||||
ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
|
||||
|
@ -136,7 +136,7 @@ static ThrowCompletionOr<Value> typed_equals(VM&, Value src1, Value src2)
|
|||
interpreter.accumulator() = TRY(op_snake_case(vm, lhs, rhs)); \
|
||||
return {}; \
|
||||
} \
|
||||
DeprecatedString OpTitleCase::to_string_impl(Bytecode::Executable const&) const \
|
||||
DeprecatedString OpTitleCase::to_deprecated_string_impl(Bytecode::Executable const&) const \
|
||||
{ \
|
||||
return DeprecatedString::formatted(#OpTitleCase " {}", m_lhs_reg); \
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ static ThrowCompletionOr<Value> typeof_(VM& vm, Value value)
|
|||
interpreter.accumulator() = TRY(op_snake_case(vm, interpreter.accumulator())); \
|
||||
return {}; \
|
||||
} \
|
||||
DeprecatedString OpTitleCase::to_string_impl(Bytecode::Executable const&) const \
|
||||
DeprecatedString OpTitleCase::to_deprecated_string_impl(Bytecode::Executable const&) const \
|
||||
{ \
|
||||
return #OpTitleCase; \
|
||||
}
|
||||
|
@ -1017,64 +1017,64 @@ ThrowCompletionOr<void> TypeofVariable::execute_impl(Bytecode::Interpreter& inte
|
|||
return {};
|
||||
}
|
||||
|
||||
DeprecatedString Load::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString Load::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return DeprecatedString::formatted("Load {}", m_src);
|
||||
}
|
||||
|
||||
DeprecatedString LoadImmediate::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString LoadImmediate::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return DeprecatedString::formatted("LoadImmediate {}", m_value);
|
||||
}
|
||||
|
||||
DeprecatedString Store::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString Store::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return DeprecatedString::formatted("Store {}", m_dst);
|
||||
}
|
||||
|
||||
DeprecatedString NewBigInt::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString NewBigInt::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return DeprecatedString::formatted("NewBigInt \"{}\"", m_bigint.to_base(10));
|
||||
}
|
||||
|
||||
DeprecatedString NewArray::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString NewArray::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("NewArray"sv);
|
||||
if (m_element_count != 0) {
|
||||
builder.appendff(" [{}-{}]", m_elements[0], m_elements[1]);
|
||||
}
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
DeprecatedString Append::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString Append::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
if (m_is_spread)
|
||||
return DeprecatedString::formatted("Append lhs: **{}", m_lhs);
|
||||
return DeprecatedString::formatted("Append lhs: {}", m_lhs);
|
||||
}
|
||||
|
||||
DeprecatedString IteratorToArray::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString IteratorToArray::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "IteratorToArray";
|
||||
}
|
||||
|
||||
DeprecatedString NewString::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString NewString::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
return DeprecatedString::formatted("NewString {} (\"{}\")", m_string, executable.string_table->get(m_string));
|
||||
}
|
||||
|
||||
DeprecatedString NewObject::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString NewObject::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "NewObject";
|
||||
}
|
||||
|
||||
DeprecatedString NewRegExp::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString NewRegExp::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
return DeprecatedString::formatted("NewRegExp source:{} (\"{}\") flags:{} (\"{}\")", m_source_index, executable.get_string(m_source_index), m_flags_index, executable.get_string(m_flags_index));
|
||||
}
|
||||
|
||||
DeprecatedString CopyObjectExcludingProperties::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString CopyObjectExcludingProperties::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.appendff("CopyObjectExcludingProperties from:{}", m_from_object);
|
||||
|
@ -1083,25 +1083,25 @@ DeprecatedString CopyObjectExcludingProperties::to_string_impl(Bytecode::Executa
|
|||
builder.join(", "sv, Span<Register const>(m_excluded_names, m_excluded_names_count));
|
||||
builder.append(']');
|
||||
}
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
DeprecatedString ConcatString::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString ConcatString::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return DeprecatedString::formatted("ConcatString {}", m_lhs);
|
||||
}
|
||||
|
||||
DeprecatedString GetVariable::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString GetVariable::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
return DeprecatedString::formatted("GetVariable {} ({})", m_identifier, executable.identifier_table->get(m_identifier));
|
||||
}
|
||||
|
||||
DeprecatedString DeleteVariable::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString DeleteVariable::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
return DeprecatedString::formatted("DeleteVariable {} ({})", m_identifier, executable.identifier_table->get(m_identifier));
|
||||
}
|
||||
|
||||
DeprecatedString CreateEnvironment::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString CreateEnvironment::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
auto mode_string = m_mode == EnvironmentMode::Lexical
|
||||
? "Lexical"
|
||||
|
@ -1109,18 +1109,18 @@ DeprecatedString CreateEnvironment::to_string_impl(Bytecode::Executable const&)
|
|||
return DeprecatedString::formatted("CreateEnvironment mode:{}", mode_string);
|
||||
}
|
||||
|
||||
DeprecatedString CreateVariable::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString CreateVariable::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
auto mode_string = m_mode == EnvironmentMode::Lexical ? "Lexical" : "Variable";
|
||||
return DeprecatedString::formatted("CreateVariable env:{} immutable:{} global:{} {} ({})", mode_string, m_is_immutable, m_is_global, m_identifier, executable.identifier_table->get(m_identifier));
|
||||
}
|
||||
|
||||
DeprecatedString EnterObjectEnvironment::to_string_impl(Executable const&) const
|
||||
DeprecatedString EnterObjectEnvironment::to_deprecated_string_impl(Executable const&) const
|
||||
{
|
||||
return DeprecatedString::formatted("EnterObjectEnvironment");
|
||||
}
|
||||
|
||||
DeprecatedString SetVariable::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString SetVariable::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
auto initialization_mode_name = m_initialization_mode == InitializationMode ::Initialize ? "Initialize"
|
||||
: m_initialization_mode == InitializationMode::Set ? "Set"
|
||||
|
@ -1129,7 +1129,7 @@ DeprecatedString SetVariable::to_string_impl(Bytecode::Executable const& executa
|
|||
return DeprecatedString::formatted("SetVariable env:{} init:{} {} ({})", mode_string, initialization_mode_name, m_identifier, executable.identifier_table->get(m_identifier));
|
||||
}
|
||||
|
||||
DeprecatedString PutById::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString PutById::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
auto kind = m_kind == PropertyKind::Getter
|
||||
? "getter"
|
||||
|
@ -1140,45 +1140,45 @@ DeprecatedString PutById::to_string_impl(Bytecode::Executable const& executable)
|
|||
return DeprecatedString::formatted("PutById kind:{} base:{}, property:{} ({})", kind, m_base, m_property, executable.identifier_table->get(m_property));
|
||||
}
|
||||
|
||||
DeprecatedString GetById::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString GetById::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
return DeprecatedString::formatted("GetById {} ({})", m_property, executable.identifier_table->get(m_property));
|
||||
}
|
||||
|
||||
DeprecatedString DeleteById::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString DeleteById::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
return DeprecatedString::formatted("DeleteById {} ({})", m_property, executable.identifier_table->get(m_property));
|
||||
}
|
||||
|
||||
DeprecatedString Jump::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString Jump::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
if (m_true_target.has_value())
|
||||
return DeprecatedString::formatted("Jump {}", *m_true_target);
|
||||
return DeprecatedString::formatted("Jump <empty>");
|
||||
}
|
||||
|
||||
DeprecatedString JumpConditional::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString JumpConditional::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
auto true_string = m_true_target.has_value() ? DeprecatedString::formatted("{}", *m_true_target) : "<empty>";
|
||||
auto false_string = m_false_target.has_value() ? DeprecatedString::formatted("{}", *m_false_target) : "<empty>";
|
||||
return DeprecatedString::formatted("JumpConditional true:{} false:{}", true_string, false_string);
|
||||
}
|
||||
|
||||
DeprecatedString JumpNullish::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString JumpNullish::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
auto true_string = m_true_target.has_value() ? DeprecatedString::formatted("{}", *m_true_target) : "<empty>";
|
||||
auto false_string = m_false_target.has_value() ? DeprecatedString::formatted("{}", *m_false_target) : "<empty>";
|
||||
return DeprecatedString::formatted("JumpNullish null:{} nonnull:{}", true_string, false_string);
|
||||
}
|
||||
|
||||
DeprecatedString JumpUndefined::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString JumpUndefined::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
auto true_string = m_true_target.has_value() ? DeprecatedString::formatted("{}", *m_true_target) : "<empty>";
|
||||
auto false_string = m_false_target.has_value() ? DeprecatedString::formatted("{}", *m_false_target) : "<empty>";
|
||||
return DeprecatedString::formatted("JumpUndefined undefined:{} not undefined:{}", true_string, false_string);
|
||||
}
|
||||
|
||||
DeprecatedString Call::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString Call::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
if (m_expression_string.has_value())
|
||||
return DeprecatedString::formatted("Call callee:{}, this:{}, arguments:[...acc] ({})", m_callee, m_this_value, executable.get_string(m_expression_string.value()));
|
||||
|
@ -1186,55 +1186,55 @@ DeprecatedString Call::to_string_impl(Bytecode::Executable const& executable) co
|
|||
return DeprecatedString::formatted("Call callee:{}, this:{}, arguments:[...acc]", m_callee, m_this_value);
|
||||
}
|
||||
|
||||
DeprecatedString SuperCall::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString SuperCall::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "SuperCall arguments:[...acc]"sv;
|
||||
}
|
||||
|
||||
DeprecatedString NewFunction::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString NewFunction::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "NewFunction";
|
||||
}
|
||||
|
||||
DeprecatedString NewClass::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString NewClass::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
auto name = m_class_expression.name();
|
||||
return DeprecatedString::formatted("NewClass '{}'", name.is_null() ? ""sv : name);
|
||||
}
|
||||
|
||||
DeprecatedString Return::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString Return::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "Return";
|
||||
}
|
||||
|
||||
DeprecatedString Increment::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString Increment::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "Increment";
|
||||
}
|
||||
|
||||
DeprecatedString Decrement::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString Decrement::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "Decrement";
|
||||
}
|
||||
|
||||
DeprecatedString Throw::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString Throw::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "Throw";
|
||||
}
|
||||
|
||||
DeprecatedString EnterUnwindContext::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString EnterUnwindContext::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
auto handler_string = m_handler_target.has_value() ? DeprecatedString::formatted("{}", *m_handler_target) : "<empty>";
|
||||
auto finalizer_string = m_finalizer_target.has_value() ? DeprecatedString::formatted("{}", *m_finalizer_target) : "<empty>";
|
||||
return DeprecatedString::formatted("EnterUnwindContext handler:{} finalizer:{} entry:{}", handler_string, finalizer_string, m_entry_point);
|
||||
}
|
||||
|
||||
DeprecatedString FinishUnwind::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString FinishUnwind::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return DeprecatedString::formatted("FinishUnwind next:{}", m_next_target);
|
||||
}
|
||||
|
||||
DeprecatedString LeaveEnvironment::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString LeaveEnvironment::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
auto mode_string = m_mode == EnvironmentMode::Lexical
|
||||
? "Lexical"
|
||||
|
@ -1242,17 +1242,17 @@ DeprecatedString LeaveEnvironment::to_string_impl(Bytecode::Executable const&) c
|
|||
return DeprecatedString::formatted("LeaveEnvironment env:{}", mode_string);
|
||||
}
|
||||
|
||||
DeprecatedString LeaveUnwindContext::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString LeaveUnwindContext::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "LeaveUnwindContext";
|
||||
}
|
||||
|
||||
DeprecatedString ContinuePendingUnwind::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString ContinuePendingUnwind::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return DeprecatedString::formatted("ContinuePendingUnwind resume:{}", m_resume_target);
|
||||
}
|
||||
|
||||
DeprecatedString PushDeclarativeEnvironment::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString PushDeclarativeEnvironment::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("PushDeclarativeEnvironment"sv);
|
||||
|
@ -1264,22 +1264,22 @@ DeprecatedString PushDeclarativeEnvironment::to_string_impl(Bytecode::Executable
|
|||
builder.append('}');
|
||||
builder.join(", "sv, names);
|
||||
}
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
DeprecatedString Yield::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString Yield::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
if (m_continuation_label.has_value())
|
||||
return DeprecatedString::formatted("Yield continuation:@{}", m_continuation_label->block().name());
|
||||
return DeprecatedString::formatted("Yield return");
|
||||
}
|
||||
|
||||
DeprecatedString GetByValue::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString GetByValue::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return DeprecatedString::formatted("GetByValue base:{}", m_base);
|
||||
}
|
||||
|
||||
DeprecatedString PutByValue::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString PutByValue::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
auto kind = m_kind == PropertyKind::Getter
|
||||
? "getter"
|
||||
|
@ -1290,47 +1290,47 @@ DeprecatedString PutByValue::to_string_impl(Bytecode::Executable const&) const
|
|||
return DeprecatedString::formatted("PutByValue kind:{} base:{}, property:{}", kind, m_base, m_property);
|
||||
}
|
||||
|
||||
DeprecatedString DeleteByValue::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString DeleteByValue::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return DeprecatedString::formatted("DeleteByValue base:{}", m_base);
|
||||
}
|
||||
|
||||
DeprecatedString GetIterator::to_string_impl(Executable const&) const
|
||||
DeprecatedString GetIterator::to_deprecated_string_impl(Executable const&) const
|
||||
{
|
||||
return "GetIterator";
|
||||
}
|
||||
|
||||
DeprecatedString GetObjectPropertyIterator::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString GetObjectPropertyIterator::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "GetObjectPropertyIterator";
|
||||
}
|
||||
|
||||
DeprecatedString IteratorNext::to_string_impl(Executable const&) const
|
||||
DeprecatedString IteratorNext::to_deprecated_string_impl(Executable const&) const
|
||||
{
|
||||
return "IteratorNext";
|
||||
}
|
||||
|
||||
DeprecatedString IteratorResultDone::to_string_impl(Executable const&) const
|
||||
DeprecatedString IteratorResultDone::to_deprecated_string_impl(Executable const&) const
|
||||
{
|
||||
return "IteratorResultDone";
|
||||
}
|
||||
|
||||
DeprecatedString IteratorResultValue::to_string_impl(Executable const&) const
|
||||
DeprecatedString IteratorResultValue::to_deprecated_string_impl(Executable const&) const
|
||||
{
|
||||
return "IteratorResultValue";
|
||||
}
|
||||
|
||||
DeprecatedString ResolveThisBinding::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString ResolveThisBinding::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "ResolveThisBinding"sv;
|
||||
}
|
||||
|
||||
DeprecatedString GetNewTarget::to_string_impl(Bytecode::Executable const&) const
|
||||
DeprecatedString GetNewTarget::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "GetNewTarget"sv;
|
||||
}
|
||||
|
||||
DeprecatedString TypeofVariable::to_string_impl(Bytecode::Executable const& executable) const
|
||||
DeprecatedString TypeofVariable::to_deprecated_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
return DeprecatedString::formatted("TypeofVariable {} ({})", m_identifier, executable.identifier_table->get(m_identifier));
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register from, Register to)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -104,28 +104,28 @@ private:
|
|||
O(RightShift, right_shift) \
|
||||
O(UnsignedRightShift, unsigned_right_shift)
|
||||
|
||||
#define JS_DECLARE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
|
||||
class OpTitleCase final : public Instruction { \
|
||||
public: \
|
||||
explicit OpTitleCase(Register lhs_reg) \
|
||||
: Instruction(Type::OpTitleCase) \
|
||||
, m_lhs_reg(lhs_reg) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const; \
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) \
|
||||
{ \
|
||||
} \
|
||||
void replace_references_impl(Register from, Register to) \
|
||||
{ \
|
||||
if (m_lhs_reg == from) \
|
||||
m_lhs_reg = to; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
Register m_lhs_reg; \
|
||||
#define JS_DECLARE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
|
||||
class OpTitleCase final : public Instruction { \
|
||||
public: \
|
||||
explicit OpTitleCase(Register lhs_reg) \
|
||||
: Instruction(Type::OpTitleCase) \
|
||||
, m_lhs_reg(lhs_reg) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const; \
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) \
|
||||
{ \
|
||||
} \
|
||||
void replace_references_impl(Register from, Register to) \
|
||||
{ \
|
||||
if (m_lhs_reg == from) \
|
||||
m_lhs_reg = to; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
Register m_lhs_reg; \
|
||||
};
|
||||
|
||||
JS_ENUMERATE_COMMON_BINARY_OPS(JS_DECLARE_COMMON_BINARY_OP)
|
||||
|
@ -138,22 +138,22 @@ JS_ENUMERATE_COMMON_BINARY_OPS(JS_DECLARE_COMMON_BINARY_OP)
|
|||
O(UnaryMinus, unary_minus) \
|
||||
O(Typeof, typeof_)
|
||||
|
||||
#define JS_DECLARE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
|
||||
class OpTitleCase final : public Instruction { \
|
||||
public: \
|
||||
OpTitleCase() \
|
||||
: Instruction(Type::OpTitleCase) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const; \
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) \
|
||||
{ \
|
||||
} \
|
||||
void replace_references_impl(Register, Register) \
|
||||
{ \
|
||||
} \
|
||||
#define JS_DECLARE_COMMON_UNARY_OP(OpTitleCase, op_snake_case) \
|
||||
class OpTitleCase final : public Instruction { \
|
||||
public: \
|
||||
OpTitleCase() \
|
||||
: Instruction(Type::OpTitleCase) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const; \
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) \
|
||||
{ \
|
||||
} \
|
||||
void replace_references_impl(Register, Register) \
|
||||
{ \
|
||||
} \
|
||||
};
|
||||
|
||||
JS_ENUMERATE_COMMON_UNARY_OPS(JS_DECLARE_COMMON_UNARY_OP)
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -199,7 +199,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -221,7 +221,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register from, Register to);
|
||||
|
||||
|
@ -242,7 +242,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -268,7 +268,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
// Note: The underlying element range shall never be changed item, by item
|
||||
// shifting it may be done in the future
|
||||
|
@ -308,7 +308,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
|
||||
// Note: This should never do anything, the lhs should always be an array, that is currently being constructed
|
||||
|
@ -327,7 +327,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -341,7 +341,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
// Note: lhs should always be a string in construction, so this should never do anything
|
||||
void replace_references_impl(Register from, Register) { VERIFY(from != m_lhs); }
|
||||
|
@ -364,7 +364,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -380,7 +380,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -397,7 +397,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -424,7 +424,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -445,7 +445,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -466,7 +466,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -485,7 +485,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -512,7 +512,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register from, Register to)
|
||||
{
|
||||
|
@ -535,7 +535,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -552,7 +552,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register from, Register to)
|
||||
{
|
||||
|
@ -575,7 +575,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register from, Register to)
|
||||
{
|
||||
|
@ -598,7 +598,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register from, Register to)
|
||||
{
|
||||
|
@ -635,7 +635,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -655,7 +655,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
};
|
||||
|
||||
class JumpNullish final : public Jump {
|
||||
|
@ -666,7 +666,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
};
|
||||
|
||||
class JumpUndefined final : public Jump {
|
||||
|
@ -677,7 +677,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
};
|
||||
|
||||
// NOTE: This instruction is variable-width depending on the number of arguments!
|
||||
|
@ -698,7 +698,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register);
|
||||
|
||||
|
@ -721,7 +721,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -738,7 +738,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -755,7 +755,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -773,7 +773,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -786,7 +786,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -799,7 +799,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -814,7 +814,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -832,7 +832,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -855,7 +855,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -871,7 +871,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -887,7 +887,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -908,7 +908,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -934,7 +934,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&);
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -953,7 +953,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
@ -969,7 +969,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -982,7 +982,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -995,7 +995,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -1008,7 +1008,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -1021,7 +1021,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -1034,7 +1034,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -1047,7 +1047,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
@ -1061,7 +1061,7 @@ public:
|
|||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_string_impl(Bytecode::Executable const&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ ThrowCompletionOr<Value> Console::trace()
|
|||
StringBuilder builder;
|
||||
auto data = vm_arguments();
|
||||
auto formatted_data = TRY(m_client->formatter(data));
|
||||
trace.label = TRY(value_vector_to_string(formatted_data));
|
||||
trace.label = TRY(value_vector_to_deprecated_string(formatted_data));
|
||||
}
|
||||
|
||||
// 3. Perform Printer("trace", « trace »).
|
||||
|
@ -212,7 +212,7 @@ ThrowCompletionOr<Value> Console::assert_()
|
|||
// 3. Otherwise:
|
||||
else {
|
||||
// 1. Let concat be the concatenation of message, U+003A (:), U+0020 SPACE, and first.
|
||||
auto concat = js_string(vm, DeprecatedString::formatted("{}: {}", message->string(), first.to_string(vm).value()));
|
||||
auto concat = js_string(vm, DeprecatedString::formatted("{}: {}", message->deprecated_string(), first.to_string(vm).value()));
|
||||
// 2. Set data[0] to concat.
|
||||
data[0] = concat;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ ThrowCompletionOr<Value> Console::group()
|
|||
auto data = vm_arguments();
|
||||
if (!data.is_empty()) {
|
||||
auto formatted_data = TRY(m_client->formatter(data));
|
||||
group_label = TRY(value_vector_to_string(formatted_data));
|
||||
group_label = TRY(value_vector_to_deprecated_string(formatted_data));
|
||||
}
|
||||
// ... Otherwise, let groupLabel be an implementation-chosen label representing a group.
|
||||
else {
|
||||
|
@ -269,7 +269,7 @@ ThrowCompletionOr<Value> Console::group_collapsed()
|
|||
auto data = vm_arguments();
|
||||
if (!data.is_empty()) {
|
||||
auto formatted_data = TRY(m_client->formatter(data));
|
||||
group_label = TRY(value_vector_to_string(formatted_data));
|
||||
group_label = TRY(value_vector_to_deprecated_string(formatted_data));
|
||||
}
|
||||
// ... Otherwise, let groupLabel be an implementation-chosen label representing a group.
|
||||
else {
|
||||
|
@ -457,7 +457,7 @@ void Console::report_exception(JS::Error const& exception, bool in_promise) cons
|
|||
m_client->report_exception(exception, in_promise);
|
||||
}
|
||||
|
||||
ThrowCompletionOr<DeprecatedString> Console::value_vector_to_string(MarkedVector<Value> const& values)
|
||||
ThrowCompletionOr<DeprecatedString> Console::value_vector_to_deprecated_string(MarkedVector<Value> const& values)
|
||||
{
|
||||
auto& vm = realm().vm();
|
||||
StringBuilder builder;
|
||||
|
@ -466,7 +466,7 @@ ThrowCompletionOr<DeprecatedString> Console::value_vector_to_string(MarkedVector
|
|||
builder.append(' ');
|
||||
builder.append(TRY(item.to_string(vm)));
|
||||
}
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
ThrowCompletionOr<DeprecatedString> Console::format_time_since(Core::ElapsedTimer timer)
|
||||
|
@ -493,7 +493,7 @@ ThrowCompletionOr<DeprecatedString> Console::format_time_since(Core::ElapsedTime
|
|||
append(builder, "{:.3} seconds"sv, combined_seconds);
|
||||
}
|
||||
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 2.1. Logger(logLevel, args), https://console.spec.whatwg.org/#logger
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
void report_exception(JS::Error const&, bool) const;
|
||||
|
||||
private:
|
||||
ThrowCompletionOr<DeprecatedString> value_vector_to_string(MarkedVector<Value> const&);
|
||||
ThrowCompletionOr<DeprecatedString> value_vector_to_deprecated_string(MarkedVector<Value> const&);
|
||||
ThrowCompletionOr<DeprecatedString> format_time_since(Core::ElapsedTimer timer);
|
||||
|
||||
Realm& m_realm;
|
||||
|
|
|
@ -97,7 +97,7 @@ JS_DEFINE_NATIVE_FUNCTION($262Object::eval_script)
|
|||
auto& error = script_or_error.error()[0];
|
||||
|
||||
// b. Return Completion { [[Type]]: throw, [[Value]]: error, [[Target]]: empty }.
|
||||
return vm.throw_completion<SyntaxError>(error.to_string());
|
||||
return vm.throw_completion<SyntaxError>(error.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 5. Let status be ScriptEvaluation(s).
|
||||
|
|
|
@ -20,7 +20,7 @@ ThrowCompletionOr<Value> IsHTMLDDA::call()
|
|||
auto& vm = this->vm();
|
||||
if (vm.argument_count() == 0)
|
||||
return js_null();
|
||||
if (vm.argument(0).is_string() && vm.argument(0).as_string().string().is_empty())
|
||||
if (vm.argument(0).is_string() && vm.argument(0).as_string().deprecated_string().is_empty())
|
||||
return js_null();
|
||||
// Not sure if this really matters, INTERPRETING.md simply says:
|
||||
// * IsHTMLDDA - (present only in implementations that can provide it) an object that:
|
||||
|
|
|
@ -26,21 +26,21 @@ DeprecatedString MarkupGenerator::html_from_source(StringView source)
|
|||
builder.append(token.trivia());
|
||||
builder.append(wrap_string_in_style(token.value(), style_type_for_token(token)));
|
||||
}
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
DeprecatedString MarkupGenerator::html_from_value(Value value)
|
||||
{
|
||||
StringBuilder output_html;
|
||||
value_to_html(value, output_html);
|
||||
return output_html.to_string();
|
||||
return output_html.to_deprecated_string();
|
||||
}
|
||||
|
||||
DeprecatedString MarkupGenerator::html_from_error(Error const& object, bool in_promise)
|
||||
{
|
||||
StringBuilder output_html;
|
||||
error_to_html(object, output_html, in_promise);
|
||||
return output_html.to_string();
|
||||
return output_html.to_deprecated_string();
|
||||
}
|
||||
|
||||
void MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, HashTable<Object*> seen_objects)
|
||||
|
|
|
@ -1556,7 +1556,7 @@ NonnullRefPtr<RegExpLiteral> Parser::parse_regexp_literal()
|
|||
syntax_error(DeprecatedString::formatted("RegExp compile error: {}", Regex<ECMA262>(parsed_regex, parsed_pattern, parsed_flags).error_string()), rule_start.position());
|
||||
|
||||
SourceRange range { m_source_code, rule_start.position(), position() };
|
||||
return create_ast_node<RegExpLiteral>(move(range), move(parsed_regex), move(parsed_pattern), move(parsed_flags), pattern.to_string(), move(flags));
|
||||
return create_ast_node<RegExpLiteral>(move(range), move(parsed_regex), move(parsed_pattern), move(parsed_flags), pattern.to_deprecated_string(), move(flags));
|
||||
}
|
||||
|
||||
static bool is_simple_assignment_target(Expression const& expression, bool allow_web_reality_call_expression = true)
|
||||
|
@ -4104,7 +4104,7 @@ ModuleRequest Parser::parse_module_request()
|
|||
while (!done() && !match(TokenType::CurlyClose)) {
|
||||
DeprecatedString key;
|
||||
if (match(TokenType::StringLiteral)) {
|
||||
key = parse_string_literal(m_state.current_token)->value().to_string();
|
||||
key = parse_string_literal(m_state.current_token)->value().to_deprecated_string();
|
||||
consume();
|
||||
} else if (match_identifier_name()) {
|
||||
key = consume().value();
|
||||
|
@ -4120,7 +4120,7 @@ ModuleRequest Parser::parse_module_request()
|
|||
if (entries.key == key)
|
||||
syntax_error(DeprecatedString::formatted("Duplicate assertion clauses with name: {}", key));
|
||||
}
|
||||
request.add_assertion(move(key), parse_string_literal(m_state.current_token)->value().to_string());
|
||||
request.add_assertion(move(key), parse_string_literal(m_state.current_token)->value().to_deprecated_string());
|
||||
}
|
||||
consume(TokenType::StringLiteral);
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ public:
|
|||
if (!hint.is_empty())
|
||||
warnln("{}", hint);
|
||||
}
|
||||
warnln("SyntaxError: {}", error.to_string());
|
||||
warnln("SyntaxError: {}", error.to_deprecated_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
DeprecatedString ParserError::to_string() const
|
||||
DeprecatedString ParserError::to_deprecated_string() const
|
||||
{
|
||||
if (!position.has_value())
|
||||
return message;
|
||||
|
|
|
@ -17,7 +17,7 @@ struct ParserError {
|
|||
DeprecatedString message;
|
||||
Optional<Position> position;
|
||||
|
||||
DeprecatedString to_string() const;
|
||||
DeprecatedString to_deprecated_string() const;
|
||||
DeprecatedString source_location_hint(StringView source, char const spacer = ' ', char const indicator = '^') const;
|
||||
};
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ DeprecatedString strip_ansi(StringView format_string)
|
|||
}
|
||||
if (i < format_string.length())
|
||||
builder.append(format_string[i]);
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
|
|
|
@ -575,13 +575,13 @@ ThrowCompletionOr<Value> perform_eval(VM& vm, Value x, CallerMode strict_caller,
|
|||
.in_class_field_initializer = in_class_field_initializer,
|
||||
};
|
||||
|
||||
Parser parser { Lexer { code_string.string() }, Program::Type::Script, move(initial_state) };
|
||||
Parser parser { Lexer { code_string.deprecated_string() }, Program::Type::Script, move(initial_state) };
|
||||
auto program = parser.parse_program(strict_caller == CallerMode::Strict);
|
||||
|
||||
// b. If script is a List of errors, throw a SyntaxError exception.
|
||||
if (parser.has_errors()) {
|
||||
auto& error = parser.errors()[0];
|
||||
return vm.throw_completion<SyntaxError>(error.to_string());
|
||||
return vm.throw_completion<SyntaxError>(error.to_deprecated_string());
|
||||
}
|
||||
|
||||
bool strict_eval = false;
|
||||
|
@ -683,7 +683,7 @@ ThrowCompletionOr<Value> perform_eval(VM& vm, Value x, CallerMode strict_caller,
|
|||
if (auto* bytecode_interpreter = Bytecode::Interpreter::current()) {
|
||||
auto executable_result = Bytecode::Generator::generate(program);
|
||||
if (executable_result.is_error())
|
||||
return vm.throw_completion<InternalError>(ErrorType::NotImplemented, executable_result.error().to_string());
|
||||
return vm.throw_completion<InternalError>(ErrorType::NotImplemented, executable_result.error().to_deprecated_string());
|
||||
|
||||
auto executable = executable_result.release_value();
|
||||
executable->name = "eval"sv;
|
||||
|
|
|
@ -1012,7 +1012,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::join)
|
|||
builder.append(string);
|
||||
}
|
||||
|
||||
return js_string(vm, builder.to_string());
|
||||
return js_string(vm, builder.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 23.1.3.19 Array.prototype.keys ( ), https://tc39.es/ecma262/#sec-array.prototype.keys
|
||||
|
@ -1743,7 +1743,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string)
|
|||
}
|
||||
|
||||
// 7. Return R.
|
||||
return js_string(vm, builder.to_string());
|
||||
return js_string(vm, builder.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 1.1.1.4 Array.prototype.toReversed ( ), https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual ~BigInt() override = default;
|
||||
|
||||
Crypto::SignedBigInteger const& big_integer() const { return m_big_integer; }
|
||||
const DeprecatedString to_string() const { return DeprecatedString::formatted("{}n", m_big_integer.to_base(10)); }
|
||||
const DeprecatedString to_deprecated_string() const { return DeprecatedString::formatted("{}n", m_big_integer.to_base(10)); }
|
||||
|
||||
private:
|
||||
explicit BigInt(Crypto::SignedBigInteger);
|
||||
|
|
|
@ -239,7 +239,7 @@ ThrowCompletionOr<Object*> DateConstructor::construct(FunctionObject& new_target
|
|||
if (primitive.is_string()) {
|
||||
// 1. Assert: The next step never returns an abrupt completion because Type(v) is String.
|
||||
// 2. Let tv be the result of parsing v as a date, in exactly the same manner as for the parse method (21.4.3.2).
|
||||
time_value = parse_date_string(primitive.as_string().string());
|
||||
time_value = parse_date_string(primitive.as_string().deprecated_string());
|
||||
}
|
||||
// iii. Else,
|
||||
else {
|
||||
|
|
|
@ -1258,7 +1258,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::symbol_to_primitive)
|
|||
auto hint_value = vm.argument(0);
|
||||
if (!hint_value.is_string())
|
||||
return vm.throw_completion<TypeError>(ErrorType::InvalidHint, hint_value.to_string_without_side_effects());
|
||||
auto& hint = hint_value.as_string().string();
|
||||
auto& hint = hint_value.as_string().deprecated_string();
|
||||
Value::PreferredType try_first;
|
||||
if (hint == "string" || hint == "default")
|
||||
try_first = Value::PreferredType::String;
|
||||
|
|
|
@ -810,7 +810,7 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
|||
auto compile = [&](auto& node, auto kind, auto name) -> ThrowCompletionOr<NonnullOwnPtr<Bytecode::Executable>> {
|
||||
auto executable_result = Bytecode::Generator::generate(node, kind);
|
||||
if (executable_result.is_error())
|
||||
return vm.throw_completion<InternalError>(ErrorType::NotImplemented, executable_result.error().to_string());
|
||||
return vm.throw_completion<InternalError>(ErrorType::NotImplemented, executable_result.error().to_deprecated_string());
|
||||
|
||||
auto bytecode_executable = executable_result.release_value();
|
||||
bytecode_executable->name = name;
|
||||
|
|
|
@ -176,7 +176,7 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic
|
|||
// 17. If parameters is a List of errors, throw a SyntaxError exception.
|
||||
if (parameters_parser.has_errors()) {
|
||||
auto error = parameters_parser.errors()[0];
|
||||
return vm.throw_completion<SyntaxError>(error.to_string());
|
||||
return vm.throw_completion<SyntaxError>(error.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 18. Let body be ParseText(StringToCodePoints(bodyString), bodySym).
|
||||
|
@ -193,7 +193,7 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic
|
|||
// 19. If body is a List of errors, throw a SyntaxError exception.
|
||||
if (body_parser.has_errors()) {
|
||||
auto error = body_parser.errors()[0];
|
||||
return vm.throw_completion<SyntaxError>(error.to_string());
|
||||
return vm.throw_completion<SyntaxError>(error.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 20. NOTE: The parameters and body are parsed separately to ensure that each is valid alone. For example, new Function("/*", "*/ ) {") is not legal.
|
||||
|
@ -207,7 +207,7 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic
|
|||
// 23. If expr is a List of errors, throw a SyntaxError exception.
|
||||
if (source_parser.has_errors()) {
|
||||
auto error = source_parser.errors()[0];
|
||||
return vm.throw_completion<SyntaxError>(error.to_string());
|
||||
return vm.throw_completion<SyntaxError>(error.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 24. Let proto be ? GetPrototypeFromConstructor(newTarget, fallbackProto).
|
||||
|
|
|
@ -306,7 +306,7 @@ static MatcherResult lookup_matcher(Vector<DeprecatedString> const& requested_lo
|
|||
|
||||
// a. Let noExtensionsLocale be the String value that is locale with any Unicode locale extension sequences removed.
|
||||
auto extensions = locale_id->remove_extension_type<::Locale::LocaleExtension>();
|
||||
auto no_extensions_locale = locale_id->to_string();
|
||||
auto no_extensions_locale = locale_id->to_deprecated_string();
|
||||
|
||||
// b. Let availableLocale be ! BestAvailableLocale(availableLocales, noExtensionsLocale).
|
||||
auto available_locale = best_available_locale(no_extensions_locale);
|
||||
|
@ -383,7 +383,7 @@ LocaleResult resolve_locale(Vector<DeprecatedString> const& requested_locales, L
|
|||
MatcherResult matcher_result;
|
||||
|
||||
// 2. If matcher is "lookup", then
|
||||
if (matcher.is_string() && (matcher.as_string().string() == "lookup"sv)) {
|
||||
if (matcher.is_string() && (matcher.as_string().deprecated_string() == "lookup"sv)) {
|
||||
// a. Let r be ! LookupMatcher(availableLocales, requestedLocales).
|
||||
matcher_result = lookup_matcher(requested_locales);
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ Vector<DeprecatedString> lookup_supported_locales(Vector<DeprecatedString> const
|
|||
|
||||
// a. Let noExtensionsLocale be the String value that is locale with any Unicode locale extension sequences removed.
|
||||
locale_id->remove_extension_type<::Locale::LocaleExtension>();
|
||||
auto no_extensions_locale = locale_id->to_string();
|
||||
auto no_extensions_locale = locale_id->to_deprecated_string();
|
||||
|
||||
// b. Let availableLocale be ! BestAvailableLocale(availableLocales, noExtensionsLocale).
|
||||
auto available_locale = best_available_locale(no_extensions_locale);
|
||||
|
@ -578,7 +578,7 @@ ThrowCompletionOr<Array*> supported_locales(VM& vm, Vector<DeprecatedString> con
|
|||
Vector<DeprecatedString> supported_locales;
|
||||
|
||||
// 3. If matcher is "best fit", then
|
||||
if (matcher.as_string().string() == "best fit"sv) {
|
||||
if (matcher.as_string().deprecated_string() == "best fit"sv) {
|
||||
// a. Let supportedLocales be BestFitSupportedLocales(availableLocales, requestedLocales).
|
||||
supported_locales = best_fit_supported_locales(requested_locales);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat
|
|||
auto usage = TRY(get_option(vm, *options, vm.names.usage, OptionType::String, { "sort"sv, "search"sv }, "sort"sv));
|
||||
|
||||
// 4. Set collator.[[Usage]] to usage.
|
||||
collator.set_usage(usage.as_string().string());
|
||||
collator.set_usage(usage.as_string().deprecated_string());
|
||||
|
||||
// 5. If usage is "sort", then
|
||||
// a. Let localeData be %Collator%.[[SortLocaleData]].
|
||||
|
@ -49,11 +49,11 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat
|
|||
// 11. If collation is not undefined, then
|
||||
if (!collation.is_undefined()) {
|
||||
// a. If collation does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
|
||||
if (!::Locale::is_type_identifier(collation.as_string().string()))
|
||||
if (!::Locale::is_type_identifier(collation.as_string().deprecated_string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, collation, "collation"sv);
|
||||
|
||||
// 12. Set opt.[[co]] to collation.
|
||||
opt.co = collation.as_string().string();
|
||||
opt.co = collation.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 13. Let numeric be ? GetOption(options, "numeric", "boolean", undefined, undefined).
|
||||
|
@ -69,7 +69,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat
|
|||
// 17. Set opt.[[kf]] to caseFirst.
|
||||
auto case_first = TRY(get_option(vm, *options, vm.names.caseFirst, OptionType::String, { "upper"sv, "lower"sv, "false"sv }, Empty {}));
|
||||
if (!case_first.is_undefined())
|
||||
opt.kf = case_first.as_string().string();
|
||||
opt.kf = case_first.as_string().deprecated_string();
|
||||
|
||||
// 18. Let relevantExtensionKeys be %Collator%.[[RelevantExtensionKeys]].
|
||||
auto relevant_extension_keys = Collator::relevant_extension_keys();
|
||||
|
@ -117,7 +117,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat
|
|||
}
|
||||
|
||||
// 28. Set collator.[[Sensitivity]] to sensitivity.
|
||||
collator.set_sensitivity(sensitivity.as_string().string());
|
||||
collator.set_sensitivity(sensitivity.as_string().deprecated_string());
|
||||
|
||||
// 29. Let ignorePunctuation be ? GetOption(options, "ignorePunctuation", "boolean", undefined, false).
|
||||
auto ignore_punctuation = TRY(get_option(vm, *options, vm.names.ignorePunctuation, OptionType::Boolean, {}, false));
|
||||
|
|
|
@ -106,11 +106,11 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
|
|||
// 7. If calendar is not undefined, then
|
||||
if (!calendar.is_undefined()) {
|
||||
// a. If calendar does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
|
||||
if (!::Locale::is_type_identifier(calendar.as_string().string()))
|
||||
if (!::Locale::is_type_identifier(calendar.as_string().deprecated_string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, calendar, "calendar"sv);
|
||||
|
||||
// 8. Set opt.[[ca]] to calendar.
|
||||
opt.ca = calendar.as_string().string();
|
||||
opt.ca = calendar.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 9. Let numberingSystem be ? GetOption(options, "numberingSystem", "string", undefined, undefined).
|
||||
|
@ -119,11 +119,11 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
|
|||
// 10. If numberingSystem is not undefined, then
|
||||
if (!numbering_system.is_undefined()) {
|
||||
// a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
|
||||
if (!::Locale::is_type_identifier(numbering_system.as_string().string()))
|
||||
if (!::Locale::is_type_identifier(numbering_system.as_string().deprecated_string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, numbering_system, "numberingSystem"sv);
|
||||
|
||||
// 11. Set opt.[[nu]] to numberingSystem.
|
||||
opt.nu = numbering_system.as_string().string();
|
||||
opt.nu = numbering_system.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 12. Let hour12 be ? GetOption(options, "hour12", "boolean", undefined, undefined).
|
||||
|
@ -140,7 +140,7 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
|
|||
|
||||
// 15. Set opt.[[hc]] to hourCycle.
|
||||
if (!hour_cycle.is_nullish())
|
||||
opt.hc = hour_cycle.as_string().string();
|
||||
opt.hc = hour_cycle.as_string().deprecated_string();
|
||||
|
||||
// 16. Let localeData be %DateTimeFormat%.[[LocaleData]].
|
||||
// 17. Let r be ResolveLocale(%DateTimeFormat%.[[AvailableLocales]], requestedLocales, opt, %DateTimeFormat%.[[RelevantExtensionKeys]], localeData).
|
||||
|
@ -275,7 +275,7 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
|
|||
|
||||
// d. Set formatOptions.[[<prop>]] to value.
|
||||
if (!value.is_undefined()) {
|
||||
option = ::Locale::calendar_pattern_style_from_string(value.as_string().string());
|
||||
option = ::Locale::calendar_pattern_style_from_string(value.as_string().deprecated_string());
|
||||
|
||||
// e. If value is not undefined, then
|
||||
// i. Set hasExplicitFormatComponents to true.
|
||||
|
@ -294,14 +294,14 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
|
|||
|
||||
// 39. Set dateTimeFormat.[[DateStyle]] to dateStyle.
|
||||
if (!date_style.is_undefined())
|
||||
date_time_format.set_date_style(date_style.as_string().string());
|
||||
date_time_format.set_date_style(date_style.as_string().deprecated_string());
|
||||
|
||||
// 40. Let timeStyle be ? GetOption(options, "timeStyle", "string", « "full", "long", "medium", "short" », undefined).
|
||||
auto time_style = TRY(get_option(vm, *options, vm.names.timeStyle, OptionType::String, AK::Array { "full"sv, "long"sv, "medium"sv, "short"sv }, Empty {}));
|
||||
|
||||
// 41. Set dateTimeFormat.[[TimeStyle]] to timeStyle.
|
||||
if (!time_style.is_undefined())
|
||||
date_time_format.set_time_style(time_style.as_string().string());
|
||||
date_time_format.set_time_style(time_style.as_string().deprecated_string());
|
||||
|
||||
Optional<::Locale::CalendarPattern> best_format {};
|
||||
|
||||
|
@ -323,7 +323,7 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
|
|||
auto formats = ::Locale::get_calendar_available_formats(data_locale, date_time_format.calendar());
|
||||
|
||||
// b. If matcher is "basic", then
|
||||
if (matcher.as_string().string() == "basic"sv) {
|
||||
if (matcher.as_string().deprecated_string() == "basic"sv) {
|
||||
// i. Let bestFormat be BasicFormatMatcher(formatOptions, formats).
|
||||
best_format = basic_format_matcher(format_options, move(formats));
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ ThrowCompletionOr<Object*> DisplayNamesConstructor::construct(FunctionObject& ne
|
|||
auto style = TRY(get_option(vm, *options, vm.names.style, OptionType::String, { "narrow"sv, "short"sv, "long"sv }, "long"sv));
|
||||
|
||||
// 12. Set displayNames.[[Style]] to style.
|
||||
display_names->set_style(style.as_string().string());
|
||||
display_names->set_style(style.as_string().deprecated_string());
|
||||
|
||||
// 13. Let type be ? GetOption(options, "type", "string", « "language", "region", "script", "currency", "calendar", "dateTimeField" », undefined).
|
||||
auto type = TRY(get_option(vm, *options, vm.names.type, OptionType::String, { "language"sv, "region"sv, "script"sv, "currency"sv, "calendar"sv, "dateTimeField"sv }, Empty {}));
|
||||
|
@ -92,13 +92,13 @@ ThrowCompletionOr<Object*> DisplayNamesConstructor::construct(FunctionObject& ne
|
|||
return vm.throw_completion<TypeError>(ErrorType::IsUndefined, "options.type"sv);
|
||||
|
||||
// 15. Set displayNames.[[Type]] to type.
|
||||
display_names->set_type(type.as_string().string());
|
||||
display_names->set_type(type.as_string().deprecated_string());
|
||||
|
||||
// 16. Let fallback be ? GetOption(options, "fallback", "string", « "code", "none" », "code").
|
||||
auto fallback = TRY(get_option(vm, *options, vm.names.fallback, OptionType::String, { "code"sv, "none"sv }, "code"sv));
|
||||
|
||||
// 17. Set displayNames.[[Fallback]] to fallback.
|
||||
display_names->set_fallback(fallback.as_string().string());
|
||||
display_names->set_fallback(fallback.as_string().deprecated_string());
|
||||
|
||||
// 18. Set displayNames.[[Locale]] to r.[[locale]].
|
||||
display_names->set_locale(move(result.locale));
|
||||
|
@ -119,7 +119,7 @@ ThrowCompletionOr<Object*> DisplayNamesConstructor::construct(FunctionObject& ne
|
|||
// 26. If type is "language", then
|
||||
if (display_names->type() == DisplayNames::Type::Language) {
|
||||
// a. Set displayNames.[[LanguageDisplay]] to languageDisplay.
|
||||
display_names->set_language_display(language_display.as_string().string());
|
||||
display_names->set_language_display(language_display.as_string().deprecated_string());
|
||||
|
||||
// b. Let typeFields be typeFields.[[<languageDisplay>]].
|
||||
// c. Assert: typeFields is a Record (see 12.4.3).
|
||||
|
|
|
@ -47,7 +47,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::of)
|
|||
code = js_string(vm, move(code_string));
|
||||
|
||||
// 4. Let code be ? CanonicalCodeForDisplayNames(displayNames.[[Type]], code).
|
||||
code = TRY(canonical_code_for_display_names(vm, display_names->type(), code.as_string().string()));
|
||||
code = TRY(canonical_code_for_display_names(vm, display_names->type(), code.as_string().deprecated_string()));
|
||||
|
||||
// 5. Let fields be displayNames.[[Fields]].
|
||||
// 6. If fields has a field [[<code>]], return fields.[[<code>]].
|
||||
|
@ -57,48 +57,48 @@ JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::of)
|
|||
switch (display_names->type()) {
|
||||
case DisplayNames::Type::Language:
|
||||
if (display_names->language_display() == DisplayNames::LanguageDisplay::Dialect) {
|
||||
result = ::Locale::get_locale_language_mapping(display_names->locale(), code.as_string().string());
|
||||
result = ::Locale::get_locale_language_mapping(display_names->locale(), code.as_string().deprecated_string());
|
||||
if (result.has_value())
|
||||
break;
|
||||
}
|
||||
|
||||
if (auto locale = is_structurally_valid_language_tag(code.as_string().string()); locale.has_value())
|
||||
if (auto locale = is_structurally_valid_language_tag(code.as_string().deprecated_string()); locale.has_value())
|
||||
formatted_result = ::Locale::format_locale_for_display(display_names->locale(), locale.release_value());
|
||||
break;
|
||||
case DisplayNames::Type::Region:
|
||||
result = ::Locale::get_locale_territory_mapping(display_names->locale(), code.as_string().string());
|
||||
result = ::Locale::get_locale_territory_mapping(display_names->locale(), code.as_string().deprecated_string());
|
||||
break;
|
||||
case DisplayNames::Type::Script:
|
||||
result = ::Locale::get_locale_script_mapping(display_names->locale(), code.as_string().string());
|
||||
result = ::Locale::get_locale_script_mapping(display_names->locale(), code.as_string().deprecated_string());
|
||||
break;
|
||||
case DisplayNames::Type::Currency:
|
||||
switch (display_names->style()) {
|
||||
case ::Locale::Style::Long:
|
||||
result = ::Locale::get_locale_long_currency_mapping(display_names->locale(), code.as_string().string());
|
||||
result = ::Locale::get_locale_long_currency_mapping(display_names->locale(), code.as_string().deprecated_string());
|
||||
break;
|
||||
case ::Locale::Style::Short:
|
||||
result = ::Locale::get_locale_short_currency_mapping(display_names->locale(), code.as_string().string());
|
||||
result = ::Locale::get_locale_short_currency_mapping(display_names->locale(), code.as_string().deprecated_string());
|
||||
break;
|
||||
case ::Locale::Style::Narrow:
|
||||
result = ::Locale::get_locale_narrow_currency_mapping(display_names->locale(), code.as_string().string());
|
||||
result = ::Locale::get_locale_narrow_currency_mapping(display_names->locale(), code.as_string().deprecated_string());
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
break;
|
||||
case DisplayNames::Type::Calendar:
|
||||
result = ::Locale::get_locale_calendar_mapping(display_names->locale(), code.as_string().string());
|
||||
result = ::Locale::get_locale_calendar_mapping(display_names->locale(), code.as_string().deprecated_string());
|
||||
break;
|
||||
case DisplayNames::Type::DateTimeField:
|
||||
switch (display_names->style()) {
|
||||
case ::Locale::Style::Long:
|
||||
result = ::Locale::get_locale_long_date_field_mapping(display_names->locale(), code.as_string().string());
|
||||
result = ::Locale::get_locale_long_date_field_mapping(display_names->locale(), code.as_string().deprecated_string());
|
||||
break;
|
||||
case ::Locale::Style::Short:
|
||||
result = ::Locale::get_locale_short_date_field_mapping(display_names->locale(), code.as_string().string());
|
||||
result = ::Locale::get_locale_short_date_field_mapping(display_names->locale(), code.as_string().deprecated_string());
|
||||
break;
|
||||
case ::Locale::Style::Narrow:
|
||||
result = ::Locale::get_locale_narrow_date_field_mapping(display_names->locale(), code.as_string().string());
|
||||
result = ::Locale::get_locale_narrow_date_field_mapping(display_names->locale(), code.as_string().deprecated_string());
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
@ -272,7 +272,7 @@ ThrowCompletionOr<DurationUnitOptions> get_duration_unit_options(VM& vm, Depreca
|
|||
}
|
||||
}
|
||||
} else {
|
||||
style = style_value.as_string().string();
|
||||
style = style_value.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 4. Let displayField be the string-concatenation of unit and "Display".
|
||||
|
@ -296,7 +296,7 @@ ThrowCompletionOr<DurationUnitOptions> get_duration_unit_options(VM& vm, Depreca
|
|||
}
|
||||
|
||||
// 7. Return the Record { [[Style]]: style, [[Display]]: display }.
|
||||
return DurationUnitOptions { .style = move(style), .display = display.as_string().string() };
|
||||
return DurationUnitOptions { .style = move(style), .display = display.as_string().deprecated_string() };
|
||||
}
|
||||
|
||||
// 1.1.7 PartitionDurationFormatPattern ( durationFormat, duration ), https://tc39.es/proposal-intl-duration-format/#sec-partitiondurationformatpattern
|
||||
|
|
|
@ -67,14 +67,14 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject&
|
|||
// 7. If numberingSystem is not undefined, then
|
||||
if (!numbering_system.is_undefined()) {
|
||||
// a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
|
||||
if (!::Locale::is_type_identifier(numbering_system.as_string().string()))
|
||||
if (!::Locale::is_type_identifier(numbering_system.as_string().deprecated_string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, numbering_system, "numberingSystem"sv);
|
||||
}
|
||||
|
||||
// 8. Let opt be the Record { [[localeMatcher]]: matcher, [[nu]]: numberingSystem }.
|
||||
LocaleOptions opt {};
|
||||
opt.locale_matcher = matcher;
|
||||
opt.nu = numbering_system.is_undefined() ? Optional<DeprecatedString>() : numbering_system.as_string().string();
|
||||
opt.nu = numbering_system.is_undefined() ? Optional<DeprecatedString>() : numbering_system.as_string().deprecated_string();
|
||||
|
||||
// 9. Let r be ResolveLocale(%DurationFormat%.[[AvailableLocales]], requestedLocales, opt, %DurationFormat%.[[RelevantExtensionKeys]], %DurationFormat%.[[LocaleData]]).
|
||||
auto result = resolve_locale(requested_locales, opt, DurationFormat::relevant_extension_keys());
|
||||
|
@ -93,7 +93,7 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject&
|
|||
auto style = TRY(get_option(vm, *options, vm.names.style, OptionType::String, { "long"sv, "short"sv, "narrow"sv, "digital"sv }, "short"sv));
|
||||
|
||||
// 14. Set durationFormat.[[Style]] to style.
|
||||
duration_format->set_style(style.as_string().string());
|
||||
duration_format->set_style(style.as_string().deprecated_string());
|
||||
|
||||
// 15. Set durationFormat.[[DataLocale]] to r.[[dataLocale]].
|
||||
duration_format->set_data_locale(move(result.data_locale));
|
||||
|
@ -119,7 +119,7 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject&
|
|||
auto digital_base = duration_instances_component.digital_default;
|
||||
|
||||
// f. Let unitOptions be ? GetDurationUnitOptions(unit, options, style, valueList, digitalBase, prevStyle).
|
||||
auto unit_options = TRY(get_duration_unit_options(vm, unit, *options, style.as_string().string(), value_list, digital_base, previous_style));
|
||||
auto unit_options = TRY(get_duration_unit_options(vm, unit, *options, style.as_string().deprecated_string(), value_list, digital_base, previous_style));
|
||||
|
||||
// g. Set the value of the styleSlot slot of durationFormat to unitOptions.[[Style]].
|
||||
(duration_format->*style_slot)(unit_options.style);
|
||||
|
|
|
@ -274,7 +274,7 @@ ThrowCompletionOr<Vector<DeprecatedString>> string_list_from_iterable(VM& vm, Va
|
|||
}
|
||||
|
||||
// iii. Append nextValue to the end of the List list.
|
||||
list.append(next_value.as_string().string());
|
||||
list.append(next_value.as_string().deprecated_string());
|
||||
}
|
||||
} while (next != nullptr);
|
||||
|
||||
|
|
|
@ -80,13 +80,13 @@ ThrowCompletionOr<Object*> ListFormatConstructor::construct(FunctionObject& new_
|
|||
auto type = TRY(get_option(vm, *options, vm.names.type, OptionType::String, { "conjunction"sv, "disjunction"sv, "unit"sv }, "conjunction"sv));
|
||||
|
||||
// 12. Set listFormat.[[Type]] to type.
|
||||
list_format->set_type(type.as_string().string());
|
||||
list_format->set_type(type.as_string().deprecated_string());
|
||||
|
||||
// 13. Let style be ? GetOption(options, "style", "string", « "long", "short", "narrow" », "long").
|
||||
auto style = TRY(get_option(vm, *options, vm.names.style, OptionType::String, { "long"sv, "short"sv, "narrow"sv }, "long"sv));
|
||||
|
||||
// 14. Set listFormat.[[Style]] to style.
|
||||
list_format->set_style(style.as_string().string());
|
||||
list_format->set_style(style.as_string().deprecated_string());
|
||||
|
||||
// Note: The remaining steps are skipped in favor of deferring to LibUnicode.
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ Locale::Locale(Object& prototype)
|
|||
Locale::Locale(::Locale::LocaleID const& locale_id, Object& prototype)
|
||||
: Object(prototype)
|
||||
{
|
||||
set_locale(locale_id.to_string());
|
||||
set_locale(locale_id.to_deprecated_string());
|
||||
|
||||
for (auto const& extension : locale_id.extensions) {
|
||||
if (!extension.has<::Locale::LocaleExtension>())
|
||||
|
|
|
@ -33,10 +33,10 @@ static ThrowCompletionOr<Optional<DeprecatedString>> get_string_option(VM& vm, O
|
|||
if (option.is_undefined())
|
||||
return Optional<DeprecatedString> {};
|
||||
|
||||
if (validator && !validator(option.as_string().string()))
|
||||
if (validator && !validator(option.as_string().deprecated_string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, option, property);
|
||||
|
||||
return option.as_string().string();
|
||||
return option.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 14.1.2 ApplyOptionsToTag ( tag, options ), https://tc39.es/ecma402/#sec-apply-options-to-tag
|
||||
|
@ -198,7 +198,7 @@ static LocaleAndKeys apply_unicode_extension_to_tag(StringView tag, LocaleAndKey
|
|||
|
||||
// 7. Let locale be the String value that is tag with any Unicode locale extension sequences removed.
|
||||
locale_id->remove_extension_type<::Locale::LocaleExtension>();
|
||||
auto locale = locale_id->to_string();
|
||||
auto locale = locale_id->to_deprecated_string();
|
||||
|
||||
// 8. Let newExtension be a Unicode BCP 47 U Extension based on attributes and keywords.
|
||||
::Locale::LocaleExtension new_extension { move(attributes), move(keywords) };
|
||||
|
|
|
@ -115,7 +115,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::base_name)
|
|||
VERIFY(locale.has_value());
|
||||
|
||||
// 4. Return the substring of locale corresponding to the unicode_language_id production.
|
||||
return js_string(vm, locale->language_id.to_string());
|
||||
return js_string(vm, locale->language_id.to_deprecated_string());
|
||||
}
|
||||
|
||||
#define JS_ENUMERATE_LOCALE_KEYWORD_PROPERTIES \
|
||||
|
|
|
@ -293,7 +293,7 @@ bool MathematicalValue::is_zero() const
|
|||
[](auto) { return false; });
|
||||
}
|
||||
|
||||
DeprecatedString MathematicalValue::to_string() const
|
||||
DeprecatedString MathematicalValue::to_deprecated_string() const
|
||||
{
|
||||
return m_value.visit(
|
||||
[](double value) { return number_to_string(value, NumberToStringMode::WithoutExponent); },
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
bool is_positive() const;
|
||||
bool is_zero() const;
|
||||
|
||||
DeprecatedString to_string() const;
|
||||
DeprecatedString to_deprecated_string() const;
|
||||
Value to_value(VM&) const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -960,7 +960,7 @@ static DeprecatedString cut_trailing_zeroes(StringView string, int cut)
|
|||
string = string.substring_view(0, string.length() - 1);
|
||||
}
|
||||
|
||||
return string.to_string();
|
||||
return string.to_deprecated_string();
|
||||
}
|
||||
|
||||
enum class PreferredResult {
|
||||
|
@ -996,7 +996,7 @@ static auto to_raw_precision_function(MathematicalValue const& number, int preci
|
|||
result.number = number.divided_by_power(result.exponent - precision);
|
||||
|
||||
// FIXME: Can we do this without string conversion?
|
||||
auto digits = result.number.to_string();
|
||||
auto digits = result.number.to_deprecated_string();
|
||||
auto digit = digits.substring_view(digits.length() - 1);
|
||||
|
||||
result.number = result.number.divided_by(10);
|
||||
|
@ -1067,7 +1067,7 @@ RawFormatResult to_raw_precision(MathematicalValue const& number, int min_precis
|
|||
}
|
||||
|
||||
// f. Let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).
|
||||
result.formatted_string = n.to_string();
|
||||
result.formatted_string = n.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 4. If e ≥ p–1, then
|
||||
|
@ -1144,7 +1144,7 @@ static auto to_raw_fixed_function(MathematicalValue const& number, int fraction,
|
|||
result.number = number.multiplied_by_power(fraction - 1);
|
||||
|
||||
// FIXME: Can we do this without string conversion?
|
||||
auto digits = result.number.to_string();
|
||||
auto digits = result.number.to_deprecated_string();
|
||||
auto digit = digits.substring_view(digits.length() - 1);
|
||||
|
||||
result.number = result.number.multiplied_by(10);
|
||||
|
@ -1206,7 +1206,7 @@ RawFormatResult to_raw_fixed(MathematicalValue const& number, int min_fraction,
|
|||
}
|
||||
|
||||
// 7. If n = 0, let m be "0". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).
|
||||
result.formatted_string = n.is_zero() ? DeprecatedString("0"sv) : n.to_string();
|
||||
result.formatted_string = n.is_zero() ? DeprecatedString("0"sv) : n.to_deprecated_string();
|
||||
|
||||
// 8. If f ≠ 0, then
|
||||
if (fraction != 0) {
|
||||
|
@ -1592,7 +1592,7 @@ ThrowCompletionOr<MathematicalValue> to_intl_mathematical_value(VM& vm, Value va
|
|||
|
||||
// 3. If Type(primValue) is String,
|
||||
// a. Let str be primValue.
|
||||
auto const& string = primitive_value.as_string().string();
|
||||
auto const& string = primitive_value.as_string().deprecated_string();
|
||||
|
||||
// Step 4 handled separately by the FIXME above.
|
||||
|
||||
|
|
|
@ -103,11 +103,11 @@ ThrowCompletionOr<NumberFormat*> initialize_number_format(VM& vm, NumberFormat&
|
|||
// 7. If numberingSystem is not undefined, then
|
||||
if (!numbering_system.is_undefined()) {
|
||||
// a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
|
||||
if (!::Locale::is_type_identifier(numbering_system.as_string().string()))
|
||||
if (!::Locale::is_type_identifier(numbering_system.as_string().deprecated_string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, numbering_system, "numberingSystem"sv);
|
||||
|
||||
// 8. Set opt.[[nu]] to numberingSystem.
|
||||
opt.nu = numbering_system.as_string().string();
|
||||
opt.nu = numbering_system.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 9. Let localeData be %NumberFormat%.[[LocaleData]].
|
||||
|
@ -176,7 +176,7 @@ ThrowCompletionOr<NumberFormat*> initialize_number_format(VM& vm, NumberFormat&
|
|||
auto notation = TRY(get_option(vm, *options, vm.names.notation, OptionType::String, { "standard"sv, "scientific"sv, "engineering"sv, "compact"sv }, "standard"sv));
|
||||
|
||||
// 22. Set numberFormat.[[Notation]] to notation.
|
||||
number_format.set_notation(notation.as_string().string());
|
||||
number_format.set_notation(notation.as_string().deprecated_string());
|
||||
|
||||
// 23. Perform ? SetNumberFormatDigitOptions(numberFormat, options, mnfdDefault, mxfdDefault, notation).
|
||||
TRY(set_number_format_digit_options(vm, number_format, *options, default_min_fraction_digits, default_max_fraction_digits, number_format.notation()));
|
||||
|
@ -199,7 +199,7 @@ ThrowCompletionOr<NumberFormat*> initialize_number_format(VM& vm, NumberFormat&
|
|||
auto trailing_zero_display = TRY(get_option(vm, *options, vm.names.trailingZeroDisplay, OptionType::String, { "auto"sv, "stripIfInteger"sv }, "auto"sv));
|
||||
|
||||
// 27. Set numberFormat.[[TrailingZeroDisplay]] to trailingZeroDisplay.
|
||||
number_format.set_trailing_zero_display(trailing_zero_display.as_string().string());
|
||||
number_format.set_trailing_zero_display(trailing_zero_display.as_string().deprecated_string());
|
||||
|
||||
// 28. Let compactDisplay be ? GetOption(options, "compactDisplay", "string", « "short", "long" », "short").
|
||||
auto compact_display = TRY(get_option(vm, *options, vm.names.compactDisplay, OptionType::String, { "short"sv, "long"sv }, "short"sv));
|
||||
|
@ -210,7 +210,7 @@ ThrowCompletionOr<NumberFormat*> initialize_number_format(VM& vm, NumberFormat&
|
|||
// 30. If notation is "compact", then
|
||||
if (number_format.notation() == NumberFormat::Notation::Compact) {
|
||||
// a. Set numberFormat.[[CompactDisplay]] to compactDisplay.
|
||||
number_format.set_compact_display(compact_display.as_string().string());
|
||||
number_format.set_compact_display(compact_display.as_string().deprecated_string());
|
||||
|
||||
// b. Set defaultUseGrouping to "min2".
|
||||
default_use_grouping = "min2"sv;
|
||||
|
@ -226,13 +226,13 @@ ThrowCompletionOr<NumberFormat*> initialize_number_format(VM& vm, NumberFormat&
|
|||
auto sign_display = TRY(get_option(vm, *options, vm.names.signDisplay, OptionType::String, { "auto"sv, "never"sv, "always"sv, "exceptZero"sv, "negative"sv }, "auto"sv));
|
||||
|
||||
// 34. Set numberFormat.[[SignDisplay]] to signDisplay.
|
||||
number_format.set_sign_display(sign_display.as_string().string());
|
||||
number_format.set_sign_display(sign_display.as_string().deprecated_string());
|
||||
|
||||
// 35. Let roundingMode be ? GetOption(options, "roundingMode", "string", « "ceil", "floor", "expand", "trunc", "halfCeil", "halfFloor", "halfExpand", "halfTrunc", "halfEven" », "halfExpand").
|
||||
auto rounding_mode = TRY(get_option(vm, *options, vm.names.roundingMode, OptionType::String, { "ceil"sv, "floor"sv, "expand"sv, "trunc"sv, "halfCeil"sv, "halfFloor"sv, "halfExpand"sv, "halfTrunc"sv, "halfEven"sv }, "halfExpand"sv));
|
||||
|
||||
// 36. Set numberFormat.[[RoundingMode]] to roundingMode.
|
||||
number_format.set_rounding_mode(rounding_mode.as_string().string());
|
||||
number_format.set_rounding_mode(rounding_mode.as_string().deprecated_string());
|
||||
|
||||
// 37. Return numberFormat.
|
||||
return &number_format;
|
||||
|
@ -282,7 +282,7 @@ ThrowCompletionOr<void> set_number_format_digit_options(VM& vm, NumberFormatBase
|
|||
bool need_fraction_digits = true;
|
||||
|
||||
// 14. If roundingPriority is "auto", then
|
||||
if (rounding_priority.as_string().string() == "auto"sv) {
|
||||
if (rounding_priority.as_string().deprecated_string() == "auto"sv) {
|
||||
// a. Set needSd to hasSd.
|
||||
need_significant_digits = has_significant_digits;
|
||||
|
||||
|
@ -358,12 +358,12 @@ ThrowCompletionOr<void> set_number_format_digit_options(VM& vm, NumberFormatBase
|
|||
// 17. If needSd is true or needFd is true, then
|
||||
if (need_significant_digits || need_fraction_digits) {
|
||||
// a. If roundingPriority is "morePrecision", then
|
||||
if (rounding_priority.as_string().string() == "morePrecision"sv) {
|
||||
if (rounding_priority.as_string().deprecated_string() == "morePrecision"sv) {
|
||||
// i. Set intlObj.[[RoundingType]] to morePrecision.
|
||||
intl_object.set_rounding_type(NumberFormatBase::RoundingType::MorePrecision);
|
||||
}
|
||||
// b. Else if roundingPriority is "lessPrecision", then
|
||||
else if (rounding_priority.as_string().string() == "lessPrecision"sv) {
|
||||
else if (rounding_priority.as_string().deprecated_string() == "lessPrecision"sv) {
|
||||
// i. Set intlObj.[[RoundingType]] to lessPrecision.
|
||||
intl_object.set_rounding_type(NumberFormatBase::RoundingType::LessPrecision);
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ ThrowCompletionOr<void> set_number_format_unit_options(VM& vm, NumberFormat& int
|
|||
auto style = TRY(get_option(vm, options, vm.names.style, OptionType::String, { "decimal"sv, "percent"sv, "currency"sv, "unit"sv }, "decimal"sv));
|
||||
|
||||
// 4. Set intlObj.[[Style]] to style.
|
||||
intl_object.set_style(style.as_string().string());
|
||||
intl_object.set_style(style.as_string().deprecated_string());
|
||||
|
||||
// 5. Let currency be ? GetOption(options, "currency", "string", undefined, undefined).
|
||||
auto currency = TRY(get_option(vm, options, vm.names.currency, OptionType::String, {}, Empty {}));
|
||||
|
@ -423,7 +423,7 @@ ThrowCompletionOr<void> set_number_format_unit_options(VM& vm, NumberFormat& int
|
|||
}
|
||||
// 7. Else,
|
||||
// a. If ! IsWellFormedCurrencyCode(currency) is false, throw a RangeError exception.
|
||||
else if (!is_well_formed_currency_code(currency.as_string().string()))
|
||||
else if (!is_well_formed_currency_code(currency.as_string().deprecated_string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, currency, "currency"sv);
|
||||
|
||||
// 8. Let currencyDisplay be ? GetOption(options, "currencyDisplay", "string", « "code", "symbol", "narrowSymbol", "name" », "symbol").
|
||||
|
@ -443,7 +443,7 @@ ThrowCompletionOr<void> set_number_format_unit_options(VM& vm, NumberFormat& int
|
|||
}
|
||||
// 12. Else,
|
||||
// a. If ! IsWellFormedUnitIdentifier(unit) is false, throw a RangeError exception.
|
||||
else if (!is_well_formed_unit_identifier(unit.as_string().string()))
|
||||
else if (!is_well_formed_unit_identifier(unit.as_string().deprecated_string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, unit, "unit"sv);
|
||||
|
||||
// 13. Let unitDisplay be ? GetOption(options, "unitDisplay", "string", « "short", "narrow", "long" », "short").
|
||||
|
@ -452,22 +452,22 @@ ThrowCompletionOr<void> set_number_format_unit_options(VM& vm, NumberFormat& int
|
|||
// 14. If style is "currency", then
|
||||
if (intl_object.style() == NumberFormat::Style::Currency) {
|
||||
// a. Set intlObj.[[Currency]] to the ASCII-uppercase of currency.
|
||||
intl_object.set_currency(currency.as_string().string().to_uppercase());
|
||||
intl_object.set_currency(currency.as_string().deprecated_string().to_uppercase());
|
||||
|
||||
// c. Set intlObj.[[CurrencyDisplay]] to currencyDisplay.
|
||||
intl_object.set_currency_display(currency_display.as_string().string());
|
||||
intl_object.set_currency_display(currency_display.as_string().deprecated_string());
|
||||
|
||||
// d. Set intlObj.[[CurrencySign]] to currencySign.
|
||||
intl_object.set_currency_sign(currency_sign.as_string().string());
|
||||
intl_object.set_currency_sign(currency_sign.as_string().deprecated_string());
|
||||
}
|
||||
|
||||
// 15. If style is "unit", then
|
||||
if (intl_object.style() == NumberFormat::Style::Unit) {
|
||||
// a. Set intlObj.[[Unit]] to unit.
|
||||
intl_object.set_unit(unit.as_string().string());
|
||||
intl_object.set_unit(unit.as_string().deprecated_string());
|
||||
|
||||
// b. Set intlObj.[[UnitDisplay]] to unitDisplay.
|
||||
intl_object.set_unit_display(unit_display.as_string().string());
|
||||
intl_object.set_unit_display(unit_display.as_string().deprecated_string());
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
@ -94,7 +94,7 @@ ThrowCompletionOr<PluralRules*> initialize_plural_rules(VM& vm, PluralRules& plu
|
|||
auto type = TRY(get_option(vm, *options, vm.names.type, OptionType::String, AK::Array { "cardinal"sv, "ordinal"sv }, "cardinal"sv));
|
||||
|
||||
// 7. Set pluralRules.[[Type]] to t.
|
||||
plural_rules.set_type(type.as_string().string());
|
||||
plural_rules.set_type(type.as_string().deprecated_string());
|
||||
|
||||
// 8. Perform ? SetNumberFormatDigitOptions(pluralRules, options, +0𝔽, 3𝔽, "standard").
|
||||
TRY(set_number_format_digit_options(vm, plural_rules, *options, 0, 3, NumberFormat::Notation::Standard));
|
||||
|
|
|
@ -148,7 +148,7 @@ ThrowCompletionOr<Vector<PatternPartitionWithUnit>> partition_relative_time_patt
|
|||
VERIFY(patterns.size() == 1);
|
||||
|
||||
// i. Let result be patterns.[[<valueString>]].
|
||||
auto result = patterns[0].pattern.to_string();
|
||||
auto result = patterns[0].pattern.to_deprecated_string();
|
||||
|
||||
// ii. Return a List containing the Record { [[Type]]: "literal", [[Value]]: result }.
|
||||
return Vector<PatternPartitionWithUnit> { { "literal"sv, move(result) } };
|
||||
|
|
|
@ -101,11 +101,11 @@ ThrowCompletionOr<RelativeTimeFormat*> initialize_relative_time_format(VM& vm, R
|
|||
// 7. If numberingSystem is not undefined, then
|
||||
if (!numbering_system.is_undefined()) {
|
||||
// a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
|
||||
if (!::Locale::is_type_identifier(numbering_system.as_string().string()))
|
||||
if (!::Locale::is_type_identifier(numbering_system.as_string().deprecated_string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, numbering_system, "numberingSystem"sv);
|
||||
|
||||
// 8. Set opt.[[nu]] to numberingSystem.
|
||||
opt.nu = numbering_system.as_string().string();
|
||||
opt.nu = numbering_system.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 9. Let localeData be %RelativeTimeFormat%.[[LocaleData]].
|
||||
|
@ -129,13 +129,13 @@ ThrowCompletionOr<RelativeTimeFormat*> initialize_relative_time_format(VM& vm, R
|
|||
auto style = TRY(get_option(vm, *options, vm.names.style, OptionType::String, { "long"sv, "short"sv, "narrow"sv }, "long"sv));
|
||||
|
||||
// 16. Set relativeTimeFormat.[[Style]] to style.
|
||||
relative_time_format.set_style(style.as_string().string());
|
||||
relative_time_format.set_style(style.as_string().deprecated_string());
|
||||
|
||||
// 17. Let numeric be ? GetOption(options, "numeric", "string", « "always", "auto" », "always").
|
||||
auto numeric = TRY(get_option(vm, *options, vm.names.numeric, OptionType::String, { "always"sv, "auto"sv }, "always"sv));
|
||||
|
||||
// 18. Set relativeTimeFormat.[[Numeric]] to numeric.
|
||||
relative_time_format.set_numeric(numeric.as_string().string());
|
||||
relative_time_format.set_numeric(numeric.as_string().deprecated_string());
|
||||
|
||||
// 19. Let relativeTimeFormat.[[NumberFormat]] be ! Construct(%NumberFormat%, « locale »).
|
||||
auto* number_format = MUST(construct(vm, *realm.intrinsics().intl_number_format_constructor(), js_string(vm, locale)));
|
||||
|
|
|
@ -80,7 +80,7 @@ ThrowCompletionOr<Object*> SegmenterConstructor::construct(FunctionObject& new_t
|
|||
auto granularity = TRY(get_option(vm, *options, vm.names.granularity, OptionType::String, { "grapheme"sv, "word"sv, "sentence"sv }, "grapheme"sv));
|
||||
|
||||
// 13. Set segmenter.[[SegmenterGranularity]] to granularity.
|
||||
segmenter->set_segmenter_granularity(granularity.as_string().string());
|
||||
segmenter->set_segmenter_granularity(granularity.as_string().deprecated_string());
|
||||
|
||||
// 14. Return segmenter.
|
||||
return segmenter;
|
||||
|
|
|
@ -63,7 +63,7 @@ ThrowCompletionOr<DeprecatedString> JSONObject::stringify_impl(VM& vm, Value val
|
|||
auto replacer_value = TRY(replacer_object.get(i));
|
||||
DeprecatedString item;
|
||||
if (replacer_value.is_string()) {
|
||||
item = replacer_value.as_string().string();
|
||||
item = replacer_value.as_string().deprecated_string();
|
||||
} else if (replacer_value.is_number()) {
|
||||
item = MUST(replacer_value.to_string(vm));
|
||||
} else if (replacer_value.is_object()) {
|
||||
|
@ -93,7 +93,7 @@ ThrowCompletionOr<DeprecatedString> JSONObject::stringify_impl(VM& vm, Value val
|
|||
space_mv = min(10, space_mv);
|
||||
state.gap = space_mv < 1 ? DeprecatedString::empty() : DeprecatedString::repeated(' ', space_mv);
|
||||
} else if (space.is_string()) {
|
||||
auto string = space.as_string().string();
|
||||
auto string = space.as_string().deprecated_string();
|
||||
if (string.length() <= 10)
|
||||
state.gap = string;
|
||||
else
|
||||
|
@ -185,7 +185,7 @@ ThrowCompletionOr<DeprecatedString> JSONObject::serialize_json_property(VM& vm,
|
|||
|
||||
// 8. If Type(value) is String, return QuoteJSONString(value).
|
||||
if (value.is_string())
|
||||
return quote_json_string(value.as_string().string());
|
||||
return quote_json_string(value.as_string().deprecated_string());
|
||||
|
||||
// 9. If Type(value) is Number, then
|
||||
if (value.is_number()) {
|
||||
|
@ -250,7 +250,7 @@ ThrowCompletionOr<DeprecatedString> JSONObject::serialize_json_object(VM& vm, St
|
|||
} else {
|
||||
auto property_list = TRY(object.enumerable_own_property_names(PropertyKind::Key));
|
||||
for (auto& property : property_list)
|
||||
TRY(process_property(property.as_string().string()));
|
||||
TRY(process_property(property.as_string().deprecated_string()));
|
||||
}
|
||||
StringBuilder builder;
|
||||
if (property_strings.is_empty()) {
|
||||
|
@ -283,7 +283,7 @@ ThrowCompletionOr<DeprecatedString> JSONObject::serialize_json_object(VM& vm, St
|
|||
|
||||
state.seen_objects.remove(&object);
|
||||
state.indent = previous_indent;
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 25.5.2.5 SerializeJSONArray ( state, value ), https://tc39.es/ecma262/#sec-serializejsonarray
|
||||
|
@ -344,7 +344,7 @@ ThrowCompletionOr<DeprecatedString> JSONObject::serialize_json_array(VM& vm, Str
|
|||
|
||||
state.seen_objects.remove(&object);
|
||||
state.indent = previous_indent;
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 25.5.2.2 QuoteJSONString ( value ), https://tc39.es/ecma262/#sec-quotejsonstring
|
||||
|
@ -385,7 +385,7 @@ DeprecatedString JSONObject::quote_json_string(DeprecatedString string)
|
|||
}
|
||||
}
|
||||
builder.append('"');
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 25.5.1 JSON.parse ( text [ , reviver ] ), https://tc39.es/ecma262/#sec-json.parse
|
||||
|
@ -422,7 +422,7 @@ Value JSONObject::parse_json_value(VM& vm, JsonValue const& value)
|
|||
if (value.is_number())
|
||||
return Value(value.to_double(0));
|
||||
if (value.is_string())
|
||||
return js_string(vm, value.to_string());
|
||||
return js_string(vm, value.to_deprecated_string());
|
||||
if (value.is_bool())
|
||||
return Value(static_cast<bool>(value.as_bool()));
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -473,7 +473,7 @@ ThrowCompletionOr<Value> JSONObject::internalize_json_property(VM& vm, Object* h
|
|||
} else {
|
||||
auto property_list = TRY(value_object.enumerable_own_property_names(Object::PropertyKind::Key));
|
||||
for (auto& property_key : property_list)
|
||||
TRY(process_property(property_key.as_string().string()));
|
||||
TRY(process_property(property_key.as_string().deprecated_string()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1246,7 +1246,7 @@ Optional<Completion> Object::enumerate_object_properties(Function<Optional<Compl
|
|||
for (auto& key : own_keys) {
|
||||
if (!key.is_string())
|
||||
continue;
|
||||
FlyString property_key = key.as_string().string();
|
||||
FlyString property_key = key.as_string().deprecated_string();
|
||||
if (visited.contains(property_key))
|
||||
continue;
|
||||
auto descriptor = TRY(target->internal_get_own_property(property_key));
|
||||
|
|
|
@ -125,7 +125,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string)
|
|||
if (!to_string_tag.is_string())
|
||||
tag = move(builtin_tag);
|
||||
else
|
||||
tag = to_string_tag.as_string().string();
|
||||
tag = to_string_tag.as_string().deprecated_string();
|
||||
|
||||
// 17. Return the string-concatenation of "[object ", tag, and "]".
|
||||
return js_string(vm, DeprecatedString::formatted("[object {}]", tag));
|
||||
|
|
|
@ -63,7 +63,7 @@ bool PrimitiveString::is_empty() const
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
DeprecatedString const& PrimitiveString::string() const
|
||||
DeprecatedString const& PrimitiveString::deprecated_string() const
|
||||
{
|
||||
resolve_rope_if_needed();
|
||||
if (!m_has_utf8_string) {
|
||||
|
@ -234,21 +234,21 @@ void PrimitiveString::resolve_rope_if_needed() const
|
|||
for (auto const* current : pieces) {
|
||||
if (!previous) {
|
||||
// This is the very first piece, just append it and continue.
|
||||
builder.append(current->string());
|
||||
builder.append(current->deprecated_string());
|
||||
previous = current;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the UTF-8 representations for both strings.
|
||||
auto const& previous_string_as_utf8 = previous->string();
|
||||
auto const& current_string_as_utf8 = current->string();
|
||||
auto const& previous_string_as_utf8 = previous->deprecated_string();
|
||||
auto const& current_string_as_utf8 = current->deprecated_string();
|
||||
|
||||
// NOTE: Now we need to look at the end of the previous string and the start
|
||||
// of the current string, to see if they should be combined into a surrogate.
|
||||
|
||||
// Surrogates encoded as UTF-8 are 3 bytes.
|
||||
if ((previous_string_as_utf8.length() < 3) || (current_string_as_utf8.length() < 3)) {
|
||||
builder.append(current->string());
|
||||
builder.append(current->deprecated_string());
|
||||
previous = current;
|
||||
continue;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ void PrimitiveString::resolve_rope_if_needed() const
|
|||
// Might the previous string end with a UTF-8 encoded surrogate?
|
||||
if ((static_cast<u8>(previous_string_as_utf8[previous_string_as_utf8.length() - 3]) & 0xf0) != 0xe0) {
|
||||
// If not, just append the current string and continue.
|
||||
builder.append(current->string());
|
||||
builder.append(current->deprecated_string());
|
||||
previous = current;
|
||||
continue;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ void PrimitiveString::resolve_rope_if_needed() const
|
|||
// Might the current string begin with a UTF-8 encoded surrogate?
|
||||
if ((static_cast<u8>(current_string_as_utf8[0]) & 0xf0) != 0xe0) {
|
||||
// If not, just append the current string and continue.
|
||||
builder.append(current->string());
|
||||
builder.append(current->deprecated_string());
|
||||
previous = current;
|
||||
continue;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ void PrimitiveString::resolve_rope_if_needed() const
|
|||
auto low_surrogate = *Utf8View(current_string_as_utf8).begin();
|
||||
|
||||
if (!Utf16View::is_high_surrogate(high_surrogate) || !Utf16View::is_low_surrogate(low_surrogate)) {
|
||||
builder.append(current->string());
|
||||
builder.append(current->deprecated_string());
|
||||
previous = current;
|
||||
continue;
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ void PrimitiveString::resolve_rope_if_needed() const
|
|||
previous = current;
|
||||
}
|
||||
|
||||
m_utf8_string = builder.to_string();
|
||||
m_utf8_string = builder.to_deprecated_string();
|
||||
m_has_utf8_string = true;
|
||||
m_is_rope = false;
|
||||
m_lhs = nullptr;
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
bool is_empty() const;
|
||||
|
||||
DeprecatedString const& string() const;
|
||||
DeprecatedString const& deprecated_string() const;
|
||||
bool has_utf8_string() const { return m_has_utf8_string; }
|
||||
|
||||
Utf16String const& utf16_string() const;
|
||||
|
|
|
@ -194,7 +194,7 @@ ThrowCompletionOr<bool> Reference::delete_(VM& vm)
|
|||
return m_base_environment->delete_binding(vm, m_name.as_string());
|
||||
}
|
||||
|
||||
DeprecatedString Reference::to_string() const
|
||||
DeprecatedString Reference::to_deprecated_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("Reference { Base="sv);
|
||||
|
@ -216,7 +216,7 @@ DeprecatedString Reference::to_string() const
|
|||
if (!m_name.is_valid())
|
||||
builder.append("<invalid>"sv);
|
||||
else if (m_name.is_symbol())
|
||||
builder.appendff("{}", m_name.as_symbol()->to_string());
|
||||
builder.appendff("{}", m_name.as_symbol()->to_deprecated_string());
|
||||
else
|
||||
builder.appendff("{}", m_name.to_string());
|
||||
builder.appendff(", Strict={}", m_strict);
|
||||
|
@ -227,7 +227,7 @@ DeprecatedString Reference::to_string() const
|
|||
builder.appendff("{}", m_this_value.to_string_without_side_effects());
|
||||
|
||||
builder.append(" }"sv);
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 6.2.4.8 InitializeReferencedBinding ( V, W ), https://tc39.es/ecma262/#sec-object.prototype.hasownproperty
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
ThrowCompletionOr<Value> get_value(VM&) const;
|
||||
ThrowCompletionOr<bool> delete_(VM&);
|
||||
|
||||
DeprecatedString to_string() const;
|
||||
DeprecatedString to_deprecated_string() const;
|
||||
|
||||
bool is_valid_reference() const { return m_name.is_valid() || m_is_private; }
|
||||
|
||||
|
|
|
@ -510,7 +510,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::flags)
|
|||
#undef __JS_ENUMERATE
|
||||
|
||||
// 18. Return result.
|
||||
return js_string(vm, builder.to_string());
|
||||
return js_string(vm, builder.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 22.2.5.8 RegExp.prototype [ @@match ] ( string ), https://tc39.es/ecma262/#sec-regexp.prototype-@@match
|
||||
|
|
|
@ -86,7 +86,7 @@ ThrowCompletionOr<void> copy_name_and_length(VM& vm, FunctionObject& function, F
|
|||
target_name = js_string(vm, DeprecatedString::empty());
|
||||
|
||||
// 8. Perform SetFunctionName(F, targetName, prefix).
|
||||
function.set_function_name({ target_name.as_string().string() }, move(prefix));
|
||||
function.set_function_name({ target_name.as_string().deprecated_string() }, move(prefix));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ ThrowCompletionOr<Value> perform_shadow_realm_eval(VM& vm, StringView source_tex
|
|||
// b. If script is a List of errors, throw a SyntaxError exception.
|
||||
if (parser.has_errors()) {
|
||||
auto& error = parser.errors()[0];
|
||||
return vm.throw_completion<SyntaxError>(error.to_string());
|
||||
return vm.throw_completion<SyntaxError>(error.to_deprecated_string());
|
||||
}
|
||||
|
||||
// c. If script Contains ScriptBody is false, return undefined.
|
||||
|
@ -272,7 +272,7 @@ ThrowCompletionOr<Value> shadow_realm_import_value(VM& vm, DeprecatedString spec
|
|||
// NOTE: Even though the spec tells us to use %ThrowTypeError%, it's not observable if we actually do.
|
||||
// Throw a nicer TypeError forwarding the import error message instead (we know the argument is an Error object).
|
||||
auto* throw_type_error = NativeFunction::create(realm, {}, [](auto& vm) -> ThrowCompletionOr<Value> {
|
||||
return vm.template throw_completion<TypeError>(vm.argument(0).as_object().get_without_side_effects(vm.names.message).as_string().string());
|
||||
return vm.template throw_completion<TypeError>(vm.argument(0).as_object().get_without_side_effects(vm.names.message).as_string().deprecated_string());
|
||||
});
|
||||
|
||||
// 13. Return PerformPromiseThen(innerCapability.[[Promise]], onFulfilled, callerRealm.[[Intrinsics]].[[%ThrowTypeError%]], promiseCapability).
|
||||
|
|
|
@ -49,7 +49,7 @@ JS_DEFINE_NATIVE_FUNCTION(ShadowRealmPrototype::evaluate)
|
|||
auto& eval_realm = object->shadow_realm();
|
||||
|
||||
// 6. Return ? PerformShadowRealmEval(sourceText, callerRealm, evalRealm).
|
||||
return perform_shadow_realm_eval(vm, source_text.as_string().string(), *caller_realm, eval_realm);
|
||||
return perform_shadow_realm_eval(vm, source_text.as_string().deprecated_string(), *caller_realm, eval_realm);
|
||||
}
|
||||
|
||||
// 3.4.2 ShadowRealm.prototype.importValue ( specifier, exportName ), https://tc39.es/proposal-shadowrealm/#sec-shadowrealm.prototype.importvalue
|
||||
|
@ -79,7 +79,7 @@ JS_DEFINE_NATIVE_FUNCTION(ShadowRealmPrototype::import_value)
|
|||
auto& eval_context = object->execution_context();
|
||||
|
||||
// 8. Return ? ShadowRealmImportValue(specifierString, exportNameString, callerRealm, evalRealm, evalContext).
|
||||
return shadow_realm_import_value(vm, move(specifier_string), export_name.as_string().string(), *caller_realm, eval_realm, eval_context);
|
||||
return shadow_realm_import_value(vm, move(specifier_string), export_name.as_string().deprecated_string(), *caller_realm, eval_realm, eval_context);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ ThrowCompletionOr<Value> StringConstructor::call()
|
|||
if (!vm.argument_count())
|
||||
return js_string(heap(), "");
|
||||
if (vm.argument(0).is_symbol())
|
||||
return js_string(vm, vm.argument(0).as_symbol().to_string());
|
||||
return js_string(vm, vm.argument(0).as_symbol().to_deprecated_string());
|
||||
return TRY(vm.argument(0).to_primitive_string(vm));
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringIteratorPrototype::next)
|
|||
builder.append_code_point(*utf8_iterator);
|
||||
++utf8_iterator;
|
||||
|
||||
return create_iterator_result_object(vm, js_string(vm, builder.to_string()), false);
|
||||
return create_iterator_result_object(vm, js_string(vm, builder.to_deprecated_string()), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
if (is_string())
|
||||
return as_string();
|
||||
if (is_symbol())
|
||||
return as_symbol()->to_string();
|
||||
return as_symbol()->to_deprecated_string();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
|
|
@ -578,7 +578,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::repeat)
|
|||
StringBuilder builder;
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
builder.append(string);
|
||||
return js_string(vm, builder.to_string());
|
||||
return js_string(vm, builder.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 22.1.3.18 String.prototype.replace ( searchValue, replaceValue ), https://tc39.es/ecma262/#sec-string.prototype.replace
|
||||
|
@ -897,7 +897,7 @@ static ThrowCompletionOr<DeprecatedString> transform_case(VM& vm, StringView str
|
|||
|
||||
// 4. Let noExtensionsLocale be the String value that is requestedLocale with any Unicode locale extension sequences (6.2.1) removed.
|
||||
requested_locale->remove_extension_type<Locale::LocaleExtension>();
|
||||
auto no_extensions_locale = requested_locale->to_string();
|
||||
auto no_extensions_locale = requested_locale->to_deprecated_string();
|
||||
|
||||
// 5. Let availableLocales be a List with language tags that includes the languages for which the Unicode Character Database contains language sensitive case mappings. Implementations may add additional language tags if they support case mapping for additional locales.
|
||||
// 6. Let locale be ! BestAvailableLocale(availableLocales, noExtensionsLocale).
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
DeprecatedString description() const { return m_description.value_or(""); }
|
||||
Optional<DeprecatedString> const& raw_description() const { return m_description; }
|
||||
bool is_global() const { return m_is_global; }
|
||||
DeprecatedString to_string() const { return DeprecatedString::formatted("Symbol({})", description()); }
|
||||
DeprecatedString to_deprecated_string() const { return DeprecatedString::formatted("Symbol({})", description()); }
|
||||
|
||||
private:
|
||||
Symbol(Optional<DeprecatedString>, bool);
|
||||
|
|
|
@ -61,7 +61,7 @@ JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::description_getter)
|
|||
JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::to_string)
|
||||
{
|
||||
auto* symbol = TRY(this_symbol_value(vm, vm.this_value()));
|
||||
return js_string(vm, symbol->to_string());
|
||||
return js_string(vm, symbol->to_deprecated_string());
|
||||
}
|
||||
|
||||
// 20.4.3.4 Symbol.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-symbol.prototype.valueof
|
||||
|
|
|
@ -147,8 +147,8 @@ ThrowCompletionOr<Value> get_option(VM& vm, Object const& options, PropertyKey c
|
|||
if (!values.is_empty()) {
|
||||
// NOTE: Every location in the spec that invokes GetOption with type=boolean also has values=undefined.
|
||||
VERIFY(value.is_string());
|
||||
if (!values.contains_slow(value.as_string().string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, value.as_string().string(), property.as_string());
|
||||
if (!values.contains_slow(value.as_string().deprecated_string()))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, value.as_string().deprecated_string(), property.as_string());
|
||||
}
|
||||
|
||||
// 9. Return value.
|
||||
|
@ -166,7 +166,7 @@ ThrowCompletionOr<DeprecatedString> to_temporal_overflow(VM& vm, Object const* o
|
|||
auto option = TRY(get_option(vm, *options, vm.names.overflow, OptionType::String, { "constrain"sv, "reject"sv }, "constrain"sv));
|
||||
|
||||
VERIFY(option.is_string());
|
||||
return option.as_string().string();
|
||||
return option.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 13.5 ToTemporalDisambiguation ( options ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaldisambiguation
|
||||
|
@ -180,7 +180,7 @@ ThrowCompletionOr<DeprecatedString> to_temporal_disambiguation(VM& vm, Object co
|
|||
auto option = TRY(get_option(vm, *options, vm.names.disambiguation, OptionType::String, { "compatible"sv, "earlier"sv, "later"sv, "reject"sv }, "compatible"sv));
|
||||
|
||||
VERIFY(option.is_string());
|
||||
return option.as_string().string();
|
||||
return option.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 13.6 ToTemporalRoundingMode ( normalizedOptions, fallback ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingmode
|
||||
|
@ -203,7 +203,7 @@ ThrowCompletionOr<DeprecatedString> to_temporal_rounding_mode(VM& vm, Object con
|
|||
fallback.view()));
|
||||
|
||||
VERIFY(option.is_string());
|
||||
return option.as_string().string();
|
||||
return option.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 13.7 NegateTemporalRoundingMode ( roundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-negatetemporalroundingmode
|
||||
|
@ -240,7 +240,7 @@ ThrowCompletionOr<DeprecatedString> to_temporal_offset(VM& vm, Object const* opt
|
|||
auto option = TRY(get_option(vm, *options, vm.names.offset, OptionType::String, { "prefer"sv, "use"sv, "ignore"sv, "reject"sv }, fallback.view()));
|
||||
|
||||
VERIFY(option.is_string());
|
||||
return option.as_string().string();
|
||||
return option.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 13.9 ToCalendarNameOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-tocalendarnameoption
|
||||
|
@ -250,7 +250,7 @@ ThrowCompletionOr<DeprecatedString> to_calendar_name_option(VM& vm, Object const
|
|||
auto option = TRY(get_option(vm, normalized_options, vm.names.calendarName, OptionType::String, { "auto"sv, "always"sv, "never"sv, "critical"sv }, "auto"sv));
|
||||
|
||||
VERIFY(option.is_string());
|
||||
return option.as_string().string();
|
||||
return option.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 13.10 ToTimeZoneNameOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-totimezonenameoption
|
||||
|
@ -260,7 +260,7 @@ ThrowCompletionOr<DeprecatedString> to_time_zone_name_option(VM& vm, Object cons
|
|||
auto option = TRY(get_option(vm, normalized_options, vm.names.timeZoneName, OptionType::String, { "auto"sv, "never"sv, "critical"sv }, "auto"sv));
|
||||
|
||||
VERIFY(option.is_string());
|
||||
return option.as_string().string();
|
||||
return option.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 13.11 ToShowOffsetOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowoffsetoption
|
||||
|
@ -270,7 +270,7 @@ ThrowCompletionOr<DeprecatedString> to_show_offset_option(VM& vm, Object const&
|
|||
auto option = TRY(get_option(vm, normalized_options, vm.names.offset, OptionType::String, { "auto"sv, "never"sv }, "auto"sv));
|
||||
|
||||
VERIFY(option.is_string());
|
||||
return option.as_string().string();
|
||||
return option.as_string().deprecated_string();
|
||||
}
|
||||
|
||||
// 13.12 ToTemporalRoundingIncrement ( normalizedOptions, dividend, inclusive ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingincrement
|
||||
|
@ -531,7 +531,7 @@ ThrowCompletionOr<Optional<DeprecatedString>> get_temporal_unit(VM& vm, Object c
|
|||
|
||||
Optional<DeprecatedString> value = option_value.is_undefined()
|
||||
? Optional<DeprecatedString> {}
|
||||
: option_value.as_string().string();
|
||||
: option_value.as_string().deprecated_string();
|
||||
|
||||
// 11. If value is listed in the Plural column of Table 13, then
|
||||
for (auto const& row : temporal_units) {
|
||||
|
|
|
@ -126,7 +126,7 @@ ThrowCompletionOr<Vector<DeprecatedString>> calendar_fields(VM& vm, Object& cale
|
|||
|
||||
Vector<DeprecatedString> result;
|
||||
for (auto& value : list)
|
||||
result.append(value.as_string().string());
|
||||
result.append(value.as_string().deprecated_string());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -791,7 +791,7 @@ ThrowCompletionOr<double> resolve_iso_month(VM& vm, Object const& fields)
|
|||
|
||||
// 6. Assert: Type(monthCode) is String.
|
||||
VERIFY(month_code.is_string());
|
||||
auto& month_code_string = month_code.as_string().string();
|
||||
auto& month_code_string = month_code.as_string().deprecated_string();
|
||||
|
||||
// 7. If the length of monthCode is not 3, throw a RangeError exception.
|
||||
auto month_length = month_code_string.length();
|
||||
|
@ -953,7 +953,7 @@ ThrowCompletionOr<Object*> default_merge_calendar_fields(VM& vm, Object const& f
|
|||
// 3. For each element key of fieldsKeys, do
|
||||
for (auto& key : fields_keys) {
|
||||
// a. If key is not "month" or "monthCode", then
|
||||
if (key.as_string().string() != vm.names.month.as_string() && key.as_string().string() != vm.names.monthCode.as_string()) {
|
||||
if (key.as_string().deprecated_string() != vm.names.month.as_string() && key.as_string().deprecated_string() != vm.names.monthCode.as_string()) {
|
||||
auto property_key = MUST(PropertyKey::from_value(vm, key));
|
||||
|
||||
// i. Let propValue be ? Get(fields, key).
|
||||
|
@ -987,7 +987,7 @@ ThrowCompletionOr<Object*> default_merge_calendar_fields(VM& vm, Object const& f
|
|||
}
|
||||
|
||||
// See comment above.
|
||||
additional_fields_keys_contains_month_or_month_code_property |= key.as_string().string() == vm.names.month.as_string() || key.as_string().string() == vm.names.monthCode.as_string();
|
||||
additional_fields_keys_contains_month_or_month_code_property |= key.as_string().deprecated_string() == vm.names.month.as_string() || key.as_string().deprecated_string() == vm.names.monthCode.as_string();
|
||||
}
|
||||
|
||||
// 6. If additionalFieldsKeys does not contain either "month" or "monthCode", then
|
||||
|
|
|
@ -537,16 +537,16 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::fields)
|
|||
// iii. If fieldNames contains nextValue, then
|
||||
if (field_names.contains_slow(next_value)) {
|
||||
// 1. Let completion be ThrowCompletion(a newly created RangeError object).
|
||||
auto completion = vm.throw_completion<RangeError>(ErrorType::TemporalDuplicateCalendarField, next_value.as_string().string());
|
||||
auto completion = vm.throw_completion<RangeError>(ErrorType::TemporalDuplicateCalendarField, next_value.as_string().deprecated_string());
|
||||
|
||||
// 2. Return ? IteratorClose(iteratorRecord, completion).
|
||||
return TRY(iterator_close(vm, iterator_record, move(completion)));
|
||||
}
|
||||
|
||||
// iv. If nextValue is not one of "year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", then
|
||||
if (!next_value.as_string().string().is_one_of("year"sv, "month"sv, "monthCode"sv, "day"sv, "hour"sv, "minute"sv, "second"sv, "millisecond"sv, "microsecond"sv, "nanosecond"sv)) {
|
||||
if (!next_value.as_string().deprecated_string().is_one_of("year"sv, "month"sv, "monthCode"sv, "day"sv, "hour"sv, "minute"sv, "second"sv, "millisecond"sv, "microsecond"sv, "nanosecond"sv)) {
|
||||
// 1. Let completion be ThrowCompletion(a newly created RangeError object).
|
||||
auto completion = vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarFieldName, next_value.as_string().string());
|
||||
auto completion = vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarFieldName, next_value.as_string().deprecated_string());
|
||||
|
||||
// 2. Return ? IteratorClose(iteratorRecord, completion).
|
||||
return TRY(iterator_close(vm, iterator_record, move(completion)));
|
||||
|
|
|
@ -1789,7 +1789,7 @@ DeprecatedString temporal_duration_to_string(double years, double months, double
|
|||
}
|
||||
|
||||
// 20. Return result.
|
||||
return result.to_string();
|
||||
return result.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 7.5.28 AddDurationToOrSubtractDurationFromDuration ( operation, duration, other, options ), https://tc39.es/proposal-temporal/#sec-temporal-adddurationtoorsubtractdurationfromduration
|
||||
|
|
|
@ -259,7 +259,7 @@ DeprecatedString format_time_zone_offset_string(double offset_nanoseconds)
|
|||
// a. Let post be the empty String.
|
||||
|
||||
// 14. Return the string-concatenation of sign, h, the code unit 0x003A (COLON), m, and post.
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 11.6.6 FormatISOTimeZoneOffsetString ( offsetNanoseconds ), https://tc39.es/proposal-temporal/#sec-temporal-formatisotimezoneoffsetstring
|
||||
|
|
|
@ -777,7 +777,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with)
|
|||
|
||||
// 18. Assert: Type(offsetString) is String.
|
||||
VERIFY(offset_string_value.is_string());
|
||||
auto const& offset_string = offset_string_value.as_string().string();
|
||||
auto const& offset_string = offset_string_value.as_string().deprecated_string();
|
||||
|
||||
// 19. Let dateTimeResult be ? InterpretTemporalDateTimeFields(calendar, fields, options).
|
||||
auto date_time_result = TRY(interpret_temporal_date_time_fields(vm, calendar, *fields, *options));
|
||||
|
|
|
@ -780,7 +780,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::join)
|
|||
}
|
||||
|
||||
// 9. Return R.
|
||||
return js_string(vm, builder.to_string());
|
||||
return js_string(vm, builder.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 23.2.3.19 %TypedArray%.prototype.keys ( ), https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys
|
||||
|
@ -1565,7 +1565,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::to_locale_string)
|
|||
}
|
||||
|
||||
// 7. Return R.
|
||||
return js_string(vm, builder.to_string());
|
||||
return js_string(vm, builder.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 1.2.2.1.3 %TypedArray%.prototype.toReversed ( ), https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed
|
||||
|
|
|
@ -963,7 +963,7 @@ ThrowCompletionOr<NonnullGCPtr<Module>> VM::resolve_imported_module(ScriptOrModu
|
|||
|
||||
if (module_or_errors.is_error()) {
|
||||
VERIFY(module_or_errors.error().size() > 0);
|
||||
return throw_completion<SyntaxError>(module_or_errors.error().first().to_string());
|
||||
return throw_completion<SyntaxError>(module_or_errors.error().first().to_deprecated_string());
|
||||
}
|
||||
return module_or_errors.release_value();
|
||||
}());
|
||||
|
|
|
@ -153,7 +153,7 @@ DeprecatedString number_to_string(double d, NumberToStringMode mode)
|
|||
builder.append(mantissa_digits.data(), k);
|
||||
}
|
||||
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 7. NOTE: In this case, the input will be represented using scientific E notation, such as 1.2e+3.
|
||||
|
@ -180,7 +180,7 @@ DeprecatedString number_to_string(double d, NumberToStringMode mode)
|
|||
// the code units of the decimal representation of abs(n - 1)
|
||||
builder.append(exponent_digits.data(), exponent_length);
|
||||
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 12. Return the string-concatenation of:
|
||||
|
@ -197,7 +197,7 @@ DeprecatedString number_to_string(double d, NumberToStringMode mode)
|
|||
// the code units of the decimal representation of abs(n - 1)
|
||||
builder.append(exponent_digits.data(), exponent_length);
|
||||
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 7.2.2 IsArray ( argument ), https://tc39.es/ecma262/#sec-isarray
|
||||
|
@ -315,11 +315,11 @@ DeprecatedString Value::to_string_without_side_effects() const
|
|||
case INT32_TAG:
|
||||
return DeprecatedString::number(as_i32());
|
||||
case STRING_TAG:
|
||||
return as_string().string();
|
||||
return as_string().deprecated_string();
|
||||
case SYMBOL_TAG:
|
||||
return as_symbol().to_string();
|
||||
return as_symbol().to_deprecated_string();
|
||||
case BIGINT_TAG:
|
||||
return as_bigint().to_string();
|
||||
return as_bigint().to_deprecated_string();
|
||||
case OBJECT_TAG:
|
||||
return DeprecatedString::formatted("[object {}]", as_object().class_name());
|
||||
case ACCESSOR_TAG:
|
||||
|
@ -353,7 +353,7 @@ ThrowCompletionOr<DeprecatedString> Value::to_string(VM& vm) const
|
|||
case INT32_TAG:
|
||||
return DeprecatedString::number(as_i32());
|
||||
case STRING_TAG:
|
||||
return as_string().string();
|
||||
return as_string().deprecated_string();
|
||||
case SYMBOL_TAG:
|
||||
return vm.throw_completion<TypeError>(ErrorType::Convert, "symbol", "string");
|
||||
case BIGINT_TAG:
|
||||
|
@ -576,7 +576,7 @@ ThrowCompletionOr<Value> Value::to_number(VM& vm) const
|
|||
case BOOLEAN_TAG:
|
||||
return Value(as_bool() ? 1 : 0);
|
||||
case STRING_TAG:
|
||||
return string_to_number(as_string().string().view());
|
||||
return string_to_number(as_string().deprecated_string().view());
|
||||
case SYMBOL_TAG:
|
||||
return vm.throw_completion<TypeError>(ErrorType::Convert, "symbol", "number");
|
||||
case BIGINT_TAG:
|
||||
|
@ -614,7 +614,7 @@ ThrowCompletionOr<BigInt*> Value::to_bigint(VM& vm) const
|
|||
return &primitive.as_bigint();
|
||||
case STRING_TAG: {
|
||||
// 1. Let n be ! StringToBigInt(prim).
|
||||
auto bigint = string_to_bigint(vm, primitive.as_string().string());
|
||||
auto bigint = string_to_bigint(vm, primitive.as_string().deprecated_string());
|
||||
|
||||
// 2. If n is undefined, throw a SyntaxError exception.
|
||||
if (!bigint.has_value())
|
||||
|
@ -1428,7 +1428,7 @@ bool same_value_non_numeric(Value lhs, Value rhs)
|
|||
VERIFY(same_type_for_equality(lhs, rhs));
|
||||
|
||||
if (lhs.is_string())
|
||||
return lhs.as_string().string() == rhs.as_string().string();
|
||||
return lhs.as_string().deprecated_string() == rhs.as_string().deprecated_string();
|
||||
|
||||
return lhs.m_value.encoded == rhs.m_value.encoded;
|
||||
}
|
||||
|
@ -1491,7 +1491,7 @@ ThrowCompletionOr<bool> is_loosely_equal(VM& vm, Value lhs, Value rhs)
|
|||
// 7. If Type(x) is BigInt and Type(y) is String, then
|
||||
if (lhs.is_bigint() && rhs.is_string()) {
|
||||
// a. Let n be StringToBigInt(y).
|
||||
auto bigint = string_to_bigint(vm, rhs.as_string().string());
|
||||
auto bigint = string_to_bigint(vm, rhs.as_string().deprecated_string());
|
||||
|
||||
// b. If n is undefined, return false.
|
||||
if (!bigint.has_value())
|
||||
|
@ -1562,8 +1562,8 @@ ThrowCompletionOr<TriState> is_less_than(VM& vm, Value lhs, Value rhs, bool left
|
|||
}
|
||||
|
||||
if (x_primitive.is_string() && y_primitive.is_string()) {
|
||||
auto x_string = x_primitive.as_string().string();
|
||||
auto y_string = y_primitive.as_string().string();
|
||||
auto x_string = x_primitive.as_string().deprecated_string();
|
||||
auto y_string = y_primitive.as_string().deprecated_string();
|
||||
|
||||
Utf8View x_code_points { x_string };
|
||||
Utf8View y_code_points { y_string };
|
||||
|
@ -1588,7 +1588,7 @@ ThrowCompletionOr<TriState> is_less_than(VM& vm, Value lhs, Value rhs, bool left
|
|||
}
|
||||
|
||||
if (x_primitive.is_bigint() && y_primitive.is_string()) {
|
||||
auto y_bigint = string_to_bigint(vm, y_primitive.as_string().string());
|
||||
auto y_bigint = string_to_bigint(vm, y_primitive.as_string().deprecated_string());
|
||||
if (!y_bigint.has_value())
|
||||
return TriState::Unknown;
|
||||
|
||||
|
@ -1598,7 +1598,7 @@ ThrowCompletionOr<TriState> is_less_than(VM& vm, Value lhs, Value rhs, bool left
|
|||
}
|
||||
|
||||
if (x_primitive.is_string() && y_primitive.is_bigint()) {
|
||||
auto x_bigint = string_to_bigint(vm, x_primitive.as_string().string());
|
||||
auto x_bigint = string_to_bigint(vm, x_primitive.as_string().deprecated_string());
|
||||
if (!x_bigint.has_value())
|
||||
return TriState::Unknown;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ struct ValueTraits : public Traits<Value> {
|
|||
{
|
||||
VERIFY(!value.is_empty());
|
||||
if (value.is_string())
|
||||
return value.as_string().string().hash();
|
||||
return value.as_string().deprecated_string().hash();
|
||||
|
||||
if (value.is_bigint())
|
||||
return value.as_bigint().big_integer().hash();
|
||||
|
|
|
@ -63,7 +63,7 @@ double Token::double_value() const
|
|||
builder.append(ch);
|
||||
}
|
||||
|
||||
DeprecatedString value_string = builder.to_string();
|
||||
DeprecatedString value_string = builder.to_deprecated_string();
|
||||
if (value_string[0] == '0' && value_string.length() >= 2) {
|
||||
if (value_string[1] == 'x' || value_string[1] == 'X') {
|
||||
// hexadecimal
|
||||
|
@ -209,7 +209,7 @@ DeprecatedString Token::string_value(StringValueStatus& status) const
|
|||
lexer.retreat();
|
||||
builder.append(lexer.consume_escaped_character('\\', "b\bf\fn\nr\rt\tv\v"sv));
|
||||
}
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 12.8.6.2 Static Semantics: TRV, https://tc39.es/ecma262/#sec-static-semantics-trv
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue