-
Notifications
You must be signed in to change notification settings - Fork 140
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
Syntax errors for jumps within eval
#2731
Comments
This is by design. When you pass scopes, we assume you are parsing an |
Hm, but
test.rb: eval("def m; break; end") Ah, you mean it's a responsibility of compiler. Got it 👍 |
Yeah, unfortunately. Consider for instance the difference between |
Is it mostly about different error messages? I'm not sure if that difference is important enough to have this behavior differ with scopes. |
Some other examples: |
I'll try to find which tests were failing, but when I implemented this I got a couple more |
Ahh, it was the ERB tests. We need this to not error out in case you're parsing an ERB file |
I'm not following, could you give a concrete example? |
Ah maybe it's related to Ripper? I've seen https://bugs.ruby-lang.org/issues/20460 now |
For some operators (
break
,next
,redo
) when jump is incorrect (e.g. in a method body)SyntaxError
might be not returned whenscopes
parsing option is not an empty Array (what is a case to implementKernel#eval
):Prism.parse
called with emptyscopes
, so syntax error is returned:Prism.parse
called with not emptyscopes
, but no syntax error returned:Related issue #1604
The text was updated successfully, but these errors were encountered: