Skip to content

Commit 91c6c4d

Browse files
coadometa-codesync[bot]
authored andcommitted
Use dictionary for calling input filters (#56089)
Summary: Pull Request resolved: #56089 Changelog: [Internal] Replaces chained input filter calls with an iteration over a dict. Reviewed By: cipolleschi Differential Revision: D96455826 fbshipit-source-id: bdaf44285db6d3432a6401d6118f245abfa7dafb
1 parent 4aacd3f commit 91c6c4d

File tree

1 file changed

+11
-4
lines changed
  • scripts/cxx-api/parser/input_filters

1 file changed

+11
-4
lines changed

scripts/cxx-api/parser/input_filters/main.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
from strip_deprecated_msg import strip_deprecated_msg
1515
from strip_ns_unavailable import strip_ns_unavailable
1616

17+
FILTERS = [
18+
strip_block_comments,
19+
strip_deprecated_msg,
20+
strip_ns_unavailable,
21+
encode_objc_interface_generics,
22+
]
23+
1724

1825
def main():
1926
if len(sys.argv) < 2:
@@ -26,10 +33,10 @@ def main():
2633
with open(filename, "r", encoding="utf-8", errors="replace") as f:
2734
content = f.read()
2835

29-
filtered = strip_block_comments(content)
30-
filtered = strip_deprecated_msg(filtered)
31-
filtered = strip_ns_unavailable(filtered)
32-
filtered = encode_objc_interface_generics(filtered)
36+
filtered = content
37+
for filter_fn in FILTERS:
38+
filtered = filter_fn(filtered)
39+
3340
print(filtered, end="")
3441
except Exception as e:
3542
# On error, output original content to not break the build

0 commit comments

Comments
 (0)