Skip to content

Commit f9a4444

Browse files
committed
[jsifier] Remove unnecessary replacement in processLibraryFunction
1 parent d020153 commit f9a4444

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
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'));
398396

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

0 commit comments

Comments
 (0)