mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:57:35 +00:00
AK: Remove StringBuilder::build() in favor of to_deprecated_string()
Having an alias function that only wraps another one is silly, and keeping the more obvious name should flush out more uses of deprecated strings. No behavior change.
This commit is contained in:
parent
da81041e97
commit
6e7459322d
129 changed files with 213 additions and 219 deletions
|
@ -57,7 +57,7 @@ DeprecatedString Date::iso_date_string() const
|
|||
builder.appendff("{:03}", ms_from_time(m_date_value));
|
||||
builder.append('Z');
|
||||
|
||||
return builder.build();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// DayWithinYear(t), https://tc39.es/ecma262/#eqn-DayWithinYear
|
||||
|
|
|
@ -95,7 +95,7 @@ DeprecatedString Error::stack_string() const
|
|||
}
|
||||
}
|
||||
|
||||
return stack_string_builder.build();
|
||||
return stack_string_builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
||||
|
|
|
@ -413,7 +413,7 @@ static ThrowCompletionOr<DeprecatedString> encode(VM& vm, DeprecatedString const
|
|||
VERIFY(nwritten > 0);
|
||||
}
|
||||
}
|
||||
return encoded_builder.build();
|
||||
return encoded_builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 19.2.6.1.2 Decode ( string, reservedSet ), https://tc39.es/ecma262/#sec-decode
|
||||
|
@ -471,7 +471,7 @@ static ThrowCompletionOr<DeprecatedString> decode(VM& vm, DeprecatedString const
|
|||
}
|
||||
if (expected_continuation_bytes > 0)
|
||||
return vm.throw_completion<URIError>(ErrorType::URIMalformed);
|
||||
return decoded_builder.build();
|
||||
return decoded_builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 19.2.6.4 encodeURI ( uri ), https://tc39.es/ecma262/#sec-encodeuri-uri
|
||||
|
@ -521,7 +521,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::escape)
|
|||
}
|
||||
escaped.appendff("%u{:04X}", code_point);
|
||||
}
|
||||
return PrimitiveString::create(vm, escaped.build());
|
||||
return PrimitiveString::create(vm, escaped.to_deprecated_string());
|
||||
}
|
||||
|
||||
// B.2.1.2 unescape ( string ), https://tc39.es/ecma262/#sec-unescape-string
|
||||
|
@ -543,7 +543,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::unescape)
|
|||
}
|
||||
unescaped.append_code_point(code_point);
|
||||
}
|
||||
return PrimitiveString::create(vm, unescaped.build());
|
||||
return PrimitiveString::create(vm, unescaped.to_deprecated_string());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::format)
|
|||
}
|
||||
|
||||
// 7. Return result.
|
||||
return PrimitiveString::create(vm, result.build());
|
||||
return PrimitiveString::create(vm, result.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 1.4.4 Intl.DurationFormat.prototype.formatToParts ( duration ), https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype.formatToParts
|
||||
|
|
|
@ -237,7 +237,7 @@ ThrowCompletionOr<DeprecatedString> format_relative_time(VM& vm, RelativeTimeFor
|
|||
}
|
||||
|
||||
// 4. Return result.
|
||||
return result.build();
|
||||
return result.to_deprecated_string();
|
||||
}
|
||||
|
||||
// 17.5.5 FormatRelativeTimeToParts ( relativeTimeFormat, value, unit ), https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts
|
||||
|
|
|
@ -116,7 +116,7 @@ ErrorOr<DeprecatedString, ParseRegexPatternError> parse_regex_pattern(StringView
|
|||
builder.append_code_point(code_unit);
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
ThrowCompletionOr<DeprecatedString> parse_regex_pattern(VM& vm, StringView pattern, bool unicode, bool unicode_sets)
|
||||
|
|
|
@ -820,13 +820,13 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace)
|
|||
|
||||
// 15. If nextSourcePosition ≥ lengthS, return accumulatedResult.
|
||||
if (next_source_position >= string.length_in_code_units())
|
||||
return PrimitiveString::create(vm, accumulated_result.build());
|
||||
return PrimitiveString::create(vm, accumulated_result.to_deprecated_string());
|
||||
|
||||
// 16. Return the string-concatenation of accumulatedResult and the substring of S from nextSourcePosition.
|
||||
auto substring = string.substring_view(next_source_position);
|
||||
accumulated_result.append(substring);
|
||||
|
||||
return PrimitiveString::create(vm, accumulated_result.build());
|
||||
return PrimitiveString::create(vm, accumulated_result.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 22.2.5.12 RegExp.prototype [ @@search ] ( string ), https://tc39.es/ecma262/#sec-regexp.prototype-@@search
|
||||
|
|
|
@ -94,7 +94,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
|
|||
builder.append(next_sub);
|
||||
}
|
||||
}
|
||||
return PrimitiveString::create(vm, builder.build());
|
||||
return PrimitiveString::create(vm, builder.to_deprecated_string());
|
||||
}
|
||||
|
||||
// 22.1.2.1 String.fromCharCode ( ...codeUnits ), https://tc39.es/ecma262/#sec-string.fromcharcode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue