Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSLFunctionReference.h
Go to the documentation of this file.
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
15
16namespace SkSL {
17
18/**
19 * An identifier referring to a function name. This is an intermediate value: FunctionReferences are
20 * always eventually replaced by FunctionCalls in valid programs.
21 */
22class FunctionReference final : public Expression {
23public:
24 inline static constexpr Kind kIRNodeKind = Kind::kFunctionReference;
25
28 : INHERITED(pos, kIRNodeKind, context.fTypes.fInvalid.get())
29 , fOverloadChain(overloadChain) {}
30
32 return fOverloadChain;
33 }
34
35 std::unique_ptr<Expression> clone(Position pos) const override {
36 return std::unique_ptr<Expression>(new FunctionReference(pos, this->overloadChain(),
37 &this->type()));
38 }
39
40 std::string description(OperatorPrecedence) const override {
41 return "<function>";
42 }
43
44private:
46 : INHERITED(pos, kIRNodeKind, type)
47 , fOverloadChain(overloadChain) {}
48
49 const FunctionDeclaration* fOverloadChain;
50
51 using INHERITED = Expression;
52};
53
54} // namespace SkSL
55
56#endif
SkPoint pos
virtual const Type & type() const
std::unique_ptr< Expression > clone(Position pos) const override
static constexpr Kind kIRNodeKind
std::string description(OperatorPrecedence) const override
FunctionReference(const Context &context, Position pos, const FunctionDeclaration *overloadChain)
const FunctionDeclaration * overloadChain() const
OperatorPrecedence
ExpressionKind
Definition SkSLIRNode.h:62