From 21baad1037c1aa85384a81dd77a4661676336133 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 2 Feb 2023 10:09:21 +0000 Subject: 51307: Improve error on attempt to define function from aliased name --- Src/input.c | 5 +++-- Src/parse.c | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Src') diff --git a/Src/input.c b/Src/input.c index 5a612669b..0da065e51 100644 --- a/Src/input.c +++ b/Src/input.c @@ -816,6 +816,7 @@ char *input_hasalias(void) { int flags = inbufflags; struct instacks *instackptr = instacktop; + char *alias_nam = NULL; for (;;) { @@ -824,9 +825,9 @@ char *input_hasalias(void) DPUTS(instackptr == instack, "BUG: continuation at bottom of instack"); instackptr--; if (instackptr->alias) - return instackptr->alias->node.nam; + alias_nam = instackptr->alias->node.nam; flags = instackptr->flags; } - return NULL; + return alias_nam; } diff --git a/Src/parse.c b/Src/parse.c index 283225b74..a07a6cc71 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -2055,6 +2055,9 @@ par_simple(int *cmplx, int nr) if (isset(EXECOPT) && hasalias && !isset(ALIASFUNCDEF) && argc && hasalias != input_hasalias()) { zwarn("defining function based on alias `%s'", hasalias); + herrflush(); + if (noerrs != 2) + errflag |= ERRFLAG_ERROR; YYERROR(oecused); } -- cgit 1.4.1