Explorar o código

* explicitly specify symtable to jvm_guarantee_record_typesym() instead of
hardcoding symtablestack.top

git-svn-id: branches/jvmbackend@18585 -

Jonas Maebe %!s(int64=14) %!d(string=hai) anos
pai
achega
9d0fdb3150
Modificáronse 2 ficheiros con 8 adicións e 9 borrados
  1. 2 2
      compiler/pdecvar.pas
  2. 6 7
      compiler/pjvm.pas

+ 2 - 2
compiler/pdecvar.pas

@@ -1372,7 +1372,7 @@ implementation
 {$endif}
 
              read_anon_type(hdef,false);
-             jvm_guarantee_record_typesym(hdef);
+             jvm_guarantee_record_typesym(hdef,symtablestack.top);
              for i:=0 to sc.count-1 do
                begin
                  vs:=tabstractvarsym(sc[i]);
@@ -1587,7 +1587,7 @@ implementation
                  symtablestack.pop(recst);
                end;
              read_anon_type(hdef,false);
-             jvm_guarantee_record_typesym(hdef);
+             jvm_guarantee_record_typesym(hdef,symtablestack.top);
              block_type:=bt_var;
              { allow only static fields reference to struct where they are declared }
              if not (vd_class in options) and

+ 6 - 7
compiler/pjvm.pas

@@ -27,7 +27,7 @@ unit pjvm;
 interface
 
     uses
-     symtype,symdef;
+     symtype,symbase,symdef;
 
     { the JVM specs require that you add a default parameterless
       constructor in case the programmer hasn't specified any }
@@ -38,7 +38,7 @@ interface
       to initialse dynamic arrays }
     procedure add_java_default_record_methods_intf(def: trecorddef);
 
-    procedure jvm_guarantee_record_typesym(var def: tdef);
+    procedure jvm_guarantee_record_typesym(var def: tdef; st: tsymtable);
 
 
 implementation
@@ -50,7 +50,7 @@ implementation
     fmodule,
     parabase,
     pdecsub,
-    symbase,symtable,symconst,symsym,symcreat,defcmp,jvmdef,
+    symtable,symconst,symsym,symcreat,defcmp,jvmdef,
     defutil,paramgr;
 
 
@@ -118,7 +118,7 @@ implementation
               end;
             { determine symtable level }
             topowner:=obj;
-            while not(topowner.owner.symtabletype in [staticsymtable,globalsymtable,localsymtable]) do
+            while not(topowner.owner.symtabletype in [staticsymtable,globalsymtable]) do
               topowner:=topowner.owner.defowner;
             { create procdef }
             pd:=tprocdef.create(topowner.owner.symtablelevel+1);
@@ -195,7 +195,7 @@ implementation
       end;
 
 
-    procedure jvm_guarantee_record_typesym(var def: tdef);
+    procedure jvm_guarantee_record_typesym(var def: tdef; st: tsymtable);
       var
         ts: ttypesym;
       begin
@@ -206,9 +206,8 @@ implementation
            not assigned(def.typesym) then
           begin
             ts:=ttypesym.create(trecorddef(def).symtable.realname^,def);
-            symtablestack.top.insert(ts);
+            st.insert(ts);
             ts.visibility:=vis_strictprivate;
-            def.typesym:=ts;
           end;
       end;