1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-15 17:30:06 +00:00

Enabled to recognize labels when parsing local variable declarations.

This commit is contained in:
acqn 2020-07-29 15:08:54 +08:00 committed by Oliver Schmidt
parent 19c81ed866
commit 92de4fa0d0

View File

@ -1248,11 +1248,23 @@ static void ParseTypeSpec (DeclSpec* D, long Default, TypeCode Qualifiers)
break;
case TOK_IDENT:
Entry = FindSym (CurTok.Ident);
if (Entry && SymIsTypeDef (Entry)) {
/* It's a typedef */
NextToken ();
TypeCopy (D->Type, Entry->Type);
/* This could be a label */
if (NextTok.Tok != TOK_COLON) {
Entry = FindSym (CurTok.Ident);
if (Entry && SymIsTypeDef (Entry)) {
/* It's a typedef */
NextToken ();
TypeCopy (D->Type, Entry->Type);
break;
}
} else {
/* This is a label. Use the default type flag to end the loop
** in DeclareLocals. The type code used here doesn't matter as
** long as it has no qualifiers.
*/
D->Flags |= DS_DEF_TYPE;
D->Type[0].C = T_QUAL_NONE;
D->Type[1].C = T_END;
break;
}
/* FALL THROUGH */