some fixes:
- always remove imports from definition modules - minor improvement in error messages
This commit is contained in:
parent
8fc22f0db7
commit
6217293e23
|
@ -53,6 +53,15 @@ df_error(nd, mess, edf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
ex_error(nd, mess)
|
||||
t_node *nd;
|
||||
char *mess;
|
||||
{
|
||||
node_error(nd, "\"%s\": %s", symbol2str(nd->nd_symb), mess);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MkCoercion(pnd, tp)
|
||||
t_node **pnd;
|
||||
register t_type *tp;
|
||||
|
@ -160,8 +169,7 @@ ChkArrow(expp)
|
|||
tp = expp->nd_right->nd_type;
|
||||
|
||||
if (tp->tp_fund != T_POINTER) {
|
||||
node_error(expp, "\"^\": illegal operand");
|
||||
return 0;
|
||||
return ex_error(expp, "illegal operand type");
|
||||
}
|
||||
|
||||
expp->nd_type = RemoveEqual(PointedtoType(tp));
|
||||
|
@ -837,8 +845,7 @@ ChkBinOper(expp)
|
|||
*/
|
||||
if (expp->nd_symb == IN) {
|
||||
if (tpr->tp_fund != T_SET) {
|
||||
node_error(expp, "\"IN\": right operand must be a set");
|
||||
return 0;
|
||||
return ex_error(expp, "right operand must be a set");
|
||||
}
|
||||
if (!TstAssCompat(ElementType(tpr), tpl)) {
|
||||
/* Assignment compatible ???
|
||||
|
@ -863,9 +870,7 @@ ChkBinOper(expp)
|
|||
if (!(tpr->tp_fund & allowed) || !(tpl->tp_fund & allowed)) {
|
||||
if (!((T_CARDINAL & allowed) &&
|
||||
ChkAddress(tpl, tpr))) {
|
||||
node_error(expp, "\"%s\": illegal operand type(s)",
|
||||
symbol2str(expp->nd_symb));
|
||||
return 0;
|
||||
return ex_error(expp, "illegal operand type(s)");
|
||||
}
|
||||
if (expp->nd_type->tp_fund & T_CARDINAL) {
|
||||
expp->nd_type = address_type;
|
||||
|
@ -873,17 +878,13 @@ ChkBinOper(expp)
|
|||
}
|
||||
|
||||
if (Boolean(expp->nd_symb) && tpl != bool_type) {
|
||||
node_error(expp, "\"%s\": illegal operand type(s)",
|
||||
symbol2str(expp->nd_symb));
|
||||
return 0;
|
||||
return ex_error(expp, "illegal operand type(s)");
|
||||
}
|
||||
|
||||
/* Operands must be compatible (distilled from Def 8.2)
|
||||
*/
|
||||
if (!TstCompat(tpr, tpl)) {
|
||||
node_error(expp,"\"%s\": incompatible types",
|
||||
symbol2str(expp->nd_symb));
|
||||
return 0;
|
||||
return ex_error(expp, "incompatible operand types");
|
||||
}
|
||||
|
||||
MkCoercion(&(expp->nd_left), tpl);
|
||||
|
@ -968,8 +969,7 @@ ChkUnOper(expp)
|
|||
default:
|
||||
crash("ChkUnOper");
|
||||
}
|
||||
node_error(expp, "\"%s\": illegal operand", symbol2str(expp->nd_symb));
|
||||
return 0;
|
||||
return ex_error(expp, "illegal operand type");
|
||||
}
|
||||
|
||||
STATIC t_node *
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "scope.h"
|
||||
#include "node.h"
|
||||
#include "Lpars.h"
|
||||
#include "warning.h"
|
||||
|
||||
STATIC
|
||||
DefInFront(df)
|
||||
|
@ -185,22 +186,27 @@ define(id, scope, kind)
|
|||
return MkDef(id, scope, kind);
|
||||
}
|
||||
|
||||
RemoveImports(pdf)
|
||||
end_definition_list(pdf)
|
||||
register t_def **pdf;
|
||||
{
|
||||
/* Remove all imports from a definition module. This is
|
||||
neccesary because the implementation module might import
|
||||
them again.
|
||||
Also, mark all other definitions "QUALIFIED EXPORT".
|
||||
*/
|
||||
register t_def *df = *pdf;
|
||||
|
||||
while (df) {
|
||||
if (df->df_kind & D_IMPORTED) {
|
||||
if (! (df->df_flags & D_USED)) {
|
||||
warning(W_ORDINARY, "identifier \"%s\" imported but not used", df->df_idf->id_text);
|
||||
}
|
||||
RemoveFromIdList(df);
|
||||
*pdf = df->df_nextinscope;
|
||||
free_def(df);
|
||||
}
|
||||
else {
|
||||
df->df_flags |= D_QEXPORTED;
|
||||
pdf = &(df->df_nextinscope);
|
||||
}
|
||||
df = *pdf;
|
||||
|
|
|
@ -167,12 +167,7 @@ node_warning(exportlist, W_OLDFASHIONED, "export list in definition module ignor
|
|||
/* empty */
|
||||
]
|
||||
definition* END IDENT
|
||||
{ register t_def *df1 = CurrentScope->sc_def;
|
||||
while (df1) {
|
||||
/* Make all definitions "QUALIFIED EXPORT" */
|
||||
df1->df_flags |= D_QEXPORTED;
|
||||
df1 = df1->df_nextinscope;
|
||||
}
|
||||
{ end_definition_list(&(CurrentScope->sc_def));
|
||||
DefinitionModule--;
|
||||
match_id(df->df_idf, dot.TOK_IDF);
|
||||
df->df_flags &= ~D_BUSY;
|
||||
|
@ -219,7 +214,6 @@ ProgramModule
|
|||
IDENT { if (state == IMPLEMENTATION) {
|
||||
df = GetDefinitionModule(dot.TOK_IDF, 0);
|
||||
CurrVis = df->mod_vis;
|
||||
RemoveImports(&(CurrentScope->sc_def));
|
||||
}
|
||||
else {
|
||||
Defined = df = define(dot.TOK_IDF, GlobalScope, D_MODULE);
|
||||
|
|
Loading…
Reference in a new issue