Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSLConstructorCompoundCast.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_COMPOUND_CAST
9#define SKSL_CONSTRUCTOR_COMPOUND_CAST
10
15
16#include <memory>
17#include <utility>
18
19namespace SkSL {
20
21class Context;
22class Type;
23
24/**
25 * Represents the construction of a vector/matrix typecast, such as `half3(myInt3)` or
26 * `float4x4(myHalf4x4)`. Matrix resizes are done in ConstructorMatrixResize, not here.
27 *
28 * These always contain exactly 1 vector or matrix of matching size, and are never constant.
29 */
31public:
32 inline static constexpr Kind kIRNodeKind = Kind::kConstructorCompoundCast;
33
34 ConstructorCompoundCast(Position pos, const Type& type, std::unique_ptr<Expression> arg)
35 : INHERITED(pos, kIRNodeKind, &type, std::move(arg)) {}
36
37 static std::unique_ptr<Expression> Make(const Context& context,
39 const Type& type,
40 std::unique_ptr<Expression> arg);
41
42 std::unique_ptr<Expression> clone(Position pos) const override {
43 return std::make_unique<ConstructorCompoundCast>(pos, this->type(), argument()->clone());
44 }
45
46private:
47 using INHERITED = SingleArgumentConstructor;
48};
49
50} // namespace SkSL
51
52#endif
SkPoint pos
ConstructorCompoundCast(Position pos, const Type &type, std::unique_ptr< Expression > arg)
static std::unique_ptr< Expression > Make(const Context &context, Position pos, const Type &type, std::unique_ptr< Expression > arg)
std::unique_ptr< Expression > clone(Position pos) const override
virtual const Type & type() const
std::unique_ptr< Expression > clone() const
std::unique_ptr< Expression > & argument()
ExpressionKind
Definition SkSLIRNode.h:62
Definition ref_ptr.h:256