mirror of
https://github.com/google/blockly.git
synced 2026-03-14 01:00:09 +01:00
Update JSDoc from Array.<> to Array<>
Same with Object.
This commit is contained in:
@@ -473,9 +473,9 @@ Blockly.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN = {
|
||||
},
|
||||
/**
|
||||
* Reconnects child blocks.
|
||||
* @param {!Array.<?Blockly.RenderedConnection>} valueConnections List of
|
||||
* @param {!Array<?Blockly.RenderedConnection>} valueConnections List of
|
||||
* value connections for 'if' input.
|
||||
* @param {!Array.<?Blockly.RenderedConnection>} statementConnections List of
|
||||
* @param {!Array<?Blockly.RenderedConnection>} statementConnections List of
|
||||
* statement connections for 'do' input.
|
||||
* @param {?Blockly.RenderedConnection} elseStatementConnection Statement
|
||||
* connection for else input.
|
||||
|
||||
@@ -264,7 +264,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
|
||||
},
|
||||
/**
|
||||
* Return all variables referenced by this block.
|
||||
* @return {!Array.<string>} List of variable names.
|
||||
* @return {!Array<string>} List of variable names.
|
||||
* @this {Blockly.Block}
|
||||
*/
|
||||
getVars: function() {
|
||||
@@ -272,7 +272,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
|
||||
},
|
||||
/**
|
||||
* Return all variables referenced by this block.
|
||||
* @return {!Array.<!Blockly.VariableModel>} List of variable models.
|
||||
* @return {!Array<!Blockly.VariableModel>} List of variable models.
|
||||
* @this {Blockly.Block}
|
||||
*/
|
||||
getVarModels: function() {
|
||||
@@ -634,8 +634,8 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
||||
},
|
||||
/**
|
||||
* Notification that the procedure's parameters have changed.
|
||||
* @param {!Array.<string>} paramNames New param names, e.g. ['x', 'y', 'z'].
|
||||
* @param {!Array.<string>} paramIds IDs of params (consistent for each
|
||||
* @param {!Array<string>} paramNames New param names, e.g. ['x', 'y', 'z'].
|
||||
* @param {!Array<string>} paramIds IDs of params (consistent for each
|
||||
* parameter through the life of a mutator, regardless of param renaming),
|
||||
* e.g. ['piua', 'f8b_', 'oi.o'].
|
||||
* @private
|
||||
@@ -809,7 +809,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
||||
},
|
||||
/**
|
||||
* Return all variables referenced by this block.
|
||||
* @return {!Array.<string>} List of variable names.
|
||||
* @return {!Array<string>} List of variable names.
|
||||
* @this {Blockly.Block}
|
||||
*/
|
||||
getVars: function() {
|
||||
@@ -817,7 +817,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
||||
},
|
||||
/**
|
||||
* Return all variables referenced by this block.
|
||||
* @return {!Array.<!Blockly.VariableModel>} List of variable models.
|
||||
* @return {!Array<!Blockly.VariableModel>} List of variable models.
|
||||
* @this {Blockly.Block}
|
||||
*/
|
||||
getVarModels: function() {
|
||||
|
||||
@@ -77,7 +77,7 @@ Blockly.Block = function(workspace, prototypeName, opt_id) {
|
||||
this.nextConnection = null;
|
||||
/** @type {Blockly.Connection} */
|
||||
this.previousConnection = null;
|
||||
/** @type {!Array.<!Blockly.Input>} */
|
||||
/** @type {!Array<!Blockly.Input>} */
|
||||
this.inputList = [];
|
||||
/** @type {boolean|undefined} */
|
||||
this.inputsInline = undefined;
|
||||
@@ -98,7 +98,7 @@ Blockly.Block = function(workspace, prototypeName, opt_id) {
|
||||
this.parentBlock_ = null;
|
||||
|
||||
/**
|
||||
* @type {!Array.<!Blockly.Block>}
|
||||
* @type {!Array<!Blockly.Block>}
|
||||
* @protected
|
||||
*/
|
||||
this.childBlocks_ = [];
|
||||
@@ -349,7 +349,7 @@ Blockly.Block.prototype.suppressPrefixSuffix;
|
||||
* An optional property for declaring developer variables. Return a list of
|
||||
* variable names for use by generators. Developer variables are never shown to
|
||||
* the user, but are declared as global variables in the generated code.
|
||||
* @type {?function():!Array.<string>}
|
||||
* @type {?function():!Array<string>}
|
||||
*/
|
||||
Blockly.Block.prototype.getDeveloperVariables;
|
||||
|
||||
@@ -549,7 +549,7 @@ Blockly.Block.prototype.unplugFromStack_ = function(opt_healStack) {
|
||||
/**
|
||||
* Returns all connections originating from this block.
|
||||
* @param {boolean} _all If true, return all connections even hidden ones.
|
||||
* @return {!Array.<!Blockly.Connection>} Array of connections.
|
||||
* @return {!Array<!Blockly.Connection>} Array of connections.
|
||||
* @package
|
||||
*/
|
||||
Blockly.Block.prototype.getConnections_ = function(_all) {
|
||||
@@ -711,7 +711,7 @@ Blockly.Block.prototype.getTopStackBlock = function() {
|
||||
* Excludes any connection on an output tab or any preceding statement.
|
||||
* Blocks are optionally sorted by position; top to bottom.
|
||||
* @param {boolean} ordered Sort the list if true.
|
||||
* @return {!Array.<!Blockly.Block>} Array of blocks.
|
||||
* @return {!Array<!Blockly.Block>} Array of blocks.
|
||||
*/
|
||||
Blockly.Block.prototype.getChildren = function(ordered) {
|
||||
if (!ordered) {
|
||||
@@ -776,7 +776,7 @@ Blockly.Block.prototype.setParent = function(newParent) {
|
||||
* Excludes any connection on an output tab or any preceding statements.
|
||||
* Blocks are optionally sorted by position; top to bottom.
|
||||
* @param {boolean} ordered Sort the list if true.
|
||||
* @return {!Array.<!Blockly.Block>} Flattened array of blocks.
|
||||
* @return {!Array<!Blockly.Block>} Flattened array of blocks.
|
||||
*/
|
||||
Blockly.Block.prototype.getDescendants = function(ordered) {
|
||||
var blocks = [this];
|
||||
@@ -1033,7 +1033,7 @@ Blockly.Block.prototype.getField = function(name) {
|
||||
|
||||
/**
|
||||
* Return all variables referenced by this block.
|
||||
* @return {!Array.<string>} List of variable names.
|
||||
* @return {!Array<string>} List of variable names.
|
||||
*/
|
||||
Blockly.Block.prototype.getVars = function() {
|
||||
var vars = [];
|
||||
@@ -1049,7 +1049,7 @@ Blockly.Block.prototype.getVars = function() {
|
||||
|
||||
/**
|
||||
* Return all variables referenced by this block.
|
||||
* @return {!Array.<!Blockly.VariableModel>} List of variable models.
|
||||
* @return {!Array<!Blockly.VariableModel>} List of variable models.
|
||||
* @package
|
||||
*/
|
||||
Blockly.Block.prototype.getVarModels = function() {
|
||||
@@ -1134,7 +1134,7 @@ Blockly.Block.prototype.setFieldValue = function(newValue, name) {
|
||||
/**
|
||||
* Set whether this block can chain onto the bottom of another block.
|
||||
* @param {boolean} newBoolean True if there can be a previous statement.
|
||||
* @param {(string|Array.<string>|null)=} opt_check Statement type or
|
||||
* @param {(string|Array<string>|null)=} opt_check Statement type or
|
||||
* list of statement types. Null/undefined if any type could be connected.
|
||||
*/
|
||||
Blockly.Block.prototype.setPreviousStatement = function(newBoolean, opt_check) {
|
||||
@@ -1166,7 +1166,7 @@ Blockly.Block.prototype.setPreviousStatement = function(newBoolean, opt_check) {
|
||||
/**
|
||||
* Set whether another block can chain onto the bottom of this block.
|
||||
* @param {boolean} newBoolean True if there can be a next statement.
|
||||
* @param {(string|Array.<string>|null)=} opt_check Statement type or
|
||||
* @param {(string|Array<string>|null)=} opt_check Statement type or
|
||||
* list of statement types. Null/undefined if any type could be connected.
|
||||
*/
|
||||
Blockly.Block.prototype.setNextStatement = function(newBoolean, opt_check) {
|
||||
@@ -1194,7 +1194,7 @@ Blockly.Block.prototype.setNextStatement = function(newBoolean, opt_check) {
|
||||
/**
|
||||
* Set whether this block returns a value.
|
||||
* @param {boolean} newBoolean True if there is an output.
|
||||
* @param {(string|Array.<string>|null)=} opt_check Returned type or list
|
||||
* @param {(string|Array<string>|null)=} opt_check Returned type or list
|
||||
* of returned types. Null or undefined if any type could be returned
|
||||
* (e.g. variable get).
|
||||
*/
|
||||
|
||||
@@ -86,7 +86,7 @@ Blockly.BlockDragger = function(block, workspace) {
|
||||
* A list of all of the icons (comment, warning, and mutator) that are
|
||||
* on this block and its descendants. Moving an icon moves the bubble that
|
||||
* extends from it if that bubble is open.
|
||||
* @type {Array.<!Object>}
|
||||
* @type {Array<!Object>}
|
||||
* @private
|
||||
*/
|
||||
this.dragIconData_ = Blockly.BlockDragger.initIconData_(block);
|
||||
@@ -109,7 +109,7 @@ Blockly.BlockDragger.prototype.dispose = function() {
|
||||
* on this block and its descendants. Moving an icon moves the bubble that
|
||||
* extends from it if that bubble is open.
|
||||
* @param {!Blockly.BlockSvg} block The root block that is being dragged.
|
||||
* @return {!Array.<!Object>} The list of all icons and their locations.
|
||||
* @return {!Array<!Object>} The list of all icons and their locations.
|
||||
* @private
|
||||
*/
|
||||
Blockly.BlockDragger.initIconData_ = function(block) {
|
||||
@@ -372,7 +372,7 @@ Blockly.BlockDragger.prototype.dragIcons_ = function(dxy) {
|
||||
/**
|
||||
* Get a list of the insertion markers that currently exist. Drags have 0, 1,
|
||||
* or 2 insertion markers.
|
||||
* @return {!Array.<!Blockly.BlockSvg>} A possibly empty list of insertion
|
||||
* @return {!Array<!Blockly.BlockSvg>} A possibly empty list of insertion
|
||||
* marker blocks.
|
||||
* @package
|
||||
*/
|
||||
|
||||
@@ -157,7 +157,7 @@ Blockly.BlockSvg.prototype.width = 0;
|
||||
/**
|
||||
* Map from IDs for warnings text to PIDs of functions to apply them.
|
||||
* Used to be able to maintain multiple warnings.
|
||||
* @type {Object.<string, number>}
|
||||
* @type {Object<string, number>}
|
||||
* @private
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.warningTextDb_ = null;
|
||||
@@ -200,7 +200,7 @@ Blockly.BlockSvg.prototype.compose;
|
||||
|
||||
/**
|
||||
* An optional method for defining custom block context menu items.
|
||||
* @type {?function(!Array.<!Object>)}
|
||||
* @type {?function(!Array<!Object>)}
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.customContextMenu;
|
||||
|
||||
@@ -748,7 +748,7 @@ Blockly.BlockSvg.prototype.showHelp = function() {
|
||||
/**
|
||||
* Generate the context menu for this block.
|
||||
* @protected
|
||||
* @return {Array.<!Object>} Context menu options
|
||||
* @return {Array<!Object>} Context menu options
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.generateContextMenu = function() {
|
||||
if (this.workspace.options.readOnly || !this.contextMenu) {
|
||||
@@ -1279,7 +1279,7 @@ Blockly.BlockSvg.prototype.bringToFront = function() {
|
||||
/**
|
||||
* Set whether this block can chain onto the bottom of another block.
|
||||
* @param {boolean} newBoolean True if there can be a previous statement.
|
||||
* @param {(string|Array.<string>|null)=} opt_check Statement type or
|
||||
* @param {(string|Array<string>|null)=} opt_check Statement type or
|
||||
* list of statement types. Null/undefined if any type could be connected.
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.setPreviousStatement = function(newBoolean,
|
||||
@@ -1296,7 +1296,7 @@ Blockly.BlockSvg.prototype.setPreviousStatement = function(newBoolean,
|
||||
/**
|
||||
* Set whether another block can chain onto the bottom of this block.
|
||||
* @param {boolean} newBoolean True if there can be a next statement.
|
||||
* @param {(string|Array.<string>|null)=} opt_check Statement type or
|
||||
* @param {(string|Array<string>|null)=} opt_check Statement type or
|
||||
* list of statement types. Null/undefined if any type could be connected.
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.setNextStatement = function(newBoolean, opt_check) {
|
||||
@@ -1312,7 +1312,7 @@ Blockly.BlockSvg.prototype.setNextStatement = function(newBoolean, opt_check) {
|
||||
/**
|
||||
* Set whether this block returns a value.
|
||||
* @param {boolean} newBoolean True if there is an output.
|
||||
* @param {(string|Array.<string>|null)=} opt_check Returned type or list
|
||||
* @param {(string|Array<string>|null)=} opt_check Returned type or list
|
||||
* of returned types. Null or undefined if any type could be returned
|
||||
* (e.g. variable get).
|
||||
*/
|
||||
@@ -1445,7 +1445,7 @@ Blockly.BlockSvg.prototype.setConnectionTracking = function(track) {
|
||||
* @param {boolean} all If true, return all connections even hidden ones.
|
||||
* Otherwise, for a non-rendered block return an empty list, and for a
|
||||
* collapsed block don't return inputs connections.
|
||||
* @return {!Array.<!Blockly.RenderedConnection>} Array of connections.
|
||||
* @return {!Array<!Blockly.RenderedConnection>} Array of connections.
|
||||
* @package
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.getConnections_ = function(all) {
|
||||
|
||||
@@ -83,7 +83,7 @@ Blockly.selected = null;
|
||||
|
||||
/**
|
||||
* All of the connections on blocks that are currently being dragged.
|
||||
* @type {!Array.<!Blockly.Connection>}
|
||||
* @type {!Array<!Blockly.Connection>}
|
||||
* @package
|
||||
*/
|
||||
Blockly.draggingConnections = [];
|
||||
@@ -373,7 +373,7 @@ Blockly.jsonInitFactory_ = function(jsonDef) {
|
||||
/**
|
||||
* Define blocks from an array of JSON block definitions, as might be generated
|
||||
* by the Blockly Developer Tools.
|
||||
* @param {!Array.<!Object>} jsonArray An array of JSON block definitions.
|
||||
* @param {!Array<!Object>} jsonArray An array of JSON block definitions.
|
||||
*/
|
||||
Blockly.defineBlocksWithJsonArray = function(jsonArray) {
|
||||
for (var i = 0; i < jsonArray.length; i++) {
|
||||
@@ -468,7 +468,7 @@ Blockly.checkBlockColourConstants = function() {
|
||||
* Checks for a constant in the Blockly namespace, verifying it is undefined or
|
||||
* has the old/original value. Prints a warning if this is not true.
|
||||
* @param {string} msgName The Msg constant identifier.
|
||||
* @param {Array.<string>} blocklyNamePath The name parts of the tested
|
||||
* @param {Array<string>} blocklyNamePath The name parts of the tested
|
||||
* constant.
|
||||
* @param {number|undefined} expectedValue The expected value of the constant.
|
||||
* @private
|
||||
|
||||
@@ -18,6 +18,6 @@ goog.provide('Blockly.Blocks');
|
||||
|
||||
/**
|
||||
* A mapping of block type names to block prototype objects.
|
||||
* @type {!Object.<string,Object>}
|
||||
* @type {!Object<string,Object>}
|
||||
*/
|
||||
Blockly.Blocks = Object.create(null);
|
||||
|
||||
@@ -20,7 +20,7 @@ goog.require('Blockly.utils.global');
|
||||
* Blockly opaque event data used to unbind events when using
|
||||
* `Blockly.browserEvents.bind` and
|
||||
* `Blockly.browserEvents.conditionalBind`.
|
||||
* @typedef {!Array.<!Array>}
|
||||
* @typedef {!Array<!Array>}
|
||||
*/
|
||||
Blockly.browserEvents.Data;
|
||||
|
||||
|
||||
@@ -569,7 +569,7 @@ Blockly.Connection.prototype.onCheckChanged_ = function() {
|
||||
|
||||
/**
|
||||
* Change a connection's compatibility.
|
||||
* @param {?(string|!Array.<string>)} check Compatible value type or list of
|
||||
* @param {?(string|!Array<string>)} check Compatible value type or list of
|
||||
* value types. Null if all types are compatible.
|
||||
* @return {!Blockly.Connection} The connection being modified
|
||||
* (to allow chaining).
|
||||
@@ -631,7 +631,7 @@ Blockly.Connection.prototype.getShadowDom = function() {
|
||||
* {@link Blockly.RenderedConnection} overrides this behavior with a list
|
||||
* computed from the rendered positioning.
|
||||
* @param {number} _maxLimit The maximum radius to another connection.
|
||||
* @return {!Array.<!Blockly.Connection>} List of connections.
|
||||
* @return {!Array<!Blockly.Connection>} List of connections.
|
||||
* @package
|
||||
*/
|
||||
Blockly.Connection.prototype.neighbours = function(_maxLimit) {
|
||||
|
||||
@@ -35,7 +35,7 @@ goog.requireType('Blockly.utils.Coordinate');
|
||||
Blockly.ConnectionDB = function(checker) {
|
||||
/**
|
||||
* Array of connections sorted by y position in workspace units.
|
||||
* @type {!Array.<!Blockly.RenderedConnection>}
|
||||
* @type {!Array<!Blockly.RenderedConnection>}
|
||||
* @private
|
||||
*/
|
||||
this.connections_ = [];
|
||||
@@ -150,7 +150,7 @@ Blockly.ConnectionDB.prototype.removeConnection = function(connection, yPos) {
|
||||
* @param {!Blockly.RenderedConnection} connection The connection whose
|
||||
* neighbours should be returned.
|
||||
* @param {number} maxRadius The maximum radius to another connection.
|
||||
* @return {!Array.<!Blockly.RenderedConnection>} List of connections.
|
||||
* @return {!Array<!Blockly.RenderedConnection>} List of connections.
|
||||
*/
|
||||
Blockly.ConnectionDB.prototype.getNeighbours = function(connection, maxRadius) {
|
||||
var db = this.connections_;
|
||||
@@ -286,7 +286,7 @@ Blockly.ConnectionDB.prototype.searchForClosest = function(conn, maxRadius,
|
||||
* Initialize a set of connection DBs for a workspace.
|
||||
* @param {!Blockly.IConnectionChecker} checker The workspace's
|
||||
* connection checker, used to decide if connections are valid during a drag.
|
||||
* @return {!Array.<!Blockly.ConnectionDB>} Array of databases.
|
||||
* @return {!Array<!Blockly.ConnectionDB>} Array of databases.
|
||||
*/
|
||||
Blockly.ConnectionDB.init = function(checker) {
|
||||
// Create four databases, one for each connection type.
|
||||
|
||||
@@ -54,7 +54,7 @@ Blockly.ContextMenu.menu_ = null;
|
||||
/**
|
||||
* Construct the menu based on the list of options and show the menu.
|
||||
* @param {!Event} e Mouse event.
|
||||
* @param {!Array.<!Object>} options Array of menu options.
|
||||
* @param {!Array<!Object>} options Array of menu options.
|
||||
* @param {boolean} rtl True if RTL, false if LTR.
|
||||
*/
|
||||
Blockly.ContextMenu.show = function(e, options, rtl) {
|
||||
@@ -75,7 +75,7 @@ Blockly.ContextMenu.show = function(e, options, rtl) {
|
||||
|
||||
/**
|
||||
* Create the context menu object and populate it with the given options.
|
||||
* @param {!Array.<!Object>} options Array of menu options.
|
||||
* @param {!Array<!Object>} options Array of menu options.
|
||||
* @param {boolean} rtl True if RTL, false if LTR.
|
||||
* @return {!Blockly.Menu} The menu that will be shown on right click.
|
||||
* @private
|
||||
|
||||
@@ -183,7 +183,7 @@ Blockly.ContextMenuItems.registerExpand = function() {
|
||||
/**
|
||||
* Adds a block and its children to a list of deletable blocks.
|
||||
* @param {!Blockly.BlockSvg} block to delete.
|
||||
* @param {!Array.<!Blockly.BlockSvg>} deleteList list of blocks that can be deleted. This will be
|
||||
* @param {!Array<!Blockly.BlockSvg>} deleteList list of blocks that can be deleted. This will be
|
||||
* modifed in place with the given block and its descendants.
|
||||
* @private
|
||||
*/
|
||||
@@ -191,7 +191,7 @@ Blockly.ContextMenuItems.addDeletableBlocks_ = function(block, deleteList) {
|
||||
if (block.isDeletable()) {
|
||||
Array.prototype.push.apply(deleteList, block.getDescendants(false));
|
||||
} else {
|
||||
var children = /** @type !Array.<!Blockly.BlockSvg> */ (block.getChildren(false));
|
||||
var children = /** @type !Array<!Blockly.BlockSvg> */ (block.getChildren(false));
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
Blockly.ContextMenuItems.addDeletableBlocks_(children[i], deleteList);
|
||||
}
|
||||
@@ -201,7 +201,7 @@ Blockly.ContextMenuItems.addDeletableBlocks_ = function(block, deleteList) {
|
||||
/**
|
||||
* Constructs a list of blocks that can be deleted in the given workspace.
|
||||
* @param {!Blockly.WorkspaceSvg} workspace to delete all blocks from.
|
||||
* @return {!Array.<!Blockly.BlockSvg>} list of blocks to delete.
|
||||
* @return {!Array<!Blockly.BlockSvg>} list of blocks to delete.
|
||||
* @private
|
||||
*/
|
||||
Blockly.ContextMenuItems.getDeletableBlocks_ = function(workspace) {
|
||||
@@ -214,7 +214,7 @@ Blockly.ContextMenuItems.getDeletableBlocks_ = function(workspace) {
|
||||
};
|
||||
|
||||
/** Deletes the given blocks. Used to delete all blocks in the workspace.
|
||||
* @param {!Array.<!Blockly.BlockSvg>} deleteList list of blocks to delete.
|
||||
* @param {!Array<!Blockly.BlockSvg>} deleteList list of blocks to delete.
|
||||
* @param {string} eventGroup event group ID with which all delete events should be associated.
|
||||
* @private
|
||||
*/
|
||||
|
||||
@@ -133,7 +133,7 @@ Blockly.ContextMenuRegistry.prototype.getItem = function(id) {
|
||||
* shown (e.g. on a block or on a workspace)
|
||||
* @param {!Blockly.ContextMenuRegistry.Scope} scope Current scope of context menu
|
||||
* (i.e., the exact workspace or block being clicked on)
|
||||
* @return {!Array.<!Blockly.ContextMenuRegistry.ContextMenuOption>} the list of ContextMenuOptions
|
||||
* @return {!Array<!Blockly.ContextMenuRegistry.ContextMenuOption>} the list of ContextMenuOptions
|
||||
*/
|
||||
Blockly.ContextMenuRegistry.prototype.getContextMenuOptions = function(scopeType, scope) {
|
||||
var menuOptions = [];
|
||||
|
||||
@@ -28,7 +28,7 @@ Blockly.Css.injected_ = false;
|
||||
* Add some CSS to the blob that will be injected later. Allows optional
|
||||
* components such as fields and the toolbox to store separate CSS.
|
||||
* The provided array of CSS will be destroyed by this function.
|
||||
* @param {!Array.<string>} cssArray Array of CSS strings.
|
||||
* @param {!Array<string>} cssArray Array of CSS strings.
|
||||
*/
|
||||
Blockly.Css.register = function(cssArray) {
|
||||
if (Blockly.Css.injected_) {
|
||||
|
||||
@@ -266,9 +266,9 @@ Blockly.Events.fireNow_ = function() {
|
||||
|
||||
/**
|
||||
* Filter the queued events and merge duplicates.
|
||||
* @param {!Array.<!Blockly.Events.Abstract>} queueIn Array of events.
|
||||
* @param {!Array<!Blockly.Events.Abstract>} queueIn Array of events.
|
||||
* @param {boolean} forward True if forward (redo), false if backward (undo).
|
||||
* @return {!Array.<!Blockly.Events.Abstract>} Array of filtered events.
|
||||
* @return {!Array<!Blockly.Events.Abstract>} Array of filtered events.
|
||||
*/
|
||||
Blockly.Events.filter = function(queueIn, forward) {
|
||||
var queue = queueIn.slice(); // Shallow copy of queue.
|
||||
@@ -396,7 +396,7 @@ Blockly.Events.setGroup = function(state) {
|
||||
/**
|
||||
* Compute a list of the IDs of the specified block and all its descendants.
|
||||
* @param {!Blockly.Block} block The root block.
|
||||
* @return {!Array.<string>} List of block IDs.
|
||||
* @return {!Array<string>} List of block IDs.
|
||||
* @package
|
||||
*/
|
||||
Blockly.Events.getDescendantIds = function(block) {
|
||||
|
||||
@@ -26,7 +26,7 @@ goog.requireType('Blockly.Block');
|
||||
* dragged. Undefined for a blank event.
|
||||
* @param {boolean=} opt_isStart Whether this is the start of a block drag.
|
||||
* Undefined for a blank event.
|
||||
* @param {!Array.<!Blockly.Block>=} opt_blocks The blocks affected by this
|
||||
* @param {!Array<!Blockly.Block>=} opt_blocks The blocks affected by this
|
||||
* drag. Undefined for a blank event.
|
||||
* @extends {Blockly.Events.UiBase}
|
||||
* @constructor
|
||||
@@ -44,7 +44,7 @@ Blockly.Events.BlockDrag = function(opt_block, opt_isStart, opt_blocks) {
|
||||
|
||||
/**
|
||||
* The blocks affected by this drag event.
|
||||
* @type {!Array.<!Blockly.Block>|undefined}
|
||||
* @type {!Array<!Blockly.Block>|undefined}
|
||||
*/
|
||||
this.blocks = opt_blocks;
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ Blockly.Extensions.registerMixin = function(name, mixinObj) {
|
||||
* @param {!Object} mixinObj The values to mix in.
|
||||
* @param {(function())=} opt_helperFn An optional function to apply after
|
||||
* mixing in the object.
|
||||
* @param {!Array.<string>=} opt_blockList A list of blocks to appear in the
|
||||
* @param {!Array<string>=} opt_blockList A list of blocks to appear in the
|
||||
* flyout of the mutator dialog.
|
||||
* @throws {Error} if the mutation is invalid or can't be applied to the block.
|
||||
*/
|
||||
@@ -157,7 +157,7 @@ Blockly.Extensions.apply = function(name, block, isMutator) {
|
||||
Blockly.Extensions.checkBlockHasMutatorProperties_(errorPrefix, block);
|
||||
} else {
|
||||
if (!Blockly.Extensions.mutatorPropertiesMatch_(
|
||||
/** @type {!Array.<Object>} */ (mutatorProperties), block)) {
|
||||
/** @type {!Array<Object>} */ (mutatorProperties), block)) {
|
||||
throw Error('Error when applying extension "' + name + '": ' +
|
||||
'mutation properties changed when applying a non-mutator extension.');
|
||||
}
|
||||
@@ -257,7 +257,7 @@ Blockly.Extensions.checkBlockHasMutatorProperties_ = function(errorPrefix,
|
||||
/**
|
||||
* Get a list of values of mutator properties on the given block.
|
||||
* @param {!Blockly.Block} block The block to inspect.
|
||||
* @return {!Array.<Object>} A list with all of the defined properties, which
|
||||
* @return {!Array<Object>} A list with all of the defined properties, which
|
||||
* should be functions, but may be anything other than undefined.
|
||||
* @private
|
||||
*/
|
||||
@@ -284,7 +284,7 @@ Blockly.Extensions.getMutatorProperties_ = function(block) {
|
||||
* Check that the current mutator properties match a list of old mutator
|
||||
* properties. This should be called after applying a non-mutator extension,
|
||||
* to verify that the extension didn't change properties it shouldn't.
|
||||
* @param {!Array.<Object>} oldProperties The old values to compare to.
|
||||
* @param {!Array<Object>} oldProperties The old values to compare to.
|
||||
* @param {!Blockly.Block} block The block to inspect for new values.
|
||||
* @return {boolean} True if the property lists match.
|
||||
* @private
|
||||
@@ -317,7 +317,7 @@ Blockly.Extensions.mutatorPropertiesMatch_ = function(oldProperties, block) {
|
||||
* reported as warnings in the console, and are never fatal.
|
||||
* @param {string} dropdownName The name of the field whose value is the key
|
||||
* to the lookup table.
|
||||
* @param {!Object.<string, string>} lookupTable The table of field values to
|
||||
* @param {!Object<string, string>} lookupTable The table of field values to
|
||||
* tooltip text.
|
||||
* @return {!Function} The extension function.
|
||||
*/
|
||||
@@ -377,7 +377,7 @@ Blockly.Extensions.buildTooltipForDropdown = function(dropdownName,
|
||||
* Emits console warnings when they are not.
|
||||
* @param {!Blockly.Block} block The block containing the dropdown
|
||||
* @param {string} dropdownName The name of the dropdown
|
||||
* @param {!Object.<string, string>} lookupTable The string lookup table
|
||||
* @param {!Object<string, string>} lookupTable The string lookup table
|
||||
* @private
|
||||
*/
|
||||
Blockly.Extensions.checkDropdownOptionsInTable_ = function(block, dropdownName,
|
||||
|
||||
@@ -130,14 +130,14 @@ Blockly.FieldColour.prototype.isDirty_ = false;
|
||||
|
||||
/**
|
||||
* Array of colours used by this field. If null, use the global list.
|
||||
* @type {Array.<string>}
|
||||
* @type {Array<string>}
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldColour.prototype.colours_ = null;
|
||||
|
||||
/**
|
||||
* Array of colour tooltips used by this field. If null, use the global list.
|
||||
* @type {Array.<string>}
|
||||
* @type {Array<string>}
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldColour.prototype.titles_ = null;
|
||||
@@ -243,7 +243,7 @@ Blockly.FieldColour.prototype.getText = function() {
|
||||
* An array of colour strings for the palette.
|
||||
* Copied from goog.ui.ColorPicker.SIMPLE_GRID_COLORS
|
||||
* All colour pickers use this unless overridden with setColours.
|
||||
* @type {!Array.<string>}
|
||||
* @type {!Array<string>}
|
||||
*/
|
||||
Blockly.FieldColour.COLOURS = [
|
||||
// grays
|
||||
@@ -279,7 +279,7 @@ Blockly.FieldColour.prototype.DEFAULT_VALUE = Blockly.FieldColour.COLOURS[0];
|
||||
* An array of tooltip strings for the palette. If not the same length as
|
||||
* COLOURS, the colour's hex code will be used for any missing titles.
|
||||
* All colour pickers use this unless overridden with setColours.
|
||||
* @type {!Array.<string>}
|
||||
* @type {!Array<string>}
|
||||
*/
|
||||
Blockly.FieldColour.TITLES = [];
|
||||
|
||||
@@ -291,9 +291,9 @@ Blockly.FieldColour.COLUMNS = 7;
|
||||
|
||||
/**
|
||||
* Set a custom colour grid for this field.
|
||||
* @param {Array.<string>} colours Array of colours for this block,
|
||||
* @param {Array<string>} colours Array of colours for this block,
|
||||
* or null to use default (Blockly.FieldColour.COLOURS).
|
||||
* @param {Array.<string>=} opt_titles Optional array of colour tooltips,
|
||||
* @param {Array<string>=} opt_titles Optional array of colour tooltips,
|
||||
* or null to use default (Blockly.FieldColour.TITLES).
|
||||
* @return {!Blockly.FieldColour} Returns itself (for method chaining).
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@ goog.require('Blockly.utils.userAgent');
|
||||
|
||||
/**
|
||||
* Class for an editable dropdown field.
|
||||
* @param {(!Array.<!Array>|!Function)} menuGenerator A non-empty array of
|
||||
* @param {(!Array<!Array>|!Function)} menuGenerator A non-empty array of
|
||||
* options for a dropdown list, or a function which generates these options.
|
||||
* @param {Function=} opt_validator A function that is called to validate
|
||||
* changes to the field's value. Takes in a language-neutral dropdown
|
||||
@@ -52,15 +52,15 @@ Blockly.FieldDropdown = function(menuGenerator, opt_validator, opt_config) {
|
||||
/**
|
||||
* An array of options for a dropdown list,
|
||||
* or a function which generates these options.
|
||||
* @type {(!Array.<!Array>|
|
||||
* !function(this:Blockly.FieldDropdown): !Array.<!Array>)}
|
||||
* @type {(!Array<!Array>|
|
||||
* !function(this:Blockly.FieldDropdown): !Array<!Array>)}
|
||||
* @protected
|
||||
*/
|
||||
this.menuGenerator_ = menuGenerator;
|
||||
|
||||
/**
|
||||
* A cache of the most recently generated options.
|
||||
* @type {Array.<!Array.<string>>}
|
||||
* @type {Array<!Array<string>>}
|
||||
* @private
|
||||
*/
|
||||
this.generatedOptions_ = null;
|
||||
@@ -449,11 +449,11 @@ Blockly.FieldDropdown.prototype.trimOptions_ = function() {
|
||||
/**
|
||||
* Use the calculated prefix and suffix lengths to trim all of the options in
|
||||
* the given array.
|
||||
* @param {!Array.<!Array>} options Array of option tuples:
|
||||
* @param {!Array<!Array>} options Array of option tuples:
|
||||
* (human-readable text or image, language-neutral name).
|
||||
* @param {number} prefixLength The length of the common prefix.
|
||||
* @param {number} suffixLength The length of the common suffix
|
||||
* @return {!Array.<!Array>} A new array with all of the option text trimmed.
|
||||
* @return {!Array<!Array>} A new array with all of the option text trimmed.
|
||||
*/
|
||||
Blockly.FieldDropdown.applyTrim_ = function(options,
|
||||
prefixLength, suffixLength) {
|
||||
@@ -480,7 +480,7 @@ Blockly.FieldDropdown.prototype.isOptionListDynamic = function() {
|
||||
* Return a list of the options for this dropdown.
|
||||
* @param {boolean=} opt_useCache For dynamic options, whether or not to use the
|
||||
* cached options or to re-generate them.
|
||||
* @return {!Array.<!Array>} A non-empty array of option tuples:
|
||||
* @return {!Array<!Array>} A non-empty array of option tuples:
|
||||
* (human-readable text or image, language-neutral name).
|
||||
* @throws {TypeError} If generated options are incorrectly structured.
|
||||
*/
|
||||
@@ -492,7 +492,7 @@ Blockly.FieldDropdown.prototype.getOptions = function(opt_useCache) {
|
||||
}
|
||||
return this.generatedOptions_;
|
||||
}
|
||||
return /** @type {!Array.<!Array.<string>>} */ (this.menuGenerator_);
|
||||
return /** @type {!Array<!Array<string>>} */ (this.menuGenerator_);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,7 +39,7 @@ goog.requireType('Blockly.MenuItem');
|
||||
* @param {Function=} opt_validator A function that is called to validate
|
||||
* changes to the field's value. Takes in a variable ID & returns a
|
||||
* validated variable ID, or null to abort the change.
|
||||
* @param {Array.<string>=} opt_variableTypes A list of the types of variables
|
||||
* @param {Array<string>=} opt_variableTypes A list of the types of variables
|
||||
* to include in the dropdown.
|
||||
* @param {string=} opt_defaultType The type of variable to create if this
|
||||
* field's value is not explicitly set. Defaults to ''.
|
||||
@@ -58,8 +58,8 @@ Blockly.FieldVariable = function(varName, opt_validator, opt_variableTypes,
|
||||
/**
|
||||
* An array of options for a dropdown list,
|
||||
* or a function which generates these options.
|
||||
* @type {(!Array.<!Array>|
|
||||
* !function(this:Blockly.FieldDropdown): !Array.<!Array>)}
|
||||
* @type {(!Array<!Array>|
|
||||
* !function(this:Blockly.FieldDropdown): !Array<!Array>)}
|
||||
* @protected
|
||||
*/
|
||||
this.menuGenerator_ = Blockly.FieldVariable.dropdownCreate;
|
||||
@@ -312,7 +312,7 @@ Blockly.FieldVariable.prototype.typeIsAllowed_ = function(type) {
|
||||
|
||||
/**
|
||||
* Return a list of variable types to include in the dropdown.
|
||||
* @return {!Array.<string>} Array of variable types.
|
||||
* @return {!Array<string>} Array of variable types.
|
||||
* @throws {Error} if variableTypes is an empty array.
|
||||
* @private
|
||||
*/
|
||||
@@ -338,7 +338,7 @@ Blockly.FieldVariable.prototype.getVariableTypes_ = function() {
|
||||
/**
|
||||
* Parse the optional arguments representing the allowed variable types and the
|
||||
* default variable type.
|
||||
* @param {Array.<string>=} opt_variableTypes A list of the types of variables
|
||||
* @param {Array<string>=} opt_variableTypes A list of the types of variables
|
||||
* to include in the dropdown. If null or undefined, variables of all types
|
||||
* will be displayed in the dropdown.
|
||||
* @param {string=} opt_defaultType The type of the variable to create if this
|
||||
@@ -388,7 +388,7 @@ Blockly.FieldVariable.prototype.refreshVariableName = function() {
|
||||
/**
|
||||
* Return a sorted list of variable names for variable dropdown menus.
|
||||
* Include a special option at the end for creating a new variable name.
|
||||
* @return {!Array.<!Array>} Array of variable names/id tuples.
|
||||
* @return {!Array<!Array>} Array of variable names/id tuples.
|
||||
* @this {Blockly.FieldVariable}
|
||||
*/
|
||||
Blockly.FieldVariable.dropdownCreate = function() {
|
||||
|
||||
@@ -91,7 +91,7 @@ Blockly.Flyout = function(workspaceOptions) {
|
||||
|
||||
/**
|
||||
* Opaque data that can be passed to Blockly.unbindEvent_.
|
||||
* @type {!Array.<!Array>}
|
||||
* @type {!Array<!Array>}
|
||||
* @private
|
||||
*/
|
||||
this.eventWrappers_ = [];
|
||||
@@ -99,28 +99,28 @@ Blockly.Flyout = function(workspaceOptions) {
|
||||
/**
|
||||
* List of background mats that lurk behind each block to catch clicks
|
||||
* landing in the blocks' lakes and bays.
|
||||
* @type {!Array.<!SVGElement>}
|
||||
* @type {!Array<!SVGElement>}
|
||||
* @private
|
||||
*/
|
||||
this.mats_ = [];
|
||||
|
||||
/**
|
||||
* List of visible buttons.
|
||||
* @type {!Array.<!Blockly.FlyoutButton>}
|
||||
* @type {!Array<!Blockly.FlyoutButton>}
|
||||
* @protected
|
||||
*/
|
||||
this.buttons_ = [];
|
||||
|
||||
/**
|
||||
* List of event listeners.
|
||||
* @type {!Array.<!Array>}
|
||||
* @type {!Array<!Array>}
|
||||
* @private
|
||||
*/
|
||||
this.listeners_ = [];
|
||||
|
||||
/**
|
||||
* List of blocks that should always be disabled.
|
||||
* @type {!Array.<!Blockly.Block>}
|
||||
* @type {!Array<!Blockly.Block>}
|
||||
* @private
|
||||
*/
|
||||
this.permanentlyDisabled_ = [];
|
||||
@@ -498,7 +498,7 @@ Blockly.Flyout.prototype.show = function(flyoutDef) {
|
||||
// Parse the Array, Node or NodeList into a a list of flyout items.
|
||||
var parsedContent = Blockly.utils.toolbox.convertFlyoutDefToJsonArray(flyoutDef);
|
||||
var flyoutInfo =
|
||||
/** @type {{contents:!Array.<!Object>, gaps:!Array.<number>}} */ (
|
||||
/** @type {{contents:!Array<!Object>, gaps:!Array<number>}} */ (
|
||||
this.createFlyoutInfo_(parsedContent));
|
||||
|
||||
this.layout_(flyoutInfo.contents, flyoutInfo.gaps);
|
||||
@@ -537,7 +537,7 @@ Blockly.Flyout.prototype.show = function(flyoutDef) {
|
||||
* the flyout.
|
||||
* @param {!Blockly.utils.toolbox.FlyoutItemInfoArray} parsedContent The array
|
||||
* of objects to show in the flyout.
|
||||
* @return {{contents:Array.<Object>, gaps:Array.<number>}} The list of contents
|
||||
* @return {{contents:Array<Object>, gaps:Array<number>}} The list of contents
|
||||
* and gaps needed to lay out the flyout.
|
||||
* @private
|
||||
*/
|
||||
@@ -594,7 +594,7 @@ Blockly.Flyout.prototype.createFlyoutInfo_ = function(parsedContent) {
|
||||
/**
|
||||
* Gets the flyout definition for the dynamic category.
|
||||
* @param {string} categoryName The name of the dynamic category.
|
||||
* @return {!Array.<!Element>} The array of flyout items.
|
||||
* @return {!Array<!Element>} The array of flyout items.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Flyout.prototype.getDynamicCategoryContents_ = function(categoryName) {
|
||||
@@ -684,7 +684,7 @@ Blockly.Flyout.prototype.getBlockXml_ = function(blockInfo) {
|
||||
* Add the necessary gap in the flyout for a separator.
|
||||
* @param {!Blockly.utils.toolbox.SeparatorInfo} sepInfo The object holding
|
||||
* information about a separator.
|
||||
* @param {!Array.<number>} gaps The list gaps between items in the flyout.
|
||||
* @param {!Array<number>} gaps The list gaps between items in the flyout.
|
||||
* @param {number} defaultGap The default gap between the button and next element.
|
||||
* @private
|
||||
*/
|
||||
@@ -1051,8 +1051,8 @@ Blockly.Flyout.prototype.setMetrics_;
|
||||
|
||||
/**
|
||||
* Lay out the blocks in the flyout.
|
||||
* @param {!Array.<!Object>} contents The blocks and buttons to lay out.
|
||||
* @param {!Array.<number>} gaps The visible gaps between blocks.
|
||||
* @param {!Array<!Object>} contents The blocks and buttons to lay out.
|
||||
* @param {!Array<number>} gaps The visible gaps between blocks.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.Flyout.prototype.layout_;
|
||||
|
||||
@@ -231,8 +231,8 @@ Blockly.HorizontalFlyout.prototype.wheel_ = function(e) {
|
||||
|
||||
/**
|
||||
* Lay out the blocks in the flyout.
|
||||
* @param {!Array.<!Object>} contents The blocks and buttons to lay out.
|
||||
* @param {!Array.<number>} gaps The visible gaps between blocks.
|
||||
* @param {!Array<!Object>} contents The blocks and buttons to lay out.
|
||||
* @param {!Array<number>} gaps The visible gaps between blocks.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.HorizontalFlyout.prototype.layout_ = function(contents, gaps) {
|
||||
|
||||
@@ -222,8 +222,8 @@ Blockly.VerticalFlyout.prototype.wheel_ = function(e) {
|
||||
|
||||
/**
|
||||
* Lay out the blocks in the flyout.
|
||||
* @param {!Array.<!Object>} contents The blocks and buttons to lay out.
|
||||
* @param {!Array.<number>} gaps The visible gaps between blocks.
|
||||
* @param {!Array<!Object>} contents The blocks and buttons to lay out.
|
||||
* @param {!Array<number>} gaps The visible gaps between blocks.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.VerticalFlyout.prototype.layout_ = function(contents, gaps) {
|
||||
|
||||
@@ -72,7 +72,7 @@ Blockly.Generator.prototype.COMMENT_WRAP = 60;
|
||||
|
||||
/**
|
||||
* List of outer-inner pairings that do NOT require parentheses.
|
||||
* @type {!Array.<!Array.<number>>}
|
||||
* @type {!Array<!Array<number>>}
|
||||
*/
|
||||
Blockly.Generator.prototype.ORDER_OVERRIDES = [];
|
||||
|
||||
@@ -442,7 +442,7 @@ Object.defineProperty(Blockly.Generator.prototype, 'variableDB_', {
|
||||
*
|
||||
* @param {string} desiredName The desired name of the function
|
||||
* (e.g. mathIsPrime).
|
||||
* @param {!Array.<string>} code A list of statements. Use ' ' for indents.
|
||||
* @param {!Array<string>} code A list of statements. Use ' ' for indents.
|
||||
* @return {string} The actual name of the new function. This may differ
|
||||
* from desiredName if the former has already been taken by the user.
|
||||
* @protected
|
||||
|
||||
@@ -953,7 +953,7 @@ Blockly.Gesture.prototype.hasStarted = function() {
|
||||
/**
|
||||
* Get a list of the insertion markers that currently exist. Block drags have
|
||||
* 0, 1, or 2 insertion markers.
|
||||
* @return {!Array.<!Blockly.BlockSvg>} A possibly empty list of insertion
|
||||
* @return {!Array<!Blockly.BlockSvg>} A possibly empty list of insertion
|
||||
* marker blocks.
|
||||
* @package
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ Blockly.Input = function(type, name, block, connection) {
|
||||
this.sourceBlock_ = block;
|
||||
/** @type {Blockly.Connection} */
|
||||
this.connection = connection;
|
||||
/** @type {!Array.<!Blockly.Field>} */
|
||||
/** @type {!Array<!Blockly.Field>} */
|
||||
this.fieldRow = [];
|
||||
};
|
||||
|
||||
@@ -185,7 +185,7 @@ Blockly.Input.prototype.isVisible = function() {
|
||||
* Sets whether this input is visible or not.
|
||||
* Should only be used to collapse/uncollapse a block.
|
||||
* @param {boolean} visible True if visible.
|
||||
* @return {!Array.<!Blockly.BlockSvg>} List of blocks to render.
|
||||
* @return {!Array<!Blockly.BlockSvg>} List of blocks to render.
|
||||
* @package
|
||||
*/
|
||||
Blockly.Input.prototype.setVisible = function(visible) {
|
||||
@@ -230,7 +230,7 @@ Blockly.Input.prototype.markDirty = function() {
|
||||
|
||||
/**
|
||||
* Change a connection's compatibility.
|
||||
* @param {string|Array.<string>|null} check Compatible value type or
|
||||
* @param {string|Array<string>|null} check Compatible value type or
|
||||
* list of value types. Null if all types are compatible.
|
||||
* @return {!Blockly.Input} The input being modified (to allow chaining).
|
||||
*/
|
||||
|
||||
@@ -131,7 +131,7 @@ Blockly.InsertionMarkerManager = function(block) {
|
||||
* other blocks. This includes all open connections on the top block, as well
|
||||
* as the last connection on the block stack.
|
||||
* Does not change during a drag.
|
||||
* @type {!Array.<!Blockly.RenderedConnection>}
|
||||
* @type {!Array<!Blockly.RenderedConnection>}
|
||||
* @private
|
||||
*/
|
||||
this.availableConnections_ = this.initAvailableConnections_();
|
||||
@@ -322,7 +322,7 @@ Blockly.InsertionMarkerManager.prototype.createMarkerBlock_ = function(sourceBlo
|
||||
* only be called once, at the beginning of a drag.
|
||||
* If the stack has more than one block, this function will populate
|
||||
* lastOnStack_ and create the corresponding insertion marker.
|
||||
* @return {!Array.<!Blockly.RenderedConnection>} A list of available
|
||||
* @return {!Array<!Blockly.RenderedConnection>} A list of available
|
||||
* connections.
|
||||
* @private
|
||||
*/
|
||||
@@ -713,7 +713,7 @@ Blockly.InsertionMarkerManager.prototype.hideReplacementFade_ = function() {
|
||||
/**
|
||||
* Get a list of the insertion markers that currently exist. Drags have 0, 1,
|
||||
* or 2 insertion markers.
|
||||
* @return {!Array.<!Blockly.BlockSvg>} A possibly empty list of insertion
|
||||
* @return {!Array<!Blockly.BlockSvg>} A possibly empty list of insertion
|
||||
* marker blocks.
|
||||
* @package
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ Blockly.Menu = function() {
|
||||
* Array of menu items.
|
||||
* (Nulls are never in the array, but typing the array as nullable prevents
|
||||
* the compiler from objecting to .indexOf(null))
|
||||
* @type {!Array.<Blockly.MenuItem>}
|
||||
* @type {!Array<Blockly.MenuItem>}
|
||||
* @private
|
||||
*/
|
||||
this.menuItems_ = [];
|
||||
|
||||
@@ -40,7 +40,7 @@ goog.requireType('Blockly.Workspace');
|
||||
|
||||
/**
|
||||
* Class for a mutator dialog.
|
||||
* @param {!Array.<string>} quarkNames List of names of sub-blocks for flyout.
|
||||
* @param {!Array<string>} quarkNames List of names of sub-blocks for flyout.
|
||||
* @extends {Blockly.Icon}
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
@@ -136,7 +136,7 @@ Blockly.Names.prototype.getName = function(name, realm) {
|
||||
* Return a list of all known user-created names in a specified realm.
|
||||
* @param {string} realm The realm of entity in Blockly
|
||||
* ('VARIABLE', 'PROCEDURE', 'DEVELOPER_VARIABLE', etc...).
|
||||
* @return {!Array.<string>} A list of Blockly entity names (no constraints).
|
||||
* @return {!Array<string>} A list of Blockly entity names (no constraints).
|
||||
*/
|
||||
Blockly.Names.prototype.getUserNames = function(realm) {
|
||||
var realmDb = this.db_[realm] || {};
|
||||
|
||||
@@ -123,7 +123,7 @@ Blockly.Options = function(options) {
|
||||
this.readOnly = readOnly;
|
||||
/** @type {number} */
|
||||
this.maxBlocks = options['maxBlocks'] || Infinity;
|
||||
/** @type {?Object.<string, number>} */
|
||||
/** @type {?Object<string, number>} */
|
||||
this.maxInstances = options['maxInstances'];
|
||||
/** @type {string} */
|
||||
this.pathToMedia = pathToMedia;
|
||||
@@ -175,7 +175,7 @@ Blockly.Options = function(options) {
|
||||
|
||||
/**
|
||||
* Map of plugin type to name of registered plugin or plugin class.
|
||||
* @type {!Object.<string, (function(new:?, ...?)|string)>}
|
||||
* @type {!Object<string, (function(new:?, ...?)|string)>}
|
||||
*/
|
||||
this.plugins = plugins;
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ Blockly.Procedures.ProcedureBlock;
|
||||
/**
|
||||
* Find all user-created procedure definitions in a workspace.
|
||||
* @param {!Blockly.Workspace} root Root workspace.
|
||||
* @return {!Array.<!Array.<!Array>>} Pair of arrays, the
|
||||
* @return {!Array<!Array<!Array>>} Pair of arrays, the
|
||||
* first contains procedures without return variables, the second with.
|
||||
* Each procedure is defined by a three-element list of name, parameter
|
||||
* list, and return value boolean.
|
||||
@@ -188,7 +188,7 @@ Blockly.Procedures.rename = function(name) {
|
||||
/**
|
||||
* Construct the blocks required by the flyout for the procedure category.
|
||||
* @param {!Blockly.Workspace} workspace The workspace containing procedures.
|
||||
* @return {!Array.<!Element>} Array of XML block elements.
|
||||
* @return {!Array<!Element>} Array of XML block elements.
|
||||
*/
|
||||
Blockly.Procedures.flyoutCategory = function(workspace) {
|
||||
var xmlList = [];
|
||||
@@ -337,7 +337,7 @@ Blockly.Procedures.mutatorChangeListener_ = function(e) {
|
||||
* Find all the callers of a named procedure.
|
||||
* @param {string} name Name of procedure.
|
||||
* @param {!Blockly.Workspace} workspace The workspace to find callers in.
|
||||
* @return {!Array.<!Blockly.Block>} Array of caller blocks.
|
||||
* @return {!Array<!Blockly.Block>} Array of caller blocks.
|
||||
*/
|
||||
Blockly.Procedures.getCallers = function(name, workspace) {
|
||||
var callers = [];
|
||||
|
||||
@@ -386,7 +386,7 @@ Blockly.RenderedConnection.prototype.stopTrackingAll = function() {
|
||||
/**
|
||||
* Start tracking this connection, as well as all down-stream connections on
|
||||
* any block attached to this connection. This happens when a block is expanded.
|
||||
* @return {!Array.<!Blockly.Block>} List of blocks to render.
|
||||
* @return {!Array<!Blockly.Block>} List of blocks to render.
|
||||
*/
|
||||
Blockly.RenderedConnection.prototype.startTrackingAll = function() {
|
||||
this.setTracking(true);
|
||||
@@ -509,7 +509,7 @@ Blockly.RenderedConnection.prototype.respawnShadow_ = function() {
|
||||
* Type checking does not apply, since this function is used for bumping.
|
||||
* @param {number} maxLimit The maximum radius to another connection, in
|
||||
* workspace units.
|
||||
* @return {!Array.<!Blockly.Connection>} List of connections.
|
||||
* @return {!Array<!Blockly.Connection>} List of connections.
|
||||
* @package
|
||||
*/
|
||||
Blockly.RenderedConnection.prototype.neighbours = function(maxLimit) {
|
||||
|
||||
@@ -587,7 +587,7 @@ Blockly.blockRendering.ConstantProvider.prototype.setTheme = function(
|
||||
|
||||
/**
|
||||
* The block styles map.
|
||||
* @type {Object.<string, Blockly.Theme.BlockStyle>}
|
||||
* @type {Object<string, Blockly.Theme.BlockStyle>}
|
||||
* @package
|
||||
*/
|
||||
this.blockStyles = {};
|
||||
@@ -1181,7 +1181,7 @@ Blockly.blockRendering.ConstantProvider.prototype.injectCSS_ = function(
|
||||
/**
|
||||
* Get any renderer specific CSS to inject when the renderer is initialized.
|
||||
* @param {string} selector CSS selector to use.
|
||||
* @return {!Array.<string>} Array of CSS strings.
|
||||
* @return {!Array<string>} Array of CSS strings.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.blockRendering.ConstantProvider.prototype.getCSS_ = function(selector) {
|
||||
|
||||
@@ -38,7 +38,7 @@ goog.requireType('Blockly.RenderedConnection');
|
||||
Blockly.blockRendering.Debug = function(constants) {
|
||||
/**
|
||||
* An array of SVG elements that have been created by this object.
|
||||
* @type {Array.<!SVGElement>}
|
||||
* @type {Array<!SVGElement>}
|
||||
* @private
|
||||
*/
|
||||
this.debugElements_ = [];
|
||||
@@ -62,7 +62,7 @@ Blockly.blockRendering.Debug = function(constants) {
|
||||
/**
|
||||
* Configuration object containing booleans to enable and disable debug
|
||||
* rendering of specific rendering components.
|
||||
* @type {!Object.<string, boolean>}
|
||||
* @type {!Object<string, boolean>}
|
||||
*/
|
||||
Blockly.blockRendering.Debug.config = {
|
||||
rowSpacers: true,
|
||||
|
||||
@@ -135,19 +135,19 @@ Blockly.blockRendering.RenderInfo = function(renderer, block) {
|
||||
|
||||
/**
|
||||
* An array of Row objects containing sizing information.
|
||||
* @type {!Array.<!Blockly.blockRendering.Row>}
|
||||
* @type {!Array<!Blockly.blockRendering.Row>}
|
||||
*/
|
||||
this.rows = [];
|
||||
|
||||
/**
|
||||
* An array of input rows on the block.
|
||||
* @type {!Array.<!Blockly.blockRendering.InputRow>}
|
||||
* @type {!Array<!Blockly.blockRendering.InputRow>}
|
||||
*/
|
||||
this.inputRows = [];
|
||||
|
||||
/**
|
||||
* An array of measurable objects containing hidden icons.
|
||||
* @type {!Array.<!Blockly.blockRendering.Icon>}
|
||||
* @type {!Array<!Blockly.blockRendering.Icon>}
|
||||
*/
|
||||
this.hiddenIcons = [];
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ Blockly.blockRendering.Row = function(constants) {
|
||||
/**
|
||||
* An array of elements contained in this row.
|
||||
* @package
|
||||
* @type {!Array.<!Blockly.blockRendering.Measurable>}
|
||||
* @type {!Array<!Blockly.blockRendering.Measurable>}
|
||||
*/
|
||||
this.elements = [];
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Blockly.zelos.PathObject = function(root, style, constants) {
|
||||
|
||||
/**
|
||||
* The outline paths on the block.
|
||||
* @type {!Object.<string,!SVGElement>}
|
||||
* @type {!Object<string,!SVGElement>}
|
||||
* @private
|
||||
*/
|
||||
this.outlines_ = {};
|
||||
@@ -62,7 +62,7 @@ Blockly.zelos.PathObject = function(root, style, constants) {
|
||||
* set is initialized with a reference to all the outlines in
|
||||
* `this.outlines_`. Every time we use an outline during the draw pass, the
|
||||
* reference is removed from this set.
|
||||
* @type {Object.<string, number>}
|
||||
* @type {Object<string, number>}
|
||||
* @private
|
||||
*/
|
||||
this.remainingOutlines_ = null;
|
||||
|
||||
@@ -58,7 +58,7 @@ Blockly.ScrollbarPair = function(
|
||||
this.hScroll = new Blockly.Scrollbar(
|
||||
workspace, true, isPair, opt_class, opt_margin);
|
||||
}
|
||||
if (addVertical ) {
|
||||
if (addVertical) {
|
||||
this.vScroll = new Blockly.Scrollbar(
|
||||
workspace, false, isPair, opt_class, opt_margin);
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ Blockly.ShortcutRegistry.prototype.checkModifiers_ = function(
|
||||
/**
|
||||
* Creates the serialized key code that will be used in the key map.
|
||||
* @param {number} keyCode Number code representing the key.
|
||||
* @param {?Array.<string>} modifiers List of modifier key codes to be used with
|
||||
* @param {?Array<string>} modifiers List of modifier key codes to be used with
|
||||
* the key. All valid modifiers can be found in the
|
||||
* Blockly.ShortcutRegistry.modifierKeys.
|
||||
* @return {string} The serialized key code for the given modifiers and key.
|
||||
|
||||
@@ -19,9 +19,9 @@ goog.require('Blockly.utils.object');
|
||||
/**
|
||||
* Class for a theme.
|
||||
* @param {string} name Theme name.
|
||||
* @param {!Object.<string, Blockly.Theme.BlockStyle>=} opt_blockStyles A map
|
||||
* @param {!Object<string, Blockly.Theme.BlockStyle>=} opt_blockStyles A map
|
||||
* from style names (strings) to objects with style attributes for blocks.
|
||||
* @param {!Object.<string, Blockly.Theme.CategoryStyle>=} opt_categoryStyles A
|
||||
* @param {!Object<string, Blockly.Theme.CategoryStyle>=} opt_categoryStyles A
|
||||
* map from style names (strings) to objects with style attributes for
|
||||
* categories.
|
||||
* @param {!Blockly.Theme.ComponentStyle=} opt_componentStyles A map of Blockly
|
||||
@@ -39,14 +39,14 @@ Blockly.Theme = function(name, opt_blockStyles, opt_categoryStyles,
|
||||
|
||||
/**
|
||||
* The block styles map.
|
||||
* @type {!Object.<string, !Blockly.Theme.BlockStyle>}
|
||||
* @type {!Object<string, !Blockly.Theme.BlockStyle>}
|
||||
* @package
|
||||
*/
|
||||
this.blockStyles = opt_blockStyles || Object.create(null);
|
||||
|
||||
/**
|
||||
* The category styles map.
|
||||
* @type {!Object.<string, Blockly.Theme.CategoryStyle>}
|
||||
* @type {!Object<string, Blockly.Theme.CategoryStyle>}
|
||||
* @package
|
||||
*/
|
||||
this.categoryStyles = opt_categoryStyles || Object.create(null);
|
||||
|
||||
@@ -45,14 +45,14 @@ Blockly.ThemeManager = function(workspace, theme) {
|
||||
|
||||
/**
|
||||
* A list of workspaces that are subscribed to this theme.
|
||||
* @type {!Array.<Blockly.Workspace>}
|
||||
* @type {!Array<Blockly.Workspace>}
|
||||
* @private
|
||||
*/
|
||||
this.subscribedWorkspaces_ = [];
|
||||
|
||||
/**
|
||||
* A map of subscribed UI components, keyed by component name.
|
||||
* @type {!Object.<string, !Array.<!Blockly.ThemeManager.Component>>}
|
||||
* @type {!Object<string, !Array<!Blockly.ThemeManager.Component>>}
|
||||
* @private
|
||||
*/
|
||||
this.componentDB_ = Object.create(null);
|
||||
|
||||
@@ -175,7 +175,7 @@ Blockly.Touch.getTouchIdentifierFromEvent = function(e) {
|
||||
Blockly.Touch.checkTouchIdentifier = function(e) {
|
||||
var identifier = Blockly.Touch.getTouchIdentifierFromEvent(e);
|
||||
|
||||
// if (Blockly.touchIdentifier_ )is insufficient because Android touch
|
||||
// if (Blockly.touchIdentifier_) is insufficient because Android touch
|
||||
// identifiers may be zero.
|
||||
if (Blockly.Touch.touchIdentifier_ !== undefined &&
|
||||
Blockly.Touch.touchIdentifier_ !== null) {
|
||||
@@ -236,7 +236,7 @@ Blockly.Touch.isTouchEvent = function(e) {
|
||||
* point.
|
||||
* @param {!Event} e A mouse event or a touch event with one or more changed
|
||||
* touches.
|
||||
* @return {!Array.<!Event>} An array of mouse or touch events. Each touch
|
||||
* @return {!Array<!Event>} An array of mouse or touch events. Each touch
|
||||
* event will have exactly one changed touch.
|
||||
*/
|
||||
Blockly.Touch.splitEventByTouches = function(e) {
|
||||
|
||||
@@ -53,7 +53,7 @@ Blockly.Trashcan = function(workspace) {
|
||||
|
||||
/**
|
||||
* A list of XML (stored as strings) representing blocks in the trashcan.
|
||||
* @type {!Array.<string>}
|
||||
* @type {!Array<string>}
|
||||
* @private
|
||||
*/
|
||||
this.contents_ = [];
|
||||
|
||||
@@ -213,7 +213,7 @@ Blockly.utils.getScrollDeltaPixels = function(e) {
|
||||
* (e.g., '%%').
|
||||
* @param {string} message Text which might contain string table references and
|
||||
* interpolation tokens.
|
||||
* @return {!Array.<string|number>} Array of strings and numbers.
|
||||
* @return {!Array<string|number>} Array of strings and numbers.
|
||||
*/
|
||||
Blockly.utils.tokenizeInterpolation = function(message) {
|
||||
return Blockly.utils.tokenizeInterpolation_(message, true);
|
||||
@@ -270,7 +270,7 @@ Blockly.utils.checkMessageReferences = function(message) {
|
||||
* interpolation tokens.
|
||||
* @param {boolean} parseInterpolationTokens Option to parse numeric
|
||||
* interpolation tokens (%1, %2, ...) when true.
|
||||
* @return {!Array.<string|number>} Array of strings and numbers.
|
||||
* @return {!Array<string|number>} Array of strings and numbers.
|
||||
* @private
|
||||
*/
|
||||
Blockly.utils.tokenizeInterpolation_ = function(message,
|
||||
|
||||
@@ -155,7 +155,7 @@ Blockly.utils.aria.setRole = function(element, roleName) {
|
||||
* @param {!Blockly.utils.aria.State} stateName State attribute being set.
|
||||
* Automatically adds prefix 'aria-' to the state name if the attribute is
|
||||
* not an extra attribute.
|
||||
* @param {string|boolean|number|!Array.<string>} value Value
|
||||
* @param {string|boolean|number|!Array<string>} value Value
|
||||
* for the state attribute.
|
||||
*/
|
||||
Blockly.utils.aria.setState = function(element, stateName, value) {
|
||||
|
||||
@@ -79,7 +79,7 @@ Blockly.utils.colour.rgbToHex = function(r, g, b) {
|
||||
* Converts a colour to RGB.
|
||||
* @param {string} colour String representing colour in any
|
||||
* colour format ('#ff0000', 'red', '0xff000', etc).
|
||||
* @return {!Array.<number>} RGB representation of the colour.
|
||||
* @return {!Array<number>} RGB representation of the colour.
|
||||
*/
|
||||
Blockly.utils.colour.hexToRgb = function(colour) {
|
||||
var hex = Blockly.utils.colour.parse(colour);
|
||||
|
||||
@@ -32,7 +32,7 @@ Blockly.utils.string.startsWith = function(str, prefix) {
|
||||
|
||||
/**
|
||||
* Given an array of strings, return the length of the shortest one.
|
||||
* @param {!Array.<string>} array Array of strings.
|
||||
* @param {!Array<string>} array Array of strings.
|
||||
* @return {number} Length of shortest string.
|
||||
*/
|
||||
Blockly.utils.string.shortestStringLength = function(array) {
|
||||
@@ -47,7 +47,7 @@ Blockly.utils.string.shortestStringLength = function(array) {
|
||||
/**
|
||||
* Given an array of strings, return the length of the common prefix.
|
||||
* Words may not be split. Any space after a word is included in the length.
|
||||
* @param {!Array.<string>} array Array of strings.
|
||||
* @param {!Array<string>} array Array of strings.
|
||||
* @param {number=} opt_shortest Length of shortest string.
|
||||
* @return {number} Length of common prefix.
|
||||
*/
|
||||
@@ -82,7 +82,7 @@ Blockly.utils.string.commonWordPrefix = function(array, opt_shortest) {
|
||||
/**
|
||||
* Given an array of strings, return the length of the common suffix.
|
||||
* Words may not be split. Any space after a word is included in the length.
|
||||
* @param {!Array.<string>} array Array of strings.
|
||||
* @param {!Array<string>} array Array of strings.
|
||||
* @param {number=} opt_shortest Length of shortest string.
|
||||
* @return {number} Length of common suffix.
|
||||
*/
|
||||
@@ -180,8 +180,8 @@ Blockly.utils.string.wrapLine_ = function(text, limit) {
|
||||
|
||||
/**
|
||||
* Compute a score for how good the wrapping is.
|
||||
* @param {!Array.<string>} words Array of each word.
|
||||
* @param {!Array.<boolean>} wordBreaks Array of line breaks.
|
||||
* @param {!Array<string>} words Array of each word.
|
||||
* @param {!Array<boolean>} wordBreaks Array of line breaks.
|
||||
* @param {number} limit Width to wrap each line.
|
||||
* @return {number} Larger the better.
|
||||
* @private
|
||||
@@ -232,10 +232,10 @@ Blockly.utils.string.wrapScore_ = function(words, wordBreaks, limit) {
|
||||
/**
|
||||
* Mutate the array of line break locations until an optimal solution is found.
|
||||
* No line breaks are added or deleted, they are simply moved around.
|
||||
* @param {!Array.<string>} words Array of each word.
|
||||
* @param {!Array.<boolean>} wordBreaks Array of line breaks.
|
||||
* @param {!Array<string>} words Array of each word.
|
||||
* @param {!Array<boolean>} wordBreaks Array of line breaks.
|
||||
* @param {number} limit Width to wrap each line.
|
||||
* @return {!Array.<boolean>} New array of optimal line breaks.
|
||||
* @return {!Array<boolean>} New array of optimal line breaks.
|
||||
* @private
|
||||
*/
|
||||
Blockly.utils.string.wrapMutate_ = function(words, wordBreaks, limit) {
|
||||
@@ -266,8 +266,8 @@ Blockly.utils.string.wrapMutate_ = function(words, wordBreaks, limit) {
|
||||
|
||||
/**
|
||||
* Reassemble the array of words into text, with the specified line breaks.
|
||||
* @param {!Array.<string>} words Array of each word.
|
||||
* @param {!Array.<boolean>} wordBreaks Array of line breaks.
|
||||
* @param {!Array<string>} words Array of each word.
|
||||
* @param {!Array<boolean>} wordBreaks Array of line breaks.
|
||||
* @return {string} Plain text.
|
||||
* @private
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,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 {!Array.<string>} points An array containing all of the points to pass to the
|
||||
* @param {!Array<string>} 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
|
||||
@@ -96,7 +96,7 @@ Blockly.utils.svgPaths.lineTo = function(dx, dy) {
|
||||
* equivalent to a series of 'l' commands.
|
||||
* These coordinates are unitless and hence in the user coordinate system.
|
||||
* See developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands
|
||||
* @param {!Array.<string>} points An array containing all of the points to
|
||||
* @param {!Array<string>} points An array containing all of the points to
|
||||
* draw lines to, in order. The points are represented as strings of the
|
||||
* format ' dx,dy '.
|
||||
* @return {string} A string of the format ' l (dx,dy)+ '
|
||||
|
||||
@@ -38,7 +38,7 @@ Blockly.VariableMap = function(workspace) {
|
||||
* A map from variable type to list of variable names. The lists contain all
|
||||
* of the named variables in the workspace, including variables
|
||||
* that are not currently in use.
|
||||
* @type {!Object.<string, !Array.<Blockly.VariableModel>>}
|
||||
* @type {!Object<string, !Array<Blockly.VariableModel>>}
|
||||
* @private
|
||||
*/
|
||||
this.variableMap_ = Object.create(null);
|
||||
@@ -102,7 +102,7 @@ Blockly.VariableMap.prototype.renameVariableById = function(id, newName) {
|
||||
* The new name must not conflict with any existing variable names.
|
||||
* @param {!Blockly.VariableModel} variable Variable to rename.
|
||||
* @param {string} newName New variable name.
|
||||
* @param {!Array.<!Blockly.Block>} blocks The list of all blocks in the
|
||||
* @param {!Array<!Blockly.Block>} blocks The list of all blocks in the
|
||||
* workspace.
|
||||
* @private
|
||||
*/
|
||||
@@ -125,7 +125,7 @@ Blockly.VariableMap.prototype.renameVariableAndUses_ = function(variable,
|
||||
* @param {string} newName New variable name.
|
||||
* @param {!Blockly.VariableModel} conflictVar The variable that was already
|
||||
* using newName.
|
||||
* @param {!Array.<!Blockly.Block>} blocks The list of all blocks in the
|
||||
* @param {!Array<!Blockly.Block>} blocks The list of all blocks in the
|
||||
* workspace.
|
||||
* @private
|
||||
*/
|
||||
@@ -264,7 +264,7 @@ Blockly.VariableMap.prototype.deleteVariableById = function(id) {
|
||||
* Deletes a variable and all of its uses from this workspace without asking the
|
||||
* user for confirmation.
|
||||
* @param {!Blockly.VariableModel} variable Variable to delete.
|
||||
* @param {!Array.<!Blockly.Block>} uses An array of uses of the variable.
|
||||
* @param {!Array<!Blockly.Block>} uses An array of uses of the variable.
|
||||
* @package
|
||||
*/
|
||||
Blockly.VariableMap.prototype.deleteVariableInternal = function(variable,
|
||||
@@ -317,7 +317,7 @@ Blockly.VariableMap.prototype.getVariable = function(name, opt_type) {
|
||||
*/
|
||||
Blockly.VariableMap.prototype.getVariableById = function(id) {
|
||||
var keys = Object.keys(this.variableMap_);
|
||||
for (var i = 0; i < keys.length; i++ ) {
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
for (var j = 0, variable; (variable = this.variableMap_[key][j]); j++) {
|
||||
if (variable.getId() == id) {
|
||||
@@ -332,7 +332,7 @@ Blockly.VariableMap.prototype.getVariableById = function(id) {
|
||||
* Get a list containing all of the variables of a specified type. If type is
|
||||
* null, return list of variables with empty string type.
|
||||
* @param {?string} type Type of the variables to find.
|
||||
* @return {!Array.<!Blockly.VariableModel>} The sought after variables of the
|
||||
* @return {!Array<!Blockly.VariableModel>} The sought after variables of the
|
||||
* passed in type. An empty array if none are found.
|
||||
*/
|
||||
Blockly.VariableMap.prototype.getVariablesOfType = function(type) {
|
||||
@@ -350,7 +350,7 @@ Blockly.VariableMap.prototype.getVariablesOfType = function(type) {
|
||||
* @param {?Blockly.Workspace} ws The workspace used to look for potential
|
||||
* variables. This can be different than the workspace stored on this object
|
||||
* if the passed in ws is a flyout workspace.
|
||||
* @return {!Array.<string>} List of variable types.
|
||||
* @return {!Array<string>} List of variable types.
|
||||
* @package
|
||||
*/
|
||||
Blockly.VariableMap.prototype.getVariableTypes = function(ws) {
|
||||
@@ -375,7 +375,7 @@ Blockly.VariableMap.prototype.getVariableTypes = function(ws) {
|
||||
|
||||
/**
|
||||
* Return all variables of all types.
|
||||
* @return {!Array.<!Blockly.VariableModel>} List of variable models.
|
||||
* @return {!Array<!Blockly.VariableModel>} List of variable models.
|
||||
*/
|
||||
Blockly.VariableMap.prototype.getAllVariables = function() {
|
||||
var all_variables = [];
|
||||
@@ -387,7 +387,7 @@ Blockly.VariableMap.prototype.getAllVariables = function() {
|
||||
|
||||
/**
|
||||
* Returns all of the variable names of all types.
|
||||
* @return {!Array.<string>} All of the variable names of all types.
|
||||
* @return {!Array<string>} All of the variable names of all types.
|
||||
*/
|
||||
Blockly.VariableMap.prototype.getAllVariableNames = function() {
|
||||
var allNames = [];
|
||||
@@ -403,7 +403,7 @@ Blockly.VariableMap.prototype.getAllVariableNames = function() {
|
||||
/**
|
||||
* Find all the uses of a named variable.
|
||||
* @param {string} id ID of the variable to find.
|
||||
* @return {!Array.<!Blockly.Block>} Array of block usages.
|
||||
* @return {!Array<!Blockly.Block>} Array of block usages.
|
||||
*/
|
||||
Blockly.VariableMap.prototype.getVariableUsesById = function(id) {
|
||||
var uses = [];
|
||||
|
||||
@@ -41,7 +41,7 @@ Blockly.Variables.NAME_TYPE = Blockly.VARIABLE_CATEGORY_NAME;
|
||||
* To get a list of all variables on a workspace, including unused variables,
|
||||
* call Workspace.getAllVariables.
|
||||
* @param {!Blockly.Workspace} ws The workspace to search for variables.
|
||||
* @return {!Array.<!Blockly.VariableModel>} Array of variable models.
|
||||
* @return {!Array<!Blockly.VariableModel>} Array of variable models.
|
||||
*/
|
||||
Blockly.Variables.allUsedVarModels = function(ws) {
|
||||
var blocks = ws.getAllBlocks(false);
|
||||
@@ -81,7 +81,7 @@ Blockly.Variables.ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE_ = {};
|
||||
* your block and return a list of variable names.
|
||||
* For use by generators.
|
||||
* @param {!Blockly.Workspace} workspace The workspace to search.
|
||||
* @return {!Array.<string>} A list of non-duplicated variable names.
|
||||
* @return {!Array<string>} A list of non-duplicated variable names.
|
||||
*/
|
||||
Blockly.Variables.allDeveloperVariables = function(workspace) {
|
||||
var blocks = workspace.getAllBlocks(false);
|
||||
@@ -116,7 +116,7 @@ Blockly.Variables.allDeveloperVariables = function(workspace) {
|
||||
* Construct the elements (blocks and button) required by the flyout for the
|
||||
* variable category.
|
||||
* @param {!Blockly.Workspace} workspace The workspace containing variables.
|
||||
* @return {!Array.<!Element>} Array of XML elements.
|
||||
* @return {!Array<!Element>} Array of XML elements.
|
||||
*/
|
||||
Blockly.Variables.flyoutCategory = function(workspace) {
|
||||
var xmlList = [];
|
||||
@@ -138,7 +138,7 @@ Blockly.Variables.flyoutCategory = function(workspace) {
|
||||
/**
|
||||
* Construct the blocks required by the flyout for the variable category.
|
||||
* @param {!Blockly.Workspace} workspace The workspace containing variables.
|
||||
* @return {!Array.<!Element>} Array of XML block elements.
|
||||
* @return {!Array<!Element>} Array of XML block elements.
|
||||
*/
|
||||
Blockly.Variables.flyoutCategoryBlocks = function(workspace) {
|
||||
var variableModelList = workspace.getVariablesOfType('');
|
||||
@@ -207,7 +207,7 @@ Blockly.Variables.generateUniqueName = function(workspace) {
|
||||
* will try to generate single letter names in the range a -> z (skip l). It
|
||||
* will start with the character passed to startChar.
|
||||
* @param {string} startChar The character to start the search at.
|
||||
* @param {!Array.<string>} usedNames A list of all of the used names.
|
||||
* @param {!Array<string>} usedNames A list of all of the used names.
|
||||
* @return {string} A unique name that is not present in the usedNames array.
|
||||
*/
|
||||
Blockly.Variables.generateUniqueNameFromOptions = function(startChar, usedNames) {
|
||||
@@ -551,9 +551,9 @@ Blockly.Variables.createVariable_ = function(workspace, id, opt_name,
|
||||
* workspace after adding a new block, using the given list of variables that
|
||||
* were in the workspace before the new block was added.
|
||||
* @param {!Blockly.Workspace} workspace The workspace to inspect.
|
||||
* @param {!Array.<!Blockly.VariableModel>} originalVariables The array of
|
||||
* @param {!Array<!Blockly.VariableModel>} originalVariables The array of
|
||||
* variables that existed in the workspace before adding the new block.
|
||||
* @return {!Array.<!Blockly.VariableModel>} The new array of variables that
|
||||
* @return {!Array<!Blockly.VariableModel>} The new array of variables that
|
||||
* were freshly added to the workspace after creating the new block,
|
||||
* or [] if no new variables were added to the workspace.
|
||||
* @package
|
||||
|
||||
@@ -38,7 +38,7 @@ Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour = function(button) {
|
||||
* Construct the elements (blocks and button) required by the flyout for the
|
||||
* variable category.
|
||||
* @param {!Blockly.Workspace} workspace The workspace containing variables.
|
||||
* @return {!Array.<!Element>} Array of XML elements.
|
||||
* @return {!Array<!Element>} Array of XML elements.
|
||||
*/
|
||||
Blockly.VariablesDynamic.flyoutCategory = function(workspace) {
|
||||
var xmlList = [];
|
||||
@@ -71,7 +71,7 @@ Blockly.VariablesDynamic.flyoutCategory = function(workspace) {
|
||||
/**
|
||||
* Construct the blocks required by the flyout for the variable category.
|
||||
* @param {!Blockly.Workspace} workspace The workspace containing variables.
|
||||
* @return {!Array.<!Element>} Array of XML block elements.
|
||||
* @return {!Array<!Element>} Array of XML block elements.
|
||||
*/
|
||||
Blockly.VariablesDynamic.flyoutCategoryBlocks = function(workspace) {
|
||||
var variableModelList = workspace.getAllVariables();
|
||||
|
||||
@@ -60,12 +60,12 @@ Blockly.Workspace = function(opt_options) {
|
||||
this.connectionChecker = new connectionCheckerClass(this);
|
||||
|
||||
/**
|
||||
* @type {!Array.<!Blockly.Block>}
|
||||
* @type {!Array<!Blockly.Block>}
|
||||
* @private
|
||||
*/
|
||||
this.topBlocks_ = [];
|
||||
/**
|
||||
* @type {!Array.<!Blockly.WorkspaceComment>}
|
||||
* @type {!Array<!Blockly.WorkspaceComment>}
|
||||
* @private
|
||||
*/
|
||||
this.topComments_ = [];
|
||||
@@ -75,17 +75,17 @@ Blockly.Workspace = function(opt_options) {
|
||||
*/
|
||||
this.commentDB_ = Object.create(null);
|
||||
/**
|
||||
* @type {!Array.<!Function>}
|
||||
* @type {!Array<!Function>}
|
||||
* @private
|
||||
*/
|
||||
this.listeners_ = [];
|
||||
/**
|
||||
* @type {!Array.<!Blockly.Events.Abstract>}
|
||||
* @type {!Array<!Blockly.Events.Abstract>}
|
||||
* @protected
|
||||
*/
|
||||
this.undoStack_ = [];
|
||||
/**
|
||||
* @type {!Array.<!Blockly.Events.Abstract>}
|
||||
* @type {!Array<!Blockly.Events.Abstract>}
|
||||
* @protected
|
||||
*/
|
||||
this.redoStack_ = [];
|
||||
@@ -144,7 +144,7 @@ Blockly.Workspace.prototype.MAX_UNDO = 1024;
|
||||
|
||||
/**
|
||||
* Set of databases for rapid lookup of connection locations.
|
||||
* @type {Array.<!Blockly.ConnectionDB>}
|
||||
* @type {Array<!Blockly.ConnectionDB>}
|
||||
*/
|
||||
Blockly.Workspace.prototype.connectionDBList = null;
|
||||
|
||||
@@ -208,7 +208,7 @@ Blockly.Workspace.prototype.removeTopBlock = function(block) {
|
||||
* Finds the top-level blocks and returns them. Blocks are optionally sorted
|
||||
* by position; top to bottom (with slight LTR or RTL bias).
|
||||
* @param {boolean} ordered Sort the list if true.
|
||||
* @return {!Array.<!Blockly.Block>} The top-level block objects.
|
||||
* @return {!Array<!Blockly.Block>} The top-level block objects.
|
||||
*/
|
||||
Blockly.Workspace.prototype.getTopBlocks = function(ordered) {
|
||||
// Copy the topBlocks_ list.
|
||||
@@ -252,7 +252,7 @@ Blockly.Workspace.prototype.removeTypedBlock = function(block) {
|
||||
* optionally sorted by position; top to bottom (with slight LTR or RTL bias).
|
||||
* @param {string} type The type of block to search for.
|
||||
* @param {boolean} ordered Sort the list if true.
|
||||
* @return {!Array.<!Blockly.Block>} The blocks of the given type.
|
||||
* @return {!Array<!Blockly.Block>} The blocks of the given type.
|
||||
*/
|
||||
Blockly.Workspace.prototype.getBlocksByType = function(type, ordered) {
|
||||
if (!this.typedBlocksDB_[type]) {
|
||||
@@ -306,7 +306,7 @@ Blockly.Workspace.prototype.removeTopComment = function(comment) {
|
||||
* Finds the top-level comments and returns them. Comments are optionally
|
||||
* sorted by position; top to bottom (with slight LTR or RTL bias).
|
||||
* @param {boolean} ordered Sort the list if true.
|
||||
* @return {!Array.<!Blockly.WorkspaceComment>} The top-level comment objects.
|
||||
* @return {!Array<!Blockly.WorkspaceComment>} The top-level comment objects.
|
||||
* @package
|
||||
*/
|
||||
Blockly.Workspace.prototype.getTopComments = function(ordered) {
|
||||
@@ -327,7 +327,7 @@ Blockly.Workspace.prototype.getTopComments = function(ordered) {
|
||||
* Find all blocks in workspace. Blocks are optionally sorted
|
||||
* by position; top to bottom (with slight LTR or RTL bias).
|
||||
* @param {boolean} ordered Sort the list if true.
|
||||
* @return {!Array.<!Blockly.Block>} Array of blocks.
|
||||
* @return {!Array<!Blockly.Block>} Array of blocks.
|
||||
*/
|
||||
Blockly.Workspace.prototype.getAllBlocks = function(ordered) {
|
||||
if (ordered) {
|
||||
@@ -411,7 +411,7 @@ Blockly.Workspace.prototype.createVariable = function(name, opt_type, opt_id) {
|
||||
/**
|
||||
* Find all the uses of the given variable, which is identified by ID.
|
||||
* @param {string} id ID of the variable to find.
|
||||
* @return {!Array.<!Blockly.Block>} Array of block usages.
|
||||
* @return {!Array<!Blockly.Block>} Array of block usages.
|
||||
*/
|
||||
Blockly.Workspace.prototype.getVariableUsesById = function(id) {
|
||||
return this.variableMap_.getVariableUsesById(id);
|
||||
@@ -453,7 +453,7 @@ Blockly.Workspace.prototype.getVariableById = function(id) {
|
||||
* Find the variable with the specified type. If type is null, return list of
|
||||
* variables with empty string type.
|
||||
* @param {?string} type Type of the variables to find.
|
||||
* @return {!Array.<!Blockly.VariableModel>} The sought after variables of the
|
||||
* @return {!Array<!Blockly.VariableModel>} The sought after variables of the
|
||||
* passed in type. An empty array if none are found.
|
||||
*/
|
||||
Blockly.Workspace.prototype.getVariablesOfType = function(type) {
|
||||
@@ -462,7 +462,7 @@ Blockly.Workspace.prototype.getVariablesOfType = function(type) {
|
||||
|
||||
/**
|
||||
* Return all variable types.
|
||||
* @return {!Array.<string>} List of variable types.
|
||||
* @return {!Array<string>} List of variable types.
|
||||
* @package
|
||||
*/
|
||||
Blockly.Workspace.prototype.getVariableTypes = function() {
|
||||
@@ -471,7 +471,7 @@ Blockly.Workspace.prototype.getVariableTypes = function() {
|
||||
|
||||
/**
|
||||
* Return all variables of all types.
|
||||
* @return {!Array.<!Blockly.VariableModel>} List of variable models.
|
||||
* @return {!Array<!Blockly.VariableModel>} List of variable models.
|
||||
*/
|
||||
Blockly.Workspace.prototype.getAllVariables = function() {
|
||||
return this.variableMap_.getAllVariables();
|
||||
@@ -479,7 +479,7 @@ Blockly.Workspace.prototype.getAllVariables = function() {
|
||||
|
||||
/**
|
||||
* Returns all variable names of all types.
|
||||
* @return {!Array.<string>} List of all variable names of all types.
|
||||
* @return {!Array<string>} List of all variable names of all types.
|
||||
*/
|
||||
Blockly.Workspace.prototype.getAllVariableNames = function() {
|
||||
return this.variableMap_.getAllVariableNames();
|
||||
@@ -577,7 +577,7 @@ Blockly.Workspace.prototype.hasBlockLimits = function() {
|
||||
|
||||
/**
|
||||
* Gets the undo stack for workplace.
|
||||
* @return {!Array.<!Blockly.Events.Abstract>} undo stack
|
||||
* @return {!Array<!Blockly.Events.Abstract>} undo stack
|
||||
* @package
|
||||
*/
|
||||
Blockly.Workspace.prototype.getUndoStack = function() {
|
||||
@@ -586,7 +586,7 @@ Blockly.Workspace.prototype.getUndoStack = function() {
|
||||
|
||||
/**
|
||||
* Gets the redo stack for workplace.
|
||||
* @return {!Array.<!Blockly.Events.Abstract>} redo stack
|
||||
* @return {!Array<!Blockly.Events.Abstract>} redo stack
|
||||
* @package
|
||||
*/
|
||||
Blockly.Workspace.prototype.getRedoStack = function() {
|
||||
@@ -782,7 +782,7 @@ Blockly.Workspace.getById = function(id) {
|
||||
|
||||
/**
|
||||
* Find all workspaces.
|
||||
* @return {!Array.<!Blockly.Workspace>} Array of workspaces.
|
||||
* @return {!Array<!Blockly.Workspace>} Array of workspaces.
|
||||
*/
|
||||
Blockly.Workspace.getAll = function() {
|
||||
var workspaces = [];
|
||||
|
||||
@@ -63,7 +63,7 @@ Blockly.WorkspaceAudio.prototype.dispose = function() {
|
||||
|
||||
/**
|
||||
* Load an audio file. Cache it, ready for instantaneous playing.
|
||||
* @param {!Array.<string>} filenames List of file types in decreasing order of
|
||||
* @param {!Array<string>} filenames List of file types in decreasing order of
|
||||
* preference (i.e. increasing size). E.g. ['media/go.mp3', 'media/go.wav']
|
||||
* Filenames include path from Blockly's root. File extensions matter.
|
||||
* @param {string} name Name of sound.
|
||||
|
||||
@@ -135,7 +135,7 @@ Blockly.WorkspaceSvg = function(
|
||||
/**
|
||||
* List of currently highlighted blocks. Block highlighting is often used to
|
||||
* visually mark blocks currently being executed.
|
||||
* @type {!Array.<!Blockly.BlockSvg>}
|
||||
* @type {!Array<!Blockly.BlockSvg>}
|
||||
* @private
|
||||
*/
|
||||
this.highlightedBlocks_ = [];
|
||||
@@ -166,7 +166,7 @@ Blockly.WorkspaceSvg = function(
|
||||
/**
|
||||
* Map from function names to callbacks, for deciding what to do when a custom
|
||||
* toolbox category is opened.
|
||||
* @type {!Object.<string, ?function(!Blockly.Workspace):!Array.<!Element>>}
|
||||
* @type {!Object<string, ?function(!Blockly.Workspace):!Array<!Element>>}
|
||||
* @private
|
||||
*/
|
||||
this.toolboxCategoryCallbacks_ = {};
|
||||
@@ -174,7 +174,7 @@ Blockly.WorkspaceSvg = function(
|
||||
/**
|
||||
* Map from function names to callbacks, for deciding what to do when a button
|
||||
* is clicked.
|
||||
* @type {!Object.<string, ?function(!Blockly.FlyoutButton)>}
|
||||
* @type {!Object<string, ?function(!Blockly.FlyoutButton)>}
|
||||
* @private
|
||||
*/
|
||||
this.flyoutButtonCallbacks_ = {};
|
||||
@@ -227,7 +227,7 @@ Blockly.WorkspaceSvg = function(
|
||||
|
||||
/**
|
||||
* The list of top-level bounded elements on the workspace.
|
||||
* @type {!Array.<!Blockly.IBoundedElement>}
|
||||
* @type {!Array<!Blockly.IBoundedElement>}
|
||||
* @private
|
||||
*/
|
||||
this.topBoundedElements_ = [];
|
||||
@@ -487,7 +487,7 @@ Blockly.WorkspaceSvg.prototype.lastRecordedPageScroll_ = null;
|
||||
/**
|
||||
* Developers may define this function to add custom menu options to the
|
||||
* workspace's context menu or edit the workspace-created set of menu options.
|
||||
* @param {!Array.<!Object>} options List of menu options to add to.
|
||||
* @param {!Array<!Object>} options List of menu options to add to.
|
||||
* @param {!Event} e The right-click event that triggered the context menu.
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.configureContextMenu;
|
||||
@@ -666,7 +666,7 @@ Blockly.WorkspaceSvg.prototype.refreshTheme = function() {
|
||||
|
||||
/**
|
||||
* Updates all the blocks with new style.
|
||||
* @param {!Array.<!Blockly.Block>} blocks List of blocks to update the style
|
||||
* @param {!Array<!Blockly.Block>} blocks List of blocks to update the style
|
||||
* on.
|
||||
* @private
|
||||
*/
|
||||
@@ -2326,7 +2326,7 @@ Blockly.WorkspaceSvg.prototype.getBlockById = function(id) {
|
||||
* Finds the top-level blocks and returns them. Blocks are optionally sorted
|
||||
* by position; top to bottom (with slight LTR or RTL bias).
|
||||
* @param {boolean} ordered Sort the list if true.
|
||||
* @return {!Array.<!Blockly.BlockSvg>} The top-level block objects.
|
||||
* @return {!Array<!Blockly.BlockSvg>} The top-level block objects.
|
||||
* @override
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.getTopBlocks = function(ordered) {
|
||||
@@ -2389,7 +2389,7 @@ Blockly.WorkspaceSvg.prototype.removeTopBoundedElement = function(element) {
|
||||
|
||||
/**
|
||||
* Finds the top-level bounded elements and returns them.
|
||||
* @return {!Array.<!Blockly.IBoundedElement>} The top-level bounded elements.
|
||||
* @return {!Array<!Blockly.IBoundedElement>} The top-level bounded elements.
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.getTopBoundedElements = function() {
|
||||
return [].concat(this.topBoundedElements_);
|
||||
@@ -2464,7 +2464,7 @@ Blockly.WorkspaceSvg.prototype.removeButtonCallback = function(key) {
|
||||
* custom toolbox categories in this workspace. See the variable and procedure
|
||||
* categories as an example.
|
||||
* @param {string} key The name to use to look up this function.
|
||||
* @param {function(!Blockly.Workspace):!Array.<!Element>} func The function to
|
||||
* @param {function(!Blockly.Workspace):!Array<!Element>} func The function to
|
||||
* call when the given toolbox category is opened.
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.registerToolboxCategoryCallback = function(key,
|
||||
@@ -2479,7 +2479,7 @@ Blockly.WorkspaceSvg.prototype.registerToolboxCategoryCallback = function(key,
|
||||
* Get the callback function associated with a given key, for populating
|
||||
* custom toolbox categories in this workspace.
|
||||
* @param {string} key The name to use to look up the function.
|
||||
* @return {?function(!Blockly.Workspace):!Array.<!Element>} The function
|
||||
* @return {?function(!Blockly.Workspace):!Array<!Element>} The function
|
||||
* corresponding to the given key for this workspace, or null if no function
|
||||
* is registered.
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,7 @@ Blockly.Xml.workspaceToDom = function(workspace, opt_noId) {
|
||||
|
||||
/**
|
||||
* Encode a list of variables as XML.
|
||||
* @param {!Array.<!Blockly.VariableModel>} variableList List of all variable
|
||||
* @param {!Array<!Blockly.VariableModel>} variableList List of all variable
|
||||
* models.
|
||||
* @return {!Element} Tree of XML elements.
|
||||
*/
|
||||
@@ -375,7 +375,7 @@ Blockly.Xml.textToDom = function(text) {
|
||||
* create blocks on the workspace.
|
||||
* @param {!Element} xml XML DOM.
|
||||
* @param {!Blockly.Workspace} workspace The workspace.
|
||||
* @return {Array.<string>} An array containing new block ids.
|
||||
* @return {Array<string>} An array containing new block ids.
|
||||
*/
|
||||
Blockly.Xml.clearWorkspaceAndLoadFromXml = function(xml, workspace) {
|
||||
workspace.setResizesEnabled(false);
|
||||
@@ -389,7 +389,7 @@ Blockly.Xml.clearWorkspaceAndLoadFromXml = function(xml, workspace) {
|
||||
* Decode an XML DOM and create blocks on the workspace.
|
||||
* @param {!Element} xml XML DOM.
|
||||
* @param {!Blockly.Workspace} workspace The workspace.
|
||||
* @return {!Array.<string>} An array containing new block IDs.
|
||||
* @return {!Array<string>} An array containing new block IDs.
|
||||
* @suppress {strictModuleDepCheck} Suppress module check while workspace
|
||||
* comments are not bundled in.
|
||||
*/
|
||||
@@ -489,7 +489,7 @@ Blockly.Xml.domToWorkspace = function(xml, workspace) {
|
||||
* blocks immediately below prior blocks, aligned by their starting edge.
|
||||
* @param {!Element} xml The XML DOM.
|
||||
* @param {!Blockly.Workspace} workspace The workspace to add to.
|
||||
* @return {Array.<string>} An array containing new block IDs.
|
||||
* @return {Array<string>} An array containing new block IDs.
|
||||
*/
|
||||
Blockly.Xml.appendDomToWorkspace = function(xml, workspace) {
|
||||
var bbox; // Bounding box of the current blocks.
|
||||
|
||||
@@ -432,7 +432,7 @@ AppController.prototype.assignExporterChangeListeners = function() {
|
||||
/**
|
||||
* If given checkbox is checked, enable the given elements. Otherwise, disable.
|
||||
* @param {boolean} enabled True if enabled, false otherwise.
|
||||
* @param {!Array.<string>} idArray Array of element IDs to enable when
|
||||
* @param {!Array<string>} idArray Array of element IDs to enable when
|
||||
* checkbox is checked.
|
||||
*/
|
||||
AppController.prototype.ifCheckedEnable = function(enabled, idArray) {
|
||||
|
||||
@@ -49,7 +49,7 @@ BlockDefinitionExtractor.buildBlockFactoryWorkspace = function(block) {
|
||||
* inner text.
|
||||
*
|
||||
* @param {string} name New element tag name.
|
||||
* @param {!Object.<string, string>=} opt_attrs Optional list of attributes.
|
||||
* @param {!Object<string, string>=} opt_attrs Optional list of attributes.
|
||||
* @param {string=} opt_text Optional inner text.
|
||||
* @return {!Element} The newly created element.
|
||||
* @private
|
||||
@@ -112,7 +112,7 @@ BlockDefinitionExtractor.buildTypeConstraintBlockForConnection_ =
|
||||
} else if (connection.check_.length === 1) {
|
||||
typeBlock = BlockDefinitionExtractor.buildBlockForType_(
|
||||
connection.check_[0]);
|
||||
} else if (connection.check_.length > 1 ) {
|
||||
} else if (connection.check_.length > 1) {
|
||||
typeBlock = BlockDefinitionExtractor.typeGroup_(connection.check_);
|
||||
}
|
||||
} else {
|
||||
@@ -323,7 +323,7 @@ BlockDefinitionExtractor.input_ = function(input, align) {
|
||||
|
||||
/**
|
||||
* Constructs a sequence <block> elements representing the field definition.
|
||||
* @param {Array.<Blockly.Field>} fieldRow A list of fields in a Blockly.Input.
|
||||
* @param {Array<Blockly.Field>} fieldRow A list of fields in a Blockly.Input.
|
||||
* @return {Element} The fist <block> element of the sequence
|
||||
* (and the root of the constructed DOM).
|
||||
* @private
|
||||
@@ -600,7 +600,7 @@ BlockDefinitionExtractor.buildFieldImage_ =
|
||||
/**
|
||||
* Creates a <block> element a group of allowed connection constraint types.
|
||||
*
|
||||
* @param {Array.<string>} types List of type names in this group.
|
||||
* @param {Array<string>} types List of type names in this group.
|
||||
* @return {Element} The <block> element representing the group, with child
|
||||
* types attached.
|
||||
* @private
|
||||
|
||||
@@ -253,7 +253,7 @@ BlockExporterController.prototype.selectUsedBlocks = function() {
|
||||
|
||||
/**
|
||||
* Set the array that holds the block types used in workspace factory.
|
||||
* @param {!Array.<string>} usedBlockTypes Block types used in
|
||||
* @param {!Array<string>} usedBlockTypes Block types used in
|
||||
*/
|
||||
BlockExporterController.prototype.setUsedBlockTypes =
|
||||
function(usedBlockTypes) {
|
||||
|
||||
@@ -70,7 +70,7 @@ BlockExporterView.prototype.deselectAllBlocks = function() {
|
||||
/**
|
||||
* Given an array of selected blocks, selects these blocks in the view, marking
|
||||
* the checkboxes accordingly.
|
||||
* @param {Array.<Blockly.Block>} blockTypes Array of block types to select.
|
||||
* @param {Array<Blockly.Block>} blockTypes Array of block types to select.
|
||||
*/
|
||||
BlockExporterView.prototype.setSelectedBlockTypes = function(blockTypes) {
|
||||
for (var i = 0, blockType; blockType = blockTypes[i]; i++) {
|
||||
@@ -80,7 +80,7 @@ BlockExporterView.prototype.setSelectedBlockTypes = function(blockTypes) {
|
||||
|
||||
/**
|
||||
* Returns array of selected blocks.
|
||||
* @return {!Array.<string>} Array of all selected block types.
|
||||
* @return {!Array<string>} Array of all selected block types.
|
||||
*/
|
||||
BlockExporterView.prototype.getSelectedBlockTypes = function() {
|
||||
var selectedTypes = [];
|
||||
|
||||
@@ -212,7 +212,7 @@ BlockLibraryController.prototype.hasEmptyBlockLibrary = function() {
|
||||
|
||||
/**
|
||||
* Get all block types stored in block library.
|
||||
* @return {!Array.<string>} Array of block types.
|
||||
* @return {!Array<string>} Array of block types.
|
||||
*/
|
||||
BlockLibraryController.prototype.getStoredBlockTypes = function() {
|
||||
return this.storage.getBlockTypes();
|
||||
|
||||
@@ -100,7 +100,7 @@ BlockLibraryStorage.prototype.getBlockXml = function(blockType) {
|
||||
/**
|
||||
* Returns map of each block type to its corresponding XML stored in current
|
||||
* block library (this.blocks).
|
||||
* @param {!Array.<string>} blockTypes Types of blocks.
|
||||
* @param {!Array<string>} blockTypes Types of blocks.
|
||||
* @return {!Object} Map of block type to corresponding XML.
|
||||
*/
|
||||
BlockLibraryStorage.prototype.getBlockXmlMap = function(blockTypes) {
|
||||
@@ -115,7 +115,7 @@ BlockLibraryStorage.prototype.getBlockXmlMap = function(blockTypes) {
|
||||
|
||||
/**
|
||||
* Returns array of all block types stored in current block library.
|
||||
* @return {!Array.<string>} Array of block types stored in library.
|
||||
* @return {!Array<string>} Array of block types stored in library.
|
||||
*/
|
||||
BlockLibraryStorage.prototype.getBlockTypes = function() {
|
||||
return Object.keys(this.blocks);
|
||||
@@ -134,7 +134,7 @@ BlockLibraryStorage.prototype.isEmpty = function() {
|
||||
|
||||
/**
|
||||
* Returns array of all block types stored in current block library.
|
||||
* @return {!Array.<string>} Map of block type to corresponding XML text.
|
||||
* @return {!Array<string>} Map of block type to corresponding XML text.
|
||||
*/
|
||||
BlockLibraryStorage.prototype.getBlockXmlTextMap = function() {
|
||||
return this.blocks;
|
||||
|
||||
@@ -377,7 +377,7 @@ FactoryUtils.connectionLineJs_ = function(functionName, typeName, workspace) {
|
||||
/**
|
||||
* Returns field strings and any config.
|
||||
* @param {!Blockly.Block} block Input block.
|
||||
* @return {!Array.<string>} Field strings.
|
||||
* @return {!Array<string>} Field strings.
|
||||
* @private
|
||||
*/
|
||||
FactoryUtils.getFieldsJs_ = function(block) {
|
||||
@@ -484,7 +484,7 @@ FactoryUtils.getFieldsJs_ = function(block) {
|
||||
/**
|
||||
* Returns field strings and any config.
|
||||
* @param {!Blockly.Block} block Input block.
|
||||
* @return {!Array.<string|!Object>} Array of static text and field configs.
|
||||
* @return {!Array<string|!Object>} Array of static text and field configs.
|
||||
* @private
|
||||
*/
|
||||
FactoryUtils.getFieldsJson_ = function(block) {
|
||||
@@ -614,7 +614,7 @@ FactoryUtils.getOptTypesFrom = function(block, name) {
|
||||
* Fetch the type(s) defined in the given input.
|
||||
* @param {!Blockly.Block} block Block with input.
|
||||
* @param {string} name Name of the input.
|
||||
* @return {!Array.<string>} List of types.
|
||||
* @return {!Array<string>} List of types.
|
||||
* @private
|
||||
*/
|
||||
FactoryUtils.getTypesFrom_ = function(block, name) {
|
||||
@@ -745,7 +745,7 @@ FactoryUtils.getBlockTypeFromJsDefinition = function(blockDef) {
|
||||
|
||||
/**
|
||||
* Generates a category containing blocks of the specified block types.
|
||||
* @param {!Array.<!Blockly.Block>} blocks Blocks to include in the category.
|
||||
* @param {!Array<!Blockly.Block>} blocks Blocks to include in the category.
|
||||
* @param {string} categoryName Name to use for the generated category.
|
||||
* @return {!Element} Category XML containing the given block types.
|
||||
*/
|
||||
@@ -771,7 +771,7 @@ FactoryUtils.generateCategoryXml = function(blocks, categoryName) {
|
||||
* Parses a string containing JavaScript block definition(s) to create an array
|
||||
* in which each element is a single block definition.
|
||||
* @param {string} blockDefsString JavaScript block definition(s).
|
||||
* @return {!Array.<string>} Array of block definitions.
|
||||
* @return {!Array<string>} Array of block definitions.
|
||||
*/
|
||||
FactoryUtils.parseJsBlockDefinitions = function(blockDefsString) {
|
||||
var blockDefArray = [];
|
||||
@@ -797,7 +797,7 @@ FactoryUtils.parseJsBlockDefinitions = function(blockDefsString) {
|
||||
* JSON objects.
|
||||
* @param {string} blockDefsString String containing JSON block
|
||||
* definition(s).
|
||||
* @return {!Array.<string>} Array of block definitions.
|
||||
* @return {!Array<string>} Array of block definitions.
|
||||
*/
|
||||
FactoryUtils.parseJsonBlockDefinitions = function(blockDefsString) {
|
||||
var blockDefArray = [];
|
||||
@@ -827,7 +827,7 @@ FactoryUtils.parseJsonBlockDefinitions = function(blockDefsString) {
|
||||
* Define blocks from imported block definitions.
|
||||
* @param {string} blockDefsString Block definition(s).
|
||||
* @param {string} format Block definition format ('JSON' or 'JavaScript').
|
||||
* @return {!Array.<!Element>} Array of block types defined.
|
||||
* @return {!Array<!Element>} Array of block types defined.
|
||||
*/
|
||||
FactoryUtils.defineAndGetBlockTypes = function(blockDefsString, format) {
|
||||
var blockTypes = [];
|
||||
|
||||
@@ -1251,7 +1251,7 @@ WorkspaceFactoryController.prototype.importBlocks = function(file, format) {
|
||||
/**
|
||||
* Updates the block library category in the toolbox workspace toolbox.
|
||||
* @param {!Element} categoryXml XML for the block library category.
|
||||
* @param {!Array.<string>} libBlockTypes Array of block types from the block
|
||||
* @param {!Array<string>} libBlockTypes Array of block types from the block
|
||||
* library.
|
||||
*/
|
||||
WorkspaceFactoryController.prototype.setBlockLibCategory =
|
||||
@@ -1278,7 +1278,7 @@ WorkspaceFactoryController.prototype.setBlockLibCategory =
|
||||
|
||||
/**
|
||||
* Return the block types used in the custom toolbox and pre-loaded workspace.
|
||||
* @return {!Array.<string>} Block types used in the custom toolbox and
|
||||
* @return {!Array<string>} Block types used in the custom toolbox and
|
||||
* pre-loaded workspace.
|
||||
*/
|
||||
WorkspaceFactoryController.prototype.getAllUsedBlockTypes = function() {
|
||||
|
||||
@@ -212,8 +212,8 @@ WorkspaceFactoryGenerator.prototype.setShadowBlocksInHiddenWorkspace_ =
|
||||
/**
|
||||
* Given a set of block types, gets the Blockly.Block objects for each block
|
||||
* type.
|
||||
* @param {!Array.<!Element>} blockTypes Array of blocks that have been defined.
|
||||
* @return {!Array.<!Blockly.Block>} Array of Blockly.Block objects corresponding
|
||||
* @param {!Array<!Element>} blockTypes Array of blocks that have been defined.
|
||||
* @return {!Array<!Blockly.Block>} Array of Blockly.Block objects corresponding
|
||||
* to the array of blockTypes.
|
||||
*/
|
||||
WorkspaceFactoryGenerator.prototype.getDefinedBlocks = function(blockTypes) {
|
||||
|
||||
@@ -246,7 +246,7 @@ WorkspaceFactoryModel.prototype.getSelectedXml = function() {
|
||||
|
||||
/**
|
||||
* Return ordered list of ListElement objects.
|
||||
* @return {!Array.<!ListElement>} ordered list of ListElement objects
|
||||
* @return {!Array<!ListElement>} ordered list of ListElement objects
|
||||
*/
|
||||
WorkspaceFactoryModel.prototype.getToolboxList = function() {
|
||||
return this.toolboxList;
|
||||
@@ -383,7 +383,7 @@ WorkspaceFactoryModel.prototype.setOptions = function(options) {
|
||||
* Returns an array of all the block types currently being used in the toolbox
|
||||
* and the pre-loaded blocks. No duplicates.
|
||||
* TODO(evd2014): Move pushBlockTypesToList to FactoryUtils.
|
||||
* @return {!Array.<string>} Array of block types currently being used.
|
||||
* @return {!Array<string>} Array of block types currently being used.
|
||||
*/
|
||||
WorkspaceFactoryModel.prototype.getAllUsedBlockTypes = function() {
|
||||
var blockTypeList = [];
|
||||
@@ -424,7 +424,7 @@ WorkspaceFactoryModel.prototype.getAllUsedBlockTypes = function() {
|
||||
|
||||
/**
|
||||
* Adds new imported block types to the list of current imported block types.
|
||||
* @param {!Array.<string>} blockTypes Array of block types imported.
|
||||
* @param {!Array<string>} blockTypes Array of block types imported.
|
||||
*/
|
||||
WorkspaceFactoryModel.prototype.addImportedBlockTypes = function(blockTypes) {
|
||||
this.importedBlockTypes = this.importedBlockTypes.concat(blockTypes);
|
||||
@@ -432,7 +432,7 @@ WorkspaceFactoryModel.prototype.addImportedBlockTypes = function(blockTypes) {
|
||||
|
||||
/**
|
||||
* Updates block types in block library.
|
||||
* @param {!Array.<string>} blockTypes Array of block types in block library.
|
||||
* @param {!Array<string>} blockTypes Array of block types in block library.
|
||||
*/
|
||||
WorkspaceFactoryModel.prototype.updateLibBlockTypes = function(blockTypes) {
|
||||
this.libBlockTypes = blockTypes;
|
||||
@@ -454,7 +454,7 @@ WorkspaceFactoryModel.prototype.isDefinedBlockType = function(blockType) {
|
||||
|
||||
/**
|
||||
* Checks if any of the block types are already defined.
|
||||
* @param {!Array.<string>} blockTypes Array of block types.
|
||||
* @param {!Array<string>} blockTypes Array of block types.
|
||||
* @return {boolean} True if a block type in the array is already defined,
|
||||
* false if none of the blocks are already defined.
|
||||
*/
|
||||
|
||||
@@ -294,7 +294,7 @@ WorkspaceFactoryView.prototype.clearToolboxTabs = function() {
|
||||
* Given a set of blocks currently loaded user-generated shadow blocks, visually
|
||||
* marks them without making them actual shadow blocks (allowing them to still
|
||||
* be editable and movable).
|
||||
* @param {!Array.<!Blockly.Block>} blocks Array of user-generated shadow blocks
|
||||
* @param {!Array<!Blockly.Block>} blocks Array of user-generated shadow blocks
|
||||
* currently loaded.
|
||||
*/
|
||||
WorkspaceFactoryView.prototype.markShadowBlocks = function(blocks) {
|
||||
|
||||
@@ -278,7 +278,7 @@ function connectionLineJs_(functionName, typeName) {
|
||||
/**
|
||||
* Returns field strings and any config.
|
||||
* @param {!Blockly.Block} block Input block.
|
||||
* @return {!Array.<string>} Field strings.
|
||||
* @return {!Array<string>} Field strings.
|
||||
* @private
|
||||
*/
|
||||
function getFieldsJs_(block) {
|
||||
@@ -374,7 +374,7 @@ function getFieldsJs_(block) {
|
||||
/**
|
||||
* Returns field strings and any config.
|
||||
* @param {!Blockly.Block} block Input block.
|
||||
* @return {!Array.<string|!Object>} Array of static text and field configs.
|
||||
* @return {!Array<string|!Object>} Array of static text and field configs.
|
||||
* @private
|
||||
*/
|
||||
function getFieldsJson_(block) {
|
||||
@@ -504,7 +504,7 @@ function getOptTypesFrom(block, name) {
|
||||
* Fetch the type(s) defined in the given input.
|
||||
* @param {!Blockly.Block} block Block with input.
|
||||
* @param {string} name Name of the input.
|
||||
* @return {!Array.<string>} List of types.
|
||||
* @return {!Array<string>} List of types.
|
||||
* @private
|
||||
*/
|
||||
function getTypesFrom_(block, name) {
|
||||
|
||||
@@ -298,7 +298,7 @@ Graph.drawVisualization = function() {
|
||||
/**
|
||||
* Plot points on the function y = f(x).
|
||||
* @param {string} code JavaScript code.
|
||||
* @return {!Array.<!Array>} 2D Array of points on the graph.
|
||||
* @return {!Array<!Array>} 2D Array of points on the graph.
|
||||
*/
|
||||
Graph.plot = function(code) {
|
||||
// Initialize a table with two column headings.
|
||||
|
||||
@@ -613,7 +613,7 @@ goog.string.StringBuffer.prototype.append = function(a1, opt_a2, var_args) {
|
||||
// directly to avoid arguments instantiation, another 2x improvement.
|
||||
this.buffer_[this.bufferLength_++] = a1;
|
||||
} else {
|
||||
var arr = /**@type {Array.<number|string|boolean>}*/(this.buffer_);
|
||||
var arr = /**@type {Array<number|string|boolean>}*/(this.buffer_);
|
||||
arr.push.apply(arr, arguments);
|
||||
this.bufferLength_ = this.buffer_.length;
|
||||
}
|
||||
@@ -1656,7 +1656,7 @@ soy.$$checkMapKey = function(key) {
|
||||
/**
|
||||
* Gets the keys in a map as an array. There are no guarantees on the order.
|
||||
* @param {Object} map The map to get the keys of.
|
||||
* @return {Array.<string>} The array of keys in the given map.
|
||||
* @return {Array<string>} The array of keys in the given map.
|
||||
*/
|
||||
soy.$$getMapKeys = function(map) {
|
||||
var mapKeys = [];
|
||||
@@ -1779,9 +1779,9 @@ soy.$$getDelegateFn = function(
|
||||
* Private helper soy.$$getDelegateFn(). This is the empty template function
|
||||
* that is returned whenever there's no delegate implementation found.
|
||||
*
|
||||
* @param {Object.<string, *>=} opt_data
|
||||
* @param {Object<string, *>=} opt_data
|
||||
* @param {soy.StringBuilder=} opt_sb
|
||||
* @param {Object.<string, *>=} opt_ijData
|
||||
* @param {Object<string, *>=} opt_ijData
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
@@ -2052,7 +2052,7 @@ soy.$$HTML5_VOID_ELEMENTS_ = new RegExp(
|
||||
*
|
||||
* @param {*} value The HTML to be escaped. May not be a string, but the
|
||||
* value will be coerced to a string.
|
||||
* @param {Object.<string, number>=} opt_tagAllowlist Has an own property whose
|
||||
* @param {Object<string, number>=} opt_tagAllowlist Has an own property whose
|
||||
* name is a lower-case tag name and whose value is {@code 1} for
|
||||
* each element that is allowed in the output.
|
||||
* @return {string} A representation of value without disallowed tags,
|
||||
@@ -2118,7 +2118,7 @@ soy.$$stripHtmlTags = function(value, opt_tagAllowlist) {
|
||||
* If {@code <table>} is used for formatting, embedded HTML shouldn't be able
|
||||
* to use a mismatched {@code </table>} to break page layout.
|
||||
*
|
||||
* @param {Array.<string>} tags an array of tags that will be modified in place
|
||||
* @param {Array<string>} tags an array of tags that will be modified in place
|
||||
* include tags, the empty string, or concatenations of empty tags.
|
||||
* @return {string} zero or more closed tags that close all elements that are
|
||||
* opened in tags but not closed.
|
||||
@@ -2575,7 +2575,7 @@ soy.$$isLowSurrogate_ = function(ch) {
|
||||
/**
|
||||
* Cache of bidi formatter by context directionality, so we don't keep on
|
||||
* creating new objects.
|
||||
* @type {!Object.<!goog.i18n.BidiFormatter>}
|
||||
* @type {!Object<!goog.i18n.BidiFormatter>}
|
||||
* @private
|
||||
*/
|
||||
soy.$$bidiFormatterCache_ = {};
|
||||
@@ -2799,7 +2799,7 @@ soy.esc.$$escapeUriHelper = function(v) {
|
||||
|
||||
/**
|
||||
* Maps characters to the escaped versions for the named escape directives.
|
||||
* @type {Object.<string, string>}
|
||||
* @type {Object<string, string>}
|
||||
* @private
|
||||
*/
|
||||
soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSPACE__AND__NORMALIZE_HTML_NOSPACE_ = {
|
||||
@@ -2837,7 +2837,7 @@ soy.esc.$$REPLACER_FOR_ESCAPE_HTML__AND__NORMALIZE_HTML__AND__ESCAPE_HTML_NOSPAC
|
||||
|
||||
/**
|
||||
* Maps characters to the escaped versions for the named escape directives.
|
||||
* @type {Object.<string, string>}
|
||||
* @type {Object<string, string>}
|
||||
* @private
|
||||
*/
|
||||
soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_JS_STRING__AND__ESCAPE_JS_REGEX_ = {
|
||||
@@ -2889,7 +2889,7 @@ soy.esc.$$REPLACER_FOR_ESCAPE_JS_STRING__AND__ESCAPE_JS_REGEX_ = function(ch) {
|
||||
|
||||
/**
|
||||
* Maps characters to the escaped versions for the named escape directives.
|
||||
* @type {Object.<string, string>}
|
||||
* @type {Object<string, string>}
|
||||
* @private
|
||||
*/
|
||||
soy.esc.$$ESCAPE_MAP_FOR_ESCAPE_CSS_STRING_ = {
|
||||
@@ -2934,7 +2934,7 @@ soy.esc.$$REPLACER_FOR_ESCAPE_CSS_STRING_ = function(ch) {
|
||||
|
||||
/**
|
||||
* Maps characters to the escaped versions for the named escape directives.
|
||||
* @type {Object.<string, string>}
|
||||
* @type {Object<string, string>}
|
||||
* @private
|
||||
*/
|
||||
soy.esc.$$ESCAPE_MAP_FOR_NORMALIZE_URI__AND__FILTER_NORMALIZE_URI_ = {
|
||||
@@ -3291,7 +3291,7 @@ soy.esc.$$LT_REGEX_ = /</g;
|
||||
/**
|
||||
* Maps lower-case names of innocuous tags to 1.
|
||||
*
|
||||
* @type {Object.<string,number>}
|
||||
* @type {Object<string,number>}
|
||||
* @private
|
||||
*/
|
||||
soy.esc.$$SAFE_TAG_ALLOWLIST_ = {'b': 1, 'br': 1, 'em': 1, 'i': 1, 's': 1, 'sub': 1, 'sup': 1, 'u': 1};
|
||||
|
||||
@@ -85,7 +85,7 @@ Blockly.JavaScript.ORDER_NONE = 99; // (...)
|
||||
|
||||
/**
|
||||
* List of outer-inner pairings that do NOT require parentheses.
|
||||
* @type {!Array.<!Array.<number>>}
|
||||
* @type {!Array<!Array<number>>}
|
||||
*/
|
||||
Blockly.JavaScript.ORDER_OVERRIDES = [
|
||||
// (foo()).bar -> foo().bar
|
||||
|
||||
@@ -97,7 +97,7 @@ Blockly.PHP.ORDER_NONE = 99; // (...)
|
||||
|
||||
/**
|
||||
* List of outer-inner pairings that do NOT require parentheses.
|
||||
* @type {!Array.<!Array.<number>>}
|
||||
* @type {!Array<!Array<number>>}
|
||||
*/
|
||||
Blockly.PHP.ORDER_OVERRIDES = [
|
||||
// (foo()).bar() -> foo().bar()
|
||||
|
||||
@@ -101,7 +101,7 @@ Blockly.Python.ORDER_NONE = 99; // (...)
|
||||
|
||||
/**
|
||||
* List of outer-inner pairings that do NOT require parentheses.
|
||||
* @type {!Array.<!Array.<number>>}
|
||||
* @type {!Array<!Array<number>>}
|
||||
*/
|
||||
Blockly.Python.ORDER_OVERRIDES = [
|
||||
// (foo()).bar -> foo().bar
|
||||
@@ -138,19 +138,16 @@ Blockly.Python.isInitialized = false;
|
||||
* @this {Blockly.Generator}
|
||||
*/
|
||||
Blockly.Python.init = function(workspace) {
|
||||
// Call Blockly.Generator's init.
|
||||
Object.getPrototypeOf(this).init.call(this);
|
||||
|
||||
/**
|
||||
* Empty loops or conditionals are not allowed in Python.
|
||||
*/
|
||||
Blockly.Python.PASS = this.INDENT + 'pass\n';
|
||||
// Create a dictionary of definitions to be printed before the code.
|
||||
Blockly.Python.definitions_ = Object.create(null);
|
||||
// Create a dictionary mapping desired function names in definitions_
|
||||
// to actual function names (to avoid collisions with user functions).
|
||||
Blockly.Python.functionNames_ = Object.create(null);
|
||||
|
||||
if (!Blockly.Python.nameDB_) {
|
||||
Blockly.Python.nameDB_ =
|
||||
new Blockly.Names(Blockly.Python.RESERVED_WORDS_);
|
||||
Blockly.Python.nameDB_ = new Blockly.Names(Blockly.Python.RESERVED_WORDS_);
|
||||
} else {
|
||||
Blockly.Python.nameDB_.reset();
|
||||
}
|
||||
@@ -193,9 +190,10 @@ Blockly.Python.finish = function(code) {
|
||||
definitions.push(def);
|
||||
}
|
||||
}
|
||||
// Clean up temporary data.
|
||||
delete Blockly.Python.definitions_;
|
||||
delete Blockly.Python.functionNames_;
|
||||
// Call Blockly.Generator's finish.
|
||||
code = Object.getPrototypeOf(this).finish.call(this, code);
|
||||
this.isInitialized = false;
|
||||
|
||||
Blockly.Python.nameDB_.reset();
|
||||
var allDefs = imports.join('\n') + '\n\n' + definitions.join('\n\n');
|
||||
return allDefs.replace(/\n\n+/g, '\n\n').replace(/\n*$/, '\n\n\n') + code;
|
||||
|
||||
@@ -33,7 +33,7 @@ Blockly.Python['controls_if'] = function(block) {
|
||||
Blockly.Python.injectId(Blockly.Python.STATEMENT_SUFFIX, block),
|
||||
Blockly.Python.INDENT) + branchCode;
|
||||
}
|
||||
code += (n == 0 ? 'if ' : 'elif ' ) + conditionCode + ':\n' + branchCode;
|
||||
code += (n == 0 ? 'if ' : 'elif ') + conditionCode + ':\n' + branchCode;
|
||||
++n;
|
||||
} while (block.getInput('IF' + n));
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ function compile(compilerOptions, opt_verbose, opt_warnings_as_error,
|
||||
|
||||
/**
|
||||
* Helper method for possibly adding the Closure library into a sources array.
|
||||
* @param {Array.<string>} srcs
|
||||
* @param {Array<string>} srcs
|
||||
*/
|
||||
function maybeAddClosureLibrary(srcs) {
|
||||
if (argv.closureLibrary) {
|
||||
@@ -155,7 +155,7 @@ function maybeAddClosureLibrary(srcs) {
|
||||
* A helper method to return an closure compiler output wrapper that wraps the
|
||||
* body in a Universal Module Definition.
|
||||
* @param {string} namespace The export namespace.
|
||||
* @param {Array.<Object>} dependencies An array of dependencies to inject.
|
||||
* @param {Array<Object>} dependencies An array of dependencies to inject.
|
||||
*/
|
||||
function outputWrapperUMD(namespace, dependencies) {
|
||||
const amdDeps = dependencies.map(d => '\'' + d.amd + '\'' ).join(', ');
|
||||
|
||||
@@ -28,7 +28,7 @@ const packageDistribution = 'dist';
|
||||
/**
|
||||
* A helper method for wrapping a file into a Universal Module Definition.
|
||||
* @param {string} namespace The export namespace.
|
||||
* @param {Array.<Object>} dependencies An array of dependencies to inject.
|
||||
* @param {Array<Object>} dependencies An array of dependencies to inject.
|
||||
*/
|
||||
function packageUMD(namespace, dependencies) {
|
||||
return gulp.umd({
|
||||
@@ -42,7 +42,7 @@ function packageUMD(namespace, dependencies) {
|
||||
/**
|
||||
* A helper method for wrapping a file into a CommonJS module for Node.js.
|
||||
* @param {string} namespace The export namespace.
|
||||
* @param {Array.<Object>} dependencies An array of dependencies to inject.
|
||||
* @param {Array<Object>} dependencies An array of dependencies to inject.
|
||||
*/
|
||||
function packageCommonJS(namespace, dependencies) {
|
||||
return gulp.umd({
|
||||
|
||||
Reference in New Issue
Block a user