-
Notifications
You must be signed in to change notification settings - Fork 188
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
Add SyntaxError#path #3433
Add SyntaxError#path #3433
Conversation
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
de3c880
to
9d7573a
Compare
5b06b00
to
9785f9f
Compare
Thank you for signing the OCA. |
I noticed a small difference between MRI and the implementation here. When instantiating the error directly, in MRI the truffleruby/spec/ruby/core/exception/load_error_spec.rb Lines 8 to 10 in 5522b6a
|
Good point, I think CRuby never uses |
8f5c146
to
a4dd7b4
Compare
|
||
@TruffleBoundary | ||
@Specialization | ||
Object path(RubySyntaxError syntaxError) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to handle RubyString / Nil - a brief search of the codebase suggested that this was how we handled varying return types, did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct. Looks great!
a4dd7b4
to
7eb6f90
Compare
Could you please squash working commits? |
cc386bd
to
0305938
Compare
@andrykonchin squashed! 🙇 |
a467c23
Attempt for
[easy, java] SyntaxError#path has been added. [Feature #19138]
as part of #3039.There's already a sourceLocation in RubySyntaxError, which I believe is used to generate the message with filename: https://github.com/shopify/truffleruby/blob/add-syntaxerror-path/src/main/java/org/truffleruby/core/exception/CoreExceptions.java#L1015. This PR exposes that sourceLocation's filename directly (I think) as
#path
.The original also has some handling for an existing SyntaxError's path being changed (diff), not sure if I needed to handle that.