mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 12:25:59 +02:00
* only record tokens for real generic routines or those that belong to a generic class/record
* don't parse a semicolon at the end for real specializations or specializations of methods that belong to a specialized class/record git-svn-id: trunk@35146 -
This commit is contained in:
parent
a76fd967b2
commit
779799c406
@ -1813,6 +1813,7 @@ implementation
|
|||||||
old_current_genericdef,
|
old_current_genericdef,
|
||||||
old_current_specializedef: tstoreddef;
|
old_current_specializedef: tstoreddef;
|
||||||
old_parse_generic: boolean;
|
old_parse_generic: boolean;
|
||||||
|
recordtokens : boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
old_current_procinfo:=current_procinfo;
|
old_current_procinfo:=current_procinfo;
|
||||||
@ -1858,7 +1859,13 @@ implementation
|
|||||||
entrypos:=current_filepos;
|
entrypos:=current_filepos;
|
||||||
entryswitches:=current_settings.localswitches;
|
entryswitches:=current_settings.localswitches;
|
||||||
|
|
||||||
if (df_generic in procdef.defoptions) then
|
recordtokens:=procdef.is_generic or
|
||||||
|
(
|
||||||
|
assigned(current_procinfo.procdef.struct) and
|
||||||
|
(df_generic in current_procinfo.procdef.struct.defoptions)
|
||||||
|
);
|
||||||
|
|
||||||
|
if recordtokens then
|
||||||
begin
|
begin
|
||||||
{ start token recorder for generic template }
|
{ start token recorder for generic template }
|
||||||
procdef.initgeneric;
|
procdef.initgeneric;
|
||||||
@ -1868,7 +1875,7 @@ implementation
|
|||||||
{ parse the code ... }
|
{ parse the code ... }
|
||||||
code:=block(current_module.islibrary);
|
code:=block(current_module.islibrary);
|
||||||
|
|
||||||
if (df_generic in procdef.defoptions) then
|
if recordtokens then
|
||||||
begin
|
begin
|
||||||
{ stop token recorder for generic template }
|
{ stop token recorder for generic template }
|
||||||
current_scanner.stoprecordtokens;
|
current_scanner.stoprecordtokens;
|
||||||
@ -2070,7 +2077,11 @@ implementation
|
|||||||
{ For specialization we didn't record the last semicolon. Moving this parsing
|
{ For specialization we didn't record the last semicolon. Moving this parsing
|
||||||
into the parse_body routine is not done because of having better file position
|
into the parse_body routine is not done because of having better file position
|
||||||
information available }
|
information available }
|
||||||
if not(df_specialization in current_procinfo.procdef.defoptions) then
|
if not current_procinfo.procdef.is_specialization and
|
||||||
|
(
|
||||||
|
not assigned(current_procinfo.procdef.struct) or
|
||||||
|
not (df_specialization in current_procinfo.procdef.struct.defoptions)
|
||||||
|
) then
|
||||||
consume(_SEMICOLON);
|
consume(_SEMICOLON);
|
||||||
|
|
||||||
if not isnestedproc then
|
if not isnestedproc then
|
||||||
|
Loading…
Reference in New Issue
Block a user