Explorar o código

* pas2jni: Properly exclude whole units.

git-svn-id: trunk@32609 -
yury %!s(int64=9) %!d(string=hai) anos
pai
achega
9d93c6f953
Modificáronse 2 ficheiros con 13 adicións e 4 borrados
  1. 7 4
      utils/pas2jni/ppuparser.pas
  2. 6 0
      utils/pas2jni/writer.pas

+ 7 - 4
utils/pas2jni/ppuparser.pas

@@ -540,6 +540,7 @@ var
 var
   i, j: integer;
   s: string;
+  chkres: TCheckItemResult;
 begin
   Result:=nil;
   for i:=0 to Units.Count - 1 do
@@ -548,12 +549,14 @@ begin
       exit;
     end;
 
-  AMainUnit:=FOnCheckItem(AUnitName) = crInclude;
+  chkres:=FOnCheckItem(AUnitName);
+  if chkres = crExclude then
+    exit;
 
-  if not AMainUnit and ( (CompareText(AUnitName, 'windows') = 0) or (CompareText(AUnitName, 'unix') = 0) ) then begin
-    Result:=nil;
+  AMainUnit:=chkres = crInclude;
+
+  if not AMainUnit and ( (CompareText(AUnitName, 'windows') = 0) or (CompareText(AUnitName, 'unix') = 0) ) then
     exit;
-  end;
 
   s:=ReadUnit(AUnitName);
   try

+ 6 - 0
utils/pas2jni/writer.pas

@@ -304,6 +304,12 @@ var
   i: integer;
   s: string;
 begin
+  if d.DefType = dtClass then
+    with TClassDef(d) do
+      if (AncestorClass = nil) and (CType in [ctClass, ctInterface]) and (CompareText(Parent.Name, 'system') <> 0) then begin
+        SetNotUsed;
+        exit;
+      end;
   s:=Prefix + d.Name;
   i:=IncludeList.IndexOf(s);
   if i >= 0 then begin