mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
@@ -323,6 +323,10 @@ function nodeOrChildIsBlack(node: ts.Node): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
function isSymbolWithDeclarations(symbol: ts.Symbol | undefined | null): symbol is ts.Symbol & { declarations: ts.Declaration[] } {
|
||||
return !!(symbol && symbol.declarations);
|
||||
}
|
||||
|
||||
function markNodes(ts: typeof import('typescript'), languageService: ts.LanguageService, options: ITreeShakingOptions) {
|
||||
const program = languageService.getProgram();
|
||||
if (!program) {
|
||||
@@ -530,7 +534,7 @@ function markNodes(ts: typeof import('typescript'), languageService: ts.Language
|
||||
setColor(symbolImportNode, NodeColor.Black);
|
||||
}
|
||||
|
||||
if (symbol && !nodeIsInItsOwnDeclaration(nodeSourceFile, node, symbol)) {
|
||||
if (isSymbolWithDeclarations(symbol) && !nodeIsInItsOwnDeclaration(nodeSourceFile, node, symbol)) {
|
||||
for (let i = 0, len = symbol.declarations!.length; i < len; i++) { // {{SQL CARBON EDIT}} Compile fixes
|
||||
const declaration = symbol.declarations![i]; // {{SQL CARBON EDIT}} Compile fixes
|
||||
if (ts.isSourceFile(declaration)) {
|
||||
@@ -595,7 +599,7 @@ function markNodes(ts: typeof import('typescript'), languageService: ts.Language
|
||||
}
|
||||
}
|
||||
|
||||
function nodeIsInItsOwnDeclaration(nodeSourceFile: ts.SourceFile, node: ts.Node, symbol: ts.Symbol): boolean {
|
||||
function nodeIsInItsOwnDeclaration(nodeSourceFile: ts.SourceFile, node: ts.Node, symbol: ts.Symbol & { declarations: ts.Declaration[] }): boolean {
|
||||
for (let i = 0, len = symbol.declarations!.length; i < len; i++) { // {{SQL CARBON EDIT}} Compile fixes
|
||||
const declaration = symbol.declarations![i]; // {{SQL CARBON EDIT}} Compile fixes
|
||||
const declarationSourceFile = declaration.getSourceFile();
|
||||
@@ -838,7 +842,7 @@ function getRealNodeSymbol(ts: typeof import('typescript'), checker: ts.TypeChec
|
||||
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
||||
// import {A, B} from "mod";
|
||||
// to jump to the implementation directly.
|
||||
if (symbol && symbol.flags & ts.SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations![0])) { // {{SQL CARBON EDIT}} Compile fixes
|
||||
if (symbol && symbol.flags & ts.SymbolFlags.Alias && symbol.declarations && shouldSkipAlias(node, symbol.declarations![0])) { // {{SQL CARBON EDIT}} Compile fixes
|
||||
const aliased = checker.getAliasedSymbol(symbol);
|
||||
if (aliased.declarations) {
|
||||
// We should mark the import as visited
|
||||
|
||||
Reference in New Issue
Block a user