diff --git a/compiler/nobj.pas b/compiler/nobj.pas index c881c5c440..3768c199c3 100644 --- a/compiler/nobj.pas +++ b/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; diff --git a/compiler/objcgutl.pas b/compiler/objcgutl.pas index b39df48df7..2df9fb90b4 100644 --- a/compiler/objcgutl.pas +++ b/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); diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index 764d26b900..1f7f713125 100644 --- a/compiler/pdecsub.pas +++ b/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 diff --git a/compiler/symconst.pas b/compiler/symconst.pas index fc6367914d..fa8761e934 100644 --- a/compiler/symconst.pas +++ b/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; diff --git a/compiler/symdef.pas b/compiler/symdef.pas index ea248e9009..74a8c3f385 100644 --- a/compiler/symdef.pas +++ b/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}