mirror of
https://github.com/google/blockly.git
synced 2025-12-16 06:10:12 +01:00
Fixing operator precedence in Lua and and adding test. (#3765)
* Fixing operator precedence in Lua and and adding test. * Updating golden files.
This commit is contained in:
@@ -17,7 +17,7 @@ goog.require('Blockly.Lua');
|
||||
|
||||
Blockly.Lua['lists_create_empty'] = function(block) {
|
||||
// Create an empty list.
|
||||
return ['{}', Blockly.Lua.ORDER_ATOMIC];
|
||||
return ['{}', Blockly.Lua.ORDER_HIGH];
|
||||
};
|
||||
|
||||
Blockly.Lua['lists_create_with'] = function(block) {
|
||||
@@ -28,7 +28,7 @@ Blockly.Lua['lists_create_with'] = function(block) {
|
||||
Blockly.Lua.ORDER_NONE) || 'None';
|
||||
}
|
||||
var code = '{' + elements.join(', ') + '}';
|
||||
return [code, Blockly.Lua.ORDER_ATOMIC];
|
||||
return [code, Blockly.Lua.ORDER_HIGH];
|
||||
};
|
||||
|
||||
Blockly.Lua['lists_repeat'] = function(block) {
|
||||
@@ -126,7 +126,7 @@ Blockly.Lua['lists_getIndex'] = function(block) {
|
||||
var mode = block.getFieldValue('MODE') || 'GET';
|
||||
var where = block.getFieldValue('WHERE') || 'FROM_START';
|
||||
var list = Blockly.Lua.valueToCode(block, 'VALUE', Blockly.Lua.ORDER_HIGH) ||
|
||||
'{}';
|
||||
'({})';
|
||||
var getIndex_ = Blockly.Lua.lists.getIndex_;
|
||||
|
||||
// If `list` would be evaluated more than once (which is the case for LAST,
|
||||
|
||||
Reference in New Issue
Block a user