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

* fixed several dispinterface parsing related stuff

git-svn-id: trunk@3373 -
florian 19 лет назад
Родитель
Сommit
91434bd791
4 измененных файлов с 24 добавлено и 11 удалено
  1. 3 2
      compiler/pdecl.pas
  2. 1 1
      compiler/pdecobj.pas
  3. 1 0
      compiler/ptype.pas
  4. 19 8
      compiler/symdef.pas

+ 3 - 2
compiler/pdecl.pas

@@ -455,9 +455,10 @@ implementation
               if (sym.typ=typesym) then
               if (sym.typ=typesym) then
                begin
                begin
                  if ((token=_CLASS) or
                  if ((token=_CLASS) or
-                     (token=_INTERFACE)) and
+                     (token=_INTERFACE) or
+                     (token=_DISPINTERFACE)) and
                     (assigned(ttypesym(sym).restype.def)) and
                     (assigned(ttypesym(sym).restype.def)) and
-                    is_class_or_interface(ttypesym(sym).restype.def) and
+                    is_class_or_interface_or_dispinterface(ttypesym(sym).restype.def) and
                     (oo_is_forward in tobjectdef(ttypesym(sym).restype.def).objectoptions) then
                     (oo_is_forward in tobjectdef(ttypesym(sym).restype.def).objectoptions) then
                   begin
                   begin
                     { we can ignore the result   }
                     { we can ignore the result   }

+ 1 - 1
compiler/pdecobj.pas

@@ -368,7 +368,7 @@ implementation
               aktobjectdef.iidstr:=stringdup(strpas(tstringconstnode(p).value_str)); { or upper? }
               aktobjectdef.iidstr:=stringdup(strpas(tstringconstnode(p).value_str)); { or upper? }
               p.free;
               p.free;
               valid:=string2guid(aktobjectdef.iidstr^,aktobjectdef.iidguid^);
               valid:=string2guid(aktobjectdef.iidstr^,aktobjectdef.iidguid^);
-              if (classtype=odt_interfacecom) and not assigned(aktobjectdef.iidguid) and not valid then
+              if (classtype in [odt_interfacecom,odt_dispinterface]) and not assigned(aktobjectdef.iidguid) and not valid then
                 Message(parser_e_improper_guid_syntax);
                 Message(parser_e_improper_guid_syntax);
             end
             end
           else
           else

+ 1 - 0
compiler/ptype.pas

@@ -685,6 +685,7 @@ implementation
                     aktpackrecords:=oldaktpackrecords;
                     aktpackrecords:=oldaktpackrecords;
                   end;
                   end;
               end;
               end;
+            _DISPINTERFACE,
             _CLASS,
             _CLASS,
             _CPPCLASS,
             _CPPCLASS,
             _INTERFACE,
             _INTERFACE,

+ 19 - 8
compiler/symdef.pas

@@ -735,6 +735,7 @@ interface
     function is_class(def: tdef): boolean;
     function is_class(def: tdef): boolean;
     function is_cppclass(def: tdef): boolean;
     function is_cppclass(def: tdef): boolean;
     function is_class_or_interface(def: tdef): boolean;
     function is_class_or_interface(def: tdef): boolean;
+    function is_class_or_interface_or_dispinterface(def: tdef): boolean;
 
 
 
 
 {$ifdef x86}
 {$ifdef x86}
@@ -4240,7 +4241,7 @@ implementation
         set_parent(c);
         set_parent(c);
         objname:=stringdup(upper(n));
         objname:=stringdup(upper(n));
         objrealname:=stringdup(n);
         objrealname:=stringdup(n);
-        if objecttype in [odt_interfacecorba,odt_interfacecom] then
+        if objecttype in [odt_interfacecorba,odt_interfacecom,odt_dispinterface] then
           prepareguid;
           prepareguid;
         { setup implemented interfaces }
         { setup implemented interfaces }
         if objecttype in [odt_class,odt_interfacecorba] then
         if objecttype in [odt_class,odt_interfacecorba] then
@@ -4270,7 +4271,7 @@ implementation
 
 
          { load guid }
          { load guid }
          iidstr:=nil;
          iidstr:=nil;
