mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +01:00
Add STATEMENT_SUFFIX
Also remove need to manually indent INFINITE_LOOP_TRAP. This is a breaking change for Python users of this property. However, very few users of this property exist, given that the existing code breaks if the block ID has a $ in it (also fixed in this PR).
This commit is contained in:
@@ -34,15 +34,21 @@ Blockly.Dart['procedures_defreturn'] = function(block) {
|
||||
var funcName = Blockly.Dart.variableDB_.getName(block.getFieldValue('NAME'),
|
||||
Blockly.Procedures.NAME_TYPE);
|
||||
var branch = Blockly.Dart.statementToCode(block, 'STACK');
|
||||
if (Blockly.Dart.STATEMENT_PREFIX) {
|
||||
var id = block.id.replace(/\$/g, '$$$$'); // Issue 251.
|
||||
var id = block.id.replace(/\$/g, '$$$$'); // Issue 251.
|
||||
if (Blockly.Dart.STATEMENT_SUFFIX) {
|
||||
branch = Blockly.Dart.prefixLines(
|
||||
Blockly.Dart.STATEMENT_PREFIX.replace(/%1/g,
|
||||
'\'' + id + '\''), Blockly.Dart.INDENT) + branch;
|
||||
Blockly.Dart.STATEMENT_SUFFIX.replace(/%1/g, '\'' + id + '\''),
|
||||
Blockly.Dart.INDENT) + branch;
|
||||
}
|
||||
if (Blockly.Dart.INFINITE_LOOP_TRAP) {
|
||||
branch = Blockly.Dart.INFINITE_LOOP_TRAP.replace(/%1/g,
|
||||
'\'' + block.id + '\'') + branch;
|
||||
branch = Blockly.Dart.prefixLines(
|
||||
Blockly.Dart.INFINITE_LOOP_TRAP.replace(/%1/g, '\'' + id + '\''),
|
||||
Blockly.Dart.INDENT) + branch;
|
||||
}
|
||||
if (Blockly.Dart.STATEMENT_PREFIX) {
|
||||
branch = Blockly.Dart.prefixLines(
|
||||
Blockly.Dart.STATEMENT_PREFIX.replace(/%1/g, '\'' + id + '\''),
|
||||
Blockly.Dart.INDENT) + branch;
|
||||
}
|
||||
var returnValue = Blockly.Dart.valueToCode(block, 'RETURN',
|
||||
Blockly.Dart.ORDER_NONE) || '';
|
||||
|
||||
Reference in New Issue
Block a user