Browse Source

* set the type of the hidden $vmt parameter to the correct classrefdef and
adjust the parameter comparison code to ignore types of $vmt parameters
when comparing (previously they were all voidpointer and hence also
equal)

git-svn-id: trunk@30955 -

Jonas Maebe 10 years ago
parent
commit
dd3d0ae5bc
3 changed files with 7 additions and 11 deletions
  1. 6 3
      compiler/defcmp.pas
  2. 0 5
      compiler/nld.pas
  3. 1 3
      compiler/pparautl.pas

+ 6 - 3
compiler/defcmp.pas

@@ -2010,15 +2010,18 @@ implementation
                 if (vo_is_hidden_para in currpara1.varoptions)<>(vo_is_hidden_para in currpara2.varoptions) then
                   exit;
                 eq:=te_exact;
-                if not(vo_is_self in currpara1.varoptions) and
-                   not(vo_is_self in currpara2.varoptions) then
+                if (([vo_is_self,vo_is_vmt]*currpara1.varoptions)=[]) and
+                   (([vo_is_self,vo_is_vmt]*currpara2.varoptions)=[]) then
                  begin
                    if not(cpo_ignorevarspez in cpoptions) and
                       (currpara1.varspez<>currpara2.varspez) then
                     exit;
                    eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                         convtype,hpd,cdoptions);
-                 end;
+                 end
+                else if ([vo_is_self,vo_is_vmt]*currpara1.varoptions)<>
+                         ([vo_is_self,vo_is_vmt]*currpara2.varoptions) then
+                   eq:=te_incompatible;
               end
              else
               begin

+ 0 - 5
compiler/nld.pas

@@ -346,11 +346,6 @@ implementation
                       (po_classmethod in tprocdef(symtableentry.owner.defowner).procoptions) then
                      resultdef:=cclassrefdef.create(tprocdef(symtableentry.owner.defowner).struct)
                  end
-               else if vo_is_vmt in tabstractvarsym(symtableentry).varoptions then
-                 begin
-                   resultdef:=tprocdef(symtableentry.owner.defowner).struct;
-                   resultdef:=cclassrefdef.create(resultdef);
-                 end;
              end;
            procsym :
              begin

+ 1 - 3
compiler/pparautl.pas

@@ -225,9 +225,7 @@ implementation
                          (tobjectdef(tprocdef(pd).struct).extendeddef.typ<>objectdef)
                        )) then
                  begin
-                   { can't use classrefdef as type because inheriting
-                     will then always file because of a type mismatch }
-                   vs:=cparavarsym.create('$vmt',paranr_vmt,vs_value,voidpointertype,[vo_is_vmt,vo_is_hidden_para]);
+                   vs:=cparavarsym.create('$vmt',paranr_vmt,vs_value,cclassrefdef.create(tprocdef(pd).struct),[vo_is_vmt,vo_is_hidden_para]);
                    pd.parast.insert(vs);
                  end;