-         if objecttype in [odt_interfacecom,odt_interfacecorba] then
+         if objecttype in [odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
            begin
            begin
               new(iidguid);
               new(iidguid);
               ppufile.getguid(iidguid^);
               ppufile.getguid(iidguid^);
@@ -4373,7 +4374,7 @@ implementation
          ppufile.putlongint(vmt_offset);
          ppufile.putlongint(vmt_offset);
          ppufile.putderef(childofderef);
          ppufile.putderef(childofderef);
          ppufile.putsmallset(objectoptions);
          ppufile.putsmallset(objectoptions);
-         if objecttype in [odt_interfacecom,odt_interfacecorba] then
+         if objecttype in [odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
            begin
            begin
               ppufile.putguid(iidguid^);
               ppufile.putguid(iidguid^);
               ppufile.putstring(iidstr^);
               ppufile.putstring(iidstr^);
@@ -4480,7 +4481,7 @@ implementation
              lastvtableindex:=c.lastvtableindex;
              lastvtableindex:=c.lastvtableindex;
              objectoptions:=objectoptions+(c.objectoptions*
              objectoptions:=objectoptions+(c.objectoptions*
                inherited_objectoptions);
                inherited_objectoptions);
-             if not (objecttype in [odt_interfacecom,odt_interfacecorba]) then
+             if not (objecttype in [odt_interfacecom,odt_interfacecorba,odt_dispinterface]) then
                begin
                begin
                   { add the data of the anchestor class }
                   { add the data of the anchestor class }
                   inc(tobjectsymtable(symtable).datasize,tobjectsymtable(c.symtable).datasize);
                   inc(tobjectsymtable(symtable).datasize,tobjectsymtable(c.symtable).datasize);
@@ -4501,7 +4502,7 @@ implementation
 
 
    procedure tobjectdef.insertvmt;
    procedure tobjectdef.insertvmt;
      begin
      begin
-        if objecttype in [odt_interfacecom,odt_interfacecorba] then
+        if objecttype in [odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
           exit;
           exit;
         if (oo_has_vmt in objectoptions) then
         if (oo_has_vmt in objectoptions) then
           internalerror(12345)
           internalerror(12345)
@@ -4524,7 +4525,7 @@ implementation
 
 
    procedure tobjectdef.check_forwards;
    procedure tobjectdef.check_forwards;
      begin
      begin
-        if not(objecttype in [odt_interfacecom,odt_interfacecorba]) then
+        if not(objecttype in [odt_interfacecom,odt_interfacecorba,odt_dispinterface]) then
           tstoredsymtable(symtable).check_forwards;
           tstoredsymtable(symtable).check_forwards;
         if (oo_is_forward in objectoptions) then
         if (oo_is_forward in objectoptions) then
           begin
           begin
@@ -4586,7 +4587,7 @@ implementation
 
 
     function tobjectdef.size : aint;
     function tobjectdef.size : aint;
       begin
       begin
-        if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba] then
+        if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
           result:=sizeof(aint)
           result:=sizeof(aint)
         else
         else
           result:=tobjectsymtable(symtable).datasize;
           result:=tobjectsymtable(symtable).datasize;
@@ -4595,7 +4596,7 @@ implementation
 
 
     function tobjectdef.alignment:shortint;
     function tobjectdef.alignment:shortint;
       begin
       begin
-        if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba] then
+        if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
           alignment:=sizeof(aint)
           alignment:=sizeof(aint)
         else
         else
           alignment:=tobjectsymtable(symtable).recordalignment;
           alignment:=tobjectsymtable(symtable).recordalignment;
@@ -4638,6 +4639,7 @@ implementation
     function tobjectdef.needs_inittable : boolean;
     function tobjectdef.needs_inittable : boolean;
       begin
       begin
          case objecttype of
          case objecttype of
+            odt_dispinterface,
             odt_class :
             odt_class :
               needs_inittable:=false;
               needs_inittable:=false;
             odt_interfacecom:
             odt_interfacecom:
@@ -5498,6 +5500,15 @@ implementation
       end;
       end;
 
 
 
 
+    function is_class_or_interface_or_dispinterface(def: tdef): boolean;
+      begin
+        result:=
+          assigned(def) and
+          (def.deftype=objectdef) and
+          (tobjectdef(def).objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_dispinterface]);
+      end;
+
+
 {$ifdef x86}
 {$ifdef x86}
     function use_sse(def : tdef) : boolean;
     function use_sse(def : tdef) : boolean;
       begin
       begin