diff --git a/src/parser/aast/api/AASTNode.php b/src/parser/aast/api/AASTNode.php --- a/src/parser/aast/api/AASTNode.php +++ b/src/parser/aast/api/AASTNode.php @@ -34,23 +34,23 @@ $this->tree = $tree; } - public function getParentNode() { + public final function getParentNode() { return $this->parentNode; } - public function getID() { + public final function getID() { return $this->id; } - public function getTypeID() { + public final function getTypeID() { return $this->typeID; } - public function getTree() { + public final function getTree() { return $this->tree; } - public function getTypeName() { + public final function getTypeName() { if (empty($this->typeName)) { $this->typeName = $this->tree->getNodeTypeNameFromTypeID($this->getTypeID()); @@ -58,7 +58,7 @@ return $this->typeName; } - public function getChildren() { + public final function getChildren() { return $this->children; } @@ -250,11 +250,11 @@ return pht('a node of type %s: "%s"', $this->getTypeName(), $concrete); } - protected function getTypeIDFromTypeName($type_name) { + protected final function getTypeIDFromTypeName($type_name) { return $this->tree->getNodeTypeIDFromTypeName($type_name); } - public function getOffset() { + public final function getOffset() { $stream = $this->tree->getRawTokenStream(); if (empty($stream[$this->l])) { return null; @@ -262,7 +262,7 @@ return $stream[$this->l]->getOffset(); } - public function getLength() { + public final function getLength() { $stream = $this->tree->getRawTokenStream(); if (empty($stream[$this->r])) { return null; @@ -288,11 +288,11 @@ return array($before, $after); } - public function getLineNumber() { + public final function getLineNumber() { return idx($this->tree->getOffsetToLineNumberMap(), $this->getOffset()); } - public function getEndLineNumber() { + public final function getEndLineNumber() { return idx( $this->tree->getOffsetToLineNumberMap(), $this->getOffset() + $this->getLength()); diff --git a/src/parser/aast/api/AASTToken.php b/src/parser/aast/api/AASTToken.php --- a/src/parser/aast/api/AASTToken.php +++ b/src/parser/aast/api/AASTToken.php @@ -17,11 +17,11 @@ $this->tree = $tree; } - public function getTokenID() { + public final function getTokenID() { return $this->id; } - public function getTypeID() { + public final function getTypeID() { return $this->typeID; } @@ -32,11 +32,11 @@ return $this->typeName; } - public function getValue() { + public final function getValue() { return $this->value; } - public function getOffset() { + public final function getOffset() { return $this->offset; } diff --git a/src/parser/aast/api/AASTTree.php b/src/parser/aast/api/AASTTree.php --- a/src/parser/aast/api/AASTTree.php +++ b/src/parser/aast/api/AASTTree.php @@ -43,28 +43,28 @@ $this->buildTree(array($tree)); } - public function setTreeType($description) { + public final function setTreeType($description) { $this->treeType = $description; return $this; } - public function getTreeType() { + public final function getTreeType() { return $this->treeType; } - public function setTokenConstants(array $token_map) { + public final function setTokenConstants(array $token_map) { $this->tokenConstants = $token_map; $this->tokenReverseMap = array_flip($token_map); return $this; } - public function setNodeConstants(array $node_map) { + public final function setNodeConstants(array $node_map) { $this->nodeConstants = $node_map; $this->nodeReverseMap = array_flip($node_map); return $this; } - public function getNodeTypeNameFromTypeID($type_id) { + public final function getNodeTypeNameFromTypeID($type_id) { if (empty($this->nodeConstants[$type_id])) { $tree_type = $this->getTreeType(); throw new Exception( @@ -77,7 +77,7 @@ return $this->nodeConstants[$type_id]; } - public function getNodeTypeIDFromTypeName($type_name) { + public final function getNodeTypeIDFromTypeName($type_name) { if (empty($this->nodeReverseMap[$type_name])) { $tree_type = $this->getTreeType(); throw new Exception( @@ -89,7 +89,7 @@ return $this->nodeReverseMap[$type_name]; } - public function getTokenTypeNameFromTypeID($type_id) { + public final function getTokenTypeNameFromTypeID($type_id) { if (empty($this->tokenConstants[$type_id])) { $tree_type = $this->getTreeType(); throw new Exception( @@ -101,7 +101,7 @@ return $this->tokenConstants[$type_id]; } - public function getTokenTypeIDFromTypeName($type_name) { + public final function getTokenTypeIDFromTypeName($type_name) { if (empty($this->tokenReverseMap[$type_name])) { $tree_type = $this->getTreeType(); throw new Exception( @@ -126,7 +126,7 @@ unset($this->stream); } - public function getRootNode() { + public final function getRootNode() { return $this->tree[0]; } @@ -156,7 +156,7 @@ return $result; } - public function getRawTokenStream() { + public final function getRawTokenStream() { return $this->stream; } diff --git a/src/parser/xhpast/api/XHPASTNode.php b/src/parser/xhpast/api/XHPASTNode.php --- a/src/parser/xhpast/api/XHPASTNode.php +++ b/src/parser/xhpast/api/XHPASTNode.php @@ -230,8 +230,4 @@ return stripcslashes($out); } - public function getLineNumber() { - return idx($this->tree->getOffsetToLineNumberMap(), $this->getOffset()); - } - }