Resolve remaining compiler warnings with visibility issues (#3335)

This commit is contained in:
Sam El-Husseini
2019-10-24 19:13:51 -04:00
committed by GitHub
parent bfe62f98ca
commit d387841db2
9 changed files with 36 additions and 17 deletions

View File

@@ -63,7 +63,7 @@ Blockly.Block = function(workspace, prototypeName, opt_id) {
/** @type {string} */
this.id = (opt_id && !workspace.getBlockById(opt_id)) ?
opt_id : Blockly.utils.genUid();
workspace.blockDB_[this.id] = this;
workspace.setBlockById(this.id, this);
/** @type {Blockly.Connection} */
this.outputConnection = null;
/** @type {Blockly.Connection} */
@@ -343,7 +343,7 @@ Blockly.Block.prototype.dispose = function(healStack) {
this.workspace.removeTopBlock(this);
this.workspace.removeTypedBlock(this);
// Remove from block database.
delete this.workspace.blockDB_[this.id];
this.workspace.removeBlockById(this.id);
this.workspace = null;
}

View File

@@ -178,7 +178,7 @@ Blockly.BlockDragger.prototype.startBlockDrag = function(currentDragDeltaXY,
// For future consideration: we may be able to put moveToDragSurface inside
// the block dragger, which would also let the block not track the block drag
// surface.
this.draggingBlock_.moveToDragSurface_();
this.draggingBlock_.moveToDragSurface();
var toolbox = this.workspace_.getToolbox();
if (toolbox) {

View File

@@ -485,9 +485,9 @@ Blockly.BlockSvg.prototype.translate = function(x, y) {
* Move this block to its workspace's drag surface, accounting for positioning.
* Generally should be called at the same time as setDragging_(true).
* Does nothing if useDragSurface_ is false.
* @private
* @package
*/
Blockly.BlockSvg.prototype.moveToDragSurface_ = function() {
Blockly.BlockSvg.prototype.moveToDragSurface = function() {
if (!this.useDragSurface_) {
return;
}
@@ -757,9 +757,9 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) {
/**
* Load the block's help page in a new window.
* @private
* @package
*/
Blockly.BlockSvg.prototype.showHelp_ = function() {
Blockly.BlockSvg.prototype.showHelp = function() {
var url = (typeof this.helpUrl == 'function') ? this.helpUrl() : this.helpUrl;
if (url) {
window.open(url);

View File

@@ -303,9 +303,9 @@ Blockly.copy_ = function(toCopy) {
* Duplicate this block and its children, or a workspace comment.
* @param {!Blockly.Block | !Blockly.WorkspaceComment} toDuplicate Block or
* Workspace Comment to be copied.
* @private
* @package
*/
Blockly.duplicate_ = function(toDuplicate) {
Blockly.duplicate = function(toDuplicate) {
// Save the clipboard.
var clipboardXml = Blockly.clipboardXml_;
var clipboardSource = Blockly.clipboardSource_;

View File

@@ -243,7 +243,7 @@ Blockly.ContextMenu.blockHelpOption = function(block) {
enabled: !!url,
text: Blockly.Msg['HELP'],
callback: function() {
block.showHelp_();
block.showHelp();
}
};
return helpOption;
@@ -261,7 +261,7 @@ Blockly.ContextMenu.blockDuplicateOption = function(block) {
text: Blockly.Msg['DUPLICATE_BLOCK'],
enabled: enabled,
callback: function() {
Blockly.duplicate_(block);
Blockly.duplicate(block);
}
};
return duplicateOption;
@@ -330,7 +330,7 @@ Blockly.ContextMenu.commentDuplicateOption = function(comment) {
text: Blockly.Msg.DUPLICATE_COMMENT,
enabled: true,
callback: function() {
Blockly.duplicate_(comment);
Blockly.duplicate(comment);
}
};
return duplicateOption;

View File

@@ -509,7 +509,7 @@ Blockly.Gesture.prototype.doStart = function(e) {
if ((e.type.toLowerCase() == 'touchstart' ||
e.type.toLowerCase() == 'pointerdown') &&
e.pointerType != 'mouse') {
Blockly.longStart_(e, this);
Blockly.longStart(e, this);
}
this.mouseDownXY_ = new Blockly.utils.Coordinate(e.clientX, e.clientY);

View File

@@ -92,9 +92,9 @@ Blockly.longPid_ = 0;
* if the touch event terminates early.
* @param {!Event} e Touch start event.
* @param {Blockly.Gesture} gesture The gesture that triggered this longStart.
* @private
* @package
*/
Blockly.longStart_ = function(e, gesture) {
Blockly.longStart = function(e, gesture) {
Blockly.longStop_();
// Punt on multitouch events.
if (e.changedTouches && e.changedTouches.length != 1) {

View File

@@ -793,6 +793,25 @@ Blockly.Workspace.prototype.getBlockById = function(id) {
return this.blockDB_[id] || null;
};
/**
* Set a block on this workspace with the specified ID.
* @param {string} id ID of block to set.
* @param {Blockly.Block} block The block to set.
* @package
*/
Blockly.Workspace.prototype.setBlockById = function(id, block) {
this.blockDB_[id] = block;
};
/**
* Delete a block off this workspace with the specified ID.
* @param {string} id ID of block to delete.
* @package
*/
Blockly.Workspace.prototype.removeBlockById = function(id) {
delete this.blockDB_[id];
};
/**
* Find the comment on this workspace with the specified ID.
* @param {string} id ID of comment to find.

View File

@@ -343,9 +343,9 @@ Blockly.WorkspaceCommentSvg.prototype.translate = function(x, y) {
* Move this comment to its workspace's drag surface, accounting for
* positioning. Generally should be called at the same time as
* setDragging(true). Does nothing if useDragSurface_ is false.
* @private
* @package
*/
Blockly.WorkspaceCommentSvg.prototype.moveToDragSurface_ = function() {
Blockly.WorkspaceCommentSvg.prototype.moveToDragSurface = function() {
if (!this.useDragSurface_) {
return;
}