Flutter Engine
The Flutter Engine
SkSLConstructorStruct.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_STRUCT
9#define SKSL_CONSTRUCTOR_STRUCT
10
16
17#include <memory>
18#include <utility>
19
20namespace SkSL {
21
22class Context;
23class Type;
24
25/**
26 * Represents the construction of an struct object, such as "Color(red, green, blue, 1)".
27 */
29public:
30 inline static constexpr Kind kIRNodeKind = Kind::kConstructorStruct;
31
33 : INHERITED(pos, kIRNodeKind, &type, std::move(arguments)) {}
34
35 // ConstructorStruct::Convert will typecheck and create struct-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 // ConstructorStruct::Make creates struct-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<ConstructorStruct>(pos, this->type(), this->arguments().clone());
50 }
51
52private:
53 using INHERITED = MultiArgumentConstructor;
54};
55
56} // namespace SkSL
57
58#endif
SkPoint pos
static std::unique_ptr< Expression > Make(const Context &context, Position pos, const Type &type, ExpressionArray args)
static constexpr Kind kIRNodeKind
std::unique_ptr< Expression > clone(Position pos) const override
ConstructorStruct(Position pos, const Type &type, ExpressionArray arguments)
static std::unique_ptr< Expression > Convert(const Context &context, Position pos, const Type &type, ExpressionArray args)
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