Kaynağa Gözat

* make the reference to the TCustomAttribute type global

git-svn-id: trunk@42393 -
svenbarth 6 yıl önce
ebeveyn
işleme
0b63e89ba2
3 değiştirilmiş dosya ile 7 ekleme ve 7 silme
  1. 4 7
      compiler/pdecl.pas
  2. 2 0
      compiler/symdef.pas
  3. 1 0
      compiler/symtable.pas

+ 4 - 7
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;
 

+ 2 - 0
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 }

+ 1 - 0
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;