OLD | NEW |
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 | 211 |
212 Value BlockNode::Execute(Scope* containing_scope, Err* err) const { | 212 Value BlockNode::Execute(Scope* containing_scope, Err* err) const { |
213 if (has_scope_) { | 213 if (has_scope_) { |
214 Scope our_scope(containing_scope); | 214 Scope our_scope(containing_scope); |
215 Value ret = ExecuteBlockInScope(&our_scope, err); | 215 Value ret = ExecuteBlockInScope(&our_scope, err); |
216 if (err->has_error()) | 216 if (err->has_error()) |
217 return Value(); | 217 return Value(); |
218 | 218 |
219 // Check for unused vars in the scope. | 219 // Check for unused vars in the scope. |
220 //our_scope.CheckForUnusedVars(err); | 220 our_scope.CheckForUnusedVars(err); |
221 return ret; | 221 return ret; |
222 } | 222 } |
223 return ExecuteBlockInScope(containing_scope, err); | 223 return ExecuteBlockInScope(containing_scope, err); |
224 } | 224 } |
225 | 225 |
226 LocationRange BlockNode::GetRange() const { | 226 LocationRange BlockNode::GetRange() const { |
227 if (begin_token_.type() != Token::INVALID && | 227 if (begin_token_.type() != Token::INVALID && |
228 end_token_.type() != Token::INVALID) { | 228 end_token_.type() != Token::INVALID) { |
229 return begin_token_.range().Union(end_token_.range()); | 229 return begin_token_.range().Union(end_token_.range()); |
230 } else if (!statements_.empty()) { | 230 } else if (!statements_.empty()) { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 520 |
521 Err UnaryOpNode::MakeErrorDescribing(const std::string& msg, | 521 Err UnaryOpNode::MakeErrorDescribing(const std::string& msg, |
522 const std::string& help) const { | 522 const std::string& help) const { |
523 return Err(op_, msg, help); | 523 return Err(op_, msg, help); |
524 } | 524 } |
525 | 525 |
526 void UnaryOpNode::Print(std::ostream& out, int indent) const { | 526 void UnaryOpNode::Print(std::ostream& out, int indent) const { |
527 out << IndentFor(indent) << "UNARY(" << op_.value() << ")\n"; | 527 out << IndentFor(indent) << "UNARY(" << op_.value() << ")\n"; |
528 operand_->Print(out, indent + 1); | 528 operand_->Print(out, indent + 1); |
529 } | 529 } |
OLD | NEW |