rename variableDB to nameDB
rename variableDB_ to nameDB_ as it is deprecated
This commit is contained in:
		
							parent
							
								
									abfa5d0bed
								
							
						
					
					
						commit
						a8cf038821
					
				| @ -121,21 +121,21 @@ Blockly["Arduino"].init = function (workspace) { | |||||||
| 
 | 
 | ||||||
|   Blockly["Arduino"].variablesInitCode_ = ""; |   Blockly["Arduino"].variablesInitCode_ = ""; | ||||||
| 
 | 
 | ||||||
|   if (!Blockly["Arduino"].variableDB_) { |   if (!Blockly["Arduino"].nameDB_) { | ||||||
|     Blockly["Arduino"].variableDB_ = new Blockly.Names( |     Blockly["Arduino"].nameDB_ = new Blockly.Names( | ||||||
|       Blockly["Arduino"].RESERVED_WORDS_ |       Blockly["Arduino"].RESERVED_WORDS_ | ||||||
|     ); |     ); | ||||||
|   } else { |   } else { | ||||||
|     Blockly["Arduino"].variableDB_.reset(); |     Blockly["Arduino"].nameDB_.reset(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Blockly["Arduino"].variableDB_.setVariableMap(workspace.getVariableMap()); |   Blockly["Arduino"].nameDB_.setVariableMap(workspace.getVariableMap()); | ||||||
| 
 | 
 | ||||||
|   // We don't have developer variables for now
 |   // We don't have developer variables for now
 | ||||||
|   // // Add developer variables (not created or named by the user).
 |   // // Add developer variables (not created or named by the user).
 | ||||||
|   // var devVarList = Blockly.Variables.allDeveloperVariables(workspace);
 |   // var devVarList = Blockly.Variables.allDeveloperVariables(workspace);
 | ||||||
|   // for (var i = 0; i < devVarList.length; i++) {
 |   // for (var i = 0; i < devVarList.length; i++) {
 | ||||||
|   //     defvars.push(Blockly['Arduino'].variableDB_.getName(devVarList[i],
 |   //     defvars.push(Blockly['Arduino'].nameDB_.getName(devVarList[i],
 | ||||||
|   //         Blockly.Names.DEVELOPER_VARIABLE_TYPE));
 |   //         Blockly.Names.DEVELOPER_VARIABLE_TYPE));
 | ||||||
|   // }
 |   // }
 | ||||||
| 
 | 
 | ||||||
| @ -145,7 +145,7 @@ Blockly["Arduino"].init = function (workspace) { | |||||||
|   for (i = 0; i < doubleVariables.length; i += 1) { |   for (i = 0; i < doubleVariables.length; i += 1) { | ||||||
|     variableCode += |     variableCode += | ||||||
|       "double " + |       "double " + | ||||||
|       Blockly["Arduino"].variableDB_.getName( |       Blockly["Arduino"].nameDB_.getName( | ||||||
|         doubleVariables[i].getId(), |         doubleVariables[i].getId(), | ||||||
|         Blockly.Variables.NAME_TYPE |         Blockly.Variables.NAME_TYPE | ||||||
|       ) + |       ) + | ||||||
| @ -156,7 +156,7 @@ Blockly["Arduino"].init = function (workspace) { | |||||||
|   for (i = 0; i < stringVariables.length; i += 1) { |   for (i = 0; i < stringVariables.length; i += 1) { | ||||||
|     variableCode += |     variableCode += | ||||||
|       "String " + |       "String " + | ||||||
|       Blockly["Arduino"].variableDB_.getName( |       Blockly["Arduino"].nameDB_.getName( | ||||||
|         stringVariables[i].getId(), |         stringVariables[i].getId(), | ||||||
|         Blockly.Variables.NAME_TYPE |         Blockly.Variables.NAME_TYPE | ||||||
|       ) + |       ) + | ||||||
| @ -167,7 +167,7 @@ Blockly["Arduino"].init = function (workspace) { | |||||||
|   for (i = 0; i < booleanVariables.length; i += 1) { |   for (i = 0; i < booleanVariables.length; i += 1) { | ||||||
|     variableCode += |     variableCode += | ||||||
|       "boolean " + |       "boolean " + | ||||||
|       Blockly["Arduino"].variableDB_.getDistinctName( |       Blockly["Arduino"].nameDB_.getDistinctName( | ||||||
|         booleanVariables[i].getId(), |         booleanVariables[i].getId(), | ||||||
|         Blockly.Variables.NAME_TYPE |         Blockly.Variables.NAME_TYPE | ||||||
|       ) + |       ) + | ||||||
| @ -178,7 +178,7 @@ Blockly["Arduino"].init = function (workspace) { | |||||||
|   for (i = 0; i < colourVariables.length; i += 1) { |   for (i = 0; i < colourVariables.length; i += 1) { | ||||||
|     variableCode += |     variableCode += | ||||||
|       "RGB " + |       "RGB " + | ||||||
|       Blockly["Arduino"].variableDB_.getName( |       Blockly["Arduino"].nameDB_.getName( | ||||||
|         colourVariables[i].getId(), |         colourVariables[i].getId(), | ||||||
|         Blockly.Variables.NAME_TYPE |         Blockly.Variables.NAME_TYPE | ||||||
|       ) + |       ) + | ||||||
| @ -281,7 +281,7 @@ Blockly["Arduino"].finish = function (code) { | |||||||
|   delete Blockly["Arduino"].loopCodeOnce_; |   delete Blockly["Arduino"].loopCodeOnce_; | ||||||
|   delete Blockly["Arduino"].variablesInitCode_; |   delete Blockly["Arduino"].variablesInitCode_; | ||||||
|   delete Blockly["Arduino"].libraries_; |   delete Blockly["Arduino"].libraries_; | ||||||
|   Blockly["Arduino"].variableDB_.reset(); |   Blockly["Arduino"].nameDB_.reset(); | ||||||
| 
 | 
 | ||||||
|   return code; |   return code; | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -275,7 +275,7 @@ Blockly.Arduino["math_change"] = function (block) { | |||||||
|       "DELTA", |       "DELTA", | ||||||
|       Blockly.Arduino.ORDER_ADDITIVE |       Blockly.Arduino.ORDER_ADDITIVE | ||||||
|     ) || "0"; |     ) || "0"; | ||||||
|   var varName = Blockly.Arduino.variableDB_.getName( |   var varName = Blockly.Arduino.nameDB_.getName( | ||||||
|     block.getFieldValue("VAR"), |     block.getFieldValue("VAR"), | ||||||
|     Blockly.Variables.NAME_TYPE |     Blockly.Variables.NAME_TYPE | ||||||
|   ); |   ); | ||||||
|  | |||||||
| @ -1,5 +1,4 @@ | |||||||
| import * as Blockly from 'blockly/core'; | import * as Blockly from "blockly/core"; | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Code generator to add code into the setup() and loop() functions. |  * Code generator to add code into the setup() and loop() functions. | ||||||
| @ -7,121 +6,122 @@ import * as Blockly from 'blockly/core'; | |||||||
|  * @param {!Blockly.Block} block Block to generate the code from. |  * @param {!Blockly.Block} block Block to generate the code from. | ||||||
|  * @return {string} Completed code. |  * @return {string} Completed code. | ||||||
|  */ |  */ | ||||||
| Blockly.Arduino['arduino_functions'] = function (block) { | Blockly.Arduino["arduino_functions"] = function (block) { | ||||||
|     // Edited version of Blockly.Generator.prototype.statementToCode
 |   // Edited version of Blockly.Generator.prototype.statementToCode
 | ||||||
|     function statementToCodeNoTab(block, name) { |   function statementToCodeNoTab(block, name) { | ||||||
|         var targetBlock = block.getInputTargetBlock(name); |     var targetBlock = block.getInputTargetBlock(name); | ||||||
|         var code = Blockly.Arduino.blockToCode(targetBlock); |     var code = Blockly.Arduino.blockToCode(targetBlock); | ||||||
|         if (typeof code != 'string') { |     if (typeof code != "string") { | ||||||
|             throw new Error('Expecting code from statement block "' + targetBlock.type + '".'); |       throw new Error( | ||||||
|         } |         'Expecting code from statement block "' + targetBlock.type + '".' | ||||||
|         return code; |       ); | ||||||
|     } |     } | ||||||
|  |     return code; | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|     var setupBranch = Blockly.Arduino.statementToCode(block, 'SETUP_FUNC'); |   var setupBranch = Blockly.Arduino.statementToCode(block, "SETUP_FUNC"); | ||||||
|     // //var setupCode = Blockly.Arduino.scrub_(block, setupBranch); No comment block
 |   // //var setupCode = Blockly.Arduino.scrub_(block, setupBranch); No comment block
 | ||||||
|     if (setupBranch) { |   if (setupBranch) { | ||||||
|         Blockly.Arduino.setupCode_['mainsetup'] = setupBranch; |     Blockly.Arduino.setupCode_["mainsetup"] = setupBranch; | ||||||
|     } |   } | ||||||
| 
 | 
 | ||||||
|     var loopBranch = statementToCodeNoTab(block, 'LOOP_FUNC'); |   var loopBranch = statementToCodeNoTab(block, "LOOP_FUNC"); | ||||||
|     //var loopcode = Blockly.Arduino.scrub_(block, loopBranch); No comment block
 |   //var loopcode = Blockly.Arduino.scrub_(block, loopBranch); No comment block
 | ||||||
|     return loopBranch; |   return loopBranch; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| Blockly.Arduino['procedures_defreturn'] = function (block) { | Blockly.Arduino["procedures_defreturn"] = function (block) { | ||||||
|     // Define a procedure with a return value.
 |   // Define a procedure with a return value.
 | ||||||
|     const funcName = Blockly.Arduino.variableDB_.getName( |   const funcName = Blockly.Arduino.nameDB_.getName( | ||||||
|         block.getFieldValue('NAME'), |     block.getFieldValue("NAME"), | ||||||
|         Blockly.Procedures.NAME_TYPE |     Blockly.Procedures.NAME_TYPE | ||||||
|     ); |   ); | ||||||
|     const branch = Blockly.Arduino.statementToCode(block, 'STACK'); |   const branch = Blockly.Arduino.statementToCode(block, "STACK"); | ||||||
|     const returnType = block.getFieldValue('RETURN TYPE') || 'void'; |   const returnType = block.getFieldValue("RETURN TYPE") || "void"; | ||||||
| 
 | 
 | ||||||
|     let returnValue = |   let returnValue = | ||||||
|         Blockly.Arduino.valueToCode(block, 'RETURN', Blockly.Arduino.ORDER_NONE) || |     Blockly.Arduino.valueToCode(block, "RETURN", Blockly.Arduino.ORDER_NONE) || | ||||||
|         ''; |     ""; | ||||||
|     if (returnValue) { |   if (returnValue) { | ||||||
|         returnValue = Blockly.Arduino.INDENT + 'return ' + returnValue + ';\n'; |     returnValue = Blockly.Arduino.INDENT + "return " + returnValue + ";\n"; | ||||||
|     } |   } | ||||||
|     const args = []; |   const args = []; | ||||||
|     for (let i = 0; i < block.argumentVarModels_.length; i++) { |   for (let i = 0; i < block.argumentVarModels_.length; i++) { | ||||||
|         args[i] = |     args[i] = | ||||||
|             translateType(block.argumentVarModels_[i].type) + |       translateType(block.argumentVarModels_[i].type) + | ||||||
|             ' ' + |       " " + | ||||||
|             block.argumentVarModels_[i].name; |       block.argumentVarModels_[i].name; | ||||||
|     } |   } | ||||||
|     let code = |   let code = | ||||||
|         translateType(returnType) + |     translateType(returnType) + | ||||||
|         ' ' + |     " " + | ||||||
|         funcName + |     funcName + | ||||||
|         '(' + |     "(" + | ||||||
|         args.join(', ') + |     args.join(", ") + | ||||||
|         ') {\n' + |     ") {\n" + | ||||||
|         branch + |     branch + | ||||||
|         returnValue + |     returnValue + | ||||||
|         '}'; |     "}"; | ||||||
|     code = Blockly.Arduino.scrub_(block, code); |   code = Blockly.Arduino.scrub_(block, code); | ||||||
|     // Add % so as not to collide with helper functions in definitions list.
 |   // Add % so as not to collide with helper functions in definitions list.
 | ||||||
|     Blockly.Arduino.functionNames_['%' + funcName] = code; |   Blockly.Arduino.functionNames_["%" + funcName] = code; | ||||||
|     return null; |   return null; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| function translateType(type) { | function translateType(type) { | ||||||
|     switch (type) { |   switch (type) { | ||||||
| 
 |     case "int": | ||||||
|         case 'int': |       return "int"; | ||||||
|             return 'int'; |     case "String": | ||||||
|         case 'String': |       return "String"; | ||||||
|             return 'String'; |     case "void": | ||||||
|         case 'void': |       return "void"; | ||||||
|             return 'void'; |     case "boolean": | ||||||
|         case 'boolean': |       return "boolean"; | ||||||
|             return 'boolean'; |     case "float": | ||||||
|         case 'float': |       return "float"; | ||||||
|             return 'float' |     default: | ||||||
|         default: |       throw new Error("Invalid Parameter Type"); | ||||||
|             throw new Error('Invalid Parameter Type'); |   } | ||||||
|     } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Blockly.Arduino['procedures_defnoreturn'] = | Blockly.Arduino["procedures_defnoreturn"] = | ||||||
|     Blockly.Arduino['procedures_defreturn']; |   Blockly.Arduino["procedures_defreturn"]; | ||||||
| 
 | 
 | ||||||
| Blockly.Arduino['procedures_callreturn'] = function (block) { | Blockly.Arduino["procedures_callreturn"] = function (block) { | ||||||
|     // Call a procedure with a return value.
 |   // Call a procedure with a return value.
 | ||||||
|     const funcName = Blockly.Arduino.variableDB_.getName( |   const funcName = Blockly.Arduino.nameDB_.getName( | ||||||
|         block.getFieldValue('NAME'), |     block.getFieldValue("NAME"), | ||||||
|         Blockly.Procedures.NAME_TYPE |     Blockly.Procedures.NAME_TYPE | ||||||
|     ); |   ); | ||||||
|     const args = []; |   const args = []; | ||||||
|     for (let i = 0; i < block.arguments_.length; i++) { |   for (let i = 0; i < block.arguments_.length; i++) { | ||||||
|         args[i] = |     args[i] = | ||||||
|             Blockly.Arduino.valueToCode( |       Blockly.Arduino.valueToCode( | ||||||
|                 block, |         block, | ||||||
|                 'ARG' + i, |         "ARG" + i, | ||||||
|                 Blockly.Arduino.ORDER_COMMA |         Blockly.Arduino.ORDER_COMMA | ||||||
|             ) || 'null'; |       ) || "null"; | ||||||
|     } |   } | ||||||
|     const code = funcName + '(' + args.join(', ') + ')'; |   const code = funcName + "(" + args.join(", ") + ")"; | ||||||
|     return [code, Blockly.Arduino.ORDER_ATOMIC]; |   return [code, Blockly.Arduino.ORDER_ATOMIC]; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| Blockly.Arduino['procedures_callnoreturn'] = function (block) { | Blockly.Arduino["procedures_callnoreturn"] = function (block) { | ||||||
|     // Call a procedure with no return value.
 |   // Call a procedure with no return value.
 | ||||||
|     const funcName = Blockly.Arduino.variableDB_.getName( |   const funcName = Blockly.Arduino.nameDB_.getName( | ||||||
|         block.getFieldValue('NAME'), |     block.getFieldValue("NAME"), | ||||||
|         Blockly.Procedures.NAME_TYPE |     Blockly.Procedures.NAME_TYPE | ||||||
|     ); |   ); | ||||||
|     const args = []; |   const args = []; | ||||||
|     for (let i = 0; i < block.arguments_.length; i++) { |   for (let i = 0; i < block.arguments_.length; i++) { | ||||||
|         args[i] = |     args[i] = | ||||||
|             Blockly.Arduino.valueToCode( |       Blockly.Arduino.valueToCode( | ||||||
|                 block, |         block, | ||||||
|                 'ARG' + i, |         "ARG" + i, | ||||||
|                 Blockly.Arduino.ORDER_COMMA |         Blockly.Arduino.ORDER_COMMA | ||||||
|             ) || 'null'; |       ) || "null"; | ||||||
|     } |   } | ||||||
| 
 | 
 | ||||||
|     return funcName + '(' + args.join(', ') + ');\n'; |   return funcName + "(" + args.join(", ") + ");\n"; | ||||||
| }; | }; | ||||||
| @ -1,5 +1,4 @@ | |||||||
| import * as Blockly from 'blockly/core'; | import * as Blockly from "blockly/core"; | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Code generator for a literal String (X). |  * Code generator for a literal String (X). | ||||||
| @ -7,12 +6,11 @@ import * as Blockly from 'blockly/core'; | |||||||
|  * @param {!Blockly.Block} block Block to generate the code from. |  * @param {!Blockly.Block} block Block to generate the code from. | ||||||
|  * @return {array} Completed code with order of operation. |  * @return {array} Completed code with order of operation. | ||||||
|  */ |  */ | ||||||
| Blockly.Arduino['text'] = function (block) { | Blockly.Arduino["text"] = function (block) { | ||||||
|     var code = Blockly.Arduino.quote_(block.getFieldValue('TEXT')); |   var code = Blockly.Arduino.quote_(block.getFieldValue("TEXT")); | ||||||
|     return [code, Blockly.Arduino.ORDER_ATOMIC]; |   return [code, Blockly.Arduino.ORDER_ATOMIC]; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| /** | /** | ||||||
|  * Code generator for a String concatenation (X...Y). This string can be made |  * Code generator for a String concatenation (X...Y). This string can be made | ||||||
|  * up of any number of elements of any type. |  * up of any number of elements of any type. | ||||||
| @ -22,30 +20,37 @@ Blockly.Arduino['text'] = function (block) { | |||||||
|  * @param {!Blockly.Block} block Block to generate the code from. |  * @param {!Blockly.Block} block Block to generate the code from. | ||||||
|  * @return {array} Completed code with order of operation. |  * @return {array} Completed code with order of operation. | ||||||
|  */ |  */ | ||||||
| Blockly.Arduino['text_join'] = function (block) { | Blockly.Arduino["text_join"] = function (block) { | ||||||
|     var code; |   var code; | ||||||
|     if (block.itemCount_ === 0) { |   if (block.itemCount_ === 0) { | ||||||
|         return ['""', Blockly.Arduino.ORDER_ATOMIC]; |     return ['""', Blockly.Arduino.ORDER_ATOMIC]; | ||||||
|     } else if (block.itemCount_ === 1) { |   } else if (block.itemCount_ === 1) { | ||||||
|         var argument0 = Blockly.Arduino.valueToCode(block, 'ADD0', |     var argument0 = | ||||||
|             Blockly.Arduino.ORDER_UNARY_POSTFIX) || '""'; |       Blockly.Arduino.valueToCode( | ||||||
|         code = 'String(' + argument0 + ')'; |         block, | ||||||
|         return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX]; |         "ADD0", | ||||||
|     } else { |         Blockly.Arduino.ORDER_UNARY_POSTFIX | ||||||
|         var argument; |       ) || '""'; | ||||||
|         code = []; |     code = "String(" + argument0 + ")"; | ||||||
|         for (var n = 0; n < block.itemCount_; n++) { |     return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX]; | ||||||
|             argument = Blockly.Arduino.valueToCode( |   } else { | ||||||
|                 block, 'ADD' + n, Blockly.Arduino.ORDER_NONE); |     var argument; | ||||||
|             if (argument === '') { |     code = []; | ||||||
|                 code[n] = '""'; |     for (var n = 0; n < block.itemCount_; n++) { | ||||||
|             } else { |       argument = Blockly.Arduino.valueToCode( | ||||||
|                 code[n] = 'String(' + argument + ')'; |         block, | ||||||
|             } |         "ADD" + n, | ||||||
|         } |         Blockly.Arduino.ORDER_NONE | ||||||
|         code = code.join(' + '); |       ); | ||||||
|         return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX]; |       if (argument === "") { | ||||||
|  |         code[n] = '""'; | ||||||
|  |       } else { | ||||||
|  |         code[n] = "String(" + argument + ")"; | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|  |     code = code.join(" + "); | ||||||
|  |     return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX]; | ||||||
|  |   } | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -55,18 +60,23 @@ Blockly.Arduino['text_join'] = function (block) { | |||||||
|  * @param {!Blockly.Block} block Block to generate the code from. |  * @param {!Blockly.Block} block Block to generate the code from. | ||||||
|  * @return {string} Completed code. |  * @return {string} Completed code. | ||||||
|  */ |  */ | ||||||
| Blockly.Arduino['text_append'] = function (block) { | Blockly.Arduino["text_append"] = function (block) { | ||||||
|     // Append to a variable in place.
 |   // Append to a variable in place.
 | ||||||
|     var varName = Blockly.Arduino.variableDB_.getName( |   var varName = Blockly.Arduino.nameDB_.getName( | ||||||
|         block.getFieldValue('VAR'), Blockly.Variables.NAME_TYPE); |     block.getFieldValue("VAR"), | ||||||
|     var argument0 = Blockly.Arduino.valueToCode(block, 'TEXT', |     Blockly.Variables.NAME_TYPE | ||||||
|         Blockly.Arduino.ORDER_UNARY_POSTFIX); |   ); | ||||||
|     if (argument0 === '') { |   var argument0 = Blockly.Arduino.valueToCode( | ||||||
|         argument0 = '""'; |     block, | ||||||
|     } else { |     "TEXT", | ||||||
|         argument0 = 'String(' + argument0 + ')'; |     Blockly.Arduino.ORDER_UNARY_POSTFIX | ||||||
|     } |   ); | ||||||
|     return varName + ' += ' + argument0 + ';\n'; |   if (argument0 === "") { | ||||||
|  |     argument0 = '""'; | ||||||
|  |   } else { | ||||||
|  |     argument0 = "String(" + argument0 + ")"; | ||||||
|  |   } | ||||||
|  |   return varName + " += " + argument0 + ";\n"; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -76,10 +86,13 @@ Blockly.Arduino['text_append'] = function (block) { | |||||||
|  * @param {!Blockly.Block} block Block to generate the code from. |  * @param {!Blockly.Block} block Block to generate the code from. | ||||||
|  * @return {array} Completed code with order of operation. |  * @return {array} Completed code with order of operation. | ||||||
|  */ |  */ | ||||||
| Blockly.Arduino['text_length'] = function (block) { | Blockly.Arduino["text_length"] = function (block) { | ||||||
|     var argument0 = Blockly.Arduino.valueToCode(block, 'VALUE', |   var argument0 = | ||||||
|         Blockly.Arduino.ORDER_UNARY_POSTFIX) || '""'; |     Blockly.Arduino.valueToCode( | ||||||
|     var code = 'String(' + argument0 + ').length()'; |       block, | ||||||
|     return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX]; |       "VALUE", | ||||||
|  |       Blockly.Arduino.ORDER_UNARY_POSTFIX | ||||||
|  |     ) || '""'; | ||||||
|  |   var code = "String(" + argument0 + ").length()"; | ||||||
|  |   return [code, Blockly.Arduino.ORDER_UNARY_POSTFIX]; | ||||||
| }; | }; | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -2,7 +2,7 @@ import Blockly from "blockly"; | |||||||
| 
 | 
 | ||||||
| const setVariableFunction = function (defaultValue) { | const setVariableFunction = function (defaultValue) { | ||||||
|   return function (block) { |   return function (block) { | ||||||
|     const variableName = Blockly["Arduino"].variableDB_.getName( |     const variableName = Blockly["Arduino"].nameDB_.getName( | ||||||
|       block.getFieldValue("VAR"), |       block.getFieldValue("VAR"), | ||||||
|       Blockly.Variables.NAME_TYPE |       Blockly.Variables.NAME_TYPE | ||||||
|     ); |     ); | ||||||
| @ -48,7 +48,7 @@ const setVariableFunction = function (defaultValue) { | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| const getVariableFunction = function (block) { | const getVariableFunction = function (block) { | ||||||
|   const variableName = Blockly["Arduino"].variableDB_.getName( |   const variableName = Blockly["Arduino"].nameDB_.getName( | ||||||
|     block.getFieldValue("VAR"), |     block.getFieldValue("VAR"), | ||||||
|     Blockly.Variables.NAME_TYPE |     Blockly.Variables.NAME_TYPE | ||||||
|   ); |   ); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user