function getDefinition()

in src/rule-generated-flow-types.js [321:345]


    function getDefinition(arg) {
      if (arg == null) {
        return null;
      }
      if (arg.type === 'Identifier') {
        const name = arg.name;
        let scope = context.getScope();
        while (scope && scope.type != 'global') {
          for (const variable of scope.variables) {
            if (variable.name === name) {
              const definition = variable.defs.find(
                def => def.node && def.node.type === 'VariableDeclarator'
              );
              return definition ? getDefinition(definition.node.init) : null;
            }
          }
          scope = scope.upper;
        }
        return null;
      }
      if (arg.type !== 'TaggedTemplateExpression') {
        return null;
      }
      return getGraphQLAST(arg);
    }