瀏覽代碼

+ new vis_none visibility specifier that can be used as "neutral"
* make it possible to force the visibility of added constructors
in add_missing_parent_constructors_intf() to a particular
setting (use vis_none to keep the visibility of the inherited
constructor)

git-svn-id: branches/jvmbackend@18614 -

Jonas Maebe 14 年之前
父節點
當前提交
30478a14b6
共有 3 個文件被更改,包括 8 次插入5 次删除
  1. 1 1
      compiler/pdecobj.pas
  2. 3 2
      compiler/symconst.pas
  3. 4 2
      compiler/symcreat.pas

+ 1 - 1
compiler/pdecobj.pas

@@ -1390,7 +1390,7 @@ implementation
                 we obviously cannot add constructors to those) }
               if is_javaclass(current_structdef) then
                 begin
-                  add_missing_parent_constructors_intf(tobjectdef(current_structdef));
+                  add_missing_parent_constructors_intf(tobjectdef(current_structdef),vis_none);
                   maybe_add_public_default_java_constructor(tobjectdef(current_structdef));
                 end;
               { need method to hold the initialization code for typed constants? }

+ 3 - 2
compiler/symconst.pas

@@ -152,7 +152,8 @@ type
     vis_strictprotected,
     vis_protected,
     vis_public,
-    vis_published
+    vis_published,
+    vis_none
   );
 
   { symbol options }
@@ -621,7 +622,7 @@ inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has
 
      visibilityName : array[tvisibility] of string[16] = (
        'hidden','strict private','private','strict protected','protected',
-       'public','published'
+       'public','published',''
      );
 
 

+ 4 - 2
compiler/symcreat.pas

@@ -64,7 +64,7 @@ interface
   { in the JVM, constructors are not automatically inherited (so you can hide
     them). To emulate the Pascal behaviour, we have to automatically add
     all parent constructors to the current class as well.}
-  procedure add_missing_parent_constructors_intf(obj: tobjectdef);
+  procedure add_missing_parent_constructors_intf(obj: tobjectdef; forcevis: tvisibility);
 
   { goes through all defs in st to add implementations for synthetic methods
     added earlier }
@@ -207,7 +207,7 @@ implementation
      end;
 
 
-  procedure add_missing_parent_constructors_intf(obj: tobjectdef);
+  procedure add_missing_parent_constructors_intf(obj: tobjectdef; forcevis: tvisibility);
     var
       parent: tobjectdef;
       def: tdef;
@@ -249,6 +249,8 @@ implementation
           { if we get here, we did not find it in the current objectdef ->
             add }
           childpd:=tprocdef(parentpd.getcopy);
+          if forcevis<>vis_none then
+            childpd.visibility:=forcevis;
           finish_copied_procdef(childpd,parentpd.procsym.realname,obj.symtable,obj);
           exclude(childpd.procoptions,po_external);
           include(childpd.procoptions,po_overload);