diff --git a/binary/bytesource_alias.js b/binary/bytesource_alias.js new file mode 100644 index 0000000..2815ee5 --- /dev/null +++ b/binary/bytesource_alias.js @@ -0,0 +1,9 @@ +/** + * @fileoverview Legacy alias for the old namespace used by encoder.js + */ +goog.module('jspb.ByteSource'); +goog.module.declareLegacyNamespace(); + +const { ByteSource } = goog.require('jspb.binary.bytesource'); + +exports = ByteSource; diff --git a/binary/encoder.js b/binary/encoder.js index 216bd14..4bc849f 100755 --- a/binary/encoder.js +++ b/binary/encoder.js @@ -190,7 +190,7 @@ class BinaryEncoder { utils.splitZigzag64(value); this.writeSplitVarint64(utils.getSplit64Low(), utils.getSplit64High()); } - + /** * Encodes a JavaScript decimal string into its wire-format, zigzag-encoded * varint representation and stores it in the buffer. Integers not diff --git a/binary/utils.js b/binary/utils.js index 6664fe2..088015a 100755 --- a/binary/utils.js +++ b/binary/utils.js @@ -12,6 +12,7 @@ goog.module.declareLegacyNamespace(); const BinaryConstants = goog.require('jspb.BinaryConstants'); const { assert } = goog.require('goog.asserts'); const { isBigIntAvailable } = goog.require('jspb.internal_options'); +const { ByteSource } = goog.require('jspb.binary.bytesource'); const { ByteString } = goog.require('jspb.bytestring'); const { decodeStringToUint8Array } = goog.require('goog.crypt.base64'); const { unsafeUint8ArrayFromByteString } = goog.require('jspb.unsafe_bytestring'); diff --git a/binary/writer.js b/binary/writer.js index e3874de..0a0302c 100755 --- a/binary/writer.js +++ b/binary/writer.js @@ -430,10 +430,6 @@ class BinaryWriter { this.encoder_.writeZigzagVarint64(/** @type {number} */(value)); break; - case 'bigint': - this.encoder_.writeZigzagVarint64BigInt(/** @type {bigint} */(value)); - break; - default: this.encoder_.writeZigzagVarint64String(/** @type {string} */(value)); break; @@ -1425,10 +1421,6 @@ class BinaryWriter { this.encoder_.writeZigzagVarint64(v); break; - case 'bigint': - this.encoder_.writeZigzagVarint64BigInt(/** @type {bigint} */(v)); - break; - default: this.encoder_.writeZigzagVarint64String(/** @type {string} */(v)); break; diff --git a/generator/js_generator.cc b/generator/js_generator.cc index a1619fa..7ba8bf0 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -1855,6 +1855,7 @@ void Generator::GenerateRequiresImpl(const GeneratorOptions& options, required->insert("jspb.internal.public_for_gencode"); required->insert("jspb.BinaryReader"); required->insert("jspb.BinaryWriter"); + required->insert("jspb.binary.bytesource"); } if (require_extension) { required->insert("jspb.ExtensionFieldBinaryInfo"); @@ -3016,7 +3017,7 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, printer->Print( "/**\n" " * Deserializes binary data (in protobuf wire format).\n" - " * @param {jspb.ByteSource} bytes The bytes to deserialize.\n" + " * @param {jspb.binary.bytesource.ByteSource} bytes The bytes to deserialize.\n" " * @return {!$class$}\n" " */\n" "$class$.deserializeBinary = function(bytes) {\n" diff --git a/internal_public.js b/internal_public.js index cf4a61d..03d52f0 100644 --- a/internal_public.js +++ b/internal_public.js @@ -12,7 +12,7 @@ goog.module.declareLegacyNamespace(); const asserts = goog.require('goog.asserts'); const { BinaryReader } = goog.require('jspb.binary.reader'); const { BinaryWriter } = goog.requireType('jspb.binary.writer'); -const {Map: JspbMap} = goog.requireType('jspb.Map'); +const JspbMap = goog.requireType('jspb.Map'); /** * Write this Map field in wire format to a BinaryWriter, using the given diff --git a/message.js b/message.js index f4db81a..430cb52 100644 --- a/message.js +++ b/message.js @@ -1876,7 +1876,7 @@ jspb.Message.clone_ = function(obj) { // NOTE:redundant null check existing for NTI compatibility. // see b/70515949 clonedArray[i] = (typeof o == 'object') ? - jspb.Message.clone_(jspb.asserts.assert(o)) : + jspb.Message.clone_(/** @type {!Object} */(jspb.asserts.assert(o))) : o; } } @@ -1892,7 +1892,7 @@ jspb.Message.clone_ = function(obj) { // NOTE:redundant null check existing for NTI compatibility. // see b/70515949 clone[key] = (typeof o == 'object') ? - jspb.Message.clone_(jspb.asserts.assert(o)) : + jspb.Message.clone_(/** @type {!Object} */(jspb.asserts.assert(o))) : o; } }