Create block id database.

This commit is contained in:
Neil Fraser 2015-12-09 10:02:42 +01:00
parent b2bbde04a1
commit 3b3ef79fbd
9 changed files with 84 additions and 70 deletions

View file

@ -202,6 +202,8 @@ Blockly.Generator.prototype.valueToCode = function(block, name, order) {
}
// Value blocks must return code and order of operations info.
// Statement blocks must only return code.
goog.asserts.assertArray(tuple, 'Expecting tuple from value block "%s".',
targetBlock.type);
var code = tuple[0];
var innerOrder = tuple[1];
if (isNaN(innerOrder)) {
@ -237,6 +239,7 @@ Blockly.Generator.prototype.statementToCode = function(block, name) {
var code = this.blockToCode(targetBlock);
// Value blocks must return code and order of operations info.
// Statement blocks must only return code.
goog.asserts.assertString(code, 'Expecting code from statement block "%s".',
targetBlock && targetBlock.type);
if (code) {
code = this.prefixLines(/** @type {string} */ (code), this.INDENT);