Browse Source

compiler: redo searchsym_type:
- remove complex condition which was used previosly to decide whether objectsymtable or recordsymtable requires a search for type or not - they require a search because contains types (although not all object types)
- don't search only for typesym but for other symbols too - for example UnitSym.TypeSym or ConstSym..ConstSym are also valid types. Skip the next symtypes during the search because they can't be used in type declaration: fieldvarsym, paravarsym, propertysym, procsym, labelsym

git-svn-id: branches/paul/extended_records@16531 -

paul 14 years ago
parent
commit
4640d096c4
1 changed files with 5 additions and 16 deletions
  1. 5 16
      compiler/symtable.pas

+ 5 - 16
compiler/symtable.pas

@@ -1900,7 +1900,7 @@ implementation
                     srsymtable:=classh.symtable;
                     srsym:=tsym(srsymtable.FindWithHash(hashedid));
                     if assigned(srsym) and
-                       (srsym.typ=typesym) and
+                       not(srsym.typ in [fieldvarsym,paravarsym,propertysym,procsym,labelsym]) and
                        is_visible_for_object(srsym,current_structdef) then
                       begin
                         addsymref(srsym);
@@ -1911,23 +1911,12 @@ implementation
                   end;
               end
             else
-            if not(srsymtable.symtabletype in [recordsymtable,ObjectSymtable,parasymtable]) or
-               (assigned(srsymtable.defowner) and
-                (
-                 (df_generic in tdef(srsymtable.defowner).defoptions) or
-                 (df_specialization in tdef(srsymtable.defowner).defoptions) or
-                 is_class_or_object(tdef(srsymtable.defowner)) or
-                 is_record(tdef(srsymtable.defowner))
-                )
-               ) then
+            if srsymtable.symtabletype<>parasymtable then
               begin
                 srsym:=tsym(srsymtable.FindWithHash(hashedid));
-                if assigned(srsym) and
-                   not(srsym.typ in [fieldvarsym,paravarsym]) and
-                   (
-                    not (srsym.owner.symtabletype in [objectsymtable,recordsymtable]) or
-                    ((srsym.typ=typesym)and is_visible_for_object(srsym,current_structdef))
-                   ) then
+                if assigned(srsym) and 
+                   not(srsym.typ in [fieldvarsym,paravarsym,propertysym,procsym,labelsym]) and
+                   (not (srsym.owner.symtabletype in [objectsymtable,recordsymtable]) or is_visible_for_object(srsym,current_structdef)) then
                   begin
                     { we need to know if a procedure references symbols
                       in the static symtable, because then it can't be