Browse Source

Finally fixed the handling of hint directives and added a comment explaining the situation in the context of generics.

git-svn-id: branches/svenbarth/generics@18001 -
svenbarth 14 years ago
parent
commit
bb61abe546
1 changed files with 22 additions and 6 deletions
  1. 22 6
      compiler/pgenutil.pas

+ 22 - 6
compiler/pgenutil.pas

@@ -332,6 +332,15 @@ uses
                 ttypesym(srsym).typedef:=tt;
                 ttypesym(srsym).typedef:=tt;
                 tt.typesym:=srsym;
                 tt.typesym:=srsym;
 
 
+                { Note regarding hint directives:
+                  There is no need to remove the flags for them from the
+                  specialized generic symbol, because hint directives that
+                  follow the specialization are handled by the code in
+                  pdecl.types_dec and added to the type symbol.
+                  E.g.: TFoo = TBar<Blubb> deprecated;
+                  Here the symbol TBar$1$Blubb will contain the
+                  "sp_hint_deprecated" flag while the TFoo symbol won't.}
+
                 case tt.typ of
                 case tt.typ of
                   { Build VMT indexes for classes and read hint directives }
                   { Build VMT indexes for classes and read hint directives }
                   objectdef:
                   objectdef:
@@ -391,15 +400,22 @@ uses
             tundefineddef.create;
             tundefineddef.create;
           end;
           end;
 
 
+        if not (token in [_GT, _RSHARPBRACKET]) then
+          begin
+            consume(_RSHARPBRACKET);
+            exit;
+          end
+        else
+          consume(token);
+
         genericdeflist.free;
         genericdeflist.free;
         generictypelist.free;
         generictypelist.free;
-        if not try_to_consume(_GT) then
-          consume(_RSHARPBRACKET)
-        else
-          if assigned(srsym) then
-            { check the hints of the found generic symbol (this way we are
-              behind the closing ">") }
+        if assigned(genericdef) then
+          begin
+            { check the hints of the found generic symbol }
+            srsym:=genericdef.typesym;
             check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
             check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
+          end;
       end;
       end;