| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2025 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #pragma once | ||
| 4 | |||
| 5 | #include <cstdint> | ||
| 6 | #include <string> | ||
| 7 | |||
| 8 | namespace spice::compiler { | ||
| 9 | |||
| 10 | // Forward declarations | ||
| 11 | class Scope; | ||
| 12 | class GlobalResourceManager; | ||
| 13 | class SourceFile; | ||
| 14 | struct CliOptions; | ||
| 15 | enum class ScopeType : uint8_t; | ||
| 16 | |||
| 17 | class CompilerPass { | ||
| 18 | public: | ||
| 19 | // Constructors | ||
| 20 | explicit CompilerPass(GlobalResourceManager &resourceManager, SourceFile *sourceFile = nullptr); | ||
| 21 | CompilerPass(const CompilerPass &) = delete; | ||
| 22 | |||
| 23 | // Destructor | ||
| 24 | 11047 | virtual ~CompilerPass() = default; | |
| 25 | |||
| 26 | // Public methods | ||
| 27 | void changeToScope(Scope *scope, ScopeType scopeType); | ||
| 28 | void changeToScope(const std::string &scopeName, ScopeType scopeType); | ||
| 29 | void changeToParentScope(ScopeType oldScopeType); | ||
| 30 | |||
| 31 | protected: | ||
| 32 | // Protected members | ||
| 33 | GlobalResourceManager &resourceManager; | ||
| 34 | const CliOptions &cliOptions; | ||
| 35 | SourceFile *sourceFile; | ||
| 36 | Scope *rootScope; | ||
| 37 | size_t manIdx = 0; | ||
| 38 | |||
| 39 | public: | ||
| 40 | // Public members | ||
| 41 | Scope *currentScope; | ||
| 42 | }; | ||
| 43 | |||
| 44 | } // namespace spice::compiler | ||
| 45 |