mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-16 05:10:34 +01:00
defutil: new is_address() helper
Returns whether a def represents an address
This commit is contained in:
parent
ae36829ecd
commit
2ce4f0baf5
@ -217,6 +217,9 @@ interface
|
||||
{# Returns true if p is any pointer def }
|
||||
function is_pointer(p : tdef) : boolean;
|
||||
|
||||
{# Returns true p is an address: pointer, classref, ansistring, ... }
|
||||
function is_address(p : tdef) : boolean;
|
||||
|
||||
{# Returns true if p is a pchar def }
|
||||
function is_pchar(p : tdef) : boolean;
|
||||
|
||||
@ -982,6 +985,20 @@ implementation
|
||||
is_pointer:=(p.typ=pointerdef);
|
||||
end;
|
||||
|
||||
function is_address(p: tdef): boolean;
|
||||
begin
|
||||
is_address:=
|
||||
(p.typ in [classrefdef,formaldef,undefineddef,procdef]) or
|
||||
is_pointer(p) or
|
||||
is_implicit_array_pointer(p) or
|
||||
is_implicit_pointer_object_type(p) or
|
||||
((p.typ=procvardef) and
|
||||
(tprocvardef(p).is_addressonly or
|
||||
is_block(p)
|
||||
)
|
||||
)
|
||||
end;
|
||||
|
||||
{ true if p is a pchar def }
|
||||
function is_pchar(p : tdef) : boolean;
|
||||
begin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user