Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

getService called with too many arguments in injector.js #1711

Closed
benmccann opened this issue Dec 16, 2012 · 2 comments
Closed

getService called with too many arguments in injector.js #1711

benmccann opened this issue Dec 16, 2012 · 2 comments

Comments

@benmccann
Copy link
Contributor

The function getService is being called with two arguments in src/auto/injector.js as shown in the code below, but it only takes one argument.

function invoke(fn, self, locals){
  var args = [],
      $inject = annotate(fn),
      length, i,
      key;

  for(i = 0, length = $inject.length; i < length; i++) {
    key = $inject[i];
    args.push(
      locals && locals.hasOwnProperty(key)
      ? locals[key]
      : getService(key, path)
    );
  }
  if (!fn.$inject) {
    // this means that we must be an array.
    fn = fn[length];
  }
@petebacondarwin
Copy link
Contributor

You're right. This seems entirely superfluous.
@IgorMinar - your commit seems to have added this call to getService(key, path). Is there any reason why it should keep the path parameter?

@benmccann
Copy link
Contributor Author

There's a bunch of stuff like this that I found by running the code through the Closure Compiler. I submitted a pull request (#1710) to filter out a bit over half of the warnings, but there's still a about a hundred fifty left. I filed an issue for this one because I wanted to make sure it was intended to ignore the path parameter and this wasn't causing some bug. The stuff I fixed in my pull request aren't bugs and were mostly simple warning related to jsdocs, but cleaning up those warnings will make it so that stuff like this that could potentially be a bug isn't hidden in the output. I'm hoping we can work through them together and get clean output from the compiler in case some of the things it found really are bugs. It only took me a few hours to fix > 50% of them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants