Adding some TODO comments referencing existing issues also discussed in this PR.

This commit is contained in:
Karishma Chadha 2017-11-20 17:15:04 -05:00
parent d9b5dc09ce
commit f84e764951
2 changed files with 5 additions and 0 deletions

View file

@ -182,6 +182,8 @@ Blockly.Variables.createVariable = function(workspace, opt_callback, opt_type) {
Blockly.Variables.promptName(Blockly.Msg.NEW_VARIABLE_TITLE, defaultName,
function(text) {
if (text) {
// TODO (#1245) use separate namespaces for lists, variables, and
// broadcast messages
if (workspace.getVariable(text)) {
Blockly.alert(Blockly.Msg.VARIABLE_ALREADY_EXISTS.replace('%1',
text.toLowerCase()),
@ -240,6 +242,8 @@ Blockly.Variables.renameVariable = function(workspace, variable,
function(newName) {
if (newName) {
var newVariable = workspace.getVariable(newName);
// TODO (#1245) use separate namespaces for lists, variables, and
// broadcast messages
if (newVariable && newVariable.type != variable.type) {
Blockly.alert(Blockly.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace('%1',
newName.toLowerCase()).replace('%2', newVariable.type),

View file

@ -112,6 +112,7 @@ Blockly.Xml.blockToDom = function(block, opt_noId) {
container.setAttribute('name', field.name);
if (field instanceof Blockly.FieldVariable || field instanceof
Blockly.FieldVariableGetter) {
// TODO (#1253) Lookup variable by id instead of name
var variable = block.workspace.getVariable(field.getValue());
if (variable) {
container.setAttribute('id', variable.getId());