You are here

class JSNode in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 8.4 advagg_js_minify/jsminplus.inc \JSNode
  2. 8.2 advagg_js_minify/jsminplus.inc \JSNode
  3. 8.3 advagg_js_minify/jsminplus.inc \JSNode
  4. 6 advagg_js_compress/jsminplus.inc \JSNode
  5. 7.2 advagg_js_compress/jsminplus.inc \JSNode

Hierarchy

Expanded class hierarchy of JSNode

File

advagg_js_compress/jsminplus.inc, line 1781

View source
class JSNode {
  private $type;
  private $value;
  private $lineno;
  private $start;
  private $end;
  public $treeNodes = array();
  public $funDecls = array();
  public $varDecls = array();
  public function __construct($t, $type = 0) {
    if ($token = $t
      ->currentToken()) {
      $this->type = $type ? $type : $token->type;
      $this->value = $token->value;
      $this->lineno = $token->lineno;
      $this->start = $token->start;
      $this->end = $token->end;
    }
    else {
      $this->type = $type;
      $this->lineno = $t->lineno;
    }
    if (($numargs = func_num_args()) > 2) {
      $args = func_get_args();
      for ($i = 2; $i < $numargs; $i++) {
        $this
          ->addNode($args[$i]);
      }
    }
  }

  // we don't want to bloat our object with all kind of specific properties, so we use overloading
  public function __set($name, $value) {
    $this->{$name} = $value;
  }
  public function __get($name) {
    if (isset($this->{$name})) {
      return $this->{$name};
    }
    return null;
  }
  public function addNode($node) {
    if ($node !== null) {
      if ($node->start < $this->start) {
        $this->start = $node->start;
      }
      if ($this->end < $node->end) {
        $this->end = $node->end;
      }
    }
    $this->treeNodes[] = $node;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
JSNode::$end private property
JSNode::$funDecls public property
JSNode::$lineno private property
JSNode::$start private property
JSNode::$treeNodes public property
JSNode::$type private property
JSNode::$value private property
JSNode::$varDecls public property
JSNode::addNode public function
JSNode::__construct public function
JSNode::__get public function
JSNode::__set public function