diff options
author | DexesTTP <dexes.ttp@gmail.com> | 2022-07-05 22:33:15 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-07-06 11:12:45 +0200 |
commit | 7ceeb745354e246ec91cbdcd6f17c8291c09aec0 (patch) | |
tree | ff0acc8f5603d392e0f0b82793df40b257e284ea /Userland/Libraries/LibJS/Parser.h | |
parent | b2454888e8fa44775456536a2a71827763cba503 (diff) | |
download | serenity-7ceeb745354e246ec91cbdcd6f17c8291c09aec0.zip |
AK: Use an enum instead of a bool for String::replace(all_occurences)
This commit has no behavior changes.
In particular, this does not fix any of the wrong uses of the previous
default parameter (which used to be 'false', meaning "only replace the
first occurence in the string"). It simply replaces the default uses by
String::replace(..., ReplaceMode::FirstOnly), leaving them incorrect.
Diffstat (limited to 'Userland/Libraries/LibJS/Parser.h')
-rw-r--r-- | Userland/Libraries/LibJS/Parser.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Parser.h b/Userland/Libraries/LibJS/Parser.h index 1f017bfbdd..39a91c0cf3 100644 --- a/Userland/Libraries/LibJS/Parser.h +++ b/Userland/Libraries/LibJS/Parser.h @@ -182,7 +182,7 @@ public: return {}; // We need to modify the source to match what the lexer considers one line - normalizing // line terminators to \n is easier than splitting using all different LT characters. - String source_string = source.replace("\r\n", "\n").replace("\r", "\n").replace(LINE_SEPARATOR_STRING, "\n").replace(PARAGRAPH_SEPARATOR_STRING, "\n"); + String source_string = source.replace("\r\n", "\n", ReplaceMode::FirstOnly).replace("\r", "\n", ReplaceMode::FirstOnly).replace(LINE_SEPARATOR_STRING, "\n", ReplaceMode::FirstOnly).replace(PARAGRAPH_SEPARATOR_STRING, "\n", ReplaceMode::FirstOnly); StringBuilder builder; builder.append(source_string.split_view('\n', true)[position.value().line - 1]); builder.append('\n'); |