Ver código fonte

* changed "optional" field (which denotes whether an objc protocol method is
required or optional) into a procoption flag
* reordered some procdef fields to have less wasted space due to alignment

git-svn-id: branches/objc@14049 -

Jonas Maebe 15 anos atrás
pai
commit
102a2a4796
5 arquivos alterados com 21 adições e 23 exclusões
  1. 1 1
      compiler/nobj.pas
  2. 2 2
      compiler/objcgutl.pas
  3. 2 1
      compiler/pdecsub.pas
  4. 3 1
      compiler/symconst.pas
  5. 13 18
      compiler/symdef.pas

+ 1 - 1
compiler/nobj.pas

@@ -489,7 +489,7 @@ implementation
                   end
                 else
                   if (ImplIntf.IType=etStandard) and
-                     not(tprocdef(def).optional) then
+                     not(po_optional in tprocdef(def).procoptions) then
                     Message1(sym_e_no_matching_implementation_found,tprocdef(def).fullprocname(false));
               end;
           end;

+ 2 - 2
compiler/objcgutl.pas

@@ -966,11 +966,11 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_protocol(list: tasmlist; protocol:
       begin
         proc:=pvmtentry(protocol.vmtentries[i])^.procdef;
         if (po_classmethod in proc.procoptions) then
-          if not proc.optional then
+          if not(po_optional in proc.procoptions) then
             reqclsmlist.Add(proc)
           else
             optclsmlist.Add(proc)
-        else if not proc.optional then
+        else if not(po_optional in proc.procoptions) then
           reqinstmlist.Add(proc)
         else
           optinstmlist.Add(proc);

+ 2 - 1
compiler/pdecsub.pas

@@ -917,7 +917,8 @@ implementation
         { symbol options that need to be kept per procdef }
         pd.fileinfo:=procstartfilepos;
         pd.visibility:=symtablestack.top.currentvisibility;
-        pd.optional:=symtablestack.top.currentlyoptional;
+        if symtablestack.top.currentlyoptional then
+          include(pd.procoptions,po_optional);
 
         { parse parameters }
         if token=_LKLAMMER then

+ 3 - 1
compiler/symconst.pas

@@ -285,7 +285,9 @@ type
     { Objective-C method }
     po_objc,
     { enumerator support }
-    po_enumerator_movenext
+    po_enumerator_movenext,
+    { optional Objective-C protocol method }
+    po_optional
   );
   tprocoptions=set of tprocoption;
 

+ 13 - 18
compiler/symdef.pas

@@ -464,7 +464,6 @@ interface
        public
           messageinf : tmessageinf;
           dispid : longint;
-          extnumber      : word;
 {$ifndef EXTDEBUG}
           { where is this function defined and what were the symbol
             flags, needed here because there
@@ -472,7 +471,6 @@ interface
             EXTDEBUG has fileinfo in tdef (PFV) }
           fileinfo : tfileposinfo;
 {$endif}
-          visibility : tvisibility;
           symoptions : tsymoptions;
           deprecatedmsg : pshortstring;
           { symbol owning this definition }
@@ -493,31 +491,31 @@ interface
 {$endif powerpc or m68k}
           { name of the result variable to insert in the localsymtable }
           resultname : pshortstring;
-          { true, if the procedure is only declared
-            (forward procedure) }
-          forwarddef,
-          { true if the procedure is declared in the interface }
-          interfacedef : boolean;
-          { true if the procedure has a forward declaration }
-          hasforward,
-          { true if the procedure is an optional method in an Objective-C protocol }
-          optional : boolean;
           { import info }
           import_dll,
           import_name : pshortstring;
-          import_nr   : word;
           { info for inlining the subroutine, if this pointer is nil,
             the procedure can't be inlined }
           inlininginfo : pinlininginfo;
 {$ifdef oldregvars}
           regvarinfo: pregvarinfo;
 {$endif oldregvars}
-{$ifdef i386}
-          fpu_used     : byte;
-{$endif i386}
           { position in aasmoutput list }
           procstarttai,
           procendtai   : tai;
+          import_nr    : word;
+          extnumber    : word;
+{$ifdef i386}
+          fpu_used     : byte;
+{$endif i386}
+          visibility   : tvisibility;
+          { true, if the procedure is only declared
+            (forward procedure) }
+          forwarddef,
+          { true if the procedure is declared in the interface }
+          interfacedef : boolean;
+          { true if the procedure has a forward declaration }
+          hasforward  : boolean;
           constructor create(level:byte);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor  destroy;override;
@@ -2965,7 +2963,6 @@ implementation
          forwarddef:=true;
          interfacedef:=false;
          hasforward:=false;
-         optional:=false;
          _class := nil;
          import_dll:=nil;
          import_name:=nil;
@@ -2995,7 +2992,6 @@ implementation
          ppufile.getposinfo(fileinfo);
          visibility:=tvisibility(ppufile.getbyte);
          ppufile.getsmallset(symoptions);
-         optional:=boolean(ppufile.getbyte);
          if sp_has_deprecated_msg in symoptions then
            deprecatedmsg:=stringdup(ppufile.getstring)
          else
@@ -3138,7 +3134,6 @@ implementation
          ppufile.putposinfo(fileinfo);
          ppufile.putbyte(byte(visibility));
          ppufile.putsmallset(symoptions);
-         ppufile.putbyte(byte(optional));
          if sp_has_deprecated_msg in symoptions then
            ppufile.putstring(deprecatedmsg^);
 {$ifdef powerpc}