babel-plugin-react-compiler 0.0.0-experimental-54240be-20241206 → 0.0.0-experimental-ba7b8e5-20241210
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 +92 -79
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -129921,9 +129921,7 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
129921
129921
|
_26,
|
129922
129922
|
_27,
|
129923
129923
|
_28,
|
129924
|
-
_29
|
129925
|
-
_30,
|
129926
|
-
_31;
|
129924
|
+
_29;
|
129927
129925
|
const stmtNode = stmtPath.node;
|
129928
129926
|
switch (stmtNode.type) {
|
129929
129927
|
case 'ThrowStatement': {
|
@@ -130765,6 +130763,12 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130765
130763
|
? _14
|
130766
130764
|
: GeneratedSource;
|
130767
130765
|
let test;
|
130766
|
+
const advanceIterator = lowerValueToTemporary(builder, {
|
130767
|
+
kind: 'IteratorNext',
|
130768
|
+
loc: leftLoc,
|
130769
|
+
iterator: Object.assign({}, iterator),
|
130770
|
+
collection: Object.assign({}, value),
|
130771
|
+
});
|
130768
130772
|
if (left.isVariableDeclaration()) {
|
130769
130773
|
const declarations = left.get('declarations');
|
130770
130774
|
CompilerError.invariant(declarations.length === 1, {
|
@@ -130774,12 +130778,6 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130774
130778
|
suggestions: null,
|
130775
130779
|
});
|
130776
130780
|
const id = declarations[0].get('id');
|
130777
|
-
const advanceIterator = lowerValueToTemporary(builder, {
|
130778
|
-
kind: 'IteratorNext',
|
130779
|
-
loc: leftLoc,
|
130780
|
-
iterator: Object.assign({}, iterator),
|
130781
|
-
collection: Object.assign({}, value),
|
130782
|
-
});
|
130783
130781
|
const assign = lowerAssignment(
|
130784
130782
|
builder,
|
130785
130783
|
leftLoc,
|
@@ -130790,13 +130788,19 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130790
130788
|
);
|
130791
130789
|
test = lowerValueToTemporary(builder, assign);
|
130792
130790
|
} else {
|
130793
|
-
|
130794
|
-
|
130795
|
-
|
130796
|
-
loc: (_16 = left.node.loc) !== null && _16 !== void 0 ? _16 : null,
|
130797
|
-
suggestions: null,
|
130791
|
+
CompilerError.invariant(left.isLVal(), {
|
130792
|
+
loc: leftLoc,
|
130793
|
+
reason: 'Expected ForOf init to be a variable declaration or lval',
|
130798
130794
|
});
|
130799
|
-
|
130795
|
+
const assign = lowerAssignment(
|
130796
|
+
builder,
|
130797
|
+
leftLoc,
|
130798
|
+
InstructionKind.Reassign,
|
130799
|
+
left,
|
130800
|
+
advanceIterator,
|
130801
|
+
'Assignment'
|
130802
|
+
);
|
130803
|
+
test = lowerValueToTemporary(builder, assign);
|
130800
130804
|
}
|
130801
130805
|
builder.terminateWithContinuation(
|
130802
130806
|
{
|
@@ -130806,8 +130810,8 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130806
130810
|
consequent: loopBlock,
|
130807
130811
|
alternate: continuationBlock.id,
|
130808
130812
|
loc:
|
130809
|
-
(
|
130810
|
-
?
|
130813
|
+
(_16 = stmt.node.loc) !== null && _16 !== void 0
|
130814
|
+
? _16
|
130811
130815
|
: GeneratedSource,
|
130812
130816
|
fallthrough: continuationBlock.id,
|
130813
130817
|
},
|
@@ -130837,8 +130841,8 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130837
130841
|
})
|
130838
130842
|
);
|
130839
130843
|
const loc =
|
130840
|
-
(
|
130841
|
-
?
|
130844
|
+
(_17 = stmt.node.loc) !== null && _17 !== void 0
|
130845
|
+
? _17
|
130842
130846
|
: GeneratedSource;
|
130843
130847
|
const value = lowerExpressionToTemporary(builder, stmt.get('right'));
|
130844
130848
|
builder.terminateWithContinuation(
|
@@ -130854,24 +130858,24 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130854
130858
|
);
|
130855
130859
|
const left = stmt.get('left');
|
130856
130860
|
const leftLoc =
|
130857
|
-
(
|
130858
|
-
?
|
130861
|
+
(_18 = left.node.loc) !== null && _18 !== void 0
|
130862
|
+
? _18
|
130859
130863
|
: GeneratedSource;
|
130860
130864
|
let test;
|
130865
|
+
const nextPropertyTemp = lowerValueToTemporary(builder, {
|
130866
|
+
kind: 'NextPropertyOf',
|
130867
|
+
loc: leftLoc,
|
130868
|
+
value: value,
|
130869
|
+
});
|
130861
130870
|
if (left.isVariableDeclaration()) {
|
130862
130871
|
const declarations = left.get('declarations');
|
130863
130872
|
CompilerError.invariant(declarations.length === 1, {
|
130864
130873
|
reason: `Expected only one declaration in the init of a ForInStatement, got ${declarations.length}`,
|
130865
130874
|
description: null,
|
130866
|
-
loc: (
|
130875
|
+
loc: (_19 = left.node.loc) !== null && _19 !== void 0 ? _19 : null,
|
130867
130876
|
suggestions: null,
|
130868
130877
|
});
|
130869
130878
|
const id = declarations[0].get('id');
|
130870
|
-
const nextPropertyTemp = lowerValueToTemporary(builder, {
|
130871
|
-
kind: 'NextPropertyOf',
|
130872
|
-
loc: leftLoc,
|
130873
|
-
value: value,
|
130874
|
-
});
|
130875
130879
|
const assign = lowerAssignment(
|
130876
130880
|
builder,
|
130877
130881
|
leftLoc,
|
@@ -130882,13 +130886,19 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130882
130886
|
);
|
130883
130887
|
test = lowerValueToTemporary(builder, assign);
|
130884
130888
|
} else {
|
130885
|
-
|
130886
|
-
|
130887
|
-
|
130888
|
-
loc: (_21 = left.node.loc) !== null && _21 !== void 0 ? _21 : null,
|
130889
|
-
suggestions: null,
|
130889
|
+
CompilerError.invariant(left.isLVal(), {
|
130890
|
+
loc: leftLoc,
|
130891
|
+
reason: 'Expected ForIn init to be a variable declaration or lval',
|
130890
130892
|
});
|
130891
|
-
|
130893
|
+
const assign = lowerAssignment(
|
130894
|
+
builder,
|
130895
|
+
leftLoc,
|
130896
|
+
InstructionKind.Reassign,
|
130897
|
+
left,
|
130898
|
+
nextPropertyTemp,
|
130899
|
+
'Assignment'
|
130900
|
+
);
|
130901
|
+
test = lowerValueToTemporary(builder, assign);
|
130892
130902
|
}
|
130893
130903
|
builder.terminateWithContinuation(
|
130894
130904
|
{
|
@@ -130899,8 +130909,8 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130899
130909
|
alternate: continuationBlock.id,
|
130900
130910
|
fallthrough: continuationBlock.id,
|
130901
130911
|
loc:
|
130902
|
-
(
|
130903
|
-
?
|
130912
|
+
(_20 = stmt.node.loc) !== null && _20 !== void 0
|
130913
|
+
? _20
|
130904
130914
|
: GeneratedSource,
|
130905
130915
|
},
|
130906
130916
|
continuationBlock
|
@@ -130910,8 +130920,8 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130910
130920
|
case 'DebuggerStatement': {
|
130911
130921
|
const stmt = stmtPath;
|
130912
130922
|
const loc =
|
130913
|
-
(
|
130914
|
-
?
|
130923
|
+
(_21 = stmt.node.loc) !== null && _21 !== void 0
|
130924
|
+
? _21
|
130915
130925
|
: GeneratedSource;
|
130916
130926
|
builder.push({
|
130917
130927
|
id: makeInstructionId(0),
|
@@ -130932,7 +130942,7 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130932
130942
|
builder.errors.push({
|
130933
130943
|
reason: `(BuildHIR::lowerStatement) Handle TryStatement without a catch clause`,
|
130934
130944
|
severity: exports.ErrorSeverity.Todo,
|
130935
|
-
loc: (
|
130945
|
+
loc: (_22 = stmt.node.loc) !== null && _22 !== void 0 ? _22 : null,
|
130936
130946
|
suggestions: null,
|
130937
130947
|
});
|
130938
130948
|
return;
|
@@ -130941,7 +130951,7 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130941
130951
|
builder.errors.push({
|
130942
130952
|
reason: `(BuildHIR::lowerStatement) Handle TryStatement with a finalizer ('finally') clause`,
|
130943
130953
|
severity: exports.ErrorSeverity.Todo,
|
130944
|
-
loc: (
|
130954
|
+
loc: (_23 = stmt.node.loc) !== null && _23 !== void 0 ? _23 : null,
|
130945
130955
|
suggestions: null,
|
130946
130956
|
});
|
130947
130957
|
}
|
@@ -130951,15 +130961,15 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130951
130961
|
const place = {
|
130952
130962
|
kind: 'Identifier',
|
130953
130963
|
identifier: builder.makeTemporary(
|
130954
|
-
(
|
130955
|
-
?
|
130964
|
+
(_24 = handlerBindingPath.node.loc) !== null && _24 !== void 0
|
130965
|
+
? _24
|
130956
130966
|
: GeneratedSource
|
130957
130967
|
),
|
130958
130968
|
effect: exports.Effect.Unknown,
|
130959
130969
|
reactive: false,
|
130960
130970
|
loc:
|
130961
|
-
(
|
130962
|
-
?
|
130971
|
+
(_25 = handlerBindingPath.node.loc) !== null && _25 !== void 0
|
130972
|
+
? _25
|
130963
130973
|
: GeneratedSource,
|
130964
130974
|
};
|
130965
130975
|
promoteTemporary(place.identifier);
|
@@ -130971,8 +130981,8 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
130971
130981
|
},
|
130972
130982
|
type: null,
|
130973
130983
|
loc:
|
130974
|
-
(
|
130975
|
-
?
|
130984
|
+
(_26 = handlerBindingPath.node.loc) !== null && _26 !== void 0
|
130985
|
+
? _26
|
130976
130986
|
: GeneratedSource,
|
130977
130987
|
});
|
130978
130988
|
handlerBinding = {path: handlerBindingPath, place: place};
|
@@ -131032,8 +131042,8 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
131032
131042
|
fallthrough: continuationBlock.id,
|
131033
131043
|
id: makeInstructionId(0),
|
131034
131044
|
loc:
|
131035
|
-
(
|
131036
|
-
?
|
131045
|
+
(_27 = stmt.node.loc) !== null && _27 !== void 0
|
131046
|
+
? _27
|
131037
131047
|
: GeneratedSource,
|
131038
131048
|
},
|
131039
131049
|
continuationBlock
|
@@ -131073,14 +131083,14 @@ function lowerStatement(builder, stmtPath, label = null) {
|
|
131073
131083
|
builder.errors.push({
|
131074
131084
|
reason: `(BuildHIR::lowerStatement) Handle ${stmtPath.type} statements`,
|
131075
131085
|
severity: exports.ErrorSeverity.Todo,
|
131076
|
-
loc: (
|
131086
|
+
loc: (_28 = stmtPath.node.loc) !== null && _28 !== void 0 ? _28 : null,
|
131077
131087
|
suggestions: null,
|
131078
131088
|
});
|
131079
131089
|
lowerValueToTemporary(builder, {
|
131080
131090
|
kind: 'UnsupportedNode',
|
131081
131091
|
loc:
|
131082
|
-
(
|
131083
|
-
?
|
131092
|
+
(_29 = stmtPath.node.loc) !== null && _29 !== void 0
|
131093
|
+
? _29
|
131084
131094
|
: GeneratedSource,
|
131085
131095
|
node: stmtPath.node,
|
131086
131096
|
});
|
@@ -141722,15 +141732,14 @@ function createPropsProperties(
|
|
141722
141732
|
let refProperty;
|
141723
141733
|
let keyProperty;
|
141724
141734
|
const props = [];
|
141725
|
-
const
|
141726
|
-
p => p.kind === 'JsxAttribute' && p.name !== 'key'
|
141735
|
+
const jsxAttributesWithoutKey = propAttributes.filter(
|
141736
|
+
p => p.kind === 'JsxAttribute' && p.name !== 'key'
|
141727
141737
|
);
|
141728
141738
|
const jsxSpreadAttributes = propAttributes.filter(
|
141729
141739
|
p => p.kind === 'JsxSpreadAttribute'
|
141730
141740
|
);
|
141731
141741
|
const spreadPropsOnly =
|
141732
|
-
|
141733
|
-
jsxSpreadAttributes.length === 1;
|
141742
|
+
jsxAttributesWithoutKey.length === 0 && jsxSpreadAttributes.length === 1;
|
141734
141743
|
propAttributes.forEach(prop => {
|
141735
141744
|
switch (prop.kind) {
|
141736
141745
|
case 'JsxAttribute': {
|
@@ -145203,19 +145212,6 @@ function codegenInstructionNullable(cx, instr) {
|
|
145203
145212
|
}
|
145204
145213
|
function codegenForInit(cx, init) {
|
145205
145214
|
if (init.kind === 'SequenceExpression') {
|
145206
|
-
for (const instr of init.instructions) {
|
145207
|
-
if (instr.value.kind === 'DeclareContext') {
|
145208
|
-
CompilerError.throwTodo({
|
145209
|
-
reason: `Support for loops where the index variable is a context variable`,
|
145210
|
-
loc: instr.loc,
|
145211
|
-
description:
|
145212
|
-
instr.value.lvalue.place.identifier.name != null
|
145213
|
-
? `\`${instr.value.lvalue.place.identifier.name.value}\` is a context variable`
|
145214
|
-
: null,
|
145215
|
-
suggestions: null,
|
145216
|
-
});
|
145217
|
-
}
|
145218
|
-
}
|
145219
145215
|
const body = codegenBlock(
|
145220
145216
|
cx,
|
145221
145217
|
init.instructions.map(instruction => ({
|
@@ -145226,20 +145222,37 @@ function codegenForInit(cx, init) {
|
|
145226
145222
|
const declarators = [];
|
145227
145223
|
let kind = 'const';
|
145228
145224
|
body.forEach(instr => {
|
145229
|
-
|
145230
|
-
|
145231
|
-
|
145232
|
-
|
145233
|
-
|
145234
|
-
|
145235
|
-
|
145236
|
-
|
145225
|
+
var _a;
|
145226
|
+
let top = undefined;
|
145227
|
+
if (
|
145228
|
+
instr.type === 'ExpressionStatement' &&
|
145229
|
+
instr.expression.type === 'AssignmentExpression' &&
|
145230
|
+
instr.expression.operator === '=' &&
|
145231
|
+
instr.expression.left.type === 'Identifier' &&
|
145232
|
+
((_a = top = declarators.at(-1)) === null || _a === void 0
|
145233
|
+
? void 0
|
145234
|
+
: _a.id.type) === 'Identifier' &&
|
145235
|
+
(top === null || top === void 0 ? void 0 : top.id.name) ===
|
145236
|
+
instr.expression.left.name &&
|
145237
|
+
(top === null || top === void 0 ? void 0 : top.init) == null
|
145238
|
+
) {
|
145239
|
+
top.init = instr.expression.right;
|
145240
|
+
} else {
|
145241
|
+
CompilerError.invariant(
|
145242
|
+
instr.type === 'VariableDeclaration' &&
|
145243
|
+
(instr.kind === 'let' || instr.kind === 'const'),
|
145244
|
+
{
|
145245
|
+
reason: 'Expected a variable declaration',
|
145246
|
+
loc: init.loc,
|
145247
|
+
description: `Got ${instr.type}`,
|
145248
|
+
suggestions: null,
|
145249
|
+
}
|
145250
|
+
);
|
145251
|
+
if (instr.kind === 'let') {
|
145252
|
+
kind = 'let';
|
145237
145253
|
}
|
145238
|
-
|
145239
|
-
if (instr.kind === 'let') {
|
145240
|
-
kind = 'let';
|
145254
|
+
declarators.push(...instr.declarations);
|
145241
145255
|
}
|
145242
|
-
declarators.push(...instr.declarations);
|
145243
145256
|
});
|
145244
145257
|
CompilerError.invariant(declarators.length > 0, {
|
145245
145258
|
reason: 'Expected a variable declaration',
|
package/package.json
CHANGED