diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index 9d5e3c6166..d77cabda02 100644 --- a/compiler/pdecvar.pas +++ b/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 diff --git a/compiler/pjvm.pas b/compiler/pjvm.pas index 43795d7d86..f3cc3cf968 100644 --- a/compiler/pjvm.pas +++ b/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;