Flutter Engine
The Flutter Engine
SkSLConstructorArray.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google LLC
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_CONSTRUCTOR_ARRAY
9#define SKSL_CONSTRUCTOR_ARRAY
10
16
17#include <memory>
18#include <utility>
19
20namespace SkSL {
21
22class Context;
23class Type;
24
25/**
26 * Represents the construction of an array type, such as "float[5](x, y, z, w, 1)".
27 */
29public:
30 inline static constexpr Kind kIRNodeKind = Kind::kConstructorArray;
31
33 : INHERITED(pos, kIRNodeKind, &type, std::move(arguments)) {}
34
35 // ConstructorArray::Convert will typecheck and create array-constructor expressions.
36 // Reports errors via the ErrorReporter; returns null on error.
37 static std::unique_ptr<Expression> Convert(const Context& context,
39 const Type& type,
41
42 // ConstructorArray::Make creates array-constructor expressions; errors reported via SkASSERT.
43 static std::unique_ptr<Expression> Make(const Context& context,
45 const Type& type,
47
48 std::unique_ptr<Expression> clone(Position pos) const override {
49 return std::make_unique<ConstructorArray>(pos, this->type(), this->arguments().clone());
50 }
51
52private:
53 using INHERITED = MultiArgumentConstructor;
54};
55
56} // namespace SkSL
57
58#endif
SkPoint pos
static constexpr Kind kIRNodeKind
std::unique_ptr< Expression > clone(Position pos) const override
static std::unique_ptr< Expression > Make(const Context &context, Position pos, const Type &type, ExpressionArray args)
static std::unique_ptr< Expression > Convert(const Context &context, Position pos, const Type &type, ExpressionArray args)
ConstructorArray(Position pos, const Type &type, ExpressionArray arguments)
std::unique_ptr< Expression > clone() const
const Type & type() const
ExpressionArray & arguments()
MultiArgumentConstructor(Position pos, Kind kind, const Type *type, ExpressionArray arguments)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
ExpressionKind
Definition: SkSLIRNode.h:62
Definition: ref_ptr.h:256