Commit 2bb47567 authored by Daniel Clifford's avatar Daniel Clifford Committed by Commit Bot

Fix formatting of Torque union types

Change-Id: Id5e25509cba272083caee62a1ae7420f77f3fa50
Reviewed-on: https://chromium-review.googlesource.com/c/1297949Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarMathias Bynens <mathias@chromium.org>
Commit-Queue: Daniel Clifford <danno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56937}
parent 318ede07
......@@ -9,7 +9,7 @@ type never generates 'void';
type Tagged generates 'TNode<Object>';
type Smi extends Tagged generates 'TNode<Smi>';
type HeapObject extends Tagged generates 'TNode<HeapObject>';
type Object = Smi|HeapObject;
type Object = Smi | HeapObject;
type int32 generates 'TNode<Int32T>' constexpr 'int32_t';
type uint32 generates 'TNode<Uint32T>' constexpr 'uint32_t';
type int64 generates 'TNode<Int64T>' constexpr 'int64_t';
......@@ -31,9 +31,9 @@ type NativeContext extends Context generates 'TNode<Context>';
type String extends HeapObject generates 'TNode<String>';
type Oddball extends HeapObject generates 'TNode<Oddball>';
type HeapNumber extends HeapObject generates 'TNode<HeapNumber>';
type Number = Smi|HeapNumber;
type Number = Smi | HeapNumber;
type BigInt extends HeapObject generates 'TNode<BigInt>';
type Numeric = Number|BigInt;
type Numeric = Number | BigInt;
type Boolean extends Oddball generates 'TNode<Oddball>';
type JSProxy extends JSReceiver generates 'TNode<JSProxy>';
type JSObject extends JSReceiver generates 'TNode<JSObject>';
......@@ -47,7 +47,7 @@ type FastJSArrayForCopy extends FastJSArray
generates 'TNode<JSArray>';
type JSFunction extends JSObject generates 'TNode<JSFunction>';
type JSBoundFunction extends JSObject generates 'TNode<JSBoundFunction>';
type Callable = JSFunction|JSBoundFunction|JSProxy;
type Callable = JSFunction | JSBoundFunction | JSProxy;
type Map extends HeapObject generates 'TNode<Map>';
type FixedArrayBase extends HeapObject generates 'TNode<FixedArrayBase>';
type FixedArray extends FixedArrayBase generates 'TNode<FixedArray>';
......
......@@ -29,6 +29,14 @@ def preprocess(input):
input = re.sub(r'(\s+)case\s*\(\s*([^\s]+)\s*\:\s*([^\:]+)\s*\)(\s*)\:',
r'\1case \3: /*_TSV\2:*/', input)
# Add extra space around | operators to fix union types later.
while True:
old = input
input = re.sub(r'(\w+\s*)\|(\s*\w+)',
r'\1|/**/\2', input)
if old == input:
break;
input = re.sub(r'\sgenerates\s+\'([^\']+)\'\s*',
r' _GeNeRaTeS00_/*\1@*/', input)
input = re.sub(r'\sconstexpr\s+\'([^\']+)\'\s*',
......@@ -65,6 +73,14 @@ def postprocess(output):
r"\n\1otherwise", output)
output = re.sub(r'_OtheSaLi',
r"otherwise", output)
while True:
old = output
output = re.sub(r'(\w+)\|/\*\*/(\s*\w+)',
r'\1 |\2', output)
if old == output:
break;
return output
if len(sys.argv) < 2 or len(sys.argv) > 3:
......
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