diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-12-26 13:33:14 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-12-26 13:33:14 +0000 |
commit | 5e7a785b405eb533f1a52f1bbf057bbbe89fa6ee (patch) | |
tree | e7a4ebf6d948a323be51af989ef19b3707dbc424 | |
parent | b72e4fe85236cf76a63f8664d32b87fe1a53b952 (diff) | |
download | ruby-5e7a785b405eb533f1a52f1bbf057bbbe89fa6ee.tar.gz ruby-5e7a785b405eb533f1a52f1bbf057bbbe89fa6ee.tar.xz ruby-5e7a785b405eb533f1a52f1bbf057bbbe89fa6ee.zip |
* eval.c (rb_eval), gc.c (gc_mark_children), node.h (NEW_ALIAS,
NEW_VALIAS), parse.y (fitem): allow dynamic symbols to
NODE_UNDEF and NODE_ALIAS.
backported from trunk. fixed: [ruby-dev:28105]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | eval.c | 7 | ||||
-rw-r--r-- | gc.c | 6 | ||||
-rw-r--r-- | node.h | 7 | ||||
-rw-r--r-- | parse.y | 13 |
5 files changed, 27 insertions, 15 deletions
@@ -1,3 +1,10 @@ +Mon Dec 26 22:32:47 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * eval.c (rb_eval), gc.c (gc_mark_children), node.h (NEW_ALIAS, + NEW_VALIAS), parse.y (fitem): allow dynamic symbols to + NODE_UNDEF and NODE_ALIAS. + backported from trunk. fixed: [ruby-dev:28105] + Mon Dec 26 08:50:36 2005 Yukihiro Matsumoto <matz@ruby-lang.org> * eval.c (ev_const_get): fixed a bug in constant reference during @@ -25,7 +32,7 @@ Wed Dec 21 16:53:06 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp> Wed Dec 21 14:53:26 2005 Tanaka Akira <akr@m17n.org> - * lib/pathname.rb (test_kernel_open): use File.identical?. + * lib/pathname.rb (test_kernel_open): use File.identical?. [ruby-talk:171804] Tue Dec 20 22:41:17 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> @@ -3889,7 +3889,7 @@ rb_eval(self, n) if (NIL_P(ruby_class)) { rb_raise(rb_eTypeError, "no class to undef method"); } - rb_undef(ruby_class, node->nd_mid); + rb_undef(ruby_class, rb_to_id(rb_eval(self, node->u2.node))); result = Qnil; break; @@ -3897,12 +3897,13 @@ rb_eval(self, n) if (NIL_P(ruby_class)) { rb_raise(rb_eTypeError, "no class to make alias"); } - rb_alias(ruby_class, node->nd_new, node->nd_old); + rb_alias(ruby_class, rb_to_id(rb_eval(self, node->u1.node)), + rb_to_id(rb_eval(self, node->u2.node))); result = Qnil; break; case NODE_VALIAS: - rb_alias_variable(node->nd_new, node->nd_old); + rb_alias_variable(node->u1.id, node->u2.id); result = Qnil; break; @@ -814,6 +814,8 @@ gc_mark_children(ptr, lev) case NODE_OP_ASGN_OR: case NODE_OP_ASGN_AND: case NODE_MODULE: + case NODE_ALIAS: + case NODE_VALIAS: gc_mark((VALUE)obj->as.node.u1.node, lev); /* fall through */ case NODE_METHOD: /* 2 */ @@ -828,6 +830,7 @@ gc_mark_children(ptr, lev) case NODE_COLON3: case NODE_OPT_N: case NODE_EVSTR: + case NODE_UNDEF: ptr = (VALUE)obj->as.node.u2.node; goto again; @@ -867,11 +870,8 @@ gc_mark_children(ptr, lev) case NODE_CVAR: case NODE_NTH_REF: case NODE_BACK_REF: - case NODE_ALIAS: - case NODE_VALIAS: case NODE_REDO: case NODE_RETRY: - case NODE_UNDEF: case NODE_SELF: case NODE_NIL: case NODE_TRUE: @@ -209,9 +209,6 @@ typedef struct RNode { #define nd_noex u1.id #define nd_defn u3.node -#define nd_old u1.id -#define nd_new u2.id - #define nd_cfnc u1.cfunc #define nd_argc u2.argc @@ -311,8 +308,8 @@ typedef struct RNode { #define NEW_SVALUE(a) NEW_NODE(NODE_SVALUE,a,0,0) #define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v)) #define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0) -#define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,o,n,0) -#define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,o,n,0) +#define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,n,o,0) +#define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,n,o,0) #define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0) #define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(b),(s)) #define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(b),0) @@ -277,9 +277,9 @@ static void top_local_setup(); %type <node> mrhs superclass block_call block_command %type <node> f_arglist f_args f_optarg f_opt f_block_arg opt_f_block_arg %type <node> assoc_list assocs assoc undef_list backref string_dvar -%type <node> block_var opt_block_var brace_block cmd_brace_block do_block lhs none +%type <node> block_var opt_block_var brace_block cmd_brace_block do_block lhs none fitem %type <node> mlhs mlhs_head mlhs_basic mlhs_entry mlhs_item mlhs_node -%type <id> fitem variable sym symbol operation operation2 operation3 +%type <id> fsym variable sym symbol operation operation2 operation3 %type <id> cname fname op f_rest_arg %type <num> f_norm_arg f_arg %token tUPLUS /* unary+ */ @@ -916,10 +916,17 @@ fname : tIDENTIFIER } ; -fitem : fname +fsym : fname | symbol ; +fitem : fsym + { + $$ = NEW_LIT(ID2SYM($1)); + } + | dsym + ; + undef_list : fitem { $$ = NEW_UNDEF($1); |