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

* parse.y (struct local_vars): no need to warn out-of-scope

variables; remove dnames member from struct.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-02-13 23:44:26 +00:00
parent 66a26a2367
commit 3e874eae07
2 changed files with 5 additions and 25 deletions

View file

@ -6,6 +6,11 @@ Wed Feb 14 03:14:42 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/uri/generic.rb (URI::Generic::set_password): password can be
cleared by nil. [ruby-core:10290]
Wed Feb 14 03:10:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (struct local_vars): no need to warn out-of-scope
variables; remove dnames member from struct.
Wed Feb 14 03:04:10 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y: RVarmap no longer used as yytype; removed.

25
parse.y
View file

@ -117,7 +117,6 @@ struct vtable {
struct local_vars {
struct vtable *tbl;
struct vtable *dnames;
struct vtable *dvars;
struct local_vars *prev;
int nofree;
@ -7240,7 +7239,6 @@ gettable_gen(struct parser_params *parser, ID id)
if (dyna_in_block() && dvar_defined(id)) return NEW_DVAR(id);
if (local_id(id)) return NEW_LVAR(id);
/* method call without arguments */
dyna_check(id);
return NEW_VCALL(id);
}
else if (is_global_id(id)) {
@ -8031,7 +8029,6 @@ local_push_gen(struct parser_params *parser, int inherit_dvars)
local = ALLOC(struct local_vars);
local->prev = lvtbl;
local->tbl = 0;
local->dnames = 0;
local->nofree = 0;
local->dvars = inherit_dvars ? DVARS_INHERIT : DVARS_TOPSCOPE;
lvtbl = local;
@ -8042,7 +8039,6 @@ local_pop_gen(struct parser_params *parser)
{
struct local_vars *local = lvtbl->prev;
vtable_free(lvtbl->tbl);
vtable_free(lvtbl->dnames);
vtable_free(lvtbl->dvars);
xfree(lvtbl);
lvtbl = local;
@ -8152,26 +8148,6 @@ dyna_var_gen(struct parser_params *parser, ID id)
lvtbl->dvars = vtable_alloc(lvtbl->dvars);
}
vtable_add(lvtbl->dvars, id);
if (!vtable_included(lvtbl->dnames, id)) {
if (!lvtbl->dnames) {
lvtbl->dnames = vtable_alloc(0);
}
vtable_add(lvtbl->dnames, id);
}
}
static void
dyna_check_gen(struct parser_params *parser, ID id)
{
int i;
if (in_defined) return; /* no check needed */
for (i=0; i<vtable_size(lvtbl->dnames); i++) {
if (lvtbl->dnames->tbl[i] == id) {
rb_warnS("out-of-scope variable - %s", rb_id2name(id));
return;
}
}
}
static void
@ -9385,4 +9361,3 @@ Init_ripper(void)
rb_intern("&&");
}
#endif /* RIPPER */