1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-13 09:31:53 +00:00

Return after errors, move left bracket consumption down

This commit is contained in:
Lauri Kasanen 2019-04-14 19:47:42 +03:00 committed by greg-king5
parent 654d972288
commit 60d8559372

View File

@ -87,15 +87,20 @@ void GotoStatement (void)
if (CurTok.Tok == TOK_IDENT && if (CurTok.Tok == TOK_IDENT &&
(arr = FindSym (CurTok.Ident))) { (arr = FindSym (CurTok.Ident))) {
NextToken (); NextToken ();
ConsumeLBrack ();
/* Find array size */ /* Find array size */
if (!IsTypeArray (arr->Type) || SizeOf (arr->Type) == 0 || if (!IsTypeArray (arr->Type) || SizeOf (arr->Type) == 0 ||
SizeOf (GetElementType(arr->Type)) != 2) SizeOf (GetElementType(arr->Type)) != 2) {
Error ("Expected array"); Error ("Expected array");
if (GetElementCount (arr->Type) > 127) return;
}
if (GetElementCount (arr->Type) > 127) {
Error ("Only arrays with <= 127 labels are supported, got %lu", Error ("Only arrays with <= 127 labels are supported, got %lu",
GetElementCount (arr->Type)); GetElementCount (arr->Type));
return;
}
ConsumeLBrack ();
if (CurTok.Tok == TOK_ICONST) { if (CurTok.Tok == TOK_ICONST) {
val = CurTok.IVal; val = CurTok.IVal;