Remove get_module and get_raw_scope Functions and Cleanup - #810
Merged
InsertCreativityHere merged 2 commits intoAug 27, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request removes dead scoping APIs by simplifying Scope to store module scope as a String (instead of a WeakPtr<Module>), and updates the Slice parser to populate this new field when constructing a module.
Changes:
- Simplify
Scopeby removing the stored module pointer and adding amodule_scope: String. - Update module construction to initialize
module_scope/parser_scopedirectly from the parsed module identifier. - Remove
ScopedSymbol::get_moduleand relatedModulecoupling from theScopedSymbolimplementation macro.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
slicec/src/parsers/slice/grammar.rs |
Initializes current_scope.module_scope and current_scope.parser_scope when parsing a module, removing the need to store a module pointer in scope. |
slicec/src/grammar/util.rs |
Simplifies Scope by replacing the module weak pointer with a module_scope string and updating scope-pop debug assertions accordingly. |
slicec/src/grammar/traits.rs |
Removes get_module from ScopedSymbol and adjusts module_scope() to return the stored Scope.module_scope string. |
Suppressed comments (1)
slicec/src/grammar/traits.rs:126
- If
ScopedSymbol::get_raw_scopeis removed from the trait,implement_Scoped_Symbol_for!should also stop generating an implementation for it; otherwise this macro will no longer compile once the trait is updated.
fn module_scope(&self) -> &str {
&self.scope.module_scope
}
fn get_raw_scope(&self) -> &Scope {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
18
to
22
| pub trait ScopedSymbol: Symbol { | ||
| fn parser_scope(&self) -> &str; | ||
| fn module_scope(&self) -> &str; | ||
| fn get_module(&self) -> &Module; | ||
| fn get_raw_scope(&self) -> &Scope; | ||
| } |
Member
Author
There was a problem hiding this comment.
It definitely is removed. Copilot is not reviewing the latest commit here? Idk.
InsertCreativityHere
added a commit
that referenced
this pull request
Aug 27, 2026
(cherry picked from commit a641aee)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes the
get_moduleandget_raw_scopefunctions fromstruct Scope, because they're uncalled.It was part of the public API, but even for the other places that use
slicec, it was dead there too.Removing these functions let's us simplify the
Scopestruct. Instead of holding aWeakPtr<Module>, now it just holds aString. This is simpler, and necessary for my intended fixes to #808.What's Changed