* Call free instead of destroy

This commit is contained in:
Michaël Van Canneyt 2025-03-21 14:23:33 +01:00
parent 36e65b3464
commit d3a0a2dddf
7 changed files with 33 additions and 34 deletions

View File

@ -4954,7 +4954,7 @@ const
if factval<>nil then if factval<>nil then
begin begin
track_state_pass:=true; track_state_pass:=true;
left.destroy; left.free;
left:=factval.getcopy; left:=factval.getcopy;
end; end;
if right.track_state_pass(exec_known) then if right.track_state_pass(exec_known) then
@ -4967,7 +4967,7 @@ const
if factval<>nil then if factval<>nil then
begin begin
track_state_pass:=true; track_state_pass:=true;
right.destroy; right.free;
right:=factval.getcopy; right:=factval.getcopy;
end; end;
end; end;

View File

@ -5103,7 +5103,7 @@ implementation
if value<>nil then if value<>nil then
begin begin
track_state_pass:=true; track_state_pass:=true;
hp.left.destroy; hp.left.free;
hp.left:=value.getcopy; hp.left:=value.getcopy;
do_typecheckpass(hp.left); do_typecheckpass(hp.left);
end; end;

View File

@ -1300,7 +1300,7 @@ implementation
t:=Tunarynode(left); t:=Tunarynode(left);
left:=Tunarynode(left).left; left:=Tunarynode(left).left;
t.left:=nil; t.left:=nil;
t.destroy; t.free;
{Symdif operator, in case you are wondering:} {Symdif operator, in case you are wondering:}
loopflags:=loopflags >< [lnf_checknegate]; loopflags:=loopflags >< [lnf_checknegate];
end; end;
@ -1486,7 +1486,7 @@ implementation
code:=right.getcopy; code:=right.getcopy;
if code.track_state_pass(exec_known) then if code.track_state_pass(exec_known) then
track_state_pass:=true; track_state_pass:=true;
code.destroy; code.free;
end; end;
repeat repeat
condition:=left.getcopy; condition:=left.getcopy;
@ -1495,7 +1495,7 @@ implementation
factval:=aktstate.find_fact(left); factval:=aktstate.find_fact(left);
if factval<>nil then if factval<>nil then
begin begin
condition.destroy; condition.free;
condition:=factval.getcopy; condition:=factval.getcopy;
change:=true; change:=true;
end; end;
@ -1526,8 +1526,8 @@ implementation
code.track_state_pass(false); code.track_state_pass(false);
done:=true; done:=true;
end; end;
code.destroy; code.free;
condition.destroy; condition.free;
firsttest:=false; firsttest:=false;
until done; until done;
{The loop condition is also known, for example: {The loop condition is also known, for example:
@ -1550,7 +1550,7 @@ implementation
aktstate.store_fact(condition, aktstate.store_fact(condition,
cordconstnode.create(byte(checknegate),pasbool1type,true)) cordconstnode.create(byte(checknegate),pasbool1type,true))
else else
condition.destroy; condition.free;
end; end;
{$endif} {$endif}
@ -1820,8 +1820,7 @@ implementation
destructor tfornode.destroy; destructor tfornode.destroy;
begin begin
if assigned(loopiteration) then loopiteration.free;
loopiteration.destroy;
inherited destroy; inherited destroy;
end; end;

View File

@ -387,10 +387,10 @@ implementation
end; end;
until false; until false;
{ free scanner } { free scanner }
current_scanner.destroy; current_scanner.free;
set_current_scanner(nil); set_current_scanner(nil);
{ close } { close }
preprocfile.destroy; preprocfile.free;
end; end;
{$endif PREPROCWRITE} {$endif PREPROCWRITE}

View File

@ -245,7 +245,7 @@ implementation
begin begin
aktstate:=Tstate_storage.create; aktstate:=Tstate_storage.create;
p.track_state_pass(true); p.track_state_pass(true);
aktstate.destroy; aktstate.free;
end; end;
{$endif} {$endif}

View File

@ -423,7 +423,7 @@ implementation
else else
begin begin
Message(parser_e_class_id_expected); Message(parser_e_class_id_expected);
p1.destroy; p1.free;
statement_syssym:=cerrornode.create; statement_syssym:=cerrornode.create;
end; end;
end; end;
@ -481,7 +481,7 @@ implementation
if df_has_generic_fields in p1.resultdef.defoptions then if df_has_generic_fields in p1.resultdef.defoptions then
include(statement_syssym.flags,nf_generic_para); include(statement_syssym.flags,nf_generic_para);
{ p1 not needed !} { p1 not needed !}
p1.destroy; p1.free;
end; end;
end; end;
@ -514,7 +514,7 @@ implementation
end; end;
{ else { else
begin begin
p1.destroy; p1.free;
p1:=cerrornode.create; p1:=cerrornode.create;
Message(parser_e_illegal_parameter_list); Message(parser_e_illegal_parameter_list);
end;} end;}
@ -902,7 +902,7 @@ implementation
good, so ignore it.} good, so ignore it.}
in_args:=true; in_args:=true;
p1:=comp_expr([ef_accept_equal]); p1:=comp_expr([ef_accept_equal]);
p1.destroy; p1.free;
consume(_RKLAMMER); consume(_RKLAMMER);
end; end;
statement_syssym:=geninlinenode(l,false,nil); statement_syssym:=geninlinenode(l,false,nil);
@ -2280,7 +2280,7 @@ implementation
again:=false; again:=false;
Message(parser_e_invalid_qualifier); Message(parser_e_invalid_qualifier);
recoverconsume_postfixops; recoverconsume_postfixops;
p1.destroy; p1.free;
p1:=cerrornode.create; p1:=cerrornode.create;
end end
else else
@ -2309,7 +2309,7 @@ implementation
protsym:=search_default_property(tabstractrecorddef(p1.resultdef)); protsym:=search_default_property(tabstractrecorddef(p1.resultdef));
if not(assigned(protsym)) then if not(assigned(protsym)) then
begin begin
p1.destroy; p1.free;
p1:=cerrornode.create; p1:=cerrornode.create;
again:=false; again:=false;
message(parser_e_no_default_property_available); message(parser_e_no_default_property_available);
@ -2420,7 +2420,7 @@ implementation
begin begin
if p1.resultdef.typ<>undefineddef then if p1.resultdef.typ<>undefineddef then
Message(parser_e_invalid_qualifier); Message(parser_e_invalid_qualifier);
p1.destroy; p1.free;
p1:=cerrornode.create; p1:=cerrornode.create;
comp_expr([ef_accept_equal]); comp_expr([ef_accept_equal]);
again:=false; again:=false;
@ -2640,7 +2640,7 @@ implementation
srsym:=tsym(tenumdef(p1.resultdef).symtable.Find(pattern)); srsym:=tsym(tenumdef(p1.resultdef).symtable.Find(pattern));
if assigned(srsym) and (srsym.typ=enumsym) and (p1.nodetype=typen) then if assigned(srsym) and (srsym.typ=enumsym) and (p1.nodetype=typen) then
begin begin
p1.destroy; p1.free;
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg); check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
p1:=genenumnode(tenumsym(srsym)); p1:=genenumnode(tenumsym(srsym));
consume(_ID); consume(_ID);
@ -2648,7 +2648,7 @@ implementation
else else
if not try_type_helper(p1,nil) then if not try_type_helper(p1,nil) then
begin begin
p1.destroy; p1.free;
Message1(sym_e_id_no_member,orgpattern); Message1(sym_e_id_no_member,orgpattern);
p1:=cerrornode.create; p1:=cerrornode.create;
consume(_ID); consume(_ID);
@ -2656,7 +2656,7 @@ implementation
end end
else else
begin begin
p1.destroy; p1.free;
p1:=cerrornode.create; p1:=cerrornode.create;
consume(_ID); consume(_ID);
end end
@ -2675,13 +2675,13 @@ implementation
begin begin
consume(_ID); consume(_ID);
p2:=parse_array_constructor(tarraydef(p1.resultdef)); p2:=parse_array_constructor(tarraydef(p1.resultdef));
p1.destroy; p1.free;
p1:=p2; p1:=p2;
end end
else else
begin begin
Message2(scan_f_syn_expected,'CREATE',pattern); Message2(scan_f_syn_expected,'CREATE',pattern);
p1.destroy; p1.free;
p1:=cerrornode.create; p1:=cerrornode.create;
consume(_ID); consume(_ID);
end; end;
@ -2689,7 +2689,7 @@ implementation
else else
begin begin
Message(parser_e_invalid_qualifier); Message(parser_e_invalid_qualifier);
p1.destroy; p1.free;
p1:=cerrornode.create; p1:=cerrornode.create;
consume(_ID); consume(_ID);
end; end;
@ -2698,7 +2698,7 @@ implementation
else else
begin begin
Message(parser_e_invalid_qualifier); Message(parser_e_invalid_qualifier);
p1.destroy; p1.free;
p1:=cerrornode.create; p1:=cerrornode.create;
consume(_ID); consume(_ID);
end; end;
@ -2707,7 +2707,7 @@ implementation
if (token<>_ID) or not try_type_helper(p1,nil) then if (token<>_ID) or not try_type_helper(p1,nil) then
begin begin
Message(parser_e_invalid_qualifier); Message(parser_e_invalid_qualifier);
p1.destroy; p1.free;
p1:=cerrornode.create; p1:=cerrornode.create;
consume(_ID); consume(_ID);
end; end;
@ -2911,7 +2911,7 @@ implementation
if found then if found then
begin begin
tderefnode(p1).left:=nil; tderefnode(p1).left:=nil;
p1.destroy; p1.free;
p1:=p2; p1:=p2;
end; end;
end end
@ -2921,7 +2921,7 @@ implementation
begin begin
if p1.resultdef.typ<>undefineddef then if p1.resultdef.typ<>undefineddef then
Message(parser_e_invalid_qualifier); Message(parser_e_invalid_qualifier);
p1.destroy; p1.free;
p1:=cerrornode.create; p1:=cerrornode.create;
{ Error } { Error }
consume(_ID); consume(_ID);

