File tree 2 files changed +23
-4
lines changed
spec/tags/ruby/core/kernel
2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -725,9 +725,29 @@ def private_singleton_methods
725
725
end
726
726
private :private_singleton_methods
727
727
728
- def proc ( &prc )
729
- raise ArgumentError , "block required" unless prc
730
- return prc
728
+ def proc
729
+ env = nil
730
+
731
+ Rubinius . asm do
732
+ push_block
733
+ # assign a pushed block to the above local variable "env"
734
+ set_local 0
735
+ end
736
+
737
+ unless env
738
+ # Support for ancient pre-block-pass style:
739
+ # def something
740
+ # proc
741
+ # end
742
+ # something { a_block } => Proc instance
743
+ env = Rubinius ::BlockEnvironment . of_sender
744
+
745
+ unless env
746
+ raise ArgumentError , "tried to create a Proc object without a block"
747
+ end
748
+ end
749
+
750
+ Proc . new ( &env )
731
751
end
732
752
module_function :proc
733
753
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments