diff --git a/compiler/ncgnstld.pas b/compiler/ncgnstld.pas index 85283aaa8f..4e016f7f5b 100644 --- a/compiler/ncgnstld.pas +++ b/compiler/ncgnstld.pas @@ -106,8 +106,8 @@ implementation the parentfpstruct inside the routine in which they were originally declared, except in the initialisation code for the parentfpstruct (nf_internal flag) } - (tabstractnormalvarsym(symtableentry).inparentfpstruct and - not(nf_internal in flags))) then + tabstractnormalvarsym(symtableentry).inparentfpstruct) and + not(nf_internal in flags) then begin { get struct holding all locals accessed by nested routines } nestedvars:=tprocdef(symtable.defowner).parentfpstruct; @@ -142,7 +142,6 @@ implementation var thissym, nestedvars: tsym; - nestedvarsdef: tdef; begin result:=inherited; if assigned(result) then @@ -153,11 +152,8 @@ implementation begin { Nested variable? Then we have to move it to a structure that can be passed by reference to nested routines } - if assigned(current_procinfo) and - (symtable.symtabletype in [localsymtable,parasymtable]) and - ((symtable.symtablelevel<>current_procinfo.procdef.parast.symtablelevel) or - (tabstractnormalvarsym(symtableentry).inparentfpstruct and - not(nf_internal in flags))) then + if assigned(left) and + not(nf_internal in flags) then begin { get struct holding all locals accessed by nested routines } nestedvars:=tprocdef(symtable.defowner).parentfpstruct; @@ -167,7 +163,6 @@ implementation build_parentfpstruct(tprocdef(symtable.defowner)); nestedvars:=tprocdef(symtable.defowner).parentfpstruct; end; - nestedvarsdef:=tlocalvarsym(nestedvars).vardef; if nestedvars<>symtableentry then thissym:=nestsym else @@ -185,7 +180,7 @@ implementation left:=csubscriptnode.create(thissym,cderefnode.create(left)); firstpass(left); include(flags,nf_internal); - end; + end; end; end; end; diff --git a/compiler/ninl.pas b/compiler/ninl.pas index 05baedb0b1..22f17fcb62 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -4371,7 +4371,7 @@ implementation addstatement(newstatement,cassignmentnode.create(resultnode,hpp)); - { force pass 1, so copied tries get first pass'ed as well and flags like nf_write, nf_call_unique + { force pass 1, so copied trees get first pass'ed as well and flags like nf_write, nf_call_unique get set right } node_reset_flags(newstatement.statement,[nf_pass1_done]); { firstpass it }