Просмотр исходного кода

Removed old search algorithm

git-svn-id: branches/svenbarth/classhelpers@17242 -
svenbarth 14 лет назад
Родитель
Сommit
16e500ee3c
4 измененных файлов с 0 добавлено и 55 удалено
  1. 0 4
      compiler/parser.pas
  2. 0 8
      compiler/psub.pas
  3. 0 8
      compiler/ptype.pas
  4. 0 35
      compiler/symtable.pas

+ 0 - 4
compiler/parser.pas

@@ -344,11 +344,7 @@ implementation
          Message1(parser_i_compiling,filename);
 
        { reset symtable }
-{$ifdef useoldsearch}
-         symtablestack:=tsymtablestack.create;
-{$else}
          symtablestack:=tdefawaresymtablestack.create;
-{$endif}
          macrosymtablestack:=TSymtablestack.create;
          systemunit:=nil;
          current_settings.defproccall:=init_settings.defproccall;

+ 0 - 8
compiler/psub.pas

@@ -1972,9 +1972,7 @@ implementation
         hp : tdef;
         oldcurrent_filepos : tfileposinfo;
         oldsymtablestack   : tsymtablestack;
-{$ifndef useoldsearch}
         oldextendeddefs    : TFPHashObjectList;
-{$endif}
         pu : tused_unit;
         hmodule : tmodule;
         specobj : tabstractrecorddef;
@@ -1989,13 +1987,9 @@ implementation
         { Setup symtablestack a definition time }
         specobj:=tabstractrecorddef(ttypesym(p).typedef);
         oldsymtablestack:=symtablestack;
-{$ifdef useoldsearch}
-        symtablestack:=tsymtablestack.create;
-{$else}
         oldextendeddefs:=current_module.extendeddefs;
         current_module.extendeddefs:=TFPHashObjectList.create(true);
         symtablestack:=tdefawaresymtablestack.create;
-{$endif}
         if not assigned(specobj.genericdef) then
           internalerror(200705151);
         hmodule:=find_module_from_symtable(specobj.genericdef.owner);
@@ -2042,10 +2036,8 @@ implementation
           end;
 
         { Restore symtablestack }
-{$ifndef useoldsearch}
         current_module.extendeddefs.free;
         current_module.extendeddefs:=oldextendeddefs;
-{$endif}
         symtablestack.free;
         symtablestack:=oldsymtablestack;
       end;

+ 0 - 8
compiler/ptype.pas

@@ -156,9 +156,7 @@ implementation
         generictype : ttypesym;
         generictypelist : TFPObjectList;
         oldsymtablestack   : tsymtablestack;
-{$ifndef useoldsearch}
         oldextendeddefs    : TFPHashObjectList;
-{$endif}
         hmodule : tmodule;
         pu : tused_unit;
         uspecializename,
@@ -295,13 +293,9 @@ implementation
               to get types right, however this is not perfect, we should probably record
               the resolved symbols }
             oldsymtablestack:=symtablestack;
-{$ifdef useoldsearch}
-            symtablestack:=tsymtablestack.create;
-{$else}
             oldextendeddefs:=current_module.extendeddefs;
             current_module.extendeddefs:=TFPHashObjectList.create(true);
             symtablestack:=tdefawaresymtablestack.create;
-{$endif}
             if not assigned(genericdef) then
               internalerror(200705151);
             hmodule:=find_module_from_symtable(genericdef.owner);
@@ -368,10 +362,8 @@ implementation
               end;
 
             { Restore symtablestack }
-{$ifndef useoldsearch}
             current_module.extendeddefs.free;
             current_module.extendeddefs:=oldextendeddefs;
-{$endif}
             symtablestack.free;
             symtablestack:=oldsymtablestack;
           end

+ 0 - 35
compiler/symtable.pas

@@ -2537,46 +2537,12 @@ implementation
 
     function search_last_objectpascal_helper(pd,contextclassh : tabstractrecorddef;out odef : tobjectdef):boolean;
       var
-{$ifdef useoldsearch}
-        stackitem : psymtablestackitem;
-        i : integer;
-        srsymtable : tsymtable;
-{$else}
         s: string;
         list: TFPObjectList;
         i: integer;
         st: tsymtable;
-{$endif}
       begin
         result:=false;
-{$ifdef useoldsearch}
-        stackitem:=symtablestack.stack;
-        while assigned(stackitem) do
-          begin
-            srsymtable:=stackitem^.symtable;
-            { only check symtables that contain a class helper }
-            if (srsymtable.symtabletype in [staticsymtable,globalsymtable]) and
-                (sto_has_helper in srsymtable.tableoptions) then
-              begin
-                { we need to search from last to first }
-                for i:=srsymtable.symlist.count-1 downto 0 do
-                  begin
-                    if not (srsymtable.symlist[i] is ttypesym) then
-                      continue;
-                    if not is_objectpascal_helper(ttypesym(srsymtable.symlist[i]).typedef) then
-                      continue;
-                    odef:=tobjectdef(ttypesym(srsymtable.symlist[i]).typedef);
-                    { does the class helper extend the correct class? }
-                    result:=odef.extendeddef=pd;
-                    if result then
-                      exit
-                    else
-                      odef:=nil;
-                  end;
-              end;
-            stackitem:=stackitem^.next;
-          end;
-{$else}
         { when there are no helpers active currently then we don't need to do
           anything }
         if current_module.extendeddefs.count=0 then
@@ -2607,7 +2573,6 @@ implementation
               { just to be sure that noone uses odef }
               odef:=nil;
           end;
-{$endif}
       end;
 
     function search_objectpascal_helper(pd,contextclassh : tabstractrecorddef;const s: string; out srsym: tsym; out srsymtable: tsymtable):boolean;