From f328481a480e253a86dd74598dc8c5044fb574e3 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Mon, 15 Apr 2019 16:23:01 +0300 Subject: [PATCH] Replace hard returns with an "else", add an error for non-IDENT tokens, and test for static --- src/cc65/goto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cc65/goto.c b/src/cc65/goto.c index fde9df945..939eb65a9 100644 --- a/src/cc65/goto.c +++ b/src/cc65/goto.c @@ -90,14 +90,12 @@ void GotoStatement (void) /* Find array size */ if (!IsTypeArray (arr->Type) || SizeOf (arr->Type) == 0 || + !(arr->Flags & SC_STATIC) || SizeOf (GetElementType(arr->Type)) != 2) { - Error ("Expected array"); - return; - } - if (GetElementCount (arr->Type) > 127) { + Error ("Expected a static array"); + } else if (GetElementCount (arr->Type) > 127) { Error ("Only arrays with <= 127 labels are supported, got %lu", GetElementCount (arr->Type)); - return; } ConsumeLBrack (); @@ -153,6 +151,8 @@ void GotoStatement (void) cur = cur->NextSym; } } + } else { /* It was not TOK_IDENT, or we couldn't find the symbol */ + Error ("Array name expected"); } } else { -- 2.39.5