minor perf improvements
parent
6e7f77be6d
commit
7b633f5e07
|
@ -33,7 +33,7 @@ if (count($testProviderArray) === 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($testProviderArray as $idx=>$testCaseFile) {
|
foreach ($testProviderArray as $idx=>$testCaseFile) {
|
||||||
if ($idx > 10) {
|
if ($idx > 20) {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -536,7 +536,7 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Check each previous sibling node for a variable assignment to that variable
|
// 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) {
|
if ($n instanceof Tolerant\Node\Statement\ExpressionStatement) {
|
||||||
$n = $n->expression;
|
$n = $n->expression;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ class TolerantTreeAnalyzer implements TreeAnalyzerInterface {
|
||||||
/** @var Tolerant\Node */
|
/** @var Tolerant\Node */
|
||||||
private $stmts;
|
private $stmts;
|
||||||
|
|
||||||
|
private $diagnostics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TolerantTreeAnalyzer constructor.
|
* TolerantTreeAnalyzer constructor.
|
||||||
* @param Tolerant\Parser $parser
|
* @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) {
|
foreach (Tolerant\DiagnosticsProvider::getDiagnostics($this->stmts) as $_error) {
|
||||||
|
$this->diagnostics = [];
|
||||||
$range = Tolerant\PositionUtilities::getRangeFromPosition($_error->start, $_error->length, $content);
|
$range = Tolerant\PositionUtilities::getRangeFromPosition($_error->start, $_error->length, $content);
|
||||||
|
|
||||||
$diagnostics[] = new Diagnostic(
|
$this->diagnostics[] = new Diagnostic(
|
||||||
$_error->message,
|
$_error->message,
|
||||||
new Range(
|
new Range(
|
||||||
new Position($range->start->line, $range->start->character),
|
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)
|
private function addReference(string $fqn, Tolerant\Node $node)
|
||||||
|
|
Loading…
Reference in New Issue