btford/ngmin — pull request #34 by BinaryMuse (2013-05-11 21:51:01+00:00)
Title: Fix annotating $get in object-based PDO on module references

Oops! #31 now works for the following case:

``` javascript
angular.module('myApp').provider('MyService', {
$get: function($window) {}
});
```

but not for this case:

``` javascript
var app = angular.module('myApp');
app.provider('MyService', {
$get: function($window) {}
});
```

This is because [`signatures/simple.js` requires that the argument be a `FunctionExpression`](https://github.com/btford/ngmin/blob/44f85a8472f711497b24f09585680d7ff4f7f6e8/signatures/simple.js#L38) in order for the module to be marked by `markASTModules`; however, removing the requirement caused `annotateInjectable` to fail because it assumes that anything sent to it was matched by the signature and thus has parameters (e.g. is a `FunctionExpression`) as well.

This pull request does two things:

1. Adds a signature to `simple.js` that allows for matching a `provider` call with an object as the parameter, and
2. Modifies `annotateInjectable` to ensure that `originalFn` even has params before checking their length.

There are probably a couple better ways to go about these checks; let me know if you'd like me to change anything.