diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-06-16 14:21:34 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-06-16 14:21:34 +0000 |
commit | 36eb4607805367a999f0546d9bb2f2950e5bb860 (patch) | |
tree | 320fa0a5d0d2ff51cd4ef583ab2bbdeada98d96c | |
parent | f5b3969eda777ef41b8b0f5b397acee8e52d420c (diff) |
* eval.c (rb_mod_freeze): prepare string representation before
freezing. [ruby-talk:103646]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | numeric.c | 1 | ||||
-rw-r--r-- | object.c | 16 |
4 files changed, 22 insertions, 2 deletions
@@ -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 16:04:40 2004 Nobuyoshi Nakada <nobu@ruby-lang.org> * object.c (rb_mod_le): singleton class inherits Class rather than its @@ -8031,8 +8031,6 @@ static int block_orphan(data) struct BLOCK *data; { - struct tag *tt; - if (data->scope->flags & SCOPE_NOSTACK) { return 1; } @@ -12,6 +12,7 @@ #include "ruby.h" #include "env.h" +#include <ctype.h> #include <math.h> #include <stdio.h> @@ -1241,6 +1241,21 @@ rb_mod_to_s(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 * * Case Equality---Returns <code>true</code> if <i>anObject</i> is an @@ -2570,6 +2585,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); |