Browse Source

* remvoed class/static methods

peter 22 years ago
parent
commit
b94735a9d3
1 changed files with 16 additions and 91 deletions
  1. 16 91
      tests/test/cg/tclatype.pp

+ 16 - 91
tests/test/cg/tclatype.pp

@@ -5,17 +5,16 @@
 type
 type
    tbaseclass = class
    tbaseclass = class
      x : longint;
      x : longint;
-     class procedure virtual_class_method; virtual;
-     class procedure call_virtual_class_method;
-     class function get_type : pointer;
-     function get_type2 : pointer;
+     function get_type : pointer;
+     function get_type2 : pointer;virtual;
      procedure check_type;
      procedure check_type;
-     class procedure class_check_type;
+     class procedure virtual_class_method;virtual;
    end;
    end;
 
 
    tderivedclass = class(tbaseclass)
    tderivedclass = class(tbaseclass)
      y : longint;
      y : longint;
-     class procedure virtual_class_method; override;
+     function get_type2 : pointer;override;
+     class procedure virtual_class_method;override;
    end;
    end;
 
 
 const
 const
@@ -29,18 +28,6 @@ var
   basesize : longint;
   basesize : longint;
   derivedsize : longint;
   derivedsize : longint;
 
 
-procedure tbaseclass.virtual_class_method;
-
-begin
-  Writeln('Calling tbase class class method');
-  tbasecalled:=true;
-  if typeof(self)<>get_type then
-    begin
-      has_error:=true;
-      Writeln('Error with typeof');
-    end;
-end;
-
 function tbaseclass.get_type : pointer;
 function tbaseclass.get_type : pointer;
 begin
 begin
   get_type:=typeof(self);
   get_type:=typeof(self);
@@ -70,27 +57,23 @@ begin
     end;
     end;
 end;
 end;
 
 
-procedure tbaseclass.class_check_type;
+procedure tbaseclass.virtual_class_method;
 begin
 begin
-  if typeof(self)<>get_type then
+  Writeln('Calling tbase class class method');
+  tbasecalled:=true;
+  if sizeof(self)<>basesize then
     begin
     begin
-      Writeln('Compiler creates garbage');
       has_error:=true;
       has_error:=true;
+      Writeln('Error with sizeof');
     end;
     end;
 end;
 end;
 
 
-class procedure tbaseclass.call_virtual_class_method;
+function tderivedclass.get_type2 : pointer;
 begin
 begin
-  virtual_class_method;
-  if get_type<>typeof(self) then
-    begin
-      Writeln('Compiler creates garbage');
-      has_error:=true;
-    end;
+  get_type2:=typeof(self);
 end;
 end;
 
 
 procedure tderivedclass.virtual_class_method;
 procedure tderivedclass.virtual_class_method;
-
 begin
 begin
   Writeln('Calling tderived class class method');
   Writeln('Calling tderived class class method');
   tderivedcalled:=true;
   tderivedcalled:=true;
@@ -117,59 +100,19 @@ begin
  cb:=tbaseclass.create;
  cb:=tbaseclass.create;
  cd:=tderivedclass.create;
  cd:=tderivedclass.create;
  c1:=tbaseclass.create;
  c1:=tbaseclass.create;
- pb:=typeof(tbaseclass);
- pd:=typeof(tderivedclass);
- if pb<>typeof(cb) then
-   has_error:=true;
- if pd<>typeof(cd) then
-   has_error:=true;
 
 
  basesize:=sizeof(cb);
  basesize:=sizeof(cb);
  Writeln('Sizeof(cb)=',basesize);
  Writeln('Sizeof(cb)=',basesize);
- if basesize<>expected_size_for_tbaseclass then
-   Writeln('not the expected size : ',expected_size_for_tbaseclass);
+ if basesize<>sizeof(pointer) then
+   Writeln('not the expected size : ',sizeof(pointer));
 
 
  derivedsize:=sizeof(cd);
  derivedsize:=sizeof(cd);
  Writeln('Sizeof(ct)=',derivedsize);
  Writeln('Sizeof(ct)=',derivedsize);
- if derivedsize<>expected_size_for_tderivedclass then
-   Writeln('not the expected size : ',expected_size_for_tderivedclass);
+ if derivedsize<>sizeof(pointer) then
+   Writeln('not the expected size : ',sizeof(pointer));
 
 
  cb.check_type;
  cb.check_type;
  cd.check_type;
  cd.check_type;
- cb.class_check_type;
- cd.class_check_type;
- tbaseclass.class_check_type;
- tderivedclass.class_check_type;
-
- tbaseclass.virtual_class_method;
- if not tbasecalled then
-   has_error:=true;
- reset_booleans;
-
- tbaseclass.call_virtual_class_method;
- if not tbasecalled then
-   has_error:=true;
- reset_booleans;
-
- tderivedclass.virtual_class_method;
- if not tderivedcalled then
-   has_error:=true;
- reset_booleans;
-
- tderivedclass.call_virtual_class_method;
- if not tderivedcalled then
-   has_error:=true;
- reset_booleans;
-
- c1.virtual_class_method;
- if not tbasecalled then
-   has_error:=true;
- reset_booleans;
-
- c1.call_virtual_class_method;
- if not tbasecalled then
-   has_error:=true;
- reset_booleans;
 
 
  c1.destroy;
  c1.destroy;
 
 
@@ -180,41 +123,23 @@ begin
    has_error:=true;
    has_error:=true;
  reset_booleans;
  reset_booleans;
 
 
- c1.call_virtual_class_method;
- if not tderivedcalled then
-   has_error:=true;
- reset_booleans;
-
  c1.destroy;
  c1.destroy;
 
 
  cc:=tbaseclass;
  cc:=tbaseclass;
- cc.class_check_type;
 
 
  cc.virtual_class_method;
  cc.virtual_class_method;
  if not tbasecalled then
  if not tbasecalled then
    has_error:=true;
    has_error:=true;
  reset_booleans;
  reset_booleans;
 
 
- cc.call_virtual_class_method;
- if not tbasecalled then
-   has_error:=true;
- reset_booleans;
-
  cc:=tderivedclass;
  cc:=tderivedclass;
 
 
 
 
- cc.class_check_type;
-
  cc.virtual_class_method;
  cc.virtual_class_method;
  if not tderivedcalled then
  if not tderivedcalled then
    has_error:=true;
    has_error:=true;
  reset_booleans;
  reset_booleans;
 
 
- cc.call_virtual_class_method;
- if not tderivedcalled then
-   has_error:=true;
- reset_booleans;
-
  if has_error then
  if has_error then
    begin
    begin
      Writeln('Error with class methods');
      Writeln('Error with class methods');