nl_tokens: looking for first var with sandbox item ;
pl_tokens: function ( ) { if ( this [ 1 ] && this [ 2 ] [ 0 ] ) { var functionName = this [ 1 ] [ 1 ] , eventName , eventDescriptor ; switch ( functionName ) { case "lmd_on" : eventName = this [ 2 ] [ 0 ] [ 1 ] ; eventDescriptor = events [ eventName ] ; // if no event triggers (no lmd_trigger(event_name,...)) // delete all lmd_on(event_name,...) statements if ( eventDescriptor . <mask> === 0 ) { return [ "stat" ] ; // wipe statement = return empty statement - ; } // Shorten event names: Using UglifyJS AST find all event names // from lmd_trigger and lmd_on and replace them with corresponding numbers //console.log(this); this [ 2 ] [ 0 ] = [ "num" , eventDescriptor . eventIndex ] ; break ; case "lmd_trigger" : eventName = this [ 2 ] [ 0 ] [ 1 ] ; eventDescriptor = events [ eventName ] ; // if no event listeners (no lmd_on(event_name,...)) // replace all lmd_trigger(event_name, argument, argument) // expressions with array [argument, argument] if ( eventDescriptor . on === 0 ) { // if parent is statement -> return void // to prevent loony arrays eg ["pewpew", "ololo"]; if ( walker . parent ( ) [ 0 ] === "stat" ) { return [ "stat" ] ; // wipe statement = return empty statement - ; } /*
                                  [
                                      "call",
                                      ["name", "lmd_trigger"],
                                      [
                                          ["string", "lmd-register:call-sandboxed-module"],
                                          ["name", "moduleName"],
                                          ["name", "require"]
                                      ]
                                  ]
  
                                    --->
  
                                  [
                                      "array",
                                      [
                                          ["name", "moduleName"],
                                          ["name", "require"]
                                      ]
                                  ]
                                  */ return [ "array" , this [ 2 ] . slice ( 1 ) ] ; } // Shorten event names: Using UglifyJS AST find all event names // from lmd_trigger and lmd_on and replace them with corresponding numbers this [ 2 ] [ 0 ] = [ "num" , eventDescriptor . eventIndex ] ; break ; } } }