lib/get-updater.js
function getAnnotatedNode(comment) {

    // find the first function declaration or expression following the annotation
    var result;
    if (comment.annotates) {
      var candidateTrees;

      // consider the context the block is in (i.e. what is its parent)
      var parent = comment.annotates.parent;

      // consider nodes from the annotated node forward
      //  include the first non-generated node and all generated nodes preceding it
      if (testNode.isBlockOrProgram(parent)) {
        var body = parent.body;
        var index = body.indexOf(comment.annotates);
        var candidates = body.slice(index);
        var length = candidates.map(testNode.isGeneratedCode).indexOf(false) + 1;
        candidateTrees = candidates.slice(0, length || candidates.length);
      }
      // otherwise we can only consider the given node
      else {
        candidateTrees = [comment.annotates];
      }

      // try the nodes
      while (!result && candidateTrees.length) {
        result = esprimaTools
          .orderNodes(candidateTrees.shift())
          .filter(testNode.isFunctionNotIFFE)
          .shift();
      }
    }

    // throw where not valid
    if (result) {
      return result;
    } else {
      errorFn('Doc-tag @ngInject does not annotate anything');
    }
  }
function getAnnotatedNode(comment) {

    // find the first function declaration or expression following the annotation
    var result;
    if (comment.annotates) {
      var candidateTrees;

      // consider the context the block is in (i.e. what is its parent)
      var parent = comment.annotates.parent;

      // consider nodes from the annotated node forward
      //  include the first non-generated node and all generated nodes preceding it
      if (testNode.isBlockOrProgram(parent)) {
        var body = parent.body;
        var index = body.indexOf(comment.annotates);
        var candidates = body.slice(index);
        var length = candidates.map(testNode.isGeneratedCode).indexOf(false) + 1;
        candidateTrees = candidates.slice(0, length || candidates.length);
      }
      // otherwise we can only consider the given node
      else {
        candidateTrees = [comment.annotates];
      }

      // try the nodes
      while (!result && candidateTrees.length) {
        result = esprimaTools
          .orderNodes(candidateTrees.shift())
          .filter(testNode.isFunctionNotIFFE)
          .shift();
      }
    }

    // throw where not valid
    if (result) {
      return result;
    } else {
      errorFn('Doc-tag @ngInject does not annotate anything');
    }
  }
Get the node that is annotated by the comment or throw if not present.
@throws {Error} Where comment does not annotate a node
@param {object} comment The comment node