Moved TryToString call into ChkAssCompat

This commit is contained in:
ceriel 1996-06-06 07:47:00 +00:00
parent 7f7f5f187f
commit 1592c3638c
2 changed files with 4 additions and 5 deletions

View file

@ -26,6 +26,7 @@
#include "node.h" #include "node.h"
#include "warning.h" #include "warning.h"
#include "main.h" #include "main.h"
#include "Lpars.h"
extern char *sprint(); extern char *sprint();
@ -289,6 +290,9 @@ ChkAssCompat(nd, tp, message)
Give an error message when it fails Give an error message when it fails
*/ */
if ((*nd)->nd_symb == STRING) {
TryToString((*nd), tp);
}
return CompatCheck(nd, tp, message, TstAssCompat); return CompatCheck(nd, tp, message, TstAssCompat);
} }

View file

@ -854,9 +854,6 @@ WalkStat(nd, exit_label, end_reached)
assignment compatible with the result type of the assignment compatible with the result type of the
function procedure (See Rep. 9.11). function procedure (See Rep. 9.11).
*/ */
if (nd->nd_RIGHT->nd_symb == STRING) {
TryToString(nd->nd_RIGHT, func_type);
}
if (!ChkAssCompat(&(nd->nd_RIGHT), func_type, "RETURN")) { if (!ChkAssCompat(&(nd->nd_RIGHT), func_type, "RETURN")) {
break; break;
} }
@ -1014,8 +1011,6 @@ DoAssign(nd)
ChkVariable(&(nd->nd_LEFT), D_DEFINED))) return; ChkVariable(&(nd->nd_LEFT), D_DEFINED))) return;
tp = nd->nd_LEFT->nd_type; tp = nd->nd_LEFT->nd_type;
if (nd->nd_RIGHT->nd_symb == STRING) TryToString(nd->nd_RIGHT, tp);
if (! ChkAssCompat(&(nd->nd_RIGHT), tp, "assignment")) { if (! ChkAssCompat(&(nd->nd_RIGHT), tp, "assignment")) {
return; return;
} }