From 664cc3d6cd7493131720710691f9c891c528abeb Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Thu, 17 Oct 2019 11:47:30 -0500 Subject: [PATCH] Fix warnings related to number of arguments passed. (#3270) --- blocks/procedures.js | 2 +- core/block_svg.js | 4 ++-- core/blockly.js | 3 ++- core/connection.js | 4 ++-- core/generator.js | 6 ++++-- core/insertion_marker_manager.js | 2 +- core/variable_map.js | 2 +- core/workspace.js | 6 +++--- 8 files changed, 16 insertions(+), 13 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 761e4877d..4b6e44975 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -942,7 +942,7 @@ Blockly.Blocks['procedures_callnoreturn'] = { var def = Blockly.Procedures.getDefinition(name, this.workspace); if (!def) { Blockly.Events.setGroup(event.group); - this.dispose(true, false); + this.dispose(true); Blockly.Events.setGroup(false); } } else if (event.type == Blockly.Events.CHANGE && event.element == 'disabled') { diff --git a/core/block_svg.js b/core/block_svg.js index 81bbbffde..c9859f334 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -577,7 +577,7 @@ Blockly.BlockSvg.prototype.snapToGrid = function() { * @return {!Blockly.utils.Rect} Object with coordinates of the bounding box. */ Blockly.BlockSvg.prototype.getBoundingRectangle = function() { - var blockXY = this.getRelativeToSurfaceXY(this); + var blockXY = this.getRelativeToSurfaceXY(); var tab = this.outputConnection ? Blockly.BlockSvg.TAB_WIDTH : 0; var blockBounds = this.getHeightWidth(); var top = blockXY.y; @@ -1513,7 +1513,7 @@ Blockly.BlockSvg.prototype.appendInput_ = function(type, name) { */ Blockly.BlockSvg.prototype.waitToTrackConnections = function() { this.callTrackConnections_ = false; - var children = this.getChildren(); + var children = this.getChildren(false); for (var i = 0, child; child = children[i]; i++) { child.waitToTrackConnections(); } diff --git a/core/blockly.js b/core/blockly.js index 856ef4b62..e37078bb5 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -269,7 +269,8 @@ Blockly.onKeyDown = function(e) { if (deleteBlock && !Blockly.selected.workspace.isFlyout) { Blockly.Events.setGroup(true); Blockly.hideChaff(); - Blockly.selected.dispose(/* heal */ true, true); + var selected = /** @type {!Blockly.BlockSvg} */ (Blockly.selected); + selected.dispose(/* heal */ true, true); Blockly.Events.setGroup(false); } }; diff --git a/core/connection.js b/core/connection.js index 8a2e87086..c8a4d2879 100644 --- a/core/connection.js +++ b/core/connection.js @@ -121,7 +121,7 @@ Blockly.Connection.prototype.connect_ = function(childConnection) { if (orphanBlock.isShadow()) { // Save the shadow block so that field values are preserved. shadowDom = Blockly.Xml.blockToDom(orphanBlock); - orphanBlock.dispose(); + orphanBlock.dispose(false); orphanBlock = null; } else if (parentConnection.type == Blockly.INPUT_VALUE) { // Value connections. @@ -212,7 +212,7 @@ Blockly.Connection.prototype.dispose = function() { var targetBlock = this.targetBlock(); if (targetBlock.isShadow()) { // Destroy the attached shadow block & its children. - targetBlock.dispose(); + targetBlock.dispose(false); } else { // Disconnect the attached normal block. targetBlock.unplug(); diff --git a/core/generator.js b/core/generator.js index fee9478b6..7ae832e1e 100644 --- a/core/generator.js +++ b/core/generator.js @@ -431,10 +431,12 @@ Blockly.Generator.prototype.init = function(_workspace) { * value blocks. * @param {!Blockly.Block} _block The current block. * @param {string} code The code created for this block. + * @param {boolean=} _opt_thisOnly True to generate code for only this + * statement. * @return {string} Code with comments and subsequent blocks added. - * @private + * @protected */ -Blockly.Generator.prototype.scrub_ = function(_block, code) { +Blockly.Generator.prototype.scrub_ = function(_block, code, _opt_thisOnly) { // Optionally override return code; }; diff --git a/core/insertion_marker_manager.js b/core/insertion_marker_manager.js index c936aed43..3e9c234f0 100644 --- a/core/insertion_marker_manager.js +++ b/core/insertion_marker_manager.js @@ -247,7 +247,7 @@ Blockly.InsertionMarkerManager.prototype.createMarkerBlock_ = function(sourceBlo Blockly.Events.disable(); try { var result = this.workspace_.newBlock(imType); - result.setInsertionMarker(true, sourceBlock.width); + result.setInsertionMarker(true); result.setCollapsed(sourceBlock.isCollapsed()); if (sourceBlock.mutationToDom) { var oldMutationDom = sourceBlock.mutationToDom(); diff --git a/core/variable_map.js b/core/variable_map.js index 3e13d67d2..76fefb438 100644 --- a/core/variable_map.js +++ b/core/variable_map.js @@ -276,7 +276,7 @@ Blockly.VariableMap.prototype.deleteVariableInternal_ = function(variable, } try { for (var i = 0; i < uses.length; i++) { - uses[i].dispose(true, false); + uses[i].dispose(true); } this.deleteVariable(variable); } finally { diff --git a/core/workspace.js b/core/workspace.js index 32cbbdd00..8cecaea90 100644 --- a/core/workspace.js +++ b/core/workspace.js @@ -479,10 +479,10 @@ Blockly.Workspace.prototype.clear = function() { Blockly.Events.setGroup(true); } while (this.topBlocks_.length) { - this.topBlocks_[0].dispose(); + this.topBlocks_[0].dispose(false); } while (this.topComments_.length) { - this.topComments_[this.topComments_.length - 1].dispose(); + this.topComments_[this.topComments_.length - 1].dispose(false); } if (!existingGroup) { Blockly.Events.setGroup(false); @@ -665,7 +665,7 @@ Blockly.Workspace.prototype.remainingCapacityOfType = function(type) { return Infinity; } return (this.options.maxInstances[type] || Infinity) - - this.getBlocksByType(type).length; + this.getBlocksByType(type, false).length; }; /**