diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-02-19 07:03:06 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-02-19 07:03:06 +0000 |
commit | 3ae4fd7258fe518327a0ceb69c292eddbabfb995 (patch) | |
tree | 35ca43544604467644f99ad0376fef8a4c4dc1e0 /parse.y | |
parent | d63d8012f46d6a8ede9145db48be830cc114ad62 (diff) |
* eval.c (secure_visibility): visibility check for untainted modules.
* signal.c (sigpipe): sighandler which does nothing.
* signal.c (trap): set sigpipe function for SIGPIPE.
* signal.c (Init_signal): default SIGPIPE handler should be
sigpipe function.
* array.c (rb_ary_subseq): wrong boundary check.
* parse.y (cond0): integer literal in condition should not be
compared to lineno ($.).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 36 |
1 files changed, 25 insertions, 11 deletions
@@ -4469,6 +4469,28 @@ warning_unless_e_option(str) if (e_option_supplied()) rb_warning(str); } +static NODE *cond0(); + +static NODE* +cond2(node, logop) + NODE *node; + int logop; +{ + enum node_type type; + + if (logop) return node; + if (!e_option_supplied()) return node; + + warn_unless_e_option("integer literal in condition"); + node = cond0(node); + type = nd_type(node); + if (type == NODE_NEWLINE) node = node->nd_next; + if (type == NODE_LIT && FIXNUM_P(node->nd_lit)) { + return call_op(node,tEQ,1,NEW_GVAR(rb_intern("$."))); + } + return node; +} + static NODE* cond0(node, logop) NODE *node; @@ -4494,8 +4516,8 @@ cond0(node, logop) case NODE_DOT2: case NODE_DOT3: - node->nd_beg = cond0(node->nd_beg, logop); - node->nd_end = cond0(node->nd_end, logop); + node->nd_beg = cond2(node->nd_beg, logop); + node->nd_end = cond2(node->nd_end, logop); if (type == NODE_DOT2) nd_set_type(node,NODE_FLIP2); else if (type == NODE_DOT3) nd_set_type(node, NODE_FLIP3); node->nd_cnt = local_append(0); @@ -4509,20 +4531,12 @@ cond0(node, logop) goto regexp; case NODE_LIT: - switch (TYPE(node->nd_lit)) { - case T_REGEXP: + if (TYPE(node->nd_lit) == T_REGEXP) { warning_unless_e_option("regex literal in condition"); regexp: nd_set_type(node, NODE_MATCH); local_cnt('_'); local_cnt('~'); - break; - - case T_FIXNUM: - if (logop) break; - if (!e_option_supplied()) break; - warn_unless_e_option("integer literal in condition"); - return call_op(node,tEQ,1,NEW_GVAR(rb_intern("$."))); } } return node; |