diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index 9232f5cb7d..f5f3a6c37f 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -321,7 +321,7 @@ const PluggableMap = function(options) { /** * @private - * @type {Array.} + * @type {!Array.} */ this.postRenderFunctions_ = []; @@ -1232,8 +1232,7 @@ PluggableMap.prototype.renderFrame_ = function(time) { if (frameState.animate) { this.render(); } - Array.prototype.push.apply( - this.postRenderFunctions_, frameState.postRenderFunctions); + Array.prototype.push.apply(this.postRenderFunctions_, frameState.postRenderFunctions); if (previousFrameState) { const moveStart = !this.previousExtent_ || diff --git a/src/ol/TileCache.js b/src/ol/TileCache.js index 7ee1f22250..4c9ef844c4 100644 --- a/src/ol/TileCache.js +++ b/src/ol/TileCache.js @@ -21,13 +21,12 @@ inherits(TileCache, LRUCache); /** - * @param {Object.} usedTiles Used tiles. + * @param {!Object.} usedTiles Used tiles. */ TileCache.prototype.expireCache = function(usedTiles) { - let tile, zKey; while (this.canExpireCache()) { - tile = this.peekLast(); - zKey = tile.tileCoord[0].toString(); + const tile = this.peekLast(); + const zKey = tile.tileCoord[0].toString(); if (zKey in usedTiles && usedTiles[zKey].contains(tile.tileCoord)) { break; } else { diff --git a/src/ol/VectorImageTile.js b/src/ol/VectorImageTile.js index 6a57370d1e..053beecdab 100644 --- a/src/ol/VectorImageTile.js +++ b/src/ol/VectorImageTile.js @@ -40,7 +40,7 @@ const VectorImageTile = function(tileCoord, state, sourceRevision, format, /** * @private - * @type {Object.} + * @type {!Object.} */ this.context_ = {}; @@ -52,7 +52,7 @@ const VectorImageTile = function(tileCoord, state, sourceRevision, format, /** * @private - * @type {Object.} + * @type {!Object.} */ this.replayState_ = {}; diff --git a/src/ol/array.js b/src/ol/array.js index 6ccb81c310..99b5a7a9af 100644 --- a/src/ol/array.js +++ b/src/ol/array.js @@ -126,15 +126,13 @@ export function reverseSubArray(arr, begin, end) { /** * @param {Array.} arr The array to modify. - * @param {Array.|VALUE} data The elements or arrays of elements - * to add to arr. + * @param {!Array.|VALUE} data The elements or arrays of elements to add to arr. * @template VALUE */ export function extend(arr, data) { - let i; const extension = Array.isArray(data) ? data : [data]; const length = extension.length; - for (i = 0; i < length; i++) { + for (let i = 0; i < length; i++) { arr[arr.length] = extension[i]; } } @@ -160,7 +158,7 @@ export function remove(arr, obj) { * @param {Array.} arr The array to search in. * @param {function(VALUE, number, ?) : boolean} func The function to compare. * @template VALUE - * @return {VALUE} The element found. + * @return {VALUE|null} The element found or null. */ export function find(arr, func) { const length = arr.length >>> 0; diff --git a/src/ol/control/Attribution.js b/src/ol/control/Attribution.js index a6633d8ba3..6d7347badc 100644 --- a/src/ol/control/Attribution.js +++ b/src/ol/control/Attribution.js @@ -130,7 +130,7 @@ inherits(Attribution, Control); Attribution.prototype.getSourceAttributions_ = function(frameState) { /** * Used to determine if an attribution already exists. - * @type {Object.} + * @type {!Object.} */ const lookup = {}; diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index 23e670a1a5..d674b21e5a 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -379,7 +379,7 @@ const GPX_SERIALIZERS = makeStructureNS( * @param {Array.} flatCoordinates Flat coordinates. * @param {ol.LayoutOptions} layoutOptions Layout options. * @param {Node} node Node. - * @param {Object} values Values. + * @param {!Object} values Values. * @return {Array.} Flat coordinates. */ function appendCoordinate(flatCoordinates, layoutOptions, node, values) { @@ -477,14 +477,11 @@ function parseExtensions(node, objectStack) { * @param {Array.<*>} objectStack Object stack. */ function parseRtePt(node, objectStack) { - const values = pushParseAndPop( - {}, RTEPT_PARSERS, node, objectStack); + const values = pushParseAndPop({}, RTEPT_PARSERS, node, objectStack); if (values) { - const rteValues = /** @type {Object} */ (objectStack[objectStack.length - 1]); - const flatCoordinates = /** @type {Array.} */ - (rteValues['flatCoordinates']); - const layoutOptions = /** @type {ol.LayoutOptions} */ - (rteValues['layoutOptions']); + const rteValues = /** @type {!Object} */ (objectStack[objectStack.length - 1]); + const flatCoordinates = /** @type {Array.} */ (rteValues['flatCoordinates']); + const layoutOptions = /** @type {ol.LayoutOptions} */ (rteValues['layoutOptions']); appendCoordinate(flatCoordinates, layoutOptions, node, values); } } @@ -497,11 +494,9 @@ function parseRtePt(node, objectStack) { function parseTrkPt(node, objectStack) { const values = pushParseAndPop({}, TRKPT_PARSERS, node, objectStack); if (values) { - const trkValues = /** @type {Object} */ (objectStack[objectStack.length - 1]); - const flatCoordinates = /** @type {Array.} */ - (trkValues['flatCoordinates']); - const layoutOptions = /** @type {ol.LayoutOptions} */ - (trkValues['layoutOptions']); + const trkValues = /** @type {!Object} */ (objectStack[objectStack.length - 1]); + const flatCoordinates = /** @type {Array.} */ (trkValues['flatCoordinates']); + const layoutOptions = /** @type {ol.LayoutOptions} */ (trkValues['layoutOptions']); appendCoordinate(flatCoordinates, layoutOptions, node, values); } } diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index fddeb78adf..14c357e1ac 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -277,7 +277,7 @@ const KML = function(opt_options) { /** * @private - * @type {Object.|string)>} + * @type {!Object.|string)>} */ this.sharedStyles_ = {}; @@ -384,14 +384,11 @@ function createNameStyleFunction(foundStyle, name) { * @param {Array.|undefined} style Style. * @param {string} styleUrl Style URL. * @param {Array.} defaultStyle Default style. - * @param {Object.|string)>} sharedStyles Shared - * styles. - * @param {boolean|undefined} showPointNames true to show names for point - * placemarks. + * @param {!Object.|string)>} sharedStyles Shared styles. + * @param {boolean|undefined} showPointNames true to show names for point placemarks. * @return {ol.StyleFunction} Feature style function. */ -function createFeatureStyleFunction(style, styleUrl, - defaultStyle, sharedStyles, showPointNames) { +function createFeatureStyleFunction(style, styleUrl, defaultStyle, sharedStyles, showPointNames) { return ( /** @@ -418,25 +415,21 @@ function createFeatureStyleFunction(style, styleUrl, if (style) { if (drawName) { - nameStyle = createNameStyleFunction(style[0], - name); + nameStyle = createNameStyleFunction(style[0], name); return style.concat(nameStyle); } return style; } if (styleUrl) { - const foundStyle = findStyle(styleUrl, defaultStyle, - sharedStyles); + const foundStyle = findStyle(styleUrl, defaultStyle, sharedStyles); if (drawName) { - nameStyle = createNameStyleFunction(foundStyle[0], - name); + nameStyle = createNameStyleFunction(foundStyle[0], name); return foundStyle.concat(nameStyle); } return foundStyle; } if (drawName) { - nameStyle = createNameStyleFunction(defaultStyle[0], - name); + nameStyle = createNameStyleFunction(defaultStyle[0], name); return defaultStyle.concat(nameStyle); } return defaultStyle; @@ -448,7 +441,7 @@ function createFeatureStyleFunction(style, styleUrl, /** * @param {Array.|string|undefined} styleValue Style value. * @param {Array.} defaultStyle Default style. - * @param {Object.|string)>} sharedStyles + * @param {!Object.|string)>} sharedStyles * Shared styles. * @return {Array.} Style. */ @@ -462,8 +455,7 @@ function findStyle(styleValue, defaultStyle, sharedStyles) { if (!(styleValue in sharedStyles) && ('#' + styleValue in sharedStyles)) { styleValue = '#' + styleValue; } - return findStyle( - sharedStyles[styleValue], defaultStyle, sharedStyles); + return findStyle(sharedStyles[styleValue], defaultStyle, sharedStyles); } else { return defaultStyle; } diff --git a/src/ol/format/WMSCapabilities.js b/src/ol/format/WMSCapabilities.js index 723dbcfc13..0b9fcfccd1 100644 --- a/src/ol/format/WMSCapabilities.js +++ b/src/ol/format/WMSCapabilities.js @@ -446,8 +446,7 @@ function readCapabilityLayer(node, objectStack) { * @return {Object|undefined} Layer object. */ function readLayer(node, objectStack) { - const parentLayerObject = /** @type {Object.} */ - (objectStack[objectStack.length - 1]); + const parentLayerObject = /** @type {!Object.} */ (objectStack[objectStack.length - 1]); const layerObject = pushParseAndPop({}, LAYER_PARSERS, node, objectStack); diff --git a/src/ol/geom/flat/geodesic.js b/src/ol/geom/flat/geodesic.js index 3b6c5c0dee..9a76ffa784 100644 --- a/src/ol/geom/flat/geodesic.js +++ b/src/ol/geom/flat/geodesic.js @@ -32,7 +32,7 @@ function line(interpolate, transform, squaredTolerance) { /** @type {Array.} */ const fractionStack = [1, 0]; - /** @type {Object.} */ + /** @type {!Object.} */ const fractions = {}; let maxIterations = 1e5; diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 08c318f8cb..670010660a 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -223,7 +223,7 @@ const Modify = function(options) { /** * @const * @private - * @type {Object.} + * @type {!Object.} */ this.SEGMENT_WRITERS_ = { 'Point': this.writePointGeometry_, diff --git a/src/ol/interaction/Pointer.js b/src/ol/interaction/Pointer.js index 00981d061f..0f5b40a74f 100644 --- a/src/ol/interaction/Pointer.js +++ b/src/ol/interaction/Pointer.js @@ -97,7 +97,7 @@ const PointerInteraction = function(opt_options) { this.handlingDownUpSequence = false; /** - * @type {Object.} + * @type {!Object.} * @private */ this.trackedPointers_ = {}; diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index 51f7b95a0c..f3090bfbd7 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -97,7 +97,7 @@ const Snap = function(opt_options) { * If a feature geometry changes while a pointer drag|move event occurs, the * feature doesn't get updated right away. It will be at the next 'pointerup' * event fired. - * @type {Object.} + * @type {!Object.} * @private */ this.pendingFeatures_ = {}; diff --git a/src/ol/proj/transforms.js b/src/ol/proj/transforms.js index 6d3536fd11..4417f30de4 100644 --- a/src/ol/proj/transforms.js +++ b/src/ol/proj/transforms.js @@ -6,7 +6,7 @@ import {isEmpty} from '../obj.js'; /** * @private - * @type {Object.>} + * @type {!Object.>} */ let transforms = {}; diff --git a/src/ol/render/canvas/Replay.js b/src/ol/render/canvas/Replay.js index cf39fa6794..91ec941fd9 100644 --- a/src/ol/render/canvas/Replay.js +++ b/src/ol/render/canvas/Replay.js @@ -129,7 +129,7 @@ const CanvasReplay = function(tolerance, maxExtent, resolution, pixelRatio, over /** * @private - * @type {Object.|Array.>>} + * @type {!Object.|Array.>>} */ this.coordinateCache_ = {}; diff --git a/src/ol/render/canvas/ReplayGroup.js b/src/ol/render/canvas/ReplayGroup.js index d8d7df604b..38bcc251e1 100644 --- a/src/ol/render/canvas/ReplayGroup.js +++ b/src/ol/render/canvas/ReplayGroup.js @@ -100,8 +100,7 @@ const CanvasReplayGroup = function( /** * @private - * @type {!Object.>} + * @type {!Object.>} */ this.replaysByZIndex_ = {}; diff --git a/src/ol/render/canvas/TextReplay.js b/src/ol/render/canvas/TextReplay.js index e3131e23cf..1d9922176d 100644 --- a/src/ol/render/canvas/TextReplay.js +++ b/src/ol/render/canvas/TextReplay.js @@ -79,7 +79,7 @@ const CanvasTextReplay = function( this.textFillState_ = null; /** - * @type {Object.} + * @type {!Object.} */ this.fillStates = {}; @@ -90,7 +90,7 @@ const CanvasTextReplay = function( this.textStrokeState_ = null; /** - * @type {Object.} + * @type {!Object.} */ this.strokeStates = {}; @@ -101,7 +101,7 @@ const CanvasTextReplay = function( this.textState_ = /** @type {ol.CanvasTextState} */ ({}); /** - * @type {Object.} + * @type {!Object.} */ this.textStates = {}; diff --git a/src/ol/render/webgl/TextureReplay.js b/src/ol/render/webgl/TextureReplay.js index 2a3894b29f..ceab45f4ff 100644 --- a/src/ol/render/webgl/TextureReplay.js +++ b/src/ol/render/webgl/TextureReplay.js @@ -242,9 +242,8 @@ WebGLTextureReplay.prototype.drawCoordinates = function(flatCoordinates, offset, /** * @protected * @param {Array.} textures Textures. - * @param {Array.} images - * Images. - * @param {Object.} texturePerImage Texture cache. + * @param {Array.} images Images. + * @param {!Object.} texturePerImage Texture cache. * @param {WebGLRenderingContext} gl Gl. */ WebGLTextureReplay.prototype.createTextures = function(textures, images, texturePerImage, gl) { diff --git a/src/ol/renderer/Layer.js b/src/ol/renderer/Layer.js index 492c5ef242..8b2cb853c6 100644 --- a/src/ol/renderer/Layer.js +++ b/src/ol/renderer/Layer.js @@ -164,7 +164,7 @@ LayerRenderer.prototype.scheduleExpireCache = function(frameState, tileSource) { /** - * @param {Object.>} usedTiles Used tiles. + * @param {!Object.>} usedTiles Used tiles. * @param {ol.source.Tile} tileSource Tile source. * @param {number} z Z. * @param {ol.TileRange} tileRange Tile range. diff --git a/src/ol/renderer/Map.js b/src/ol/renderer/Map.js index 6aac6da47c..194a20f2e8 100644 --- a/src/ol/renderer/Map.js +++ b/src/ol/renderer/Map.js @@ -32,7 +32,7 @@ const MapRenderer = function(container, map) { /** * @private - * @type {Object.} + * @type {!Object.} */ this.layerRenderers_ = {}; diff --git a/src/ol/renderer/canvas/VectorLayer.js b/src/ol/renderer/canvas/VectorLayer.js index 19953f6af3..9b8093865e 100644 --- a/src/ol/renderer/canvas/VectorLayer.js +++ b/src/ol/renderer/canvas/VectorLayer.js @@ -253,14 +253,13 @@ CanvasVectorLayerRenderer.prototype.forEachFeatureAtCoordinate = function(coordi const resolution = frameState.viewState.resolution; const rotation = frameState.viewState.rotation; const layer = /** @type {ol.layer.Vector} */ (this.getLayer()); - /** @type {Object.} */ + /** @type {!Object.} */ const features = {}; - const result = this.replayGroup_.forEachFeatureAtCoordinate(coordinate, resolution, - rotation, hitTolerance, {}, + const result = this.replayGroup_.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, {}, /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ + * @param {ol.Feature|ol.render.Feature} feature Feature. + * @return {?} Callback result. + */ function(feature) { const key = getUid(feature).toString(); if (!(key in features)) { diff --git a/src/ol/renderer/canvas/VectorTileLayer.js b/src/ol/renderer/canvas/VectorTileLayer.js index 51cc0f6f5b..46f005b31a 100644 --- a/src/ol/renderer/canvas/VectorTileLayer.js +++ b/src/ol/renderer/canvas/VectorTileLayer.js @@ -265,7 +265,7 @@ CanvasVectorTileLayerRenderer.prototype.forEachFeatureAtCoordinate = function(co const rotation = frameState.viewState.rotation; hitTolerance = hitTolerance == undefined ? 0 : hitTolerance; const layer = this.getLayer(); - /** @type {Object.} */ + /** @type {!Object.} */ const features = {}; /** @type {Array.} */ @@ -290,8 +290,7 @@ CanvasVectorTileLayerRenderer.prototype.forEachFeatureAtCoordinate = function(co continue; } replayGroup = sourceTile.getReplayGroup(layer, tile.tileCoord.toString()); - found = found || replayGroup.forEachFeatureAtCoordinate( - coordinate, resolution, rotation, hitTolerance, {}, + found = found || replayGroup.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, {}, /** * @param {ol.Feature|ol.render.Feature} feature Feature. * @return {?} Callback result. diff --git a/src/ol/renderer/webgl/VectorLayer.js b/src/ol/renderer/webgl/VectorLayer.js index fc32b07afd..328c32abb2 100644 --- a/src/ol/renderer/webgl/VectorLayer.js +++ b/src/ol/renderer/webgl/VectorLayer.js @@ -143,7 +143,7 @@ WebGLVectorLayerRenderer.prototype.forEachFeatureAtCoordinate = function(coordin const viewState = frameState.viewState; const layer = this.getLayer(); const layerState = this.layerState_; - /** @type {Object.} */ + /** @type {!Object.} */ const features = {}; return this.replayGroup_.forEachFeatureAtCoordinate(coordinate, context, viewState.center, viewState.resolution, viewState.rotation, diff --git a/src/ol/source/TileImage.js b/src/ol/source/TileImage.js index d630746da0..2da8c2ee29 100644 --- a/src/ol/source/TileImage.js +++ b/src/ol/source/TileImage.js @@ -61,13 +61,13 @@ const TileImage = function(options) { /** * @protected - * @type {Object.} + * @type {!Object.} */ this.tileCacheForProjection = {}; /** * @protected - * @type {Object.} + * @type {!Object.} */ this.tileGridForProjection = {}; @@ -173,8 +173,7 @@ TileImage.prototype.getTileGridForProjection = function(projection) { } else { const projKey = getUid(projection).toString(); if (!(projKey in this.tileGridForProjection)) { - this.tileGridForProjection[projKey] = - getTileGridForProjection(projection); + this.tileGridForProjection[projKey] = getTileGridForProjection(projection); } return /** @type {!ol.tilegrid.TileGrid} */ (this.tileGridForProjection[projKey]); } diff --git a/src/ol/source/UrlTile.js b/src/ol/source/UrlTile.js index e3cfd1312e..11e7c3b514 100644 --- a/src/ol/source/UrlTile.js +++ b/src/ol/source/UrlTile.js @@ -63,7 +63,7 @@ const UrlTile = function(options) { /** * @private - * @type {Object.} + * @type {!Object.} */ this.tileLoadingKeys_ = {}; diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index 01aa6702da..9208832806 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -126,21 +126,21 @@ const VectorSource = function(opt_options) { /** * @private - * @type {Object.} + * @type {!Object.} */ this.nullGeometryFeatures_ = {}; /** * A lookup of features by id (the return from feature.getId()). * @private - * @type {Object.} + * @type {!Object.} */ this.idIndex_ = {}; /** * A lookup of features without id (keyed by ol.getUid(feature)). * @private - * @type {Object.} + * @type {!Object.} */ this.undefIdIndex_ = {}; diff --git a/src/ol/source/WMTS.js b/src/ol/source/WMTS.js index 8f2d2e7ffb..dd631611e8 100644 --- a/src/ol/source/WMTS.js +++ b/src/ol/source/WMTS.js @@ -288,7 +288,7 @@ WMTS.prototype.updateDimensions = function(dimensions) { /** * Generate source options from a capabilities object. * @param {Object} wmtsCap An object representing the capabilities document. - * @param {Object} config Configuration properties for the layer. Defaults for + * @param {!Object} config Configuration properties for the layer. Defaults for * the layer will apply if not provided. * * Required config properties: diff --git a/src/ol/structs/PriorityQueue.js b/src/ol/structs/PriorityQueue.js index ff800bced3..ef2513a99d 100644 --- a/src/ol/structs/PriorityQueue.js +++ b/src/ol/structs/PriorityQueue.js @@ -46,7 +46,7 @@ const PriorityQueue = function(priorityFunction, keyFunction) { this.priorities_ = []; /** - * @type {Object.} + * @type {!Object.} * @private */ this.queuedElements_ = {}; diff --git a/src/ol/style/IconImageCache.js b/src/ol/style/IconImageCache.js index 5323fb21e0..c0d65d4b7e 100644 --- a/src/ol/style/IconImageCache.js +++ b/src/ol/style/IconImageCache.js @@ -10,7 +10,7 @@ import {asString} from '../color.js'; const IconImageCache = function() { /** - * @type {Object.} + * @type {!Object.} * @private */ this.cache_ = {}; diff --git a/src/ol/webgl/Context.js b/src/ol/webgl/Context.js index 658eca2d29..b9cca14be0 100644 --- a/src/ol/webgl/Context.js +++ b/src/ol/webgl/Context.js @@ -34,19 +34,19 @@ const WebGLContext = function(canvas, gl) { /** * @private - * @type {Object.} + * @type {!Object.} */ this.bufferCache_ = {}; /** * @private - * @type {Object.} + * @type {!Object.} */ this.shaderCache_ = {}; /** * @private - * @type {Object.} + * @type {!Object.} */ this.programCache_ = {}; diff --git a/src/ol/xml.js b/src/ol/xml.js index b9cb5b2022..c7194f0e1d 100644 --- a/src/ol/xml.js +++ b/src/ol/xml.js @@ -133,8 +133,7 @@ export function makeArrayExtender(valueReader, opt_this) { function(node, objectStack) { const value = valueReader.call(opt_this, node, objectStack); if (value !== undefined) { - const array = /** @type {Array.<*>} */ - (objectStack[objectStack.length - 1]); + const array = /** @type {Array.<*>} */ (objectStack[objectStack.length - 1]); extend(array, value); } } @@ -157,8 +156,7 @@ export function makeArrayPusher(valueReader, opt_this) { * @param {Array.<*>} objectStack Object stack. */ function(node, objectStack) { - const value = valueReader.call(opt_this !== undefined ? opt_this : this, - node, objectStack); + const value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack); if (value !== undefined) { const array = objectStack[objectStack.length - 1]; array.push(value); @@ -182,8 +180,7 @@ export function makeReplacer(valueReader, opt_this) { * @param {Array.<*>} objectStack Object stack. */ function(node, objectStack) { - const value = valueReader.call(opt_this !== undefined ? opt_this : this, - node, objectStack); + const value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack); if (value !== undefined) { objectStack[objectStack.length - 1] = value; } @@ -207,13 +204,10 @@ export function makeObjectPropertyPusher(valueReader, opt_property, opt_this) { * @param {Array.<*>} objectStack Object stack. */ function(node, objectStack) { - const value = valueReader.call(opt_this !== undefined ? opt_this : this, - node, objectStack); + const value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack); if (value !== undefined) { - const object = /** @type {Object} */ - (objectStack[objectStack.length - 1]); - const property = opt_property !== undefined ? - opt_property : node.localName; + const object = /** @type {!Object} */ (objectStack[objectStack.length - 1]); + const property = opt_property !== undefined ? opt_property : node.localName; let array; if (property in object) { array = object[property]; @@ -241,13 +235,10 @@ export function makeObjectPropertySetter(valueReader, opt_property, opt_this) { * @param {Array.<*>} objectStack Object stack. */ function(node, objectStack) { - const value = valueReader.call(opt_this !== undefined ? opt_this : this, - node, objectStack); + const value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack); if (value !== undefined) { - const object = /** @type {Object} */ - (objectStack[objectStack.length - 1]); - const property = opt_property !== undefined ? - opt_property : node.localName; + const object = /** @type {!Object} */ (objectStack[objectStack.length - 1]); + const property = opt_property !== undefined ? opt_property : node.localName; object[property] = value; } }); @@ -266,8 +257,7 @@ export function makeObjectPropertySetter(valueReader, opt_property, opt_this) { */ export function makeChildAppender(nodeWriter, opt_this) { return function(node, value, objectStack) { - nodeWriter.call(opt_this !== undefined ? opt_this : this, - node, value, objectStack); + nodeWriter.call(opt_this !== undefined ? opt_this : this, node, value, objectStack); const parent = objectStack[objectStack.length - 1]; const parentNode = parent.node; parentNode.appendChild(node); @@ -430,11 +420,10 @@ export function parseNode(parsersNS, node, objectStack, opt_this) { * @return {T} Object. * @template T */ -export function pushParseAndPop( - object, parsersNS, node, objectStack, opt_this) { +export function pushParseAndPop(object, parsersNS, node, objectStack, opt_this) { objectStack.push(object); parseNode(parsersNS, node, objectStack, opt_this); - return objectStack.pop(); + return /** @type {T} */ (objectStack.pop()); } @@ -501,10 +490,8 @@ export function serialize( * @return {O|undefined} Object. * @template O, T */ -export function pushSerializeAndPop(object, - serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) { +export function pushSerializeAndPop(object, serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) { objectStack.push(object); - serialize( - serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this); - return objectStack.pop(); + serialize(serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this); + return /** @type {O|undefined} */ (objectStack.pop()); }