mirror of
https://github.com/google/blockly.git
synced 2026-01-04 07:30:08 +01:00
Rename variableDB_ to nameDB_
There is significant confusion in names and comments with regards to variables and procedures. `Blockly.Generator.prototype.variableDB_` is a Blockly.Names database, not a variable map. This rename introduces a getter and setter so deprecated references still work. This commit also fixes some comments which are either outright wrong or misleading regarding variable and procedure names.
This commit is contained in:
@@ -187,7 +187,7 @@ Blockly.Python['lists_setIndex'] = function(block) {
|
||||
if (list.match(/^\w+$/)) {
|
||||
return '';
|
||||
}
|
||||
var listVar = Blockly.Python.variableDB_.getDistinctName(
|
||||
var listVar = Blockly.Python.nameDB_.getDistinctName(
|
||||
'tmp_list', Blockly.VARIABLE_CATEGORY_NAME);
|
||||
var code = listVar + ' = ' + list + '\n';
|
||||
list = listVar;
|
||||
@@ -228,7 +228,7 @@ Blockly.Python['lists_setIndex'] = function(block) {
|
||||
case 'RANDOM':
|
||||
Blockly.Python.definitions_['import_random'] = 'import random';
|
||||
var code = cacheList();
|
||||
var xVar = Blockly.Python.variableDB_.getDistinctName(
|
||||
var xVar = Blockly.Python.nameDB_.getDistinctName(
|
||||
'tmp_x', Blockly.VARIABLE_CATEGORY_NAME);
|
||||
code += xVar + ' = int(random.random() * len(' + list + '))\n';
|
||||
if (mode == 'SET') {
|
||||
|
||||
Reference in New Issue
Block a user