mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (rb_yield_0): 0 (= Qfalse) is a valid value, so that
default self should be checked by klass == 0. * bignum.c (rb_cstr2inum): should disallow '++1', '+-1', etc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2ed799f834
commit
72267e8dbf
4 changed files with 28 additions and 29 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
Wed Mar 14 10:41:34 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_yield_0): 0 (= Qfalse) is a valid value, so that
|
||||||
|
default self should be checked by klass == 0.
|
||||||
|
|
||||||
|
* bignum.c (rb_cstr2inum): should disallow '++1', '+-1', etc.
|
||||||
|
|
||||||
|
Tue Mar 13 17:51:09 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (ev_const_defined): add new parameter self for special
|
||||||
|
const fallback.
|
||||||
|
|
||||||
|
* eval.c (ev_const_get): ditto.
|
||||||
|
|
||||||
Tue Mar 13 16:39:45 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
Tue Mar 13 16:39:45 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* dir.c (rb_glob_helper): fix drive letter handling on DOSISH.
|
* dir.c (rb_glob_helper): fix drive letter handling on DOSISH.
|
||||||
|
|
4
bignum.c
4
bignum.c
|
@ -209,6 +209,10 @@ rb_cstr2inum(str, base)
|
||||||
str++;
|
str++;
|
||||||
sign = 0;
|
sign = 0;
|
||||||
}
|
}
|
||||||
|
if (str[0] == '+' || str[0] == '-') {
|
||||||
|
if (badcheck) goto bad;
|
||||||
|
return INT2FIX(0);
|
||||||
|
}
|
||||||
if (base == 0) {
|
if (base == 0) {
|
||||||
if (str[0] == '0') {
|
if (str[0] == '0') {
|
||||||
if (str[1] == 'x' || str[1] == 'X') {
|
if (str[1] == 'x' || str[1] == 'X') {
|
||||||
|
|
37
eval.c
37
eval.c
|
@ -1421,16 +1421,17 @@ superclass(self, node)
|
||||||
#define ruby_cbase (RNODE(ruby_frame->cbase)->nd_clss)
|
#define ruby_cbase (RNODE(ruby_frame->cbase)->nd_clss)
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
ev_const_defined(cref, id)
|
ev_const_defined(cref, id, self)
|
||||||
NODE *cref;
|
NODE *cref;
|
||||||
ID id;
|
ID id;
|
||||||
|
VALUE self;
|
||||||
{
|
{
|
||||||
NODE *cbase = cref;
|
NODE *cbase = cref;
|
||||||
|
|
||||||
while (cbase && cbase->nd_clss != rb_cObject) {
|
while (cbase && cbase->nd_clss != rb_cObject) {
|
||||||
struct RClass *klass = RCLASS(cbase->nd_clss);
|
struct RClass *klass = RCLASS(cbase->nd_clss);
|
||||||
|
|
||||||
if (NIL_P(klass)) return rb_const_defined(rb_cObject, id);
|
if (NIL_P(klass)) return rb_const_defined(CLASS_OF(self), id);
|
||||||
if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, 0)) {
|
if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, 0)) {
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
}
|
}
|
||||||
|
@ -1440,9 +1441,10 @@ ev_const_defined(cref, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
ev_const_get(cref, id)
|
ev_const_get(cref, id, self)
|
||||||
NODE *cref;
|
NODE *cref;
|
||||||
ID id;
|
ID id;
|
||||||
|
VALUE self;
|
||||||
{
|
{
|
||||||
NODE *cbase = cref;
|
NODE *cbase = cref;
|
||||||
VALUE result;
|
VALUE result;
|
||||||
|
@ -1450,7 +1452,7 @@ ev_const_get(cref, id)
|
||||||
while (cbase && cbase->nd_clss != rb_cObject) {
|
while (cbase && cbase->nd_clss != rb_cObject) {
|
||||||
struct RClass *klass = RCLASS(cbase->nd_clss);
|
struct RClass *klass = RCLASS(cbase->nd_clss);
|
||||||
|
|
||||||
if (NIL_P(klass)) return rb_const_get(rb_cObject, id);
|
if (NIL_P(klass)) return rb_const_get(CLASS_OF(self), id);
|
||||||
if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, &result)) {
|
if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, &result)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1459,27 +1461,6 @@ ev_const_get(cref, id)
|
||||||
return rb_const_get(cref->nd_clss, id);
|
return rb_const_get(cref->nd_clss, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
|
||||||
ev_const_set(cref, id, val)
|
|
||||||
NODE *cref;
|
|
||||||
ID id;
|
|
||||||
VALUE val;
|
|
||||||
{
|
|
||||||
NODE *cbase = cref;
|
|
||||||
|
|
||||||
while (cbase && cbase->nd_clss != rb_cObject) {
|
|
||||||
struct RClass *klass = RCLASS(cbase->nd_clss);
|
|
||||||
|
|
||||||
if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, 0)) {
|
|
||||||
st_insert(klass->iv_tbl, id, val);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
cbase = cbase->nd_next;
|
|
||||||
}
|
|
||||||
rb_const_assign(cbase->nd_clss, id, val);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_mod_nesting()
|
rb_mod_nesting()
|
||||||
{
|
{
|
||||||
|
@ -1825,7 +1806,7 @@ is_defined(self, node, buf)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NODE_CONST:
|
case NODE_CONST:
|
||||||
if (ev_const_defined(RNODE(ruby_frame->cbase), node->nd_vid)) {
|
if (ev_const_defined(RNODE(ruby_frame->cbase), node->nd_vid, self)) {
|
||||||
return "constant";
|
return "constant";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2737,7 +2718,7 @@ rb_eval(self, n)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NODE_CONST:
|
case NODE_CONST:
|
||||||
result = ev_const_get(RNODE(ruby_frame->cbase), node->nd_vid);
|
result = ev_const_get(RNODE(ruby_frame->cbase), node->nd_vid, self);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NODE_CVAR: /* normal method */
|
case NODE_CVAR: /* normal method */
|
||||||
|
@ -3538,7 +3519,7 @@ rb_yield_0(val, self, klass, acheck)
|
||||||
ruby_dyna_vars = block->dyna_vars;
|
ruby_dyna_vars = block->dyna_vars;
|
||||||
}
|
}
|
||||||
ruby_class = klass?klass:block->klass;
|
ruby_class = klass?klass:block->klass;
|
||||||
if (!self) self = block->self;
|
if (!klass) self = block->self;
|
||||||
node = block->body;
|
node = block->body;
|
||||||
|
|
||||||
if (block->var) {
|
if (block->var) {
|
||||||
|
|
|
@ -185,7 +185,7 @@ class Queue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def shift(non_block=false)
|
def shift(non_block=false)
|
||||||
pop(non_block=false)
|
pop(non_block)
|
||||||
end
|
end
|
||||||
alias deq shift
|
alias deq shift
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue