|
@@ -362,11 +362,19 @@ implementation
|
|
srsym : tsym;
|
|
srsym : tsym;
|
|
para : tcallparanode;
|
|
para : tcallparanode;
|
|
newstatement : tstatementnode;
|
|
newstatement : tstatementnode;
|
|
|
|
+ oldlocalswitches: tlocalswitches;
|
|
begin
|
|
begin
|
|
result:=internalstatements(newstatement);
|
|
result:=internalstatements(newstatement);
|
|
|
|
|
|
if assigned(current_procinfo.procdef._class) then
|
|
if assigned(current_procinfo.procdef._class) then
|
|
begin
|
|
begin
|
|
|
|
+ { Don't test self and the vmt here. The reason is that }
|
|
|
|
+ { a constructor already checks whether these are valid }
|
|
|
|
+ { before. Further, in case of TThread the thread may }
|
|
|
|
+ { free the class instance right after AfterConstruction }
|
|
|
|
+ { has been called, so it may no longer be valid (JM) }
|
|
|
|
+ oldlocalswitches:=current_settings.localswitches;
|
|
|
|
+ current_settings.localswitches:=oldlocalswitches-[cs_check_object,cs_check_range];
|
|
{ maybe call AfterConstruction for classes }
|
|
{ maybe call AfterConstruction for classes }
|
|
if (current_procinfo.procdef.proctypeoption=potype_constructor) and
|
|
if (current_procinfo.procdef.proctypeoption=potype_constructor) and
|
|
is_class(current_procinfo.procdef._class) then
|
|
is_class(current_procinfo.procdef._class) then
|
|
@@ -444,6 +452,7 @@ implementation
|
|
else
|
|
else
|
|
internalerror(200305105);
|
|
internalerror(200305105);
|
|
end;
|
|
end;
|
|
|
|
+ current_settings.localswitches:=oldlocalswitches;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -452,6 +461,7 @@ implementation
|
|
var
|
|
var
|
|
pd : tprocdef;
|
|
pd : tprocdef;
|
|
newstatement : tstatementnode;
|
|
newstatement : tstatementnode;
|
|
|
|
+ oldlocalswitches: tlocalswitches;
|
|
begin
|
|
begin
|
|
generate_except_block:=internalstatements(newstatement);
|
|
generate_except_block:=internalstatements(newstatement);
|
|
|
|
|
|
@@ -460,6 +470,10 @@ implementation
|
|
if assigned(current_procinfo.procdef._class) and
|
|
if assigned(current_procinfo.procdef._class) and
|
|
(current_procinfo.procdef.proctypeoption=potype_constructor) then
|
|
(current_procinfo.procdef.proctypeoption=potype_constructor) then
|
|
begin
|
|
begin
|
|
|
|
+ { Don't test self and the vmt here. See generate_bodyexit_block }
|
|
|
|
+ { why (JM) }
|
|
|
|
+ oldlocalswitches:=current_settings.localswitches;
|
|
|
|
+ current_settings.localswitches:=oldlocalswitches-[cs_check_object,cs_check_range];
|
|
pd:=current_procinfo.procdef._class.Finddestructor;
|
|
pd:=current_procinfo.procdef._class.Finddestructor;
|
|
if assigned(pd) then
|
|
if assigned(pd) then
|
|
begin
|
|
begin
|
|
@@ -471,6 +485,7 @@ implementation
|
|
ccallnode.create(nil,tprocsym(pd.procsym),pd.procsym.owner,load_self_node,[]),
|
|
ccallnode.create(nil,tprocsym(pd.procsym),pd.procsym.owner,load_self_node,[]),
|
|
nil));
|
|
nil));
|
|
end;
|
|
end;
|
|
|
|
+ current_settings.localswitches:=oldlocalswitches;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|