We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
test.rb:
p Object.new&.object_id
$ ruby-next -V --min-version=2.2.0 nextify test.rb RubyNext core strategy: refine RubyNext transpile mode: rewrite Remove old files: ./.rbnext Generated: ./.rbnext/2.3/test.rb
$ cat ./.rbnext/2.3/test.rb p ((!Object.new.nil? || nil) && Object.new.object_id)
But the LHS, Object.new should only be evaluated once.
Object.new
Ruby version: 2.7
Ruby Next version: 0.11.1
The text was updated successfully, but these errors were encountered:
Thanks for the report!
So far, I have only the following idea:
Object.new&.object_id #=> (((__tmp__ = Object.new) || true) && (!__tmp__.nil? || nil) && __tmp__.object_id)
(and the lvar name should be unique in the context (file?))
Sorry, something went wrong.
Evaluate safe navigation lhs once
d10f41c
Fixes #68
668d142
Yes, I think an extra var is needed, just like for some cases of pattern matching.
I think it can be simplified a bit:
Object.new&.object_id #=> (__tmp__ = Object.new; __tmp__.nil? ? nil : __tmp__.object_id)
to be closer to the actual behavior, checking with nil.equal?(__tmp__) might be better.
nil.equal?(__tmp__)
382b2d6
palkan
No branches or pull requests
test.rb:
But the LHS,
Object.new
should only be evaluated once.Environment
Ruby version: 2.7
Ruby Next version: 0.11.1
The text was updated successfully, but these errors were encountered: