ui5-migration
ui5-migration copied to clipboard
addMissingDependencies task duplicate variable name
During a replacement with addMissingDependencies and a config which contains newVariableName and newModulePath there can be a nameclash which produces invalid code:
config.json:
"*.control": {
"newModulePath": "sap/ui/core/Element",
"newVariableName": "Element",
"replacer": "Module",
"finder": "NewExpressionFinder",
"newExpressionCalleeName": "ReplaceMe"
"extender": "AddImport"
}
source:
sap.ui.define(["sap/me/Element"],
function(Element) {
"use strict";
Element.foo();
var x = new ReplaceMe();
});
current behaviour:
sap.ui.define(["sap/me/Element", "sap/ui/core/Element"],
function(Element, Element) {
"use strict";
Element.foo();
var x = Element;
});
Here the Element variable is duplicated and this is invalid code.
target behaviour:
source:
sap.ui.define(["sap/me/Element", "sap/ui/core/Element"],
function(Element, CoreElement) {
"use strict";
Element.foo();
var x = CoreElement;
});