schmod / babel-plugin-angularjs-annotate

Add Angular 1.x dependency injection annotations to ES6 code
http://schmod.github.io/babel-plugin-angularjs-annotate
MIT License
240 stars 29 forks source link

Check for class expressions in inspectDeclarator #54

Closed MartijnWelker closed 3 years ago

MartijnWelker commented 4 years ago

Currently inspectDeclarator only checks for (arrow)function expressions, but it should also check for class expressions in the form of:

/*@ngInject*/
let MyClass = class MyClass { // or as unnamed class
  constructor (myService) {
  }
};

and

let MyClass = class MyClass { // or as unnamed class

  /*@ngInject*/
  constructor (myService) {
  }
};

If you enter the above code in the testpage WITHOUT compiling to ES5 the injection tokens won't be added.

timofei-iatsenko commented 4 years ago

Damned, I did the same https://github.com/schmod/babel-plugin-angularjs-annotate/pull/55 but also added a test case

MartijnWelker commented 3 years ago

Closing in favour of #55