Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle method definitions with constants #26

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joshmn
Copy link

@joshmn joshmn commented Aug 7, 2023

closes #20

Not in love with #inferred_context_for but it seems to work.

Copy link
Owner

@marcoroth marcoroth left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on, @joshmn! 🤗

Comment on lines +203 to +204
@modules << existing
@namespace << existing
Copy link
Owner

@marcoroth marcoroth Aug 7, 2023

Choose a reason for hiding this comment

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

I think we shouldn't add it to the @modules or @namesapce since we are not going to traverse it's children, so we don't need to set setup it up to be part of the namespace, since we would also need to pop them again

elsif existing = @analyzer.classes.detect { |name| name.qualified_name == target }
return prev if @classes.find { |klass| klass.qualified_name == existing.qualified_name }

@classes << existing
Copy link
Owner

Choose a reason for hiding this comment

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

Same here

# rubocop:disable Lint/AssignmentInCondition
def inferred_context_for(target)
if existing = @analyzer.modules.detect { |name| name.qualified_name == target }
return prev if @modules.find { |mod| mod.qualified_name == existing.qualified_name }
Copy link
Owner

Choose a reason for hiding this comment

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

Where is prev coming from? 🤔

@marcoroth
Copy link
Owner

I'm afraid this one needs quite some rework after #41. Sorry about that!

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.

Support method definitions with constant in definition
2 participants