From 33c70038268181365fc1bf2cffed90da29bb452d Mon Sep 17 00:00:00 2001 From: akudev Date: Fri, 13 Sep 2024 18:37:56 +0200 Subject: [PATCH] fix: actually remove also ControllerExtension.use() inside sequences --- packages/plugin/__test__/__snapshots__/test.js.snap | 8 ++++---- packages/plugin/src/classes/helpers/classes.js | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/plugin/__test__/__snapshots__/test.js.snap b/packages/plugin/__test__/__snapshots__/test.js.snap index b44f49a..54f8b47 100644 --- a/packages/plugin/__test__/__snapshots__/test.js.snap +++ b/packages/plugin/__test__/__snapshots__/test.js.snap @@ -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; });" diff --git a/packages/plugin/src/classes/helpers/classes.js b/packages/plugin/src/classes/helpers/classes.js index ffbf10d..2c2d220 100644 --- a/packages/plugin/src/classes/helpers/classes.js +++ b/packages/plugin/src/classes/helpers/classes.js @@ -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