[repro] repro for ContextVariable bug (ObjectMethod)

Found from eslint validator on www after doing a local sync + RunForget test of 
#2432 

P898168203 

> New Errors: 

> no-undef:'VARIABLE_NAME' is not defined.
This commit is contained in:
Mofei Zhang
2023-12-06 13:20:49 -05:00
parent 7e9f6ecfea
commit d3e84d4dff
3 changed files with 71 additions and 0 deletions
@@ -0,0 +1,54 @@
## Input
```javascript
import { identity } from "shared-runtime";
function Foo() {
const CONSTANT = 1;
const x = {
foo() {
return identity(CONSTANT);
},
};
return x.foo();
}
export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{}],
};
```
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
import { identity } from "shared-runtime";
function Foo() {
const $ = useMemoCache(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const x = {
foo() {
return identity(CONSTANT);
},
};
t0 = x.foo();
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}
export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{}],
};
```
@@ -0,0 +1,16 @@
import { identity } from "shared-runtime";
function Foo() {
const CONSTANT = 1;
const x = {
foo() {
return identity(CONSTANT);
},
};
return x.foo();
}
export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{}],
};
@@ -515,6 +515,7 @@ const skipFilter = new Set([
"bug-jsx-memberexpr-tag-in-lambda",
"bug-invalid-code-when-bailout",
"component-syntax-ref-gating.flow",
"bug-context-vars-in-object-method",
// 'react-forget-runtime' not yet supported
"flag-enable-emit-hook-guards",