Skip to content

Commit 9836dd2

Browse files
committed
[jsifier] Remove unnecessary replacement in processLibraryFunction
1 parent b4ffae4 commit 9836dd2

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/jsifier.mjs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,10 @@ export async function runJSify(outputFile, symbolsOnly) {
389389
}
390390

391391
function processLibraryFunction(snippet, symbol, mangled, deps, isStub) {
392-
// It is possible that when printing the function as a string on Windows,
393-
// the js interpreter we are in returns the string with Windows line endings
394-
// \r\n. This is undesirable, since line endings are managed in the form \n
395-
// in the output for binary file writes, so make sure the endings are
396-
// uniform.
397-
snippet = snippet.toString().replace(/\r\n/gm, '\n');
392+
snippet = snippet.toString();
393+
394+
// Node's toString() should not return windows line endings, even on windows.
395+
assert(!snippet.includes('\r\n'), `${symbol} contains windows newlines:` + snippet);
398396

399397
// Is this a shorthand `foo() {}` method syntax?
400398
// If so, prepend a function keyword so that it's valid syntax when extracted.

src/lib/libcore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2268,7 +2268,7 @@ addToLibrary({
22682268
},
22692269

22702270
$getNativeTypeSize__deps: ['$POINTER_SIZE'],
2271-
$getNativeTypeSize: {{{ getNativeTypeSize }}},
2271+
$getNativeTypeSize: {{{ getNativeTypeSize.toString() }}},
22722272

22732273
$wasmTable__docs: '/** @type {WebAssembly.Table} */',
22742274
#if RELOCATABLE

0 commit comments

Comments
 (0)