disallow variables on shadow blocks

This commit is contained in:
Rachel Fenichel
2016-09-23 18:19:16 -07:00
parent ea846abc9f
commit 6a882ca2e8
2 changed files with 14 additions and 0 deletions

View File

@@ -535,6 +535,9 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) {
goog.asserts.assert(child.isShadow(),
'Shadow block not allowed non-shadow child.');
}
// Ensure this block doesn't have any variable inputs.
goog.asserts.assert(block.getVars().length == 0,
'Shadow blocks cannot have variable fields.');
block.setShadow(true);
}
return block;