Did not handle RETURN's in module bodies right
This commit is contained in:
parent
a7674c8ad0
commit
ad67e9e2dd
@ -258,6 +258,7 @@ WithStatement(t_node **pnd;)
|
|||||||
ReturnStatement(t_node **pnd;)
|
ReturnStatement(t_node **pnd;)
|
||||||
{
|
{
|
||||||
register t_def *df = CurrentScope->sc_definedby;
|
register t_def *df = CurrentScope->sc_definedby;
|
||||||
|
register t_type *tp = df->df_type ? ResultType(df->df_type) : 0;
|
||||||
register t_node *nd;
|
register t_node *nd;
|
||||||
} :
|
} :
|
||||||
|
|
||||||
@ -267,12 +268,12 @@ ReturnStatement(t_node **pnd;)
|
|||||||
{ if (scopeclosed(CurrentScope)) {
|
{ if (scopeclosed(CurrentScope)) {
|
||||||
error("a module body cannot return a value");
|
error("a module body cannot return a value");
|
||||||
}
|
}
|
||||||
else if (! ResultType(df->df_type)) {
|
else if (! tp) {
|
||||||
error("procedure \"%s\" is not a function, so cannot return a value", df->df_idf->id_text);
|
error("procedure \"%s\" is not a function, so cannot return a value", df->df_idf->id_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
|
||||||
{ if (ResultType(df->df_type)) {
|
{ if (tp) {
|
||||||
error("function procedure \"%s\" must return a value", df->df_idf->id_text);
|
error("function procedure \"%s\" must return a value", df->df_idf->id_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user