@param allSearchSymbols set of additional symbols for use by `includes`
(location *ast.Node, symbol *ast.Symbol, comingFrom ImpExpKind, text string, allSearchSymbols []*ast.Symbol)
| 1847 | |
| 1848 | // @param allSearchSymbols set of additional symbols for use by `includes` |
| 1849 | func (state *refState) createSearch(location *ast.Node, symbol *ast.Symbol, comingFrom ImpExpKind, text string, allSearchSymbols []*ast.Symbol) *refSearch { |
| 1850 | // Note: if this is an external module symbol, the name doesn't include quotes. |
| 1851 | // Note: getLocalSymbolForExportDefault handles `export default class C {}`, but not `export default C` or `export { C as default }`. |
| 1852 | // The other two forms seem to be handled downstream (e.g. in `skipPastExportOrImportSpecifier`), so special-casing the first form |
| 1853 | // here appears to be intentional). |
| 1854 | if text == "" { |
| 1855 | s := binder.GetLocalSymbolForExportDefault(symbol) |
| 1856 | if s == nil { |
| 1857 | s = getNonModuleSymbolOfMergedModuleSymbol(symbol) |
| 1858 | if s == nil { |
| 1859 | s = symbol |
| 1860 | } |
| 1861 | } |
| 1862 | text = stringutil.StripQuotes(ast.SymbolName(s)) |
| 1863 | } |
| 1864 | if len(allSearchSymbols) == 0 { |
| 1865 | allSearchSymbols = []*ast.Symbol{symbol} |
| 1866 | } |
| 1867 | search := &refSearch{ |
| 1868 | symbol: symbol, |
| 1869 | comingFrom: comingFrom, |
| 1870 | text: text, |
| 1871 | escapedText: text, |
| 1872 | allSearchSymbols: allSearchSymbols, |
| 1873 | includes: func(sym *ast.Symbol) bool { return slices.Contains(allSearchSymbols, sym) }, |
| 1874 | } |
| 1875 | if state.options.implementations && location != nil { |
| 1876 | search.parents = getParentSymbolsOfPropertyAccess(location, symbol, state.checker) |
| 1877 | } |
| 1878 | return search |
| 1879 | } |
| 1880 | |
| 1881 | func (state *refState) referenceAdder(searchSymbol *ast.Symbol) func(*ast.Node, entryKind) { |
| 1882 | symbolAndEntries := state.symbolToReferences[searchSymbol] |
no test coverage detected