use Value meaning as a filter when resolving names to prevent skipping other value in favor of block-scoped variables
This commit is contained in:
parent
62cbe977e3
commit
64fa7fbecb
|
@ -11072,7 +11072,7 @@ module ts {
|
|||
|
||||
var symbol = declarationSymbol ||
|
||||
getNodeLinks(n).resolvedSymbol ||
|
||||
resolveName(n, n.text, SymbolFlags.BlockScopedVariable | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
resolveName(n, n.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
|
||||
var isLetOrConst =
|
||||
symbol &&
|
||||
|
|
28
tests/baselines/reference/letConstMatchingParameterNames.js
Normal file
28
tests/baselines/reference/letConstMatchingParameterNames.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
//// [letConstMatchingParameterNames.ts]
|
||||
let parent = true;
|
||||
const parent2 = true;
|
||||
declare function use(a: any);
|
||||
|
||||
function a() {
|
||||
|
||||
let parent = 1;
|
||||
const parent2 = 2;
|
||||
|
||||
function b(parent: string, parent2: number) {
|
||||
use(parent);
|
||||
use(parent2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [letConstMatchingParameterNames.js]
|
||||
var parent = true;
|
||||
var parent2 = true;
|
||||
function a() {
|
||||
var _parent = 1;
|
||||
var _parent2 = 2;
|
||||
function b(parent, parent2) {
|
||||
use(parent);
|
||||
use(parent2);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
=== tests/cases/compiler/letConstMatchingParameterNames.ts ===
|
||||
let parent = true;
|
||||
>parent : boolean
|
||||
|
||||
const parent2 = true;
|
||||
>parent2 : boolean
|
||||
|
||||
declare function use(a: any);
|
||||
>use : (a: any) => any
|
||||
>a : any
|
||||
|
||||
function a() {
|
||||
>a : () => void
|
||||
|
||||
let parent = 1;
|
||||
>parent : number
|
||||
|
||||
const parent2 = 2;
|
||||
>parent2 : number
|
||||
|
||||
function b(parent: string, parent2: number) {
|
||||
>b : (parent: string, parent2: number) => void
|
||||
>parent : string
|
||||
>parent2 : number
|
||||
|
||||
use(parent);
|
||||
>use(parent) : any
|
||||
>use : (a: any) => any
|
||||
>parent : string
|
||||
|
||||
use(parent2);
|
||||
>use(parent2) : any
|
||||
>use : (a: any) => any
|
||||
>parent2 : number
|
||||
}
|
||||
}
|
||||
|
15
tests/cases/compiler/letConstMatchingParameterNames.ts
Normal file
15
tests/cases/compiler/letConstMatchingParameterNames.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
// @target: es5
|
||||
let parent = true;
|
||||
const parent2 = true;
|
||||
declare function use(a: any);
|
||||
|
||||
function a() {
|
||||
|
||||
let parent = 1;
|
||||
const parent2 = 2;
|
||||
|
||||
function b(parent: string, parent2: number) {
|
||||
use(parent);
|
||||
use(parent2);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue