Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: tools/gn/parse_tree.cc

Issue 115323009: Fix help and error messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/operators.cc ('k') | tools/gn/pattern.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/parse_tree.h" 5 #include "tools/gn/parse_tree.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 statements_[i]->Print(out, indent + 1); 186 statements_[i]->Print(out, indent + 1);
187 } 187 }
188 188
189 Value BlockNode::ExecuteBlockInScope(Scope* our_scope, Err* err) const { 189 Value BlockNode::ExecuteBlockInScope(Scope* our_scope, Err* err) const {
190 for (size_t i = 0; i < statements_.size() && !err->has_error(); i++) { 190 for (size_t i = 0; i < statements_.size() && !err->has_error(); i++) {
191 // Check for trying to execute things with no side effects in a block. 191 // Check for trying to execute things with no side effects in a block.
192 const ParseNode* cur = statements_[i]; 192 const ParseNode* cur = statements_[i];
193 if (cur->AsList() || cur->AsLiteral() || cur->AsUnaryOp() || 193 if (cur->AsList() || cur->AsLiteral() || cur->AsUnaryOp() ||
194 cur->AsIdentifier()) { 194 cur->AsIdentifier()) {
195 *err = cur->MakeErrorDescribing( 195 *err = cur->MakeErrorDescribing(
196 "This statment has no effect.", 196 "This statement has no effect.",
197 "Either delete it or do something with the result."); 197 "Either delete it or do something with the result.");
198 return Value(); 198 return Value();
199 } 199 }
200 cur->Execute(our_scope, err); 200 cur->Execute(our_scope, err);
201 } 201 }
202 return Value(); 202 return Value();
203 } 203 }
204 204
205 // ConditionNode -------------------------------------------------------------- 205 // ConditionNode --------------------------------------------------------------
206 206
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 Err UnaryOpNode::MakeErrorDescribing(const std::string& msg, 462 Err UnaryOpNode::MakeErrorDescribing(const std::string& msg,
463 const std::string& help) const { 463 const std::string& help) const {
464 return Err(op_, msg, help); 464 return Err(op_, msg, help);
465 } 465 }
466 466
467 void UnaryOpNode::Print(std::ostream& out, int indent) const { 467 void UnaryOpNode::Print(std::ostream& out, int indent) const {
468 out << IndentFor(indent) << "UNARY(" << op_.value() << ")\n"; 468 out << IndentFor(indent) << "UNARY(" << op_.value() << ")\n";
469 operand_->Print(out, indent + 1); 469 operand_->Print(out, indent + 1);
470 } 470 }
OLDNEW
« no previous file with comments | « tools/gn/operators.cc ('k') | tools/gn/pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698