| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 333 |
| 334 const FunctionCallNode* FunctionCallNode::AsFunctionCall() const { | 334 const FunctionCallNode* FunctionCallNode::AsFunctionCall() const { |
| 335 return this; | 335 return this; |
| 336 } | 336 } |
| 337 | 337 |
| 338 Value FunctionCallNode::Execute(Scope* scope, Err* err) const { | 338 Value FunctionCallNode::Execute(Scope* scope, Err* err) const { |
| 339 return functions::RunFunction(scope, this, args_.get(), block_.get(), err); | 339 return functions::RunFunction(scope, this, args_.get(), block_.get(), err); |
| 340 } | 340 } |
| 341 | 341 |
| 342 LocationRange FunctionCallNode::GetRange() const { | 342 LocationRange FunctionCallNode::GetRange() const { |
| 343 if (function_.type() == Token::INVALID) |
| 344 return LocationRange(); // This will be null in some tests. |
| 343 if (block_) | 345 if (block_) |
| 344 return function_.range().Union(block_->GetRange()); | 346 return function_.range().Union(block_->GetRange()); |
| 345 return function_.range().Union(args_->GetRange()); | 347 return function_.range().Union(args_->GetRange()); |
| 346 } | 348 } |
| 347 | 349 |
| 348 Err FunctionCallNode::MakeErrorDescribing(const std::string& msg, | 350 Err FunctionCallNode::MakeErrorDescribing(const std::string& msg, |
| 349 const std::string& help) const { | 351 const std::string& help) const { |
| 350 return Err(function_, msg, help); | 352 return Err(function_, msg, help); |
| 351 } | 353 } |
| 352 | 354 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 526 |
| 525 Err UnaryOpNode::MakeErrorDescribing(const std::string& msg, | 527 Err UnaryOpNode::MakeErrorDescribing(const std::string& msg, |
| 526 const std::string& help) const { | 528 const std::string& help) const { |
| 527 return Err(op_, msg, help); | 529 return Err(op_, msg, help); |
| 528 } | 530 } |
| 529 | 531 |
| 530 void UnaryOpNode::Print(std::ostream& out, int indent) const { | 532 void UnaryOpNode::Print(std::ostream& out, int indent) const { |
| 531 out << IndentFor(indent) << "UNARY(" << op_.value() << ")\n"; | 533 out << IndentFor(indent) << "UNARY(" << op_.value() << ")\n"; |
| 532 operand_->Print(out, indent + 1); | 534 operand_->Print(out, indent + 1); |
| 533 } | 535 } |
| OLD | NEW |