mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
fix(48673): allow Find All References on access modifier for constructor (#48813)
This commit is contained in:
parent
d6e483b8da
commit
aa48a37e09
@ -806,6 +806,8 @@ namespace ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
return getAdjustedLocationForFunction(node as FunctionDeclaration | FunctionExpression);
|
||||
case SyntaxKind.Constructor:
|
||||
return node;
|
||||
}
|
||||
}
|
||||
if (isNamedDeclaration(node)) {
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
// === /tests/cases/fourslash/constructorFindAllReferences1.ts ===
|
||||
// export class C {
|
||||
// /*FIND ALL REFS*/public [|constructor|]() { }
|
||||
// public foo() { }
|
||||
// }
|
||||
//
|
||||
// new [|C|]().foo();
|
||||
|
||||
[
|
||||
{
|
||||
"definition": {
|
||||
"containerKind": "",
|
||||
"containerName": "",
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences1.ts",
|
||||
"kind": "class",
|
||||
"name": "class C",
|
||||
"textSpan": {
|
||||
"start": 13,
|
||||
"length": 1
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "class",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "C",
|
||||
"kind": "className"
|
||||
}
|
||||
],
|
||||
"contextSpan": {
|
||||
"start": 0,
|
||||
"length": 68
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 28,
|
||||
"length": 11
|
||||
},
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences1.ts",
|
||||
"contextSpan": {
|
||||
"start": 21,
|
||||
"length": 24
|
||||
},
|
||||
"isWriteAccess": false
|
||||
},
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 74,
|
||||
"length": 1
|
||||
},
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences1.ts",
|
||||
"isWriteAccess": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -0,0 +1,63 @@
|
||||
// === /tests/cases/fourslash/constructorFindAllReferences2.ts ===
|
||||
// export class C {
|
||||
// /*FIND ALL REFS*/private [|constructor|]() { }
|
||||
// public foo() { }
|
||||
// }
|
||||
//
|
||||
// new [|C|]().foo();
|
||||
|
||||
[
|
||||
{
|
||||
"definition": {
|
||||
"containerKind": "",
|
||||
"containerName": "",
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences2.ts",
|
||||
"kind": "class",
|
||||
"name": "class C",
|
||||
"textSpan": {
|
||||
"start": 13,
|
||||
"length": 1
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "class",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "C",
|
||||
"kind": "className"
|
||||
}
|
||||
],
|
||||
"contextSpan": {
|
||||
"start": 0,
|
||||
"length": 69
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 29,
|
||||
"length": 11
|
||||
},
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences2.ts",
|
||||
"contextSpan": {
|
||||
"start": 21,
|
||||
"length": 25
|
||||
},
|
||||
"isWriteAccess": false
|
||||
},
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 75,
|
||||
"length": 1
|
||||
},
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences2.ts",
|
||||
"isWriteAccess": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -0,0 +1,65 @@
|
||||
// === /tests/cases/fourslash/constructorFindAllReferences3.ts ===
|
||||
// export class C {
|
||||
// /*FIND ALL REFS*/[|constructor|]() { }
|
||||
// public foo() { }
|
||||
// }
|
||||
//
|
||||
// new [|C|]().foo();
|
||||
|
||||
[
|
||||
{
|
||||
"definition": {
|
||||
"containerKind": "",
|
||||
"containerName": "",
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences3.ts",
|
||||
"kind": "class",
|
||||
"name": "class C",
|
||||
"textSpan": {
|
||||
"start": 13,
|
||||
"length": 1
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "class",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "C",
|
||||
"kind": "className"
|
||||
}
|
||||
],
|
||||
"contextSpan": {
|
||||
"start": 0,
|
||||
"length": 61
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 21,
|
||||
"length": 11
|
||||
},
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences3.ts",
|
||||
"contextSpan": {
|
||||
"start": 21,
|
||||
"length": 17
|
||||
},
|
||||
"isWriteAccess": false,
|
||||
"isDefinition": true
|
||||
},
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 67,
|
||||
"length": 1
|
||||
},
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences3.ts",
|
||||
"isWriteAccess": false,
|
||||
"isDefinition": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -0,0 +1,63 @@
|
||||
// === /tests/cases/fourslash/constructorFindAllReferences4.ts ===
|
||||
// export class C {
|
||||
// /*FIND ALL REFS*/protected [|constructor|]() { }
|
||||
// public foo() { }
|
||||
// }
|
||||
//
|
||||
// new [|C|]().foo();
|
||||
|
||||
[
|
||||
{
|
||||
"definition": {
|
||||
"containerKind": "",
|
||||
"containerName": "",
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences4.ts",
|
||||
"kind": "class",
|
||||
"name": "class C",
|
||||
"textSpan": {
|
||||
"start": 13,
|
||||
"length": 1
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "class",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "C",
|
||||
"kind": "className"
|
||||
}
|
||||
],
|
||||
"contextSpan": {
|
||||
"start": 0,
|
||||
"length": 71
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 31,
|
||||
"length": 11
|
||||
},
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences4.ts",
|
||||
"contextSpan": {
|
||||
"start": 21,
|
||||
"length": 27
|
||||
},
|
||||
"isWriteAccess": false
|
||||
},
|
||||
{
|
||||
"textSpan": {
|
||||
"start": 77,
|
||||
"length": 1
|
||||
},
|
||||
"fileName": "/tests/cases/fourslash/constructorFindAllReferences4.ts",
|
||||
"isWriteAccess": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
10
tests/cases/fourslash/constructorFindAllReferences1.ts
Normal file
10
tests/cases/fourslash/constructorFindAllReferences1.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////export class C {
|
||||
//// /**/public constructor() { }
|
||||
//// public foo() { }
|
||||
////}
|
||||
////
|
||||
////new C().foo();
|
||||
|
||||
verify.baselineFindAllReferences("");
|
||||
10
tests/cases/fourslash/constructorFindAllReferences2.ts
Normal file
10
tests/cases/fourslash/constructorFindAllReferences2.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////export class C {
|
||||
//// /**/private constructor() { }
|
||||
//// public foo() { }
|
||||
////}
|
||||
////
|
||||
////new C().foo();
|
||||
|
||||
verify.baselineFindAllReferences("");
|
||||
10
tests/cases/fourslash/constructorFindAllReferences3.ts
Normal file
10
tests/cases/fourslash/constructorFindAllReferences3.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////export class C {
|
||||
//// /**/constructor() { }
|
||||
//// public foo() { }
|
||||
////}
|
||||
////
|
||||
////new C().foo();
|
||||
|
||||
verify.baselineFindAllReferences("");
|
||||
10
tests/cases/fourslash/constructorFindAllReferences4.ts
Normal file
10
tests/cases/fourslash/constructorFindAllReferences4.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////export class C {
|
||||
//// /**/protected constructor() { }
|
||||
//// public foo() { }
|
||||
////}
|
||||
////
|
||||
////new C().foo();
|
||||
|
||||
verify.baselineFindAllReferences("");
|
||||
Loading…
x
Reference in New Issue
Block a user