From c23ad29d149a27adb9dae0ea6d8f0e05851b5ebf Mon Sep 17 00:00:00 2001 From: Jose Date: Mon, 28 Oct 2024 22:52:08 +0100 Subject: [PATCH] Cleanup JavaScript var usage - Fix #2876 (#2991) --- js/src/Ice/ConnectionI.js | 2 +- js/src/Ice/IncomingRequest.js | 4 ++-- js/src/Ice/OutgoingAsync.js | 2 +- js/src/Ice/OutputStream.js | 2 +- js/src/Ice/Properties.js | 4 ++-- js/src/Ice/Reference.js | 2 +- js/test/Ice/middleware/Server.ts | 2 +- js/test/Ice/timeout/Client.ts | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/js/src/Ice/ConnectionI.js b/js/src/Ice/ConnectionI.js index a2d293df904..1c7fa067f89 100644 --- a/js/src/Ice/ConnectionI.js +++ b/js/src/Ice/ConnectionI.js @@ -1418,7 +1418,7 @@ export class ConnectionI { while (requestCount > 0) { // adapter can be null here, however the adapter set in current can't be null, and we never pass // a null current.adapter to the application code. - var request = new IncomingRequest(requestId, this, adapter, stream); + const request = new IncomingRequest(requestId, this, adapter, stream); if (dispatcher !== null) { // We don't and can't await the dispatchAsync: with batch requests, we want all the dispatches to diff --git a/js/src/Ice/IncomingRequest.js b/js/src/Ice/IncomingRequest.js index 2626277eaa2..28c93a4f1c9 100644 --- a/js/src/Ice/IncomingRequest.js +++ b/js/src/Ice/IncomingRequest.js @@ -32,7 +32,7 @@ export class IncomingRequest { // Read everything else from the input stream const start = inputStream.pos; - var identity = new Identity(); + const identity = new Identity(); identity._read(inputStream); let facet = ""; @@ -52,7 +52,7 @@ export class IncomingRequest { } const encapsulationSize = inputStream.readInt(); - var encoding = new EncodingVersion(); + const encoding = new EncodingVersion(); encoding._read(inputStream); this._current = new Current(adapter, connection, identity, facet, operation, mode, ctx, requestId, encoding); diff --git a/js/src/Ice/OutgoingAsync.js b/js/src/Ice/OutgoingAsync.js index a256c6000cc..62ab4fe6ac4 100644 --- a/js/src/Ice/OutgoingAsync.js +++ b/js/src/Ice/OutgoingAsync.js @@ -272,7 +272,7 @@ export class ProxyOutgoingAsyncBase extends OutgoingAsyncBase { ++this._cnt; Debug.assert(this._cnt > 0); - var retryIntervals = instance._retryIntervals; + const retryIntervals = instance._retryIntervals; let interval = 0; if (this._cnt == retryIntervals.length + 1 && ex instanceof CloseConnectionException) { diff --git a/js/src/Ice/OutputStream.js b/js/src/Ice/OutputStream.js index ea039f5dafa..024a4dabcdd 100644 --- a/js/src/Ice/OutputStream.js +++ b/js/src/Ice/OutputStream.js @@ -489,7 +489,7 @@ EncapsEncoder11.InstanceData = class { export class OutputStream { constructor(arg1, arg2) { - var instance = null; + let instance = null; this._encoding = null; if (arg1 !== undefined && arg1 !== null) { diff --git a/js/src/Ice/Properties.js b/js/src/Ice/Properties.js index 9a31455b1de..eb508d2f2f4 100644 --- a/js/src/Ice/Properties.js +++ b/js/src/Ice/Properties.js @@ -62,7 +62,7 @@ export class Properties { getIcePropertyAsInt(key) { const defaultValueString = Properties.getDefaultProperty(key); - var defaultValue = 0; + let defaultValue = 0; if (defaultValueString != "") { defaultValue = parseInt(defaultValueString); } @@ -84,7 +84,7 @@ export class Properties { } getIcePropertyAsList(key) { - var defaultPropertyList = StringUtil.splitString(Properties.getDefaultProperty(key), ", \t\r\n"); + const defaultPropertyList = StringUtil.splitString(Properties.getDefaultProperty(key), ", \t\r\n"); return this.getPropertyAsListWithDefault(key, defaultPropertyList); } diff --git a/js/src/Ice/Reference.js b/js/src/Ice/Reference.js index f17d964b499..4ef9b1a4d0c 100644 --- a/js/src/Ice/Reference.js +++ b/js/src/Ice/Reference.js @@ -1026,7 +1026,7 @@ export class RoutableReference extends Reference { } getRequestHandler() { - var handler = new ConnectRequestHandler(this); + const handler = new ConnectRequestHandler(this); this.getConnection(handler); return handler; } diff --git a/js/test/Ice/middleware/Server.ts b/js/test/Ice/middleware/Server.ts index 2ebfb022afd..c27fbbae784 100644 --- a/js/test/Ice/middleware/Server.ts +++ b/js/test/Ice/middleware/Server.ts @@ -14,7 +14,7 @@ class Middleware extends Ice.Object { return this._next.dispatch(request); } else { this._inLog.push(this._name); - var response = await this._next.dispatch(request); + const response = await this._next.dispatch(request); this._outLog.push(this._name); return response; } diff --git a/js/test/Ice/timeout/Client.ts b/js/test/Ice/timeout/Client.ts index c53baea209b..a5f32d4664d 100644 --- a/js/test/Ice/timeout/Client.ts +++ b/js/test/Ice/timeout/Client.ts @@ -42,7 +42,7 @@ export class Client extends TestHelper { } { - var properties = communicator.getProperties().clone(); + const properties = communicator.getProperties().clone(); properties.setProperty("Ice.Connection.Client.ConnectTimeout", "-1"); const [communicator2, _] = this.initialize(properties);