Created
September 28, 2013 06:26
-
-
Save shugo/6739085 to your computer and use it in GitHub Desktop.
A quick hack making class definitions to return classes
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/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); | |
} | |
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
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 |
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment