Add github_code/react__react from GitHub - direct commit (part 4)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.jsAdded+17
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate-iife.expect.mdAdded+58
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate-iife.jsAdded+17
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.mdAdded+66
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.jsAdded+19
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate-iife.expect.mdAdded+58
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate-iife.jsAdded+17
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.mdAdded+66
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.jsAdded+19
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.mdAdded+55
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-2.jsAdded+16
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.mdAdded+49
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-3.jsAdded+15
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.mdAdded+51
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.jsAdded+14
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.mdAdded+76
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate.jsAdded+23
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-no-mutate.expect.mdAdded+80
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-no-mutate.jsAdded+21
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias-iife.expect.mdAdded+56
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias-iife.jsAdded+16
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.mdAdded+64
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.jsAdded+18
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-1.expect.mdAdded+50
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-1.jsAdded+13
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2-iife.expect.mdAdded+61
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2-iife.jsAdded+15
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.mdAdded+57
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.jsAdded+16
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3-iife.expect.mdAdded+71
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3-iife.jsAdded+19
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.mdAdded+66
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.jsAdded+20
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4-iife.expect.mdAdded+61
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4-iife.jsAdded+15
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.mdAdded+57
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.jsAdded+16
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-iife.expect.mdAdded+59
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-iife.jsAdded+14
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.mdAdded+55
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.jsAdded+16
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.mdAdded+96
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.jsAdded+27
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.mdAdded+56
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.jsAdded+13
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-decl.expect.mdAdded+51
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-decl.jsAdded+14
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.mdAdded+40
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.jsAdded+10
- github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.mdAdded+61
1234567891011121314151617import {mutate} from 'shared-runtime';function Component({a}) { let x = {a}; let y = {}; const f0 = function () { y.x = x; }; f0(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2}], sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],};12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
## Input
```javascriptimport {mutate} from 'shared-runtime';
function component(a) { let x = {a}; let y = {}; (function () { let a = y; a['x'] = x; })(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['foo'],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";import { mutate } from "shared-runtime";
function component(a) { const $ = _c(2); let y; if ($[0] !== a) { const x = { a }; y = {};
const a_0 = y; a_0.x = x;
mutate(y); $[0] = a; $[1] = y; } else { y = $[1]; } return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ["foo"],};
``` ### Eval output(kind: ok) {"x":{"a":"foo"},"wat0":"joe"}1234567891011121314151617import {mutate} from 'shared-runtime';
function component(a) { let x = {a}; let y = {}; (function () { let a = y; a['x'] = x; })(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['foo'],};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
## Input
```javascriptimport {mutate} from 'shared-runtime';
function Component({a}) { let x = {a}; let y = {}; const f0 = function () { let a = y; a['x'] = x; }; f0(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2}], sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";import { mutate } from "shared-runtime";
function Component(t0) { const $ = _c(2); const { a } = t0; let y; if ($[0] !== a) { const x = { a }; y = {}; const f0 = function () { const a_0 = y; a_0.x = x; };
f0(); mutate(y); $[0] = a; $[1] = y; } else { y = $[1]; } return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{ a: 2 }], sequentialRenders: [{ a: 2 }, { a: 2 }, { a: 3 }],};
``` ### Eval output(kind: ok) {"x":{"a":2},"wat0":"joe"}{"x":{"a":2},"wat0":"joe"}{"x":{"a":3},"wat0":"joe"}12345678910111213141516171819import {mutate} from 'shared-runtime';
function Component({a}) { let x = {a}; let y = {}; const f0 = function () { let a = y; a['x'] = x; }; f0(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2}], sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],};12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
## Input
```javascriptconst {mutate} = require('shared-runtime');
function component(a) { let x = {a}; let y = {}; (function () { let a = y; a.x = x; })(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['foo'],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";const { mutate } = require("shared-runtime");
function component(a) { const $ = _c(2); let y; if ($[0] !== a) { const x = { a }; y = {};
const a_0 = y; a_0.x = x;
mutate(y); $[0] = a; $[1] = y; } else { y = $[1]; } return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ["foo"],};
``` ### Eval output(kind: ok) {"x":{"a":"foo"},"wat0":"joe"}1234567891011121314151617const {mutate} = require('shared-runtime');
function component(a) { let x = {a}; let y = {}; (function () { let a = y; a.x = x; })(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['foo'],};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
## Input
```javascriptimport {mutate} from 'shared-runtime';
function Component({a}) { let x = {a}; let y = {}; const f0 = function () { let a = y; a.x = x; }; f0(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2}], sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";import { mutate } from "shared-runtime";
function Component(t0) { const $ = _c(2); const { a } = t0; let y; if ($[0] !== a) { const x = { a }; y = {}; const f0 = function () { const a_0 = y; a_0.x = x; };
f0(); mutate(y); $[0] = a; $[1] = y; } else { y = $[1]; } return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{ a: 2 }], sequentialRenders: [{ a: 2 }, { a: 2 }, { a: 3 }],};
``` ### Eval output(kind: ok) {"x":{"a":2},"wat0":"joe"}{"x":{"a":2},"wat0":"joe"}{"x":{"a":3},"wat0":"joe"}12345678910111213141516171819import {mutate} from 'shared-runtime';
function Component({a}) { let x = {a}; let y = {}; const f0 = function () { let a = y; a.x = x; }; f0(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2}], sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],};12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
## Input
```javascriptfunction component(a, b) { let y = {b}; let z = {a}; let x = function () { z.a = 2; y.b; }; x(); return z;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: [{a: 'val1', b: 'val2'}], isComponent: false,};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function component(a, b) { const $ = _c(2); let z; if ($[0] !== a) { z = { a }; const x = function () { z.a = 2; };
x(); $[0] = a; $[1] = z; } else { z = $[1]; } return z;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: [{ a: "val1", b: "val2" }], isComponent: false,};
``` ### Eval output(kind: ok) {"a":2}12345678910111213141516function component(a, b) { let y = {b}; let z = {a}; let x = function () { z.a = 2; y.b; }; x(); return z;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: [{a: 'val1', b: 'val2'}], isComponent: false,};12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
## Input
```javascriptfunction component(a, b) { let y = {b}; let z = {a}; let x = function () { z.a = 2; y.b; }; return z;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['TodoAdd'], isComponent: 'TodoAdd',};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function component(a, b) { const $ = _c(2); let t0; if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; } else { t0 = $[1]; } const z = t0;
return z;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ["TodoAdd"], isComponent: "TodoAdd",};
``` 123456789101112131415function component(a, b) { let y = {b}; let z = {a}; let x = function () { z.a = 2; y.b; }; return z;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['TodoAdd'], isComponent: 'TodoAdd',};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
## Input
```javascriptfunction component(a) { let y = {b: {a}}; let x = function () { y.b.a = 2; }; x(); return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['TodoAdd'], isComponent: 'TodoAdd',};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function component(a) { const $ = _c(2); let y; if ($[0] !== a) { y = { b: { a } }; const x = function () { y.b.a = 2; };
x(); $[0] = a; $[1] = y; } else { y = $[1]; } return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ["TodoAdd"], isComponent: "TodoAdd",};
``` 1234567891011121314function component(a) { let y = {b: {a}}; let x = function () { y.b.a = 2; }; x(); return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['TodoAdd'], isComponent: 'TodoAdd',};12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
## Input
```javascriptimport {mutate} from 'shared-runtime';
function Component({a, b}) { let z = {a}; let y = {b: {b}}; let x = function () { z.a = 2; mutate(y.b); }; x(); return [y, z];}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2, b: 3}], sequentialRenders: [ {a: 2, b: 3}, {a: 2, b: 3}, {a: 4, b: 3}, {a: 4, b: 5}, ],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";import { mutate } from "shared-runtime";
function Component(t0) { const $ = _c(3); const { a, b } = t0; let t1; if ($[0] !== a || $[1] !== b) { const z = { a }; const y = { b: { b } }; const x = function () { z.a = 2; mutate(y.b); }; x(); t1 = [y, z]; $[0] = a; $[1] = b; $[2] = t1; } else { t1 = $[2]; } return t1;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{ a: 2, b: 3 }], sequentialRenders: [ { a: 2, b: 3 }, { a: 2, b: 3 }, { a: 4, b: 3 }, { a: 4, b: 5 }, ],};
``` ### Eval output(kind: ok) [{"b":{"b":3,"wat0":"joe"}},{"a":2}][{"b":{"b":3,"wat0":"joe"}},{"a":2}][{"b":{"b":3,"wat0":"joe"}},{"a":2}][{"b":{"b":5,"wat0":"joe"}},{"a":2}]1234567891011121314151617181920212223import {mutate} from 'shared-runtime';
function Component({a, b}) { let z = {a}; let y = {b: {b}}; let x = function () { z.a = 2; mutate(y.b); }; x(); return [y, z];}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2, b: 3}], sequentialRenders: [ {a: 2, b: 3}, {a: 2, b: 3}, {a: 4, b: 3}, {a: 4, b: 5}, ],};1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
## Input
```javascriptfunction Component({a, b}) { let z = {a}; let y = {b}; let x = function () { z.a = 2; return Math.max(y.b, 0); }; x(); return z;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2, b: 3}], sequentialRenders: [ {a: 2, b: 3}, {a: 2, b: 3}, {a: 4, b: 3}, {a: 4, b: 5}, ],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function Component(t0) { const $ = _c(5); const { a, b } = t0; let z; if ($[0] !== a || $[1] !== b) { z = { a }; let t1; if ($[3] !== b) { t1 = { b }; $[3] = b; $[4] = t1; } else { t1 = $[4]; } const y = t1; const x = function () { z.a = 2; return Math.max(y.b, 0); };
x(); $[0] = a; $[1] = b; $[2] = z; } else { z = $[2]; } return z;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{ a: 2, b: 3 }], sequentialRenders: [ { a: 2, b: 3 }, { a: 2, b: 3 }, { a: 4, b: 3 }, { a: 4, b: 5 }, ],};
``` ### Eval output(kind: ok) {"a":2}{"a":2}{"a":2}{"a":2}123456789101112131415161718192021function Component({a, b}) { let z = {a}; let y = {b}; let x = function () { z.a = 2; return Math.max(y.b, 0); }; x(); return z;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2, b: 3}], sequentialRenders: [ {a: 2, b: 3}, {a: 2, b: 3}, {a: 4, b: 3}, {a: 4, b: 5}, ],};1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
## Input
```javascriptconst {mutate} = require('shared-runtime');
function component(a) { let x = {a}; let y = {}; (function () { y = x; })(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['foo'],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";const { mutate } = require("shared-runtime");
function component(a) { const $ = _c(2); let y; if ($[0] !== a) { const x = { a }; y = {};
y = x;
mutate(y); $[0] = a; $[1] = y; } else { y = $[1]; } return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ["foo"],};
``` ### Eval output(kind: ok) {"a":"foo","wat0":"joe"}12345678910111213141516const {mutate} = require('shared-runtime');
function component(a) { let x = {a}; let y = {}; (function () { y = x; })(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['foo'],};12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
## Input
```javascriptimport {mutate} from 'shared-runtime';
function Component({a}) { let x = {a}; let y = {}; const f0 = function () { y = x; }; f0(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2}], sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";import { mutate } from "shared-runtime";
function Component(t0) { const $ = _c(2); const { a } = t0; let y; if ($[0] !== a) { const x = { a }; y = {}; const f0 = function () { y = x; };
f0(); mutate(y); $[0] = a; $[1] = y; } else { y = $[1]; } return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{ a: 2 }], sequentialRenders: [{ a: 2 }, { a: 2 }, { a: 3 }],};
``` ### Eval output(kind: ok) {"a":2,"wat0":"joe"}{"a":2,"wat0":"joe"}{"a":3,"wat0":"joe"}123456789101112131415161718import {mutate} from 'shared-runtime';
function Component({a}) { let x = {a}; let y = {}; const f0 = function () { y = x; }; f0(); mutate(y); return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2}], sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],};1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
## Input
```javascriptfunction component(a) { let z = {a}; let x = function () { console.log(z); }; return x;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['TodoAdd'], isComponent: 'TodoAdd',};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function component(a) { const $ = _c(2); let t0; if ($[0] !== a) { const z = { a }; t0 = function () { console.log(z); }; $[0] = a; $[1] = t0; } else { t0 = $[1]; } const x = t0;
return x;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ["TodoAdd"], isComponent: "TodoAdd",};
``` 12345678910111213function component(a) { let z = {a}; let x = function () { console.log(z); }; return x;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['TodoAdd'], isComponent: 'TodoAdd',};12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
## Input
```javascriptfunction bar(a) { let x = [a]; let y = {}; (function () { y = x[0][1]; })();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [['val1', 'val2']], isComponent: false,};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function bar(a) { const $ = _c(4); let t0; if ($[0] !== a) { t0 = [a]; $[0] = a; $[1] = t0; } else { t0 = $[1]; } const x = t0; let y; if ($[2] !== x[0][1]) { y = {};
y = x[0][1]; $[2] = x[0][1]; $[3] = y; } else { y = $[3]; }
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [["val1", "val2"]], isComponent: false,};
``` ### Eval output(kind: ok) "val2"123456789101112131415function bar(a) { let x = [a]; let y = {}; (function () { y = x[0][1]; })();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [['val1', 'val2']], isComponent: false,};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
## Input
```javascriptfunction bar(a) { let x = [a]; let y = {}; const f0 = function () { y = x[0][1]; }; f0();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [['val1', 'val2']], isComponent: false,};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function bar(a) { const $ = _c(2); let y; if ($[0] !== a) { const x = [a]; y = {}; const f0 = function () { y = x[0][1]; };
f0(); $[0] = a; $[1] = y; } else { y = $[1]; }
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [["val1", "val2"]], isComponent: false,};
``` ### Eval output(kind: ok) "val2"12345678910111213141516function bar(a) { let x = [a]; let y = {}; const f0 = function () { y = x[0][1]; }; f0();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [['val1', 'val2']], isComponent: false,};1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
## Input
```javascriptfunction bar(a, b) { let x = [a, b]; let y = {}; let t = {}; (function () { y = x[0][1]; t = x[1][0]; })();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [ [1, 2], [2, 3], ],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function bar(a, b) { const $ = _c(6); let t0; if ($[0] !== a || $[1] !== b) { t0 = [a, b]; $[0] = a; $[1] = b; $[2] = t0; } else { t0 = $[2]; } const x = t0; let y; if ($[3] !== x[0][1] || $[4] !== x[1][0]) { y = {}; let t = {};
y = x[0][1]; t = x[1][0]; $[3] = x[0][1]; $[4] = x[1][0]; $[5] = y; } else { y = $[5]; }
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [ [1, 2], [2, 3], ],};
``` ### Eval output(kind: ok) 212345678910111213141516171819function bar(a, b) { let x = [a, b]; let y = {}; let t = {}; (function () { y = x[0][1]; t = x[1][0]; })();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [ [1, 2], [2, 3], ],};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
## Input
```javascriptfunction bar(a, b) { let x = [a, b]; let y = {}; let t = {}; const f0 = function () { y = x[0][1]; t = x[1][0]; }; f0();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [ [1, 2], [2, 3], ],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function bar(a, b) { const $ = _c(3); let y; if ($[0] !== a || $[1] !== b) { const x = [a, b]; y = {}; let t = {}; const f0 = function () { y = x[0][1]; t = x[1][0]; };
f0(); $[0] = a; $[1] = b; $[2] = y; } else { y = $[2]; }
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [ [1, 2], [2, 3], ],};
``` ### Eval output(kind: ok) 21234567891011121314151617181920function bar(a, b) { let x = [a, b]; let y = {}; let t = {}; const f0 = function () { y = x[0][1]; t = x[1][0]; }; f0();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [ [1, 2], [2, 3], ],};12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
## Input
```javascriptfunction bar(a) { let x = [a]; let y = {}; (function () { y = x[0].a[1]; })();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [{a: ['val1', 'val2']}], isComponent: false,};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function bar(a) { const $ = _c(4); let t0; if ($[0] !== a) { t0 = [a]; $[0] = a; $[1] = t0; } else { t0 = $[1]; } const x = t0; let y; if ($[2] !== x[0].a[1]) { y = {};
y = x[0].a[1]; $[2] = x[0].a[1]; $[3] = y; } else { y = $[3]; }
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [{ a: ["val1", "val2"] }], isComponent: false,};
``` ### Eval output(kind: ok) "val2"123456789101112131415function bar(a) { let x = [a]; let y = {}; (function () { y = x[0].a[1]; })();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [{a: ['val1', 'val2']}], isComponent: false,};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
## Input
```javascriptfunction bar(a) { let x = [a]; let y = {}; const f0 = function () { y = x[0].a[1]; }; f0();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [{a: ['val1', 'val2']}], isComponent: false,};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function bar(a) { const $ = _c(2); let y; if ($[0] !== a) { const x = [a]; y = {}; const f0 = function () { y = x[0].a[1]; };
f0(); $[0] = a; $[1] = y; } else { y = $[1]; }
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [{ a: ["val1", "val2"] }], isComponent: false,};
``` ### Eval output(kind: ok) "val2"12345678910111213141516function bar(a) { let x = [a]; let y = {}; const f0 = function () { y = x[0].a[1]; }; f0();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: [{a: ['val1', 'val2']}], isComponent: false,};1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
## Input
```javascriptfunction bar(a) { let x = [a]; let y = {}; (function () { y = x[0]; })();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: ['TodoAdd'],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function bar(a) { const $ = _c(4); let t0; if ($[0] !== a) { t0 = [a]; $[0] = a; $[1] = t0; } else { t0 = $[1]; } const x = t0; let y; if ($[2] !== x[0]) { y = {};
y = x[0]; $[2] = x[0]; $[3] = y; } else { y = $[3]; }
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: ["TodoAdd"],};
``` ### Eval output(kind: ok) "TodoAdd"1234567891011121314function bar(a) { let x = [a]; let y = {}; (function () { y = x[0]; })();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: ['TodoAdd'],};12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
## Input
```javascriptfunction bar(a) { let x = [a]; let y = {}; const f0 = function () { y = x[0]; }; f0();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: ['TodoAdd'], isComponent: 'TodoAdd',};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function bar(a) { const $ = _c(2); let y; if ($[0] !== a) { const x = [a]; y = {}; const f0 = function () { y = x[0]; };
f0(); $[0] = a; $[1] = y; } else { y = $[1]; }
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: ["TodoAdd"], isComponent: "TodoAdd",};
``` 12345678910111213141516function bar(a) { let x = [a]; let y = {}; const f0 = function () { y = x[0]; }; f0();
return y;}
export const FIXTURE_ENTRYPOINT = { fn: bar, params: ['TodoAdd'], isComponent: 'TodoAdd',};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
## Input
```javascriptimport {mutate} from 'shared-runtime';
function Component({a, b}) { let z = {a}; (function () { mutate(z); })(); let y = z;
{ // z is shadowed & renamed but the lambda is unaffected. let z = {b}; y = {y, z}; } return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2, b: 3}], sequentialRenders: [ {a: 2, b: 3}, {a: 2, b: 3}, {a: 2, b: 4}, {a: 3, b: 4}, ],};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";import { mutate } from "shared-runtime";
function Component(t0) { const $ = _c(7); const { a, b } = t0; let z; if ($[0] !== a) { z = { a };
mutate(z); $[0] = a; $[1] = z; } else { z = $[1]; }
let y = z; let t1; if ($[2] !== b) { t1 = { b }; $[2] = b; $[3] = t1; } else { t1 = $[3]; } const z_0 = t1; let t2; if ($[4] !== y || $[5] !== z_0) { t2 = { y, z: z_0 }; $[4] = y; $[5] = z_0; $[6] = t2; } else { t2 = $[6]; } y = t2;
return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{ a: 2, b: 3 }], sequentialRenders: [ { a: 2, b: 3 }, { a: 2, b: 3 }, { a: 2, b: 4 }, { a: 3, b: 4 }, ],};
``` ### Eval output(kind: ok) {"y":{"a":2,"wat0":"joe"},"z":{"b":3}}{"y":{"a":2,"wat0":"joe"},"z":{"b":3}}{"y":{"a":2,"wat0":"joe"},"z":{"b":4}}{"y":{"a":3,"wat0":"joe"},"z":{"b":4}}123456789101112131415161718192021222324252627import {mutate} from 'shared-runtime';
function Component({a, b}) { let z = {a}; (function () { mutate(z); })(); let y = z;
{ // z is shadowed & renamed but the lambda is unaffected. let z = {b}; y = {y, z}; } return y;}
export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{a: 2, b: 3}], sequentialRenders: [ {a: 2, b: 3}, {a: 2, b: 3}, {a: 2, b: 4}, {a: 3, b: 4}, ],};1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
## Input
```javascriptfunction useHook(a, b) { let z = {a}; let y = b; let x = function () { if (y) { // we don't know for sure this mutates, so we should assume // that there is no mutation so long as `x` isn't called // during render maybeMutate(z); } }; return x;}
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function useHook(a, b) { const $ = _c(5); let t0; if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; } else { t0 = $[1]; } const z = t0; const y = b; let t1; if ($[2] !== y || $[3] !== z) { t1 = function () { if (y) { maybeMutate(z); } }; $[2] = y; $[3] = z; $[4] = t1; } else { t1 = $[4]; } const x = t1;
return x;}
``` 12345678910111213function useHook(a, b) { let z = {a}; let y = b; let x = function () { if (y) { // we don't know for sure this mutates, so we should assume // that there is no mutation so long as `x` isn't called // during render maybeMutate(z); } }; return x;}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
## Input
```javascriptfunction component(a) { let t = {a}; function x() { t.foo(); } x(t); return t;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['TodoAdd'], isComponent: 'TodoAdd',};
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function component(a) { const $ = _c(2); let t; if ($[0] !== a) { t = { a }; const x = function x() { t.foo(); };
x(t); $[0] = a; $[1] = t; } else { t = $[1]; } return t;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ["TodoAdd"], isComponent: "TodoAdd",};
``` 1234567891011121314function component(a) { let t = {a}; function x() { t.foo(); } x(t); return t;}
export const FIXTURE_ENTRYPOINT = { fn: component, params: ['TodoAdd'], isComponent: 'TodoAdd',};12345678910111213141516171819202122232425262728293031323334353637383940
## Input
```javascriptfunction Foo(props) { const onFoo = useCallback( reason => { log(props.router.location); }, [props.router.location] );
return onFoo;}
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function Foo(props) { const $ = _c(2); let t0; if ($[0] !== props.router.location) { t0 = (reason) => { log(props.router.location); }; $[0] = props.router.location; $[1] = t0; } else { t0 = $[1]; } const onFoo = t0;
return onFoo;}
``` 12345678910function Foo(props) { const onFoo = useCallback( reason => { log(props.router.location); }, [props.router.location] );
return onFoo;}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
## Input
```javascriptfunction component({mutator}) { const poke = () => { mutator.poke(); };
const hide = () => { mutator.user.hide(); };
return <Foo poke={poke} hide={hide}></Foo>;}
```
## Code
```javascriptimport { c as _c } from "react/compiler-runtime";function component(t0) { const $ = _c(7); const { mutator } = t0; let t1; if ($[0] !== mutator) { t1 = () => { mutator.poke(); }; $[0] = mutator; $[1] = t1; } else { t1 = $[1]; } const poke = t1; let t2; if ($[2] !== mutator.user) { t2 = () => { mutator.user.hide(); }; $[2] = mutator.user; $[3] = t2; } else { t2 = $[3]; } const hide = t2; let t3; if ($[4] !== hide || $[5] !== poke) { t3 = <Foo poke={poke} hide={hide} />; $[4] = hide; $[5] = poke; $[6] = t3; } else { t3 = $[6]; } return t3;}
``` github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.jsAdded+17
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate-iife.expect.mdAdded+58
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate-iife.jsAdded+17
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.mdAdded+66
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.jsAdded+19
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate-iife.expect.mdAdded+58
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate-iife.jsAdded+17
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.mdAdded+66
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.jsAdded+19
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.mdAdded+55
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-2.jsAdded+16
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.mdAdded+49
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-3.jsAdded+15
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.mdAdded+51
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.jsAdded+14
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.mdAdded+76
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate.jsAdded+23
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-no-mutate.expect.mdAdded+80
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-no-mutate.jsAdded+21
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias-iife.expect.mdAdded+56
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias-iife.jsAdded+16
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.mdAdded+64
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.jsAdded+18
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-1.expect.mdAdded+50
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-1.jsAdded+13
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2-iife.expect.mdAdded+61
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2-iife.jsAdded+15
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.mdAdded+57
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.jsAdded+16
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3-iife.expect.mdAdded+71
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3-iife.jsAdded+19
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.mdAdded+66
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.jsAdded+20
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4-iife.expect.mdAdded+61
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4-iife.jsAdded+15
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.mdAdded+57
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.jsAdded+16
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-iife.expect.mdAdded+59
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-iife.jsAdded+14
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.mdAdded+55
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.jsAdded+16
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.mdAdded+96
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.jsAdded+27
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.mdAdded+56
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.jsAdded+13
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-decl.expect.mdAdded+51
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-decl.jsAdded+14
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.mdAdded+40
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.jsAdded+10
github_code/react__react/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.mdAdded+61