pike.git/
src/
las.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2022-01-15
2022-01-15 11:34:49 by Henrik Grubbström (Grubba) <grubba@grubba.org>
203bfd05c778579d3677de9a04ba139a4cd503e4 (
21
lines) (+
15
/-
6
)
[
Show
|
Annotate
]
Branch:
master
Compiler
[Typechecker]
: Improved type check for the splice operator.
4019:
case F_PUSH_ARRAY: if (CAR(n)) {
-
struct pike_type *array_type
;
-
MAKE
_
CONSTANT
_
TYPE
(array_type,
tArr(tZero
)
)
;
-
if (!
pike_types_le(
array_type
, CAR(n
)
->type,
0, 0))
{
-
yytype_report(REPORT_ERROR, NULL, 0, array_type,
+
struct pike_type *array_type
=
+
type
_
binop(PT
_
BINOP_AND, CAR
(
n)->type,
array_type
_string
,
0, 0, 0
);
+
if (!array_type) {
+
yytype_report(REPORT_ERROR, NULL, 0, array_type
_string
,
NULL, 0, CAR(n)->type, 0, "Bad argument to splice operator.");
-
+
#if 0
+
} else if ((array_type != CAR(n)->type) &&
+
(THIS_COMPILATION->lex.pragmas & ID_STRICT_TYPES) &&
+
(Pike_compiler->compiler_pass == COMPILER_PASS_LAST)) {
+
yytype_report(REPORT_WARNING, NULL, 0, array_type,
+
NULL, 0, CAR(n)->type,
+
0, "Bad argument to splice operator.");
+
#endif
}
-
free_type(array_type);
+
/* FIXME: The type field of the splice operator is not yet utilized. * * It probably ought to be something similar to MANY(..., VOID). */
-
n->type = index_type(
CAR(n)->
type, int_type_string, n);
+
n->type = index_type(
array_
type, int_type_string, n);
+
free_type(array_type);
} else { copy_pike_type(n->type, mixed_type_string); }