[patch] Make Codegen ObjectMethod call compatible with babel v7.7
--- Tested on - with RunForget ([before](P897673438), [after](P897678035)) Compiles 12 more files
Mofei Zhang committed
Dec 6, 2023 at 13:20 UTC
01c1b16db45b5894d248363fcc7c15874448c284
1 file changed
+13
-10
compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts
+13
-10
@@ -1318,17 +1318,20 @@ function codegenInstructionValue(
1318
renameVariables(reactiveFunction);
1319
const fn = codegenReactiveFunction(reactiveFunction).unwrap();
1320
1321
- properties.push(
1322
- t.objectMethod(
1323
- "method",
1324
- key,
1325
- fn.params,
1326
- fn.body,
1327
- false,
1328
- fn.generator,
1329
- fn.async
1330
- )
1321
+ /*
1322
+ * ObjectMethod builder must be backwards compatible with older versions of babel.
1323
+ * https://github.com/babel/babel/blob/v7.7.4/packages/babel-types/src/definitions/core.js#L599-L603
1324
+ */
1325
+ const babelNode = t.objectMethod(
1326
+ "method",
1327
+ key,
1328
+ fn.params,
1329
+ fn.body,
1330
+ false
1331
);
1332
+ babelNode.async = fn.async;
1333
+ babelNode.generator = fn.generator;
1334
+ properties.push(babelNode);
1335
break;
1336
}
1337
default: