Refactor Binder and Environment, remove fixed_scope_idx
The `fixed_scope_idx` field has been removed from `Binder` and `Environment`. This field was used to enforce immutability on certain scopes during binding. The logic for handling the immutability of the root scope (scope 0) has been moved and refactored. Now, during the `Environment::new` bootstrap phase, the addresses within the RTL scope (scope 0) are directly translated from `Address::Local` to `Address::Global`. This ensures that the Binder inherently treats these as global and immutable without needing an explicit `fixed_scope_idx` check. The `Binder::bind_root` signature has been updated to reflect this change by removing the `fixed_scope_idx` parameter. Consequently, tests and other usages of `bind_root` have been adjusted. This change simplifies the binding process by centralizing the immutability handling to the environment setup phase, making the Binder's logic cleaner.
This commit is contained in:
@@ -7,7 +7,7 @@ Die `Environment`-Struktur fungiert im Projekt als zentraler "State-Manager" und
|
||||
* **Modulladung & Abhängigkeiten:** `preload_dependencies` und `discover_globals` lesen `#use`-Abhängigkeiten, durchsuchen den Code vorab nach globalen Definitionen (`def`) und Makros und laden die Standardbibliothek (`prelude.myc`).
|
||||
* **Kompilierungs-Pipeline:** Die Methoden `compile`, `compile_syntax`, `compile_pipeline` und `link` steuern den Code durch alle Compiler-Phasen: Macro-Expansion -> Binding -> Type-Checking -> Analysis -> Specialization -> Optimization -> Lowering.
|
||||
* **Makro-Evaluierung:** Die interne Struktur `RuntimeMacroEvaluator` wird genutzt, um AST-Knoten zur Compile-Zeit an eine VM zu übergeben und den Code für Makros auszuführen.
|
||||
* **Laufzeit-Ausführung & RTL (Runtime Library):** Methoden wie `run_script`, `run_debug` und `instantiate` starten die `VM`. Zudem gibt es Methoden (`register_native`, `allocate_slot`), um native Rust-Funktionen (Intrinsics) im globalen Scope (`fixed_scope_idx = 0`) zu registrieren.
|
||||
* **Laufzeit-Ausführung & RTL (Runtime Library):** Methoden wie `run_script`, `run_debug` und `instantiate` starten die `VM`. Zudem gibt es Methoden (`register_native`, `allocate_slot`), um native Rust-Funktionen (Intrinsics) im globalen RTL-Scope (Scope 0) zu registrieren.
|
||||
* **Dokumentations-Registry:** Es speichert sowohl RTL-Dokumentation als auch aus dem Source-Code extrahierte Kommentare (`myc_docs`).
|
||||
|
||||
## 2. Prüfung auf Boilerplate
|
||||
|
||||
Reference in New Issue
Block a user