Skip to content

Commit

Permalink
fix: actually remove also ControllerExtension.use() inside sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
akudev committed Sep 13, 2024
1 parent aaa6e21 commit 33c7003
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/plugin/__test__/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1885,10 +1885,10 @@ exports[`typescript ts-class-controller-extension-wrapped.ts 1`] = `
};
};
const MyExtendedController = Controller.extend("test.controller.MyExtendedController", {
routing4: (cov_1uvvg22e7l().s[5]++, ControllerExtension.use(Routing.override({})), ControllerExtension.use(Routing)),
routing3: (cov_1uvvg22e7l().s[5]++, cov_1uvvg22e7l().s[5]++, ControllerExtension.use(Routing.override({}))),
routing2: (cov_1uvvg22e7l().s[5]++, ControllerExtension.use(Routing.override({}))),
routing: (cov_1uvvg22e7l().s[5]++, ControllerExtension.use(Routing))
routing4: (cov_1uvvg22e7l().s[5]++, ControllerExtension.use(Routing.override({})), Routing),
routing3: (cov_1uvvg22e7l().s[5]++, cov_1uvvg22e7l().s[5]++, Routing.override({})),
routing2: (cov_1uvvg22e7l().s[5]++, Routing.override({})),
routing: (cov_1uvvg22e7l().s[5]++, Routing)
});
return MyExtendedController;
});"
Expand Down
7 changes: 5 additions & 2 deletions packages/plugin/src/classes/helpers/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,13 @@ export function convertClassToUI5Extend(
// this.routing = (cov_1uvvg22e7l().s[5]++, ControllerExtension.use(Routing.override({ … })));
if (
t.isSequenceExpression(rightSide) &&
rightSide.expressions.some((expression) =>
isCallToControllerExtensionUse(expression, memberPath)
isCallToControllerExtensionUse(
rightSide.expressions[rightSide.expressions.length - 1],
memberPath
)
) {
rightSide.expressions[rightSide.expressions.length - 1] =
rightSide.expressions[rightSide.expressions.length - 1].arguments[0];
member.value = rightSide;
extendProps.unshift(buildObjectProperty(member)); // add it to the properties of the extend() config object
continue; // prevent the member from also being added to the constructor
Expand Down

0 comments on commit 33c7003

Please sign in to comment.