-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
- 9.1.2.0
- 9.1.1.0
- 9.1.0.0
- 9.0.5.0
- 9.0.4.0
- 9.0.3.0
- 9.0.1.0
- 9.0.0.0
- 9.0.0.0.rc2
- 9.0.0.0.rc1
- 9.0.0.0.pre2
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
fails:Method#to_proc returns a Proc object with the correct arity | ||
fails:Method#to_proc returns a proc that can be used by define_method | ||
fails:Method#to_proc returns a proc that can receive a block | ||
fails:Method#to_proc returns a Proc which does not depends on the value of self |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,15 +42,20 @@ public Object dispatchWithModifiedSelf(VirtualFrame currentFrame, RubyProc block | |
// TODO: assumes this also changes the default definee. | ||
|
||
Frame frame = block.getDeclarationFrame(); | ||
FrameSlot slot = frame.getFrameDescriptor().findOrAddFrameSlot(RubyModule.VISIBILITY_FRAME_SLOT_ID, "dynamic visibility for def", FrameSlotKind.Object); | ||
Object oldVisibility = frame.getValue(slot); | ||
|
||
try { | ||
frame.setObject(slot, Visibility.PUBLIC); | ||
if (frame != null) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
chrisseaton
Author
Contributor
|
||
FrameSlot slot = frame.getFrameDescriptor().findOrAddFrameSlot(RubyModule.VISIBILITY_FRAME_SLOT_ID, "dynamic visibility for def", FrameSlotKind.Object); | ||
Object oldVisibility = frame.getValue(slot); | ||
|
||
try { | ||
frame.setObject(slot, Visibility.PUBLIC); | ||
|
||
return dispatch.dispatchWithSelfAndBlock(currentFrame, block, self, block.getBlockCapturedInScope(), argumentsObjects); | ||
} finally { | ||
frame.setObject(slot, oldVisibility); | ||
} | ||
} else { | ||
return dispatch.dispatchWithSelfAndBlock(currentFrame, block, self, block.getBlockCapturedInScope(), argumentsObjects); | ||
} finally { | ||
frame.setObject(slot, oldVisibility); | ||
} | ||
} | ||
|
||
|
6 comments
on commit 06c5d29
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.
Was the Ruby wrong or just suboptimal? It was taken from the MRI documentation.
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.
If the proc is called with a block the shim ignored it.
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.
The shim could just take a block and pass it I suppose.
The general issue is to fake the parameters to match the ones of the original methods, which is not possible in Ruby, so it might be needed to define it in Java.
How can we solve the problem of being able to call on non-self?
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.
Yeah I think the parameter handling thing may also be important - maybe you can query the arity of a block - and in this case it would tell you it was anything, and maybe it should tell you the arity of the original method.
Rubinius uses a primitive rather than Ruby, so it seemed to make sense to do the same.
Not sure what you mean by being able to call on non-self?
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.
Not sure what you mean by being able to call on non-self?
The failing spec.
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.
Rubinius uses a primitive rather than Ruby, so it seemed to make sense to do the same.
But it does explicitly check if the proc is associated with a method, which is not ideal IMHO, while our native conversion should be able to copy parameters metadata between proc and block. So this commit is good for that.
def parameters
if @ruby_method
return @ruby_method.parameters
elsif @bound_method
return @bound_method.parameters
end
How could frame be null there?