mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:07:34 +00:00
Everywhere: Pass AK::StringView by value
This commit is contained in:
parent
ad5d217e76
commit
8b1108e485
392 changed files with 978 additions and 978 deletions
|
@ -20,8 +20,8 @@ public:
|
|||
|
||||
Token next();
|
||||
|
||||
const StringView& source() const { return m_source; };
|
||||
const StringView& filename() const { return m_filename; };
|
||||
StringView source() const { return m_source; };
|
||||
StringView filename() const { return m_filename; };
|
||||
|
||||
void disallow_html_comments() { m_allow_html_comments = false; };
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
String MarkupGenerator::html_from_source(const StringView& source)
|
||||
String MarkupGenerator::html_from_source(StringView source)
|
||||
{
|
||||
StringBuilder builder;
|
||||
auto lexer = Lexer(source);
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace JS {
|
|||
|
||||
class MarkupGenerator {
|
||||
public:
|
||||
static String html_from_source(const StringView&);
|
||||
static String html_from_source(StringView);
|
||||
static String html_from_value(Value);
|
||||
static String html_from_error(Object&);
|
||||
|
||||
|
|
|
@ -609,7 +609,7 @@ static constexpr AK::Array<StringView, 9> strict_reserved_words = { "implements"
|
|||
|
||||
static bool is_strict_reserved_word(StringView str)
|
||||
{
|
||||
return any_of(strict_reserved_words, [&str](StringView const& word) {
|
||||
return any_of(strict_reserved_words, [&str](StringView word) {
|
||||
return word == str;
|
||||
});
|
||||
}
|
||||
|
@ -3575,7 +3575,7 @@ Token Parser::consume(TokenType expected_type)
|
|||
|
||||
Token Parser::consume_and_validate_numeric_literal()
|
||||
{
|
||||
auto is_unprefixed_octal_number = [](const StringView& value) {
|
||||
auto is_unprefixed_octal_number = [](StringView value) {
|
||||
return value.length() > 1 && value[0] == '0' && is_ascii_digit(value[1]);
|
||||
};
|
||||
auto literal_start = position();
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
return String::formatted("{} (line: {}, column: {})", message, position.value().line, position.value().column);
|
||||
}
|
||||
|
||||
String source_location_hint(const StringView& source, const char spacer = ' ', const char indicator = '^') const
|
||||
String source_location_hint(StringView source, const char spacer = ' ', const char indicator = '^') const
|
||||
{
|
||||
if (!position.has_value())
|
||||
return {};
|
||||
|
|
|
@ -266,7 +266,7 @@ ThrowCompletionOr<Vector<String>> canonicalize_locale_list(GlobalObject& global_
|
|||
}
|
||||
|
||||
// 9.2.2 BestAvailableLocale ( availableLocales, locale ), https://tc39.es/ecma402/#sec-bestavailablelocale
|
||||
Optional<String> best_available_locale(StringView const& locale)
|
||||
Optional<String> best_available_locale(StringView locale)
|
||||
{
|
||||
// 1. Let candidate be locale.
|
||||
StringView candidate = locale;
|
||||
|
|
|
@ -39,7 +39,7 @@ String canonicalize_unicode_locale_id(Unicode::LocaleID& locale);
|
|||
bool is_well_formed_currency_code(StringView currency);
|
||||
bool is_well_formed_unit_identifier(StringView unit_identifier);
|
||||
ThrowCompletionOr<Vector<String>> canonicalize_locale_list(GlobalObject&, Value locales);
|
||||
Optional<String> best_available_locale(StringView const& locale);
|
||||
Optional<String> best_available_locale(StringView locale);
|
||||
String insert_unicode_extension_and_canonicalize(Unicode::LocaleID locale_id, Unicode::LocaleExtension extension);
|
||||
LocaleResult resolve_locale(Vector<String> const& requested_locales, LocaleOptions const& options, Vector<StringView> const& relevant_extension_keys);
|
||||
Vector<String> lookup_supported_locales(Vector<String> const& requested_locales);
|
||||
|
|
|
@ -32,7 +32,7 @@ NonnullRefPtr<Utf16StringImpl> Utf16StringImpl::create(Vector<u16, 1> string)
|
|||
return adopt_ref(*new Utf16StringImpl(move(string)));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Utf16StringImpl> Utf16StringImpl::create(StringView const& string)
|
||||
NonnullRefPtr<Utf16StringImpl> Utf16StringImpl::create(StringView string)
|
||||
{
|
||||
return create(AK::utf8_to_utf16(string));
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ Utf16String::Utf16String(Vector<u16, 1> string)
|
|||
{
|
||||
}
|
||||
|
||||
Utf16String::Utf16String(StringView const& string)
|
||||
Utf16String::Utf16String(StringView string)
|
||||
: m_string(Detail::Utf16StringImpl::create(move(string)))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<Utf16StringImpl> create();
|
||||
static NonnullRefPtr<Utf16StringImpl> create(Vector<u16, 1>);
|
||||
static NonnullRefPtr<Utf16StringImpl> create(StringView const&);
|
||||
static NonnullRefPtr<Utf16StringImpl> create(StringView);
|
||||
static NonnullRefPtr<Utf16StringImpl> create(Utf16View const&);
|
||||
|
||||
Vector<u16, 1> const& string() const;
|
||||
|
@ -40,7 +40,7 @@ class Utf16String {
|
|||
public:
|
||||
Utf16String();
|
||||
explicit Utf16String(Vector<u16, 1>);
|
||||
explicit Utf16String(StringView const&);
|
||||
explicit Utf16String(StringView);
|
||||
explicit Utf16String(Utf16View const&);
|
||||
|
||||
Vector<u16, 1> const& string() const;
|
||||
|
|
|
@ -201,16 +201,16 @@ public:
|
|||
static const char* name(TokenType);
|
||||
|
||||
const String& message() const { return m_message; }
|
||||
const StringView& trivia() const { return m_trivia; }
|
||||
const StringView& original_value() const { return m_original_value; }
|
||||
StringView trivia() const { return m_trivia; }
|
||||
StringView original_value() const { return m_original_value; }
|
||||
StringView value() const
|
||||
{
|
||||
return m_value.visit(
|
||||
[](StringView const& view) { return view; },
|
||||
[](StringView view) { return view; },
|
||||
[](FlyString const& identifier) { return identifier.view(); },
|
||||
[](Empty) -> StringView { VERIFY_NOT_REACHED(); });
|
||||
}
|
||||
const StringView& filename() const { return m_filename; }
|
||||
StringView filename() const { return m_filename; }
|
||||
size_t line_number() const { return m_line_number; }
|
||||
size_t line_column() const { return m_line_column; }
|
||||
size_t offset() const { return m_offset; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue