babel-plugin-react-compiler 0.0.0-experimental-179bb06-20241211 → 0.0.0-experimental-1e8c174-20241215
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +23 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -125850,6 +125850,9 @@ function isPrimitiveType(id) {
|
|
125850
125850
|
function isArrayType(id) {
|
125851
125851
|
return id.type.kind === 'Object' && id.type.shapeId === 'BuiltInArray';
|
125852
125852
|
}
|
125853
|
+
function isPropsType(id) {
|
125854
|
+
return id.type.kind === 'Object' && id.type.shapeId === 'BuiltInProps';
|
125855
|
+
}
|
125853
125856
|
function isRefValueType(id) {
|
125854
125857
|
return id.type.kind === 'Object' && id.type.shapeId === 'BuiltInRefValue';
|
125855
125858
|
}
|
@@ -157269,6 +157272,24 @@ function emitDestructureProps(env, propsObj, oldToNewProps) {
|
|
157269
157272
|
};
|
157270
157273
|
return destructurePropsInstr;
|
157271
157274
|
}
|
157275
|
+
function optimizePropsMethodCalls(fn) {
|
157276
|
+
for (const [, block] of fn.body.blocks) {
|
157277
|
+
for (let i = 0; i < block.instructions.length; i++) {
|
157278
|
+
const instr = block.instructions[i];
|
157279
|
+
if (
|
157280
|
+
instr.value.kind === 'MethodCall' &&
|
157281
|
+
isPropsType(instr.value.receiver.identifier)
|
157282
|
+
) {
|
157283
|
+
instr.value = {
|
157284
|
+
kind: 'CallExpression',
|
157285
|
+
callee: instr.value.property,
|
157286
|
+
args: instr.value.args,
|
157287
|
+
loc: instr.value.loc,
|
157288
|
+
};
|
157289
|
+
}
|
157290
|
+
}
|
157291
|
+
}
|
157292
|
+
}
|
157272
157293
|
function* run(
|
157273
157294
|
func,
|
157274
157295
|
config,
|
@@ -157340,6 +157361,8 @@ function* runWithEnvironment(func, env) {
|
|
157340
157361
|
if (env.config.lowerContextAccess) {
|
157341
157362
|
lowerContextAccess(hir, env.config.lowerContextAccess);
|
157342
157363
|
}
|
157364
|
+
optimizePropsMethodCalls(hir);
|
157365
|
+
yield log({kind: 'hir', name: 'OptimizePropsMethodCalls', value: hir});
|
157343
157366
|
analyseFunctions(hir);
|
157344
157367
|
yield log({kind: 'hir', name: 'AnalyseFunctions', value: hir});
|
157345
157368
|
inferReferenceEffects(hir);
|
package/package.json
CHANGED