blob: 7af940e85b7f83a80e64f499c880a2d178905c11 [file] [log] [blame]
* Copyright 2016 Google Inc.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
#include "include/private/SkTArray.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
namespace SkSL {
* A function invocation.
class FunctionCall final : public Expression {
static constexpr Kind kExpressionKind = Kind::kFunctionCall;
FunctionCall(int offset, const Type* type, const FunctionDeclaration* function,
ExpressionArray arguments)
: INHERITED(offset, kExpressionKind, type)
, fFunction(*function)
, fArguments(std::move(arguments)) {}
// Resolves generic types, performs type conversion on arguments, determines return type, and
// reports errors via the ErrorReporter.
static std::unique_ptr<Expression> Convert(const Context& context,
int offset,
const FunctionDeclaration& function,
ExpressionArray arguments);
// Creates the function call; reports errors via ASSERT.
static std::unique_ptr<Expression> Make(const Context& context,
int offset,
const Type* returnType,
const FunctionDeclaration& function,
ExpressionArray arguments);
const FunctionDeclaration& function() const {
return fFunction;
ExpressionArray& arguments() {
return fArguments;
const ExpressionArray& arguments() const {
return fArguments;
bool hasProperty(Property property) const override;
std::unique_ptr<Expression> clone() const override;
String description() const override;
const FunctionDeclaration& fFunction;
ExpressionArray fArguments;
using INHERITED = Expression;
} // namespace SkSL