Skip to content

Separate method and constant reference Ruby APIs#719

Open
vinistock wants to merge 1 commit intomainfrom
04-02-separate_method_and_constant_reference_ruby_apis
Open

Separate method and constant reference Ruby APIs#719
vinistock wants to merge 1 commit intomainfrom
04-02-separate_method_and_constant_reference_ruby_apis

Conversation

@vinistock
Copy link
Copy Markdown
Member

@vinistock vinistock commented Apr 2, 2026

Another refactor PR preparing for exposing ancestor operations in the Ruby API. This PR separates method from constant references. They have different data and different types involved, so we can get better structure by having them be independent.

Other than internal changes, the main thing is that we now have:

  • ConstantReference: abstract parent class
  • UnresolvedConstantReference: the object to represent constants that we couldn't resolve (holds unqualified name and location)
  • ResolvedConstantReference: object for resolved constants (holds declaration that it points to and location)

Copy link
Copy Markdown
Member Author

vinistock commented Apr 2, 2026

@vinistock vinistock self-assigned this Apr 2, 2026
@vinistock vinistock force-pushed the 04-02-separate_method_and_constant_reference_ruby_apis branch from 69d6496 to 44be2ea Compare April 2, 2026 17:40
@vinistock vinistock marked this pull request as ready for review April 2, 2026 17:45
@vinistock vinistock requested a review from a team as a code owner April 2, 2026 17:45
end
end

def test_graph_resolved_constant_references
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it possible to have both resolved and unresolved references returned together? If so, can we add a test for it?


// Constant and ConstantAlias have constant references
rb_define_method(cConstant, "references", rdxr_constant_declaration_references, 0);
rb_define_method(cConstantAlias, "references", rdxr_constant_declaration_references, 0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we have tests for these?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants