Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test,util: remove lint workarounds #10785

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@ var simdFormatters;
if (typeof global.SIMD === 'object' && global.SIMD !== null) {
simdFormatters = new Map();

const make = (extractLane, count) => {
return (ctx, value, recurseTimes, visibleKeys, keys) => {
const make =
(extractLane, count) => (ctx, value, recurseTimes, visibleKeys, keys) => {
const output = new Array(count);
for (var i = 0; i < count; i += 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO: You can replace var with let.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're avoiding using let in loops at the moment due to performance concerns. For more context, see #8637 and #9049.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the information! I understood about it.

output[i] = formatPrimitive(ctx, extractLane(value, i));
return output;
};
};

const SIMD = global.SIMD; // Pacify eslint.

const countPerType = {
Bool16x8: 8,
Expand All @@ -52,7 +49,7 @@ if (typeof global.SIMD === 'object' && global.SIMD !== null) {
};

for (const key in countPerType) {
const type = SIMD[key];
const type = global.SIMD[key];
simdFormatters.set(type, make(type.extractLane, countPerType[key]));
}
}
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-util-inspect-simd.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Flags: --harmony_simd
/* global SIMD */
'use strict';

require('../common');
const assert = require('assert');
const inspect = require('util').inspect;

const SIMD = global.SIMD; // Pacify eslint.

assert.strictEqual(
inspect(SIMD.Bool16x8()),
'Bool16x8 [ false, false, false, false, false, false, false, false ]');
Expand Down