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/SkSLType.h"
13
14namespace SkSL {
15
16/**
17 * Abstract supertype of all statements.
18 */
19struct Statement : public IRNode {
20 enum Kind {
21 kBlock_Kind,
22 kBreak_Kind,
23 kContinue_Kind,
24 kDiscard_Kind,
25 kDo_Kind,
26 kExpression_Kind,
27 kFor_Kind,
28 kIf_Kind,
29 kNop_Kind,
30 kReturn_Kind,
31 kSwitch_Kind,
32 kVarDeclaration_Kind,
33 kVarDeclarations_Kind,
34 kWhile_Kind
35 };
36
37 Statement(int offset, Kind kind)
38 : INHERITED(offset)
39 , fKind(kind) {}
40
41 virtual bool isEmpty() const {
42 return false;
43 }
44
45 virtual std::unique_ptr<Statement> clone() const = 0;
46
47 const Kind fKind;
48
49 typedef IRNode INHERITED;
50};
51
52} // namespace SkSL
53
54#endif
55