Skip to content

Commit

Permalink
Remove extra else clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
NeilFraser committed Jun 9, 2021
1 parent cff7b35 commit 861a981
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
3 changes: 1 addition & 2 deletions core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

/**
Expand Down
5 changes: 2 additions & 3 deletions core/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"');
};

/**
Expand Down
3 changes: 1 addition & 2 deletions core/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

/**
Expand Down
3 changes: 1 addition & 2 deletions core/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
};

/**
Expand Down
3 changes: 1 addition & 2 deletions core/names.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/**
Expand Down
7 changes: 3 additions & 4 deletions core/shortcut_registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion generators/php/procedures.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 861a981

Please sign in to comment.