+ support for simplifying empty try-except statements

o required for the JVM target, as exception tables with start=end
     are invalid there

git-svn-id: trunk@27742 -
This commit is contained in:
Jonas Maebe 2014-05-10 12:47:28 +00:00
parent 5fa09fa2f4
commit ea0b9efd20

View File

@ -182,6 +182,7 @@ interface
constructor create(l,r,_t1 : tnode);virtual;reintroduce;
function pass_typecheck:tnode;override;
function pass_1 : tnode;override;
function simplify(forinline: boolean): tnode; override;
end;
ttryexceptnodeclass = class of ttryexceptnode;
@ -2071,6 +2072,15 @@ implementation
end;
function ttryexceptnode.simplify(forinline: boolean): tnode;
begin
result:=nil;
{ empty try -> can never raise exception -> do nothing }
if has_no_code(left) then
result:=cnothingnode.create;
end;
{*****************************************************************************
TTRYFINALLYNODE
*****************************************************************************}