Be sure not to consume semicolon after _USES twice

This commit is contained in:
Pierre Muller 2024-03-11 10:27:36 +00:00
parent 57a1b5a39b
commit f88622a799

View File

@ -1083,7 +1083,10 @@ type
and are connected, and conditional compilation expressions can and are connected, and conditional compilation expressions can
use the symbols from those units } use the symbols from those units }
if curr.consume_semicolon_after_uses then if curr.consume_semicolon_after_uses then
begin
consume(_SEMICOLON); consume(_SEMICOLON);
curr.consume_semicolon_after_uses:=false;
end;
{ further, changing the globalsymtable is not allowed anymore } { further, changing the globalsymtable is not allowed anymore }
curr.globalsymtable.sealed:=true; curr.globalsymtable.sealed:=true;
@ -1153,8 +1156,10 @@ type
might cause internal errors, see tw8611 } might cause internal errors, see tw8611 }
if curr.consume_semicolon_after_uses then if curr.consume_semicolon_after_uses then
begin
consume(_SEMICOLON); consume(_SEMICOLON);
curr.consume_semicolon_after_uses:=false;
end;
{ now push our own symtable } { now push our own symtable }
symtablestack.push(curr.globalsymtable); symtablestack.push(curr.globalsymtable);
{ Dump stack { Dump stack
@ -1258,7 +1263,6 @@ type
s1,s2 : ^string; {Saves stack space} s1,s2 : ^string; {Saves stack space}
unitname : ansistring; unitname : ansistring;
unitname8 : string[8]; unitname8 : string[8];
consume_semicolon_after_uses:boolean;
feature : tfeature; feature : tfeature;
load_ok : boolean; load_ok : boolean;
@ -1391,13 +1395,10 @@ type
exit; exit;
end; end;
consume_semicolon_after_uses:=true; curr.consume_semicolon_after_uses:=true;
end end
else else
consume_semicolon_after_uses:=false; curr.consume_semicolon_after_uses:=false;
{ we need to store this in case compilation is transferred to another unit }
curr.consume_semicolon_after_uses:=consume_semicolon_after_uses;
{ move the global symtable from the temporary local to global } { move the global symtable from the temporary local to global }
current_module.globalsymtable:=current_module.localsymtable; current_module.globalsymtable:=current_module.localsymtable;
@ -2447,7 +2448,10 @@ type
{ consume the semicolon after maps have been updated else conditional compiling expressions { consume the semicolon after maps have been updated else conditional compiling expressions
might cause internal errors, see tw8611 } might cause internal errors, see tw8611 }
if curr.consume_semicolon_after_uses then if curr.consume_semicolon_after_uses then
begin
consume(_SEMICOLON); consume(_SEMICOLON);
curr.consume_semicolon_after_uses:=false;
end;
{Insert the name of the main program into the symbol table.} {Insert the name of the main program into the symbol table.}
if curr.realmodulename^<>'' then if curr.realmodulename^<>'' then
@ -2723,7 +2727,6 @@ type
var var
main_file : tinputfile; main_file : tinputfile;
consume_semicolon_after_uses,
consume_semicolon_after_loaded : boolean; consume_semicolon_after_loaded : boolean;
ps : tprogramparasym; ps : tprogramparasym;
textsym : ttypesym; textsym : ttypesym;
@ -2856,12 +2859,10 @@ type
current_namespacelist:=Nil; current_namespacelist:=Nil;
parseusesclause(curr); parseusesclause(curr);
load_ok:=loadunits(curr,false) and load_ok; load_ok:=loadunits(curr,false) and load_ok;
consume_semicolon_after_uses:=true; curr.consume_semicolon_after_uses:=true;
end end
else else
consume_semicolon_after_uses:=false; curr.consume_semicolon_after_uses:=false;
Curr.consume_semicolon_after_uses:=consume_semicolon_after_uses;
if not load_ok then if not load_ok then
curr.state:=ms_compiling_wait; curr.state:=ms_compiling_wait;