Skip to content

Commit e4ab2db

Browse files
committed
Fix find all references for salsa
1 parent 6febe3b commit e4ab2db

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

src/compiler/checker.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ namespace ts {
376376
const moduleAugmentation = <ModuleDeclaration>moduleName.parent;
377377
if (moduleAugmentation.symbol.valueDeclaration !== moduleAugmentation) {
378378
// this is a combined symbol for multiple augmentations within the same file.
379-
// its symbol already has accumulated information for all declarations
380-
// so we need to add it just once - do the work only for first declaration
379+
// its symbol already has accumulated information for all declarations
380+
// so we need to add it just once - do the work only for first declaration
381381
Debug.assert(moduleAugmentation.symbol.declarations.length > 1);
382382
return;
383383
}
@@ -386,7 +386,7 @@ namespace ts {
386386
mergeSymbolTable(globals, moduleAugmentation.symbol.exports);
387387
}
388388
else {
389-
// find a module that about to be augmented
389+
// find a module that about to be augmented
390390
let mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found);
391391
if (!mainModule) {
392392
return;
@@ -812,7 +812,7 @@ namespace ts {
812812
}
813813

814814
// No static member is present.
815-
// Check if we're in an instance method and look for a relevant instance member.
815+
// Check if we're in an instance method and look for a relevant instance member.
816816
if (location === container && !(location.flags & NodeFlags.Static)) {
817817
const instanceType = (<InterfaceType>getDeclaredTypeOfSymbol(classSymbol)).thisType;
818818
if (getPropertyOfType(instanceType, name)) {
@@ -1163,7 +1163,7 @@ namespace ts {
11631163
return getMergedSymbol(sourceFile.symbol);
11641164
}
11651165
if (moduleNotFoundError) {
1166-
// report errors only if it was requested
1166+
// report errors only if it was requested
11671167
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
11681168
}
11691169
return undefined;
@@ -2618,7 +2618,7 @@ namespace ts {
26182618
}
26192619
}
26202620
else if (declaration.kind === SyntaxKind.Parameter) {
2621-
// If it's a parameter, see if the parent has a jsdoc comment with an @param
2621+
// If it's a parameter, see if the parent has a jsdoc comment with an @param
26222622
// annotation.
26232623
const paramTag = getCorrespondingJSDocParameterTag(<ParameterDeclaration>declaration);
26242624
if (paramTag && paramTag.typeExpression) {
@@ -2633,7 +2633,7 @@ namespace ts {
26332633
function getTypeForVariableLikeDeclaration(declaration: VariableLikeDeclaration): Type {
26342634
if (declaration.parserContextFlags & ParserContextFlags.JavaScriptFile) {
26352635
// If this is a variable in a JavaScript file, then use the JSDoc type (if it has
2636-
// one as its type), otherwise fallback to the below standard TS codepaths to
2636+
// one as its type), otherwise fallback to the below standard TS codepaths to
26372637
// try to figure it out.
26382638
const type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration);
26392639
if (type && type !== unknownType) {
@@ -4058,7 +4058,7 @@ namespace ts {
40584058
const isJSConstructSignature = isJSDocConstructSignature(declaration);
40594059
let returnType: Type = undefined;
40604060

4061-
// If this is a JSDoc construct signature, then skip the first parameter in the
4061+
// If this is a JSDoc construct signature, then skip the first parameter in the
40624062
// parameter list. The first parameter represents the return type of the construct
40634063
// signature.
40644064
for (let i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) {
@@ -4461,7 +4461,7 @@ namespace ts {
44614461
}
44624462

44634463
if (symbol.flags & SymbolFlags.Value && node.kind === SyntaxKind.JSDocTypeReference) {
4464-
// A JSDocTypeReference may have resolved to a value (as opposed to a type). In
4464+
// A JSDocTypeReference may have resolved to a value (as opposed to a type). In
44654465
// that case, the type of this reference is just the type of the value we resolved
44664466
// to.
44674467
return getTypeOfSymbol(symbol);
@@ -10404,7 +10404,7 @@ namespace ts {
1040410404

1040510405
/*
1040610406
*TypeScript Specification 1.0 (6.3) - July 2014
10407-
* An explicitly typed function whose return type isn't the Void type,
10407+
* An explicitly typed function whose return type isn't the Void type,
1040810408
* the Any type, or a union type containing the Void or Any type as a constituent
1040910409
* must have at least one return statement somewhere in its body.
1041010410
* An exception to this rule is if the function implementation consists of a single 'throw' statement.
@@ -14426,10 +14426,10 @@ namespace ts {
1442614426
if (isAmbientExternalModule) {
1442714427
if (isExternalModuleAugmentation(node)) {
1442814428
// body of the augmentation should be checked for consistency only if augmentation was applied to its target (either global scope or module)
14429-
// otherwise we'll be swamped in cascading errors.
14429+
// otherwise we'll be swamped in cascading errors.
1443014430
// We can detect if augmentation was applied using following rules:
1443114431
// - augmentation for a global scope is always applied
14432-
// - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module).
14432+
// - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module).
1443314433
const checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & SymbolFlags.Merged);
1443414434
if (checkBody) {
1443514435
// body of ambient external module is always a module block
@@ -15200,6 +15200,18 @@ namespace ts {
1520015200
return getSymbolOfNode(entityName.parent);
1520115201
}
1520215202

15203+
if (isInJavaScriptFile(entityName) && entityName.parent.kind === SyntaxKind.PropertyAccessExpression) {
15204+
const specialPropertyAssignmentKind = getSpecialPropertyAssignmentKind(entityName.parent.parent);
15205+
switch (specialPropertyAssignmentKind) {
15206+
case SpecialPropertyAssignmentKind.ExportsProperty:
15207+
case SpecialPropertyAssignmentKind.ThisProperty:
15208+
case SpecialPropertyAssignmentKind.PrototypeProperty:
15209+
return getSymbolOfNode(entityName.parent);
15210+
case SpecialPropertyAssignmentKind.ModuleExports:
15211+
return getSymbolOfNode(entityName.parent.parent);
15212+
}
15213+
}
15214+
1520315215
if (entityName.parent.kind === SyntaxKind.ExportAssignment) {
1520415216
return resolveEntityName(<Identifier>entityName,
1520515217
/*all meanings*/ SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);

0 commit comments

Comments
 (0)