Browse Source

Somehow the changes regarding tf_methods_specialized weren't commited, thus here they are again:
* symconst.pas: remove tf_methods_specialized
* psub.pas: remove check for/inclusion of tf_methods_specialized as this isn't needed anymore since the generic is specialized in a temporary symtable

pgenutil.pas: remove merge artifacts

pdecl.pas: fix compilation ("s" was duplicate)

pexpr.pas:
* fix calling of generate_specialization
* disable the goto in sub_expr for now; this will be enabled again once right hand sides work as well

git-svn-id: branches/svenbarth/generics@19675 -

svenbarth 13 years ago
parent
commit
87d9714221
5 changed files with 9 additions and 38 deletions
  1. 0 1
      compiler/pdecl.pas
  2. 8 4
      compiler/pexpr.pas
  3. 0 19
      compiler/pgenutil.pas
  4. 0 5
      compiler/psub.pas
  5. 1 9
      compiler/symconst.pas

+ 0 - 1
compiler/pdecl.pas

@@ -360,7 +360,6 @@ implementation
          generictypelist : TFPObjectList;
          generictypelist : TFPObjectList;
          generictokenbuf : tdynamicarray;
          generictokenbuf : tdynamicarray;
          vmtbuilder : TVMTBuilder;
          vmtbuilder : TVMTBuilder;
-         s : shortstring;
          gendef : tstoreddef;
          gendef : tstoreddef;
          s : shortstring;
          s : shortstring;
       begin
       begin

+ 8 - 4
compiler/pexpr.pas

@@ -3101,7 +3101,7 @@ implementation
                        check_hints(parseddef.typesym,parseddef.typesym.symoptions,parseddef.typesym.deprecatedmsg);
                        check_hints(parseddef.typesym,parseddef.typesym.symoptions,parseddef.typesym.deprecatedmsg);
 
 
                        { generate the specialization }
                        { generate the specialization }
-                       generate_specialization(gendef,false,parseddef,gensym.RealName);
+                       generate_specialization(gendef,false,'',parseddef,gensym.RealName);
 
 
                        { we don't need the old left and right nodes anymore }
                        { we don't need the old left and right nodes anymore }
                        p1.Free;
                        p1.Free;
@@ -3121,8 +3121,12 @@ implementation
                        { with p1 now set we are in reality directly behind the
                        { with p1 now set we are in reality directly behind the
                          call to "factor" thus we need to call down to that
                          call to "factor" thus we need to call down to that
                          again }
                          again }
-                       factornode:=p1;
-                       goto SubExprStart;
+                       { This is disabled until specializations on the right
+                         hand side work as well, because
+                         "not working expressions" is better than "half working
+                         expressions" }
+                       {factornode:=p1;
+                       goto SubExprStart;}
                      end
                      end
                    else
                    else
                      begin
                      begin
@@ -3188,7 +3192,7 @@ implementation
                          Internalerror(2011071401);
                          Internalerror(2011071401);
 
 
                        { generate the specialization }
                        { generate the specialization }
-                       generate_specialization(gendef,false,nil,'');
+                       generate_specialization(gendef,false,'',nil,'');
 
 
                        { we don't need the old p2 anymore }
                        { we don't need the old p2 anymore }
                        p2.Free;
                        p2.Free;

+ 0 - 19
compiler/pgenutil.pas

@@ -326,21 +326,6 @@ uses
             if assigned(hmodule.globalsymtable) then
             if assigned(hmodule.globalsymtable) then
               symtablestack.push(hmodule.globalsymtable);
               symtablestack.push(hmodule.globalsymtable);
 
 
-<<<<<<< HEAD
-            { in case of a parent or an implemented interface the class needs
-              to be inserted in the current unit and not in the class it's
-              used in }
-            { TODO: check whether we are using the correct symtable }
-            if not parse_class_parent then
-              begin
-                { hacky, but necessary to insert the newly generated class properly }
-                item:=oldsymtablestack.stack;
-                while assigned(item) and (item^.symtable.symtablelevel>main_program_level) do
-                  item:=item^.next;
-                if assigned(item) and (item^.symtable<>symtablestack.top) then
-                  symtablestack.push(item^.symtable);
-              end;
-=======
             { push the localsymtable if needed }
             { push the localsymtable if needed }
             if (hmodule<>current_module) or not current_module.in_interface then
             if (hmodule<>current_module) or not current_module.in_interface then
               symtablestack.push(current_module.localsymtable);
               symtablestack.push(current_module.localsymtable);
@@ -351,7 +336,6 @@ uses
               influenced by symbols in the current unit }
               influenced by symbols in the current unit }
             tempst:=tspecializesymtable.create(current_module.modulename^,current_module.moduleid);
             tempst:=tspecializesymtable.create(current_module.modulename^,current_module.moduleid);
             symtablestack.push(tempst);
             symtablestack.push(tempst);
->>>>>>> unique-syms
 
 
             { Reparse the original type definition }
             { Reparse the original type definition }
             if not err then
             if not err then
@@ -439,10 +423,7 @@ uses
                 { Consume the semicolon if it is also recorded }
                 { Consume the semicolon if it is also recorded }
                 try_to_consume(_SEMICOLON);
                 try_to_consume(_SEMICOLON);
 
 
-<<<<<<< HEAD
-=======
                 block_type:=old_block_type;
                 block_type:=old_block_type;
->>>>>>> unique-syms
                 if parse_class_parent then
                 if parse_class_parent then
                   begin
                   begin
                     current_structdef:=old_current_structdef;
                     current_structdef:=old_current_structdef;

+ 0 - 5
compiler/psub.pas

@@ -2010,8 +2010,6 @@ implementation
           i  : longint;
           i  : longint;
           hp : tdef;
           hp : tdef;
         begin
         begin
-          if df_methods_specialized in def.defoptions then
-            Exit;
           for i:=0 to def.symtable.DefList.Count-1 do
           for i:=0 to def.symtable.DefList.Count-1 do
             begin
             begin
               hp:=tdef(def.symtable.DefList[i]);
               hp:=tdef(def.symtable.DefList[i]);
@@ -2042,9 +2040,6 @@ implementation
                  { generate code for subtypes as well }
                  { generate code for subtypes as well }
                  process_abstractrecorddef(tabstractrecorddef(hp));
                  process_abstractrecorddef(tabstractrecorddef(hp));
            end;
            end;
-          { we need to flag the def, so that we know the next time that we
-            already specialized the methods }
-          Include(def.defoptions, df_methods_specialized);
         end;
         end;
 
 
       begin
       begin

+ 1 - 9
compiler/symconst.pas

@@ -184,15 +184,7 @@ type
     { type is a specialization of a generic type }
     { type is a specialization of a generic type }
     df_specialization,
     df_specialization,
     { def has been copied from another def so symtable is not owned }
     { def has been copied from another def so symtable is not owned }
-    df_copied_def,
-    { this flag is set when the methods for a spezialization where already
-      generated; this is for example needed in case of the enumerator in the
-      generic lists of fgl.pp: the enumerator is specialized as part of the
-      surrounding class and if the class and the enumerator are used in the
-      same unit the methods of the enumerator are generated twice, once as part
-      of the class and once as part of the temporary variable that holds the
-      enumerator }
-    df_methods_specialized
+    df_copied_def
   );
   );
   tdefoptions=set of tdefoption;
   tdefoptions=set of tdefoption;