* fixed instances of passing properties as var parameter

git-svn-id: trunk@7249 -
This commit is contained in:
Jonas Maebe 2007-05-03 11:02:38 +00:00
parent 5fc31d96e0
commit 21f87ef1de
7 changed files with 49 additions and 54 deletions

View File

@ -169,7 +169,6 @@ interface
function docompare(p: tnode): boolean; override;
procedure printnodetree(var t:text);override;
property value : tnode read left write left;
property nextpara : tnode read right write right;
property parametername : tnode read third write third;
end;
@ -267,9 +266,9 @@ implementation
procedure increase_paramssize;
begin
{ for now we pass everything by reference
case para.value.resultdef.typ of
case para.left.resultdef.typ of
variantdef:
inc(paramssize,para.value.resultdef.size);
inc(paramssize,para.left.resultdef.size);
else
}
inc(paramssize,sizeof(voidpointertype.size ));
@ -301,41 +300,41 @@ implementation
while assigned(para) do
begin
inc(paracount);
typecheckpass(para.value);
typecheckpass(para.left);
{ insert some extra casts }
if is_constintnode(para.value) and not(is_64bitint(para.value.resultdef)) then
if is_constintnode(para.left) and not(is_64bitint(para.left.resultdef)) then
begin
para.value:=ctypeconvnode.create_internal(para.value,s32inttype);
typecheckpass(para.value);
para.left:=ctypeconvnode.create_internal(para.left,s32inttype);
typecheckpass(para.left);
end
else if para.value.nodetype=stringconstn then
else if para.left.nodetype=stringconstn then
begin
para.value:=ctypeconvnode.create_internal(para.value,cwidestringtype);
typecheckpass(para.value);
para.left:=ctypeconvnode.create_internal(para.left,cwidestringtype);
typecheckpass(para.left);
end
{ force automatable boolean type }
else if is_boolean(para.value.resultdef) then
else if is_boolean(para.left.resultdef) then
begin
para.value:=ctypeconvnode.create_internal(para.value,bool16type);
typecheckpass(para.value);
para.left:=ctypeconvnode.create_internal(para.left,bool16type);
typecheckpass(para.left);
end
{ force automatable float type }
else if is_extended(para.value.resultdef) then
else if is_extended(para.left.resultdef) then
begin
para.value:=ctypeconvnode.create_internal(para.value,s64floattype);
typecheckpass(para.value);
para.left:=ctypeconvnode.create_internal(para.left,s64floattype);
typecheckpass(para.left);
end;
if assigned(para.parametername) then
begin
typecheckpass(para.value);
typecheckpass(para.left);
inc(namedparacount);
end;
if para.value.nodetype<>nothingn then
if not is_automatable(para.value.resultdef) then
CGMessagePos1(para.value.fileinfo,type_e_not_automatable,para.value.resultdef.typename);
if para.left.nodetype<>nothingn then
if not is_automatable(para.left.resultdef) then
CGMessagePos1(para.left.fileinfo,type_e_not_automatable,para.left.resultdef.typename);
{ we've to know the parameter size to allocate the temp. space }
increase_paramssize;
@ -370,20 +369,20 @@ implementation
internalerror(200611041);
end;
dispatchbyref:=para.value.resultdef.typ in [variantdef];
dispatchbyref:=para.left.resultdef.typ in [variantdef];
{ assign the argument/parameter to the temporary location }
if para.value.nodetype<>nothingn then
if para.left.nodetype<>nothingn then
if dispatchbyref then
addstatement(statements,cassignmentnode.create(
ctypeconvnode.create_internal(cderefnode.create(caddnode.create(addn,
caddrnode.create(ctemprefnode.create(params)),
cordconstnode.create(paramssize,ptruinttype,false)
)),voidpointertype),
ctypeconvnode.create_internal(caddrnode.create_internal(para.value),voidpointertype)))
ctypeconvnode.create_internal(caddrnode.create_internal(para.left),voidpointertype)))
else
begin
case para.value.resultdef.size of
case para.left.resultdef.size of
1..4:
assignmenttype:=u32inttype;
8:
@ -396,20 +395,20 @@ implementation
caddrnode.create(ctemprefnode.create(params)),
cordconstnode.create(paramssize,ptruinttype,false)
)),assignmenttype),
ctypeconvnode.create_internal(para.value,assignmenttype)));
ctypeconvnode.create_internal(para.left,assignmenttype)));
end;
if is_ansistring(para.value.resultdef) then
if is_ansistring(para.left.resultdef) then
calldesc.argtypes[currargpos]:=varStrArg
else
calldesc.argtypes[currargpos]:=para.value.resultdef.getvardef;
calldesc.argtypes[currargpos]:=para.left.resultdef.getvardef;
if dispatchbyref then
calldesc.argtypes[currargpos]:=calldesc.argtypes[currargpos] or $80;
increase_paramssize;
para.value:=nil;
para.left:=nil;
inc(currargpos);
para:=tcallparanode(para.nextpara);
end;

View File

@ -893,8 +893,9 @@ implementation
{ multiple parameters? }
if assigned(right) then
begin
if assigned(frametree) then
secondpass(frametree);
{ frame tree }
if assigned(third) then
secondpass(third);
secondpass(right);
end;
secondpass(left);
@ -905,8 +906,9 @@ implementation
if assigned(right) then
begin
paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc3);
if assigned(frametree) then
cg.a_param_loc(current_asmdata.CurrAsmList,frametree.location,paraloc3)
{ frame tree }
if assigned(third) then
cg.a_param_loc(current_asmdata.CurrAsmList,third.location,paraloc3)
else
cg.a_param_const(current_asmdata.CurrAsmList,OS_INT,0,paraloc3);
{ push address }

View File

@ -169,8 +169,6 @@ interface
constructor create(l,taddr,tframe:tnode);virtual;
function pass_typecheck:tnode;override;
function pass_1 : tnode;override;
property frametree : tnode read third write third;
end;
traisenodeclass = class of traisenode;
@ -1258,10 +1256,10 @@ implementation
typecheckpass(right);
inserttypeconv(right,voidpointertype);
{ frame }
if assigned(frametree) then
if assigned(third) then
begin
typecheckpass(frametree);
inserttypeconv(frametree,voidpointertype);
typecheckpass(third);
inserttypeconv(third,voidpointertype);
end;
end;
end;
@ -1283,8 +1281,8 @@ implementation
{ addr }
firstpass(right);
{ frame }
if assigned(frametree) then
firstpass(frametree);
if assigned(third) then
firstpass(third);
end;
left_right_max;
end;

View File

@ -659,7 +659,7 @@ implementation
begin
datasize:=align(datasize,sizeof(aint));
ImplIntf.Ioffset:=datasize;
inc(datasize,sizeof(aint));
datasize:=datasize+sizeof(aint);
end;
end;
end;

View File

@ -132,7 +132,8 @@ implementation
result := foreachnode(tloopnode(n).t2,f,arg) or result;
end;
raisen:
result := foreachnode(traisenode(n).frametree,f,arg) or result;
{ frame tree }
result := foreachnode(traisenode(n).third,f,arg) or result;
casen:
begin
for i := 0 to tcasenode(n).blocks.count-1 do
@ -179,7 +180,8 @@ implementation
result := foreachnodestatic(procmethod,tloopnode(n).t2,f,arg) or result;
end;
raisen:
result := foreachnodestatic(traisenode(n).frametree,f,arg) or result;
{ frame tree }
result := foreachnodestatic(traisenode(n).third,f,arg) or result;
casen:
begin
for i := 0 to tcasenode(n).blocks.count-1 do

View File

@ -406,8 +406,6 @@ interface
FObjDataList : TFPObjectList;
{ Position calculation }
FImageBase : aint;
FCurrDataPos,
FCurrMemPos : aint;
protected
{ writer }
FWriter : TObjectwriter;
@ -420,6 +418,8 @@ interface
property CExeSection:TExeSectionClass read FCExeSection write FCExeSection;
property CObjData:TObjDataClass read FCObjData write FCObjData;
public
CurrDataPos,
CurrMemPos : aint;
IsSharedLibrary : boolean;
constructor create;virtual;
destructor destroy;override;
@ -467,8 +467,6 @@ interface
property EntryName:string read FEntryName write FEntryName;
property ImageBase:aint read FImageBase write FImageBase;
property CurrExeSec:TExeSection read FCurrExeSec;
property CurrDataPos:aint read FCurrDataPos write FCurrDataPos;
property CurrMemPos:aint read FCurrMemPos write FCurrMemPos;
end;
TExeOutputClass=class of TExeOutput;

View File

@ -38,16 +38,12 @@ type
TSuiteResults = class(TObject)
private
FRuns: integer;
FErrors: integer;
FFailures: integer;
FIgnores: integer;
FStartTime: TDateTime;
public
property Runs: integer read FRuns write FRuns;
property Ignores: integer read FIgnores write FIgnores;
property Errors: integer read FErrors write FErrors;
property Failures: integer read FFailures write FFailures;
Runs: integer;
Failures: integer;
Errors: integer;
Ignores: integer;
property StartTime: TDateTime read FStartTime write FStartTime;
end;