Normalize ++x to x++. (#5660)

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.
This commit is contained in:
Neil Fraser
2021-11-02 09:22:11 -07:00
committed by GitHub
parent 7ff6b93eb5
commit fa47c3c4a8
10 changed files with 10 additions and 10 deletions

View File

@@ -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);
}
}

View File

@@ -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(

View File

@@ -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;

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {