Add non-nullable modifier to return type of functions never returning null (#5797)

This commit is contained in:
Jakub Vrána
2020-03-12 17:02:29 +01:00
committed by GitHub
parent 9954e09ab7
commit 35abb7f89b

View File

@@ -110,7 +110,7 @@ flatbuffers.Long = function(low, high) {
/** /**
* @param {number} low * @param {number} low
* @param {number} high * @param {number} high
* @returns {flatbuffers.Long} * @returns {!flatbuffers.Long}
*/ */
flatbuffers.Long.create = function(low, high) { flatbuffers.Long.create = function(low, high) {
// Special-case zero to avoid GC overhead for default values // Special-case zero to avoid GC overhead for default values
@@ -133,7 +133,7 @@ flatbuffers.Long.prototype.equals = function(other) {
}; };
/** /**
* @type {flatbuffers.Long} * @type {!flatbuffers.Long}
* @const * @const
*/ */
flatbuffers.Long.ZERO = new flatbuffers.Long(0, 0); flatbuffers.Long.ZERO = new flatbuffers.Long(0, 0);
@@ -271,7 +271,7 @@ flatbuffers.Builder.prototype.dataBuffer = function() {
* Get the bytes representing the FlatBuffer. Only call this after you've * Get the bytes representing the FlatBuffer. Only call this after you've
* called finish(). * called finish().
* *
* @returns {Uint8Array} * @returns {!Uint8Array}
*/ */
flatbuffers.Builder.prototype.asUint8Array = function() { flatbuffers.Builder.prototype.asUint8Array = function() {
return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset()); return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
@@ -556,7 +556,7 @@ flatbuffers.Builder.prototype.offset = function() {
* the end of the new buffer (since we build the buffer backwards). * the end of the new buffer (since we build the buffer backwards).
* *
* @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data * @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data
* @returns {flatbuffers.ByteBuffer} A new byte buffer with the old data copied * @returns {!flatbuffers.ByteBuffer} A new byte buffer with the old data copied
* to it. The data is located at the end of the buffer. * to it. The data is located at the end of the buffer.
* *
* uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass * uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
@@ -825,7 +825,7 @@ flatbuffers.Builder.prototype.createString = function(s) {
* *
* @param {number} low * @param {number} low
* @param {number} high * @param {number} high
* @returns {flatbuffers.Long} * @returns {!flatbuffers.Long}
*/ */
flatbuffers.Builder.prototype.createLong = function(low, high) { flatbuffers.Builder.prototype.createLong = function(low, high) {
return flatbuffers.Long.create(low, high); return flatbuffers.Long.create(low, high);
@@ -856,7 +856,7 @@ flatbuffers.ByteBuffer = function(bytes) {
* Create and allocate a new ByteBuffer with a given size. * Create and allocate a new ByteBuffer with a given size.
* *
* @param {number} byte_size * @param {number} byte_size
* @returns {flatbuffers.ByteBuffer} * @returns {!flatbuffers.ByteBuffer}
*/ */
flatbuffers.ByteBuffer.allocate = function(byte_size) { flatbuffers.ByteBuffer.allocate = function(byte_size) {
return new flatbuffers.ByteBuffer(new Uint8Array(byte_size)); return new flatbuffers.ByteBuffer(new Uint8Array(byte_size));
@@ -952,7 +952,7 @@ flatbuffers.ByteBuffer.prototype.readUint32 = function(offset) {
/** /**
* @param {number} offset * @param {number} offset
* @returns {flatbuffers.Long} * @returns {!flatbuffers.Long}
*/ */
flatbuffers.ByteBuffer.prototype.readInt64 = function(offset) { flatbuffers.ByteBuffer.prototype.readInt64 = function(offset) {
return new flatbuffers.Long(this.readInt32(offset), this.readInt32(offset + 4)); return new flatbuffers.Long(this.readInt32(offset), this.readInt32(offset + 4));
@@ -960,7 +960,7 @@ flatbuffers.ByteBuffer.prototype.readInt64 = function(offset) {
/** /**
* @param {number} offset * @param {number} offset
* @returns {flatbuffers.Long} * @returns {!flatbuffers.Long}
*/ */
flatbuffers.ByteBuffer.prototype.readUint64 = function(offset) { flatbuffers.ByteBuffer.prototype.readUint64 = function(offset) {
return new flatbuffers.Long(this.readUint32(offset), this.readUint32(offset + 4)); return new flatbuffers.Long(this.readUint32(offset), this.readUint32(offset + 4));
@@ -1135,7 +1135,7 @@ flatbuffers.ByteBuffer.prototype.__union = function(t, offset) {
* *
* @param {number} offset * @param {number} offset
* @param {flatbuffers.Encoding=} opt_encoding Defaults to UTF16_STRING * @param {flatbuffers.Encoding=} opt_encoding Defaults to UTF16_STRING
* @returns {string|Uint8Array} * @returns {string|!Uint8Array}
*/ */
flatbuffers.ByteBuffer.prototype.__string = function(offset, opt_encoding) { flatbuffers.ByteBuffer.prototype.__string = function(offset, opt_encoding) {
offset += this.readInt32(offset); offset += this.readInt32(offset);
@@ -1246,7 +1246,7 @@ flatbuffers.ByteBuffer.prototype.__has_identifier = function(ident) {
* *
* @param {number} low * @param {number} low
* @param {number} high * @param {number} high
* @returns {flatbuffers.Long} * @returns {!flatbuffers.Long}
*/ */
flatbuffers.ByteBuffer.prototype.createLong = function(low, high) { flatbuffers.ByteBuffer.prototype.createLong = function(low, high) {
return flatbuffers.Long.create(low, high); return flatbuffers.Long.create(low, high);