summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--class.c14
-rw-r--r--eval.c2
-rw-r--r--numeric.c1
-rw-r--r--object.c16
5 files changed, 27 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index a3139aff22..a3428beaa2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
diff --git a/class.c b/class.c
index bf0457bb75..6a21cb66d9 100644
--- a/class.c
+++ b/class.c
@@ -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
diff --git a/eval.c b/eval.c
index 76178c998b..2d8eca0ab7 100644
--- a/eval.c
+++ b/eval.c
@@ -8011,8 +8011,6 @@ static int
block_orphan(data)
struct BLOCK *data;
{
- struct tag *tt;
-
if (data->scope->flags & SCOPE_NOSTACK) {
return 1;
}
diff --git a/numeric.c b/numeric.c
index 763e4d2ba6..1c89e11806 100644
--- a/numeric.c
+++ b/numeric.c
@@ -12,6 +12,7 @@
#include "ruby.h"
#include "env.h"
+#include <ctype.h>
#include <math.h>
#include <stdio.h>
diff --git a/object.c b/object.c
index f2c8c5f522..c3554b38f0 100644
--- a/object.c
+++ b/object.c
@@ -1215,6 +1215,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
@@ -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);