mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
This broke main.
This commit is contained in:
committed by
GitHub
parent
894bc73cb4
commit
80cb7a9925
@@ -4026,7 +4026,6 @@ function lowerAssignment(
|
||||
pattern: {
|
||||
kind: 'ArrayPattern',
|
||||
items,
|
||||
loc: lvalue.node.loc ?? GeneratedSource,
|
||||
},
|
||||
},
|
||||
value,
|
||||
@@ -4204,7 +4203,6 @@ function lowerAssignment(
|
||||
pattern: {
|
||||
kind: 'ObjectPattern',
|
||||
properties,
|
||||
loc: lvalue.node.loc ?? GeneratedSource,
|
||||
},
|
||||
},
|
||||
value,
|
||||
|
||||
@@ -694,13 +694,11 @@ export type SpreadPattern = {
|
||||
export type ArrayPattern = {
|
||||
kind: 'ArrayPattern';
|
||||
items: Array<Place | SpreadPattern | Hole>;
|
||||
loc: SourceLocation;
|
||||
};
|
||||
|
||||
export type ObjectPattern = {
|
||||
kind: 'ObjectPattern';
|
||||
properties: Array<ObjectProperty | SpreadPattern>;
|
||||
loc: SourceLocation;
|
||||
};
|
||||
|
||||
export type ObjectPropertyKey =
|
||||
|
||||
@@ -515,7 +515,6 @@ function emitDestructureProps(
|
||||
pattern: {
|
||||
kind: 'ObjectPattern',
|
||||
properties,
|
||||
loc: GeneratedSource,
|
||||
},
|
||||
kind: InstructionKind.Let,
|
||||
},
|
||||
|
||||
@@ -702,7 +702,7 @@ function codegenReactiveScope(
|
||||
outputComments.push(name.name);
|
||||
if (!cx.hasDeclared(identifier)) {
|
||||
statements.push(
|
||||
t.variableDeclaration('let', [createVariableDeclarator(name, null)]),
|
||||
t.variableDeclaration('let', [t.variableDeclarator(name)]),
|
||||
);
|
||||
}
|
||||
cacheLoads.push({name, index, value: wrapCacheDep(cx, name)});
|
||||
@@ -1387,7 +1387,7 @@ function codegenInstructionNullable(
|
||||
suggestions: null,
|
||||
});
|
||||
return createVariableDeclaration(instr.loc, 'const', [
|
||||
createVariableDeclarator(codegenLValue(cx, lvalue), value),
|
||||
t.variableDeclarator(codegenLValue(cx, lvalue), value),
|
||||
]);
|
||||
}
|
||||
case InstructionKind.Function: {
|
||||
@@ -1451,7 +1451,7 @@ function codegenInstructionNullable(
|
||||
suggestions: null,
|
||||
});
|
||||
return createVariableDeclaration(instr.loc, 'let', [
|
||||
createVariableDeclarator(codegenLValue(cx, lvalue), value),
|
||||
t.variableDeclarator(codegenLValue(cx, lvalue), value),
|
||||
]);
|
||||
}
|
||||
case InstructionKind.Reassign: {
|
||||
@@ -1691,9 +1691,6 @@ function withLoc<T extends (...args: Array<any>) => t.Node>(
|
||||
};
|
||||
}
|
||||
|
||||
const createIdentifier = withLoc(t.identifier);
|
||||
const createArrayPattern = withLoc(t.arrayPattern);
|
||||
const createObjectPattern = withLoc(t.objectPattern);
|
||||
const createBinaryExpression = withLoc(t.binaryExpression);
|
||||
const createExpressionStatement = withLoc(t.expressionStatement);
|
||||
const _createLabelledStatement = withLoc(t.labeledStatement);
|
||||
@@ -1725,31 +1722,6 @@ const createTryStatement = withLoc(t.tryStatement);
|
||||
const createBreakStatement = withLoc(t.breakStatement);
|
||||
const createContinueStatement = withLoc(t.continueStatement);
|
||||
|
||||
function createVariableDeclarator(
|
||||
id: t.LVal,
|
||||
init?: t.Expression | null,
|
||||
): t.VariableDeclarator {
|
||||
const node = t.variableDeclarator(id, init);
|
||||
|
||||
/*
|
||||
* The variable declarator location is not preserved in HIR, however, we can use the
|
||||
* start location of the id and the end location of the init to recreate the
|
||||
* exact original variable declarator location.
|
||||
*
|
||||
* Or if init is null, we likely have a declaration without an initializer, so we can use the id.loc.end as the end location.
|
||||
*/
|
||||
if (id.loc && (init === null || init?.loc)) {
|
||||
node.loc = {
|
||||
start: id.loc.start,
|
||||
end: init?.loc?.end ?? id.loc.end,
|
||||
filename: id.loc.filename,
|
||||
identifierName: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function createHookGuard(
|
||||
guard: ExternalFunction,
|
||||
context: ProgramContext,
|
||||
@@ -1857,7 +1829,7 @@ function codegenInstruction(
|
||||
);
|
||||
} else {
|
||||
return createVariableDeclaration(instr.loc, 'const', [
|
||||
createVariableDeclarator(
|
||||
t.variableDeclarator(
|
||||
convertIdentifier(instr.lvalue.identifier),
|
||||
expressionValue,
|
||||
),
|
||||
@@ -2784,7 +2756,7 @@ function codegenArrayPattern(
|
||||
): t.ArrayPattern {
|
||||
const hasHoles = !pattern.items.every(e => e.kind !== 'Hole');
|
||||
if (hasHoles) {
|
||||
const result = createArrayPattern(pattern.loc, []);
|
||||
const result = t.arrayPattern([]);
|
||||
/*
|
||||
* Older versions of babel have a validation bug fixed by
|
||||
* https://github.com/babel/babel/pull/10917
|
||||
@@ -2805,8 +2777,7 @@ function codegenArrayPattern(
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
return createArrayPattern(
|
||||
pattern.loc,
|
||||
return t.arrayPattern(
|
||||
pattern.items.map(item => {
|
||||
if (item.kind === 'Hole') {
|
||||
return null;
|
||||
@@ -2826,8 +2797,7 @@ function codegenLValue(
|
||||
return codegenArrayPattern(cx, pattern);
|
||||
}
|
||||
case 'ObjectPattern': {
|
||||
return createObjectPattern(
|
||||
pattern.loc,
|
||||
return t.objectPattern(
|
||||
pattern.properties.map(property => {
|
||||
if (property.kind === 'ObjectProperty') {
|
||||
const key = codegenObjectPropertyKey(cx, property.key);
|
||||
@@ -2946,7 +2916,7 @@ function convertIdentifier(identifier: Identifier): t.Identifier {
|
||||
suggestions: null,
|
||||
},
|
||||
);
|
||||
return createIdentifier(identifier.loc, identifier.name.value);
|
||||
return t.identifier(identifier.name.value);
|
||||
}
|
||||
|
||||
function compareScopeDependency(
|
||||
|
||||
@@ -27,11 +27,7 @@ import {Result} from '../Utils/Result';
|
||||
|
||||
/**
|
||||
* Some common node types that are important for coverage tracking.
|
||||
* Based on istanbul-lib-instrument + some other common nodes we expect to be present in the generated AST.
|
||||
*
|
||||
* Note: For VariableDeclaration, VariableDeclarator, and Identifier, we enforce stricter validation
|
||||
* that requires both the source location AND node type to match in the generated AST. This ensures
|
||||
* that variable declarations maintain their structural integrity through compilation.
|
||||
* Based on istanbul-lib-instrument
|
||||
*/
|
||||
const IMPORTANT_INSTRUMENTED_TYPES = new Set([
|
||||
'ArrowFunctionExpression',
|
||||
@@ -58,14 +54,6 @@ const IMPORTANT_INSTRUMENTED_TYPES = new Set([
|
||||
'LabeledStatement',
|
||||
'ConditionalExpression',
|
||||
'LogicalExpression',
|
||||
|
||||
/**
|
||||
* Note: these aren't important for coverage tracking,
|
||||
* but we still want to track them to ensure we aren't regressing them when
|
||||
* we fix the source location tracking for other nodes.
|
||||
*/
|
||||
'VariableDeclaration',
|
||||
'Identifier',
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -126,13 +114,10 @@ export function validateSourceLocations(
|
||||
): Result<void, CompilerError> {
|
||||
const errors = new CompilerError();
|
||||
|
||||
/*
|
||||
* Step 1: Collect important locations from the original source
|
||||
* Note: Multiple node types can share the same location (e.g. VariableDeclarator and Identifier)
|
||||
*/
|
||||
// Step 1: Collect important locations from the original source
|
||||
const importantOriginalLocations = new Map<
|
||||
string,
|
||||
{loc: t.SourceLocation; nodeTypes: Set<string>}
|
||||
{loc: t.SourceLocation; nodeType: string}
|
||||
>();
|
||||
|
||||
func.traverse({
|
||||
@@ -152,31 +137,20 @@ export function validateSourceLocations(
|
||||
// Collect the location if it exists
|
||||
if (node.loc) {
|
||||
const key = locationKey(node.loc);
|
||||
const existing = importantOriginalLocations.get(key);
|
||||
if (existing) {
|
||||
existing.nodeTypes.add(node.type);
|
||||
} else {
|
||||
importantOriginalLocations.set(key, {
|
||||
loc: node.loc,
|
||||
nodeTypes: new Set([node.type]),
|
||||
});
|
||||
}
|
||||
importantOriginalLocations.set(key, {
|
||||
loc: node.loc,
|
||||
nodeType: node.type,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// Step 2: Collect all locations from the generated AST with their node types
|
||||
const generatedLocations = new Map<string, Set<string>>();
|
||||
// Step 2: Collect all locations from the generated AST
|
||||
const generatedLocations = new Set<string>();
|
||||
|
||||
function collectGeneratedLocations(node: t.Node): void {
|
||||
if (node.loc) {
|
||||
const key = locationKey(node.loc);
|
||||
const nodeTypes = generatedLocations.get(key);
|
||||
if (nodeTypes) {
|
||||
nodeTypes.add(node.type);
|
||||
} else {
|
||||
generatedLocations.set(key, new Set([node.type]));
|
||||
}
|
||||
generatedLocations.add(locationKey(node.loc));
|
||||
}
|
||||
|
||||
// Use Babel's VISITOR_KEYS to traverse only actual node properties
|
||||
@@ -209,86 +183,22 @@ export function validateSourceLocations(
|
||||
collectGeneratedLocations(outlined.fn.body);
|
||||
}
|
||||
|
||||
/*
|
||||
* Step 3: Validate that all important locations are preserved
|
||||
* For certain node types, also validate that the node type matches
|
||||
*/
|
||||
const strictNodeTypes = new Set([
|
||||
'VariableDeclaration',
|
||||
'VariableDeclarator',
|
||||
'Identifier',
|
||||
]);
|
||||
|
||||
const reportMissingLocation = (
|
||||
loc: t.SourceLocation,
|
||||
nodeType: string,
|
||||
): void => {
|
||||
errors.pushDiagnostic(
|
||||
CompilerDiagnostic.create({
|
||||
category: ErrorCategory.Todo,
|
||||
reason: 'Important source location missing in generated code',
|
||||
description:
|
||||
`Source location for ${nodeType} is missing in the generated output. This can cause coverage instrumentation ` +
|
||||
`to fail to track this code properly, resulting in inaccurate coverage reports.`,
|
||||
}).withDetails({
|
||||
kind: 'error',
|
||||
loc,
|
||||
message: null,
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
const reportWrongNodeType = (
|
||||
loc: t.SourceLocation,
|
||||
expectedType: string,
|
||||
actualTypes: Set<string>,
|
||||
): void => {
|
||||
errors.pushDiagnostic(
|
||||
CompilerDiagnostic.create({
|
||||
category: ErrorCategory.Todo,
|
||||
reason:
|
||||
'Important source location has wrong node type in generated code',
|
||||
description:
|
||||
`Source location for ${expectedType} exists in the generated output but with wrong node type(s): ${Array.from(actualTypes).join(', ')}. ` +
|
||||
`This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.`,
|
||||
}).withDetails({
|
||||
kind: 'error',
|
||||
loc,
|
||||
message: null,
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
for (const [key, {loc, nodeTypes}] of importantOriginalLocations) {
|
||||
const generatedNodeTypes = generatedLocations.get(key);
|
||||
|
||||
if (!generatedNodeTypes) {
|
||||
// Location is completely missing
|
||||
reportMissingLocation(loc, Array.from(nodeTypes).join(', '));
|
||||
} else {
|
||||
// Location exists, check each node type
|
||||
for (const nodeType of nodeTypes) {
|
||||
if (
|
||||
strictNodeTypes.has(nodeType) &&
|
||||
!generatedNodeTypes.has(nodeType)
|
||||
) {
|
||||
/*
|
||||
* For strict node types, the specific node type must be present
|
||||
* Check if any generated node type is also an important original node type
|
||||
*/
|
||||
const hasValidNodeType = Array.from(generatedNodeTypes).some(
|
||||
genType => nodeTypes.has(genType),
|
||||
);
|
||||
|
||||
if (hasValidNodeType) {
|
||||
// At least one generated node type is valid (also in original), so this is just missing
|
||||
reportMissingLocation(loc, nodeType);
|
||||
} else {
|
||||
// None of the generated node types are in original - this is wrong node type
|
||||
reportWrongNodeType(loc, nodeType, generatedNodeTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Step 3: Validate that all important locations are preserved
|
||||
for (const [key, {loc, nodeType}] of importantOriginalLocations) {
|
||||
if (!generatedLocations.has(key)) {
|
||||
errors.pushDiagnostic(
|
||||
CompilerDiagnostic.create({
|
||||
category: ErrorCategory.Todo,
|
||||
reason: 'Important source location missing in generated code',
|
||||
description:
|
||||
`Source location for ${nodeType} is missing in the generated output. This can cause coverage instrumentation ` +
|
||||
`to fail to track this code properly, resulting in inaccurate coverage reports.`,
|
||||
}).withDetails({
|
||||
kind: 'error',
|
||||
loc,
|
||||
message: null,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,10 @@ function Component() {
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const a = makeObject_Primitives();
|
||||
|
||||
const x = [];
|
||||
x.push(a);
|
||||
|
||||
mutate(x);
|
||||
t0 = [x, a];
|
||||
$[0] = t0;
|
||||
|
||||
@@ -33,6 +33,7 @@ function Component() {
|
||||
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const x = [];
|
||||
x.push(a);
|
||||
|
||||
t1 = [x, a];
|
||||
$[1] = t1;
|
||||
} else {
|
||||
|
||||
@@ -85,10 +85,14 @@ function Component(t0) {
|
||||
let t1;
|
||||
if ($[0] !== prop) {
|
||||
const obj = shallowCopy(prop);
|
||||
|
||||
const aliasedObj = identity(obj);
|
||||
|
||||
const getId = () => obj.id;
|
||||
|
||||
mutate(aliasedObj);
|
||||
setPropertyByKey(aliasedObj, "id", prop.id + 1);
|
||||
|
||||
t1 = <Stringify getId={getId} shouldInvokeFns={true} />;
|
||||
$[0] = prop;
|
||||
$[1] = t1;
|
||||
|
||||
@@ -181,9 +181,12 @@ function Component(t0) {
|
||||
if ($[0] !== prop) {
|
||||
const obj = shallowCopy(prop);
|
||||
const aliasedObj = identity(obj);
|
||||
|
||||
const id = [obj.id];
|
||||
|
||||
mutate(aliasedObj);
|
||||
setPropertyByKey(aliasedObj, "id", prop.id + 1);
|
||||
|
||||
t1 = <Stringify id={id} />;
|
||||
$[0] = prop;
|
||||
$[1] = t1;
|
||||
|
||||
@@ -54,6 +54,7 @@ function Foo(t0) {
|
||||
let t1;
|
||||
if ($[0] !== cond1 || $[1] !== cond2) {
|
||||
const arr = makeArray({ a: 2 }, 2, []);
|
||||
|
||||
t1 = cond1 ? (
|
||||
<>
|
||||
<div>{identity("foo")}</div>
|
||||
|
||||
@@ -49,6 +49,7 @@ function Component() {
|
||||
ref.current = "";
|
||||
}
|
||||
};
|
||||
|
||||
t0 = () => {
|
||||
setRef();
|
||||
};
|
||||
|
||||
@@ -49,6 +49,7 @@ function Component() {
|
||||
ref.current.value = "";
|
||||
}
|
||||
};
|
||||
|
||||
t0 = () => {
|
||||
setRef();
|
||||
};
|
||||
|
||||
@@ -74,6 +74,7 @@ function Component() {
|
||||
console.log(ref.current.value);
|
||||
}
|
||||
};
|
||||
|
||||
t0 = (
|
||||
<>
|
||||
<input ref={ref} />
|
||||
|
||||
@@ -36,6 +36,7 @@ function useArrayOfRef() {
|
||||
const callback = (value) => {
|
||||
ref.current = value;
|
||||
};
|
||||
|
||||
t0 = [callback];
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -35,6 +35,7 @@ function Component(props) {
|
||||
const arr = [...bar(props)];
|
||||
return arr.at(x);
|
||||
};
|
||||
|
||||
t1 = fn();
|
||||
$[2] = props;
|
||||
$[3] = x;
|
||||
|
||||
@@ -61,6 +61,7 @@ function useBar(t0) {
|
||||
if ($[0] !== arg) {
|
||||
const s = new Set([1, 5, 4]);
|
||||
const mutableIterator = s.values();
|
||||
|
||||
t1 = [arg, ...mutableIterator];
|
||||
$[0] = arg;
|
||||
$[1] = t1;
|
||||
|
||||
@@ -28,6 +28,7 @@ function Component(props) {
|
||||
const a = [];
|
||||
const b = {};
|
||||
foo(a, b);
|
||||
|
||||
foo(b);
|
||||
t0 = <div a={a} b={b} />;
|
||||
$[0] = t0;
|
||||
|
||||
@@ -45,6 +45,7 @@ function useKeyCommand() {
|
||||
const nextPosition = direction === "left" ? addOne(position) : position;
|
||||
currentPosition.current = nextPosition;
|
||||
};
|
||||
|
||||
const moveLeft = { handler: handleKey("left") };
|
||||
const moveRight = { handler: handleKey("right") };
|
||||
t0 = [moveLeft, moveRight];
|
||||
|
||||
@@ -45,6 +45,7 @@ function Component(t0) {
|
||||
z.a = 2;
|
||||
mutate(y.b);
|
||||
};
|
||||
|
||||
x();
|
||||
t1 = [y, z];
|
||||
$[0] = a;
|
||||
|
||||
@@ -29,6 +29,7 @@ function MyComponentName(props) {
|
||||
const x = {};
|
||||
foo(x, props.a);
|
||||
foo(x, props.b);
|
||||
|
||||
y = [];
|
||||
y.push(x);
|
||||
$[0] = props.a;
|
||||
|
||||
@@ -34,6 +34,7 @@ function useTest() {
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
let w = {};
|
||||
|
||||
const t1 = (w = 42);
|
||||
const t2 = w;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ function useTest() {
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const w = {};
|
||||
|
||||
const t1 = (w.x = 42);
|
||||
const t2 = w.x;
|
||||
|
||||
|
||||
@@ -44,9 +44,11 @@ function ComponentA(props) {
|
||||
if (b) {
|
||||
a.push(props.p0);
|
||||
}
|
||||
|
||||
if (props.p1) {
|
||||
b.push(props.p2);
|
||||
}
|
||||
|
||||
t0 = <Foo a={a} b={b} />;
|
||||
$[0] = props.p0;
|
||||
$[1] = props.p1;
|
||||
@@ -67,9 +69,11 @@ function ComponentB(props) {
|
||||
if (mayMutate(b)) {
|
||||
a.push(props.p0);
|
||||
}
|
||||
|
||||
if (props.p1) {
|
||||
b.push(props.p2);
|
||||
}
|
||||
|
||||
t0 = <Foo a={a} b={b} />;
|
||||
$[0] = props.p0;
|
||||
$[1] = props.p1;
|
||||
|
||||
@@ -28,6 +28,7 @@ function Component(props) {
|
||||
const a = [];
|
||||
const b = {};
|
||||
new Foo(a, b);
|
||||
|
||||
new Foo(b);
|
||||
t0 = <div a={a} b={b} />;
|
||||
$[0] = t0;
|
||||
|
||||
@@ -34,6 +34,7 @@ function Component(props) {
|
||||
const callback = () => {
|
||||
console.log(x);
|
||||
};
|
||||
|
||||
x = {};
|
||||
t0 = <Stringify callback={callback} shouldInvokeFns={true} />;
|
||||
$[0] = t0;
|
||||
|
||||
@@ -75,6 +75,7 @@ function Component(props) {
|
||||
let t0;
|
||||
if ($[0] !== post) {
|
||||
const allUrls = [];
|
||||
|
||||
const { media: t1, comments: t2, urls: t3 } = post;
|
||||
const media = t1 === undefined ? null : t1;
|
||||
let t4;
|
||||
@@ -101,6 +102,7 @@ function Component(props) {
|
||||
if (!comments.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(comments.length);
|
||||
};
|
||||
$[6] = comments.length;
|
||||
@@ -109,6 +111,7 @@ function Component(props) {
|
||||
t6 = $[7];
|
||||
}
|
||||
const onClick = t6;
|
||||
|
||||
allUrls.push(...urls);
|
||||
t0 = <Stringify media={media} allUrls={allUrls} onClick={onClick} />;
|
||||
$[0] = post;
|
||||
|
||||
@@ -53,6 +53,7 @@ function Component(props) {
|
||||
let t0;
|
||||
if ($[0] !== post) {
|
||||
const allUrls = [];
|
||||
|
||||
const { media, comments, urls } = post;
|
||||
let t1;
|
||||
if ($[2] !== comments.length) {
|
||||
@@ -60,6 +61,7 @@ function Component(props) {
|
||||
if (!comments.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(comments.length);
|
||||
};
|
||||
$[2] = comments.length;
|
||||
@@ -68,6 +70,7 @@ function Component(props) {
|
||||
t1 = $[3];
|
||||
}
|
||||
const onClick = t1;
|
||||
|
||||
allUrls.push(...urls);
|
||||
t0 = <Media media={media} onClick={onClick} />;
|
||||
$[0] = post;
|
||||
|
||||
@@ -57,6 +57,7 @@ function Component(t0) {
|
||||
let y;
|
||||
if ($[0] !== a || $[1] !== b || $[2] !== c) {
|
||||
x = [];
|
||||
|
||||
if (a) {
|
||||
let t1;
|
||||
if ($[5] !== b) {
|
||||
|
||||
@@ -46,6 +46,7 @@ function Component(t0) {
|
||||
setLocalValue("disabled");
|
||||
}
|
||||
};
|
||||
|
||||
t2 = [value, enabled];
|
||||
$[0] = enabled;
|
||||
$[1] = value;
|
||||
|
||||
@@ -65,14 +65,17 @@ function Component() {
|
||||
if ($[2] !== bar || $[3] !== foo) {
|
||||
t2 = () => {
|
||||
let isChanged = false;
|
||||
|
||||
const newData = foo.map((val) => {
|
||||
bar.someMethod(val);
|
||||
isChanged = true;
|
||||
});
|
||||
|
||||
if (isChanged) {
|
||||
setFoo(newData);
|
||||
}
|
||||
};
|
||||
|
||||
t3 = [foo, bar];
|
||||
$[2] = bar;
|
||||
$[3] = foo;
|
||||
|
||||
@@ -50,6 +50,7 @@ export default function Component(t0) {
|
||||
setLocal(test + test);
|
||||
}
|
||||
};
|
||||
|
||||
t2 = [test];
|
||||
$[0] = test;
|
||||
$[1] = t1;
|
||||
|
||||
@@ -10,28 +10,14 @@ function Component({prop1, prop2}) {
|
||||
const y = x * 2;
|
||||
const arr = [x, y];
|
||||
const obj = {x, y};
|
||||
let destA, destB;
|
||||
if (y > 5) {
|
||||
[destA, destB] = arr;
|
||||
}
|
||||
|
||||
const [a, b] = arr;
|
||||
const {x: c, y: d} = obj;
|
||||
let sound;
|
||||
|
||||
if (y > 10) {
|
||||
sound = 'woof';
|
||||
} else {
|
||||
sound = 'meow';
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (a > 10) {
|
||||
console.log(a);
|
||||
console.log(sound);
|
||||
console.log(destA, destB);
|
||||
}
|
||||
}, [a, sound, destA, destB]);
|
||||
}, [a]);
|
||||
|
||||
const foo = useCallback(() => {
|
||||
return a + b;
|
||||
@@ -52,343 +38,187 @@ function Component({prop1, prop2}) {
|
||||
## Error
|
||||
|
||||
```
|
||||
Found 25 errors:
|
||||
Found 13 errors:
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:4:9
|
||||
2 | import {useEffect, useCallback} from 'react';
|
||||
error.todo-missing-source-locations.ts:5:8
|
||||
3 |
|
||||
> 4 | function Component({prop1, prop2}) {
|
||||
| ^^^^^^^^^
|
||||
5 | const x = prop1 + prop2;
|
||||
4 | function Component({prop1, prop2}) {
|
||||
> 5 | const x = prop1 + prop2;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
6 | const y = x * 2;
|
||||
7 | const arr = [x, y];
|
||||
8 | const obj = {x, y};
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for VariableDeclaration is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:9:2
|
||||
error.todo-missing-source-locations.ts:6:8
|
||||
4 | function Component({prop1, prop2}) {
|
||||
5 | const x = prop1 + prop2;
|
||||
> 6 | const y = x * 2;
|
||||
| ^^^^^^^^^
|
||||
7 | const arr = [x, y];
|
||||
8 | const obj = {x, y};
|
||||
9 | const [a, b] = arr;
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:7:8
|
||||
5 | const x = prop1 + prop2;
|
||||
6 | const y = x * 2;
|
||||
> 7 | const arr = [x, y];
|
||||
| ^^^^^^^^^^^^
|
||||
8 | const obj = {x, y};
|
||||
9 | const [a, b] = arr;
|
||||
10 | const {x: c, y: d} = obj;
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:8:8
|
||||
6 | const y = x * 2;
|
||||
7 | const arr = [x, y];
|
||||
> 8 | const obj = {x, y};
|
||||
| ^^^^^^^^^^^^
|
||||
9 | const [a, b] = arr;
|
||||
10 | const {x: c, y: d} = obj;
|
||||
11 |
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:9:8
|
||||
7 | const arr = [x, y];
|
||||
8 | const obj = {x, y};
|
||||
> 9 | let destA, destB;
|
||||
> 9 | const [a, b] = arr;
|
||||
| ^^^^^^^^^^^^
|
||||
10 | const {x: c, y: d} = obj;
|
||||
11 |
|
||||
12 | useEffect(() => {
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:10:8
|
||||
8 | const obj = {x, y};
|
||||
9 | const [a, b] = arr;
|
||||
> 10 | const {x: c, y: d} = obj;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
11 |
|
||||
12 | useEffect(() => {
|
||||
13 | if (a > 10) {
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:12:2
|
||||
10 | const {x: c, y: d} = obj;
|
||||
11 |
|
||||
> 12 | useEffect(() => {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
10 | if (y > 5) {
|
||||
11 | [destA, destB] = arr;
|
||||
12 | }
|
||||
> 13 | if (a > 10) {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 14 | console.log(a);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 15 | }
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 16 | }, [a]);
|
||||
| ^^^^^^^^^^^
|
||||
17 |
|
||||
18 | const foo = useCallback(() => {
|
||||
19 | return a + b;
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:11:4
|
||||
9 | let destA, destB;
|
||||
10 | if (y > 5) {
|
||||
> 11 | [destA, destB] = arr;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
12 | }
|
||||
13 |
|
||||
14 | const [a, b] = arr;
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:15:9
|
||||
13 |
|
||||
14 | const [a, b] = arr;
|
||||
> 15 | const {x: c, y: d} = obj;
|
||||
| ^
|
||||
16 | let sound;
|
||||
17 |
|
||||
18 | if (y > 10) {
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:15:15
|
||||
13 |
|
||||
14 | const [a, b] = arr;
|
||||
> 15 | const {x: c, y: d} = obj;
|
||||
| ^
|
||||
16 | let sound;
|
||||
17 |
|
||||
18 | if (y > 10) {
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for VariableDeclaration is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:16:2
|
||||
14 | const [a, b] = arr;
|
||||
15 | const {x: c, y: d} = obj;
|
||||
> 16 | let sound;
|
||||
| ^^^^^^^^^^
|
||||
17 |
|
||||
18 | if (y > 10) {
|
||||
19 | sound = 'woof';
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:19:4
|
||||
17 |
|
||||
18 | if (y > 10) {
|
||||
> 19 | sound = 'woof';
|
||||
| ^^^^^^^^^^^^^^^
|
||||
20 | } else {
|
||||
21 | sound = 'meow';
|
||||
22 | }
|
||||
|
||||
Todo: Important source location has wrong node type in generated code
|
||||
|
||||
Source location for Identifier exists in the generated output but with wrong node type(s): ExpressionStatement. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:19:4
|
||||
17 |
|
||||
18 | if (y > 10) {
|
||||
> 19 | sound = 'woof';
|
||||
| ^^^^^
|
||||
20 | } else {
|
||||
21 | sound = 'meow';
|
||||
22 | }
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:21:4
|
||||
19 | sound = 'woof';
|
||||
20 | } else {
|
||||
> 21 | sound = 'meow';
|
||||
| ^^^^^^^^^^^^^^^
|
||||
22 | }
|
||||
23 |
|
||||
24 | useEffect(() => {
|
||||
|
||||
Todo: Important source location has wrong node type in generated code
|
||||
|
||||
Source location for Identifier exists in the generated output but with wrong node type(s): ExpressionStatement. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:21:4
|
||||
19 | sound = 'woof';
|
||||
20 | } else {
|
||||
> 21 | sound = 'meow';
|
||||
| ^^^^^
|
||||
22 | }
|
||||
23 |
|
||||
24 | useEffect(() => {
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:24:2
|
||||
22 | }
|
||||
23 |
|
||||
> 24 | useEffect(() => {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 25 | if (a > 10) {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 26 | console.log(a);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 27 | console.log(sound);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 28 | console.log(destA, destB);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 29 | }
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 30 | }, [a, sound, destA, destB]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
31 |
|
||||
32 | const foo = useCallback(() => {
|
||||
33 | return a + b;
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:26:6
|
||||
24 | useEffect(() => {
|
||||
25 | if (a > 10) {
|
||||
> 26 | console.log(a);
|
||||
error.todo-missing-source-locations.ts:14:6
|
||||
12 | useEffect(() => {
|
||||
13 | if (a > 10) {
|
||||
> 14 | console.log(a);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
27 | console.log(sound);
|
||||
28 | console.log(destA, destB);
|
||||
29 | }
|
||||
15 | }
|
||||
16 | }, [a]);
|
||||
17 |
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:26:14
|
||||
24 | useEffect(() => {
|
||||
25 | if (a > 10) {
|
||||
> 26 | console.log(a);
|
||||
| ^^^
|
||||
27 | console.log(sound);
|
||||
28 | console.log(destA, destB);
|
||||
29 | }
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:27:6
|
||||
25 | if (a > 10) {
|
||||
26 | console.log(a);
|
||||
> 27 | console.log(sound);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
28 | console.log(destA, destB);
|
||||
29 | }
|
||||
30 | }, [a, sound, destA, destB]);
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:27:14
|
||||
25 | if (a > 10) {
|
||||
26 | console.log(a);
|
||||
> 27 | console.log(sound);
|
||||
| ^^^
|
||||
28 | console.log(destA, destB);
|
||||
29 | }
|
||||
30 | }, [a, sound, destA, destB]);
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:28:6
|
||||
26 | console.log(a);
|
||||
27 | console.log(sound);
|
||||
> 28 | console.log(destA, destB);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
29 | }
|
||||
30 | }, [a, sound, destA, destB]);
|
||||
31 |
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:28:14
|
||||
26 | console.log(a);
|
||||
27 | console.log(sound);
|
||||
> 28 | console.log(destA, destB);
|
||||
| ^^^
|
||||
29 | }
|
||||
30 | }, [a, sound, destA, destB]);
|
||||
31 |
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:32:14
|
||||
30 | }, [a, sound, destA, destB]);
|
||||
31 |
|
||||
> 32 | const foo = useCallback(() => {
|
||||
| ^^^^^^^^^^^
|
||||
33 | return a + b;
|
||||
34 | }, [a, b]);
|
||||
35 |
|
||||
error.todo-missing-source-locations.ts:18:8
|
||||
16 | }, [a]);
|
||||
17 |
|
||||
> 18 | const foo = useCallback(() => {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
> 19 | return a + b;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 20 | }, [a, b]);
|
||||
| ^^^^^^^^^^^^^
|
||||
21 |
|
||||
22 | function bar() {
|
||||
23 | return (c + d) * 2;
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ReturnStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:33:4
|
||||
31 |
|
||||
32 | const foo = useCallback(() => {
|
||||
> 33 | return a + b;
|
||||
error.todo-missing-source-locations.ts:19:4
|
||||
17 |
|
||||
18 | const foo = useCallback(() => {
|
||||
> 19 | return a + b;
|
||||
| ^^^^^^^^^^^^^
|
||||
34 | }, [a, b]);
|
||||
35 |
|
||||
36 | function bar() {
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:34:6
|
||||
32 | const foo = useCallback(() => {
|
||||
33 | return a + b;
|
||||
> 34 | }, [a, b]);
|
||||
| ^
|
||||
35 |
|
||||
36 | function bar() {
|
||||
37 | return (c + d) * 2;
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:34:9
|
||||
32 | const foo = useCallback(() => {
|
||||
33 | return a + b;
|
||||
> 34 | }, [a, b]);
|
||||
| ^
|
||||
35 |
|
||||
36 | function bar() {
|
||||
37 | return (c + d) * 2;
|
||||
20 | }, [a, b]);
|
||||
21 |
|
||||
22 | function bar() {
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ReturnStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:37:4
|
||||
35 |
|
||||
36 | function bar() {
|
||||
> 37 | return (c + d) * 2;
|
||||
error.todo-missing-source-locations.ts:23:4
|
||||
21 |
|
||||
22 | function bar() {
|
||||
> 23 | return (c + d) * 2;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
38 | }
|
||||
39 |
|
||||
40 | console.log('Hello, world!');
|
||||
24 | }
|
||||
25 |
|
||||
26 | console.log('Hello, world!');
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:40:2
|
||||
38 | }
|
||||
39 |
|
||||
> 40 | console.log('Hello, world!');
|
||||
error.todo-missing-source-locations.ts:26:2
|
||||
24 | }
|
||||
25 |
|
||||
> 26 | console.log('Hello, world!');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
41 |
|
||||
42 | return [y, foo, bar];
|
||||
43 | }
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:40:10
|
||||
38 | }
|
||||
39 |
|
||||
> 40 | console.log('Hello, world!');
|
||||
| ^^^
|
||||
41 |
|
||||
42 | return [y, foo, bar];
|
||||
43 | }
|
||||
27 |
|
||||
28 | return [y, foo, bar];
|
||||
29 | }
|
||||
|
||||
Todo: Important source location missing in generated code
|
||||
|
||||
Source location for ReturnStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports..
|
||||
|
||||
error.todo-missing-source-locations.ts:42:2
|
||||
40 | console.log('Hello, world!');
|
||||
41 |
|
||||
> 42 | return [y, foo, bar];
|
||||
error.todo-missing-source-locations.ts:28:2
|
||||
26 | console.log('Hello, world!');
|
||||
27 |
|
||||
> 28 | return [y, foo, bar];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
43 | }
|
||||
44 |
|
||||
29 | }
|
||||
30 |
|
||||
```
|
||||
|
||||
|
||||
@@ -6,28 +6,14 @@ function Component({prop1, prop2}) {
|
||||
const y = x * 2;
|
||||
const arr = [x, y];
|
||||
const obj = {x, y};
|
||||
let destA, destB;
|
||||
if (y > 5) {
|
||||
[destA, destB] = arr;
|
||||
}
|
||||
|
||||
const [a, b] = arr;
|
||||
const {x: c, y: d} = obj;
|
||||
let sound;
|
||||
|
||||
if (y > 10) {
|
||||
sound = 'woof';
|
||||
} else {
|
||||
sound = 'meow';
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (a > 10) {
|
||||
console.log(a);
|
||||
console.log(sound);
|
||||
console.log(destA, destB);
|
||||
}
|
||||
}, [a, sound, destA, destB]);
|
||||
}, [a]);
|
||||
|
||||
const foo = useCallback(() => {
|
||||
return a + b;
|
||||
|
||||
@@ -44,6 +44,7 @@ function Component(props) {
|
||||
let t0;
|
||||
if ($[0] !== props.a) {
|
||||
const a = [props.a];
|
||||
|
||||
t0 = [a];
|
||||
$[0] = props.a;
|
||||
$[1] = t0;
|
||||
|
||||
@@ -40,11 +40,13 @@ function Component(props) {
|
||||
[
|
||||
fbt._param(
|
||||
"a really long description that got split into multiple lines",
|
||||
|
||||
props.name,
|
||||
),
|
||||
],
|
||||
{ hk: "1euPUp" },
|
||||
);
|
||||
|
||||
t0 = element.toString();
|
||||
$[0] = props.name;
|
||||
$[1] = t0;
|
||||
|
||||
@@ -32,9 +32,16 @@ function Component(props) {
|
||||
if ($[0] !== props.name) {
|
||||
const element = fbt._(
|
||||
'Hello {"user" name}',
|
||||
[fbt._param('"user" name', props.name)],
|
||||
[
|
||||
fbt._param(
|
||||
'"user" name',
|
||||
|
||||
props.name,
|
||||
),
|
||||
],
|
||||
{ hk: "S0vMe" },
|
||||
);
|
||||
|
||||
t0 = element.toString();
|
||||
$[0] = props.name;
|
||||
$[1] = t0;
|
||||
|
||||
@@ -32,9 +32,16 @@ function Component(props) {
|
||||
if ($[0] !== props.name) {
|
||||
const element = fbt._(
|
||||
"Hello {user name ☺}",
|
||||
[fbt._param("user name \u263A", props.name)],
|
||||
[
|
||||
fbt._param(
|
||||
"user name \u263A",
|
||||
|
||||
props.name,
|
||||
),
|
||||
],
|
||||
{ hk: "1En1lp" },
|
||||
);
|
||||
|
||||
t0 = element.toString();
|
||||
$[0] = props.name;
|
||||
$[1] = t0;
|
||||
|
||||
@@ -32,9 +32,16 @@ function Component(props) {
|
||||
if ($[0] !== props.name) {
|
||||
const element = fbt._(
|
||||
"Hello {user name}",
|
||||
[fbt._param("user name", props.name)],
|
||||
[
|
||||
fbt._param(
|
||||
"user name",
|
||||
|
||||
props.name,
|
||||
),
|
||||
],
|
||||
{ hk: "2zEDKF" },
|
||||
);
|
||||
|
||||
t0 = element.toString();
|
||||
$[0] = props.name;
|
||||
$[1] = t0;
|
||||
|
||||
@@ -78,6 +78,7 @@ function Component(t0) {
|
||||
setState(5);
|
||||
}
|
||||
};
|
||||
|
||||
t3 = [state];
|
||||
$[1] = state;
|
||||
$[2] = t2;
|
||||
|
||||
@@ -33,6 +33,7 @@ function Component(props) {
|
||||
for (const key in props) {
|
||||
items.push(<div key={key}>{key}</div>);
|
||||
}
|
||||
|
||||
t0 = <div>{items}</div>;
|
||||
$[0] = props;
|
||||
$[1] = t0;
|
||||
|
||||
@@ -73,6 +73,7 @@ function Component(props) {
|
||||
const item = props.items[i];
|
||||
items.push(<div key={item.id}>{item.value}</div>);
|
||||
}
|
||||
|
||||
t0 = <div>{items}</div>;
|
||||
$[0] = props.items;
|
||||
$[1] = props.start;
|
||||
|
||||
@@ -38,6 +38,7 @@ function Component(_props) {
|
||||
<div key={toJSON(item)}>{toJSON(mutateAndReturn(item))}</div>,
|
||||
);
|
||||
}
|
||||
|
||||
t0 = <div>{results}</div>;
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -29,6 +29,7 @@ function Component(props) {
|
||||
const onLoad = () => {
|
||||
log(id);
|
||||
};
|
||||
|
||||
t0 = <Foo onLoad={onLoad} />;
|
||||
$[0] = id;
|
||||
$[1] = t0;
|
||||
|
||||
@@ -27,6 +27,7 @@ function Component(props) {
|
||||
const f = function () {
|
||||
return <div>{props.name}</div>;
|
||||
};
|
||||
|
||||
t0 = f.call();
|
||||
$[0] = props;
|
||||
$[1] = t0;
|
||||
|
||||
@@ -29,6 +29,7 @@ function Component(props) {
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const maybeMutable = new MaybeMutable();
|
||||
|
||||
t0 = <View>{maybeMutate(maybeMutable)}</View>;
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -60,6 +60,7 @@ function useFoo(t0) {
|
||||
if ($[3] !== propArr[1] || $[4] !== propArr[2]) {
|
||||
s2 = new Set(MODULE_LOCAL.values());
|
||||
s2.add(propArr[1]);
|
||||
|
||||
s3 = new Set(s2.values());
|
||||
s3.add(propArr[2]);
|
||||
$[3] = propArr[1];
|
||||
|
||||
@@ -41,6 +41,7 @@ function useFoo(t0) {
|
||||
if ($[0] !== propArr[0]) {
|
||||
s1 = new Set([1, 2, 3]);
|
||||
s1.add(makeArray(propArr[0]));
|
||||
|
||||
s2 = new Set(s1);
|
||||
|
||||
mutate(s2);
|
||||
|
||||
@@ -37,6 +37,7 @@ function Foo() {
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const [t1, t2] = [1, { x: 2 }];
|
||||
const a = t1;
|
||||
const { x: t3, y: t4 } = t2;
|
||||
|
||||
@@ -39,11 +39,14 @@ function hoisting() {
|
||||
const onClick = function onClick() {
|
||||
return bar.baz;
|
||||
};
|
||||
|
||||
const onClick2 = function onClick2() {
|
||||
return bar[baz];
|
||||
};
|
||||
|
||||
const baz = "baz";
|
||||
const bar = { baz: 1 };
|
||||
|
||||
t0 = (
|
||||
<Stringify onClick={onClick} onClick2={onClick2} shouldInvokeFns={true} />
|
||||
);
|
||||
|
||||
@@ -66,6 +66,7 @@ function Component(t0) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
t1 = <Stringify shouldInvokeFns={true} callback={callback} />;
|
||||
$[0] = isObjNull;
|
||||
$[1] = obj;
|
||||
|
||||
@@ -36,10 +36,12 @@ function useHook(t0) {
|
||||
let t1;
|
||||
if ($[0] !== cond) {
|
||||
const getX = () => x;
|
||||
|
||||
let x;
|
||||
if (cond) {
|
||||
x = CONST_NUMBER1;
|
||||
}
|
||||
|
||||
t1 = <Stringify getX={getX} shouldInvokeFns={true} />;
|
||||
$[0] = cond;
|
||||
$[1] = t1;
|
||||
|
||||
@@ -34,7 +34,9 @@ function hoisting() {
|
||||
const onClick = function onClick(x) {
|
||||
return x + bar.baz;
|
||||
};
|
||||
|
||||
const bar = { baz: 1 };
|
||||
|
||||
t0 = <Stringify onClick={onClick} />;
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -36,10 +36,13 @@ function hoisting() {
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const qux = () => {
|
||||
let result;
|
||||
|
||||
result = foo();
|
||||
return result;
|
||||
};
|
||||
|
||||
const foo = () => bar + baz;
|
||||
|
||||
const bar = 3;
|
||||
const baz = 2;
|
||||
t0 = qux();
|
||||
|
||||
@@ -36,10 +36,13 @@ function hoisting() {
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const qux = () => {
|
||||
let result;
|
||||
|
||||
result = foo();
|
||||
return result;
|
||||
};
|
||||
|
||||
let foo = () => bar + baz;
|
||||
|
||||
let bar = 3;
|
||||
const baz = 2;
|
||||
t0 = qux();
|
||||
|
||||
@@ -36,6 +36,7 @@ function hoisting() {
|
||||
},
|
||||
};
|
||||
const bar = _temp;
|
||||
|
||||
t0 = x.foo();
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -36,11 +36,13 @@ function useHook(t0) {
|
||||
let t1;
|
||||
if ($[0] !== cond) {
|
||||
const getX = () => x;
|
||||
|
||||
let x = CONST_NUMBER0;
|
||||
if (cond) {
|
||||
x = x + CONST_NUMBER1;
|
||||
x;
|
||||
}
|
||||
|
||||
t1 = <Stringify getX={getX} shouldInvokeFns={true} />;
|
||||
$[0] = cond;
|
||||
$[1] = t1;
|
||||
|
||||
@@ -37,12 +37,14 @@ function useHook(t0) {
|
||||
let t1;
|
||||
if ($[0] !== cond) {
|
||||
const getX = () => x;
|
||||
|
||||
let x = CONST_NUMBER0;
|
||||
if (cond) {
|
||||
x = x + CONST_NUMBER1;
|
||||
x;
|
||||
x = Math.min(x, 100);
|
||||
}
|
||||
|
||||
t1 = <Stringify getX={getX} shouldInvokeFns={true} />;
|
||||
$[0] = cond;
|
||||
$[1] = t1;
|
||||
|
||||
@@ -37,6 +37,7 @@ function Foo(t0) {
|
||||
return x * factorial(x - 1);
|
||||
}
|
||||
};
|
||||
|
||||
t1 = factorial(value);
|
||||
$[0] = value;
|
||||
$[1] = t1;
|
||||
|
||||
@@ -30,6 +30,7 @@ function get2() {
|
||||
const copy = x;
|
||||
return copy;
|
||||
};
|
||||
|
||||
const x = 2;
|
||||
t0 = callbk();
|
||||
$[0] = t0;
|
||||
|
||||
@@ -49,6 +49,7 @@ function useFoo() {
|
||||
let t2;
|
||||
if ($[2] !== handleLogout) {
|
||||
const getComponent = () => <ColumnItem onPress={() => handleLogout()} />;
|
||||
|
||||
t2 = getComponent();
|
||||
$[2] = handleLogout;
|
||||
$[3] = t2;
|
||||
|
||||
@@ -30,7 +30,9 @@ function hoisting() {
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const foo = () => bar();
|
||||
|
||||
const bar = _temp;
|
||||
|
||||
t0 = foo();
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -61,6 +61,7 @@ function Component() {
|
||||
let t1;
|
||||
if ($[2] !== state) {
|
||||
const doubledArray = makeArray(state);
|
||||
|
||||
t1 = doubledArray.join("");
|
||||
$[2] = state;
|
||||
$[3] = t1;
|
||||
|
||||
@@ -29,6 +29,7 @@ function Component(props) {
|
||||
let t0;
|
||||
if ($[0] !== props) {
|
||||
var _ref;
|
||||
|
||||
t0 =
|
||||
(_ref = props) != null
|
||||
? (_ref = _ref.group) != null
|
||||
|
||||
@@ -30,6 +30,7 @@ function Component(props) {
|
||||
let items;
|
||||
if ($[0] !== props.a || $[1] !== props.cond) {
|
||||
let t0;
|
||||
|
||||
if (props.cond) {
|
||||
t0 = [];
|
||||
} else {
|
||||
|
||||
@@ -34,6 +34,7 @@ function Component(t0) {
|
||||
let t1;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
a = "a";
|
||||
|
||||
const [t2, t3] = [null, null];
|
||||
t1 = t3;
|
||||
a = t2;
|
||||
|
||||
@@ -40,6 +40,7 @@ function Test() {
|
||||
return _temp;
|
||||
},
|
||||
};
|
||||
|
||||
t0 = <Stringify value={context} shouldInvokeFns={true} />;
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -77,6 +77,7 @@ function Component(t0) {
|
||||
hasLogged.current = true;
|
||||
}
|
||||
};
|
||||
|
||||
t3 = <Stringify log={log} shouldInvokeFns={true} />;
|
||||
$[4] = logA;
|
||||
$[5] = logB;
|
||||
|
||||
@@ -48,6 +48,7 @@ import { useIdentity } from "shared-runtime";
|
||||
function useMakeCallback(t0) {
|
||||
const $ = _c(2);
|
||||
const { obj, shouldSynchronizeState } = t0;
|
||||
|
||||
const [, setState] = useState(0);
|
||||
let t1;
|
||||
if ($[0] !== obj.value) {
|
||||
|
||||
@@ -33,6 +33,7 @@ function Component(props) {
|
||||
let t1;
|
||||
if ($[0] !== item) {
|
||||
const count = new MaybeMutable(item);
|
||||
|
||||
T1 = View;
|
||||
T0 = View;
|
||||
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
|
||||
@@ -25,6 +25,7 @@ function Component(props) {
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const count = new MaybeMutable();
|
||||
|
||||
t0 = (
|
||||
<View>
|
||||
<View>
|
||||
|
||||
@@ -35,6 +35,7 @@ function Component() {
|
||||
const f = () => {
|
||||
setState(_temp);
|
||||
};
|
||||
|
||||
t0 = () => {
|
||||
f();
|
||||
};
|
||||
|
||||
@@ -59,6 +59,7 @@ function Component(props) {
|
||||
if ($[0] !== props.alternateComponent || $[1] !== props.component) {
|
||||
const maybeMutable = new MaybeMutable();
|
||||
Tag = props.component;
|
||||
|
||||
T0 = Tag;
|
||||
t0 = ((Tag = props.alternateComponent), maybeMutate(maybeMutable));
|
||||
$[0] = props.alternateComponent;
|
||||
|
||||
@@ -32,7 +32,9 @@ function Foo() {
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const x = [{ value: 0 }, { value: 1 }, { value: 2 }];
|
||||
|
||||
const foo = () => x[CONST_NUMBER0].value;
|
||||
|
||||
t0 = invoke(foo);
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -32,6 +32,7 @@ function Foo() {
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const x = [{ value: 0 }, { value: 1 }, { value: 2 }];
|
||||
const foo = (param) => x[param].value;
|
||||
|
||||
t0 = invoke(foo, 1);
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -46,10 +46,12 @@ function CaptureNotMutate(props) {
|
||||
let aliasedElement;
|
||||
if ($[2] !== idx || $[3] !== props.el) {
|
||||
const element = bar(props.el);
|
||||
|
||||
const fn = function () {
|
||||
const arr = { element };
|
||||
return arr[idx];
|
||||
};
|
||||
|
||||
aliasedElement = fn();
|
||||
mutate(aliasedElement);
|
||||
$[2] = idx;
|
||||
|
||||
@@ -36,6 +36,7 @@ function Component(props) {
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const object = {};
|
||||
|
||||
t0 = () => {
|
||||
mutate(object);
|
||||
};
|
||||
|
||||
@@ -43,15 +43,18 @@ function Component(props) {
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const a = () => b();
|
||||
|
||||
const b = () => (
|
||||
<>
|
||||
<div onClick={() => onClick(true)}>a</div>
|
||||
<div onClick={() => onClick(false)}>b</div>
|
||||
</>
|
||||
);
|
||||
|
||||
const onClick = (value) => {
|
||||
setState(value);
|
||||
};
|
||||
|
||||
t0 = <div>{a()}</div>;
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -94,14 +94,19 @@ function testFunction(props) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (a) {
|
||||
}
|
||||
|
||||
if (b) {
|
||||
}
|
||||
|
||||
if (c) {
|
||||
}
|
||||
|
||||
if (d) {
|
||||
}
|
||||
|
||||
mutate(d, null);
|
||||
t0 = { a, b, c, d };
|
||||
$[0] = t0;
|
||||
|
||||
@@ -74,6 +74,7 @@ function Component(props) {
|
||||
const b = [a];
|
||||
const c = {};
|
||||
const d = { c };
|
||||
|
||||
x = {};
|
||||
x.b = b;
|
||||
const y = mutate(x, d);
|
||||
|
||||
@@ -76,6 +76,7 @@ function useFoo(t0) {
|
||||
let t1;
|
||||
if ($[0] !== input) {
|
||||
const arr = shallowCopy(input);
|
||||
|
||||
const cond = identity(false);
|
||||
t1 = cond ? { val: CONST_TRUE } : mutate(arr);
|
||||
$[0] = input;
|
||||
|
||||
@@ -32,6 +32,7 @@ function Component(props) {
|
||||
let element;
|
||||
if ($[0] !== props.value) {
|
||||
const key = {};
|
||||
|
||||
element = <div key={mutateAndReturnNewValue(key)}>{props.value}</div>;
|
||||
|
||||
mutate(key);
|
||||
|
||||
@@ -58,6 +58,7 @@ function useFoo(t0) {
|
||||
const x = { a };
|
||||
const y = [b];
|
||||
mutate(x);
|
||||
|
||||
z = [mutate(y)];
|
||||
|
||||
mutate(y);
|
||||
|
||||
@@ -182,9 +182,12 @@ function Component(t0) {
|
||||
if ($[0] !== prop) {
|
||||
const obj = shallowCopy(prop);
|
||||
const aliasedObj = identity(obj);
|
||||
|
||||
const id = [obj.id];
|
||||
|
||||
mutate(aliasedObj);
|
||||
setPropertyByKey(aliasedObj, "id", prop.id + 1);
|
||||
|
||||
t1 = <Stringify id={id} />;
|
||||
$[0] = prop;
|
||||
$[1] = t1;
|
||||
|
||||
@@ -31,6 +31,7 @@ function Component(t0) {
|
||||
y.x = x;
|
||||
mutate(y);
|
||||
};
|
||||
|
||||
f();
|
||||
t1 = <div>{x}</div>;
|
||||
$[0] = a;
|
||||
|
||||
@@ -53,6 +53,7 @@ function Component(t0) {
|
||||
let z;
|
||||
if ($[0] !== prop1 || $[1] !== prop2) {
|
||||
let x = [{ value: prop1 }];
|
||||
|
||||
while (x.length < 2) {
|
||||
arrayPush(x, { value: prop2 });
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ function Component(t0) {
|
||||
const b = { x };
|
||||
a.y.x = b;
|
||||
};
|
||||
|
||||
f0();
|
||||
mutate(y);
|
||||
t1 = <Stringify x={y} />;
|
||||
|
||||
@@ -30,6 +30,7 @@ function Component(props) {
|
||||
let items;
|
||||
if ($[0] !== props.a || $[1] !== props.cond) {
|
||||
let t0;
|
||||
|
||||
if (props.cond) {
|
||||
t0 = [];
|
||||
} else {
|
||||
|
||||
@@ -41,6 +41,7 @@ function Component(t0) {
|
||||
const y = [x];
|
||||
return y[0];
|
||||
};
|
||||
|
||||
const x0 = f();
|
||||
const z = [x0];
|
||||
const x1 = z[0];
|
||||
|
||||
@@ -42,6 +42,7 @@ function Component(t0) {
|
||||
const x0 = y[0];
|
||||
return [x0];
|
||||
};
|
||||
|
||||
const z = f();
|
||||
const x1 = z[0];
|
||||
x1.key = "value";
|
||||
|
||||
@@ -32,6 +32,7 @@ function Component(props) {
|
||||
let context;
|
||||
if ($[0] !== props.value) {
|
||||
const key = { a: "key" };
|
||||
|
||||
const t0 = key.a;
|
||||
const t1 = identity([props.value]);
|
||||
let t2;
|
||||
|
||||
@@ -45,6 +45,7 @@ function Component() {
|
||||
.build({})
|
||||
.build({});
|
||||
};
|
||||
|
||||
t1 = <Stringify x={x} fn={fn} />;
|
||||
$[1] = t1;
|
||||
} else {
|
||||
|
||||
@@ -38,8 +38,10 @@ function Component(t0) {
|
||||
while (z == null) {
|
||||
z = x;
|
||||
}
|
||||
|
||||
z.y = y;
|
||||
};
|
||||
|
||||
f();
|
||||
mutate(x);
|
||||
t1 = <div>{x}</div>;
|
||||
|
||||
@@ -33,8 +33,11 @@ function Example() {
|
||||
let t0;
|
||||
if ($[0] !== data) {
|
||||
const { a, b } = identity(data);
|
||||
|
||||
const el = <Stringify tooltip={b} />;
|
||||
|
||||
identity(a.at(0));
|
||||
|
||||
t0 = <Stringify icon={el} />;
|
||||
$[0] = data;
|
||||
$[1] = t0;
|
||||
|
||||
@@ -56,7 +56,9 @@ function Foo(t0) {
|
||||
let t2;
|
||||
if ($[2] !== arr2 || $[3] !== foo || $[4] !== x) {
|
||||
let y = [];
|
||||
|
||||
getVal1 = _temp;
|
||||
|
||||
t2 = () => [y];
|
||||
foo ? (y = x.concat(arr2)) : y;
|
||||
$[2] = arr2;
|
||||
|
||||
@@ -30,6 +30,7 @@ function Component(props) {
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
const key = {};
|
||||
|
||||
t0 = mutateAndReturn(key);
|
||||
$[0] = t0;
|
||||
} else {
|
||||
|
||||
@@ -31,6 +31,7 @@ function Component(props) {
|
||||
let context;
|
||||
if ($[0] !== props.value) {
|
||||
const key = { a: "key" };
|
||||
|
||||
const t0 = key.a;
|
||||
const t1 = identity([props.value]);
|
||||
let t2;
|
||||
|
||||
@@ -27,6 +27,7 @@ function Component(props) {
|
||||
let t0;
|
||||
if ($[0] !== props) {
|
||||
const x = makeOptionalFunction(props);
|
||||
|
||||
t0 = x?.(
|
||||
<div>
|
||||
<span>{props.text}</span>
|
||||
|
||||
@@ -46,6 +46,7 @@ function useKeyCommand() {
|
||||
const nextPosition = direction === "left" ? addOne(position) : position;
|
||||
currentPosition.current = nextPosition;
|
||||
};
|
||||
|
||||
const moveLeft = { handler: handleKey("left") };
|
||||
const moveRight = { handler: handleKey("right") };
|
||||
t0 = [moveLeft, moveRight];
|
||||
|
||||
@@ -75,7 +75,9 @@ function Component(props) {
|
||||
} else {
|
||||
y = [];
|
||||
}
|
||||
|
||||
y.push(x);
|
||||
|
||||
t1 = [x, y];
|
||||
$[1] = props.cond;
|
||||
$[2] = props.cond2;
|
||||
|
||||
@@ -53,7 +53,9 @@ function Component(props) {
|
||||
} else {
|
||||
y = [];
|
||||
}
|
||||
|
||||
y.push(x);
|
||||
|
||||
t1 = [x, y];
|
||||
$[1] = props.cond;
|
||||
$[2] = props.value;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user