chore: replace var with const and let in python block generators (#5650)

* chore: replace var with const and let in python block generators

* chore: update test deps

* chore: update bracket usage in switch statements
This commit is contained in:
Rachel Fenichel
2021-10-29 11:02:58 -07:00
committed by GitHub
parent f0a874ca27
commit db78d9f280
9 changed files with 342 additions and 312 deletions

View File

@@ -16,16 +16,17 @@ goog.require('Blockly.Python');
Blockly.Python['variables_get'] = function(block) {
// Variable getter.
var code = Blockly.Python.nameDB_.getName(block.getFieldValue('VAR'),
const code = Blockly.Python.nameDB_.getName(block.getFieldValue('VAR'),
Blockly.VARIABLE_CATEGORY_NAME);
return [code, Blockly.Python.ORDER_ATOMIC];
};
Blockly.Python['variables_set'] = function(block) {
// Variable setter.
var argument0 = Blockly.Python.valueToCode(block, 'VALUE',
Blockly.Python.ORDER_NONE) || '0';
var varName = Blockly.Python.nameDB_.getName(block.getFieldValue('VAR'),
Blockly.VARIABLE_CATEGORY_NAME);
const argument0 =
Blockly.Python.valueToCode(block, 'VALUE', Blockly.Python.ORDER_NONE) ||
'0';
const varName = Blockly.Python.nameDB_.getName(
block.getFieldValue('VAR'), Blockly.VARIABLE_CATEGORY_NAME);
return varName + ' = ' + argument0 + '\n';
};