Selaa lähdekoodia

--- Merging r13756 into '.':
U compiler/pass_1.pas
--- Merging r13998 through r13999 into '.':
A tests/test/tassignmentoperator1.pp
U compiler/symsym.pas
--- Merging r14003 through r14004 into '.':
A tests/test/tclassinfo1.pp
U tests/test/tassignmentoperator1.pp
U compiler/nobj.pas

git-svn-id: branches/fixes_2_4@15224 -

Jonas Maebe 15 vuotta sitten
vanhempi
commit
347c90070f

+ 2 - 0
.gitattributes

@@ -8255,6 +8255,7 @@ tests/test/tarray6.pp svneol=native#text/plain
 tests/test/tarray7.pp svneol=native#text/plain
 tests/test/tasmread.pp svneol=native#text/plain
 tests/test/tasout.pp svneol=native#text/plain
+tests/test/tassignmentoperator1.pp svneol=native#text/pascal
 tests/test/tbopr.pp svneol=native#text/plain
 tests/test/tbrtlevt.pp svneol=native#text/plain
 tests/test/tcase1.pp svneol=native#text/plain
@@ -8269,6 +8270,7 @@ tests/test/tclass5.pp svneol=native#text/plain
 tests/test/tclass6.pp svneol=native#text/plain
 tests/test/tclass7.pp svneol=native#text/plain
 tests/test/tclass8.pp svneol=native#text/plain
+tests/test/tclassinfo1.pp svneol=native#text/pascal
 tests/test/tclrprop.pp svneol=native#text/plain
 tests/test/tcmp.pp svneol=native#text/plain
 tests/test/tcmp0.pp svneol=native#text/plain

+ 1 - 4
compiler/nobj.pas

@@ -1315,10 +1315,7 @@ implementation
             { pointer to field table }
             current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(fieldtablelabel));
             { pointer to type info of published section }
-            if (oo_can_have_published in _class.objectoptions) then
-              current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(RTTIWriter.get_rtti_label(_class,fullrtti)))
-            else
-              current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil));
+            current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(RTTIWriter.get_rtti_label(_class,fullrtti)));
             { inittable for con-/destruction }
             if _class.members_need_inittable then
               current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(RTTIWriter.get_rtti_label(_class,initrtti)))

+ 9 - 9
compiler/pass_1.pas

@@ -83,10 +83,10 @@ implementation
             begin
                node_changed:=true;
                p.free;
-               { run typecheckpass }
-               typecheckpass(hp);
                { switch to new node }
                p:=hp;
+               { run typecheckpass }
+               typecheckpass(p);
             end;
            current_settings.localswitches:=oldlocalswitches;
            current_filepos:=oldpos;
@@ -164,10 +164,10 @@ implementation
                  if assigned(hp) then
                   begin
                      p.free;
-                     { run typecheckpass }
-                     typecheckpass(hp);
                      { switch to new node }
                      p:=hp;
+                     { run typecheckpass }
+                     typecheckpass(p);
                   end;
                  if codegenerror then
                   begin
@@ -186,10 +186,10 @@ implementation
                  if assigned(hp) then
                   begin
                     p.free;
-                    { run firstpass }
-                    firstpass(hp);
                     { switch to new node }
-                    p:=hp;
+                    p := hp;
+                    { run firstpass }
+                    firstpass(p);
                   end
                  else
                    begin
@@ -199,8 +199,8 @@ implementation
                      if assigned(hp) then
                        begin
                          p.free;
-                         firstpass(hp);
-                         p:=hp;
+                         p := hp;
+                         firstpass(p);
                        end;
                    end;
                  if codegenerror then

+ 8 - 3
compiler/symsym.pas

@@ -712,8 +712,8 @@ implementation
 
     function Tprocsym.Find_procdef_assignment_operator(fromdef,todef:tdef;var besteq:tequaltype):Tprocdef;
       var
-        paraidx,
-        i  : longint;
+        paraidx, realparamcount,
+        i, j : longint;
         bestpd,
         hpd,
         pd : tprocdef;
@@ -747,8 +747,13 @@ implementation
                       assigned(pd.paras[paraidx]) and
                       (vo_is_hidden_para in tparavarsym(pd.paras[paraidx]).varoptions) do
                   inc(paraidx);
+                realparamcount:=0;
+                for j := 0 to pd.paras.Count-1 do
+                  if assigned(pd.paras[j]) and not (vo_is_hidden_para in tparavarsym(pd.paras[j]).varoptions) then
+                    inc(realparamcount);
                 if (paraidx<pd.paras.count) and
-                   assigned(pd.paras[paraidx]) then
+                   assigned(pd.paras[paraidx]) and
+                   (realparamcount = 1) then
                   begin
                     eq:=compare_defs_ext(fromdef,tparavarsym(pd.paras[paraidx]).vardef,nothingn,convtyp,hpd,[]);
 

+ 17 - 0
tests/test/tassignmentoperator1.pp

@@ -0,0 +1,17 @@
+{ %fail }
+program tassignmentoperator1;
+
+{$mode objfpc}
+
+operator := (S1, S2: String): Integer;
+begin
+  Result := Length(S1);
+end;
+
+var
+  S: String;
+  V: Integer;
+begin
+  V := S;
+end.
+

+ 11 - 0
tests/test/tclassinfo1.pp

@@ -0,0 +1,11 @@
+program tclassinfo1;
+
+{$apptype console}
+{$mode objfpc}{$H+}
+uses
+  Classes;
+begin
+  WriteLn(TObject.ClassInfo = TypeInfo(TObject));
+  WriteLn(TPersistent.ClassInfo = TypeInfo(TPersistent));
+end.
+