Skip to content

Commit 36eb460

Browse files
author
matz
committed
* 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
1 parent f5b3969 commit 36eb460

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Wed Jun 16 23:05:57 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
2+
3+
* object.c (rb_mod_freeze): prepare string representation before
4+
freezing. [ruby-talk:103646]
5+
16
Wed Jun 16 16:04:40 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
27

38
* object.c (rb_mod_le): singleton class inherits Class rather than its

eval.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8031,8 +8031,6 @@ static int
80318031
block_orphan(data)
80328032
struct BLOCK *data;
80338033
{
8034-
struct tag *tt;
8035-
80368034
if (data->scope->flags & SCOPE_NOSTACK) {
80378035
return 1;
80388036
}

numeric.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "ruby.h"
1414
#include "env.h"
15+
#include <ctype.h>
1516
#include <math.h>
1617
#include <stdio.h>
1718

object.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,21 @@ rb_mod_to_s(klass)
12391239
return rb_str_dup(rb_class_path(klass));
12401240
}
12411241

1242+
/*
1243+
* call-seq:
1244+
* mod.freeze
1245+
*
1246+
* Prevents further modifications to <i>mod</i>.
1247+
*/
1248+
1249+
static VALUE
1250+
rb_mod_freeze(mod)
1251+
VALUE mod;
1252+
{
1253+
rb_mod_to_s(mod);
1254+
return rb_obj_freeze(mod);
1255+
}
1256+
12421257
/*
12431258
* call-seq:
12441259
* mod === obj => true or false
@@ -2570,6 +2585,7 @@ Init_Object()
25702585
rb_define_method(rb_cSymbol, "id2name", sym_to_s, 0);
25712586
rb_define_method(rb_cSymbol, "to_sym", sym_to_sym, 0);
25722587

2588+
rb_define_method(rb_cModule, "freeze", rb_mod_freeze, 0);
25732589
rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);
25742590
rb_define_method(rb_cModule, "==", rb_obj_equal, 1);
25752591
rb_define_method(rb_cModule, "<=>", rb_mod_cmp, 1);

0 commit comments

Comments
 (0)