@samitouri / QOS-React / commits / 2aa3a28481

test case for debugger stmt in reactive scope

Joe Savona committed Apr 26, 2023 at 11:34 UTC 2aa3a284810424bee7064fa0748c260f8121bb5e
2 files changed +42
compiler/forget/src/__tests__/fixtures/compiler/debugger-memoized.expect.md new
+36
@@ -0,0 +1,36 @@
1 +
2 +## Input
3 +
4 +```javascript
5 +function Component(props) {
6 + const x = [];
7 + debugger;
8 + x.push(props.value);
9 + return x;
10 +}
11 +
12 +```
13 +
14 +## Code
15 +
16 +```javascript
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 +function Component(props) {
19 + const $ = useMemoCache(2);
20 + const c_0 = $[0] !== props.value;
21 + let x;
22 + if (c_0) {
23 + x = [];
24 + debugger;
25 +
26 + x.push(props.value);
27 + $[0] = props.value;
28 + $[1] = x;
29 + } else {
30 + x = $[1];
31 + }
32 + return x;
33 +}
34 +
35 +```
36 +
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/compiler/debugger-memoized.js new
+6
@@ -0,0 +1,6 @@
1 +function Component(props) {
2 + const x = [];
3 + debugger;
4 + x.push(props.value);
5 + return x;
6 +}