minor perf improvements
parent
6e7f77be6d
commit
7b633f5e07
|
@ -33,7 +33,7 @@ if (count($testProviderArray) === 0) {
|
|||
}
|
||||
|
||||
foreach ($testProviderArray as $idx=>$testCaseFile) {
|
||||
if ($idx > 10) {
|
||||
if ($idx > 20) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue