Page MenuHomePhabricator

D10534.id25345.diff
No OneTemporary

D10534.id25345.diff

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
@@ -243,6 +243,15 @@
return $stream[$this->l]->getOffset();
}
+ public function getLength() {
+ $stream = $this->tree->getRawTokenStream();
+ if (empty($stream[$this->r])) {
+ return null;
+ }
+ return $stream[$this->r]->getOffset() - $this->getOffset();
+ }
+
+
public function getSurroundingNonsemanticTokens() {
$before = array();
$after = array();
@@ -264,6 +273,12 @@
return idx($this->tree->getOffsetToLineNumberMap(), $this->getOffset());
}
+ public function getEndLineNumber() {
+ return idx(
+ $this->tree->getOffsetToLineNumberMap(),
+ $this->getOffset() + $this->getLength());
+ }
+
public function dispose() {
foreach ($this->getChildren() as $child) {
$child->dispose();

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 16, 12:18 AM (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7285119
Default Alt Text
D10534.id25345.diff (927 B)

Event Timeline