pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

ActionScript pastebin - collaborative debugging tool View Help


Posted by ejot on Mon 7 Jul 11:19 (modification of post by ejot view diff)
report abuse | download | new post

  1. package
  2. {
  3.         public class InterestingClass
  4.         {
  5.                 protected static function processStacktrace():Object {
  6.                         var inspected:Object = new Object();
  7.                         var inspectionPattern:RegExp = new RegExp(".*at .*\\/(.*)\\(\\)\\[.*\\/(.*)\\..*\\]");
  8.                                                
  9.                         var stacktrace:String = new Error().getStackTrace();
  10.                         var called:String = stacktrace.split("\n")[2];
  11.                         var calling:String = stacktrace.split("\n")[3];
  12.                        
  13.                         inspected["called"] = {"cls":called.match(inspectionPattern)[2], "method":called.match(inspectionPattern)[1]};
  14.                         inspected["calling"] = {"cls":calling.match(inspectionPattern)[2], "method":calling.match(inspectionPattern)[1]};
  15.                         return inspected;
  16.                 }
  17.                
  18.                 protected function doOutput(inspected:Object):void {
  19.                         trace("I am in", inspected.called.method, "of", inspected.called.cls, "and was called from", inspected.calling.method, "of", inspected.calling.cls);
  20.                 }
  21.                
  22.                 public function method1():String {
  23.                         var inspected:Object = processStacktrace();
  24.                         doOutput(inspected);
  25.                         return "I am method1";
  26.                 }
  27.                
  28.                 public function method2(value:String):String {
  29.                         var inspected:Object = processStacktrace();
  30.                         doOutput(inspected);
  31.                         return "You told me: " + value;
  32.                 }
  33.         }
  34. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me