diff options
author | Linus Groh <mail@linusgroh.de> | 2020-05-04 19:01:24 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-04 21:42:47 +0200 |
commit | d4bfcea570acab122f1c4048962479b0d02a7370 (patch) | |
tree | 7907413b5f1bb35d58970a351c4df39bd1a86400 /Libraries/LibJS | |
parent | adb4accab3668e60a6998c4b492d1cf7be11f9d1 (diff) | |
download | serenity-d4bfcea570acab122f1c4048962479b0d02a7370.zip |
LibJS: Add indentation to sections in SwitchCase::dump()
This now matches the output of
Program
(Variables)
...
(Children)
...
or
FunctionDeclaration 'foo'
(Parameters)
...
(Body)
...
etc.
Also don't print each consequent statement index, it doesn't add any
value.
Diffstat (limited to 'Libraries/LibJS')
-rw-r--r-- | Libraries/LibJS/AST.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index a53eac4e00..0544b23321 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -1384,21 +1384,17 @@ void SwitchStatement::dump(int indent) const void SwitchCase::dump(int indent) const { ASTNode::dump(indent); - print_indent(indent); + print_indent(indent + 1); if (m_test) { printf("(Test)\n"); - m_test->dump(indent + 1); + m_test->dump(indent + 2); } else { printf("(Default)\n"); } - print_indent(indent); + print_indent(indent + 1); printf("(Consequent)\n"); - int i = 0; - for (auto& statement : m_consequent) { - print_indent(indent); - printf("[%d]\n", i++); - statement.dump(indent + 1); - } + for (auto& statement : m_consequent) + statement.dump(indent + 2); } Value ConditionalExpression::execute(Interpreter& interpreter) const |