소스 검색

+ added method TCGPara.locations_count

git-svn-id: trunk@24530 -
nickysn 12 년 전
부모
커밋
3e22ec43b5
1개의 변경된 파일17개의 추가작업 그리고 0개의 파일을 삭제
  1. 17 0
      compiler/parabase.pas

+ 17 - 0
compiler/parabase.pas

@@ -72,6 +72,8 @@ unit parabase;
              register : tregister);
        end;
 
+       { TCGPara }
+
        TCGPara = object
           Def       : tdef; { Type of the parameter }
           Location  : PCGParalocation;
@@ -88,6 +90,7 @@ unit parabase;
           procedure   check_simple_location;
           function    add_location:pcgparalocation;
           procedure   get_location(var newloc:tlocation);
+          function    locations_count:integer;
 
           procedure   buildderef;
           procedure   deref;
@@ -257,6 +260,20 @@ implementation
       end;
 
 
+    function TCGPara.locations_count: integer;
+      var
+        hlocation: pcgparalocation;
+      begin
+        result:=0;
+        hlocation:=location;
+        while assigned(hlocation) do
+          begin
+            inc(result);
+            hlocation:=hlocation^.next;
+          end;
+      end;
+
+
     procedure TCGPara.buildderef;
       begin
         defderef.build(def);