Forráskód Böngészése

+ 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 éve
szülő
commit
30478a14b6
3 módosított fájl, 8 hozzáadás és 5 törlés
  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) }
                 we obviously cannot add constructors to those) }
               if is_javaclass(current_structdef) then
               if is_javaclass(current_structdef) then
                 begin
                 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));
                   maybe_add_public_default_java_constructor(tobjectdef(current_structdef));
                 end;
                 end;
               { need method to hold the initialization code for typed constants? }
               { need method to hold the initialization code for typed constants? }

+ 3 - 2
compiler/symconst.pas

@@ -152,7 +152,8 @@ type
     vis_strictprotected,
     vis_strictprotected,
     vis_protected,
     vis_protected,
     vis_public,
     vis_public,
-    vis_published
+    vis_published,
+    vis_none
   );
   );
 
 
   { symbol options }
   { symbol options }
@@ -621,7 +622,7 @@ inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has
 
 
      visibilityName : array[tvisibility] of string[16] = (
      visibilityName : array[tvisibility] of string[16] = (
        'hidden','strict private','private','strict protected','protected',
        '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
   { in the JVM, constructors are not automatically inherited (so you can hide
     them). To emulate the Pascal behaviour, we have to automatically add
     them). To emulate the Pascal behaviour, we have to automatically add
     all parent constructors to the current class as well.}
     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
   { goes through all defs in st to add implementations for synthetic methods
     added earlier }
     added earlier }
@@ -207,7 +207,7 @@ implementation
      end;
      end;
 
 
 
 
-  procedure add_missing_parent_constructors_intf(obj: tobjectdef);
+  procedure add_missing_parent_constructors_intf(obj: tobjectdef; forcevis: tvisibility);
     var
     var
       parent: tobjectdef;
       parent: tobjectdef;
       def: tdef;
       def: tdef;
@@ -249,6 +249,8 @@ implementation
           { if we get here, we did not find it in the current objectdef ->
           { if we get here, we did not find it in the current objectdef ->
             add }
             add }
           childpd:=tprocdef(parentpd.getcopy);
           childpd:=tprocdef(parentpd.getcopy);
+          if forcevis<>vis_none then
+            childpd.visibility:=forcevis;
           finish_copied_procdef(childpd,parentpd.procsym.realname,obj.symtable,obj);
           finish_copied_procdef(childpd,parentpd.procsym.realname,obj.symtable,obj);
           exclude(childpd.procoptions,po_external);
           exclude(childpd.procoptions,po_external);
           include(childpd.procoptions,po_overload);
           include(childpd.procoptions,po_overload);