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