making distel:who_calls more robust

Matthias Radestock <[email protected]> Sat, 14 Apr 2007 10:43:58 +0100
Newsgroups gmane.comp.lang.erlang.distel.devel
Message-ID <[email protected]>
erl_syntax_lib:fold and friends can crash when encountering certain
kinds of syntax, e.g. binary comprehensions. See 
  http://www.erlang.org/pipermail/erlang-bugs/2007-April/000337.html

This makes distel:who_calls fall over.

The attached makes the distel code more robust by catching and ignoring
these errors.


Regards,

Matthias

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Distel-hackers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/distel-hackers
distel.patch (text/x-diff, 800 B)
Index: src/distel.erl
===================================================================
--- src/distel.erl	(revision 9)
+++ src/distel.erl	(working copy)
@@ -1166,7 +1166,14 @@
 calls(ThisMod, Tree, Applies) ->
     {_, Calls} =
 	lists:foldl(fun(T, Acc) ->
-			    do_funs(T, Acc, ThisMod, Applies)
+                            %% erl_syntax_lib:fold and friends can
+                            %% crash when encountering certain kinds
+                            %% of syntax, e.g. binary comprehensions
+                            %% (at least in R11B-4 and earlier)
+                            case catch do_funs(T, Acc, ThisMod, Applies) of
+                                {'EXIT', _} -> Acc;
+                                R -> R
+			    end
 		    end, {[], []}, Tree),
     Calls.