Jelajahi Sumber

* more check_hints fixes

git-svn-id: trunk@2445 -
peter 19 tahun lalu
induk
melakukan
301042c824
2 mengubah file dengan 34 tambahan dan 23 penghapusan
  1. 1 1
      compiler/htypechk.pas
  2. 33 22
      compiler/pexpr.pas

+ 1 - 1
compiler/htypechk.pas

@@ -2205,7 +2205,7 @@ implementation
     procedure check_hints(const srsym: tsym; const symoptions: tsymoptions);
      begin
        if not assigned(srsym) then
-         exit;
+         internalerror(200602051);
        if sp_hint_deprecated in symoptions then
          Message1(sym_w_deprecated_symbol,srsym.realname);
        if sp_hint_platform in symoptions then

+ 33 - 22
compiler/pexpr.pas

@@ -1159,7 +1159,8 @@ implementation
                         begin
                            static_name:=lower(sym.owner.name^)+'_'+sym.name;
                            searchsym(static_name,sym,srsymtable);
-                           check_hints(sym,sym.symoptions);
+			   if assigned(sym) then
+                             check_hints(sym,sym.symoptions);
                            p1.free;
                            p1:=cloadnode.create(sym,srsymtable);
                         end
@@ -1259,7 +1260,8 @@ implementation
                      begin
                        static_name:=lower(srsym.owner.name^)+'_'+srsym.name;
                        searchsym(static_name,srsym,srsymtable);
-                       check_hints(srsym,srsym.symoptions);
+		       if assigned(srsym) then
+                         check_hints(srsym,srsym.symoptions);
                      end
                     else
                      begin
@@ -1333,7 +1335,8 @@ implementation
                                  p1:=ctypenode.create(htype);
                                  { search also in inherited methods }
                                  srsym:=searchsym_in_class(tobjectdef(htype.def),pattern);
-                                 check_hints(srsym,srsym.symoptions);
+				 if assigned(srsym) then
+                                   check_hints(srsym,srsym.symoptions);
                                  consume(_ID);
                                  do_member_read(tobjectdef(htype.def),false,srsym,p1,again,[]);
                                end
@@ -1351,16 +1354,19 @@ implementation
                               { TP allows also @TMenu.Load if Load is only }
                               { defined in an anchestor class              }
                               srsym:=search_class_member(tobjectdef(htype.def),pattern);
-                              check_hints(srsym,srsym.symoptions);
-                              if not assigned(srsym) then
-                               Message1(sym_e_id_no_member,orgpattern)
-                              else if not(getaddr) and not(sp_static in srsym.symoptions) then
-                               Message(sym_e_only_static_in_static)
-                              else
-                               begin
-                                 consume(_ID);
-                                 do_member_read(tobjectdef(htype.def),getaddr,srsym,p1,again,[]);
-                               end;
+                              if assigned(srsym) then
+			        begin
+                                  check_hints(srsym,srsym.symoptions);
+  				  if not(getaddr) and not(sp_static in srsym.symoptions) then
+                                    Message(sym_e_only_static_in_static)
+                                  else
+                                    begin
+                                      consume(_ID);
+                                      do_member_read(tobjectdef(htype.def),getaddr,srsym,p1,again,[]);
+				    end;  
+                                end
+			      else	
+                                Message1(sym_e_id_no_member,orgpattern);
                             end;
                          end
                        else
@@ -1377,14 +1383,17 @@ implementation
                                 { TP allows also @TMenu.Load if Load is only }
                                 { defined in an anchestor class              }
                                 srsym:=search_class_member(tobjectdef(htype.def),pattern);
-                                check_hints(srsym,srsym.symoptions);
-                                if not assigned(srsym) then
-                                 Message1(sym_e_id_no_member,orgpattern)
-                                else
+                                if assigned(srsym) then
                                  begin
+                                   check_hints(srsym,srsym.symoptions);
                                    consume(_ID);
                                    do_member_read(tobjectdef(htype.def),getaddr,srsym,p1,again,[]);
-                                 end;
+                                 end
+				else 
+				 begin
+                                   Message1(sym_e_id_no_member,orgpattern);
+                                   consume(_ID);
+				 end;
                               end
                              else
                               begin
@@ -1827,10 +1836,12 @@ implementation
                           if token=_ID then
                             begin
                               hsym:=tsym(trecorddef(p1.resulttype.def).symtable.search(pattern));
-                              check_hints(hsym,hsym.symoptions);
                               if assigned(hsym) and
                                  (hsym.typ=fieldvarsym) then
-                                p1:=csubscriptnode.create(hsym,p1)
+				begin 
+                                  check_hints(hsym,hsym.symoptions);
+                                  p1:=csubscriptnode.create(hsym,p1)
+				end  
                               else
                                 begin
                                   Message1(sym_e_illegal_field,pattern);
@@ -1849,7 +1860,6 @@ implementation
                              begin
                                classh:=tobjectdef(tclassrefdef(p1.resulttype.def).pointertype.def);
                                hsym:=searchsym_in_class(classh,pattern);
-                               check_hints(hsym,hsym.symoptions);
                                if hsym=nil then
                                  begin
                                    Message1(sym_e_id_no_member,orgpattern);
@@ -1860,6 +1870,7 @@ implementation
                                  end
                                else
                                  begin
+                                   check_hints(hsym,hsym.symoptions);
                                    consume(_ID);
                                    do_member_read(classh,getaddr,hsym,p1,again,[]);
                                  end;
@@ -1875,7 +1886,6 @@ implementation
                                allow_only_static:=false;
                                classh:=tobjectdef(p1.resulttype.def);
                                hsym:=searchsym_in_class(classh,pattern);
-                               check_hints(hsym,hsym.symoptions);
                                allow_only_static:=store_static;
                                if hsym=nil then
                                  begin
@@ -1887,6 +1897,7 @@ implementation
                                  end
                                else
                                  begin
+                                    check_hints(hsym,hsym.symoptions);
                                     consume(_ID);
                                     do_member_read(classh,getaddr,hsym,p1,again,[]);
                                  end;