* eval.c (rb_mod_freeze): prepare string representation before
freezing. [ruby-talk:103646] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1135c41a5b
commit
9d1f9bd56b
@ -1,3 +1,8 @@
|
|||||||
|
Wed Jun 16 23:05:57 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* object.c (rb_mod_freeze): prepare string representation before
|
||||||
|
freezing. [ruby-talk:103646]
|
||||||
|
|
||||||
Wed Jun 16 19:57:24 2004 Michal Rokos <michal@ruby-lang.org>
|
Wed Jun 16 19:57:24 2004 Michal Rokos <michal@ruby-lang.org>
|
||||||
|
|
||||||
* test/ruby/test_array.rb: extend testcase to check #first, #last,
|
* test/ruby/test_array.rb: extend testcase to check #first, #last,
|
||||||
|
14
class.c
14
class.c
@ -652,8 +652,8 @@ class_instance_method_list(argc, argv, mod, func)
|
|||||||
* end
|
* end
|
||||||
*
|
*
|
||||||
* A.instance_methods #=> ["method1"]
|
* A.instance_methods #=> ["method1"]
|
||||||
* B.instance_methods #=> ["method2"]
|
* B.instance_methods(false) #=> ["method2"]
|
||||||
* C.instance_methods #=> ["method3"]
|
* C.instance_methods(false) #=> ["method3"]
|
||||||
* C.instance_methods(true).length #=> 43
|
* C.instance_methods(true).length #=> 43
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -756,8 +756,8 @@ rb_class_public_instance_methods(argc, argv, mod)
|
|||||||
* end
|
* end
|
||||||
*
|
*
|
||||||
* Single.singleton_methods #=> ["four"]
|
* Single.singleton_methods #=> ["four"]
|
||||||
* a.singleton_methods #=> ["two", "one"]
|
* a.singleton_methods(false) #=> ["two", "one"]
|
||||||
* a.singleton_methods(true) #=> ["two", "one", "three"]
|
* a.singleton_methods #=> ["two", "one", "three"]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
@ -809,11 +809,7 @@ rb_define_method(klass, name, func, argc)
|
|||||||
VALUE (*func)();
|
VALUE (*func)();
|
||||||
int argc;
|
int argc;
|
||||||
{
|
{
|
||||||
ID id = rb_intern(name);
|
rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc), NOEX_PUBLIC);
|
||||||
int ex = NOEX_PUBLIC;
|
|
||||||
|
|
||||||
|
|
||||||
rb_add_method(klass, id, NEW_CFUNC(func, argc), ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
2
eval.c
2
eval.c
@ -8011,8 +8011,6 @@ static int
|
|||||||
block_orphan(data)
|
block_orphan(data)
|
||||||
struct BLOCK *data;
|
struct BLOCK *data;
|
||||||
{
|
{
|
||||||
struct tag *tt;
|
|
||||||
|
|
||||||
if (data->scope->flags & SCOPE_NOSTACK) {
|
if (data->scope->flags & SCOPE_NOSTACK) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "ruby.h"
|
#include "ruby.h"
|
||||||
#include "env.h"
|
#include "env.h"
|
||||||
|
#include <ctype.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
16
object.c
16
object.c
@ -1213,6 +1213,21 @@ rb_mod_to_s(klass)
|
|||||||
return rb_str_dup(rb_class_name(klass));
|
return rb_str_dup(rb_class_name(klass));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* call-seq:
|
||||||
|
* mod.freeze
|
||||||
|
*
|
||||||
|
* Prevents further modifications to <i>mod</i>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
rb_mod_freeze(mod)
|
||||||
|
VALUE mod;
|
||||||
|
{
|
||||||
|
rb_mod_to_s(mod);
|
||||||
|
return rb_obj_freeze(mod);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* mod === obj => true or false
|
* mod === obj => true or false
|
||||||
@ -2597,6 +2612,7 @@ Init_Object()
|
|||||||
rb_define_method(rb_cSymbol, "id2name", sym_to_s, 0);
|
rb_define_method(rb_cSymbol, "id2name", sym_to_s, 0);
|
||||||
rb_define_method(rb_cSymbol, "to_sym", sym_to_sym, 0);
|
rb_define_method(rb_cSymbol, "to_sym", sym_to_sym, 0);
|
||||||
|
|
||||||
|
rb_define_method(rb_cModule, "freeze", rb_mod_freeze, 0);
|
||||||
rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);
|
rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);
|
||||||
rb_define_method(rb_cModule, "==", rb_obj_equal, 1);
|
rb_define_method(rb_cModule, "==", rb_obj_equal, 1);
|
||||||
rb_define_method(rb_cModule, "<=>", rb_mod_cmp, 1);
|
rb_define_method(rb_cModule, "<=>", rb_mod_cmp, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user