浏览代码

* corrected wrong error message of a member of a class/object/classref wasn't found

florian 25 年之前
父节点
当前提交
6c3bbb7915
共有 1 个文件被更改,包括 46 次插入19 次删除
  1. 46 19
      compiler/pexpr.pas

+ 46 - 19
compiler/pexpr.pas

@@ -1458,27 +1458,51 @@ unit pexpr;
                                  break;
                                 classh:=classh^.childof;
                               end;
-                             consume(_ID);
-                             do_member_read(getaddr,sym,p1,pd,again);
+                              if sym=nil then
+                                begin
+                                   Message1(sym_e_id_no_member,pattern);
+                                   disposetree(p1);
+                                   p1:=genzeronode(errorn);
+                                   { try to clean up }
+                                   pd:=generrordef;
+                                   consume(_ID);
+                                end
+                              else
+                                begin
+                                   consume(_ID);
+                                   do_member_read(getaddr,sym,p1,pd,again);
+                                end;
                            end;
 
                          objectdef:
                            begin
-                             classh:=pobjectdef(pd);
-                             sym:=nil;
-                             store_static:=allow_only_static;
-                             allow_only_static:=false;
-                             while assigned(classh) do
-                              begin
-                                sym:=pvarsym(classh^.symtable^.search(pattern));
-                                srsymtable:=classh^.symtable;
-                                if assigned(sym) then
-                                 break;
-                                classh:=classh^.childof;
-                              end;
-                             allow_only_static:=store_static;
-                             consume(_ID);
-                             do_member_read(getaddr,sym,p1,pd,again);
+                              classh:=pobjectdef(pd);
+                              sym:=nil;
+                              store_static:=allow_only_static;
+                              allow_only_static:=false;
+                              while assigned(classh) do
+                                begin
+                                   sym:=pvarsym(classh^.symtable^.search(pattern));
+                                   srsymtable:=classh^.symtable;
+                                   if assigned(sym) then
+                                     break;
+                                   classh:=classh^.childof;
+                                end;
+                              allow_only_static:=store_static;
+                              if sym=nil then
+                                begin
+                                   Message1(sym_e_id_no_member,pattern);
+                                   disposetree(p1);
+                                   p1:=genzeronode(errorn);
+                                   { try to clean up }
+                                   pd:=generrordef;
+                                   consume(_ID);
+                                end
+                              else
+                                begin
+                                   consume(_ID);
+                                   do_member_read(getaddr,sym,p1,pd,again);
+                                end;
                            end;
 
                          pointerdef:
@@ -2100,7 +2124,10 @@ _LECKKLAMMER : begin
 end.
 {
   $Log$
-  Revision 1.166  2000-01-09 23:16:05  peter
+  Revision 1.167  2000-01-19 22:41:58  florian
+    * corrected wrong error message of a member of a class/object/classref wasn't found
+
+  Revision 1.166  2000/01/09 23:16:05  peter
     * added st_default stringtype
     * genstringconstnode extended with stringtype parameter using st_default
       will do the old behaviour
@@ -2228,4 +2255,4 @@ end.
   Revision 1.134  1999/08/09 22:16:29  peter
     * fixed crash after wrong para's with class contrustor
 
-}
+}