Jelajahi Sumber

* crash when using exception classes without sysutils unit fixed

florian 25 tahun lalu
induk
melakukan
9f57527c98
2 mengubah file dengan 16 tambahan dan 6 penghapusan
  1. 9 4
      compiler/pstatmnt.pas
  2. 7 2
      compiler/tcflw.pas

+ 9 - 4
compiler/pstatmnt.pas

@@ -588,16 +588,18 @@ unit pstatmnt;
                                if (srsym^.typ=typesym) and
                                  (ptypesym(srsym)^.restype.def^.deftype=objectdef) and
                                  pobjectdef(ptypesym(srsym)^.restype.def)^.is_class then
-                                 ot:=pobjectdef(ptypesym(srsym)^.restype.def)
+                                 begin
+                                    ot:=pobjectdef(ptypesym(srsym)^.restype.def);
+                                    sym:=new(pvarsym,initdef(objname,ot));
+                                 end
                                else
                                  begin
-                                    ot:=pobjectdef(generrordef);
+                                    sym:=new(pvarsym,initdef(objname,new(perrordef,init)));
                                     if (srsym^.typ=typesym) then
                                       Message1(type_e_class_type_expected,ptypesym(srsym)^.restype.def^.typename)
                                     else
                                       Message1(type_e_class_type_expected,ot^.typename);
                                  end;
-                               sym:=new(pvarsym,initdef(objname,ot));
                                exceptsymtable:=new(psymtable,init(stt_exceptsymtable));
                                exceptsymtable^.insert(sym);
                                { insert the exception symtable stack }
@@ -1366,7 +1368,10 @@ unit pstatmnt;
 end.
 {
   $Log$
-  Revision 1.126  2000-03-19 11:16:44  peter
+  Revision 1.127  2000-03-19 14:17:05  florian
+    * crash when using exception classes without sysutils unit fixed
+
+  Revision 1.126  2000/03/19 11:16:44  peter
     * check for unknown id in on exception
 
   Revision 1.125  2000/03/16 15:12:06  pierre

+ 7 - 2
compiler/tcflw.pas

@@ -554,7 +554,6 @@ implementation
          firstpass(p^.left);
          aktexceptblock:=oldexceptblock;
          set_varstate(p^.left,true);
-
 {$ifdef newcg}
          tg.cleartempgen;
 {$else newcg}
@@ -582,6 +581,9 @@ implementation
 
       begin
          { that's really an example procedure for a firstpass :) }
+         if (p^.excepttype^.deftype<>objectdef) or
+           not(pobjectdef(p^.excepttype)^.is_class) then
+           CGMessage(type_e_mismatch);
 {$ifdef newcg}
          tg.cleartempgen;
 {$else newcg}
@@ -626,7 +628,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.35  2000-02-17 14:53:43  florian
+  Revision 1.36  2000-03-19 14:17:05  florian
+    * crash when using exception classes without sysutils unit fixed
+
+  Revision 1.35  2000/02/17 14:53:43  florian
     * some updates for the newcg
 
   Revision 1.34  2000/02/09 13:23:07  peter