Skip to content

Add arity to invocations #257

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

Merged

Conversation

vinistock
Copy link
Contributor

This PR's branch is based on #256.

Add arity to method invocation nodes.

@vinistock vinistock force-pushed the vs/add_arity_to_invocations branch from 64a1c0f to ab9e14f Compare January 18, 2023 18:59
@vinistock vinistock force-pushed the vs/add_arity_to_invocations branch from ab9e14f to c0ddaf1 Compare January 18, 2023 19:56
@vinistock vinistock force-pushed the vs/add_arity_to_invocations branch from c0ddaf1 to 2c12f9a Compare January 18, 2023 19:57
@@ -848,6 +852,22 @@ def format(q)
def ===(other)
other.is_a?(Args) && ArrayMatch.call(parts, other.parts)
end

def arity
accepts_infinite_arguments? ? Float::INFINITY : parts.length
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kept infinity here to represent an splats and argument forwarding, so that we can do def_node.arity.cover?(call_node.arity).

@kddnewton kddnewton merged commit 51056cd into ruby-syntax-tree:main Jan 26, 2023
@vinistock vinistock deleted the vs/add_arity_to_invocations branch January 26, 2023 16:11
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.

2 participants