Flutter Engine
The Flutter Engine
SkSLFunctionCall.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_FUNCTIONCALL
9#define SKSL_FUNCTIONCALL
10
15
16#include <cstdint>
17#include <memory>
18#include <string>
19#include <utility>
20
21namespace SkSL {
22
23class Context;
24class FunctionDeclaration;
25class Type;
26enum class OperatorPrecedence : uint8_t;
27
28/**
29 * A function invocation.
30 */
31class FunctionCall final : public Expression {
32public:
33 inline static constexpr Kind kIRNodeKind = Kind::kFunctionCall;
34
38 , fFunction(*function)
39 , fArguments(std::move(arguments)) {}
40
41 // Resolves generic types, performs type conversion on arguments, determines return type, and
42 // reports errors via the ErrorReporter.
43 static std::unique_ptr<Expression> Convert(const Context& context,
47
48 static std::unique_ptr<Expression> Convert(const Context& context,
50 std::unique_ptr<Expression> functionValue,
52
53 // Creates the function call; reports errors via ASSERT.
54 static std::unique_ptr<Expression> Make(const Context& context,
56 const Type* returnType,
59
60 static const FunctionDeclaration* FindBestFunctionForCall(const Context& context,
61 const FunctionDeclaration* overloads,
63
65 return fFunction;
66 }
67
69 return fArguments;
70 }
71
72 const ExpressionArray& arguments() const {
73 return fArguments;
74 }
75
76 std::unique_ptr<Expression> clone(Position pos) const override;
77
78 std::string description(OperatorPrecedence) const override;
79
80private:
81 const FunctionDeclaration& fFunction;
82 ExpressionArray fArguments;
83
84 using INHERITED = Expression;
85};
86
87} // namespace SkSL
88
89#endif
SkPoint pos
std::unique_ptr< Expression > clone() const
Expression(Position pos, Kind kind, const Type *type)
const Type & type() const
std::string description() const final
static constexpr Kind kIRNodeKind
const ExpressionArray & arguments() const
ExpressionArray & arguments()
const FunctionDeclaration & function() const
static std::unique_ptr< Expression > Convert(const Context &context, Position pos, const FunctionDeclaration &function, ExpressionArray arguments)
static std::unique_ptr< Expression > Make(const Context &context, Position pos, const Type *returnType, const FunctionDeclaration &function, ExpressionArray arguments)
FunctionCall(Position pos, const Type *type, const FunctionDeclaration *function, ExpressionArray arguments)
static const FunctionDeclaration * FindBestFunctionForCall(const Context &context, const FunctionDeclaration *overloads, const ExpressionArray &arguments)
OperatorPrecedence
Definition: SkSLOperator.h:57
ExpressionKind
Definition: SkSLIRNode.h:62
Definition: ref_ptr.h:256