@@ -68,12 +68,10 @@ function createSuperExpressionStatement(j) {
6868 * @param {MethodDefinition } methodDefinition - MethodDefinition to replce instances from
6969 * @returns {MethodDefinition }
7070 */
71- function replaceSuperExpressions (
72- j ,
73- methodDefinition ,
74- replaceWithUndefined ,
75- isAction = false
76- ) {
71+ function replaceSuperExpressions ( j , methodDefinition , functionProp ) {
72+ const replaceWithUndefined = functionProp . hasRuntimeData
73+ ? ! functionProp . isOverridden
74+ : false ;
7775 const superExprs = j ( methodDefinition ) . find ( j . CallExpression , {
7876 callee : {
7977 type : "MemberExpression" ,
@@ -93,7 +91,9 @@ function replaceSuperExpressions(
9391 } else {
9492 let superMethodCall ;
9593 const superMethodArgs = get ( superExpr , "value.arguments" ) || [ ] ;
96- if ( isAction ) {
94+ if ( functionProp . isComputed ) {
95+ superMethodCall = j . memberExpression ( j . super ( ) , functionProp . key ) ;
96+ } else if ( functionProp . isAction ) {
9797 superMethodCall = j . callExpression (
9898 j . memberExpression (
9999 j . memberExpression (
@@ -131,24 +131,15 @@ function replaceSuperExpressions(
131131 * @param {Decorator[] } decorators
132132 * @returns {MethodDefinition[] }
133133 */
134- function createMethodProp (
135- j ,
136- functionProp ,
137- decorators = [ ] ,
138- replaceWithUndefined = false ,
139- isAction = false
140- ) {
134+ function createMethodProp ( j , functionProp , decorators = [ ] ) {
141135 const propKind = functionProp . kind === "init" ? "method" : functionProp . kind ;
142- if ( functionProp . hasRuntimeData ) {
143- replaceWithUndefined = ! functionProp . isOverridden ;
144- }
136+
145137 return withDecorators (
146138 withComments (
147139 replaceSuperExpressions (
148140 j ,
149141 j . methodDefinition ( propKind , functionProp . key , functionProp . value ) ,
150- replaceWithUndefined ,
151- isAction
142+ functionProp
152143 ) ,
153144 functionProp
154145 ) ,
@@ -232,16 +223,12 @@ function createActionDecoratedProps(j, actionsProp) {
232223 const actionProps = get ( actionsProp , "value.properties" ) ;
233224 const overriddenActions = get ( actionsProp , "overriddenActions" ) || [ ] ;
234225 const actionDecorators = createIdentifierDecorators ( j ) ;
235- return actionProps . map ( actionProp =>
236- createMethodProp (
237- j ,
238- actionProp ,
239- actionDecorators ,
240- actionsProp . hasRuntimeData &&
241- ! overriddenActions . includes ( actionProp . key . name ) ,
242- true
243- )
244- ) ;
226+ return actionProps . map ( actionProp => {
227+ actionProp . isAction = true ;
228+ actionProp . hasRuntimeData = actionsProp . hasRuntimeData ;
229+ actionProp . isOverridden = overriddenActions . includes ( actionProp . key . name ) ;
230+ return createMethodProp ( j , actionProp , actionDecorators ) ;
231+ } ) ;
245232}
246233
247234/**
@@ -258,6 +245,7 @@ function createCallExpressionProp(j, callExprProp) {
258245
259246 if ( lastArgType === "FunctionExpression" ) {
260247 const functionExpr = {
248+ isComputed : true ,
261249 kind : callExprProp . kind ,
262250 key : callExprProp . key ,
263251 value : callExprLastArg ,
@@ -272,6 +260,7 @@ function createCallExpressionProp(j, callExprProp) {
272260 ] ;
273261 } else if ( lastArgType === "ObjectExpression" ) {
274262 const callExprMethods = callExprLastArg . properties . map ( callExprFunction => {
263+ callExprFunction . isComputed = true ;
275264 callExprFunction . kind = getPropName ( callExprFunction ) ;
276265 callExprFunction . key = callExprProp . key ;
277266 callExprFunction . value . params . shift ( ) ;
0 commit comments