* fix for Mantis : when parsing a helper type its extendeddef might be Nil

+ added test

git-svn-id: trunk@43346 -
This commit is contained in:
svenbarth 2019-11-01 15:02:31 +00:00
parent f481587bee
commit fdeaacac21
3 changed files with 30 additions and 2 deletions

1
.gitattributes vendored
View File

@ -16071,6 +16071,7 @@ tests/webtbf/tw3583.pp svneol=native#text/plain
tests/webtbf/tw35866.pp svneol=native#text/pascal
tests/webtbf/tw35981.pp svneol=native#text/pascal
tests/webtbf/tw36114.pp svneol=native#text/pascal
tests/webtbf/tw36223.pp svneol=native#text/pascal
tests/webtbf/tw3626.pp svneol=native#text/plain
tests/webtbf/tw3631.pp svneol=native#text/plain
tests/webtbf/tw3643.pp svneol=native#text/plain

View File

@ -3916,8 +3916,17 @@ implementation
exit;
end;
{ now search all helpers using the extendeddef as the starting point }
if m_multi_helpers in current_settings.modeswitches then
result:=search_best_objectpascal_helper(s,classh.extendeddef,contextclassh,srsym,srsymtable);
if (m_multi_helpers in current_settings.modeswitches) and
(
(current_structdef<>classh) or
assigned(classh.extendeddef)
) then
begin
{ this is only allowed if classh is currently parsed }
if not assigned(classh.extendeddef) then
internalerror(2019110101);
result:=search_best_objectpascal_helper(s,classh.extendeddef,contextclassh,srsym,srsymtable);
end;
end;
function search_specific_assignment_operator(assignment_type:ttoken;from_def,to_def:Tdef):Tprocdef;

18
tests/webtbf/tw36223.pp Normal file
View File

@ -0,0 +1,18 @@
{ %FAIL }
{$mode objfpc}
{$modeswitch multihelpers}
unit tw36223;
interface
uses
SysUtils;
type
// ERROR: Compilation raised exception internally
TMyHelper = class helper for TSomeObject
end;
implementation
end.