Index: tools/gn/parser.cc |
diff --git a/tools/gn/parser.cc b/tools/gn/parser.cc |
index 57a398e0187e50f03a7efa15443009fc9efb41ab..378a71050aeb940de3f174964c920130519b0e99 100644 |
--- a/tools/gn/parser.cc |
+++ b/tools/gn/parser.cc |
@@ -453,7 +453,7 @@ std::unique_ptr<ParseNode> Parser::ParseExpression(int precedence) { |
} |
std::unique_ptr<ParseNode> Parser::Block(Token token) { |
- // This entrypoing into ParseBlock means its part of an expression and we |
+ // This entrypoint into ParseBlock means it's part of an expression and we |
// always want the result. |
return ParseBlock(token, BlockNode::RETURNS_SCOPE); |
} |
@@ -819,6 +819,10 @@ void Parser::AssignComments(ParseNode* file) { |
// Assign line comments to syntax immediately following. |
int cur_comment = 0; |
for (auto* node : pre) { |
+ if (node->GetRange().is_null()) { |
+ CHECK_EQ(node, file) << "Only expected on top file node"; |
+ continue; |
+ } |
const Location& start = node->GetRange().begin(); |
while (cur_comment < static_cast<int>(line_comment_tokens_.size())) { |
if (start.byte() >= line_comment_tokens_[cur_comment].location().byte()) { |