Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[squash] move SIMD formatter lookup further below in the if/else chain
  • Loading branch information
addaleax committed Jul 26, 2016
commit 696c05ec96af10e488faaef00bc0511d36f7d6fa
11 changes: 6 additions & 5 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,13 @@ function formatValue(ctx, value, recurseTimes) {
'byteOffset',
'buffer');
}
} else if (simdFormatters &&
typeof value.constructor === 'function' &&
simdFormatters.has(value.constructor)) {
braces = ['[', ']'];
formatter = simdFormatters.get(value.constructor);
} else {
var promiseInternals = inspectPromise(value);
if (promiseInternals) {
braces = ['{', '}'];
formatter = formatPromise;
} else {
let maybeSimdFormatter;
if (binding.isMapIterator(value)) {
constructor = { name: 'MapIterator' };
braces = ['{', '}'];
Expand All @@ -508,6 +504,11 @@ function formatValue(ctx, value, recurseTimes) {
braces = ['{', '}'];
empty = false;
formatter = formatCollectionIterator;
} else if (simdFormatters &&
typeof constructor === 'function' &&
(maybeSimdFormatter = simdFormatters.get(constructor))) {
braces = ['[', ']'];
formatter = maybeSimdFormatter;
} else {
// Unset the constructor to prevent "Object {...}" for ordinary objects.
if (constructor && constructor.name === 'Object')
Expand Down