From: Joshua Spence Date: Thu, 23 Apr 2015 10:15:00 +0000 (+1000) Subject: Improve performance of LINT_UNNECESSARY_SEMICOLON X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=9ddf37b9ee3e301b226c9ff20e8be088262efb07;p=arcanist.git Improve performance of LINT_UNNECESSARY_SEMICOLON Summary: Ref T7892. Improve the performance of `ArcanistXHPASTLinter::LINT_UNNECESSARY_SEMICOLON`. Test Plan: Wiped 6 seconds off the total time to lint rARC. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7892 Differential Revision: https://secure.phabricator.com/D12519 --- diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index 6a06039a..b12b581f 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -3490,7 +3490,13 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { continue; } - if ($statement->getSemanticString() == ';') { + if (count($statement->getChildren()) > 1) { + continue; + } else if ($statement->getChildByIndex(0)->getTypeName() != 'n_EMPTY') { + continue; + } + + if ($statement->getConcreteString() == ';') { $this->raiseLintAtNode( $statement, self::LINT_UNNECESSARY_SEMICOLON,