Commit 5ae5d70c authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[torque] Fix formatting of tq files with #include

Formatter does not recognize #include, since we format .tq files as TS.
So replace it with a comment first, then substitute it back.

This should also fix the Presubmit in waterfall

https://ci.chromium.org/p/v8/builders/ci/V8%20Presubmit/10296

Change-Id: I316d52fc24e099474c542f75773683b54e8d0a63
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2175089Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67512}
parent 84a06b59
......@@ -41,6 +41,11 @@ def preprocess(input):
# intrinsic's name if it's already adjacent to it.
input = re.sub(r'%([A-Za-z])', kPercentEscape + r'\1', input)
# includes are not recognized, change them into comments so that the
# formatter ignores them first, until we can figure out a way to format cpp
# includes within a JS file.
input = re.sub(r'^#include', r'// InClUdE', input, flags=re.MULTILINE)
return input
def postprocess(output):
......@@ -71,6 +76,8 @@ def postprocess(output):
output = re.sub(kPercentEscape, r'%', output)
output = re.sub( r'^// InClUdE',r'#include', output, flags=re.MULTILINE)
return output
def process(filename, lint, should_format):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment