mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 23:21:57 +02:00
* fix check for procedure without parameters
* calling constructor as member will not allocate memory
This commit is contained in:
parent
5197c95be6
commit
4d67ae9f31
@ -120,6 +120,7 @@ interface
|
||||
{$endif state_tracking}
|
||||
function docompare(p: tnode): boolean; override;
|
||||
procedure printnodedata(var t:text);override;
|
||||
function para_count:longint;
|
||||
private
|
||||
{$ifdef callparatemp}
|
||||
function extract_functioncall_paras: tblocknode;
|
||||
@ -1686,6 +1687,11 @@ type
|
||||
{ inherited call, no create/destroy }
|
||||
if (nf_inherited in flags) then
|
||||
vmttree:=cpointerconstnode.create(0,voidpointertype)
|
||||
else
|
||||
{ do not create/destroy when called from member function
|
||||
without specifying self explicit }
|
||||
if (nf_member_call in flags) then
|
||||
vmttree:=cpointerconstnode.create(0,voidpointertype)
|
||||
else
|
||||
{ constructor with extended syntax called from new }
|
||||
if (nf_new_call in flags) then
|
||||
@ -1711,14 +1717,7 @@ type
|
||||
{ destructor: release instance, flag(vmt)=1
|
||||
constructor: direct call, do nothing, leave vmt=0 }
|
||||
if (procdefinition.proctypeoption=potype_destructor) then
|
||||
begin
|
||||
{ do not release when called from member function
|
||||
without specifying self explicit }
|
||||
if (nf_member_call in flags) then
|
||||
vmttree:=cpointerconstnode.create(0,voidpointertype)
|
||||
else
|
||||
vmttree:=cpointerconstnode.create(1,voidpointertype);
|
||||
end
|
||||
vmttree:=cpointerconstnode.create(1,voidpointertype)
|
||||
else
|
||||
vmttree:=cpointerconstnode.create(0,voidpointertype);
|
||||
end
|
||||
@ -2536,6 +2535,23 @@ type
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
||||
function tcallnode.para_count:longint;
|
||||
var
|
||||
ppn : tcallparanode;
|
||||
begin
|
||||
result:=0;
|
||||
ppn:=tcallparanode(left);
|
||||
while assigned(ppn) do
|
||||
begin
|
||||
if not(assigned(ppn.paraitem) and
|
||||
ppn.paraitem.is_hidden) then
|
||||
inc(result);
|
||||
ppn:=tcallparanode(ppn.right);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function tcallnode.docompare(p: tnode): boolean;
|
||||
begin
|
||||
docompare :=
|
||||
@ -2573,7 +2589,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.163 2003-06-03 13:01:59 daniel
|
||||
Revision 1.164 2003-06-03 21:05:48 peter
|
||||
* fix check for procedure without parameters
|
||||
* calling constructor as member will not allocate memory
|
||||
|
||||
Revision 1.163 2003/06/03 13:01:59 daniel
|
||||
* Register allocator finished
|
||||
|
||||
Revision 1.162 2003/05/26 21:17:17 peter
|
||||
|
@ -778,10 +778,27 @@ implementation
|
||||
begin
|
||||
v:=tordconstnode(left).value;
|
||||
if is_currency(resulttype.def) then
|
||||
v:=v*10000
|
||||
else if is_currency(left.resulttype.def) then
|
||||
v:=v div 10000;
|
||||
result:=cordconstnode.create(v,resulttype,false);
|
||||
v:=v*10000;
|
||||
if (resulttype.def.deftype=pointerdef) then
|
||||
result:=cpointerconstnode.create(v,resulttype)
|
||||
else
|
||||
begin
|
||||
if is_currency(left.resulttype.def) then
|
||||
v:=v div 10000;
|
||||
result:=cordconstnode.create(v,resulttype,false);
|
||||
end;
|
||||
end
|
||||
else if left.nodetype=pointerconstn then
|
||||
begin
|
||||
v:=tpointerconstnode(left).value;
|
||||
if (resulttype.def.deftype=pointerdef) then
|
||||
result:=cpointerconstnode.create(v,resulttype)
|
||||
else
|
||||
begin
|
||||
if is_currency(resulttype.def) then
|
||||
v:=v*10000;
|
||||
result:=cordconstnode.create(v,resulttype,false);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -1161,7 +1178,7 @@ implementation
|
||||
end
|
||||
else
|
||||
if (left.nodetype=calln) and
|
||||
not assigned(tcallnode(left).left) then
|
||||
(tcallnode(left).para_count=0) then
|
||||
begin
|
||||
if assigned(tcallnode(left).right) then
|
||||
begin
|
||||
@ -2091,7 +2108,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.111 2003-05-11 21:37:03 peter
|
||||
Revision 1.112 2003-06-03 21:05:48 peter
|
||||
* fix check for procedure without parameters
|
||||
* calling constructor as member will not allocate memory
|
||||
|
||||
Revision 1.111 2003/05/11 21:37:03 peter
|
||||
* moved implicit exception frame from ncgutil to psub
|
||||
* constructor/destructor helpers moved from cobj/ncgutil to psub
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user