summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-19 20:55:28 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-19 20:55:28 +0000
commit0b1e4b50e05c71d5a4d155b90b25125c780c59be (patch)
tree0727e25ed8fe439c2b2254fe9715a5409ceac95f
parent20c50c91501d8a6f1fade0ccf983f0936f6ee45d (diff)
downloadchromium_src-0b1e4b50e05c71d5a4d155b90b25125c780c59be.zip
chromium_src-0b1e4b50e05c71d5a4d155b90b25125c780c59be.tar.gz
chromium_src-0b1e4b50e05c71d5a4d155b90b25125c780c59be.tar.bz2
set begin/end tokens on list so doesn't dcheck, and don't set empty block on functions
R=brettw@chromium.org Review URL: https://codereview.chromium.org/23064021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218307 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--tools/gn/parser.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/gn/parser.cc b/tools/gn/parser.cc
index 348588f..b0bb6f8 100644
--- a/tools/gn/parser.cc
+++ b/tools/gn/parser.cc
@@ -254,7 +254,9 @@ scoped_ptr<ParseNode> Parser::BinaryOperator(scoped_ptr<ParseNode> left,
scoped_ptr<ParseNode> Parser::IdentifierOrCall(scoped_ptr<ParseNode> left,
Token token) {
scoped_ptr<ListNode> list(new ListNode);
- scoped_ptr<BlockNode> block(new BlockNode(false));
+ list->set_begin_token(token);
+ list->set_end_token(token);
+ scoped_ptr<BlockNode> block;
bool has_arg = false;
if (Match(Token::LEFT_PAREN)) {
// Parsing a function call.
@@ -282,7 +284,8 @@ scoped_ptr<ParseNode> Parser::IdentifierOrCall(scoped_ptr<ParseNode> left,
scoped_ptr<FunctionCallNode> func_call(new FunctionCallNode);
func_call->set_function(token);
func_call->set_args(list.Pass());
- func_call->set_block(block.Pass());
+ if (block)
+ func_call->set_block(block.Pass());
return func_call.Pass();
}
@@ -320,6 +323,7 @@ scoped_ptr<ParseNode> Parser::Subscript(scoped_ptr<ParseNode> left,
scoped_ptr<ListNode> Parser::ParseList(Token::Type stop_before,
bool allow_trailing_comma) {
scoped_ptr<ListNode> list(new ListNode);
+ list->set_begin_token(cur_token());
bool just_got_comma = false;
while (!LookAhead(stop_before)) {
just_got_comma = false;
@@ -340,6 +344,7 @@ scoped_ptr<ListNode> Parser::ParseList(Token::Type stop_before,
*err_ = Err(cur_token(), "Trailing comma");
return scoped_ptr<ListNode>();
}
+ list->set_end_token(cur_token());
return list.Pass();
}