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

* 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
This commit is contained in:
ko1 2007-11-27 01:02:30 +00:00
parent 724de18989
commit 329484693a
5 changed files with 63 additions and 39 deletions

View file

@ -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

View file

@ -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

View file

@ -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 =

View file

@ -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();
}

View file

@ -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[];