Skip to content

[7.0] Investigate what would be needed to remove the shadow-function.js internal plugin #5597

Closed

Description

@loganfsmyth

This plugin is ugly and requires us to tack private undocumented properties onto AST nodes so that this and arguments are handled properly when processing scopes.

Ideally the rewriting and hoisting of these values would be handled by some helper that was used by all of the places we need to normalize these values. We should investigate what if anything might be blocking us from doing that.

The primary thing that comes to mind is that when we transform these things, we need to take into account anything that might care about this in those contexts. e.g.

async fn(){
  super.fn();
}

when rewriting, we have to move the function content inside of a wrapper, which breaks super.

var fn = function(){
  return (...args) => arguments;
}

When converting this arrow to a function, we need to rewrite arguments.

I think this is doable, but we'll need to keep plugin ordering in mind. The super case above for instance is a bug we currently have that I think is fixable easily if we do this.

Activity

  1. added this to the Babel 7 milestone on Apr 6, 2017
  2. added
    outdated
    on May 4, 2018
  3. locked as resolved and limited conversation to collaborators on May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Has PRoutdated

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions