Merge branch 'FixVisibility' into 'main'

Fix for visibility information when a function is a publish declaration.

See merge request freepascal.org/fpc/source!920
This commit is contained in:
Henrique Gottardi Werlang 2025-04-04 20:06:08 -03:00
commit caf5a0994e

View File

@ -20945,11 +20945,14 @@ var
ResultTypeInfo: TJSElement;
Call: TJSCallExpression;
Flags: Integer;
ExtVis: word;
ExtVis: Integer;
procedure AddExtRTTIVisibility;
begin
Call.AddArg(CreateLiteralNumber(Proc,ExtVis));
if ExtVis > -1 then
Call.AddArg(CreateLiteralNumber(Proc,ExtVis));
ExtVis := -1;
end;
procedure AddOption(const aName: String; JS: TJSElement);
@ -20959,8 +20962,7 @@ var
if JS=nil then exit;
if OptionsEl=nil then
begin
if ExtVis=ExtRTTIVisDefaultMethod then
AddExtRTTIVisibility;
AddExtRTTIVisibility;
OptionsEl:=TJSObjectLiteral(CreateElement(TJSObjectLiteral,Proc));
Call.AddArg(OptionsEl);
end;
@ -21054,10 +21056,19 @@ begin
ResultEl:=TPasFunction(Proc).FuncType.ResultEl;
ResultTypeInfo:=CreateTypeInfoRef(ResultEl.ResultType,AContext,ResultEl);
if ResultTypeInfo<>nil then
begin
AddExtRTTIVisibility;
Call.AddArg(ResultTypeInfo);
end;
end;
if (ResultTypeInfo=nil) and ((Flags>0) or (length(Attr)>0)) then
begin
AddExtRTTIVisibility;
Call.AddArg(CreateLiteralNull(Proc));
end;
// flags if needed
if (Flags>0) or (length(Attr)>0) then