mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 02:50:26 +00:00
js: Make printing of the last result optional
This commit is contained in:
parent
0bc6bcc2ed
commit
12b8cd8c10
Notes:
sideshowbarker
2024-07-19 08:12:55 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/12b8cd8c105
1 changed files with 4 additions and 1 deletions
|
@ -42,10 +42,12 @@ int main(int argc, char** argv)
|
|||
{
|
||||
bool dump_ast = false;
|
||||
bool gc_on_every_allocation = false;
|
||||
bool print_last_result = false;
|
||||
const char* script_path = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(dump_ast, "Dump the AST", "ast-dump", 'A');
|
||||
args_parser.add_option(dump_ast, "Print last result", "print-last-result", 'l');
|
||||
args_parser.add_option(gc_on_every_allocation, "GC on every allocation", "gc-on-every-allocation", 'g');
|
||||
args_parser.add_positional_argument(script_path, "Path to script file", "script");
|
||||
args_parser.parse(argc, argv);
|
||||
|
@ -80,6 +82,7 @@ int main(int argc, char** argv)
|
|||
auto result = interpreter.run(*program);
|
||||
dbg() << "Interpreter returned " << result;
|
||||
|
||||
if (print_last_result)
|
||||
printf("%s\n", result.to_string().characters());
|
||||
|
||||
dbg() << "Collecting garbage on exit...";
|
||||
|
|
Loading…
Reference in a new issue