|
@@ -95,6 +95,10 @@ interface
|
|
|
procedure propaccesslist_to_node(var p1:tnode;st:TSymtable;pl:tpropaccesslist);
|
|
|
function node_to_propaccesslist(p1:tnode):tpropaccesslist;
|
|
|
|
|
|
+ { checks whether sym is a static field and if so, translates the access
|
|
|
+ to the appropriate node tree }
|
|
|
+ function handle_staticfield_access(sym: tsym; nested: boolean; var p1: tnode): boolean;
|
|
|
+
|
|
|
{ returns true if n is an array element access of a bitpacked array with
|
|
|
elements of the which the vitsize mod 8 <> 0, or if is a field access
|
|
|
with bitsize mod 8 <> 0 or bitoffset mod 8 <> 0 of an element in a
|
|
@@ -994,6 +998,34 @@ implementation
|
|
|
end;
|
|
|
|
|
|
|
|
|
+ function handle_staticfield_access(sym: tsym; nested: boolean; var p1: tnode): boolean;
|
|
|
+ var
|
|
|
+ static_name: shortstring;
|
|
|
+ srsymtable: tsymtable;
|
|
|
+ begin
|
|
|
+ result:=false;
|
|
|
+ { generate access code }
|
|
|
+ if (sp_static in sym.symoptions) then
|
|
|
+ begin
|
|
|
+ result:=true;
|
|
|
+ if not nested then
|
|
|
+ static_name:=lower(sym.owner.name^)+'_'+sym.name
|
|
|
+ else
|
|
|
+ static_name:=lower(generate_nested_name(sym.owner,'_'))+'_'+sym.name;
|
|
|
+ if sym.owner.defowner.typ=objectdef then
|
|
|
+ searchsym_in_class(tobjectdef(sym.owner.defowner),tobjectdef(sym.owner.defowner),static_name,sym,srsymtable,true)
|
|
|
+ else
|
|
|
+ searchsym_in_record(trecorddef(sym.owner.defowner),static_name,sym,srsymtable);
|
|
|
+ if assigned(sym) then
|
|
|
+ check_hints(sym,sym.symoptions,sym.deprecatedmsg);
|
|
|
+ p1.free;
|
|
|
+ p1:=nil;
|
|
|
+ { static syms are always stored as absolutevarsym to handle scope and storage properly }
|
|
|
+ propaccesslist_to_node(p1,nil,tabsolutevarsym(sym).ref);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
function is_bitpacked_access(n: tnode): boolean;
|
|
|
begin
|
|
|
case n.nodetype of
|