Created
February 18, 2012 19:47
-
-
Save ileitch/1860780 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/kernel/bootstrap/block_environment.rb b/kernel/bootstrap/block_environment.rb | |
index ccc91b4..80cb6df 100644 | |
--- a/kernel/bootstrap/block_environment.rb | |
+++ b/kernel/bootstrap/block_environment.rb | |
@@ -23,6 +23,8 @@ module Rubinius | |
end | |
class AsMethod < Executable | |
+ attr_reader :block_env | |
+ | |
def self.new(block_env) | |
Rubinius.primitive :block_as_method_create | |
raise PrimitiveFailure, "BlockEnvironment::AsMethod.new failed" | |
@@ -59,6 +61,31 @@ module Rubinius | |
def defined_line | |
@block_env.line | |
end | |
+ | |
+ def ==(other) | |
+ cm = @block_env.instance_variable_get("@code") | |
+ other_cm = other.block_env.instance_variable_get("@code") | |
+ scope = @block_env.instance_variable_get("@scope") | |
+ other_scope = other.block_env.instance_variable_get("@scope") | |
+ top_scope = @block_env.instance_variable_get("@top_scope") | |
+ other_top_scope = other.block_env.instance_variable_get("@top_scope") | |
+ this_module = @block_env.instance_variable_get("@module") | |
+ other_module = other.block_env.instance_variable_get("@module") | |
+ | |
+ scope == other_scope && | |
+ top_scope == other_top_scope && | |
+ this_module == other_module && | |
+ cm.iseq == other_cm.iseq && | |
+ cm.stack_size == other_cm.stack_size && | |
+ cm.local_count == other_cm.local_count && | |
+ cm.required_args == other_cm.required_args && | |
+ cm.total_args == other_cm.total_args && | |
+ cm.splat == other_cm.splat && | |
+ cm.literals == other_cm.literals && | |
+ cm.lines == other_cm.lines && | |
+ cm.file == other_cm.file && | |
+ cm.local_names == other_cm.local_names | |
+ end | |
end | |
end | |
end | |
diff --git a/spec/tags/19/ruby/core/method/eql_tags.txt b/spec/tags/19/ruby/core/method/eql_tags.txt | |
index 37953dc..8f28f6b 100644 | |
--- a/spec/tags/19/ruby/core/method/eql_tags.txt | |
+++ b/spec/tags/19/ruby/core/method/eql_tags.txt | |
@@ -1,3 +1,2 @@ | |
fails:Method#eql? returns true if a method was defined using the other one | |
-fails:Method#eql? returns true for methods defined using the same block/proc | |
fails:Method#eql? returns true for the same method missing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment