From 0b63e89ba290a4df67893b01019c3614f8cb8f1e Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 12 Jul 2019 22:07:15 +0000 Subject: [PATCH] * make the reference to the TCustomAttribute type global git-svn-id: trunk@42393 - --- compiler/pdecl.pas | 11 ++++------- compiler/symdef.pas | 2 ++ compiler/symtable.pas | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index d6eb799e58..748e8e3e16 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -72,14 +72,11 @@ implementation cpuinfo ; - var - system_custom_attribute_def: tobjectdef = nil; - function is_system_custom_attribute_descendant(def:tdef):boolean; begin - if system_custom_attribute_def=nil then - system_custom_attribute_def:=tobjectdef(search_system_type('TCUSTOMATTRIBUTE').typedef); - Result:=def_is_related(def,system_custom_attribute_def); + if not assigned(class_tcustomattribute) then + class_tcustomattribute:=tobjectdef(search_system_type('TCUSTOMATTRIBUTE').typedef); + Result:=def_is_related(def,class_tcustomattribute); end; function readconstant(const orgname:string;const filepos:tfileposinfo; out nodetype: tnodetype):tconstsym; @@ -449,7 +446,7 @@ implementation { Check if the attribute class is related to TCustomAttribute } if not is_system_custom_attribute_descendant(od) then - incompatibletypes(od,system_custom_attribute_def); + incompatibletypes(od,class_tcustomattribute); paran:=read_attr_paras; diff --git a/compiler/symdef.pas b/compiler/symdef.pas index c9c86eb4a3..35b743156d 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -1147,6 +1147,8 @@ interface { pointer to the anchestor of all classes } class_tobject : tobjectdef; + { pointer to the base type for custom attributes } + class_tcustomattribute : tobjectdef; { pointer to the ancestor of all COM interfaces } interface_iunknown : tobjectdef; { pointer to the ancestor of all dispinterfaces } diff --git a/compiler/symtable.pas b/compiler/symtable.pas index 185b69dbf9..08c13f7e87 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -4714,6 +4714,7 @@ implementation {$endif} { set some global vars to nil, might be important for the ide } class_tobject:=nil; + class_tcustomattribute:=nil; interface_iunknown:=nil; interface_idispatch:=nil; rec_tguid:=nil;