GOT ERR: Expecting string from statement block:

423 views
Skip to first unread message

Ray gautam

unread,
Nov 27, 2019, 3:31:02 AM11/27/19
to Blockly
here is the code: 
Blockly.JavaScript[`hatch_${dropName}`] = function(block) {
const blockName = block.getFieldValue(`DROP_hatch_${dropName}`);
const valueInput = Blockly.JavaScript.valueToCode(
block,
`name_hatch_${dropName}`,
Blockly.JavaScript.ORDER_ATOMIC,
);
const stmtValue = hasCallback
? Blockly.JavaScript.statementToCode(block, `hatch_${dropName}_statement`)
: '';

const code = !hasCallback
? `${entity}.${blockName}(${valueInput})\n`
: `${entity}.${blockName}(${valueInput}, function(event) {
${stmtValue}
})\n`;
return [code, Blockly.JavaScript.ORDER_NONE];
};


any idea is why is this is happening ?

Amber B

unread,
Nov 27, 2019, 8:49:01 AM11/27/19
to Blockly
I believe it can happen if the block in question is missing the outputConnection. Can we see the generator code for this block as well? (E.g. the Blockly.Blocks[`hatch_${dropName}`] definition)

Ray gautam

unread,
Nov 28, 2019, 6:44:43 AM11/28/19
to Blockly
thanks , for the reply , yeah will look into it, 
Reply all
Reply to author
Forward
0 new messages