mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
Remove extra else clauses
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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"');
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.');
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user