jimexist commented on code in PR #3529:
URL: https://github.com/apache/thrift/pull/3529#discussion_r3366057481


##########
lib/nodejs/test/int64_bigint.test.js:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Exercises the `js:bigint=true` default of the compiler. The fixture is
+// regenerated by testAll.sh into `gen-nodejs-bigint/` using the bare
+// `--gen js:node,es6` flag set (bigint=true is implicit).

Review Comment:
   Fixed in 58f132df3 — updated the docstring to reference the actual CLI 
syntax `--gen js:node,bigint` instead of the stale `js:bigint=true`.



##########
lib/nodejs/test/bigint_helpers.test.js:
##########
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Exercises `thrift.toBigInt` / `thrift.fromBigInt` — the JS-side helpers
+// emitted by `js:bigint=true` generated code to convert between node-int64
+// `Int64` and native `bigint`. Verifies they round-trip through the binary
+// protocol without any runtime toggle on `TBinaryProtocol`.

Review Comment:
   Fixed in 58f132df3 — updated the docstring to reference the actual CLI 
syntax `--gen js:node,bigint` instead of the stale `js:bigint=true`.



##########
lib/nodejs/lib/thrift/index.js:
##########
@@ -57,6 +57,70 @@ exports.createWebServer = web_server.createWebServer;
 
 exports.Int64 = require("node-int64");
 
+const bigIntCompat = require("./bigint_compat");
+
+/**
+ * Convert a `node-int64` Int64 (as returned by `TBinaryProtocol.readI64`,
+ * `TCompactProtocol.readI64`, etc.) to a native `bigint`. Used by code
+ * generated with `js:bigint=true` to surface int64 values as BigInt without
+ * a protocol-layer toggle.

Review Comment:
   Fixed in 58f132df3 — updated the docstring to reference the actual CLI 
syntax `--gen js:node,bigint` instead of the stale `js:bigint=true`.



##########
lib/nodejs/lib/thrift/browser.js:
##########
@@ -37,6 +37,53 @@ exports.createClient = require("./create_client");
 
 exports.Int64 = require("node-int64");
 
+const bigIntCompat = require("./bigint_compat");
+
+/**
+ * Convert a `node-int64` Int64 to a native `bigint`. Used by code generated
+ * with `js:bigint=true`. Feature-detects `Buffer#readBigInt64BE` (Node 12+
+ * and modern buffer polyfills) and falls back to a `readInt32BE` /
+ * `readUInt32BE` + BigInt composition when the native method is absent.

Review Comment:
   Fixed in 58f132df3 — updated the docstring to reference the actual CLI 
syntax `--gen js:node,bigint` instead of the stale `js:bigint=true`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to