| 1 | /* |
| 2 | * Copyright 2019 Google LLC |
| 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_ASTFILE |
| 9 | #define SKSL_ASTFILE |
| 10 | |
| 11 | #include "src/sksl/SkSLASTNode.h" |
| 12 | |
| 13 | namespace SkSL { |
| 14 | |
| 15 | struct ASTFile { |
| 16 | ASTFile() |
| 17 | : fRoot(ASTNode::ID::Invalid()) {} |
| 18 | |
| 19 | ASTNode& root() { |
| 20 | return fNodes[fRoot.fValue]; |
| 21 | } |
| 22 | |
| 23 | private: |
| 24 | std::vector<ASTNode> fNodes; |
| 25 | |
| 26 | ASTNode::ID fRoot; |
| 27 | |
| 28 | friend class IRGenerator; |
| 29 | friend class Parser; |
| 30 | }; |
| 31 | |
| 32 | } // namespace |
| 33 | |
| 34 | #endif |
| 35 | |