diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-19 09:02:04 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-19 09:02:04 +0000 |
commit | d1a3599bf7a6eb4400d68090752ef5fb0d907639 (patch) | |
tree | cfb2c7c81c09e60b1083cb18fccc268c230f908d /parse.y | |
parent | 892bbbf0bf76ff2223c07f4c10a784195835eba5 (diff) |
* re.c (rb_reg_search): should clear last_match if pos is out of
string range.
* string.c (rb_str_index_m): ditto.
* string.c (rb_str_rindex): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -380,7 +380,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem if (in_def || in_single) { yyerror("BEGIN in method"); } - local_push(1); + local_push(0); } '{' compstmt '}' { @@ -1249,7 +1249,7 @@ primary : literal if (in_def || in_single) yyerror("class definition in method body"); class_nest++; - local_push(1); + local_push(0); $<num>$ = ruby_sourceline; } compstmt @@ -1270,7 +1270,7 @@ primary : literal $<num>$ = in_single; in_single = 0; class_nest++; - local_push(1); + local_push(0); } compstmt kEND @@ -1287,7 +1287,7 @@ primary : literal if (in_def || in_single) yyerror("module definition in method body"); class_nest++; - local_push(1); + local_push(0); $<num>$ = ruby_sourceline; } compstmt @@ -1305,7 +1305,7 @@ primary : literal $<id>$ = cur_mid; cur_mid = $2; in_def++; - local_push(1); + local_push(0); } f_arglist compstmt @@ -1333,7 +1333,7 @@ primary : literal { value_expr($2); in_single++; - local_push(1); + local_push(0); lex_state = EXPR_END; /* force for args */ } f_arglist @@ -4697,7 +4697,8 @@ static struct local_vars { } *lvtbl; static void -local_push(int dyna_init) +local_push(top) + int top; { struct local_vars *local; @@ -4709,8 +4710,11 @@ local_push(int dyna_init) local->dlev = 0; local->dyna_vars = ruby_dyna_vars; lvtbl = local; - - if (dyna_init) ruby_dyna_vars = (struct RVarmap* )0; + if (!top) { + /* preserve reference for GC, but link should be cut. */ + rb_dvar_push(0, (VALUE)ruby_dyna_vars); + ruby_dyna_vars->next = 0; + } } static void @@ -4785,7 +4789,7 @@ local_id(id) static void top_local_init() { - local_push(0); + local_push(1); lvtbl->cnt = ruby_scope->local_tbl?ruby_scope->local_tbl[0]:0; if (lvtbl->cnt > 0) { lvtbl->tbl = ALLOC_N(ID, lvtbl->cnt+3); |