Skip to content

Commit

Permalink
fix: Move @alias onto classes instead of constructors (google#6003)
Browse files Browse the repository at this point in the history
* fix: Move @alias onto classes instead of constructors

* fix: Fix JSDoc for constructors.
  • Loading branch information
gonfunko authored Mar 16, 2022
1 parent e2eaebe commit 1647a32
Show file tree
Hide file tree
Showing 152 changed files with 159 additions and 161 deletions.
2 changes: 1 addition & 1 deletion core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ goog.require('Blockly.Events.BlockMove');
* @implements {IASTNodeLocation}
* @implements {IDeletable}
* @unrestricted
* @alias Blockly.Block
*/
class Block {
/**
Expand All @@ -76,7 +77,6 @@ class Block {
* @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
* create a new ID.
* @throws When the prototypeName is not valid or not allowed.
* @alias Blockly.Block
*/
constructor(workspace, prototypeName, opt_id) {
const {Generator} = goog.module.get('Blockly.Generator');
Expand Down
2 changes: 1 addition & 1 deletion core/block_drag_surface.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const {Svg} = goog.require('Blockly.utils.Svg');
/**
* Class for a drag surface for the currently dragged block. This is a separate
* SVG that contains only the currently moving block, or nothing.
* @alias Blockly.BlockDragSurfaceSvg
*/
const BlockDragSurfaceSvg = class {
/**
* @param {!Element} container Containing element.
* @alias Blockly.BlockDragSurfaceSvg
*/
constructor(container) {
/**
Expand Down
2 changes: 1 addition & 1 deletion core/block_dragger.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ goog.require('Blockly.Events.BlockMove');
* Class for a block dragger. It moves blocks around the workspace when they
* are being dragged by a mouse or touch.
* @implements {IBlockDragger}
* @alias Blockly.BlockDragger
*/
const BlockDragger = class {
/**
* @param {!BlockSvg} block The block to drag.
* @param {!WorkspaceSvg} workspace The workspace to drag on.
* @alias Blockly.BlockDragger
*/
constructor(block, workspace) {
/**
Expand Down
2 changes: 1 addition & 1 deletion core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ goog.require('Blockly.Touch');
* @implements {IBoundedElement}
* @implements {ICopyable}
* @implements {IDraggable}
* @alias Blockly.BlockSvg
*/
class BlockSvg extends Block {
/**
Expand All @@ -96,7 +97,6 @@ class BlockSvg extends Block {
* type-specific functions for this block.
* @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
* create a new ID.
* @alias Blockly.BlockSvg
*/
constructor(workspace, prototypeName, opt_id) {
super(workspace, prototypeName, opt_id);
Expand Down
2 changes: 1 addition & 1 deletion core/bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ goog.require('Blockly.Workspace');
/**
* Class for UI bubble.
* @implements {IBubble}
* @alias Blockly.Bubble
*/
const Bubble = class {
/**
Expand All @@ -53,7 +54,6 @@ const Bubble = class {
* @param {?number} bubbleWidth Width of bubble, or null if not resizable.
* @param {?number} bubbleHeight Height of bubble, or null if not resizable.
* @struct
* @alias Blockly.Bubble
*/
constructor(workspace, content, shape, anchorXY, bubbleWidth, bubbleHeight) {
this.workspace_ = workspace;
Expand Down
2 changes: 1 addition & 1 deletion core/bubble_dragger.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ goog.require('Blockly.constants');
* Class for a bubble dragger. It moves things on the bubble canvas around the
* workspace when they are being dragged by a mouse or touch. These can be
* block comments, mutators, warnings, or workspace comments.
* @alias Blockly.BubbleDragger
*/
const BubbleDragger = class {
/**
* @param {!IBubble} bubble The item on the bubble canvas to drag.
* @param {!WorkspaceSvg} workspace The workspace to drag on.
* @alias Blockly.BubbleDragger
*/
constructor(bubble, workspace) {
/**
Expand Down
2 changes: 1 addition & 1 deletion core/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ goog.require('Blockly.Warning');
/**
* Class for a comment.
* @extends {Icon}
* @alias Blockly.Comment
*/
class Comment extends Icon {
/**
* @param {!BlockSvg} block The block associated with this comment.
* @alias Blockly.Comment
*/
constructor(block) {
super(block);
Expand Down
4 changes: 3 additions & 1 deletion core/component_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ const {IPositionable} = goog.requireType('Blockly.IPositionable');

/**
* Manager for all items registered with the workspace.
* @alias Blockly.ComponentManager
*/
class ComponentManager {
/**
* @alias Blockly.ComponentManager
* Creates a new ComponentManager instance.
*/
constructor() {
/**
Expand Down Expand Up @@ -219,6 +220,7 @@ ComponentManager.ComponentDatum;
/**
* A name with the capability of the element stored in the generic.
* @template T
* @alias Blockly.ComponentManager.Capability
*/
ComponentManager.Capability = class {
/**
Expand Down
2 changes: 1 addition & 1 deletion core/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ goog.require('Blockly.constants');
/**
* Class for a connection between blocks.
* @implements {IASTNodeLocationWithBlock}
* @alias Blockly.Connection
*/
class Connection {
/**
* @param {!Block} source The block establishing this connection.
* @param {number} type The type of the connection.
* @alias Blockly.Connection
*/
constructor(source, type) {
/**
Expand Down
6 changes: 1 addition & 5 deletions core/connection_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,9 @@ const {RenderedConnection} = goog.requireType('Blockly.RenderedConnection');
/**
* Class for connection type checking logic.
* @implements {IConnectionChecker}
* @alias Blockly.ConnectionChecker
*/
class ConnectionChecker {
/**
* @alias Blockly.ConnectionChecker
*/
constructor() {}

/**
* Check whether the current connection can connect with the target
* connection.
Expand Down
2 changes: 1 addition & 1 deletion core/connection_db.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ goog.require('Blockly.constants');
* Database of connections.
* Connections are stored in order of their vertical component. This way
* connections in an area may be looked up quickly using a binary search.
* @alias Blockly.ConnectionDB
*/
class ConnectionDB {
/**
* @param {!IConnectionChecker} checker The workspace's
* connection type checker, used to decide if connections are valid during
* a drag.
* @alias Blockly.ConnectionDB
*/
constructor(checker) {
/**
Expand Down
3 changes: 2 additions & 1 deletion core/contextmenu_registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ const {WorkspaceSvg} = goog.requireType('Blockly.WorkspaceSvg');
* Class for the registry of context menu items. This is intended to be a
* singleton. You should not create a new instance, and only access this class
* from ContextMenuRegistry.registry.
* @alias Blockly.ContextMenuRegistry
*/
class ContextMenuRegistry {
/**
* @alias Blockly.ContextMenuRegistry
* Resets the existing singleton instance of ContextMenuRegistry.
*/
constructor() {
this.reset();
Expand Down
4 changes: 3 additions & 1 deletion core/delete_area.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ const {IDraggable} = goog.requireType('Blockly.IDraggable');
* dropped on top of it.
* @extends {DragTarget}
* @implements {IDeleteArea}
* @alias Blockly.DeleteArea
*/
class DeleteArea extends DragTarget {
/**
* @alias Blockly.DeleteArea
* Constructor for DeleteArea. Should not be called directly, only by a
* subclass.
*/
constructor() {
super();
Expand Down
6 changes: 1 addition & 5 deletions core/drag_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ const {Rect} = goog.requireType('Blockly.utils.Rect');
* Abstract class for a component with custom behaviour when a block or bubble
* is dragged over or dropped on top of it.
* @implements {IDragTarget}
* @alias Blockly.DragTarget
*/
class DragTarget {
/**
* @alias Blockly.DragTarget
*/
constructor() {}

/**
* Handles when a cursor with a block or bubble enters this drag target.
* @param {!IDraggable} _dragElement The block or bubble currently being
Expand Down
1 change: 1 addition & 0 deletions core/events/events_abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const {Workspace} = goog.requireType('Blockly.Workspace');
/**
* Abstract class for an event.
* @abstract
* @alias Blockly.Events.Abstract
*/
class Abstract {
/**
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_block_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ const {Block} = goog.requireType('Blockly.Block');
/**
* Abstract class for a block event.
* @extends {AbstractEvent}
* @alias Blockly.Events.BlockBase
*/
class BlockBase extends AbstractEvent {
/**
* @param {!Block=} opt_block The block this event corresponds to.
* Undefined for a blank event.
* @alias Blockly.Events.BlockBase
*/
constructor(opt_block) {
super();
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_block_change.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const {Block} = goog.requireType('Blockly.Block');
/**
* Class for a block change event.
* @extends {BlockBase}
* @alias Blockly.Events.BlockChange
*/
class BlockChange extends BlockBase {
/**
Expand All @@ -37,7 +38,6 @@ class BlockChange extends BlockBase {
* @param {?string=} opt_name Name of input or field affected, or null.
* @param {*=} opt_oldValue Previous value of element.
* @param {*=} opt_newValue New value of element.
* @alias Blockly.Events.BlockChange
*/
constructor(opt_block, opt_element, opt_name, opt_oldValue, opt_newValue) {
super(opt_block);
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_block_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const {Block} = goog.requireType('Blockly.Block');
/**
* Class for a block creation event.
* @extends {BlockBase}
* @alias Blockly.Events.BlockCreate
*/
class BlockCreate extends BlockBase {
/**
* @param {!Block=} opt_block The created block. Undefined for a blank
* event.
* @alias Blockly.Events.BlockCreate
*/
constructor(opt_block) {
super(opt_block);
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_block_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const {Block} = goog.requireType('Blockly.Block');
/**
* Class for a block deletion event.
* @extends {BlockBase}
* @alias Blockly.Events.BlockDelete
*/
class BlockDelete extends BlockBase {
/**
* @param {!Block=} opt_block The deleted block. Undefined for a blank
* event.
* @alias Blockly.Events.BlockDelete
*/
constructor(opt_block) {
super(opt_block);
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_block_drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const {UiBase} = goog.require('Blockly.Events.UiBase');
/**
* Class for a block drag event.
* @extends {UiBase}
* @alias Blockly.Events.BlockDrag
*/
class BlockDrag extends UiBase {
/**
Expand All @@ -34,7 +35,6 @@ class BlockDrag extends UiBase {
* Undefined for a blank event.
* @param {!Array<!Block>=} opt_blocks The blocks affected by this
* drag. Undefined for a blank event.
* @alias Blockly.Events.BlockDrag
*/
constructor(opt_block, opt_isStart, opt_blocks) {
const workspaceId = opt_block ? opt_block.workspace.id : undefined;
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_block_move.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const {Coordinate} = goog.require('Blockly.utils.Coordinate');
/**
* Class for a block move event. Created before the move.
* @extends {BlockBase}
* @alias Blockly.Events.BlockMove
*/
class BlockMove extends BlockBase {
/**
* @param {!Block=} opt_block The moved block. Undefined for a blank
* event.
* @alias Blockly.Events.BlockMove
*/
constructor(opt_block) {
super(opt_block);
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_bubble_open.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const {UiBase} = goog.require('Blockly.Events.UiBase');
/**
* Class for a bubble open event.
* @extends {UiBase}
* @alias Blockly.Events.BubbleOpen
*/
class BubbleOpen extends UiBase {
/**
Expand All @@ -35,7 +36,6 @@ class BubbleOpen extends UiBase {
* @param {string=} opt_bubbleType The type of bubble. One of 'mutator',
* 'comment'
* or 'warning'. Undefined for a blank event.
* @alias Blockly.Events.BubbleOpen
*/
constructor(opt_block, opt_isOpen, opt_bubbleType) {
const workspaceId = opt_block ? opt_block.workspace.id : undefined;
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_click.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const {UiBase} = goog.require('Blockly.Events.UiBase');
/**
* Class for a click event.
* @extends {UiBase}
* @alias Blockly.Events.Click
*/
class Click extends UiBase {
/**
Expand All @@ -35,7 +36,6 @@ class Click extends UiBase {
* Not used if block is passed. Undefined for a blank event.
* @param {string=} opt_targetType The type of element targeted by this click
* event. Undefined for a blank event.
* @alias Blockly.Events.Click
*/
constructor(opt_block, opt_workspaceId, opt_targetType) {
let workspaceId = opt_block ? opt_block.workspace.id : opt_workspaceId;
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_comment_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const {WorkspaceComment} = goog.requireType('Blockly.WorkspaceComment');
/**
* Abstract class for a comment event.
* @extends {AbstractEvent}
* @alias Blockly.Events.CommentBase
*/
class CommentBase extends AbstractEvent {
/**
* @param {!WorkspaceComment=} opt_comment The comment this event
* corresponds to. Undefined for a blank event.
* @alias Blockly.Events.CommentBase
*/
constructor(opt_comment) {
super();
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_comment_change.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ const {WorkspaceComment} = goog.requireType('Blockly.WorkspaceComment');
/**
* Class for a comment change event.
* @extends {CommentBase}
* @alias Blockly.Events.CommentChange
*/
class CommentChange extends CommentBase {
/**
* @param {!WorkspaceComment=} opt_comment The comment that is being
* changed. Undefined for a blank event.
* @param {string=} opt_oldContents Previous contents of the comment.
* @param {string=} opt_newContents New contents of the comment.
* @alias Blockly.Events.CommentChange
*/
constructor(opt_comment, opt_oldContents, opt_newContents) {
super(opt_comment);
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_comment_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const {WorkspaceComment} = goog.requireType('Blockly.WorkspaceComment');
/**
* Class for a comment creation event.
* @extends {CommentBase}
* @alias Blockly.Events.CommentCreate
*/
class CommentCreate extends CommentBase {
/**
* @param {!WorkspaceComment=} opt_comment The created comment.
* Undefined for a blank event.
* @alias Blockly.Events.CommentCreate
*/
constructor(opt_comment) {
super(opt_comment);
Expand Down
2 changes: 1 addition & 1 deletion core/events/events_comment_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const {WorkspaceComment} = goog.requireType('Blockly.WorkspaceComment');
/**
* Class for a comment deletion event.
* @extends {CommentBase}
* @alias Blockly.Events.CommentDelete
*/
class CommentDelete extends CommentBase {
/**
* @param {!WorkspaceComment=} opt_comment The deleted comment.
* Undefined for a blank event.
* @alias Blockly.Events.CommentDelete
*/
constructor(opt_comment) {
super(opt_comment);
Expand Down
Loading

0 comments on commit 1647a32

Please sign in to comment.