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

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

Issue 2393853003: GN: Mark variables in nested scopes used for += and -=. (Closed)
Patch Set: Fix Created 4 years, 2 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
« no previous file with comments | « no previous file | tools/gn/operators_unittest.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/operators.h" 5 #include "tools/gn/operators.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return false; 148 return false;
149 } 149 }
150 type_ = SCOPE; 150 type_ = SCOPE;
151 scope_ = base->scope_value(); 151 scope_ = base->scope_value();
152 name_token_ = &dest_accessor->member()->value(); 152 name_token_ = &dest_accessor->member()->value();
153 return true; 153 return true;
154 } 154 }
155 155
156 const Value* ValueDestination::GetExistingValue() const { 156 const Value* ValueDestination::GetExistingValue() const {
157 if (type_ == SCOPE) 157 if (type_ == SCOPE)
158 return scope_->GetValue(name_token_->value(), false); 158 return scope_->GetValue(name_token_->value(), true);
159 else if (type_ == LIST) 159 else if (type_ == LIST)
160 return &list_->list_value()[index_]; 160 return &list_->list_value()[index_];
161 return nullptr; 161 return nullptr;
162 } 162 }
163 163
164 Value* ValueDestination::GetExistingMutableValueIfExists( 164 Value* ValueDestination::GetExistingMutableValueIfExists(
165 const ParseNode* origin) { 165 const ParseNode* origin) {
166 if (type_ == SCOPE) { 166 if (type_ == SCOPE) {
167 Value* value = scope_->GetMutableValue( 167 Value* value = scope_->GetMutableValue(
168 name_token_->value(), Scope::SEARCH_CURRENT, false); 168 name_token_->value(), Scope::SEARCH_CURRENT, false);
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 return ExecuteGreaterEquals(scope, op_node, left_value, right_value, err); 774 return ExecuteGreaterEquals(scope, op_node, left_value, right_value, err);
775 if (op.type() == Token::LESS_EQUAL) 775 if (op.type() == Token::LESS_EQUAL)
776 return ExecuteLessEquals(scope, op_node, left_value, right_value, err); 776 return ExecuteLessEquals(scope, op_node, left_value, right_value, err);
777 if (op.type() == Token::GREATER_THAN) 777 if (op.type() == Token::GREATER_THAN)
778 return ExecuteGreater(scope, op_node, left_value, right_value, err); 778 return ExecuteGreater(scope, op_node, left_value, right_value, err);
779 if (op.type() == Token::LESS_THAN) 779 if (op.type() == Token::LESS_THAN)
780 return ExecuteLess(scope, op_node, left_value, right_value, err); 780 return ExecuteLess(scope, op_node, left_value, right_value, err);
781 781
782 return Value(); 782 return Value();
783 } 783 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/operators_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698