diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-var-in-nested-func-decl.expect.md b/compiler/forget/src/__tests__/fixtures/hir/capturing-var-in-nested-func-decl.expect.md deleted file mode 100644 index cff1ce6de2..0000000000 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-var-in-nested-func-decl.expect.md +++ /dev/null @@ -1,50 +0,0 @@ - -## Input - -```javascript -function component(a) { - let z = { a }; - let x = function () { - function t() { - z; - } - t(); - }; - return x; -} - -``` - -## Code - -```javascript -function component(a) { - const $ = React.useMemoCache(); - const c_0 = $[0] !== a; - let z; - if (c_0) { - z = { a: a }; - $[0] = a; - $[1] = z; - } else { - z = $[1]; - } - const c_2 = $[2] !== z; - let x; - if (c_2) { - x = function () { - function t() { - z; - } - t(); - }; - $[2] = z; - $[3] = x; - } else { - x = $[3]; - } - return x; -} - -``` - \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/capturing-var-in-nested-func-decl.js b/compiler/forget/src/__tests__/fixtures/hir/capturing-var-in-nested-func-decl.js deleted file mode 100644 index 5f6559dd33..0000000000 --- a/compiler/forget/src/__tests__/fixtures/hir/capturing-var-in-nested-func-decl.js +++ /dev/null @@ -1,11 +0,0 @@ -// @skip -- TODO: support lowering Function Declaration in HIR -function component(a) { - let z = { a }; - let x = function () { - function t() { - z; - } - t(); - }; - return x; -} diff --git a/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.expect.md b/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.expect.md index 70dd995935..33b4d0eeb0 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.expect.md @@ -67,6 +67,12 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) { // Cannot assign to globals someUnknownGlobal = true; moduleLocal = true; + + function component(a) { + // Add support for function declarations once we support `var` hoisting. + function t() {} + t(); + } } let moduleLocal = false; @@ -363,17 +369,26 @@ let moduleLocal = false; > 64 | someUnknownGlobal = true; | ^^^^^^^^^^^^^^^^^ 65 | moduleLocal = true; - 66 | } - 67 | + 66 | + 67 | function component(a) { [ReactForget] InvalidInputError: (BuildHIR::lowerAssignment) Assigning to an identifier defined outside the function scope is not supported. 63 | // Cannot assign to globals 64 | someUnknownGlobal = true; > 65 | moduleLocal = true; | ^^^^^^^^^^^ - 66 | } - 67 | - 68 | let moduleLocal = false; + 66 | + 67 | function component(a) { + 68 | // Add support for function declarations once we support `var` hoisting. + +[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle FunctionDeclaration statements + 65 | moduleLocal = true; + 66 | +> 67 | function component(a) { + | ^ + 68 | // Add support for function declarations once we support `var` hoisting. + 69 | function t() {} + 70 | t(); ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js b/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js index 5f79d9c548..00b1098080 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js +++ b/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js @@ -63,6 +63,12 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) { // Cannot assign to globals someUnknownGlobal = true; moduleLocal = true; + + function component(a) { + // Add support for function declarations once we support `var` hoisting. + function t() {} + t(); + } } let moduleLocal = false;