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

Use a more portable way to check if code is parseable #1032

Merged
merged 2 commits into from
Jul 29, 2023

Conversation

eregon
Copy link
Member

@eregon eregon commented Jul 26, 2023

Comment on lines 433 to 435
catch(:valid) do
eval("BEGIN { throw :valid, true }\n#{text}")
false
end
Copy link
Member

Choose a reason for hiding this comment

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

false line should never reach.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, removed.

* The same as used in irb: https://github.com/ruby/irb/pull/134/files
* This works on all Ruby implementations, unlike `return` in BEGIN which
  can be quite difficult to support.
* This reverts commit 5db4767.
@eregon eregon force-pushed the more-portable-parseable-check branch from 79359d3 to 9791cf7 Compare July 28, 2023 10:46
@eregon eregon merged commit e3bd869 into ruby:master Jul 29, 2023
21 checks passed
@eregon eregon deleted the more-portable-parseable-check branch July 29, 2023 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants