Permalink
Browse files

Add ? to type annotations for variables that are initialized to null.

This fixes a linter warning.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=223178965
  • Loading branch information...
SLaks authored and nreid260 committed Nov 28, 2018
1 parent 4c9ccc4 commit c4b2a841108ec08ae9432c8a7a3ec6b3bac2b50d
@@ -64,7 +64,7 @@ goog.async.AnimationDelay = function(listener, opt_window, opt_handler) {
/**
* Identifier of the active delay timeout, or event listener,
* or null when inactive.
* @private {goog.events.Key|number}
* @private {?goog.events.Key|number}
*/
this.id_ = null;

@@ -112,7 +112,7 @@ goog.async.WorkQueue.prototype.getUnusedItem_ = function() {
goog.async.WorkItem = function() {
/** @type {?function()} */
this.fn = null;
/** @type {Object|null|undefined} */
/** @type {?Object|null|undefined} */
this.scope = null;
/** @type {?goog.async.WorkItem} */
this.next = null;
@@ -507,7 +507,7 @@ goog.ModuleType = {
* @private {?{
* moduleName: (string|undefined),
* declareLegacyNamespace:boolean,
* type: goog.ModuleType
* type: ?goog.ModuleType
* }}
*/
goog.moduleLoaderState_ = null;
@@ -33,23 +33,23 @@ goog.require('goog.userAgent.product');

/**
* Maps bytes to characters.
* @type {Object}
* @type {?Object}
* @private
*/
goog.crypt.base64.byteToCharMap_ = null;


/**
* Maps characters to bytes. Used for normal and websafe characters.
* @type {Object}
* @type {?Object}
* @private
*/
goog.crypt.base64.charToByteMap_ = null;


/**
* Maps bytes to websafe characters.
* @type {Object}
* @type {?Object}
* @private
*/
goog.crypt.base64.byteToCharMapWebSafe_ = null;
@@ -47,19 +47,19 @@ goog.require('goog.string');
goog.dom.browserrange.IeRange = function(range, doc) {
/**
* Lazy cache of the node containing the entire selection.
* @private {Node}
* @private {?Node}
*/
this.parentNode_ = null;

/**
* Lazy cache of the node containing the start of the selection.
* @private {Node}
* @private {?Node}
*/
this.startNode_ = null;

/**
* Lazy cache of the node containing the end of the selection.
* @private {Node}
* @private {?Node}
*/
this.endNode_ = null;

@@ -106,7 +106,7 @@ goog.editor.Field = function(id, opt_doc) {

/**
* Dom helper for the editable node.
* @type {goog.dom.DomHelper}
* @type {?goog.dom.DomHelper}
* @protected
*/
this.editableDomHelper = null;
@@ -210,7 +210,7 @@ goog.inherits(goog.editor.Field, goog.events.EventTarget);

/**
* The editable dom node.
* @type {Element}
* @type {?Element}
* TODO(user): Make this private!
*/
goog.editor.Field.prototype.field = null;
@@ -50,7 +50,7 @@ goog.editor.PluginImpl = function() {

/**
* The field object this plugin is attached to.
* @type {goog.editor.Field}
* @type {?goog.editor.Field}
* @protected
* @deprecated Use goog.editor.PluginImpl.getFieldObject and
* goog.editor.PluginImpl.setFieldObject.
@@ -80,20 +80,20 @@ goog.events.BrowserEvent = function(opt_e, opt_currentTarget) {
/**
* Target that fired the event.
* @override
* @type {Node}
* @type {?Node}
*/
this.target = null;

/**
* Node that had the listener attached.
* @override
* @type {Node|undefined}
* @type {?Node|undefined}
*/
this.currentTarget = null;

/**
* For mouseover and mouseout events, the related object for the event.
* @type {Node}
* @type {?Node}
*/
this.relatedTarget = null;

@@ -184,7 +184,7 @@ goog.events.BrowserEvent = function(opt_e, opt_currentTarget) {
/**
* History state object, only set for PopState events where it's a copy of the
* state object provided to pushState or replaceState.
* @type {Object}
* @type {?Object}
*/
this.state = null;

@@ -207,7 +207,7 @@ goog.events.BrowserEvent = function(opt_e, opt_currentTarget) {

/**
* The browser event object.
* @private {Event}
* @private {?Event}
*/
this.event_ = null;

@@ -89,7 +89,7 @@ goog.events.EventTarget = function() {
* currently breaks people who expect getParentEventTarget to return
* goog.events.EventTarget.
*
* @private {goog.events.EventTarget}
* @private {?goog.events.EventTarget}
*/
this.parentEventTarget_ = null;
};
@@ -138,31 +138,31 @@ goog.inherits(goog.events.KeyHandler, goog.events.EventTarget);

/**
* This is the element that we will listen to the real keyboard events on.
* @type {Element|Document|null}
* @type {?Element|?Document|null}
* @private
*/
goog.events.KeyHandler.prototype.element_ = null;


/**
* The key for the key press listener.
* @type {goog.events.Key}
* @type {?goog.events.Key}
* @private
*/
goog.events.KeyHandler.prototype.keyPressKey_ = null;


/**
* The key for the key down listener.
* @type {goog.events.Key}
* @type {?goog.events.Key}
* @private
*/
goog.events.KeyHandler.prototype.keyDownKey_ = null;


/**
* The key for the key up listener.
* @type {goog.events.Key}
* @type {?goog.events.Key}
* @private
*/
goog.events.KeyHandler.prototype.keyUpKey_ = null;
@@ -64,15 +64,15 @@ goog.fx.anim.activeAnimations_ = {};

/**
* An optional animation window.
* @type {Window}
* @type {?Window}
* @private
*/
goog.fx.anim.animationWindow_ = null;


/**
* An interval ID for the global timer or event handler uid.
* @type {goog.async.Delay|goog.async.AnimationDelay}
* @type {?goog.async.Delay|?goog.async.AnimationDelay}
* @private
*/
goog.fx.anim.animationDelay_ = null;
@@ -98,7 +98,7 @@ goog.Promise = function(resolver, opt_context) {

/**
* For Promises created by calling `then()`, the originating parent.
* @private {goog.Promise}
* @private {?goog.Promise}
*/
this.parent_ = null;

@@ -250,9 +250,9 @@ goog.Promise.State_ = {
goog.Promise.CallbackEntry_ = function() {
/** @type {?goog.Promise} */
this.child = null;
/** @type {Function} */
/** @type {?Function} */
this.onFulfilled = null;
/** @type {Function} */
/** @type {?Function} */
this.onRejected = null;
/** @type {?} */
this.context = null;
@@ -50,15 +50,15 @@ goog.proto2.Message = function() {

/**
* The lazy deserializer for this message instance, if any.
* @type {goog.proto2.LazyDeserializer}
* @type {?goog.proto2.LazyDeserializer}
* @private
*/
this.lazyDeserializer_ = null;

/**
* A map of those fields deserialized, from tag number to their deserialized
* value.
* @type {Object}
* @type {?Object}
* @private
*/
this.deserializedFields_ = null;
@@ -566,7 +566,7 @@ goog.proto2.TextFormatSerializer.Parser = function() {

/**
* The current tokenizer.
* @type {goog.proto2.TextFormatSerializer.Tokenizer_}
* @type {?goog.proto2.TextFormatSerializer.Tokenizer_}
* @private
*/
this.tokenizer_ = null;
@@ -53,7 +53,7 @@ goog.storage.mechanism.IEUserData = function(storageKey, opt_storageNodeId) {
/**
* The document element used for storing data.
*
* @private {Element}
* @private {?Element}
*/
this.storageNode_ = null;

@@ -117,7 +117,7 @@ goog.storage.mechanism.IEUserData.ENCODE_MAP = {
/**
* Global storageKey to storageNode map, so we save on reloading the storage.
*
* @type {goog.structs.Map}
* @type {?goog.structs.Map}
* @private
*/
goog.storage.mechanism.IEUserData.storageMap_ = null;
@@ -37,7 +37,7 @@ goog.require('goog.asserts');
*/
goog.structs.InversionMap = function(rangeArray, valueArray, opt_delta) {
/**
* @protected {Array<number>}
* @protected {?Array<number>}
*/
this.rangeArray = null;

@@ -55,14 +55,14 @@ goog.structs.SimplePool = function(initialCount, maxCount) {
/**
* Function for overriding createObject. The avoids a common case requiring
* subclassing this class.
* @private {Function}
* @private {?Function}
*/
this.createObjectFn_ = null;

/**
* Function for overriding disposeObject. The avoids a common case requiring
* subclassing this class.
* @private {Function}
* @private {?Function}
*/
this.disposeObjectFn_ = null;

@@ -43,13 +43,13 @@ goog.structs.TreeNode = function(key, value) {

/**
* Reference to the parent node or null if it has no parent.
* @private {goog.structs.TreeNode<KEY, VALUE>}
* @private {?goog.structs.TreeNode<KEY, VALUE>}
*/
this.parent_ = null;

/**
* Child nodes or null in case of leaf node.
* @private {Array<!goog.structs.TreeNode<KEY, VALUE>>}
* @private {?Array<!goog.structs.TreeNode<KEY, VALUE>>}
*/
this.children_ = null;
};
@@ -139,7 +139,7 @@ goog.ui.ac.AutoComplete = function(matcher, renderer, selectionHandler) {

/**
* The target HTML node for displaying.
* @type {Element}
* @type {?Element}
* @protected
* @suppress {underscore|visibility}
*/
@@ -337,7 +337,7 @@ goog.ui.ac.InputHandler.prototype.activeTimeoutId_ = null;

/**
* The element that is currently active.
* @type {Element}
* @type {?Element}
* @private
*/
goog.ui.ac.InputHandler.prototype.activeElement_ = null;
@@ -92,7 +92,7 @@ goog.ui.ac.Renderer = function(

/**
* Reference to the main element that controls the rendered autocomplete
* @type {Element}
* @type {?Element}
* @private
*/
this.element_ = null;
@@ -1058,7 +1058,7 @@ goog.Uri.QueryData = function(opt_query, opt_uri, opt_ignoreCase) {
* We need to use a Map because we cannot guarantee that the key names will
* not be problematic for IE.
*
* @private {goog.structs.Map<string, !Array<*>>}
* @private {?goog.structs.Map<string, !Array<*>>}
*/
this.keyMap_ = null;

@@ -161,7 +161,7 @@ goog.async.Deferred = function(opt_onCancelFunction, opt_defaultScope) {
/**
* If this Deferred was created by branch(), this will be the "parent"
* Deferred.
* @type {goog.async.Deferred}
* @type {?goog.async.Deferred}
* @private
*/
this.parent_ = null;

0 comments on commit c4b2a84

Please sign in to comment.