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 Make(Position pos,const Context & context)21 static std::unique_ptr<Expression> Make(Position pos, const Context& context) { 22 return std::make_unique<Poison>(pos, context.fTypes.fPoison.get()); 23 } 24 Poison(Position pos,const Type * type)25 Poison(Position pos, const Type* type) 26 : INHERITED(pos, kIRNodeKind, type) {} 27 clone(Position pos)28 std::unique_ptr<Expression> clone(Position pos) const override { 29 return std::make_unique<Poison>(pos, &this->type()); 30 } 31 description(OperatorPrecedence)32 std::string description(OperatorPrecedence) const override { 33 return Compiler::POISON_TAG; 34 } 35 36 private: 37 using INHERITED = Expression; 38 }; 39 40 } // namespace SkSL 41 42 #endif // SkSLPoison_DEFINED 43