Commit 8a94daf5 authored by Wael Almattar's avatar Wael Almattar Committed by V8 LUCI CQ

[tools] Refactor, use built-in Array.flat() instead of custom flatten method

Change-Id: I0e4de2d943db5a6af41bb1a1599e0ebb0568d290
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2912881Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74849}
parent ff9a6689
...@@ -228,6 +228,7 @@ Victor Costan <costan@gmail.com> ...@@ -228,6 +228,7 @@ Victor Costan <costan@gmail.com>
Vlad Burlik <vladbph@gmail.com> Vlad Burlik <vladbph@gmail.com>
Vladimir Krivosheev <develar@gmail.com> Vladimir Krivosheev <develar@gmail.com>
Vladimir Shutoff <vovan@shutoff.ru> Vladimir Shutoff <vovan@shutoff.ru>
Wael Almattar <waelsy123@gmail.com>
Wei Wu <lazyparser@gmail.com> Wei Wu <lazyparser@gmail.com>
Wenlu Wang <kingwenlu@gmail.com> Wenlu Wang <kingwenlu@gmail.com>
Wenyu Zhao <wenyu.zhao@anu.edu.au> Wenyu Zhao <wenyu.zhao@anu.edu.au>
......
...@@ -24,9 +24,6 @@ import { Root } from 'protobufjs'; ...@@ -24,9 +24,6 @@ import { Root } from 'protobufjs';
// JSON fields it will include/exclude based on the data present in the trace // JSON fields it will include/exclude based on the data present in the trace
// event. // event.
// TODO(petermarshall): Replace with Array#flat once it lands in Node.js.
const flatten = <T>(a: T[], b: T[]) => { a.push(...b); return a; }
// Convert a string representing an int or uint (64 bit) to a Number or throw // Convert a string representing an int or uint (64 bit) to a Number or throw
// if the value won't fit. // if the value won't fit.
function parseIntOrThrow(int: string) { function parseIntOrThrow(int: string) {
...@@ -124,7 +121,7 @@ async function main() { ...@@ -124,7 +121,7 @@ async function main() {
}, {}) }, {})
}; };
})) }))
.reduce(flatten, []) .flat()
}; };
await fs.promises.writeFile(process.argv[4], JSON.stringify(output, null, 2)); await fs.promises.writeFile(process.argv[4], JSON.stringify(output, null, 2));
} }
......
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