Browse Source

compiler: fix is_visible_for_object for nested specialization

git-svn-id: trunk@14243 -
paul 15 years ago
parent
commit
f0c57aa76e
1 changed files with 20 additions and 2 deletions
  1. 20 2
      compiler/symtable.pas

+ 20 - 2
compiler/symtable.pas

@@ -1568,8 +1568,18 @@ implementation
             begin
               { private symbols are allowed when we are in the same
                 module as they are defined }
-              result:=(symownerdef.owner.symtabletype in [globalsymtable,staticsymtable]) and
-                      (symownerdef.owner.iscurrentunit);
+              result:=(
+                       (symownerdef.owner.symtabletype in [globalsymtable,staticsymtable]) and
+                       (symownerdef.owner.iscurrentunit)
+                      ) or
+                      ( // the case of specialize inside the generic declaration
+                       (symownerdef.owner.symtabletype = objectsymtable) and
+                       assigned(current_objectdef) and
+                       (
+                         (current_objectdef=symownerdef) or
+                         (current_objectdef.owner.moduleid=symownerdef.owner.moduleid)
+                       )
+                      );
             end;
           vis_strictprivate :
             begin
@@ -1596,6 +1606,14 @@ implementation
                         (contextobjdef.owner.symtabletype in [globalsymtable,staticsymtable]) and
                         (contextobjdef.owner.iscurrentunit) and
                         contextobjdef.is_related(symownerdef)
+                       ) or
+                       ( // the case of specialize inside the generic declaration
+                        (symownerdef.owner.symtabletype = objectsymtable) and
+                        assigned(current_objectdef) and
+                        (
+                         (current_objectdef=symownerdef) or
+                         (current_objectdef.owner.moduleid=symownerdef.owner.moduleid)
+                        )
                        )
                       );
             end;