mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 10:12:25 -05:00
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.
This commit is contained in:
parent
adb4accab3
commit
d4bfcea570
Notes:
sideshowbarker
2024-07-19 06:59:34 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/d4bfcea570a Pull-request: https://github.com/SerenityOS/serenity/pull/2102
1 changed files with 5 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue