mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-22 12:49:19 +02:00
* moved handle_staticfield_access() from pexpr to nutils so it can
be reused elsewhere * moved check_hints() from htypechk to symsym (so it can be called from nutils, and it's also more about symbols than about types) git-svn-id: branches/jvmbackend@18722 -
This commit is contained in:
parent
dbe55d1f6f
commit
1c74072748
@ -170,8 +170,6 @@ interface
|
||||
|
||||
function allowenumop(nt:tnodetype):boolean;
|
||||
|
||||
procedure check_hints(const srsym: tsym; const symoptions: tsymoptions; const deprecatedmsg : pshortstring);
|
||||
|
||||
procedure check_ranges(const location: tfileposinfo; source: tnode; destdef: tdef);
|
||||
|
||||
implementation
|
||||
@ -2942,26 +2940,6 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure check_hints(const srsym: tsym; const symoptions: tsymoptions; const deprecatedmsg : pshortstring);
|
||||
begin
|
||||
if not assigned(srsym) then
|
||||
internalerror(200602051);
|
||||
if sp_hint_deprecated in symoptions then
|
||||
if (sp_has_deprecated_msg in symoptions) and (deprecatedmsg <> nil) then
|
||||
Message2(sym_w_deprecated_symbol_with_msg,srsym.realname,deprecatedmsg^)
|
||||
else
|
||||
Message1(sym_w_deprecated_symbol,srsym.realname);
|
||||
if sp_hint_experimental in symoptions then
|
||||
Message1(sym_w_experimental_symbol,srsym.realname);
|
||||
if sp_hint_platform in symoptions then
|
||||
Message1(sym_w_non_portable_symbol,srsym.realname);
|
||||
if sp_hint_library in symoptions then
|
||||
Message1(sym_w_library_symbol,srsym.realname);
|
||||
if sp_hint_unimplemented in symoptions then
|
||||
Message1(sym_w_non_implemented_symbol,srsym.realname);
|
||||
end;
|
||||
|
||||
|
||||
procedure check_ranges(const location: tfileposinfo; source: tnode; destdef: tdef);
|
||||
begin
|
||||
if not(cs_check_ordinal_size in current_settings.localswitches) then
|
||||
|
@ -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
|
||||
|
@ -1026,36 +1026,6 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
{ 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;
|
||||
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;
|
||||
|
||||
|
||||
{ the following procedure handles the access to a property symbol }
|
||||
procedure handle_propertysym(propsym : tpropertysym;st : TSymtable;var p1 : tnode);
|
||||
var
|
||||
|
@ -343,6 +343,7 @@ interface
|
||||
{ generate internal static field name based on regular field name }
|
||||
function internal_static_field_name(const fieldname: TSymStr): TSymStr;
|
||||
|
||||
procedure check_hints(const srsym: tsym; const symoptions: tsymoptions; const deprecatedmsg : pshortstring);
|
||||
|
||||
implementation
|
||||
|
||||
@ -375,6 +376,28 @@ implementation
|
||||
result:='$_static_'+fieldname;
|
||||
end;
|
||||
|
||||
|
||||
procedure check_hints(const srsym: tsym; const symoptions: tsymoptions; const deprecatedmsg : pshortstring);
|
||||
begin
|
||||
if not assigned(srsym) then
|
||||
internalerror(200602051);
|
||||
if sp_hint_deprecated in symoptions then
|
||||
if (sp_has_deprecated_msg in symoptions) and (deprecatedmsg <> nil) then
|
||||
Message2(sym_w_deprecated_symbol_with_msg,srsym.realname,deprecatedmsg^)
|
||||
else
|
||||
Message1(sym_w_deprecated_symbol,srsym.realname);
|
||||
if sp_hint_experimental in symoptions then
|
||||
Message1(sym_w_experimental_symbol,srsym.realname);
|
||||
if sp_hint_platform in symoptions then
|
||||
Message1(sym_w_non_portable_symbol,srsym.realname);
|
||||
if sp_hint_library in symoptions then
|
||||
Message1(sym_w_library_symbol,srsym.realname);
|
||||
if sp_hint_unimplemented in symoptions then
|
||||
Message1(sym_w_non_implemented_symbol,srsym.realname);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
TSYM (base for all symtypes)
|
||||
****************************************************************************}
|
||||
|
Loading…
Reference in New Issue
Block a user