[#65451] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...

Issue #10333 has been updated by Koichi Sasada.

9 messages 2014/10/07

[ruby-core:65920] [ruby-trunk - Bug #10432] [Closed] wrong receiver of Binding from Method

From: nobu@...
Date: 2014-10-27 08:17:34 UTC
List: ruby-core #65920
Issue #10432 has been updated by Nobuyoshi Nakada.

Status changed from Assigned to Closed
% Done changed from 0 to 100

Applied in changeset r48160.

----------
proc.c: fix method proc binding receiver

* proc.c (method_proc): the receiver of binding from method should
  be same as the receiver of the method.
  [ruby-core:65917] [Bug #10432]

----------------------------------------
Bug #10432: wrong receiver of Binding from Method
https://bugs.ruby-lang.org/issues/10432#change-49659

* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: core
* Target version: current: 2.2.0
* ruby -v: trunk
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
Methodオブジェクトから`to_proc.binding`で作られたBindingのreceiverが、Methodオブジェクトの元になったオブジェクトではなく、Methodオブジェクトになっています。

~~~ruby
class C
  def foo;end
end
o = C.new
m = o.method(:foo)
p m.receiver                    # #<C:0x007fcada074e58>
p m.to_proc.binding.receiver    # #<Method: C#foo>
~~~

2.0, 2.1では`Binding#receiver`はありませんが、`eval("self")`で同様の結果になります。




-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next