Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addMissingDependencies task duplicate variable name #249

Open
tobiasso85 opened this issue Sep 6, 2022 · 0 comments
Open

addMissingDependencies task duplicate variable name #249

tobiasso85 opened this issue Sep 6, 2022 · 0 comments

Comments

@tobiasso85
Copy link
Contributor

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;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant