function getMakeDecoratorCall()

in tools/api-builder/docs-package/processors/mergeDecoratorDocs.js [66:88]


function getMakeDecoratorCall(doc, type) {

  var makeDecoratorFnName = 'make' + (type || '')+ 'Decorator';

  var initializer = doc.exportSymbol &&
                    doc.exportSymbol.valueDeclaration &&
                    doc.exportSymbol.valueDeclaration.initializer;

  if (initializer) {
    // There appear to be two forms of initializer:
    //    export var Injectable: InjectableFactory = <InjectableFactory>makeDecorator(InjectableMetadata);
    // and
    //    export var RouteConfig: (configs: RouteDefinition[]) => ClassDecorator = makeDecorator(RouteConfigAnnotation);
    // In the first case, the type assertion `<InjectableFactory>` causes the AST to contain an extra level of expression
    // to hold the new type of the expression.
    if (initializer.expression && initializer.expression.expression) {
      initializer = initializer.expression;
    }
    if (initializer.expression && initializer.expression.text === makeDecoratorFnName) {
      return initializer;
    }
  }
}