Cleaned up unamed handling w/ safename.

This commit is contained in:
Beka Westberg
2019-07-08 10:48:42 -07:00
parent bb19b4ce0c
commit 7b02728ff2
2 changed files with 2 additions and 2 deletions

View File

@@ -172,7 +172,7 @@ Blockly.Names.prototype.getDistinctName = function(name, type) {
*/
Blockly.Names.prototype.safeName_ = function(name) {
if (!name) {
name = 'unnamed';
name = Blockly.Msg['UNNAMED_KEY'] || 'unnamed';
} else {
// Unfortunately names in non-latin characters will look like
// _E9_9F_B3_E4_B9_90 which is pretty meaningless.

View File

@@ -103,7 +103,7 @@ Blockly.Procedures.findLegalName = function(name, block) {
// Flyouts can have multiple procedures called 'do something'.
return name;
}
name = name || Blockly.Msg['UNNAMED_KEY'];
name = name || Blockly.Msg['UNNAMED_KEY'] || 'unnamed';
while (!Blockly.Procedures.isLegalName_(name, block.workspace, block)) {
// Collision with another procedure.
var r = name.match(/^(.*?)(\d+)$/);