Explorar el Código

* also process all subnodes of try-except and try-finally in
foreachnode(static) (fixes first example of mantis #9076)

git-svn-id: trunk@7671 -

Jonas Maebe hace 18 años
padre
commit
62b3b307e0
Se han modificado 4 ficheros con 43 adiciones y 2 borrados
  1. 2 0
      .gitattributes
  2. 2 2
      compiler/nutils.pas
  3. 29 0
      tests/webtbs/tw9076.pp
  4. 10 0
      tests/webtbs/tw9076a.pp

+ 2 - 0
.gitattributes

@@ -8295,6 +8295,8 @@ tests/webtbs/tw8950.pp svneol=native#text/plain
 tests/webtbs/tw8975.pp svneol=native#text/plain
 tests/webtbs/tw8975a.pp svneol=native#text/plain
 tests/webtbs/tw9054.pp svneol=native#text/plain
+tests/webtbs/tw9076.pp svneol=native#text/plain
+tests/webtbs/tw9076a.pp svneol=native#text/plain
 tests/webtbs/tw9085.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain

+ 2 - 2
compiler/nutils.pas

@@ -125,7 +125,7 @@ implementation
             result := foreachnode(tcallnode(n).methodpointer,f,arg) or result;
             result := foreachnode(tcallnode(n).methodpointerdone,f,arg) or result;
           end;
-        ifn, whilerepeatn, forn:
+        ifn, whilerepeatn, forn, tryexceptn, tryfinallyn:
           begin
             { not in one statement, won't work because of b- }
             result := foreachnode(tloopnode(n).t1,f,arg) or result;
@@ -173,7 +173,7 @@ implementation
               result := foreachnodestatic(procmethod,tcallnode(n).methodpointer,f,arg) or result;
               result := foreachnodestatic(procmethod,tcallnode(n).methodpointerdone,f,arg) or result;
             end;
-          ifn, whilerepeatn, forn:
+          ifn, whilerepeatn, forn, tryexceptn, tryfinallyn:
             begin
               { not in one statement, won't work because of b- }
               result := foreachnodestatic(procmethod,tloopnode(n).t1,f,arg) or result;

+ 29 - 0
tests/webtbs/tw9076.pp

@@ -0,0 +1,29 @@
+{ %norun }
+
+unit tw9076;
+
+{$mode objfpc}
+
+interface
+
+type
+  pfdset = pointer;
+
+function __Select(N: Longint; ReadFds: PFDSet; WriteFds: PFDSet;
+ExceptFds: PFDSet): Longint; inline;
+
+implementation
+
+function __Select(N: Longint; ReadFds: PFDSet; WriteFds: PFDSet;
+ExceptFds: PFDSet): Longint;
+begin
+  try
+    result := 2
+  except
+    Result := -1
+  end
+end;
+
+end.
+
+

+ 10 - 0
tests/webtbs/tw9076a.pp

@@ -0,0 +1,10 @@
+{ %norun }
+
+program chatserver;
+
+uses tw9076;
+
+begin
+  __Select(0, nil, nil, nil)
+end.
+