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

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

Issue 2586073002: Revert GN declare_args() change. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « tools/gn/functions_unittest.cc ('k') | tools/gn/scope.h » ('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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 #include <tuple> 10 #include <tuple>
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 } 480 }
481 481
482 IdentifierNode::~IdentifierNode() { 482 IdentifierNode::~IdentifierNode() {
483 } 483 }
484 484
485 const IdentifierNode* IdentifierNode::AsIdentifier() const { 485 const IdentifierNode* IdentifierNode::AsIdentifier() const {
486 return this; 486 return this;
487 } 487 }
488 488
489 Value IdentifierNode::Execute(Scope* scope, Err* err) const { 489 Value IdentifierNode::Execute(Scope* scope, Err* err) const {
490 const Scope* found_in_scope = nullptr; 490 const Value* value = scope->GetValue(value_.value(), true);
491 const Value* value = scope->GetValueWithScope(value_.value(), true,
492 &found_in_scope);
493 Value result; 491 Value result;
494 if (!value) { 492 if (!value) {
495 *err = MakeErrorDescribing("Undefined identifier"); 493 *err = MakeErrorDescribing("Undefined identifier");
496 return result; 494 return result;
497 } 495 }
498 496
499 if (!EnsureNotReadingFromSameDeclareArgs(this, scope, found_in_scope, err))
500 return result;
501
502 result = *value; 497 result = *value;
503 result.set_origin(this); 498 result.set_origin(this);
504 return result; 499 return result;
505 } 500 }
506 501
507 LocationRange IdentifierNode::GetRange() const { 502 LocationRange IdentifierNode::GetRange() const {
508 return value_.range(); 503 return value_.range();
509 } 504 }
510 505
511 Err IdentifierNode::MakeErrorDescribing(const std::string& msg, 506 Err IdentifierNode::MakeErrorDescribing(const std::string& msg,
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 867
873 Err EndNode::MakeErrorDescribing(const std::string& msg, 868 Err EndNode::MakeErrorDescribing(const std::string& msg,
874 const std::string& help) const { 869 const std::string& help) const {
875 return Err(value_, msg, help); 870 return Err(value_, msg, help);
876 } 871 }
877 872
878 void EndNode::Print(std::ostream& out, int indent) const { 873 void EndNode::Print(std::ostream& out, int indent) const {
879 out << IndentFor(indent) << "END(" << value_.value() << ")\n"; 874 out << IndentFor(indent) << "END(" << value_.value() << ")\n";
880 PrintComments(out, indent); 875 PrintComments(out, indent);
881 } 876 }
OLDNEW
« no previous file with comments | « tools/gn/functions_unittest.cc ('k') | tools/gn/scope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698