diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2022-07-11 20:10:18 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-12 23:11:35 +0200 |
commit | c8585b77d263d15807231cb8bd1345d2591b9495 (patch) | |
tree | ac3c44a6f7d6fad59b942809d67b92826386b25c /Userland/Libraries/LibJS | |
parent | 3f3f45580ab7266258e97cb3cecf1e24716d61c5 (diff) | |
download | serenity-c8585b77d263d15807231cb8bd1345d2591b9495.zip |
Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the
need to run generic code for a single character (as contains,
starts_with, ends_with etc. for a char will be just a length and
equality check).
No functional changes.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Op.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/StringPrototype.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 62a9c2cd0b..f0ea2e9b59 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -1030,7 +1030,7 @@ String PushDeclarativeEnvironment::to_string_impl(Bytecode::Executable const& ex Vector<String> names; for (auto& it : m_variables) names.append(executable.get_string(it.key)); - builder.append("}"); + builder.append('}'); builder.join(", "sv, names); } return builder.to_string(); diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 8ffc5403f6..03709565ce 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -791,7 +791,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::match_all) auto flags = TRY(regexp.as_object().get("flags")); auto flags_object = TRY(require_object_coercible(global_object, flags)); auto flags_string = TRY(flags_object.to_string(global_object)); - if (!flags_string.contains("g")) + if (!flags_string.contains('g')) return vm.throw_completion<TypeError>(global_object, ErrorType::StringNonGlobalRegExp); } if (auto* matcher = TRY(regexp.get_method(global_object, *vm.well_known_symbol_match_all()))) @@ -885,7 +885,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::replace_all) auto flags = TRY(search_value.as_object().get(vm.names.flags)); auto flags_object = TRY(require_object_coercible(global_object, flags)); auto flags_string = TRY(flags_object.to_string(global_object)); - if (!flags_string.contains("g")) + if (!flags_string.contains('g')) return vm.throw_completion<TypeError>(global_object, ErrorType::StringNonGlobalRegExp); } |