mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
Fix JS and PHP list/text blocks.
The length and is_empty blocks can take either text or lists.
This commit is contained in:
@@ -56,14 +56,14 @@ Blockly.Python['lists_repeat'] = function(block) {
|
||||
};
|
||||
|
||||
Blockly.Python['lists_length'] = function(block) {
|
||||
// List length.
|
||||
// String or array length.
|
||||
var argument0 = Blockly.Python.valueToCode(block, 'VALUE',
|
||||
Blockly.Python.ORDER_NONE) || '[]';
|
||||
return ['len(' + argument0 + ')', Blockly.Python.ORDER_FUNCTION_CALL];
|
||||
};
|
||||
|
||||
Blockly.Python['lists_isEmpty'] = function(block) {
|
||||
// Is the list empty?
|
||||
// Is the string null or array empty?
|
||||
var argument0 = Blockly.Python.valueToCode(block, 'VALUE',
|
||||
Blockly.Python.ORDER_NONE) || '[]';
|
||||
var code = 'not len(' + argument0 + ')';
|
||||
|
||||
Reference in New Issue
Block a user