OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef TOOLS_GN_TEMPLATE_H_ |
| 6 #define TOOLS_GN_TEMPLATE_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 |
| 13 class BlockNode; |
| 14 class Err; |
| 15 class FunctionCallNode; |
| 16 class LocationRange; |
| 17 class Scope; |
| 18 class Value; |
| 19 |
| 20 class Template { |
| 21 public: |
| 22 // Makes a new closure based on the given scope. |
| 23 Template(const Scope* scope, const FunctionCallNode* def); |
| 24 |
| 25 // Takes ownership of a previously-constructed closure. |
| 26 Template(scoped_ptr<Scope> closure, const FunctionCallNode* def); |
| 27 |
| 28 ~Template(); |
| 29 |
| 30 // Makes a copy of this template. |
| 31 scoped_ptr<Template> Clone() const; |
| 32 |
| 33 // Invoke the template. The values correspond to the state of the code |
| 34 // invoking the template. |
| 35 Value Invoke(Scope* scope, |
| 36 const FunctionCallNode* invocation, |
| 37 const std::vector<Value>& args, |
| 38 BlockNode* block, |
| 39 Err* err) const; |
| 40 |
| 41 // Returns the location range where this template was defined. |
| 42 LocationRange GetDefinitionRange() const; |
| 43 |
| 44 private: |
| 45 Template(); |
| 46 |
| 47 scoped_ptr<Scope> closure_; |
| 48 const FunctionCallNode* definition_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(Template); |
| 51 }; |
| 52 |
| 53 #endif // TOOLS_GN_TEMPLATE_H_ |
OLD | NEW |