Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1098)

Unified Diff: third_party/closure_compiler/checker.py

Issue 435053002: Remove <if> statements before checking JS code by checker.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@B_define
Patch Set: inline replace_if function Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/closure_compiler/checker_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/closure_compiler/checker.py
diff --git a/third_party/closure_compiler/checker.py b/third_party/closure_compiler/checker.py
index 7dda25fc1fc2cfcfcc88efc11203e29e65cba4ac..5a6db172fb807049e397d2e716fb95bd3c054432 100644
--- a/third_party/closure_compiler/checker.py
+++ b/third_party/closure_compiler/checker.py
@@ -31,6 +31,7 @@ class FileCache(object):
class Flattener(object):
+ _IF_TAGS_REG = "</?if[^>]*?>"
_INCLUDE_REG = "<include[^>]+src=['\"]([^>]*)['\"]>"
def __init__(self, file):
@@ -46,6 +47,11 @@ class Flattener(object):
else:
self.index += 1
+ # Replace every occurrence of tags like <if expr="..."> and </if>
+ # with an empty string.
Dan Beam 2014/08/02 00:04:56 ^ i think the code pretty clearly shows this, but
+ for i, line in enumerate(self.lines):
+ self.lines[i] = line[:2] + (re.sub(self._IF_TAGS_REG, "", line[2]),)
+
self.contents = "\n".join(l[2] for l in self.lines)
# Returns a list of tuples in the format: (file, line number, line contents).
« no previous file with comments | « no previous file | third_party/closure_compiler/checker_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698