]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Speedup implicit fallthrough lint rule by 99.5 %
authorvrana <jakubv@fb.com>
Fri, 22 Feb 2013 21:49:16 +0000 (13:49 -0800)
committervrana <jakubv@fb.com>
Fri, 22 Feb 2013 22:16:03 +0000 (14:16 -0800)
Summary: At least on my sample file.

Test Plan: Saw time 0.073 s instead of 12.606 s.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D5086

src/lint/linter/ArcanistXHPASTLinter.php

index 0843ea81a21995ab56689b98c369a97fb40958ca..886236be7c98120cb98b31ff8c8e79dcac5308da 100644 (file)
@@ -534,9 +534,10 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
         $tokens = $block->getTokens();
         $last = end($tokens);
         while ($last && $last = $last->getNextToken()) {
-          if (!$last->isSemantic()) {
-            $tokens[$last->getTokenID()] = $last;
+          if ($last->isSemantic()) {
+            break;
           }
+          $tokens[$last->getTokenID()] = $last;
         }
 
         $blocks[$key] = array(