Merge pull request #954 from AnmAtAnm/warn-on-overwrite

Adding warning on duplicate JSON block definition.
This commit is contained in:
Andrew n marshall
2017-02-24 15:51:20 -08:00
committed by GitHub

View File

@@ -410,6 +410,10 @@ Blockly.defineBlocksWithJsonArray = function(jsonArray) {
console.warn('Block definition #' + i +
' in JSON array is missing a type attribute. Skipping.');
} else {
if (Blockly.Blocks[typename]) {
console.warn('Block definition #' + i +
' in JSON array overwrites prior definition of "' + typename + '".');
}
Blockly.Blocks[typename] = {
init: Blockly.jsonInitFactory_(elem)
};