mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-02 21:58:29 +02:00
* fix for Mantis #31945: two fixes for nested routines inside generic methods
a) correctly determine whether token recording is required or not (nested routines of generic routines don't need it) b) correctly determine whether the trailing ";" needs to be parsed (nested routines of generic routines need to) git-svn-id: trunk@36469 -
This commit is contained in:
parent
eb9b4fb71f
commit
dffe423b10
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15581,6 +15581,7 @@ tests/webtbs/tw3183a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3184.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3185.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3190.pp svneol=native#text/plain
|
||||
tests/webtbs/tw31945.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3197.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3207.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3210.pp svneol=native#text/plain
|
||||
|
@ -1877,10 +1877,12 @@ implementation
|
||||
entryswitches:=current_settings.localswitches;
|
||||
|
||||
recordtokens:=procdef.is_generic or
|
||||
(
|
||||
assigned(current_procinfo.procdef.struct) and
|
||||
(df_generic in current_procinfo.procdef.struct.defoptions)
|
||||
);
|
||||
(
|
||||
assigned(procdef.struct) and
|
||||
(df_generic in procdef.struct.defoptions) and
|
||||
assigned(procdef.owner) and
|
||||
(procdef.owner.defowner=procdef.struct)
|
||||
);
|
||||
|
||||
if recordtokens then
|
||||
begin
|
||||
@ -2094,6 +2096,10 @@ implementation
|
||||
(
|
||||
not assigned(current_procinfo.procdef.struct) or
|
||||
not (df_specialization in current_procinfo.procdef.struct.defoptions)
|
||||
or not (
|
||||
assigned(current_procinfo.procdef.owner) and
|
||||
(current_procinfo.procdef.owner.defowner=current_procinfo.procdef.struct)
|
||||
)
|
||||
) then
|
||||
consume(_SEMICOLON);
|
||||
|
||||
|
40
tests/webtbs/tw31945.pp
Normal file
40
tests/webtbs/tw31945.pp
Normal file
@ -0,0 +1,40 @@
|
||||
{ Note: this is a vastly reduced variant of the example attached to bug report #31945 }
|
||||
|
||||
unit tw31945;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils;
|
||||
|
||||
type
|
||||
{ GprAvgLvlTreeNode }
|
||||
|
||||
generic GprAvgLvlTreeNode<T> = class
|
||||
public
|
||||
procedure ConsistencyCheck; virtual;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ GprAvgLvlTreeNode }
|
||||
|
||||
procedure GprAvgLvlTreeNode.ConsistencyCheck;
|
||||
|
||||
procedure E(Msg: string);
|
||||
begin
|
||||
raise Exception.Create('GprAvgLvlTreeNode.ConsistencyCheck: '+Msg);
|
||||
end;
|
||||
|
||||
begin
|
||||
E('Hello World');
|
||||
end;
|
||||
|
||||
var
|
||||
t: specialize GprAvgLvlTreeNode<LongInt>;
|
||||
initialization
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user