Revert 264226 "Reduce dependency of TiclInvalidationService on P..."
[chromium-blink-merge.git] / tools / gn / template.h
blob01768620ec98bbe293d05ba66c5044ddfa2f1a97
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.
5 #ifndef TOOLS_GN_TEMPLATE_H_
6 #define TOOLS_GN_TEMPLATE_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
13 class BlockNode;
14 class Err;
15 class FunctionCallNode;
16 class LocationRange;
17 class Scope;
18 class Value;
20 class Template {
21 public:
22 // Makes a new closure based on the given scope.
23 Template(const Scope* scope, const FunctionCallNode* def);
25 // Takes ownership of a previously-constructed closure.
26 Template(scoped_ptr<Scope> closure, const FunctionCallNode* def);
28 ~Template();
30 // Makes a copy of this template.
31 scoped_ptr<Template> Clone() const;
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;
41 // Returns the location range where this template was defined.
42 LocationRange GetDefinitionRange() const;
44 private:
45 Template();
47 scoped_ptr<Scope> closure_;
48 const FunctionCallNode* definition_;
50 DISALLOW_COPY_AND_ASSIGN(Template);
53 #endif // TOOLS_GN_TEMPLATE_H_