Skip to content

Remove get_module and get_raw_scope Functions and Cleanup - #810

Merged
InsertCreativityHere merged 2 commits into
icerpc:mainfrom
InsertCreativityHere:scope-cleanup
Aug 27, 2026
Merged

Remove get_module and get_raw_scope Functions and Cleanup#810
InsertCreativityHere merged 2 commits into
icerpc:mainfrom
InsertCreativityHere:scope-cleanup

Conversation

@InsertCreativityHere

@InsertCreativityHere InsertCreativityHere commented Aug 27, 2026

Copy link
Copy Markdown
Member

This PR removes the get_module and get_raw_scope functions from struct 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 Scope struct. Instead of holding a WeakPtr<Module>, now it just holds a String. This is simpler, and necessary for my intended fixes to #808.

What's Changed

  • Nothing changed except removing dead code.

@InsertCreativityHere InsertCreativityHere added the slicec Related to the 'slicec' crate label Aug 27, 2026
@InsertCreativityHere InsertCreativityHere added this to the 0.4.1 milestone Aug 27, 2026
@InsertCreativityHere
InsertCreativityHere requested a lite review from Copilot August 27, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Scope by removing the stored module pointer and adding a module_scope: String.
  • Update module construction to initialize module_scope/parser_scope directly from the parsed module identifier.
  • Remove ScopedSymbol::get_module and related Module coupling from the ScopedSymbol implementation 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_scope is 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;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It definitely is removed. Copilot is not reviewing the latest commit here? Idk.

@InsertCreativityHere
InsertCreativityHere merged commit a641aee into icerpc:main Aug 27, 2026
7 checks passed
InsertCreativityHere added a commit that referenced this pull request Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

slicec Related to the 'slicec' crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants