]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Improve performance of LINT_UNNECESSARY_SEMICOLON
authorJoshua Spence <josh@joshuaspence.com>
Thu, 23 Apr 2015 10:15:00 +0000 (20:15 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Thu, 23 Apr 2015 10:18:54 +0000 (20:18 +1000)
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

src/lint/linter/ArcanistXHPASTLinter.php

index 6a06039a134c859b0837f7f55069968d4c0df5f8..b12b581f084c1509d32b6a3183a70d0239188af2 100644 (file)
@@ -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,