compiler: write correct method kind for constructors,destructors and class methods

git-svn-id: trunk@14512 -
This commit is contained in:
paul 2010-01-01 20:22:02 +00:00
parent db0f23e643
commit c83fc67e32
2 changed files with 24 additions and 7 deletions

View File

@ -697,11 +697,28 @@ implementation
if (tf_requires_proper_alignment in target_info.flags) then if (tf_requires_proper_alignment in target_info.flags) then
current_asmdata.asmlists[al_rtti].concat(cai_align.Create(sizeof(TConstPtrUInt))); current_asmdata.asmlists[al_rtti].concat(cai_align.Create(sizeof(TConstPtrUInt)));
{ write kind of method (can only be function or procedure)} { write kind of method }
if def.returndef = voidtype then case def.proctypeoption of
methodkind := mkProcedure potype_constructor: methodkind:=mkConstructor;
potype_destructor: methodkind:=mkDestructor;
potype_procedure:
if po_classmethod in def.procoptions then
methodkind:=mkClassProcedure
else
methodkind:=mkProcedure;
potype_function:
if po_classmethod in def.procoptions then
methodkind:=mkClassFunction
else
methodkind:=mkFunction;
else else
methodkind := mkFunction; begin
if def.returndef = voidtype then
methodkind:=mkProcedure
else
methodkind:=mkFunction;
end;
end;
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(methodkind)); current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(methodkind));
{ write parameter info. The parameters must be written in reverse order { write parameter info. The parameters must be written in reverse order
@ -711,7 +728,7 @@ implementation
for i:=0 to def.paras.count-1 do for i:=0 to def.paras.count-1 do
write_para(tparavarsym(def.paras[i])); write_para(tparavarsym(def.paras[i]));
if methodkind=mkFunction then if (methodkind=mkFunction) or (methodkind=mkClassFunction) then
begin begin
{ write name of result type } { write name of result type }
write_rtti_name(def.returndef); write_rtti_name(def.returndef);

View File

@ -137,8 +137,8 @@ unit typinfo;
TypeName : ShortString; TypeName : ShortString;
end; end;
followed by followed by
ResultType : ShortString // for mkFunction only ResultType : ShortString // for mkFunction, mkClassFunction only
ResultTypeRef : PPTypeInfo; // for mkFunction only ResultTypeRef : PPTypeInfo; // for mkFunction, mkClassFunction only
CC : TCallConv; CC : TCallConv;
ParamTypeRefs : array[1..ParamCount] of PPTypeInfo;} ParamTypeRefs : array[1..ParamCount] of PPTypeInfo;}
); );