OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SKSL_BLOCK | 8 #ifndef SKSL_BLOCK |
9 #define SKSL_BLOCK | 9 #define SKSL_BLOCK |
10 | 10 |
11 #include "SkSLStatement.h" | 11 #include "SkSLStatement.h" |
12 #include "SkSLSymbolTable.h" | |
13 | 12 |
14 namespace SkSL { | 13 namespace SkSL { |
15 | 14 |
16 /** | 15 /** |
17 * A block of multiple statements functioning as a single statement. | 16 * A block of multiple statements functioning as a single statement. |
18 */ | 17 */ |
19 struct Block : public Statement { | 18 struct Block : public Statement { |
20 Block(Position position, std::vector<std::unique_ptr<Statement>> statements, | 19 Block(Position position, std::vector<std::unique_ptr<Statement>> statements) |
21 const std::shared_ptr<SymbolTable> symbols) | |
22 : INHERITED(position, kBlock_Kind) | 20 : INHERITED(position, kBlock_Kind) |
23 , fStatements(std::move(statements)) | 21 , fStatements(std::move(statements)) {} |
24 , fSymbols(std::move(symbols)) {} | |
25 | 22 |
26 std::string description() const override { | 23 std::string description() const override { |
27 std::string result = "{"; | 24 std::string result = "{"; |
28 for (size_t i = 0; i < fStatements.size(); i++) { | 25 for (size_t i = 0; i < fStatements.size(); i++) { |
29 result += "\n"; | 26 result += "\n"; |
30 result += fStatements[i]->description(); | 27 result += fStatements[i]->description(); |
31 } | 28 } |
32 result += "\n}\n"; | 29 result += "\n}\n"; |
33 return result; | 30 return result; |
34 } | 31 } |
35 | 32 |
36 const std::vector<std::unique_ptr<Statement>> fStatements; | 33 const std::vector<std::unique_ptr<Statement>> fStatements; |
37 const std::shared_ptr<SymbolTable> fSymbols; | |
38 | 34 |
39 typedef Statement INHERITED; | 35 typedef Statement INHERITED; |
40 }; | 36 }; |
41 | 37 |
42 } // namespace | 38 } // namespace |
43 | 39 |
44 #endif | 40 #endif |
OLD | NEW |