1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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:
matz 2004-06-16 14:21:34 +00:00
parent 1135c41a5b
commit 9d1f9bd56b
5 changed files with 27 additions and 11 deletions

View file

@ -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>
* test/ruby/test_array.rb: extend testcase to check #first, #last,

14
class.c
View file

@ -652,8 +652,8 @@ class_instance_method_list(argc, argv, mod, func)
* end
*
* A.instance_methods #=> ["method1"]
* B.instance_methods #=> ["method2"]
* C.instance_methods #=> ["method3"]
* B.instance_methods(false) #=> ["method2"]
* C.instance_methods(false) #=> ["method3"]
* C.instance_methods(true).length #=> 43
*/
@ -756,8 +756,8 @@ rb_class_public_instance_methods(argc, argv, mod)
* end
*
* Single.singleton_methods #=> ["four"]
* a.singleton_methods #=> ["two", "one"]
* a.singleton_methods(true) #=> ["two", "one", "three"]
* a.singleton_methods(false) #=> ["two", "one"]
* a.singleton_methods #=> ["two", "one", "three"]
*/
VALUE
@ -809,11 +809,7 @@ rb_define_method(klass, name, func, argc)
VALUE (*func)();
int argc;
{
ID id = rb_intern(name);
int ex = NOEX_PUBLIC;
rb_add_method(klass, id, NEW_CFUNC(func, argc), ex);
rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc), NOEX_PUBLIC);
}
void

2
eval.c
View file

@ -8011,8 +8011,6 @@ static int
block_orphan(data)
struct BLOCK *data;
{
struct tag *tt;
if (data->scope->flags & SCOPE_NOSTACK) {
return 1;
}

View file

@ -12,6 +12,7 @@
#include "ruby.h"
#include "env.h"
#include <ctype.h>
#include <math.h>
#include <stdio.h>

View file

@ -1213,6 +1213,21 @@ rb_mod_to_s(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:
* 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, "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_obj_equal, 1);
rb_define_method(rb_cModule, "<=>", rb_mod_cmp, 1);