Browse Source

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

Henrique Gottardi Werlang 6 months ago
parent
commit
2c54727c74
1 changed files with 15 additions and 4 deletions
  1. 15 4
      packages/pastojs/src/fppas2js.pp

+ 15 - 4
packages/pastojs/src/fppas2js.pp

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