pike.git/
src/
las.c
Branch:
Tag:
Non-build tags
All tags
No tags
2000-01-04
2000-01-04 00:49:52 by Henrik Grubbström (Grubba) <grubba@grubba.org>
c9cfaeda2ece299a79614134507ec73edac9acbf (
27
lines) (+
23
/-
4
)
[
Show
|
Annotate
]
Branch:
7.9
Improved type-checking for case ranges.
Rev: src/las.c:1.158
5:
\*/ /**/ #include "global.h"
-
RCSID("$Id: las.c,v 1.
157
1999
/
12
/
30
22
:
20
:
56
grubba Exp $");
+
RCSID("$Id: las.c,v 1.
158
2000
/
01
/
04
00
:
49
:
52
grubba Exp $");
#include "language.h" #include "interpret.h"
2460:
} } }
+
copy_shared_string(n->type,void_type_string);
+
break;
-
/*
Fall
through
*/
-
+
case
F_CASE:
+
if (CDR(n) && CAR(n)) {
+
/*
case
1
.. 2:
*/
+
if (!match_types(CAR(n)->type, CDR(n)->type)) {
+
yytype_error("Type mismatch in case range.",
+
CAR(n)->type, CDR(n)->type, 0);
+
} else if ((lex.pragmas & ID_STRICT_TYPES) &&
+
(CAR(n)->type != CDR(n)->type)) {
+
/* The type should be the same for both CAR & CDR. */
+
if (!pike_types_le(CDR(n)->type, CAR(n)->type)) {
+
yytype_error("Type mismatch in case range.",
+
CAR(n)->type, CDR(n)->type, YYTE_IS_WARNING);
+
} else if (!pike_types_le(CAR(n)->type, CDR(n)->type)) {
+
yytype_error("Type mismatch in case range.",
+
CDR(n)->type, CAR(n)->type, YYTE_IS_WARNING);
+
}
+
}
+
}
+
/* FALL_THROUGH */
case F_INC_LOOP: case F_DEC_LOOP: case F_DEC_NEQ_LOOP: case F_INC_NEQ_LOOP:
-
case F_CASE:
+
case F_CONTINUE: case F_BREAK: case F_DEFAULT: