[#927] UnboundMethod#to_proc — Dave Thomas <dave@...>
I'm wondering what I can do with a Proc generated by
17 messages
2003/04/06
[#929] Re: UnboundMethod#to_proc
— "Chris Pine" <nemo@...>
2003/04/06
----- Original Message -----
[#934] Re: UnboundMethod#to_proc
— Mathieu Bouchard <matju@...>
2003/04/06
[#940] Re: UnboundMethod#to_proc
— chr_news@...
2003/04/07
>
[#941] Re: UnboundMethod#to_proc
— Dave Thomas <dave@...>
2003/04/07
>> If they have diverging interfaces such that the contracts conflict
[#936] docs on implementation of ruby and/or ruby-gc ? — Ruben Vandeginste <Ruben.Vandeginste@...>
4 messages
2003/04/07
[#964] Range in logical context — Dave Thomas <dave@...>
If I run
7 messages
2003/04/16
[#965] Re: Range in logical context
— Mauricio Fern疣dez <batsman.geo@...>
2003/04/16
On Thu, Apr 17, 2003 at 06:10:40AM +0900, Dave Thomas wrote:
[#973] problem with rb_rescue2() ? — Mathieu Bouchard <matju@...>
5 messages
2003/04/19
Re: Range in logical context
From:
nobu.nokada@...
Date:
2003-04-17 02:24:06 UTC
List:
ruby-core #967
Hi,
At Thu, 17 Apr 2003 07:55:46 +0900,
Dave Thomas wrote:
> I assumed that was referring to stuff with an implicit $_ or $., such as
>
> print if 10..20
>
> or
>
> print if /cat/../dog/
>
> I'm not sure I see the reason for deprecating the more general form.
Exactly. And some new nodes are not warned.
Index: parse.y
===================================================================
RCS file: /pub/cvs/ruby/src/ruby/parse.y,v
retrieving revision 1.268
diff -u -2 -p -r1.268 parse.y
--- parse.y 10 Apr 2003 08:37:12 -0000 1.268
+++ parse.y 17 Apr 2003 02:10:37 -0000
@@ -5197,4 +5203,22 @@ range_op(node)
}
+static int
+literal_node_p(node)
+ NODE *node;
+{
+ if (!node) return Qtrue;
+ switch (nd_type(node)) {
+ case NODE_LIT:
+ case NODE_STR:
+ case NODE_DSTR:
+ case NODE_EVSTR:
+ case NODE_DREGX:
+ case NODE_DREGX_ONCE:
+ case NODE_DSYM:
+ return Qtrue;
+ }
+ return Qfalse;
+}
+
static NODE*
cond0(node)
@@ -5207,4 +5231,5 @@ cond0(node)
switch (type) {
case NODE_DSTR:
+ case NODE_EVSTR:
case NODE_STR:
rb_warn("string literal in condition");
@@ -5231,5 +5256,13 @@ cond0(node)
else if (type == NODE_DOT3) nd_set_type(node, NODE_FLIP3);
node->nd_cnt = local_append(internal_id());
- warning_unless_e_option("range literal in condition");
+ if (e_option_supplied() && RTEST(ruby_verbose)) {
+ if (literal_node_p(node->nd_beg) || literal_node_p(node->nd_end)) {
+ rb_warn("range literal in condition");
+ }
+ }
+ break;
+
+ case NODE_DSYM:
+ rb_warning("literal in condition");
break;
--
Nobu Nakada