Changeset View
Changeset View
Standalone View
Standalone View
src/parser/aast/api/AASTNode.php
| <?php | <?php | ||||
| abstract class AASTNode { | abstract class AASTNode extends Phobject { | ||||
| protected $id; | protected $id; | ||||
| protected $l; | protected $l; | ||||
| protected $r; | protected $r; | ||||
| protected $typeID; | protected $typeID; | ||||
| protected $typeName; | |||||
| protected $tree; | protected $tree; | ||||
| // These are public only as a microoptimization to make tree construction | // These are public only as a microoptimization to make tree construction | ||||
| // faster; do not access them directly. | // faster; do not access them directly. | ||||
| public $children = array(); | public $children = array(); | ||||
| public $parentNode; | public $parentNode; | ||||
| private $selectCache; | |||||
| abstract public function isStaticScalar(); | abstract public function isStaticScalar(); | ||||
| abstract public function getDocblockToken(); | abstract public function getDocblockToken(); | ||||
| abstract public function evalStatic(); | abstract public function evalStatic(); | ||||
| abstract public function getStringLiteralValue(); | abstract public function getStringLiteralValue(); | ||||
| public function __construct($id, array $data, AASTTree $tree) { | public function __construct($id, array $data, AASTTree $tree) { | ||||
| $this->id = $id; | $this->id = $id; | ||||
| $this->typeID = $data[0]; | $this->typeID = $data[0]; | ||||
| ▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | foreach ($type_names as $type_name) { | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return $tokens; | return $tokens; | ||||
| } | } | ||||
| final public function isDescendantOf(AASTNode $node) { | |||||
| for ($it = $this; $it !== null; $it = $it->getParentNode()) { | |||||
| if ($it === $node) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| public function selectDescendantsOfType($type_name) { | public function selectDescendantsOfType($type_name) { | ||||
| return $this->selectDescendantsOfTypes(array($type_name)); | return $this->selectDescendantsOfTypes(array($type_name)); | ||||
| } | } | ||||
| public function selectDescendantsOfTypes(array $type_names) { | public function selectDescendantsOfTypes(array $type_names) { | ||||
| $nodes = array(); | $nodes = array(); | ||||
| foreach ($type_names as $type_name) { | foreach ($type_names as $type_name) { | ||||
| $type = $this->getTypeIDFromTypeName($type_name); | $type = $this->getTypeIDFromTypeName($type_name); | ||||
| ▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines | |||||