mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-06 08:47:10 +01:00
* fix code formatting (no code changes)
git-svn-id: trunk@42376 -
This commit is contained in:
parent
3ad24c9db8
commit
f1715ff337
@ -46,8 +46,8 @@ interface
|
|||||||
procedure threadvar_dec(out had_generic:boolean);
|
procedure threadvar_dec(out had_generic:boolean);
|
||||||
procedure property_dec;
|
procedure property_dec;
|
||||||
procedure resourcestring_dec(out had_generic:boolean);
|
procedure resourcestring_dec(out had_generic:boolean);
|
||||||
procedure parse_rttiattributes(var rtti_attrs_def: trtti_attribute_list);
|
procedure parse_rttiattributes(var rtti_attrs_def:trtti_attribute_list);
|
||||||
procedure add_synthetic_rtti_function_declarations(rtti_attrs_def: trtti_attribute_list; name: shortstring);
|
procedure add_synthetic_rtti_function_declarations(rtti_attrs_def:trtti_attribute_list;name:shortstring);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ implementation
|
|||||||
consume(_SEMICOLON);
|
consume(_SEMICOLON);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function find_create_constructor(objdef: tobjectdef): tsymentry;
|
function find_create_constructor(objdef:tobjectdef):tsymentry;
|
||||||
begin
|
begin
|
||||||
while assigned(objdef) do
|
while assigned(objdef) do
|
||||||
begin
|
begin
|
||||||
@ -411,73 +411,73 @@ implementation
|
|||||||
internalerror(2012111101);
|
internalerror(2012111101);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure parse_rttiattributes(var rtti_attrs_def: trtti_attribute_list);
|
procedure parse_rttiattributes(var rtti_attrs_def:trtti_attribute_list);
|
||||||
var
|
var
|
||||||
p, p1: tnode;
|
p, p1 : tnode;
|
||||||
again: boolean;
|
again : boolean;
|
||||||
od: tobjectdef;
|
od : tobjectdef;
|
||||||
constrSym: tsymentry;
|
constrSym : tsymentry;
|
||||||
constrProcDef: tprocdef;
|
constrProcDef : tprocdef;
|
||||||
typeSym: ttypesym;
|
typeSym : ttypesym;
|
||||||
oldblock_type: tblock_type;
|
oldblock_type : tblock_type;
|
||||||
begin
|
begin
|
||||||
consume(_LECKKLAMMER);
|
consume(_LECKKLAMMER);
|
||||||
|
|
||||||
{ Parse attribute type }
|
{ Parse attribute type }
|
||||||
p := factor(false,[ef_type_only,ef_check_attr_suffix]);
|
p:=factor(false,[ef_type_only,ef_check_attr_suffix]);
|
||||||
if p.nodetype<> errorn then
|
if p.nodetype<>errorn then
|
||||||
begin
|
|
||||||
typeSym := ttypesym(ttypenode(p).typesym);
|
|
||||||
od := tobjectdef(ttypenode(p).typedef);
|
|
||||||
if Assigned(od) then
|
|
||||||
begin
|
begin
|
||||||
{ Check if the attribute class is related to TCustomAttribute }
|
typeSym:=ttypesym(ttypenode(p).typesym);
|
||||||
if not is_system_custom_attribute_descendant(od) then
|
od:=tobjectdef(ttypenode(p).typedef);
|
||||||
incompatibletypes(od, system_custom_attribute_def);
|
if Assigned(od) then
|
||||||
|
begin
|
||||||
|
{ Check if the attribute class is related to TCustomAttribute }
|
||||||
|
if not is_system_custom_attribute_descendant(od) then
|
||||||
|
incompatibletypes(od, system_custom_attribute_def);
|
||||||
|
|
||||||
{ Search the tprocdef of the constructor which has to be called. }
|
{ Search the tprocdef of the constructor which has to be called. }
|
||||||
constrSym := find_create_constructor(od);
|
constrSym:=find_create_constructor(od);
|
||||||
if constrSym.typ<>procsym then
|
if constrSym.typ<>procsym then
|
||||||
internalerror(2018102301);
|
internalerror(2018102301);
|
||||||
constrProcDef:=tprocsym(constrSym).find_procdef_bytype(potype_constructor);
|
constrProcDef:=tprocsym(constrSym).find_procdef_bytype(potype_constructor);
|
||||||
|
|
||||||
{ Parse the attribute-parameters as if it is a list of parameters from
|
{ Parse the attribute-parameters as if it is a list of parameters from
|
||||||
a call to the constrProcDef constructor in an execution-block. }
|
a call to the constrProcDef constructor in an execution-block. }
|
||||||
p1 := cloadvmtaddrnode.create(ctypenode.create(od));
|
p1:=cloadvmtaddrnode.create(ctypenode.create(od));
|
||||||
again:=true;
|
again:=true;
|
||||||
oldblock_type := block_type;
|
oldblock_type:=block_type;
|
||||||
block_type := bt_body;
|
block_type:=bt_body;
|
||||||
do_member_read(od,false,constrProcDef.procsym,p1,again,[], nil);
|
do_member_read(od,false,constrProcDef.procsym,p1,again,[], nil);
|
||||||
|
|
||||||
{ Check the number of parameters }
|
{ Check the number of parameters }
|
||||||
if (tcallnode(p1).para_count < constrProcDef.minparacount) then
|
if (tcallnode(p1).para_count<constrProcDef.minparacount) then
|
||||||
CGMessagePos1(p.fileinfo, parser_e_wrong_parameter_size, od.typename + '.' + constrProcDef.procsym.prettyname);
|
CGMessagePos1(p.fileinfo,parser_e_wrong_parameter_size,od.typename+'.'+constrProcDef.procsym.prettyname);
|
||||||
|
|
||||||
block_type:=oldblock_type;
|
block_type:=oldblock_type;
|
||||||
|
|
||||||
{ Add attribute to attribute list which will be added
|
{ Add attribute to attribute list which will be added
|
||||||
to the property which is defined next. }
|
to the property which is defined next. }
|
||||||
if not assigned(rtti_attrs_def) then
|
if not assigned(rtti_attrs_def) then
|
||||||
rtti_attrs_def := trtti_attribute_list.create;
|
rtti_attrs_def:=trtti_attribute_list.create;
|
||||||
rtti_attrs_def.addattribute(typeSym,p1);
|
rtti_attrs_def.addattribute(typeSym,p1);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
p.free;
|
p.free;
|
||||||
consume(_RECKKLAMMER);
|
consume(_RECKKLAMMER);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure add_synthetic_rtti_function_declarations(rtti_attrs_def: trtti_attribute_list; name: shortstring);
|
procedure add_synthetic_rtti_function_declarations(rtti_attrs_def:trtti_attribute_list;name:shortstring);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i : Integer;
|
||||||
sstate: tscannerstate;
|
sstate : tscannerstate;
|
||||||
attribute: trtti_attribute;
|
attribute : trtti_attribute;
|
||||||
pd: tprocdef;
|
pd : tprocdef;
|
||||||
begin
|
begin
|
||||||
name := StringReplace(name, '.', '_', [rfReplaceAll]);
|
name:=StringReplace(name,'.','_',[rfReplaceAll]);
|
||||||
for i := 0 to rtti_attrs_def.get_attribute_count-1 do
|
for i:=0 to rtti_attrs_def.get_attribute_count-1 do
|
||||||
begin
|
begin
|
||||||
attribute := trtti_attribute(rtti_attrs_def.rtti_attributes[i]);
|
attribute:=trtti_attribute(rtti_attrs_def.rtti_attributes[i]);
|
||||||
replace_scanner('rtti_class_attributes',sstate);
|
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
|
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
|
pd.synthetickind:=tsk_get_rttiattribute
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user