+ tarrayconstructornode: add utility method has_range_node to check whether the array constructor node tree contains any range node

git-svn-id: trunk@36091 -
This commit is contained in:
svenbarth 2017-05-04 21:16:47 +00:00
parent 4a2266ac44
commit b1c66dee9b

View File

@ -108,6 +108,8 @@ interface
tarrayconstructorrangenodeclass = class of tarrayconstructorrangenode;
tarrayconstructornode = class(tbinarynode)
private
function has_range_node:boolean;
protected
procedure wrapmanagedvarrec(var n: tnode);virtual;abstract;
public
@ -987,6 +989,24 @@ implementation
end;
function tarrayconstructornode.has_range_node:boolean;
var
n : tarrayconstructornode;
begin
result:=false;
n:=self;
while assigned(n) do
begin
if assigned(n.left) and (n.left.nodetype=arrayconstructorrangen) then
begin
result:=true;
break;
end;
n:=tarrayconstructornode(n.right);
end;
end;
function tarrayconstructornode.pass_typecheck:tnode;
var
hdef : tdef;