mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
js: Rename the --disable-string-quotes flag to --raw-strings
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Build Dev Container Image / build (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Build Dev Container Image / build (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Since it does more than removing the quotes by escaping the string too It makes sense to change the name of the flag to something more close to what it's really doing.
This commit is contained in:
parent
8caa7c89cf
commit
8b1f1ae87a
Notes:
github-actions[bot]
2025-07-10 00:31:20 +00:00
Author: https://github.com/ananas-dev
Commit: 8b1f1ae87a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4965
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/alimpfard
3 changed files with 7 additions and 7 deletions
|
@ -1038,18 +1038,18 @@ ErrorOr<void> print_value(JS::PrintContext& print_context, JS::Value value, Hash
|
|||
else if (value.is_undefined())
|
||||
TRY(js_out(print_context, "\033[34;1m"));
|
||||
|
||||
if (value.is_string() && !print_context.disable_string_quotes)
|
||||
if (value.is_string() && !print_context.raw_strings)
|
||||
TRY(js_out(print_context, "\""));
|
||||
else if (value.is_negative_zero())
|
||||
TRY(js_out(print_context, "-"));
|
||||
|
||||
auto contents = value.to_string_without_side_effects();
|
||||
if (value.is_string() && !print_context.disable_string_quotes)
|
||||
if (value.is_string() && !print_context.raw_strings)
|
||||
TRY(js_out(print_context, "{}", TRY(escape_for_string_literal(contents))));
|
||||
else
|
||||
TRY(js_out(print_context, "{}", contents));
|
||||
|
||||
if (value.is_string() && !print_context.disable_string_quotes)
|
||||
if (value.is_string() && !print_context.raw_strings)
|
||||
TRY(js_out(print_context, "\""));
|
||||
TRY(js_out(print_context, "\033[0m"));
|
||||
return {};
|
||||
|
|
|
@ -17,7 +17,7 @@ struct PrintContext {
|
|||
JS::VM& vm;
|
||||
Stream& stream;
|
||||
bool strip_ansi { false };
|
||||
bool disable_string_quotes { false };
|
||||
bool raw_strings { false };
|
||||
};
|
||||
|
||||
JS_API ErrorOr<void> print(JS::Value value, PrintContext&);
|
||||
|
|
|
@ -85,7 +85,7 @@ static bool s_dump_ast = false;
|
|||
static bool s_as_module = false;
|
||||
static bool s_print_last_result = false;
|
||||
static bool s_strip_ansi = false;
|
||||
static bool s_disable_string_quotes = false;
|
||||
static bool s_raw_strings = false;
|
||||
static bool s_disable_source_location_hints = false;
|
||||
#if !defined(AK_OS_WINDOWS)
|
||||
static RefPtr<Line::Editor> s_editor;
|
||||
|
@ -97,7 +97,7 @@ static int s_exit_code = 0;
|
|||
|
||||
static ErrorOr<void> print_inline(JS::Value value, Stream& stream)
|
||||
{
|
||||
JS::PrintContext print_context { .vm = *g_vm, .stream = stream, .strip_ansi = s_strip_ansi, .disable_string_quotes = s_disable_string_quotes };
|
||||
JS::PrintContext print_context { .vm = *g_vm, .stream = stream, .strip_ansi = s_strip_ansi, .raw_strings = s_raw_strings };
|
||||
return JS::print(value, print_context);
|
||||
}
|
||||
|
||||
|
@ -822,8 +822,8 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
|
|||
args_parser.add_option(s_strip_ansi, "Disable ANSI colors", "disable-ansi-colors", 'i');
|
||||
args_parser.add_option(s_disable_source_location_hints, "Disable source location hints", "disable-source-location-hints", 'h');
|
||||
args_parser.add_option(gc_on_every_allocation, "GC on every allocation", "gc-on-every-allocation", 'g');
|
||||
args_parser.add_option(s_raw_strings, "Display strings without quotes or escape sequences", "--raw-strings", 'r');
|
||||
args_parser.add_option(disable_syntax_highlight, "Disable live syntax highlighting", "no-syntax-highlight", 's');
|
||||
args_parser.add_option(s_disable_string_quotes, "Disable quotes around strings", "disable-string-quotes", {});
|
||||
args_parser.add_option(disable_debug_printing, "Disable debug output", "disable-debug-output", {});
|
||||
args_parser.add_option(evaluate_script, "Evaluate argument as a script", "evaluate", 'c', "script");
|
||||
args_parser.add_option(use_test262_global, "Use test262 global ($262)", "use-test262-global", {});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue