diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-09 18:21:39 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-09 18:21:39 +0000 |
commit | 80f7f8d07e2b3b48c054e5f4c5d2e16ffa9bfc67 (patch) | |
tree | 883d4d789458a6bf9008b08e34b84add1bb61476 /bootstraptest/test_jump.rb | |
parent | b664caeb785d66bb882fb014f0274eb5c7f23413 (diff) | |
download | ruby-80f7f8d07e2b3b48c054e5f4c5d2e16ffa9bfc67.tar.gz |
* compile.c (iseq_compile_each), vm_insnhelper.c (vm_invoke_block,
vm_throw): allow "return" and "yield" even in singleton class
definition. based on a patch from wanabe <s.wanabe AT gmail.com>
for "return". [ruby-core:21379] [ruby-dev:40975]
* insns.def (defineclass): ditto (straightforwardly push block ptr,
instead of dfp ptr with special flag).
* vm_core.h (RUBY_VM_CLASS_SPECIAL_P): ditto (no longer needed).
* proc.c (proc_new): ditto (remove handling for special flag).
* bootstraptest/test_jump.rb: add tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest/test_jump.rb')
-rw-r--r-- | bootstraptest/test_jump.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bootstraptest/test_jump.rb b/bootstraptest/test_jump.rb index 9484df8852..c53d83591e 100644 --- a/bootstraptest/test_jump.rb +++ b/bootstraptest/test_jump.rb @@ -282,3 +282,27 @@ assert_normal_exit %q{ break end }, '[ruby-core:28172]' + +assert_equal "true", %q{ + class Object + def return_eigenclass + class << self + return self + end + end + end + s = "foo" + s.return_eigenclass == class << s; self; end +}, '[ruby-core:21379]' + +assert_equal "true", %q{ + class Object + def yield_eigenclass + class << self + yield self + end + end + end + s = "foo" + s.yield_eigenclass {|c| c == class << s; self; end } +}, '[ruby-dev:40975]' |