2
0
Эх сурвалжийг харах

+ 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 -

Jonas Maebe 11 жил өмнө
parent
commit
ea0b9efd20
1 өөрчлөгдсөн 10 нэмэгдсэн , 0 устгасан
  1. 10 0
      compiler/nflw.pas

+ 10 - 0
compiler/nflw.pas

@@ -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
 *****************************************************************************}