fix(boards): 修复arduino下变量名大小写不敏感

This commit is contained in:
王立帮
2025-10-19 19:46:25 +08:00
parent 6b1bd254f5
commit aaf5ffedec
3 changed files with 5 additions and 5 deletions

View File

@@ -121,7 +121,7 @@ Names.prototype.getName = function (name, type) {
name = varName; name = varName;
} }
} }
var normalized = name.toLowerCase() + '_' + type; var normalized = name + '_' + type;
var isVarType = type == Variables.NAME_TYPE || var isVarType = type == Variables.NAME_TYPE ||
type == Names.DEVELOPER_VARIABLE_TYPE; type == Names.DEVELOPER_VARIABLE_TYPE;
@@ -193,7 +193,7 @@ Names.prototype.safeName_ = function (name) {
* @return {boolean} True if names are the same. * @return {boolean} True if names are the same.
*/ */
Names.equals = function (name1, name2) { Names.equals = function (name1, name2) {
return name1.toLowerCase() == name2.toLowerCase(); return name1 == name2;
}; };
export default Names; export default Names;

View File

@@ -90,7 +90,7 @@ Variables.allVariables = function (root) {
var varName = blockVariables[y]; var varName = blockVariables[y];
// Variable name may be null if the block is only half-built. // Variable name may be null if the block is only half-built.
if (varName) { if (varName) {
variableHash[varName.toLowerCase()] = varName; variableHash[varName] = varName;
} }
} }
} }
@@ -222,7 +222,7 @@ Variables.generateUniqueName = function (workspace) {
while (!newName) { while (!newName) {
var inUse = false; var inUse = false;
for (var i = 0; i < variableList.length; i++) { for (var i = 0; i < variableList.length; i++) {
if (variableList[i].toLowerCase() == potName) { if (variableList[i] == potName) {
// This potential name is already used. // This potential name is already used.
inUse = true; inUse = true;
break; break;

View File

@@ -52,7 +52,7 @@ class Names {
* @return {boolean} True if names are the same. * @return {boolean} True if names are the same.
*/ */
static equals(name1, name2) { static equals(name1, name2) {
return name1.toLowerCase() == name2.toLowerCase(); return name1 == name2;
} }
/** /**
* When JavaScript (or most other languages) is generated, variable 'foo' and * When JavaScript (or most other languages) is generated, variable 'foo' and