1 // Copyright 2020 The Tint Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SRC_AST_BREAK_STATEMENT_H_
16 #define SRC_AST_BREAK_STATEMENT_H_
17 
18 #include "src/ast/statement.h"
19 
20 namespace tint {
21 namespace ast {
22 
23 /// An break statement
24 class BreakStatement : public Statement {
25  public:
26   /// Constructor
27   BreakStatement();
28   /// Constructor
29   /// @param source the break statement source
30   explicit BreakStatement(const Source& source);
31   /// Move constructor
32   BreakStatement(BreakStatement&&);
33   ~BreakStatement() override;
34 
35   /// @returns true if this is an break statement
36   bool IsBreak() const override;
37 
38   /// @returns true if the node is valid
39   bool IsValid() const override;
40 
41   /// Writes a representation of the node to the output stream
42   /// @param out the stream to write to
43   /// @param indent number of spaces to indent the node when writing
44   void to_str(std::ostream& out, size_t indent) const override;
45 
46  private:
47   BreakStatement(const BreakStatement&) = delete;
48 };
49 
50 }  // namespace ast
51 }  // namespace tint
52 
53 #endif  // SRC_AST_BREAK_STATEMENT_H_
54