-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(injector): support arrow functions with no parenthesis #12890
Conversation
I initially upgraded jscs so it will parse es6 syntax correctly, but since eventually I used |
@@ -62,17 +62,23 @@ | |||
* Implicit module which gets automatically added to each {@link auto.$injector $injector}. | |||
*/ | |||
|
|||
var ARROW_ARG = /^([^\(]+)=>/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This RegExp would incorrectly match arg1 => { var arrow = '=>'; }
(it would match greedily until the last =>
before the first (
).
The +
should be made non-greedy: /^([^(]+?)=>/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I left a couple of comments. |
Why isn't this running in travis? :( |
It did run initially I think (https://travis-ci.org/angular/angular.js/builds/81241841). |
Did someone restartd it or did it start on its own ? |
I created another pull request on a cloned branch in hopes of somehow triggering travis and it seems to have worked :) |
Okay, Travis finally approves. I'll merge this tomorrow morning unless anyone else has more comments |
with arrow functions parenthesis are optional in case you have exactly one argument to the function. the previous regexp assumed function arguments are always inside parenthesis and so it didn't annotate functions like `$http => $http.get(...)` correctly
No description provided.