Browse Source

* pas2jni: Fixed exclusion of descendant classes.

git-svn-id: trunk@29152 -
yury 10 years ago
parent
commit
7860959a13
2 changed files with 25 additions and 8 deletions
  1. 0 8
      utils/pas2jni/ppuparser.pas
  2. 25 0
      utils/pas2jni/writer.pas

+ 0 - 8
utils/pas2jni/ppuparser.pas

@@ -308,9 +308,6 @@ var
         if jt = 'obj' then begin
           if it.Strings['ObjType'] <> 'class' then
             continue;
-          // Exclude class?
-          if FOnCheckItem(AUnitName + '.' + CurObjName) = crExclude then
-            continue;
           d:=TClassDef.Create(CurDef, dtClass);
         end
         else
@@ -446,11 +443,6 @@ var
           dtClass:
             with TClassDef(d) do begin
               AncestorClass:=TClassDef(_GetRef(it.Get('Ancestor', TJSONObject(nil)), TClassDef));
-              if (AncestorClass <> nil) and (AncestorClass.DefType = dtNone) then begin
-                // Ancestor class has been excluded
-                FreeAndNil(d);
-                continue;
-              end;
               _ReadDefs(d, it, 'Fields');
             end;
           dtRecord:

+ 25 - 0
utils/pas2jni/writer.pas

@@ -1250,6 +1250,28 @@ begin
 end;
 
 procedure TWriter.WriteUnit(u: TUnitDef);
+
+  procedure _ExcludeClasses(AAncestorClass: TClassDef);
+  var
+    i: integer;
+    d: TDef;
+    s: string;
+  begin
+    for i:=0 to u.Count - 1 do begin
+      d:=u[i];
+      if d.DefType = dtClass then begin
+        s:=u.Name + '.' + d.Name;
+        if (TClassDef(d).AncestorClass = AAncestorClass) or
+           ( (AAncestorClass = nil) and (DoCheckItem(u.Name + '.' + d.Name) = crExclude) )
+        then begin
+          d.SetNotUsed;
+          ExcludeList.Add(s);
+          _ExcludeClasses(TClassDef(d));
+        end;
+      end;
+    end;
+  end;
+
 var
   d: TDef;
   i: integer;
@@ -1262,6 +1284,9 @@ begin
   if not u.IsUsed then
     exit;
 
+  if AnsiCompareText(u.Name, 'system') <> 0 then
+    _ExcludeClasses(nil);
+
   for i:=0 to High(u.UsedUnits) do
     WriteUnit(u.UsedUnits[i]);