From cff7b359f4fa5f0e1d69168d687e3f654fd320f3 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Tue, 8 Jun 2021 15:41:08 -0700 Subject: [PATCH] Make comments more consistent. --- core/block.js | 10 +++++----- core/connection.js | 17 ++++++++--------- core/css.js | 18 +++++++++--------- core/dropdowndiv.js | 10 +++++----- core/events/events.js | 2 +- core/field_dropdown.js | 4 ++-- core/field_multilineinput.js | 4 ++-- core/field_textinput.js | 2 +- core/field_variable.js | 4 ++-- core/inject.js | 2 +- core/insertion_marker_manager.js | 2 +- core/mutator.js | 4 ++-- core/renderers/common/constants.js | 6 +++--- core/renderers/common/drawer.js | 4 ++-- core/renderers/geras/drawer.js | 2 +- core/renderers/zelos/constants.js | 30 +++++++++++++++--------------- core/theme/highcontrast.js | 4 ++-- core/toolbox/toolbox.js | 6 +++--- core/utils/toolbox.js | 2 +- core/workspace_svg.js | 6 +++--- core/xml.js | 8 ++++---- generators/python/procedures.js | 4 ++-- 22 files changed, 75 insertions(+), 76 deletions(-) diff --git a/core/block.js b/core/block.js index d081bc889..0fb157886 100644 --- a/core/block.js +++ b/core/block.js @@ -509,7 +509,7 @@ Blockly.Block.prototype.getOnlyValueConnection_ = function() { thisConnection.type == Blockly.connectionTypes.INPUT_VALUE && thisConnection.targetConnection) { if (connection) { - return null; // More than one value input found. + return null; // More than one value input found. } connection = thisConnection; } @@ -1700,7 +1700,7 @@ Blockly.Block.prototype.validateTokens_ = function(tokens, argsCount) { }; /** - * Inserts args in place of numerical tokens. String args are converted to json + * Inserts args in place of numerical tokens. String args are converted to JSON * that defines a label field. If necessary an extra dummy input is added to * the end of the elements. * @param {!Array} tokens The tokens to interpolate @@ -1742,9 +1742,9 @@ Blockly.Block.prototype.interpolateArguments_ = }; /** - * Creates a field from the json definition of a field. If a field with the + * Creates a field from the JSON definition of a field. If a field with the * given type cannot be found, this attempts to create a different field using - * the 'alt' property of the json definition (if it exists). + * the 'alt' property of the JSON definition (if it exists). * @param {{alt:(string|undefined)}} element The element to try to turn into a * field. * @return {?Blockly.Field} The field defined by the JSON, or null if one @@ -1764,7 +1764,7 @@ Blockly.Block.prototype.fieldFromJson_ = function(element) { }; /** - * Creates an input from the json definition of an input. Sets the input's check + * Creates an input from the JSON definition of an input. Sets the input's check * and alignment if they are provided. * @param {!Object} element The JSON to turn into an input. * @param {string} warningPrefix The prefix to add to warnings to help the diff --git a/core/connection.js b/core/connection.js index cf6ced592..c9415dd05 100644 --- a/core/connection.js +++ b/core/connection.js @@ -493,8 +493,7 @@ Blockly.Connection.prototype.respawnShadow_ = function() { var parentBlock = this.getSourceBlock(); var shadow = this.getShadowDom(); if (parentBlock.workspace && shadow) { - var blockShadow = - Blockly.Xml.domToBlock(shadow, parentBlock.workspace); + var blockShadow = Blockly.Xml.domToBlock(shadow, parentBlock.workspace); if (blockShadow.outputConnection) { this.connect(blockShadow.outputConnection); } else if (blockShadow.previousConnection) { @@ -646,11 +645,10 @@ Blockly.Connection.prototype.neighbours = function(_maxLimit) { */ Blockly.Connection.prototype.getParentInput = function() { var parentInput = null; - var block = this.sourceBlock_; - var inputs = block.inputList; - for (var idx = 0; idx < block.inputList.length; idx++) { - if (inputs[idx].connection === this) { - parentInput = inputs[idx]; + var inputs = this.sourceBlock_.inputList; + for (var i = 0; i < inputs.length; i++) { + if (inputs[i].connection === this) { + parentInput = inputs[i]; break; } } @@ -663,11 +661,12 @@ Blockly.Connection.prototype.getParentInput = function() { * @return {string} The description. */ Blockly.Connection.prototype.toString = function() { - var msg; var block = this.sourceBlock_; if (!block) { return 'Orphan Connection'; - } else if (block.outputConnection == this) { + } + var msg; + if (block.outputConnection == this) { msg = 'Output Connection of '; } else if (block.previousConnection == this) { msg = 'Previous Connection of '; diff --git a/core/css.js b/core/css.js index c33c2aed7..9f6037d7b 100644 --- a/core/css.js +++ b/core/css.js @@ -88,13 +88,13 @@ Blockly.Css.CONTENT = [ '.blocklyWidgetDiv {', 'display: none;', 'position: absolute;', - 'z-index: 99999;', /* big value for bootstrap3 compatibility */ + 'z-index: 99999;', /* big value for bootstrap3 compatibility */ '}', '.injectionDiv {', 'height: 100%;', 'position: relative;', - 'overflow: hidden;', /* So blocks in drag surface disappear at edges */ + 'overflow: hidden;', /* So blocks in drag surface disappear at edges */ 'touch-action: none;', '}', @@ -125,7 +125,7 @@ Blockly.Css.CONTENT = [ 'right: 0;', 'bottom: 0;', 'overflow: visible !important;', - 'z-index: 50;', /* Display below toolbox, but above everything else. */ + 'z-index: 50;', /* Display below toolbox, but above everything else. */ '}', '.blocklyBlockCanvas.blocklyCanvasTransitioning,', @@ -143,7 +143,7 @@ Blockly.Css.CONTENT = [ 'opacity: .9;', 'padding: 2px;', 'position: absolute;', - 'z-index: 100000;', /* big value for bootstrap3 compatibility */ + 'z-index: 100000;', /* big value for bootstrap3 compatibility */ '}', '.blocklyDropDownDiv {', @@ -165,7 +165,7 @@ Blockly.Css.CONTENT = [ '}', '.blocklyDropDownContent {', - 'max-height: 300px;', // @todo: spec for maximum height. + 'max-height: 300px;', // @todo: spec for maximum height. 'overflow: auto;', 'overflow-x: hidden;', 'position: relative;', @@ -498,11 +498,11 @@ Blockly.Css.CONTENT = [ '}', '.blocklyDropDownDiv .blocklyMenu {', - 'background: inherit;', /* Compatibility with gapi, reset from goog-menu */ - 'border: inherit;', /* Compatibility with gapi, reset from goog-menu */ + 'background: inherit;', /* Compatibility with gapi, reset from goog-menu */ + 'border: inherit;', /* Compatibility with gapi, reset from goog-menu */ 'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;', 'outline: none;', - 'position: relative;', /* Compatibility with gapi, reset from goog-menu */ + 'position: relative;', /* Compatibility with gapi, reset from goog-menu */ 'z-index: 20000;', /* Arbitrary, but some apps depend on it... */ '}', @@ -541,7 +541,7 @@ Blockly.Css.CONTENT = [ 'background: url(<<>>/sprites.png) no-repeat -48px -16px;', 'float: left;', 'margin-left: -24px;', - 'position: static;', /* Scroll with the menu. */ + 'position: static;', /* Scroll with the menu. */ '}', '.blocklyMenuItemRtl .blocklyMenuItemCheckbox {', diff --git a/core/dropdowndiv.js b/core/dropdowndiv.js index d7d383cbc..68698371e 100644 --- a/core/dropdowndiv.js +++ b/core/dropdowndiv.js @@ -493,7 +493,7 @@ Blockly.DropDownDiv.getPositionBelowMetrics_ = function( return { initialX: xCoords.divX, initialY : primaryY, - finalX: xCoords.divX, // X position remains constant during animation. + finalX: xCoords.divX, // X position remains constant during animation. finalY: finalY, arrowX: xCoords.arrowX, arrowY: arrowY, @@ -525,12 +525,12 @@ Blockly.DropDownDiv.getPositionAboveMetrics_ = function( var arrowY = divSize.height - (Blockly.DropDownDiv.BORDER_SIZE * 2) - (Blockly.DropDownDiv.ARROW_SIZE / 2); var finalY = secondaryY - divSize.height - Blockly.DropDownDiv.PADDING_Y; - var initialY = secondaryY - divSize.height; // No padding on Y + var initialY = secondaryY - divSize.height; // No padding on Y. return { initialX: xCoords.divX, initialY : initialY, - finalX: xCoords.divX, // X position remains constant during animation. + finalX: xCoords.divX, // X position remains constant during animation. finalY: finalY, arrowX: xCoords.arrowX, arrowY: arrowY, @@ -560,8 +560,8 @@ Blockly.DropDownDiv.getPositionTopOfPageMetrics_ = function( return { initialX: xCoords.divX, initialY : 0, - finalX: xCoords.divX, // X position remains constant during animation. - finalY: 0, // Y position remains constant during animation. + finalX: xCoords.divX, // X position remains constant during animation. + finalY: 0, // Y position remains constant during animation. arrowAtTop: null, arrowX: null, arrowY: null, diff --git a/core/events/events.js b/core/events/events.js index 975ed6300..982e84577 100644 --- a/core/events/events.js +++ b/core/events/events.js @@ -281,7 +281,7 @@ Blockly.Events.filter = function(queueIn, forward) { // Merge duplicates. for (var i = 0, event; (event = queue[i]); i++) { if (!event.isNull()) { - // Treat all ui events as the same type in hash table. + // Treat all UI events as the same type in hash table. var eventType = event.isUiEvent ? Blockly.Events.UI : event.type; var key = [eventType, event.blockId, event.workspaceId].join(' '); diff --git a/core/field_dropdown.js b/core/field_dropdown.js index b376be75b..89f6bb1e1 100644 --- a/core/field_dropdown.js +++ b/core/field_dropdown.js @@ -337,8 +337,8 @@ Blockly.FieldDropdown.prototype.dropdownCreate_ = function() { var options = this.getOptions(false); this.selectedMenuItem_ = null; for (var i = 0; i < options.length; i++) { - var content = options[i][0]; // Human-readable text or image. - var value = options[i][1]; // Language-neutral value. + var content = options[i][0]; // Human-readable text or image. + var value = options[i][1]; // Language-neutral value. if (typeof content == 'object') { // An image, not text. var image = new Image(content['width'], content['height']); diff --git a/core/field_multilineinput.js b/core/field_multilineinput.js index 2306925e5..c6260e4fd 100644 --- a/core/field_multilineinput.js +++ b/core/field_multilineinput.js @@ -100,8 +100,8 @@ Blockly.FieldMultilineInput.fromJson = function(options) { * @package */ Blockly.FieldMultilineInput.prototype.toXml = function(fieldElement) { - // Replace '\n' characters with html-escaped equivalent ' '. This is - // needed so the plain-text representation of the xml produced by + // Replace '\n' characters with HTML-escaped equivalent ' '. This is + // needed so the plain-text representation of the XML produced by // `Blockly.Xml.domToText` will appear on a single line (this is a limitation // of the plain-text format). fieldElement.textContent = this.getValue().replace(/\n/g, ' '); diff --git a/core/field_textinput.js b/core/field_textinput.js index 24d98d745..bd97f5fcb 100644 --- a/core/field_textinput.js +++ b/core/field_textinput.js @@ -547,7 +547,7 @@ Blockly.FieldTextInput.prototype.isTabNavigable = function() { */ Blockly.FieldTextInput.prototype.getText_ = function() { if (this.isBeingEdited_ && this.htmlInput_) { - // We are currently editing, return the html input value instead. + // We are currently editing, return the HTML input value instead. return this.htmlInput_.value; } return null; diff --git a/core/field_variable.js b/core/field_variable.js index 069113dfd..efdf08bfa 100644 --- a/core/field_variable.js +++ b/core/field_variable.js @@ -129,7 +129,7 @@ Blockly.FieldVariable.prototype.configure_ = function(config) { */ Blockly.FieldVariable.prototype.initModel = function() { if (this.variable_) { - return; // Initialization already happened. + return; // Initialization already happened. } var variable = Blockly.Variables.getOrCreateVariablePackage( this.sourceBlock_.workspace, null, @@ -300,7 +300,7 @@ Blockly.FieldVariable.prototype.doValueUpdate_ = function(newId) { Blockly.FieldVariable.prototype.typeIsAllowed_ = function(type) { var typeList = this.getVariableTypes_(); if (!typeList) { - return true; // If it's null, all types are valid. + return true; // If it's null, all types are valid. } for (var i = 0; i < typeList.length; i++) { if (type == typeList[i]) { diff --git a/core/inject.js b/core/inject.js index 298f52f6b..662939141 100644 --- a/core/inject.js +++ b/core/inject.js @@ -166,7 +166,7 @@ Blockly.createMainWorkspace_ = function(svg, options, blockDragSurface, mainWorkspace.getTheme().getClassName()); if (!wsOptions.hasCategories && wsOptions.languageTree) { - // Add flyout as an that is a sibling of the workspace svg. + // Add flyout as an that is a sibling of the workspace SVG. var flyout = mainWorkspace.addFlyout(Blockly.utils.Svg.SVG); Blockly.utils.dom.insertAfter(flyout, svg); } diff --git a/core/insertion_marker_manager.js b/core/insertion_marker_manager.js index 1a758dbcb..a6a427d12 100644 --- a/core/insertion_marker_manager.js +++ b/core/insertion_marker_manager.js @@ -384,7 +384,7 @@ Blockly.InsertionMarkerManager.prototype.shouldUpdatePreviews_ = function( } else { console.error('Only one of localConnection_ and closestConnection_ was set.'); } - } else { // No connection found. + } else { // No connection found. // Only need to update if we were showing a preview before. return !!(this.localConnection_ && this.closestConnection_); } diff --git a/core/mutator.js b/core/mutator.js index ecfb434b7..52135bf83 100644 --- a/core/mutator.js +++ b/core/mutator.js @@ -196,9 +196,9 @@ Blockly.Mutator.prototype.createEditor_ = function() { this.workspace_.addChangeListener(Blockly.Events.disableOrphans); // Mutator flyouts go inside the mutator workspace's rather than in - // a top level svg. Instead of handling scale themselves, mutators + // a top level SVG. Instead of handling scale themselves, mutators // inherit scale from the parent workspace. - // To fix this, scale needs to be applied at a different level in the dom. + // To fix this, scale needs to be applied at a different level in the DOM. var flyoutSvg = hasFlyout ? this.workspace_.addFlyout(Blockly.utils.Svg.G) : null; var background = this.workspace_.createDom('blocklyMutatorBackground'); diff --git a/core/renderers/common/constants.js b/core/renderers/common/constants.js index f9b0596c5..a21ef85aa 100644 --- a/core/renderers/common/constants.js +++ b/core/renderers/common/constants.js @@ -261,14 +261,14 @@ Blockly.blockRendering.ConstantProvider = function() { * to be the height of the text based on the font used. * @type {number} */ - this.FIELD_TEXT_HEIGHT = -1; // Dynamically set + this.FIELD_TEXT_HEIGHT = -1; // Dynamically set. /** * Text baseline. This constant is dynamically set in ``setFontConstants_`` * to be the baseline of the text based on the font used. * @type {number} */ - this.FIELD_TEXT_BASELINE = -1; // Dynamically set + this.FIELD_TEXT_BASELINE = -1; // Dynamically set. /** * A field's border rect corner radius. @@ -855,7 +855,7 @@ Blockly.blockRendering.ConstantProvider.prototype.makePuzzleTab = function() { var halfHeight = height / 2; var control1Y = halfHeight + overlap; var control2Y = halfHeight + 0.5; - var control3Y = overlap; // 2.5 + var control3Y = overlap; // 2.5 var endPoint1 = Blockly.utils.svgPaths.point(-width, forward * halfHeight); var endPoint2 = Blockly.utils.svgPaths.point(width, forward * halfHeight); diff --git a/core/renderers/common/drawer.js b/core/renderers/common/drawer.js index d82e48a93..f91b97d7a 100644 --- a/core/renderers/common/drawer.js +++ b/core/renderers/common/drawer.js @@ -227,7 +227,7 @@ Blockly.blockRendering.Drawer.prototype.drawRightSideRow_ = function(row) { /** * Add steps for the bottom edge of a block, possibly including a notch - * for the next connection + * for the next connection. * @protected */ Blockly.blockRendering.Drawer.prototype.drawBottom_ = function() { @@ -449,7 +449,7 @@ Blockly.blockRendering.Drawer.prototype.positionNextConnection_ = function() { if (bottomRow.connection) { var connInfo = bottomRow.connection; - var x = connInfo.xPos; // Already contains info about startX + var x = connInfo.xPos; // Already contains info about startX. var connX = (this.info_.RTL ? -x : x); connInfo.connectionModel.setOffsetInBlock(connX, bottomRow.baseline); } diff --git a/core/renderers/geras/drawer.js b/core/renderers/geras/drawer.js index 25870f9cb..360d123ce 100644 --- a/core/renderers/geras/drawer.js +++ b/core/renderers/geras/drawer.js @@ -197,7 +197,7 @@ Blockly.geras.Drawer.prototype.positionNextConnection_ = function() { if (bottomRow.connection) { var connInfo = bottomRow.connection; - var x = connInfo.xPos; // Already contains info about startX + var x = connInfo.xPos; // Already contains info about startX. var connX = (this.info_.RTL ? -x : x) + (this.constants_.DARK_PATH_OFFSET / 2); connInfo.connectionModel.setOffsetInBlock( diff --git a/core/renderers/zelos/constants.js b/core/renderers/zelos/constants.js index 5c629d99e..bb039250a 100644 --- a/core/renderers/zelos/constants.js +++ b/core/renderers/zelos/constants.js @@ -214,23 +214,23 @@ Blockly.zelos.ConstantProvider = function() { * @package */ this.SHAPE_IN_SHAPE_PADDING = { - 1: { // Outer shape: hexagon. - 0: 5 * this.GRID_UNIT, // Field in hexagon. - 1: 2 * this.GRID_UNIT, // Hexagon in hexagon. - 2: 5 * this.GRID_UNIT, // Round in hexagon. - 3: 5 * this.GRID_UNIT // Square in hexagon. + 1: { // Outer shape: hexagon. + 0: 5 * this.GRID_UNIT, // Field in hexagon. + 1: 2 * this.GRID_UNIT, // Hexagon in hexagon. + 2: 5 * this.GRID_UNIT, // Round in hexagon. + 3: 5 * this.GRID_UNIT // Square in hexagon. }, - 2: { // Outer shape: round. - 0: 3 * this.GRID_UNIT, // Field in round. - 1: 3 * this.GRID_UNIT, // Hexagon in round. - 2: 1 * this.GRID_UNIT, // Round in round. - 3: 2 * this.GRID_UNIT // Square in round. + 2: { // Outer shape: round. + 0: 3 * this.GRID_UNIT, // Field in round. + 1: 3 * this.GRID_UNIT, // Hexagon in round. + 2: 1 * this.GRID_UNIT, // Round in round. + 3: 2 * this.GRID_UNIT // Square in round. }, - 3: { // Outer shape: square. - 0: 2 * this.GRID_UNIT, // Field in square. - 1: 2 * this.GRID_UNIT, // Hexagon in square. - 2: 2 * this.GRID_UNIT, // Round in square. - 3: 2 * this.GRID_UNIT // Square in square. + 3: { // Outer shape: square. + 0: 2 * this.GRID_UNIT, // Field in square. + 1: 2 * this.GRID_UNIT, // Hexagon in square. + 2: 2 * this.GRID_UNIT, // Round in square. + 3: 2 * this.GRID_UNIT // Square in square. } }; diff --git a/core/theme/highcontrast.js b/core/theme/highcontrast.js index bd1084354..b38077474 100644 --- a/core/theme/highcontrast.js +++ b/core/theme/highcontrast.js @@ -113,7 +113,7 @@ Blockly.Themes.HighContrast.setComponentStyle('selectedGlowSize', 1); Blockly.Themes.HighContrast.setComponentStyle('replacementGlowColour', '#000000'); Blockly.Themes.HighContrast.setFontStyle({ - 'family': null, // Use default font-family - 'weight': null, // Use default font-weight + 'family': null, // Use default font-family. + 'weight': null, // Use default font-weight. 'size': 16 }); diff --git a/core/toolbox/toolbox.js b/core/toolbox/toolbox.js index debd34013..b64d07b50 100644 --- a/core/toolbox/toolbox.js +++ b/core/toolbox/toolbox.js @@ -406,7 +406,7 @@ Blockly.Toolbox.prototype.render = function(toolboxDef) { */ Blockly.Toolbox.prototype.renderContents_ = function(toolboxDef) { // This is for performance reasons. By using document fragment we only have to - // add to the dom once. + // add to the DOM once. var fragment = document.createDocumentFragment(); for (var i = 0, toolboxItemDef; (toolboxItemDef = toolboxDef[i]); i++) { this.createToolboxItem_(toolboxItemDef, fragment); @@ -426,7 +426,7 @@ Blockly.Toolbox.prototype.createToolboxItem_ = function(toolboxItemDef, fragment var registryName = toolboxItemDef['kind']; // Categories that are collapsible are created using a class registered under - // a diffferent name. + // a different name. if (registryName.toUpperCase() == 'CATEGORY' && Blockly.utils.toolbox.isCategoryCollapsible( /** @type {!Blockly.utils.toolbox.CategoryInfo} */(toolboxItemDef))) { @@ -443,7 +443,7 @@ Blockly.Toolbox.prototype.createToolboxItem_ = function(toolboxItemDef, fragment if (toolboxItemDom) { fragment.appendChild(toolboxItemDom); } - // Adds the id to the html element that can receive a click. + // Adds the ID to the HTML element that can receive a click. // This is used in onClick_ to find the toolboxItem that was clicked. if (toolboxItem.getClickTarget) { toolboxItem.getClickTarget().setAttribute('id', toolboxItem.getId()); diff --git a/core/utils/toolbox.js b/core/utils/toolbox.js index 1e745c0fa..c4a1375bb 100644 --- a/core/utils/toolbox.js +++ b/core/utils/toolbox.js @@ -345,7 +345,7 @@ Blockly.utils.toolbox.xmlToJsonArray_ = function(toolboxDef) { var tagName = child.tagName.toUpperCase(); obj['kind'] = tagName; - // Store the xml for a block + // Store the XML for a block. if (tagName == 'BLOCK') { obj['blockxml'] = child; } else if (child.childNodes && child.childNodes.length > 0) { diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 6797926c8..9365b8c5a 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -1787,7 +1787,7 @@ Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function(e) { // This is needed as for some browser/system combinations which do not // set deltaX. x = this.scrollX - scrollDelta.y; - y = this.scrollY; // Don't scroll vertically + y = this.scrollY; // Don't scroll vertically. } this.scroll(x, y); } @@ -2213,8 +2213,8 @@ Blockly.WorkspaceSvg.prototype.setScale = function(newScale) { this.scrollX -= metrics.absoluteLeft; this.scrollY -= metrics.absoluteTop; - // // The scroll values and the view values are additive inverses of - // // each other, so when we subtract from one we have to add to the other. + // The scroll values and the view values are additive inverses of + // each other, so when we subtract from one we have to add to the other. metrics.viewLeft += metrics.absoluteLeft; metrics.viewTop += metrics.absoluteTop; diff --git a/core/xml.js b/core/xml.js index 0c2fa2054..4140d6528 100644 --- a/core/xml.js +++ b/core/xml.js @@ -166,7 +166,7 @@ Blockly.Xml.blockToDom = function(block, opt_noId) { element.setAttribute('type', block.type); if (!opt_noId) { // It's important to use setAttribute here otherwise IE11 won't serialize - // the block's id when domToText is called. + // the block's ID when domToText is called. element.setAttribute('id', block.id); } if (block.mutationToDom) { @@ -637,7 +637,7 @@ Blockly.Xml.domToVariables = function(xmlVariables, workspace) { Blockly.Xml.childNodeTagMap; /** - * Creates a mapping of childNodes for each supported xml tag for the provided + * Creates a mapping of childNodes for each supported XML tag for the provided * xmlBlock. Logs a warning for any encountered unsupported tags. * @param {!Element} xmlBlock XML block element. * @return {!Blockly.Xml.childNodeTagMap} The childNode map from nodeName to @@ -765,8 +765,8 @@ Blockly.Xml.applyFieldTagNodes_ = function(xmlChildren, block) { }; /** - * Finds any enclosed blocks or shadows within this xml node. - * @param {!Element} xmlNode The xml node to extract child block info from. + * Finds any enclosed blocks or shadows within this XML node. + * @param {!Element} xmlNode The XML node to extract child block info from. * @return {{childBlockElement: ?Element, childShadowElement: ?Element}} Any * found child block. * @private diff --git a/generators/python/procedures.js b/generators/python/procedures.js index d5f46a8ac..9840dc5ac 100644 --- a/generators/python/procedures.js +++ b/generators/python/procedures.js @@ -22,8 +22,8 @@ Blockly.Python['procedures_defreturn'] = function(block) { var globals = []; var workspace = block.workspace; var variables = Blockly.Variables.allUsedVarModels(workspace) || []; - for (var i = 0, variable; variable = variables[i]; i++) { - varName = variable.name; + for (var i = 0, variable; (variable = variables[i]); i++) { + var varName = variable.name; if (block.getVars().indexOf(varName) == -1) { globals.push(Blockly.Python.nameDB_.getName(varName, Blockly.VARIABLE_CATEGORY_NAME));