xref: /aosp_15_r20/external/skia/src/sksl/ir/SkSLStatement.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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_STATEMENT
9 #define SKSL_STATEMENT
10 
11 #include "src/sksl/ir/SkSLIRNode.h"
12 #include "src/sksl/ir/SkSLSymbol.h"
13 
14 namespace SkSL {
15 
16 /**
17  * Abstract supertype of all statements.
18  */
19 class Statement : public IRNode {
20 public:
21     using Kind = StatementKind;
22 
Statement(Position pos,Kind kind)23     Statement(Position pos, Kind kind)
24     : INHERITED(pos, (int) kind) {
25         SkASSERT(kind >= Kind::kFirst && kind <= Kind::kLast);
26     }
27 
kind()28     Kind kind() const {
29         return (Kind) fKind;
30     }
31 
isEmpty()32     virtual bool isEmpty() const {
33         return false;
34     }
35 
36 private:
37     using INHERITED = IRNode;
38 };
39 
40 }  // namespace SkSL
41 
42 #endif
43