- remove code to create an attribute using a synthetic function

git-svn-id: trunk@42396 -
This commit is contained in:
svenbarth 2019-07-12 22:07:28 +00:00
parent 402728239f
commit a64a8f8deb
4 changed files with 2 additions and 57 deletions

View File

@ -47,7 +47,6 @@ interface
procedure property_dec;
procedure resourcestring_dec(out had_generic:boolean);
procedure parse_rttiattributes(var rtti_attrs_def:trtti_attribute_list);
procedure add_synthetic_rtti_function_declarations(rtti_attrs_def:trtti_attribute_list;name:shortstring);
implementation
@ -519,28 +518,6 @@ implementation
consume(_RECKKLAMMER);
end;
procedure add_synthetic_rtti_function_declarations(rtti_attrs_def:trtti_attribute_list;name:shortstring);
var
i : Integer;
sstate : tscannerstate;
attribute : trtti_attribute;
pd : tprocdef;
begin
name:=StringReplace(name,'.','_',[rfReplaceAll]);
for i:=0 to rtti_attrs_def.get_attribute_count-1 do
begin
attribute:=trtti_attribute(rtti_attrs_def.rtti_attributes[i]);
replace_scanner('rtti_class_attributes',sstate);
if str_parse_method_dec('function rtti_'+name+'_'+IntToStr(i)+':'+ attribute.typesym.Name +';',potype_function,false,tabstractrecorddef(ttypesym(attribute.typesym).typedef),pd) then
pd.synthetickind:=tsk_get_rttiattribute
else
internalerror(2012052601);
pd.skpara:=attribute;
attribute.symbolname:=pd.mangledname;
restore_scanner(sstate);
end;
end;
procedure types_dec(in_structure: boolean;out had_generic:boolean;var rtti_attrs_def: trtti_attribute_list);
function determine_generic_def(name:tidstring):tstoreddef;

View File

@ -465,8 +465,7 @@ type
tsk_field_setter, // Setter for a field (callthrough property is passed in skpara)
tsk_block_invoke_procvar, // Call a procvar to invoke inside a block
tsk_interface_wrapper, // Call through to a method from an interface wrapper
tsk_call_no_parameters, // Call skpara procedure without passing any parameters nor returning a result
tsk_get_rttiattribute // Create and return a TCustomAttribute instance
tsk_call_no_parameters // Call skpara procedure without passing any parameters nor returning a result
);
{ synthetic procdef supplementary information (tprocdef.skpara) }

View File

@ -1025,34 +1025,6 @@ implementation
setverbosity('W+');
end;
function get_attribute_code_block(pd: tprocdef) : tnode;
var
attribute: trtti_attribute;
load: tloadnode;
statement: tstatementnode;
assignment: tassignmentnode;
begin
attribute:=trtti_attribute(pd.skpara);
load := cloadnode.create(pd.funcretsym,pd.funcretsym.Owner);
assignment := cassignmentnode.create(load,Attribute.constructorcall.getcopy);
assignment.resultdef := voidtype;
statement := cstatementnode.Create(assignment,nil);
result := cblocknode.create(statement);
result.resultdef := voidtype;
end;
procedure implement_get_attribute(pd: tprocdef);
var
old_parse_only: boolean;
begin
old_parse_only:=parse_only;
parse_only:=false;
read_proc(po_classmethod in pd.procoptions,pd,false,@get_attribute_code_block);
parse_only:=old_parse_only;
end;
procedure add_synthetic_method_implementations_for_st(st: tsymtable);
var
i : longint;
@ -1143,8 +1115,6 @@ implementation
implement_interface_wrapper(pd);
tsk_call_no_parameters:
implement_call_no_parameters(pd);
tsk_get_rttiattribute:
implement_get_attribute(pd);
end;
end;
end;

View File

@ -959,8 +959,7 @@ implementation
if ((tsym(sym).owner.symtabletype<>localsymtable) or
(tprocdef(tsym(sym).owner.defowner).proctypeoption<>potype_constructor)) and
not (po_noreturn in tprocdef(tsym(sym).owner.defowner).procoptions) and
not(cs_opt_nodedfa in current_settings.optimizerswitches) and
(tprocdef(tsym(sym).owner.defowner).synthetickind <> tsk_get_rttiattribute) then
not(cs_opt_nodedfa in current_settings.optimizerswitches) then
MessagePos(tsym(sym).fileinfo,sym_w_function_result_not_set)
end
else if (tsym(sym).owner.symtabletype=parasymtable) then