newer version

This commit is contained in:
ceriel 1986-04-22 23:22:19 +00:00
parent fef8659bf1
commit ce160b4f1a
4 changed files with 13 additions and 6 deletions

View file

@ -369,7 +369,7 @@ left->nd_def->df_idf->id_text, left->nd_def->df_value.df_stdname));
/* A dynamic array has no explicit /* A dynamic array has no explicit
index type index type
*/ */
expp->nd_type = int_type; expp->nd_type = intorcard_type;
} }
else cstcall(expp, S_MAX); else cstcall(expp, S_MAX);
break; break;
@ -667,16 +667,19 @@ node_error(expp, "IN operator: type of LHS not compatible with element type of R
} }
if (expp->nd_symb == '[') { if (expp->nd_symb == '[') {
/* Handle ARRAY selection specially too! */ /* Handle ARRAY selection specially too!
*/
if (tpl->tp_fund != T_ARRAY) { if (tpl->tp_fund != T_ARRAY) {
node_error(expp, node_error(expp,
"array index not belonging to an ARRAY"); "array index not belonging to an ARRAY");
return 0; return 0;
} }
if (!TstCompat(tpl->next, tpr)) {
if ((tpl->next && !TstCompat(tpl->next, tpr)) ||
(!tpl->next && !TstCompat(intorcard_type, tpr)) {
node_error(expp, "incompatible index type"); node_error(expp, "incompatible index type");
return 0;
} }
expp->nd_type = tpl->arr_elem; expp->nd_type = tpl->arr_elem;
return 1; return 1;
} }

View file

@ -61,7 +61,7 @@ ProcedureHeading(struct def **pdf; int type;)
/* We already saw a definition of this type /* We already saw a definition of this type
in the definition module. in the definition module.
*/ */
if (!TstTypeEquiv(tp, df->df_type)) { if (!TstProcEquiv(tp, df->df_type)) {
error("inconsistent procedure declaration for \"%s\"", df->df_idf->id_text); error("inconsistent procedure declaration for \"%s\"", df->df_idf->id_text);
} }
FreeType(df->df_type); FreeType(df->df_type);

View file

@ -95,6 +95,10 @@ TstCompat(tp1, tp2)
&& &&
(tp2 == int_type || tp2 == card_type) (tp2 == int_type || tp2 == card_type)
) )
||
(tp1 == char_type && tp2 == charc_type)
||
(tp2 == char_type && tp1 == charc_type)
|| ||
( tp2 == intorcard_type ( tp2 == intorcard_type
&& &&

View file

@ -272,7 +272,7 @@ ExpectBool(nd)
chk_expr(nd); chk_expr(nd);
if (nd->nd_type != bool_type) { if (nd->nd_type != bool_type && nd->nd_type != error_type) {
node_error(nd, "boolean expression expected"); node_error(nd, "boolean expression expected");
} }