aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-27 01:02:30 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-27 01:02:30 +0000
commit329484693ae6d9dab6e01675faf7b535c2783a83 (patch)
treee831796a4899b7d86c4ac76e07118f3c9f4d4035
parent724de18989353b277b175e56ef69b78ec339510a (diff)
downloadruby-329484693ae6d9dab6e01675faf7b535c2783a83.tar.gz
* insns.def, compile.c: fix to allow dsym for alias/undef.
[ruby-dev:32355] * bootstraptest/test_method.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--bootstraptest/test_method.rb22
-rw-r--r--compile.c55
-rw-r--r--insns.def12
-rw-r--r--version.h6
5 files changed, 63 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 272d38baae..fe5de409c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Nov 27 09:57:42 2007 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def, compile.c: fix to allow dsym for alias/undef.
+ [ruby-dev:32355]
+
+ * bootstraptest/test_method.rb: add tests for above.
+
Mon Nov 26 23:18:46 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/drb/extserv.rb (initialize, stop_service): synchronize with
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
index 76901f6f6e..7c2d6652a1 100644
--- a/bootstraptest/test_method.rb
+++ b/bootstraptest/test_method.rb
@@ -230,6 +230,28 @@ assert_equal '1', %q( class A; def a() end end # [yarv-dev:999]
end
begin B.new.b; rescue NoMethodError; 1 end )
+assert_equal '3', %q{
+ def m1
+ 1
+ end
+ alias m2 m1
+ alias :"#{'m3'}" m1
+ m1 + m2 + m3
+}, '[ruby-dev:32308]'
+assert_equal '1', %q{
+ def foobar
+ end
+ undef :"foo#{:bar}"
+ 1
+}, '[ruby-dev:32308]'
+assert_equal '1', %q{
+ def foobar
+ 1
+ end
+ alias :"bar#{:baz}" :"foo#{:bar}"
+ barbaz
+}, '[ruby-dev:32308]'
+
# private
assert_equal '1', %q( class C
def m() mm() end
diff --git a/compile.c b/compile.c
index ce462fef0d..9a096ccf61 100644
--- a/compile.c
+++ b/compile.c
@@ -4063,42 +4063,37 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_ALIAS:{
- VALUE s1, s2;
- enum node_type t;
+ VALUE s1, s2;
+ enum node_type t;
- if (((t = nd_type(node->u1.node)) != NODE_LIT && t != NODE_DSYM) ||
- ((t = nd_type(node->u2.node)) != NODE_LIT && t != NODE_DSYM)) {
- rb_compile_bug(ERROR_ARGS "alias args must be NODE_LIT or NODE_DSYM");
- }
- s1 = node->u1.node->nd_lit;
- s2 = node->u2.node->nd_lit;
+ COMPILE(ret, "alias arg1", node->u1.node);
+ COMPILE(ret, "alias arg2", node->u2.node);
- ADD_INSN3(ret, nd_line(node), alias, Qfalse, ID2SYM(rb_to_id(s1)),
- ID2SYM(rb_to_id(s2)));
- if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
- }
- break;
+ ADD_INSN1(ret, nd_line(node), alias, Qfalse);
+
+ if (!poped) {
+ ADD_INSN(ret, nd_line(node), putnil);
+ }
+ break;
}
case NODE_VALIAS:{
- ADD_INSN3(ret, nd_line(node), alias, Qtrue, ID2SYM(node->u1.id),
- ID2SYM(node->u2.id));
- if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
- }
- break;
+ ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->u1.id));
+ ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->u2.id));
+ ADD_INSN1(ret, nd_line(node), alias, Qtrue);
+
+ if (!poped) {
+ ADD_INSN(ret, nd_line(node), putnil);
+ }
+ break;
}
case NODE_UNDEF:{
- enum node_type t = nd_type(node->u2.node);
- if (t != NODE_LIT && t != NODE_DSYM) {
- rb_compile_bug(ERROR_ARGS "undef args must be NODE_LIT");
- }
- ADD_INSN1(ret, nd_line(node), undef,
- ID2SYM(rb_to_id(node->u2.node->nd_lit)));
- if (!poped) {
- ADD_INSN(ret, nd_line(node), putnil);
- }
- break;
+ COMPILE(ret, "undef arg", node->u2.node);
+ ADD_INSN(ret, nd_line(node), undef);
+
+ if (!poped) {
+ ADD_INSN(ret, nd_line(node), putnil);
+ }
+ break;
}
case NODE_CLASS:{
VALUE iseqval =
diff --git a/insns.def b/insns.def
index f5751ee721..7ffd56c369 100644
--- a/insns.def
+++ b/insns.def
@@ -751,18 +751,18 @@ definemethod
*/
DEFINE_INSN
alias
-(VALUE v_p, ID id1, ID id2)
-()
+(VALUE v_p)
+(VALUE sym1, VALUE sym2)
()
{
VALUE klass;
if (v_p == Qtrue) {
- rb_alias_variable(id1, id2);
+ rb_alias_variable(ID2SYM(sym1), SYM2ID(sym2));
}
else {
klass = get_cref(GET_ISEQ(), GET_LFP())->nd_clss;
- rb_alias(klass, id1, id2);
+ rb_alias(klass, SYM2ID(sym1), SYM2ID(sym2));
}
}
@@ -773,12 +773,12 @@ alias
*/
DEFINE_INSN
undef
-(ID id)
()
+(VALUE sym)
()
{
VALUE klass = get_cref(GET_ISEQ(), GET_LFP())->nd_clss;
- rb_undef(klass, id);
+ rb_undef(klass, SYM2ID(sym));
INC_VM_STATE_VERSION();
}
diff --git a/version.h b/version.h
index 04caf01e81..57cc32e582 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2007-11-26"
+#define RUBY_RELEASE_DATE "2007-11-27"
#define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20071126
+#define RUBY_RELEASE_CODE 20071127
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 11
-#define RUBY_RELEASE_DAY 26
+#define RUBY_RELEASE_DAY 27
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];