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

Method names can shadow import names #47

Open
edsrzf opened this issue Aug 12, 2018 · 1 comment
Open

Method names can shadow import names #47

edsrzf opened this issue Aug 12, 2018 · 1 comment

Comments

@edsrzf
Copy link

edsrzf commented Aug 12, 2018

I've run into a bug where if a class method has the same name as an import, prefixed with an underscore, it shadows the import with the similar name. Brief example:

import now from 'lodash/now'

const f = function ($log) {
  'ngInject'
  class C {
    _now () {
      // This line ends up referring to the method containing it.
      now()
    }
  }

  return C
}

I've created a full reproduction case with more information here: https://github.com/edsrzf/babel-angularjs-repro

Note that this uses babel 7. I've tried pulling in the changes from #43 but they don't seem to help anything.

I'm happy to try to fix this if I can get some guidance. In particular, I'm not sure if this is actually a bug in this plugin or if it's merely a symptom of some issue within babel itself.

@edsrzf
Copy link
Author

edsrzf commented Oct 3, 2018

I've forked this repo here, with a fix on its master branch: https://github.com/vend/babel-plugin-angularjs-annotate/

The commit is here: vend@82cdc58

I'd make a pull request, but this repo seems to be unmaintained at the moment.

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