Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing support for immediately invoked function expressions (IIFE) #111

Open
encody opened this issue Sep 8, 2023 · 0 comments
Open

Missing support for immediately invoked function expressions (IIFE) #111

encody opened this issue Sep 8, 2023 · 0 comments

Comments

@encody
Copy link

encody commented Sep 8, 2023

Just playing around with the playground, this code fails to run:

const f = (() => {})();

return <></>;

With this error:

Execution error:
Unsupported member type: 'ArrowFunctionExpression'
Error: Unsupported member type: 'ArrowFunctionExpression'
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:141230)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:142716)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:128336)
    at https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:149725
    at Array.forEach (<anonymous>)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:149584)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:150144)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:158210)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:157614)
    at https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:164529
    at uI (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:84130)
    at uY (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:90512)
    at e (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:111124)
    at https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:111135
    at oI (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:111647)
    at oS (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:95017)
    at x (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:33:1373)
    at MessagePort.T (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:33:1903)

This code also fails:

const f = (function () {})();

return <></>;

The error is similar:

Execution error:
Unsupported member type: 'FunctionExpression'
Error: Unsupported member type: 'FunctionExpression'
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:141230)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:142716)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:128336)
    at https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:149725
    at Array.forEach (<anonymous>)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:149584)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:150144)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:158210)
    at t.value (https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:157614)
    at https://near.org/_next/static/chunks/f3857751.16e15a3bc421ed0c.js:1:164529
    at uI (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:84130)
    at uY (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:90512)
    at e (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:111124)
    at https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:111135
    at oI (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:111647)
    at oS (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:9:95017)
    at x (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:33:1373)
    at MessagePort.T (https://near.org/_next/static/chunks/framework-c16fc4c01675a4d8.js:33:1903)

Curiously, giving the function a name and immediately executing it does not render the same error, though it theoretically is logically equivalent:

let f;
{
  const g = () => {};
  f = g();
}

return <></>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant