* corrected version of r16812: code generation is still handled specially

for assigned(), but the type information is now correct so it doesn't
    have to be forced to OS_ADDR anymore

git-svn-id: trunk@16819 -
This commit is contained in:
Jonas Maebe 2011-01-26 14:50:18 +00:00
parent 0f35da07f1
commit 04e26bfc85
2 changed files with 13 additions and 6 deletions

View File

@ -640,9 +640,7 @@ implementation
procedure tcginlinenode.second_assigned;
begin
secondpass(tcallparanode(left).left);
{ force left to be an OS_ADDR, since in case of method procvars }
{ the size is 2*OS_ADDR (JM) }
cg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,OS_ADDR,OC_NE,0,tcallparanode(left).left.location,current_procinfo.CurrTrueLabel);
cg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,def_cgsize(left.resultdef),OC_NE,0,tcallparanode(left).left.location,current_procinfo.CurrTrueLabel);
cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel);
location_reset(location,LOC_JUMP,OS_NO);
end;

View File

@ -2258,9 +2258,18 @@ implementation
begin
{ the parser has already made sure the expression is valid }
{ there could be a procvar, which is 2*sizeof(pointer), while we }
{ must only check the first pointer -> can't just convert to an }
{ add node in all cases }
{ in case of a complex procvar, only check the "code" pointer }
if (tcallparanode(left).left.resultdef.typ=procvardef) and
not tprocvardef(tcallparanode(left).left.resultdef).is_addressonly then
begin
inserttypeconv_explicit(tcallparanode(left).left,search_system_type('TMETHOD').typedef);
tcallparanode(left).left:=csubscriptnode.create(tsym(tabstractrecorddef(tcallparanode(left).left.resultdef).symtable.find('CODE')),tcallparanode(left).left);
tcallparanode(left).get_paratype;
end;
{ converting to an add node is tricky because of differences
in procvar handling between FPC and Delphi handling, so
handle specially }
set_varstate(tcallparanode(left).left,vs_read,[vsf_must_be_valid]);
resultdef:=booltype;
end;