/src/skia/src/sksl/ir/SkSLPoison.h
Line | Count | Source |
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 | | #ifndef SkSLPoison_DEFINED |
8 | | #define SkSLPoison_DEFINED |
9 | | |
10 | | #include "src/sksl/SkSLBuiltinTypes.h" |
11 | | #include "src/sksl/SkSLCompiler.h" |
12 | | #include "src/sksl/SkSLContext.h" |
13 | | #include "src/sksl/ir/SkSLExpression.h" |
14 | | |
15 | | namespace SkSL { |
16 | | |
17 | | class Poison : public Expression { |
18 | | public: |
19 | | inline static constexpr Kind kIRNodeKind = Kind::kPoison; |
20 | | |
21 | 266k | static std::unique_ptr<Expression> Make(Position pos, const Context& context) { |
22 | 266k | return std::make_unique<Poison>(pos, context.fTypes.fPoison.get()); |
23 | 266k | } |
24 | | |
25 | | Poison(Position pos, const Type* type) |
26 | 271k | : INHERITED(pos, kIRNodeKind, type) {} |
27 | | |
28 | 4.14k | std::unique_ptr<Expression> clone(Position pos) const override { |
29 | 4.14k | return std::make_unique<Poison>(pos, &this->type()); |
30 | 4.14k | } |
31 | | |
32 | 11.5k | std::string description(OperatorPrecedence) const override { |
33 | 11.5k | return Compiler::POISON_TAG; |
34 | 11.5k | } |
35 | | |
36 | | private: |
37 | | using INHERITED = Expression; |
38 | | }; |
39 | | |
40 | | } // namespace SkSL |
41 | | |
42 | | #endif // SkSLPoison_DEFINED |