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

Ignore anonymous helpers #4

Merged
merged 1 commit into from
Jun 24, 2024
Merged

Conversation

olivier-thatch
Copy link
Contributor

Ignore anonymous helpers instead of raising an exception.

The Tapioca compiler requires helper methods to be declared inside a named module rather than an anonymous helpers do ... end block in order to generate a proper RBI definition that Sorbet can use to know that the helper methods exist.

The initial version of the Tapioca compiler raised an exception when encountering anonymous helpers do ... end blocks to help enforce this. However this is at least one case in which the block form of helpers must be used: defining reusable params, e.g.:

  helpers do
    params :pagination do
      optional :page, type: Integer
      optional :per_page, type: Integer
    end
  end

This PR updates the compiler to simply skip over anonymous helpers blocks.

@olivier-thatch olivier-thatch merged commit 4228226 into main Jun 24, 2024
6 checks passed
@olivier-thatch olivier-thatch deleted the olivier-ignore-anonymous-helpers branch June 24, 2024 20:00
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.

1 participant