Skip to content

Commit

Permalink
test,util: remove lint workarounds
Browse files Browse the repository at this point in the history
Remove assignments to `SIMD` that are only to pacify ESLint. Instead,
use either `global.SIMD` or provide an comment letting ESLint know in
cases where `SIMD` is guaranteed to be a defined global identifier.

PR-URL: #10785
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
Trott authored and MylesBorins committed Mar 9, 2017
1 parent e316faf commit 4a87aee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
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)
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

0 comments on commit 4a87aee

Please sign in to comment.