Make type and variabletype attributes optional

If a variable doesn’t have a type, then don’t add these empty attributes in the XML.
This commit is contained in:
Neil Fraser
2019-07-12 15:04:36 -07:00
committed by Neil Fraser
parent 8abba6ae10
commit 829dcc207c
7 changed files with 27 additions and 25 deletions

View File

@@ -166,10 +166,10 @@ Blockly.VariableMap.prototype.renameVariableWithConflict_ = function(variable,
* Create a variable with a given name, optional type, and optional ID.
* @param {string} name The name of the variable. This must be unique across
* variables and procedures.
* @param {string=} opt_type The type of the variable like 'int' or 'string'.
* @param {?string=} opt_type The type of the variable like 'int' or 'string'.
* Does not need to be unique. Field_variable can filter variables based on
* their type. This will default to '' which is a specific type.
* @param {string=} opt_id The unique ID of the variable. This will default to
* @param {?string=} opt_id The unique ID of the variable. This will default to
* a UUID.
* @return {Blockly.VariableModel} The newly created variable.
*/