public
Created

A quick hack making class definitions to return classes

  • Download Gist
class_def_return_class.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
diff --git a/compile.c b/compile.c
index 2285d28..ace1296 100644
--- a/compile.c
+++ b/compile.c
@@ -547,6 +547,10 @@ rb_iseq_compile_node(VALUE self, NODE *node)
ADD_INSN1(ret, 0, throw, INT2FIX(0) /* continue throw */ );
}
else {
+ if (iseq->type == ISEQ_TYPE_CLASS) {
+ ADD_INSN(ret, iseq->compile_data->last_line, pop);
+ ADD_INSN(ret, iseq->compile_data->last_line, putself);
+ }
ADD_INSN(ret, iseq->compile_data->last_line, leave);
}
make-test-all.log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
CC = gcc
LD = ld
LDSHARED = gcc -shared
CFLAGS = -O0 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration -ansi -std=iso9899:199409
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
CPPFLAGS = -I. -I.ext/include/i686-linux -I./include -I.
DLDFLAGS = -fstack-protector -pie
SOLIBS = -lgmp
組み込み spec を使用しています。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
ターゲット: i686-linux-gnu
configure 設定: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
スレッドモデル: posix
gcc バージョン 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
 
# Running tests:
 
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................E........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................SSS..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F.....................................................................................................................................................................................................................................S...................................................................................................................................................................................................................................................................................................E.............................E.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Terminated
S.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
 
Finished tests in 905.629859s, 15.9270 tests/s, 2499.9176 assertions/s.
 
1) Failure:
TestMethod#test_callee [/home/shugo/src/ruby/test/ruby/test_method.rb:97]:
Expected TestMethod::TestCallee to be nil.
 
2) Error:
TestObject#test_inspect:
TypeError: no implicit conversion of Class into String
/home/shugo/src/ruby/test/ruby/test_object.rb:727:in `test_inspect'
/home/shugo/src/ruby/lib/test/unit/testcase.rb:17:in `run'
/home/shugo/src/ruby/lib/test/unit.rb:663:in `block in _run_suites'
/home/shugo/src/ruby/lib/test/unit.rb:661:in `each'
/home/shugo/src/ruby/lib/test/unit.rb:661:in `_run_suites'
/home/shugo/src/ruby/lib/test/unit.rb:27:in `run'
/home/shugo/src/ruby/lib/test/unit.rb:780:in `run'
/home/shugo/src/ruby/lib/test/unit.rb:840:in `run'
/home/shugo/src/ruby/lib/test/unit.rb:844:in `run'
./test/runner.rb:30:in `<main>'
 
3) Error:
TestEval#test_eval_orig:
TypeError: wrong argument type Module (expected binding)
/home/shugo/src/ruby/test/ruby/test_eval.rb:295:in `eval'
/home/shugo/src/ruby/test/ruby/test_eval.rb:295:in `test_eval_orig'
 
4) Error:
TestObject#test_to_s:
TypeError: no implicit conversion of Class into String
/home/shugo/src/ruby/test/ruby/test_object.rb:695:in `test_to_s'
/home/shugo/src/ruby/lib/test/unit/testcase.rb:17:in `run'
/home/shugo/src/ruby/lib/test/unit.rb:663:in `block in _run_suites'
/home/shugo/src/ruby/lib/test/unit.rb:661:in `each'
/home/shugo/src/ruby/lib/test/unit.rb:661:in `_run_suites'
/home/shugo/src/ruby/lib/test/unit.rb:27:in `run'
/home/shugo/src/ruby/lib/test/unit.rb:780:in `run'
/home/shugo/src/ruby/lib/test/unit.rb:840:in `run'
/home/shugo/src/ruby/lib/test/unit.rb:844:in `run'
./test/runner.rb:30:in `<main>'
 
14424 tests, 2264000 assertions, 1 failures, 3 errors, 34 skips
 
ruby -v: ruby 2.1.0dev (2013-09-28 trunk 43076) [i686-linux]
make: *** [yes-test-all] エラー 4
make-test.log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
CC = gcc
LD = ld
LDSHARED = gcc -shared
CFLAGS = -O0 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration -ansi -std=iso9899:199409
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
CPPFLAGS = -I. -I.ext/include/i686-linux -I./include -I.
DLDFLAGS = -fstack-protector -pie
SOLIBS = -lgmp
組み込み spec を使用しています。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
ターゲット: i686-linux-gnu
configure 設定: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
スレッドモデル: posix
gcc バージョン 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
sample/test.rb:assignment ....................................................................................................................................................................................................................................................................................................................................................................................OK 372
sample/test.rb:condition ..OK 2
sample/test.rb:if/unless ...OK 3
sample/test.rb:case .....OK 5
sample/test.rb:while/until ........OK 8
sample/test.rb:exception ..........OK 10
sample/test.rb:array .......................................OK 39
sample/test.rb:hash ...........................OK 27
sample/test.rb:iterator ...............................................................................................................OK 111
sample/test.rb:float ................................................................................OK 80
sample/test.rb:bignum ...............................OK 31
sample/test.rb:string & char ..............................................................OK 62
sample/test.rb:assignment ..........OK 10
sample/test.rb:call ......OK 6
sample/test.rb:proc .........OK 9
sample/test.rb:signal ..OK 2
sample/test.rb:eval .............................OK 29
sample/test.rb:system ........OK 8
sample/test.rb:const .....OK 5
sample/test.rb:clone .....OK 5
sample/test.rb:marshal ....OK 4
sample/test.rb:pack ....OK 4
sample/test.rb:math ..OK 2
sample/test.rb:struct ......OK 6
sample/test.rb:variable ...........OK 11
sample/test.rb:trace ...OK 3
sample/test.rb:defined? ............OK 12
sample/test.rb:alias ......OK 6
sample/test.rb:path .......................OK 23
sample/test.rb:gc ....OK 4
 
test succeeded
test_attr.rb ..
test_autoload.rb .......F
test_block.rb ....................................................F....
test_class.rb .............................................
test_eval.rb .....................................
test_exception.rb ..................................
test_finalizer.rb .
test_flip.rb .
test_flow.rb .............................................................
test_fork.rb .....
test_gc.rb ..
test_io.rb .........
test_jump.rb ............................F
test_literal.rb ...........................................................................................................................................................
test_literal_suffix.rb ................................................
test_load.rb ..
test_marshal.rb .
test_massign.rb ..................................
test_method.rb .................................................................................................................................................................................................................................
test_objectspace.rb .....
test_proc.rb .......................................
test_struct.rb .
test_syntax.rb ..........................................................................................................................................................
test_thread.rb ..................................................
#10 test_autoload.rb:62:in `<top (required)>':
open("zzz.rb", "w") {}
class A
autoload :C, "./zzz"
class C
end
C
end
#=> "A" (expected "A::C")
#63 test_block.rb:507:in `<top (required)>':
STDERR.reopen(STDOUT)
class C
define_method(:foo) do |&block|
block.call if block
end
result = "ng"
new.foo() {result = "ok"}
result
end
#=> "C" (expected "ok")
#291 test_jump.rb:298:in `<top (required)>':
class Object
def yield_eigenclass
class << self
yield self
end
end
end
s = "foo"
s.yield_eigenclass {|c| c == class << s; self; end }
#=> "#<Class:#<String:0x40941390>>" (expected "true") [ruby-dev:40975]
FAIL 3/1005 tests failed
make: *** [yes-btest-ruby] エラー 1

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.