-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
[Truffle] Adding annotation to return an enumerator if no block is given to a method. #2720
[Truffle] Adding annotation to return an enumerator if no block is given to a method. #2720
Conversation
final RubyProc block = RubyArguments.getBlock(frame.getArguments()); | ||
|
||
if (block == null) { | ||
|
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.
Sorry to be a pain, but we don't want a blank line here...
76bf07a
to
eed837f
Compare
@chrisseaton I updated but wasn't sure if i got the adding and removing lines correct |
…tion [Truffle] Adding annotation to return an enumerator if no block is given to a method.
public Object execute(VirtualFrame frame) { | ||
final RubyProc block = RubyArguments.getBlock(frame.getArguments()); | ||
|
||
if (block == null) { |
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.
I think we want a ConditionProfile
here. We've essentially collapsed two specializations into one to consolidate a common pattern. But a given call site is apt to only use one form or the other.
@chrisseaton it would be nice if the style things could be checked with something like checkstyle Also, I have had trouble using raiseIfFrozen or the IsFrozenNode in a method after the method is to_enum'ed. Any ideas? I might try to debug this later on. |
|
||
} else { | ||
try { | ||
return method.executeRubyBasicObject(frame); |
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 should probably be execute
instead of executeRubyBasicObject
. I'm not sure how often it happens (maybe never), but this wrapper won't work if the specialization returns a primitive.
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.
Yes, sorry these notes are both correct and important but I already merged - can submit another PR?
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.
I'll submit a new PR
No description provided.