Skip to content

TDZ transformer interprets any reference to a function as calling it (?) (T6641) #3708

@babel-bot

Description

@babel-bot

Issue originally made by @spicyj

Options

function transform(src) { console.log(require('./packages/babel-core').transform(src, {plugins: [[require('./packages/babel-plugin-transform-es2015-block-scoping'), {tdz: true}]]}).code); }

Input code

> transform('function f() {x;} maybeCall(f); let x = 5;')
function f() {
  (function () {
    throw new ReferenceError("x is not defined - temporal dead zone");
  })();
}maybeCall(f);var x = 5;

Description

f should only throw if maybeCall calls f before the let executes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: traverse

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions