mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Only do partial parsing if there are few changes
This commit is contained in:
parent
cd9e9321fd
commit
1a08b69d9c
@ -123,11 +123,16 @@ class StatementsProvider
|
||||
|
||||
if ($existing_statements && $existing_file_contents) {
|
||||
$file_changes = \Psalm\Diff\FileDiffer::getDiff($existing_file_contents, $file_contents);
|
||||
$traverser = new PhpParser\NodeTraverser;
|
||||
$traverser->addVisitor(new \Psalm\Visitor\CloningVisitor);
|
||||
// performs a deep clone
|
||||
/** @var array<int, PhpParser\Node\Stmt> */
|
||||
$existing_statements_copy = $traverser->traverse($existing_statements);
|
||||
|
||||
if (count($file_changes) < 10) {
|
||||
$traverser = new PhpParser\NodeTraverser;
|
||||
$traverser->addVisitor(new \Psalm\Visitor\CloningVisitor);
|
||||
// performs a deep clone
|
||||
/** @var array<int, PhpParser\Node\Stmt> */
|
||||
$existing_statements_copy = $traverser->traverse($existing_statements);
|
||||
} else {
|
||||
$file_changes = null;
|
||||
}
|
||||
}
|
||||
|
||||
$stmts = self::parseStatements(
|
||||
|
Loading…
Reference in New Issue
Block a user