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_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
15 class FunctionCallNode
;
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
);
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
,
41 // Returns the location range where this template was defined.
42 LocationRange
GetDefinitionRange() const;
47 scoped_ptr
<Scope
> closure_
;
48 const FunctionCallNode
* definition_
;
50 DISALLOW_COPY_AND_ASSIGN(Template
);
53 #endif // TOOLS_GN_TEMPLATE_H_