View File

@ -451,7 +451,7 @@ implementation
Message(type_e_type_id_expected); Message(type_e_type_id_expected);
consume_all_until(_RKLAMMER); consume_all_until(_RKLAMMER);
consume(_RKLAMMER); consume(_RKLAMMER);
p1.destroy; p1.free;
new_function:=cerrornode.create; new_function:=cerrornode.create;
exit; exit;
end; end;
@ -461,7 +461,7 @@ implementation
Message1(type_e_pointer_type_expected,p1.resultdef.typename); Message1(type_e_pointer_type_expected,p1.resultdef.typename);
consume_all_until(_RKLAMMER); consume_all_until(_RKLAMMER);
consume(_RKLAMMER); consume(_RKLAMMER);
p1.destroy; p1.free;
new_function:=cerrornode.create; new_function:=cerrornode.create;
exit; exit;
end; end;
@ -485,7 +485,7 @@ implementation
Message(parser_e_pointer_to_class_expected); Message(parser_e_pointer_to_class_expected);
consume_all_until(_RKLAMMER); consume_all_until(_RKLAMMER);
consume(_RKLAMMER); consume(_RKLAMMER);
p1.destroy; p1.free;
new_function:=cerrornode.create; new_function:=cerrornode.create;
exit; exit;
end; end;