1 /*
2  * Copyright 2016 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SKSL_FUNCTIONREFERENCE
9 #define SKSL_FUNCTIONREFERENCE
10 
11 #include "SkSLContext.h"
12 #include "SkSLExpression.h"
13 #include "SkSLFunctionDeclaration.h"
14 
15 namespace SkSL {
16 
17 /**
18  * An identifier referring to a function name. This is an intermediate value: FunctionReferences are
19  * always eventually replaced by FunctionCalls in valid programs.
20  */
21 struct FunctionReference : public Expression {
22     FunctionReference(const Context& context, int offset,
23                       std::vector<const FunctionDeclaration*> function)
24     : INHERITED(offset, kFunctionReference_Kind, *context.fInvalid_Type)
25     , fFunctions(function) {}
26 
27     bool hasSideEffects() const override {
28         return false;
29     }
30 
31     String description() const override {
32         ASSERT(false);
33         return String("<function>");
34     }
35 
36     const std::vector<const FunctionDeclaration*> fFunctions;
37 
38     typedef Expression INHERITED;
39 };
40 
41 } // namespace
42 
43 #endif
44