src/CompilerPass.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2026 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 | |||
| 22 | // Prevent copy | ||
| 23 | CompilerPass(const CompilerPass &) = delete; | ||
| 24 | CompilerPass &operator=(const CompilerPass &) = delete; | ||
| 25 | |||
| 26 | // Destructor | ||
| 27 | 11999 | virtual ~CompilerPass() = default; | |
| 28 | |||
| 29 | // Public methods | ||
| 30 | void changeToScope(Scope *scope, ScopeType scopeType); | ||
| 31 | void changeToScope(const std::string &scopeName, ScopeType scopeType); | ||
| 32 | void changeToParentScope(ScopeType oldScopeType); | ||
| 33 | |||
| 34 | protected: | ||
| 35 | // Protected members | ||
| 36 | GlobalResourceManager &resourceManager; | ||
| 37 | const CliOptions &cliOptions; | ||
| 38 | SourceFile *sourceFile; | ||
| 39 | Scope *rootScope; | ||
| 40 | size_t manIdx = 0; | ||
| 41 | |||
| 42 | public: | ||
| 43 | // Public members | ||
| 44 | Scope *currentScope; | ||
| 45 | }; | ||
| 46 | |||
| 47 | } // namespace spice::compiler | ||
| 48 |