Fix order errors in text generators (#4329)

* Fix dart text generator logic

* Fix Javascript text generator logic.

* Fix Lua text generator logic

* Fix php text generator logic

* Fix python text generator logic

* Fix error in substring logic

* Fix unit test block generators

* Update from ORDER_COMMA to ORDER_NONE

* Update golden files
This commit is contained in:
Monica Kozbial
2020-09-30 14:08:45 -07:00
committed by GitHub
parent 64fe425944
commit 81d355f5fa
17 changed files with 139 additions and 118 deletions

View File

@@ -24,7 +24,9 @@ Blockly.Lua['text'] = function(block) {
Blockly.Lua['text_multiline'] = function(block) {
// Text value.
var code = Blockly.Lua.multiline_quote_(block.getFieldValue('TEXT'));
return [code, Blockly.Lua.ORDER_ATOMIC];
var order = code.indexOf('..') != -1 ? Blockly.Lua.ORDER_CONCATENATION :
Blockly.Lua.ORDER_ATOMIC;
return [code, order];
};
Blockly.Lua['text_join'] = function(block) {
@@ -347,7 +349,7 @@ Blockly.Lua['text_replace'] = function(block) {
Blockly.Lua['text_reverse'] = function(block) {
var text = Blockly.Lua.valueToCode(block, 'TEXT',
Blockly.Lua.ORDER_HIGH) || '\'\'';
Blockly.Lua.ORDER_NONE) || '\'\'';
var code = 'string.reverse(' + text + ')';
return [code, Blockly.Lua.ORDER_HIGH];
};