Skip to content

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

@encody

Description

@encody

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 <></>;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions