Chromium Code Reviews| 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..1f5469161e37b4aec9f4b5e81d72f0319ac65a49 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,8 +47,17 @@ class Flattener(object): |
| else: |
| self.index += 1 |
| + self.lines = map(self._remove_if_operators, self.lines) |
|
Dan Beam
2014/08/01 20:39:54
for line in self.lines:
line[2] = re.sub(self._I
Vitaly Pavlenko
2014/08/01 20:52:37
line[2] = re.sub(self._IF_TAGS_REG, "", line[2])
T
Dan Beam
2014/08/01 20:59:53
^ that's fine
|
| + |
| self.contents = "\n".join(l[2] for l in self.lines) |
| + def _remove_if_operators(self, line): |
| + # Replace every occurrence of tags like <if expr="..."> and </if> |
| + # with an empty string. |
| + file, lnum, contents = line |
| + contents = re.sub(self._IF_TAGS_REG, '', contents) |
| + return (file, lnum, contents) |
| + |
| # Returns a list of tuples in the format: (file, line number, line contents). |
| def _get_file(self, file): |
| lines = FileCache.read(file).splitlines() |