JSNode

The W3 Total Cache JSNode class.

Defined (1)

The class is defined in the following location(s).

/lib/Minify/JSMinPlus.php  
  1. class JSNode 
  2. private $type; 
  3. private $value; 
  4. private $lineno; 
  5. private $start; 
  6. private $end; 
  7.  
  8. public $treeNodes = array(); 
  9. public $funDecls = array(); 
  10. public $varDecls = array(); 
  11.  
  12. public function __construct($t, $type=0) 
  13. if ($token = $t->currentToken()) 
  14. $this->type = $type ? $type : $token->type; 
  15. $this->value = $token->value; 
  16. $this->lineno = $token->lineno; 
  17. $this->start = $token->start; 
  18. $this->end = $token->end; 
  19. else 
  20. $this->type = $type; 
  21. $this->lineno = $t->lineno; 
  22.  
  23. if (($numargs = func_num_args()) > 2) 
  24. $args = func_get_args(); 
  25. for ($i = 2; $i < $numargs; $i++) 
  26. $this->addNode($args[$i]); 
  27.  
  28. // we don't want to bloat our object with all kind of specific properties, so we use overloading 
  29. public function __set($name, $value) 
  30. $this->$name = $value; 
  31.  
  32. public function __get($name) 
  33. if (isset($this->$name)) 
  34. return $this->$name; 
  35.  
  36. return null; 
  37.  
  38. public function addNode($node) 
  39. if ($node !== null) 
  40. if ($node->start < $this->start) 
  41. $this->start = $node->start; 
  42. if ($this->end < $node->end) 
  43. $this->end = $node->end; 
  44.  
  45. $this->treeNodes[] = $node;