зеркало из https://github.com/github/ruby.git
* compile.c (defined_expr): defined(method(x)) dumped core. a
patch from Yusuke ENDOH <mame AT tsg.ne.jp>. [ruby-dev:32335] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
cca64ecb9a
Коммит
050a10c607
|
@ -1,3 +1,8 @@
|
|||
Fri Nov 23 10:44:24 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* compile.c (defined_expr): defined(method(x)) dumped core. a
|
||||
patch from Yusuke ENDOH <mame AT tsg.ne.jp>. [ruby-dev:32335]
|
||||
|
||||
Wed Nov 21 18:03:49 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* vm.c: fix to recycle thread data (VM stack).
|
||||
|
|
|
@ -2295,13 +2295,11 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
|
|||
if (node->nd_args) {
|
||||
lfalse = NEW_LABEL(nd_line(node));
|
||||
defined_expr(iseq, ret, node->nd_args, lfinish, Qfalse);
|
||||
ADD_INSNL(ret, nd_line(node), branchunless, lfalse);
|
||||
}
|
||||
if (!self) {
|
||||
LABEL *lcont = NEW_LABEL(nd_line(node));
|
||||
|
||||
if (lfalse) {
|
||||
ADD_INSNL(ret, nd_line(node), branchunless, lfalse);
|
||||
}
|
||||
defined_expr(iseq, ret, node->nd_recv, lfinish, Qfalse);
|
||||
ADD_INSNL(ret, nd_line(node), branchif, lcont);
|
||||
if (lfalse) {
|
||||
|
@ -2319,9 +2317,8 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
|
|||
ADD_INSN(ret, nd_line(node), putself);
|
||||
ADD_INSN3(ret, nd_line(node), defined, INT2FIX(DEFINED_FUNC),
|
||||
ID2SYM(node->nd_mid), needstr);
|
||||
ADD_INSNL(ret, nd_line(node), jump, lfinish);
|
||||
if (lfalse) {
|
||||
ADD_INSNL(ret, nd_line(node), branchif, lfinish);
|
||||
|
||||
ADD_LABEL(ret, lfalse);
|
||||
ADD_INSN(ret, nd_line(node), putnil);
|
||||
ADD_INSNL(ret, nd_line(node), jump, lfinish);
|
||||
|
|
|
@ -10,6 +10,8 @@ class TestDefined < Test::Unit::TestCase
|
|||
yield(defined?(self.foo))
|
||||
yield(defined?(f.foo))
|
||||
end
|
||||
def baz(f)
|
||||
end
|
||||
end
|
||||
|
||||
def defined_test
|
||||
|
@ -34,10 +36,17 @@ class TestDefined < Test::Unit::TestCase
|
|||
assert(defined?(1 == 2)) # operator expression
|
||||
|
||||
f = Foo.new
|
||||
assert_nil(defined?(f.foo))
|
||||
assert_nil(defined?(f.foo)) # protected method
|
||||
f.bar(f) { |v| assert(v) }
|
||||
assert_nil(defined?(f.quux)) # undefined method
|
||||
assert_nil(defined?(f.baz(x))) # undefined argument
|
||||
x = 0
|
||||
assert(defined?(f.baz(x)))
|
||||
assert_nil(defined?(f.quux(x)))
|
||||
assert(defined?(print(x)))
|
||||
assert_nil(defined?(quux(x)))
|
||||
|
||||
assert(defined_test) # not iterator
|
||||
assert(!defined_test{}) # called as iterator
|
||||
assert(!defined_test{}) # called as iterator
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define RUBY_VERSION "1.9.0"
|
||||
#define RUBY_RELEASE_DATE "2007-11-22"
|
||||
#define RUBY_RELEASE_DATE "2007-11-23"
|
||||
#define RUBY_VERSION_CODE 190
|
||||
#define RUBY_RELEASE_CODE 20071122
|
||||
#define RUBY_RELEASE_CODE 20071123
|
||||
#define RUBY_PATCHLEVEL 0
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
|
@ -9,7 +9,7 @@
|
|||
#define RUBY_VERSION_TEENY 0
|
||||
#define RUBY_RELEASE_YEAR 2007
|
||||
#define RUBY_RELEASE_MONTH 11
|
||||
#define RUBY_RELEASE_DAY 22
|
||||
#define RUBY_RELEASE_DAY 23
|
||||
|
||||
#ifdef RUBY_EXTERN
|
||||
RUBY_EXTERN const char ruby_version[];
|
||||
|
|
Загрузка…
Ссылка в новой задаче