Selaa lähdekoodia

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

git-svn-id: trunk@36091 -
svenbarth 8 vuotta sitten
vanhempi
commit
b1c66dee9b
1 muutettua tiedostoa jossa 20 lisäystä ja 0 poistoa
  1. 20 0
      compiler/nld.pas

+ 20 - 0
compiler/nld.pas

@@ -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;