* 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 -
This commit is contained in:
Jonas Maebe 2009-11-04 16:29:39 +00:00
parent 559e284bd0
commit 102a2a4796
5 changed files with 21 additions and 23 deletions

View File

@ -489,7 +489,7 @@ implementation
end end
else else
if (ImplIntf.IType=etStandard) and 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)); Message1(sym_e_no_matching_implementation_found,tprocdef(def).fullprocname(false));
end; end;
end; end;

View File

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

View File

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

View File

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

View File

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