ReferenceResolvingPass.h 695 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2023, Dan Klishch <danilklishch@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include "Compiler/GenericASTPass.h"
  8. namespace JSSpecCompiler {
  9. // ReferenceResolvingPass collects all variable names declared in the function and replaces
  10. // UnresolvedReference nodes with either SlotName, Variable, or FunctionPointer nodes.
  11. class ReferenceResolvingPass : public GenericASTPass {
  12. public:
  13. inline static constexpr StringView name = "reference-resolving"sv;
  14. using GenericASTPass::GenericASTPass;
  15. protected:
  16. void process_function() override;
  17. RecursionDecision on_entry(Tree tree) override;
  18. void on_leave(Tree tree) override;
  19. };
  20. }