From 6aedfab4d19a85eaf265947403794c07f8d94b56 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Tue, 30 Jul 2019 16:28:48 -0700 Subject: [PATCH] Misc JSDoc fixes. (#2747) --- core/block.js | 2 +- core/field_colour.js | 4 ++-- core/keyboard_nav/cursor_svg.js | 2 +- core/utils/svg_paths.js | 2 +- core/xml.js | 2 +- demos/blockfactory/block_definition_extractor.js | 4 ++-- demos/blockfactory/block_library_controller.js | 2 +- demos/blockfactory/block_library_storage.js | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/block.js b/core/block.js index 8f5dedee9..5bd8c78fe 100644 --- a/core/block.js +++ b/core/block.js @@ -914,7 +914,7 @@ Blockly.Block.prototype.getColourBorder = function() { var colour = this.getColour(); return { colourBorder: null, - colourLight: Blockly.utils.colour.blend('white',colour, 0.3), + colourLight: Blockly.utils.colour.blend('white', colour, 0.3), colourDark: Blockly.utils.colour.blend('black', colour, 0.2) }; }; diff --git a/core/field_colour.js b/core/field_colour.js index fb7ab823d..489f816ae 100644 --- a/core/field_colour.js +++ b/core/field_colour.js @@ -245,13 +245,13 @@ Blockly.FieldColour.COLUMNS = 7; * Set a custom colour grid for this field. * @param {Array.} colours Array of colours for this block, * or null to use default (Blockly.FieldColour.COLOURS). - * @param {Array.} opt_titles Optional array of colour tooltips, + * @param {Array.=} opt_titles Optional array of colour tooltips, * or null to use default (Blockly.FieldColour.TITLES). * @return {!Blockly.FieldColour} Returns itself (for method chaining). */ Blockly.FieldColour.prototype.setColours = function(colours, opt_titles) { this.colours_ = colours; - if (opt_titles !== undefined) { + if (opt_titles) { this.titles_ = opt_titles; } return this; diff --git a/core/keyboard_nav/cursor_svg.js b/core/keyboard_nav/cursor_svg.js index d8e0302b7..21e6cae7d 100644 --- a/core/keyboard_nav/cursor_svg.js +++ b/core/keyboard_nav/cursor_svg.js @@ -29,7 +29,7 @@ goog.require('Blockly.Cursor'); /** * Class for a cursor. * @param {!Blockly.Workspace} workspace The workspace to sit in. - * @param {?boolean} opt_isImmovable True if the cursor cannot be moved with + * @param {boolean=} opt_isImmovable True if the cursor cannot be moved with * calls to prev/next/in/out. This is called a marker. * @extends {Blockly.Cursor} * @constructor diff --git a/core/utils/svg_paths.js b/core/utils/svg_paths.js index 3674830b9..99d5be526 100644 --- a/core/utils/svg_paths.js +++ b/core/utils/svg_paths.js @@ -52,7 +52,7 @@ Blockly.utils.svgPaths.point = function(x, y) { * These coordinates are unitless and hence in the user coordinate system. * @param {string} command The command to use. * Should be one of: c, C, s, S, q, Q. - * @param {string} points An array containing all of the points to pass to the + * @param {!Array.} points An array containing all of the points to pass to the * curve command, in order. The points are represented as strings of the * format ' x, y '. * @return {string} A string defining one or more Bezier curves. See the MDN diff --git a/core/xml.js b/core/xml.js index bc873c896..50c377ed8 100644 --- a/core/xml.js +++ b/core/xml.js @@ -510,7 +510,7 @@ Blockly.Xml.domToBlock = function(xmlBlock, workspace) { var swap = xmlBlock; // Closure Compiler complains here because the arguments are reversed. /** @suppress {checkTypes} */ - xmlBlock = workspace; + xmlBlock = /** @type {!Element} */ (workspace); workspace = swap; console.warn('Deprecated call to Blockly.Xml.domToBlock, ' + 'swap the arguments.'); diff --git a/demos/blockfactory/block_definition_extractor.js b/demos/blockfactory/block_definition_extractor.js index fb21499a5..05ab81d70 100644 --- a/demos/blockfactory/block_definition_extractor.js +++ b/demos/blockfactory/block_definition_extractor.js @@ -49,8 +49,8 @@ BlockDefinitionExtractor.buildBlockFactoryWorkspace = function(block) { * inner text. * * @param {string} name New element tag name. - * @param {Map} opt_attrs Optional list of attributes. - * @param {string?} opt_text Optional inner text. + * @param {!Object.=} opt_attrs Optional list of attributes. + * @param {string=} opt_text Optional inner text. * @return {!Element} The newly created element. * @private */ diff --git a/demos/blockfactory/block_library_controller.js b/demos/blockfactory/block_library_controller.js index 11744906f..0b2eb5bcf 100644 --- a/demos/blockfactory/block_library_controller.js +++ b/demos/blockfactory/block_library_controller.js @@ -36,7 +36,7 @@ * Block Library Controller Class * @param {string} blockLibraryName Desired name of Block Library, also used * to create the key for where it's stored in local storage. - * @param {!BlockLibraryStorage} opt_blockLibraryStorage Optional storage + * @param {!BlockLibraryStorage=} opt_blockLibraryStorage Optional storage * object that allows user to import a block library. * @constructor */ diff --git a/demos/blockfactory/block_library_storage.js b/demos/blockfactory/block_library_storage.js index f1e292a93..b4b50d59b 100644 --- a/demos/blockfactory/block_library_storage.js +++ b/demos/blockfactory/block_library_storage.js @@ -31,7 +31,7 @@ * Represents a block library's storage. * @param {string} blockLibraryName Desired name of Block Library, also used * to create the key for where it's stored in local storage. - * @param {Object} opt_blocks Object mapping block type to XML. + * @param {!Object=} opt_blocks Object mapping block type to XML. * @constructor */ function BlockLibraryStorage(blockLibraryName, opt_blocks) {