Skip to content

gh-136938: Do not use var in js, use let and const #136939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 12 additions & 12 deletions Python/emscripten_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ EM_JS_MACROS(void, _emscripten_promising_main_js, (void), {
// `createAsyncInputDevice` simpler, and everything faster.
FS.createAsyncInputDevice = function(parent, name, input) {
parent = typeof parent == 'string' ? parent : FS.getPath(parent);
var path = PATH.join2(parent, name);
var mode = FS_getMode(true, false);
const path = PATH.join2(parent, name);
const mode = FS_getMode(true, false);
FS.createDevice.major ||= 64;
var dev = FS.makedev(FS.createDevice.major++, 0);
const dev = FS.makedev(FS.createDevice.major++, 0);
async function getDataBuf() {
var buf;
let buf;
try {
buf = await input();
} catch (e) {
Expand All @@ -72,7 +72,7 @@ EM_JS_MACROS(void, _emscripten_promising_main_js, (void), {
ops._dataBuf = buf;
}

var ops = {
const ops = {
_dataBuf: new Uint8Array(0),
open(stream) {
stream.seekable = false;
Expand All @@ -82,7 +82,7 @@ EM_JS_MACROS(void, _emscripten_promising_main_js, (void), {
if (!ops._dataBuf.byteLength) {
await getDataBuf();
}
var toRead = Math.min(ops._dataBuf.byteLength, buffer.byteLength);
const toRead = Math.min(ops._dataBuf.byteLength, buffer.byteLength);
buffer.subarray(0, toRead).set(ops._dataBuf);
buffer = buffer.subarray(toRead);
ops._dataBuf = ops._dataBuf.subarray(toRead);
Expand Down Expand Up @@ -151,7 +151,7 @@ EM_JS_MACROS(__externref_t, __maybe_fd_read_async, (
if (!WebAssembly.promising) {
return null;
}
var stream;
let stream;
try {
stream = SYSCALLS.getStreamFromFD(fd);
} catch (e) {
Expand All @@ -169,12 +169,12 @@ EM_JS_MACROS(__externref_t, __maybe_fd_read_async, (
// https://github.com/emscripten-core/emscripten/blob/4.0.11/src/lib/libwasi.js?plain=1#L331
// https://github.com/emscripten-core/emscripten/blob/4.0.11/src/lib/libwasi.js?plain=1#L197
try {
var ret = 0;
for (var i = 0; i < iovcnt; i++) {
var ptr = HEAP32[(iovs + IOVEC_T_BUF_OFFSET)/4];
var len = HEAP32[(iovs + IOVEC_T_BUF_LEN_OFFSET)/4];
let ret = 0;
for (let i = 0; i < iovcnt; i++) {
const ptr = HEAP32[(iovs + IOVEC_T_BUF_OFFSET)/4];
const len = HEAP32[(iovs + IOVEC_T_BUF_LEN_OFFSET)/4];
iovs += IOVEC_T_SIZE;
var curr = await stream.stream_ops.readAsync(stream, HEAP8, ptr, len);
const curr = await stream.stream_ops.readAsync(stream, HEAP8, ptr, len);
if (curr < 0) return -1;
ret += curr;
if (curr < len) break; // nothing more to read
Expand Down
6 changes: 3 additions & 3 deletions Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3655,16 +3655,16 @@ static PyStructSequence_Desc emscripten_info_desc = {
};

EM_JS(char *, _Py_emscripten_runtime, (void), {
var info;
let info;
if (typeof navigator == 'object') {
info = navigator.userAgent;
} else if (typeof process == 'object') {
info = "Node.js ".concat(process.version);
} else {
info = "UNKNOWN";
}
var len = lengthBytesUTF8(info) + 1;
var res = _malloc(len);
const len = lengthBytesUTF8(info) + 1;
const res = _malloc(len);
if (res) stringToUTF8(info, res, len);
#if __wasm64__
return BigInt(res);
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy