Skip to content

Commit

Permalink
Normalize ++x to x++. (#5660)
Browse files Browse the repository at this point in the history
There are only 10 instances of ++x in our codebase, compared with over 500 instances of x++.  The stlye guide has no opinion on which to use, nor do I.  But the lack of consistency was making regex searches for bugs more difficult.
  • Loading branch information
NeilFraser authored Nov 2, 2021
1 parent 7ff6b93 commit fa47c3c
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ Block.prototype.jsonInit = function(json) {

const extensionNames = json['extensions'];
if (Array.isArray(extensionNames)) {
for (let j = 0; j < extensionNames.length; ++j) {
for (let j = 0; j < extensionNames.length; j++) {
Extensions.apply(extensionNames[j], this, false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ const checkDropdownOptionsInTable = function(block, dropdownName, lookupTable) {
const dropdown = block.getField(dropdownName);
if (!dropdown.isOptionListDynamic()) {
const options = dropdown.getOptions();
for (let i = 0; i < options.length; ++i) {
for (let i = 0; i < options.length; i++) {
const optionKey = options[i][1]; // label, then value
if (lookupTable[optionKey] === null) {
console.warn(
Expand Down
2 changes: 1 addition & 1 deletion core/field_dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ const validateOptions = function(options) {
throw TypeError('FieldDropdown options must not be an empty array.');
}
let foundError = false;
for (let i = 0; i < options.length; ++i) {
for (let i = 0; i < options.length; i++) {
const tuple = options[i];
if (!Array.isArray(tuple)) {
foundError = true;
Expand Down
2 changes: 1 addition & 1 deletion core/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Input.prototype.insertFieldAt = function(index, field, opt_name) {
}
// Add the field to the field row.
this.fieldRow.splice(index, 0, field);
++index;
index++;
if (field.suffixField) {
// Add any suffix.
index = this.insertFieldAt(index, field.suffixField);
Expand Down
2 changes: 1 addition & 1 deletion core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ const tokenizeInterpolation_ = function(message, parseInterpolationTokens) {
// Merge adjacent text tokens into a single string.
const mergedTokens = [];
buffer.length = 0;
for (let i = 0; i < tokens.length; ++i) {
for (let i = 0; i < tokens.length; i++) {
if (typeof tokens[i] === 'string') {
buffer.push(tokens[i]);
} else {
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Blockly.Dart['controls_if'] = function(block) {
}
code += (n > 0 ? 'else ' : '') +
'if (' + conditionCode + ') {\n' + branchCode + '}';
++n;
n++;
} while (block.getInput('IF' + n));

if (block.getInput('ELSE') || Blockly.Dart.STATEMENT_SUFFIX) {
Expand Down
2 changes: 1 addition & 1 deletion generators/javascript/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Blockly.JavaScript['controls_if'] = function(block) {
}
code += (n > 0 ? ' else ' : '') +
'if (' + conditionCode + ') {\n' + branchCode + '}';
++n;
n++;
} while (block.getInput('IF' + n));

if (block.getInput('ELSE') || Blockly.JavaScript.STATEMENT_SUFFIX) {
Expand Down
2 changes: 1 addition & 1 deletion generators/lua/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Blockly.Lua['controls_if'] = function(block) {
}
code += (n > 0 ? 'else' : '') +
'if ' + conditionCode + ' then\n' + branchCode;
++n;
n++;
} while (block.getInput('IF' + n));

if (block.getInput('ELSE') || Blockly.Lua.STATEMENT_SUFFIX) {
Expand Down
2 changes: 1 addition & 1 deletion generators/php/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Blockly.PHP['controls_if'] = function(block) {
}
code += (n > 0 ? ' else ' : '') +
'if (' + conditionCode + ') {\n' + branchCode + '}';
++n;
n++;
} while (block.getInput('IF' + n));

if (block.getInput('ELSE') || Blockly.PHP.STATEMENT_SUFFIX) {
Expand Down
2 changes: 1 addition & 1 deletion generators/python/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Blockly.Python['controls_if'] = function(block) {
Blockly.Python.INDENT) + branchCode;
}
code += (n === 0 ? 'if ' : 'elif ') + conditionCode + ':\n' + branchCode;
++n;
n++;
} while (block.getInput('IF' + n));

if (block.getInput('ELSE') || Blockly.Python.STATEMENT_SUFFIX) {
Expand Down

0 comments on commit fa47c3c

Please sign in to comment.