소스 검색

* allow access to parent locals when the currnet localst has no
varsyms

peter 22 년 전
부모
커밋
9647af4066
1개의 변경된 파일26개의 추가작업 그리고 3개의 파일을 삭제
  1. 26 3
      compiler/rautils.pas

+ 26 - 3
compiler/rautils.pas

@@ -218,7 +218,7 @@ uses
   defutil,systems,verbose,globals,
   defutil,systems,verbose,globals,
   symtable,paramgr,
   symtable,paramgr,
   aasmcpu,
   aasmcpu,
-  tgobj,procinfo;
+  procinfo;
 
 
 {*************************************************************************
 {*************************************************************************
                               TExprParse
                               TExprParse
@@ -769,6 +769,24 @@ end;
 
 
 
 
 Function TOperand.SetupVar(const s:string;GetOffset : boolean): Boolean;
 Function TOperand.SetupVar(const s:string;GetOffset : boolean): Boolean;
+
+  function symtable_has_varsyms(st:tsymtable):boolean;
+  var
+    sym : tsym;
+  begin
+    result:=false;
+    sym:=tsym(st.symindex.first);
+    while assigned(sym) do
+      begin
+        if sym.typ=varsym then
+          begin
+            result:=true;
+            exit;
+          end;
+        sym:=tsym(sym.indexnext);
+      end;
+  end;
+
 { search and sets up the correct fields in the Instr record }
 { search and sets up the correct fields in the Instr record }
 { for the NON-constant identifier passed to the routine.    }
 { for the NON-constant identifier passed to the routine.    }
 { if not found returns FALSE.                               }
 { if not found returns FALSE.                               }
@@ -820,7 +838,8 @@ Begin
                   if assigned(current_procinfo.parent) and
                   if assigned(current_procinfo.parent) and
                      (tvarsym(sym).owner<>current_procinfo.procdef.localst) and
                      (tvarsym(sym).owner<>current_procinfo.procdef.localst) and
                      (tvarsym(sym).owner<>current_procinfo.procdef.parast) and
                      (tvarsym(sym).owner<>current_procinfo.procdef.parast) and
-                     (current_procinfo.procdef.localst.symtablelevel>normal_function_level) then
+                     (current_procinfo.procdef.localst.symtablelevel>normal_function_level) and
+                     symtable_has_varsyms(current_procinfo.procdef.localst) then
                     message1(asmr_e_local_para_unreachable,s);
                     message1(asmr_e_local_para_unreachable,s);
                   opr.localsym:=tvarsym(sym);
                   opr.localsym:=tvarsym(sym);
                   opr.localsymofs:=0;
                   opr.localsymofs:=0;
@@ -1502,7 +1521,11 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.69  2003-10-01 20:34:49  peter
+  Revision 1.70  2003-10-08 19:39:58  peter
+    * allow access to parent locals when the currnet localst has no
+      varsyms
+
+  Revision 1.69  2003/10/01 20:34:49  peter
     * procinfo unit contains tprocinfo
     * procinfo unit contains tprocinfo
     * cginfo renamed to cgbase
     * cginfo renamed to cgbase
     * moved cgmessage to verbose
     * moved cgmessage to verbose