Commit 7aad5f51 authored by carlosperate's avatar carlosperate

General comment clean up, minor code clean up.

parent bb5f52a4
......@@ -388,8 +388,8 @@ Blockly.Blocks['logic_negate'] = {
this.setTooltip(Blockly.Msg.LOGIC_NEGATE_TOOLTIP);
},
/**
* Assigns a type to the block, not input is meant to be a booleans, so it
* should return the same.
* Assigns a type to the block, not block input is meant to be a booleans, so
* it should return the same.
*/
getType: function() {
return 'boolean';
......@@ -433,7 +433,7 @@ Blockly.Blocks['logic_null'] = {
.appendField(Blockly.Msg.LOGIC_NULL);
this.setTooltip(Blockly.Msg.LOGIC_NULL_TOOLTIP);
}
// Null does not have a type, so no getType.
// Null does not have a type, so no getType. Might change this in the future.
};
Blockly.Blocks['logic_ternary'] = {
......
......@@ -173,7 +173,9 @@ Blockly.Blocks['controls_for'] = {
* Finds the type of the variable selected in the drop down. Sets it to an
* an integer if it has not been defined before.
* @this Blockly.Block
* @param {Array<string>} existingVars List of variables already defined.
* @param {Array<string>} existingVars Associative array of variables already
* defined. Variable name as the key,
* type as their value.
* @return {string} String to indicate the type if it has not been defined
* before.
*/
......@@ -183,7 +185,6 @@ Blockly.Blocks['controls_for'] = {
// Check if variable has been defined already
var varType = Blockly.StaticTyping.findListVarType(varName, existingVars);
if (varType != null) {
this.varType = varType;
if ((varType != 'int') && (varType != 'float')) {
this.setWarningText('This variable type has been previously set to a ' +
existingVars[varName] + ' and it needs to be a number!')
......@@ -193,22 +194,10 @@ Blockly.Blocks['controls_for'] = {
} else {
// not defined, so set it to an int
varType = 'int';
this.varType = 'int';
this.setWarningText(null);
}
return varType;
},
/**
* Contains the type of the variable selected from the drop down.
*/
varType: 'nonono',
/**
* Retrieves the type of the selected variable, defined at getVarType.
* @this Blockly.Block
*/
getType: function() {
return this.varType;
}
};
......
......@@ -61,7 +61,7 @@ Blockly.Blocks['text'] = {
return new Blockly.FieldImage(Blockly.pathToMedia + file, 12, 12, '"');
},
/**
* Assigns a type to the block, it always returns a string.
* Assigns a type to the block, text block is always a string.
*/
getType: function() {
return 'String';
......@@ -194,7 +194,7 @@ Blockly.Blocks['text_join'] = {
}
},
/**
* Assigns a type to the block, it always returns a string.
* Assigns a type to the block, this block always returns a string.
*/
getType: function() {
return 'String';
......@@ -278,7 +278,9 @@ Blockly.Blocks['text_append'] = {
* Finds the type of the variable selected in the drop down. Sets it to an
* a string if it has not been defined before.
* @this Blockly.Block
* @param {Array<string>} existingVars List of variables already defined.
* @param {Array<string>} existingVars Associativ array of variables already
* defined. Variable name as key, and
* type as value.
* @return {string} String to indicate the type if it has not been defined
* before.
*/
......
......@@ -86,10 +86,11 @@ Blockly.Blocks['variables_get'] = {
options.push(option);
},
/**
* Finds the type of the selected variable. Need to find the original
* variable set block to save the type into the varType block variable.
* Finds the type of the selected variable.
* @this Blockly.Block
* @param {Array<string>} existingVars List of variables already defined.
* @param {Array<string>} existingVars Associative array of variables already
* defined. Var names as key and type as
* value.
* @return {string} String to indicate the type if it has not been defined
* before.
*/
......@@ -167,7 +168,9 @@ Blockly.Blocks['variables_set'] = {
/**
* Searches through the nested blocks to find a variable type.
* @this Blockly.Block
* @param {Array<string>} existingVars List of variables already defined.
* @param {Array<string>} existingVars Associative array of variables already
* defined. Var name as the key, type as
* the value.
* @return {string} String to indicate the type if it has not been defined
* before.
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment