Skip to content

Commit

Permalink
chore: runs clang format on all files (google#5627)
Browse files Browse the repository at this point in the history
  • Loading branch information
alschmiedt authored Oct 21, 2021
1 parent 6dc0f90 commit 0f3c063
Show file tree
Hide file tree
Showing 36 changed files with 209 additions and 130 deletions.
3 changes: 2 additions & 1 deletion core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,8 @@ Block.prototype.getVarModels = function() {
Block.prototype.updateVarName = function(variable) {
for (let i = 0, input; (input = this.inputList[i]); i++) {
for (let j = 0, field; (field = input.fieldRow[j]); j++) {
if (field.referencesVariables() && variable.getId() === field.getValue()) {
if (field.referencesVariables() &&
variable.getId() === field.getValue()) {
field.refreshVariableName();
}
}
Expand Down
3 changes: 1 addition & 2 deletions core/blockly.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,7 @@ exports.zelos = zelos;
// accessors on one copy would call get/set functions on the other
// copy!)
if (globalThis.goog && globalThis.Blockly &&
typeof globalThis.Blockly === 'object' &&
globalThis.Blockly !== exports) {
typeof globalThis.Blockly === 'object' && globalThis.Blockly !== exports) {
const descriptors = Object.getOwnPropertyDescriptors(exports);
const accessors = {};
for (const key in descriptors) {
Expand Down
2 changes: 1 addition & 1 deletion core/contextmenu_items.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ const registerHelp = function() {
scope) {
const block = scope.block;
const url = (typeof block.helpUrl === 'function') ? block.helpUrl() :
block.helpUrl;
block.helpUrl;
if (url) {
return 'enabled';
}
Expand Down
4 changes: 2 additions & 2 deletions core/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const register = function(cssContent) {

if (Array.isArray(cssContent)) {
deprecation.warn(
'Registering CSS by passing an array of strings', 'September 2021',
'September 2022', 'css.register passing a multiline string');
'Registering CSS by passing an array of strings', 'September 2021',
'September 2022', 'css.register passing a multiline string');
content += ('\n' + cssContent.join('\n'));
} else {
// Add new cssContent in the global content.
Expand Down
1 change: 0 additions & 1 deletion core/events/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,3 @@ Object.defineProperties(exports, {
},
},
});

3 changes: 2 additions & 1 deletion core/events/events_block_change.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ BlockChange.prototype.run = function(forward) {
block.domToMutation(
Xml.textToDom(/** @type {string} */ (value) || '<mutation/>'));
}
eventUtils.fire(new BlockChange(block, 'mutation', null, oldState, value));
eventUtils.fire(
new BlockChange(block, 'mutation', null, oldState, value));
break;
}
default:
Expand Down
4 changes: 2 additions & 2 deletions core/events/events_block_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const BlockCreate = function(opt_block) {
* JSON representation of the block that was just created.
* @type {!blocks.State}
*/
this.json = /** @type {!blocks.State} */ (blocks.save(
opt_block, {addCoordinates: true}));
this.json = /** @type {!blocks.State} */ (
blocks.save(opt_block, {addCoordinates: true}));
};
object.inherits(BlockCreate, BlockBase);

Expand Down
6 changes: 3 additions & 3 deletions core/events/events_block_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ const BlockDelete = function(opt_block) {
* JSON representation of the block that was just deleted.
* @type {!blocks.State}
*/
this.oldJson = /** @type {!blocks.State} */ (blocks.save(
opt_block, {addCoordinates: true}));
this.oldJson = /** @type {!blocks.State} */ (
blocks.save(opt_block, {addCoordinates: true}));
};
object.inherits(BlockDelete, BlockBase);

Expand Down Expand Up @@ -95,7 +95,7 @@ BlockDelete.prototype.fromJson = function(json) {
this.oldXml = Xml.textToDom(json['oldXml']);
this.ids = json['ids'];
this.wasShadow =
json['wasShadow'] || this.oldXml.tagName.toLowerCase() === 'shadow';
json['wasShadow'] || this.oldXml.tagName.toLowerCase() === 'shadow';
this.oldJson = /** @type {!blocks.State} */ (json['oldJson']);
if (json['recordUndo'] !== undefined) {
this.recordUndo = json['recordUndo'];
Expand Down
3 changes: 2 additions & 1 deletion core/events/events_comment_change.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ CommentChange.prototype.run = function(forward) {
comment.setContent(contents);
};

registry.register(registry.Type.EVENT, eventUtils.COMMENT_CHANGE, CommentChange);
registry.register(
registry.Type.EVENT, eventUtils.COMMENT_CHANGE, CommentChange);

exports.CommentChange = CommentChange;
3 changes: 2 additions & 1 deletion core/events/events_comment_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ CommentCreate.prototype.run = function(forward) {
CommentBase.CommentCreateDeleteHelper(this, forward);
};

registry.register(registry.Type.EVENT, eventUtils.COMMENT_CREATE, CommentCreate);
registry.register(
registry.Type.EVENT, eventUtils.COMMENT_CREATE, CommentCreate);

exports.CommentCreate = CommentCreate;
3 changes: 2 additions & 1 deletion core/events/events_comment_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ CommentDelete.prototype.run = function(forward) {
CommentBase.CommentCreateDeleteHelper(this, !forward);
};

registry.register(registry.Type.EVENT, eventUtils.COMMENT_DELETE, CommentDelete);
registry.register(
registry.Type.EVENT, eventUtils.COMMENT_DELETE, CommentDelete);

exports.CommentDelete = CommentDelete;
3 changes: 2 additions & 1 deletion core/events/events_viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ ViewportChange.prototype.fromJson = function(json) {
this.oldScale = json['oldScale'];
};

registry.register(registry.Type.EVENT, eventUtils.VIEWPORT_CHANGE, ViewportChange);
registry.register(
registry.Type.EVENT, eventUtils.VIEWPORT_CHANGE, ViewportChange);

exports.ViewportChange = ViewportChange;
80 changes: 70 additions & 10 deletions core/field_colour.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,25 +255,85 @@ FieldColour.prototype.getText = function() {
*/
FieldColour.COLOURS = [
// grays
'#ffffff', '#cccccc', '#c0c0c0', '#999999', '#666666', '#333333', '#000000',
'#ffffff',
'#cccccc',
'#c0c0c0',
'#999999',
'#666666',
'#333333',
'#000000',
// reds
'#ffcccc', '#ff6666', '#ff0000', '#cc0000', '#990000', '#660000', '#330000',
'#ffcccc',
'#ff6666',
'#ff0000',
'#cc0000',
'#990000',
'#660000',
'#330000',
// oranges
'#ffcc99', '#ff9966', '#ff9900', '#ff6600', '#cc6600', '#993300', '#663300',
'#ffcc99',
'#ff9966',
'#ff9900',
'#ff6600',
'#cc6600',
'#993300',
'#663300',
// yellows
'#ffff99', '#ffff66', '#ffcc66', '#ffcc33', '#cc9933', '#996633', '#663333',
'#ffff99',
'#ffff66',
'#ffcc66',
'#ffcc33',
'#cc9933',
'#996633',
'#663333',
// olives
'#ffffcc', '#ffff33', '#ffff00', '#ffcc00', '#999900', '#666600', '#333300',
'#ffffcc',
'#ffff33',
'#ffff00',
'#ffcc00',
'#999900',
'#666600',
'#333300',
// greens
'#99ff99', '#66ff99', '#33ff33', '#33cc00', '#009900', '#006600', '#003300',
'#99ff99',
'#66ff99',
'#33ff33',
'#33cc00',
'#009900',
'#006600',
'#003300',
// turquoises
'#99ffff', '#33ffff', '#66cccc', '#00cccc', '#339999', '#336666', '#003333',
'#99ffff',
'#33ffff',
'#66cccc',
'#00cccc',
'#339999',
'#336666',
'#003333',
// blues
'#ccffff', '#66ffff', '#33ccff', '#3366ff', '#3333ff', '#000099', '#000066',
'#ccffff',
'#66ffff',
'#33ccff',
'#3366ff',
'#3333ff',
'#000099',
'#000066',
// purples
'#ccccff', '#9999ff', '#6666cc', '#6633ff', '#6600cc', '#333399', '#330099',
'#ccccff',
'#9999ff',
'#6666cc',
'#6633ff',
'#6600cc',
'#333399',
'#330099',
// violets
'#ffccff', '#ff99ff', '#cc66cc', '#cc33cc', '#993399', '#663366', '#330033',
'#ffccff',
'#ff99ff',
'#cc66cc',
'#cc33cc',
'#993399',
'#663366',
'#330033',
];

/**
Expand Down
9 changes: 6 additions & 3 deletions core/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,19 +343,22 @@ const loadSounds = function(pathToMedia, workspace) {
const audioMgr = workspace.getAudioManager();
audioMgr.load(
[
pathToMedia + 'click.mp3', pathToMedia + 'click.wav',
pathToMedia + 'click.mp3',
pathToMedia + 'click.wav',
pathToMedia + 'click.ogg',
],
'click');
audioMgr.load(
[
pathToMedia + 'disconnect.wav', pathToMedia + 'disconnect.mp3',
pathToMedia + 'disconnect.wav',
pathToMedia + 'disconnect.mp3',
pathToMedia + 'disconnect.ogg',
],
'disconnect');
audioMgr.load(
[
pathToMedia + 'delete.mp3', pathToMedia + 'delete.ogg',
pathToMedia + 'delete.mp3',
pathToMedia + 'delete.ogg',
pathToMedia + 'delete.wav',
],
'delete');
Expand Down
2 changes: 1 addition & 1 deletion core/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const Options = function(options) {
toolboxAtStart ? toolbox.Position.TOP : toolbox.Position.BOTTOM;
} else {
toolboxPosition = (toolboxAtStart === rtl) ? toolbox.Position.RIGHT :
toolbox.Position.LEFT;
toolbox.Position.LEFT;
}

let hasCss = options['css'];
Expand Down
3 changes: 2 additions & 1 deletion core/procedures.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ exports.mutatorOpenListener = mutatorOpenListener;
* @param {!Abstract} e The event that triggered this listener.
*/
const mutatorChangeListener = function(e) {
if (e.type !== eventUtils.BLOCK_CREATE && e.type !== eventUtils.BLOCK_DELETE &&
if (e.type !== eventUtils.BLOCK_CREATE &&
e.type !== eventUtils.BLOCK_DELETE &&
e.type !== eventUtils.BLOCK_CHANGE) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion core/renderers/common/block_rendering.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ exports.isDebuggerEnabled = isDebuggerEnabled;
* to register.
* @throws {Error} if a renderer with the same name has already been registered.
*/
const register = function(name, rendererClass) {
const register = function(name, rendererClass) {
registry.register(registry.Type.RENDERER, name, rendererClass);
};
exports.register = register;
Expand Down
9 changes: 6 additions & 3 deletions core/renderers/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@ ConstantProvider.prototype.makeJaggedTeeth = function() {
const width = this.JAGGED_TEETH_WIDTH;

const mainPath = svgPaths.line([
svgPaths.point(width, height / 4), svgPaths.point(-width * 2, height / 2),
svgPaths.point(width, height / 4),
svgPaths.point(-width * 2, height / 2),
svgPaths.point(width, height / 4),
]);
return {height: height, width: width, path: mainPath};
Expand All @@ -800,7 +801,8 @@ ConstantProvider.prototype.makeStartHat = function() {
const width = this.START_HAT_WIDTH;

const mainPath = svgPaths.curve('c', [
svgPaths.point(30, -height), svgPaths.point(70, -height),
svgPaths.point(30, -height),
svgPaths.point(70, -height),
svgPaths.point(width, 0),
]);
return {height: height, width: width, path: mainPath};
Expand Down Expand Up @@ -837,7 +839,8 @@ ConstantProvider.prototype.makePuzzleTab = function() {
'c',
[
svgPaths.point(0, forward * control1Y),
svgPaths.point(-width, back * control2Y), endPoint1,
svgPaths.point(-width, back * control2Y),
endPoint1,
]) +
svgPaths.curve(
's', [svgPaths.point(width, back * control3Y), endPoint2]);
Expand Down
2 changes: 1 addition & 1 deletion core/renderers/common/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
*/

/**
* @fileoverview Block rendering debugging functionality.
Expand Down
3 changes: 1 addition & 2 deletions core/renderers/common/marker_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ MarkerSvg.prototype.isCursor = function() {
* @package
*/
MarkerSvg.prototype.createDom = function() {
const className =
this.isCursor() ? CURSOR_CLASS : MARKER_CLASS;
const className = this.isCursor() ? CURSOR_CLASS : MARKER_CLASS;

this.svgGroup_ = dom.createSvgElement(Svg.G, {'class': className}, null);

Expand Down
3 changes: 1 addition & 2 deletions core/renderers/geras/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ ConstantProvider.prototype.getCSS_ = function(selector) {
// Insertion marker.
selector + ' .blocklyInsertionMarker>.blocklyPathLight,',
selector + ' .blocklyInsertionMarker>.blocklyPathDark {',
'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';',
'stroke: none;',
'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', 'stroke: none;',
'}',
/* eslint-enable indent */
]);
Expand Down
9 changes: 6 additions & 3 deletions core/renderers/geras/highlight_constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ HighlightConstantProvider.prototype.makePuzzleTab = function() {
svgPaths.curve(
'q',
[
svgPaths.point(-width * 0.05, 10), svgPaths.point(width * 0.3, 9.5),
svgPaths.point(-width * 0.05, 10),
svgPaths.point(width * 0.3, 9.5),
]) +
svgPaths.moveBy(width * 0.67, -1.9) +
svgPaths.lineOnAxis('v', verticalOverlap);
Expand Down Expand Up @@ -272,12 +273,14 @@ HighlightConstantProvider.prototype.makeJaggedTeeth = function() {
HighlightConstantProvider.prototype.makeStartHat = function() {
const hatHeight = this.constantProvider.START_HAT.height;
const pathRtl = svgPaths.moveBy(25, -8.7) + svgPaths.curve('c', [
svgPaths.point(29.7, -6.2), svgPaths.point(57.2, -0.5),
svgPaths.point(29.7, -6.2),
svgPaths.point(57.2, -0.5),
svgPaths.point(75, 8.7),
]);

const pathLtr = svgPaths.curve('c', [
svgPaths.point(17.8, -9.2), svgPaths.point(45.3, -14.9),
svgPaths.point(17.8, -9.2),
svgPaths.point(45.3, -14.9),
svgPaths.point(75, -8.7),
]) + svgPaths.moveTo(100.5, hatHeight + 0.5);
return {
Expand Down
3 changes: 2 additions & 1 deletion core/renderers/measurables/input_row.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ InputRow.prototype.measure = function() {
if (Types.isInput(elem)) {
if (Types.isStatementInput(elem)) {
connectedBlockWidths += elem.connectedBlockWidth;
} else if (Types.isExternalInput(elem) && elem.connectedBlockWidth !== 0) {
} else if (
Types.isExternalInput(elem) && elem.connectedBlockWidth !== 0) {
connectedBlockWidths +=
(elem.connectedBlockWidth - elem.connectionWidth);
}
Expand Down
2 changes: 1 addition & 1 deletion core/renderers/measurables/round_corner.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const RoundCorner = function(constants, opt_position) {
RoundCorner.superClass_.constructor.call(this, constants);
this.type =
((!opt_position || opt_position === 'left') ? Types.LEFT_ROUND_CORNER :
Types.RIGHT_ROUND_CORNER) |
Types.RIGHT_ROUND_CORNER) |
Types.CORNER;
this.width = this.constants_.CORNER_RADIUS;
// The rounded corner extends into the next row by 4 so we only take the
Expand Down
2 changes: 1 addition & 1 deletion core/renderers/measurables/square_corner.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const SquareCorner = function(constants, opt_position) {
SquareCorner.superClass_.constructor.call(this, constants);
this.type =
((!opt_position || opt_position === 'left') ? Types.LEFT_SQUARE_CORNER :
Types.RIGHT_SQUARE_CORNER) |
Types.RIGHT_SQUARE_CORNER) |
Types.CORNER;
this.height = this.constants_.NO_PADDING;
this.width = this.constants_.NO_PADDING;
Expand Down
2 changes: 1 addition & 1 deletion core/renderers/measurables/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const Types = {
ROW: 1 << 20, // Row.
TOP_ROW: 1 << 21, // Top Row.
BOTTOM_ROW: 1 << 22, // Bottom Row.
INPUT_ROW: 1 << 23, // Input Row.
INPUT_ROW: 1 << 23, // Input Row.
};

/**
Expand Down
Loading

0 comments on commit 0f3c063

Please sign in to comment.