SkSLASTFile.h 530 B

12345678910111213141516171819202122232425262728293031323334
  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. #ifndef SKSL_ASTFILE
  8. #define SKSL_ASTFILE
  9. #include "src/sksl/SkSLASTNode.h"
  10. namespace SkSL {
  11. struct ASTFile {
  12. ASTFile()
  13. : fRoot(ASTNode::ID::Invalid()) {}
  14. ASTNode& root() {
  15. return fNodes[fRoot.fValue];
  16. }
  17. private:
  18. std::vector<ASTNode> fNodes;
  19. ASTNode::ID fRoot;
  20. friend class IRGenerator;
  21. friend class Parser;
  22. };
  23. } // namespace
  24. #endif