Skip to content

Commit 40b52e2

Browse files
authored
Remove unused arguments from makeGetValue (#23784)
The last 4 arguments to this helper function are no used and we have had assertions in the code a for while now with no reports of folks depending on these.
1 parent 5a62c4d commit 40b52e2

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

src/parseTools.mjs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -412,27 +412,13 @@ function asmFloatToInt(x) {
412412
}
413413

414414
// See makeSetValue
415-
function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, _ignore, align) {
416-
assert(typeof align === 'undefined', 'makeGetValue no longer supports align parameter');
417-
assert(
418-
typeof noNeedFirst === 'undefined',
419-
'makeGetValue no longer supports noNeedFirst parameter',
420-
);
421-
if (typeof unsigned !== 'undefined') {
422-
// TODO(sbc): make this into an error at some point.
423-
printErr(
424-
'makeGetValue: Please use u8/u16/u32/u64 unsigned types in favor of additional argument',
425-
);
426-
if (unsigned && type.startsWith('i')) {
427-
type = `u${type.slice(1)}`;
428-
}
429-
} else if (type.startsWith('u')) {
430-
// Set `unsigned` based on the type name.
431-
unsigned = true;
432-
}
415+
function makeGetValue(ptr, pos, type) {
416+
assert(arguments.length == 3, 'makeGetValue expects 3 arguments');
433417

434418
const offset = calcFastOffset(ptr, pos);
435419
if (type === 'i53' || type === 'u53') {
420+
// Set `unsigned` based on the type name.
421+
const unsigned = type.startsWith('u');
436422
return `readI53From${unsigned ? 'U' : 'I'}64(${offset})`;
437423
}
438424

test/other/test_parseTools.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ addToLibrary({
5555
out('u32: ' + val.toString(16))
5656
assert(val == 0xedcba988);
5757

58-
// unsigned i32 (legacy)
59-
val = {{{ makeGetValue('ptr', '0', 'i32', undefined, /*unsigned=*/true) }}};
60-
out('u32 legacy: ' + val.toString(16))
61-
assert(val == 0xedcba988);
62-
6358
// i16
6459
val = {{{ makeGetValue('ptr', '0', 'i16') }}};
6560
out('i16: ' + val.toString(16))
@@ -70,11 +65,6 @@ addToLibrary({
7065
out('u16: ' + val.toString(16))
7166
assert(val == 43400);
7267

73-
// unsigned i16 (legacy)
74-
val = {{{ makeGetValue('ptr', '0', 'i16', undefined, /*unsigned=*/true) }}};
75-
out('u16 legacy: ' + val.toString(16))
76-
assert(val == 43400);
77-
7868
// i8
7969
val = {{{ makeGetValue('ptr', '0', 'i8') }}};
8070
out('i8: ' + val.toString(16))
@@ -85,11 +75,6 @@ addToLibrary({
8575
out('u8: ' + val.toString(16))
8676
assert(val == 0x88);
8777

88-
// unsigned i8 (legacy)
89-
val = {{{ makeGetValue('ptr', '0', 'i8', undefined, /*unsigned=*/true) }}};
90-
out('u8 legacy: ' + val.toString(16))
91-
assert(val == 0x88);
92-
9378
// pointer
9479
val = {{{ makeGetValue('ptr', '0', 'void*') }}};
9580
out('ptr: ' + val.toString(16))

test/other/test_parseTools.out

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ i53: -aabb12345678
77
u53: ffff5544edcba800
88
i32: -12345678
99
u32: edcba988
10-
u32 legacy: edcba988
1110
i16: -5678
1211
u16: a988
13-
u16 legacy: a988
1412
i8: -78
1513
u8: 88
16-
u8 legacy: 88
1714
ptr: edcba988
1815
ptr: edcba988
1916

0 commit comments

Comments
 (0)