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

Side by Side Diff: tools/gn/template.h

Issue 212933008: Don't dynamically scope GN templates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/scope_unittest.cc ('k') | tools/gn/template.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « tools/gn/scope_unittest.cc ('k') | tools/gn/template.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698