• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 Google Inc.
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_DISCARDSTATEMENT
9 #define SKSL_DISCARDSTATEMENT
10 
11 #include "include/private/SkSLIRNode.h"
12 #include "include/private/SkSLStatement.h"
13 #include "include/sksl/SkSLPosition.h"
14 
15 #include <memory>
16 #include <string>
17 
18 namespace SkSL {
19 
20 class Context;
21 
22 /**
23  * A 'discard' statement.
24  */
25 class DiscardStatement final : public Statement {
26 public:
27     inline static constexpr Kind kIRNodeKind = Kind::kDiscard;
28 
DiscardStatement(Position pos)29     DiscardStatement(Position pos) : INHERITED(pos, kIRNodeKind) {}
30 
31     // Creates a discard-statement; reports errors via ErrorReporter.
32     static std::unique_ptr<Statement> Convert(const Context& context, Position pos);
33 
34     // Creates a discard-statement; reports errors via SkASSERT.
35     static std::unique_ptr<Statement> Make(const Context& context, Position pos);
36 
37     std::unique_ptr<Statement> clone() const override;
38 
description()39     std::string description() const override {
40         return "discard;";
41     }
42 
43 private:
44     using INHERITED = Statement;
45 };
46 
47 }  // namespace SkSL
48 
49 #endif
50