Remove extra else clauses

This commit is contained in:
Neil Fraser
2021-06-08 16:00:35 -07:00
committed by Neil Fraser
parent cff7b359f4
commit 861a981cb6
7 changed files with 10 additions and 16 deletions

View File

@@ -1949,9 +1949,8 @@ Blockly.Block.prototype.removeInput = function(name, opt_quiet) {
}
if (opt_quiet) {
return false;
} else {
throw Error('Input not found: ' + name);
}
throw Error('Input not found: ' + name);
};
/**

View File

@@ -227,10 +227,9 @@ Blockly.Extensions.checkMutatorDialog_ = function(object, errorPrefix) {
return true;
} else if (!hasCompose && !hasDecompose) {
return false;
} else {
throw Error(errorPrefix +
'Must have both or neither of "compose" and "decompose"');
}
throw Error(errorPrefix +
'Must have both or neither of "compose" and "decompose"');
};
/**

View File

@@ -219,9 +219,8 @@ Blockly.Generator.prototype.blockToCode = function(block, opt_thisOnly) {
} else if (code === null) {
// Block has handled code generation itself.
return '';
} else {
throw SyntaxError('Invalid code generated: ' + code);
}
throw SyntaxError('Invalid code generated: ' + code);
};
/**

View File

@@ -168,9 +168,8 @@ Blockly.Input.prototype.removeField = function(name, opt_quiet) {
}
if (opt_quiet) {
return false;
} else {
throw Error('Field "' + name + '" not found.');
}
throw Error('Field "' + name + '" not found.');
};
/**

View File

@@ -95,9 +95,8 @@ Blockly.Names.prototype.getNameForUserVariable_ = function(id) {
var variable = this.variableMap_.getVariableById(id);
if (variable) {
return variable.name;
} else {
return null;
}
return null;
};
/**

View File

@@ -165,11 +165,10 @@ Blockly.ShortcutRegistry.prototype.removeKeyMapping = function(
delete this.keyMap_[keyCode];
}
return true;
} else if (!opt_quiet) {
console.warn(
'No keyboard shortcut with name "' + shortcutName +
}
if (!opt_quiet) {
console.warn('No keyboard shortcut with name "' + shortcutName +
'" registered with key code "' + keyCode + '"');
return false;
}
return false;
};

View File

@@ -23,7 +23,7 @@ Blockly.PHP['procedures_defreturn'] = function(block) {
var workspace = block.workspace;
var variables = Blockly.Variables.allUsedVarModels(workspace) || [];
for (var i = 0, variable; variable = variables[i]; i++) {
varName = variable.name;
var varName = variable.name;
if (block.getVars().indexOf(varName) == -1) {
globals.push(Blockly.PHP.nameDB_.getName(varName,
Blockly.VARIABLE_CATEGORY_NAME));