Browse Source

* fixed displaying of hints such for procedures and functions
(and moved check_hints from pbase to htypechk)

git-svn-id: trunk@2417 -

Jonas Maebe 19 years ago
parent
commit
9fd4e98dad
3 changed files with 26 additions and 27 deletions
  1. 15 0
      compiler/htypechk.pas
  2. 2 18
      compiler/pbase.pas
  3. 9 9
      compiler/pexpr.pas

+ 15 - 0
compiler/htypechk.pas

@@ -149,6 +149,8 @@ interface
 
     function allowenumop(nt:tnodetype):boolean;
 
+    procedure check_hints(const srsym: tsym; const symoptions: tsymoptions);
+
 implementation
 
     uses
@@ -2200,4 +2202,17 @@ implementation
       end;
 
 
+    procedure check_hints(const srsym: tsym; const symoptions: tsymoptions);
+     begin
+       if not assigned(srsym) then
+         exit;
+       if sp_hint_deprecated in symoptions then
+         Message1(sym_w_deprecated_symbol,srsym.realname);
+       if sp_hint_platform in symoptions then
+         Message1(sym_w_non_portable_symbol,srsym.realname);
+       if sp_hint_unimplemented in symoptions then
+         Message1(sym_w_non_implemented_symbol,srsym.realname);
+     end;
+
+
 end.

+ 2 - 18
compiler/pbase.pas

@@ -87,8 +87,6 @@ interface
 
     function try_consume_hintdirective(var symopt:tsymoptions):boolean;
 
-    procedure check_hints(const srsym: tsym);
-
     { just for an accurate position of the end of a procedure (PM) }
     var
        last_endtoken_filepos: tfileposinfo;
@@ -97,7 +95,7 @@ interface
 implementation
 
     uses
-       globtype,scanner,systems,verbose;
+       globtype,htypechk,scanner,systems,verbose;
 
 {****************************************************************************
                                Token Parsing
@@ -177,20 +175,6 @@ implementation
     { check if a symbol contains the hint directive, and if so gives out a hint
       if required.
     }
-    procedure check_hints(const srsym: tsym);
-     begin
-       if not assigned(srsym) then
-         exit;
-       if sp_hint_deprecated in srsym.symoptions then
-         Message1(sym_w_deprecated_symbol,srsym.realname);
-       if sp_hint_platform in srsym.symoptions then
-         Message1(sym_w_non_portable_symbol,srsym.realname);
-       if sp_hint_unimplemented in srsym.symoptions then
-         Message1(sym_w_non_implemented_symbol,srsym.realname);
-     end;
-
-
-
     function consume_sym(var srsym:tsym;var srsymtable:tsymtable):boolean;
       begin
         { first check for identifier }
@@ -203,7 +187,7 @@ implementation
            exit;
          end;
         searchsym(pattern,srsym,srsymtable);
-        check_hints(srsym);
+        check_hints(srsym,srsym.symoptions);
         if assigned(srsym) then
          begin
            if (srsym.typ=unitsym) then

+ 9 - 9
compiler/pexpr.pas

@@ -1159,7 +1159,7 @@ implementation
                         begin
                            static_name:=lower(sym.owner.name^)+'_'+sym.name;
                            searchsym(static_name,sym,srsymtable);
-                           check_hints(sym);
+                           check_hints(sym,sym.symoptions);
                            p1.free;
                            p1:=cloadnode.create(sym,srsymtable);
                         end
@@ -1259,7 +1259,7 @@ implementation
                      begin
                        static_name:=lower(srsym.owner.name^)+'_'+srsym.name;
                        searchsym(static_name,srsym,srsymtable);
-                       check_hints(srsym);
+                       check_hints(srsym,srsym.symoptions);
                      end
                     else
                      begin
@@ -1333,7 +1333,7 @@ implementation
                                  p1:=ctypenode.create(htype);
                                  { search also in inherited methods }
                                  srsym:=searchsym_in_class(tobjectdef(htype.def),pattern);
-                                 check_hints(srsym);
+                                 check_hints(srsym,srsym.symoptions);
                                  consume(_ID);
                                  do_member_read(tobjectdef(htype.def),false,srsym,p1,again,[]);
                                end
@@ -1351,7 +1351,7 @@ 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);
+                              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
@@ -1377,7 +1377,7 @@ 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);
+                                check_hints(srsym,srsym.symoptions);
                                 if not assigned(srsym) then
                                  Message1(sym_e_id_no_member,orgpattern)
                                 else
@@ -1827,7 +1827,7 @@ implementation
                           if token=_ID then
                             begin
                               hsym:=tsym(trecorddef(p1.resulttype.def).symtable.search(pattern));
-                              check_hints(hsym);
+                              check_hints(hsym,hsym.symoptions);
                               if assigned(hsym) and
                                  (hsym.typ=fieldvarsym) then
                                 p1:=csubscriptnode.create(hsym,p1)
@@ -1849,7 +1849,7 @@ implementation
                              begin
                                classh:=tobjectdef(tclassrefdef(p1.resulttype.def).pointertype.def);
                                hsym:=searchsym_in_class(classh,pattern);
-                               check_hints(hsym);
+                               check_hints(hsym,hsym.symoptions);
                                if hsym=nil then
                                  begin
                                    Message1(sym_e_id_no_member,orgpattern);
@@ -1875,7 +1875,7 @@ implementation
                                allow_only_static:=false;
                                classh:=tobjectdef(p1.resulttype.def);
                                hsym:=searchsym_in_class(classh,pattern);
-                               check_hints(hsym);
+                               check_hints(hsym,hsym.symoptions);
                                allow_only_static:=store_static;
                                if hsym=nil then
                                  begin
@@ -2057,7 +2057,7 @@ implementation
                    end;
                   if assigned(sym) then
                    begin
-                     check_hints(sym);
+                     check_hints(sym,sym.symoptions);
                      { load the procdef from the inherited class and
                        not from self }
                      if sym.typ in [procsym,propertysym] then