mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +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:
@@ -73,17 +73,17 @@ Blockly.JavaScript['text_append'] = function(block) {
|
||||
};
|
||||
|
||||
Blockly.JavaScript['text_length'] = function(block) {
|
||||
// String length.
|
||||
// String or array length.
|
||||
var argument0 = Blockly.JavaScript.valueToCode(block, 'VALUE',
|
||||
Blockly.JavaScript.ORDER_FUNCTION_CALL) || '\'\'';
|
||||
return [argument0 + '.length', Blockly.JavaScript.ORDER_MEMBER];
|
||||
};
|
||||
|
||||
Blockly.JavaScript['text_isEmpty'] = function(block) {
|
||||
// Is the string null?
|
||||
// Is the string null or array empty?
|
||||
var argument0 = Blockly.JavaScript.valueToCode(block, 'VALUE',
|
||||
Blockly.JavaScript.ORDER_MEMBER) || '\'\'';
|
||||
return ['!' + argument0, Blockly.JavaScript.ORDER_LOGICAL_NOT];
|
||||
return ['!' + argument0 + '.length', Blockly.JavaScript.ORDER_LOGICAL_NOT];
|
||||
};
|
||||
|
||||
Blockly.JavaScript['text_indexOf'] = function(block) {
|
||||
|
||||
Reference in New Issue
Block a user