mirror of
https://github.com/google/blockly.git
synced 2026-01-31 04:30:11 +01:00
Fix warnings for code used by blocks (#3362)
This commit is contained in:
@@ -279,6 +279,20 @@ Blockly.Block.prototype.colourTertiary_ = null;
|
||||
*/
|
||||
Blockly.Block.prototype.styleName_ = null;
|
||||
|
||||
/**
|
||||
* An optional method called during initialization.
|
||||
* @type {?function()}
|
||||
*/
|
||||
Blockly.Block.prototype.init;
|
||||
|
||||
/**
|
||||
* An optional callback method to use whenever the block's parent workspace
|
||||
* changes. This is usually only called from the constructor, the block type
|
||||
* initializer function, or an extension initializer function.
|
||||
* @type {?function(Blockly.Events.Abstract)}
|
||||
*/
|
||||
Blockly.Block.prototype.onchange;
|
||||
|
||||
/**
|
||||
* An optional serialization method for defining how to serialize the
|
||||
* mutation state. This must be coupled with defining `domToMutation`.
|
||||
|
||||
@@ -238,6 +238,12 @@ Blockly.BlockSvg.prototype.decompose;
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.compose;
|
||||
|
||||
/**
|
||||
* An optional method for defining custom block context menu items.
|
||||
* @type {?function(!Array.<!Object>)}
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.customContextMenu;
|
||||
|
||||
/**
|
||||
* An property used internally to reference the block's rendering debugger.
|
||||
* @type {?Blockly.blockRendering.Debug}
|
||||
|
||||
@@ -606,7 +606,6 @@ Blockly.Connection.prototype.targetBlock = function() {
|
||||
* value type system. E.g. square_root("Hello") is not compatible.
|
||||
* @param {!Blockly.Connection} otherConnection Connection to compare against.
|
||||
* @return {boolean} True if the connections share a type.
|
||||
* @package
|
||||
*/
|
||||
Blockly.Connection.prototype.checkType = function(otherConnection) {
|
||||
if (!this.check_ || !otherConnection.check_) {
|
||||
|
||||
@@ -300,12 +300,10 @@ Blockly.ContextMenu.blockCommentOption = function(block) {
|
||||
* right-click originated.
|
||||
* @return {!Object} A menu option, containing text, enabled, and a callback.
|
||||
* @package
|
||||
* @suppress {checkTypes} Suppress checks while workspace comments are not
|
||||
* bundled in.
|
||||
*/
|
||||
Blockly.ContextMenu.commentDeleteOption = function(comment) {
|
||||
var deleteOption = {
|
||||
text: Blockly.Msg.REMOVE_COMMENT,
|
||||
text: Blockly.Msg['REMOVE_COMMENT'],
|
||||
enabled: true,
|
||||
callback: function() {
|
||||
Blockly.Events.setGroup(true);
|
||||
@@ -322,12 +320,10 @@ Blockly.ContextMenu.commentDeleteOption = function(comment) {
|
||||
* right-click originated.
|
||||
* @return {!Object} A menu option, containing text, enabled, and a callback.
|
||||
* @package
|
||||
* @suppress {checkTypes} Suppress checks while workspace comments are not
|
||||
* bundled in.
|
||||
*/
|
||||
Blockly.ContextMenu.commentDuplicateOption = function(comment) {
|
||||
var duplicateOption = {
|
||||
text: Blockly.Msg.DUPLICATE_COMMENT,
|
||||
text: Blockly.Msg['DUPLICATE_COMMENT'],
|
||||
enabled: true,
|
||||
callback: function() {
|
||||
Blockly.duplicate(comment);
|
||||
@@ -354,7 +350,7 @@ Blockly.ContextMenu.workspaceCommentOption = function(ws, e) {
|
||||
// location of the mouse event.
|
||||
var addWsComment = function() {
|
||||
var comment = new Blockly.WorkspaceCommentSvg(
|
||||
ws, Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT,
|
||||
ws, Blockly.Msg['WORKSPACE_COMMENT_DEFAULT_TEXT'],
|
||||
Blockly.WorkspaceCommentSvg.DEFAULT_SIZE,
|
||||
Blockly.WorkspaceCommentSvg.DEFAULT_SIZE);
|
||||
|
||||
@@ -394,7 +390,7 @@ Blockly.ContextMenu.workspaceCommentOption = function(ws, e) {
|
||||
// that they won't be able to edit.
|
||||
enabled: !Blockly.utils.userAgent.IE
|
||||
};
|
||||
wsCommentOption.text = Blockly.Msg.ADD_COMMENT;
|
||||
wsCommentOption.text = Blockly.Msg['ADD_COMMENT'];
|
||||
wsCommentOption.callback = function() {
|
||||
addWsComment();
|
||||
};
|
||||
|
||||
@@ -259,7 +259,7 @@ Blockly.Field.prototype.SERIALIZABLE = false;
|
||||
|
||||
/**
|
||||
* Point size of text. Should match blocklyText's font-size in CSS.
|
||||
* @const {string}
|
||||
* @const {number}
|
||||
*/
|
||||
Blockly.Field.FONTSIZE = 11;
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
goog.provide('Blockly.ASTNode');
|
||||
|
||||
goog.require('Blockly.utils.Coordinate');
|
||||
|
||||
|
||||
/**
|
||||
* Class for an AST node.
|
||||
|
||||
@@ -47,7 +47,7 @@ Blockly.blockRendering.Connection = function(constants, connectionModel) {
|
||||
constants);
|
||||
this.connectionModel = connectionModel;
|
||||
this.shape = this.constants_.shapeFor(connectionModel);
|
||||
this.isDynamicShape = !!this.shape.isDynamic;
|
||||
this.isDynamicShape = !!this.shape['isDynamic'];
|
||||
this.type |= Blockly.blockRendering.Types.CONNECTION;
|
||||
};
|
||||
Blockly.utils.object.inherits(Blockly.blockRendering.Connection,
|
||||
|
||||
@@ -252,11 +252,7 @@ Blockly.zelos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a spacer row to go between prev and next, and set its size.
|
||||
* @param {?Blockly.blockRendering.Row} prev The previous row, or null.
|
||||
* @param {?Blockly.blockRendering.Row} next The next row, or null.
|
||||
* @return {!Blockly.blockRendering.SpacerRow} The newly created spacer row.
|
||||
* @protected
|
||||
* @override
|
||||
*/
|
||||
Blockly.zelos.RenderInfo.prototype.makeSpacerRow_ = function(prev, next) {
|
||||
var height = this.getSpacerRowHeight_(prev, next);
|
||||
|
||||
@@ -284,7 +284,7 @@ Blockly.utils.dom.getTextWidth = function(textElement) {
|
||||
* This method requires that we know the text element's font family and size in
|
||||
* advance. Similar to `getTextWidth`, we cache the width we compute.
|
||||
* @param {!Element} textElement An SVG 'text' element.
|
||||
* @param {string} fontSize The font size to use.
|
||||
* @param {number} fontSize The font size to use.
|
||||
* @param {string} fontFamily The font family to use.
|
||||
* @return {number} Width of element.
|
||||
*/
|
||||
|
||||
@@ -44,6 +44,8 @@ goog.require('Blockly.WorkspaceAudio');
|
||||
goog.require('Blockly.WorkspaceDragSurfaceSvg');
|
||||
goog.require('Blockly.Xml');
|
||||
|
||||
goog.requireType('Blockly.blockRendering.Renderer');
|
||||
|
||||
|
||||
/**
|
||||
* Class for a workspace. This is an onscreen area with optional trashcan,
|
||||
@@ -1308,7 +1310,6 @@ Blockly.WorkspaceSvg.prototype.refreshToolboxSelection = function() {
|
||||
* flyout to show the renamed variable immediately.
|
||||
* @param {string} id ID of the variable to rename.
|
||||
* @param {string} newName New variable name.
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.renameVariableById = function(id, newName) {
|
||||
Blockly.WorkspaceSvg.superClass_.renameVariableById.call(this, id, newName);
|
||||
@@ -1319,7 +1320,6 @@ Blockly.WorkspaceSvg.prototype.renameVariableById = function(id, newName) {
|
||||
* Delete a variable by the passed in ID. Update the flyout to show
|
||||
* immediately that the variable is deleted.
|
||||
* @param {string} id ID of variable to delete.
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.deleteVariableById = function(id) {
|
||||
Blockly.WorkspaceSvg.superClass_.deleteVariableById.call(this, id);
|
||||
@@ -1336,7 +1336,6 @@ Blockly.WorkspaceSvg.prototype.deleteVariableById = function(id) {
|
||||
* @param {?string=} opt_id The unique ID of the variable. This will default to
|
||||
* a UUID.
|
||||
* @return {!Blockly.VariableModel} The newly created variable.
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.createVariable = function(name,
|
||||
opt_type, opt_id) {
|
||||
@@ -1465,7 +1464,6 @@ Blockly.WorkspaceSvg.prototype.isContentBounded = function() {
|
||||
* the mouse position). This does not include zooming with the zoom controls
|
||||
* since the X Y coordinates are decided programmatically.
|
||||
* @return {boolean} True if the workspace is movable, false otherwise.
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.isMovable = function() {
|
||||
return (this.options.moveOptions && this.options.moveOptions.scrollbars) ||
|
||||
@@ -2265,7 +2263,7 @@ Blockly.WorkspaceSvg.getContentDimensionsBounded_ = function(ws, svgSize) {
|
||||
* @return {!Object} Contains size and position metrics of a top level
|
||||
* workspace.
|
||||
* @private
|
||||
* @this Blockly.WorkspaceSvg
|
||||
* @this {Blockly.WorkspaceSvg}
|
||||
*/
|
||||
Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_ = function() {
|
||||
|
||||
@@ -2347,7 +2345,7 @@ Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_ = function() {
|
||||
* @param {!Object} xyRatio Contains an x and/or y property which is a float
|
||||
* between 0 and 1 specifying the degree of scrolling.
|
||||
* @private
|
||||
* @this Blockly.WorkspaceSvg
|
||||
* @this {Blockly.WorkspaceSvg}
|
||||
*/
|
||||
Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_ = function(xyRatio) {
|
||||
var metrics = this.getMetrics();
|
||||
|
||||
Reference in New Issue
Block a user