1
0
Fork 0

minor perf improvements

pull/357/head
Sara Itani 2017-03-21 15:25:49 -07:00
parent 6e7f77be6d
commit 7b633f5e07
3 changed files with 10 additions and 8 deletions

View File

@ -33,7 +33,7 @@ if (count($testProviderArray) === 0) {
}
foreach ($testProviderArray as $idx=>$testCaseFile) {
if ($idx > 10) {
if ($idx > 20) {
exit();
}

View File

@ -536,7 +536,7 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
break;
}
// Check each previous sibling node for a variable assignment to that variable
while ($n->getPreviousSibling() && $n = $n->getPreviousSibling()) {
while (($prevSibling = $n->getPreviousSibling()) !== null && $n = $prevSibling) {
if ($n instanceof Tolerant\Node\Statement\ExpressionStatement) {
$n = $n->expression;
}

View File

@ -25,6 +25,8 @@ class TolerantTreeAnalyzer implements TreeAnalyzerInterface {
/** @var Tolerant\Node */
private $stmts;
private $diagnostics;
/**
* TolerantTreeAnalyzer constructor.
* @param Tolerant\Parser $parser
@ -100,15 +102,12 @@ class TolerantTreeAnalyzer implements TreeAnalyzerInterface {
}
}
}
}
public function getDiagnostics() {
$diagnostics = [];
$content = $this->stmts->getFileContents();
foreach (Tolerant\DiagnosticsProvider::getDiagnostics($this->stmts) as $_error) {
$this->diagnostics = [];
$range = Tolerant\PositionUtilities::getRangeFromPosition($_error->start, $_error->length, $content);
$diagnostics[] = new Diagnostic(
$this->diagnostics[] = new Diagnostic(
$_error->message,
new Range(
new Position($range->start->line, $range->start->character),
@ -116,7 +115,10 @@ class TolerantTreeAnalyzer implements TreeAnalyzerInterface {
)
);
}
return $diagnostics;
}
public function getDiagnostics() {
return $this->diagnostics;
}
private function addReference(string $fqn, Tolerant\Node $node)