Commit c5e6f0ac authored by Scott Graham's avatar Scott Graham

gn format: don't crash when there's no block on a function call

(Child of https://codereview.chromium.org/607173002/)

R=brettw@chromium.org
BUG=348474

Review URL: https://codereview.chromium.org/608593006

Cr-Commit-Position: refs/heads/master@{#297228}
parent def297bc
...@@ -242,10 +242,12 @@ Printer::ExprStyle Printer::Expr(const ParseNode* root) { ...@@ -242,10 +242,12 @@ Printer::ExprStyle Printer::Expr(const ParseNode* root) {
Sequence(kSequenceStyleFunctionCall, Sequence(kSequenceStyleFunctionCall,
func_call->args()->contents(), func_call->args()->contents(),
func_call->args()->End()); func_call->args()->End());
Print(" "); if (func_call->block()) {
Sequence(kSequenceStyleBracedBlock, Print(" ");
func_call->block()->statements(), Sequence(kSequenceStyleBracedBlock,
func_call->block()->End()); func_call->block()->statements(),
func_call->block()->End());
}
} else if (const IdentifierNode* identifier = root->AsIdentifier()) { } else if (const IdentifierNode* identifier = root->AsIdentifier()) {
Print(identifier->value().value()); Print(identifier->value().value());
} else if (const ListNode* list = root->AsList()) { } else if (const ListNode* list = root->AsList()) {
......
...@@ -46,3 +46,4 @@ FORMAT_TEST(014) ...@@ -46,3 +46,4 @@ FORMAT_TEST(014)
FORMAT_TEST(015) FORMAT_TEST(015)
// TODO(scottmg): Requires precedence/parentheses FORMAT_TEST(016) // TODO(scottmg): Requires precedence/parentheses FORMAT_TEST(016)
FORMAT_TEST(017) FORMAT_TEST(017)
FORMAT_TEST(018)
# Don't crash when no block on a function call.
import("wee.gni")
# Don't crash when no block on a function call.
import("wee.gni")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment