Actually visit expression node on empty destructuring assignment (#23744)
This commit is contained in:
parent
6d3b6e21da
commit
47385b29e0
|
@ -46,7 +46,7 @@ namespace ts {
|
|||
value = node.right;
|
||||
}
|
||||
else {
|
||||
return value;
|
||||
return visitNode(value, visitor, isExpression);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
//// [emptyArrayDestructuringExpressionVisitedByTransformer.ts]
|
||||
var a = [] = [1].map(_ => _);
|
||||
var b = [1].map(_ => _);
|
||||
|
||||
//// [emptyArrayDestructuringExpressionVisitedByTransformer.js]
|
||||
var a = [1].map(function (_) { return _; });
|
||||
var b = [1].map(function (_) { return _; });
|
|
@ -0,0 +1,15 @@
|
|||
=== tests/cases/compiler/emptyArrayDestructuringExpressionVisitedByTransformer.ts ===
|
||||
var a = [] = [1].map(_ => _);
|
||||
>a : Symbol(a, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 0, 3))
|
||||
>[1].map : Symbol(Array.map, Decl(lib.d.ts, --, --))
|
||||
>map : Symbol(Array.map, Decl(lib.d.ts, --, --))
|
||||
>_ : Symbol(_, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 0, 21))
|
||||
>_ : Symbol(_, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 0, 21))
|
||||
|
||||
var b = [1].map(_ => _);
|
||||
>b : Symbol(b, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 1, 3))
|
||||
>[1].map : Symbol(Array.map, Decl(lib.d.ts, --, --))
|
||||
>map : Symbol(Array.map, Decl(lib.d.ts, --, --))
|
||||
>_ : Symbol(_, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 1, 16))
|
||||
>_ : Symbol(_, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 1, 16))
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
=== tests/cases/compiler/emptyArrayDestructuringExpressionVisitedByTransformer.ts ===
|
||||
var a = [] = [1].map(_ => _);
|
||||
>a : number[]
|
||||
>[] = [1].map(_ => _) : number[]
|
||||
>[] : undefined[]
|
||||
>[1].map(_ => _) : number[]
|
||||
>[1].map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
|
||||
>[1] : number[]
|
||||
>1 : 1
|
||||
>map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
|
||||
>_ => _ : (_: number) => number
|
||||
>_ : number
|
||||
>_ : number
|
||||
|
||||
var b = [1].map(_ => _);
|
||||
>b : number[]
|
||||
>[1].map(_ => _) : number[]
|
||||
>[1].map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
|
||||
>[1] : number[]
|
||||
>1 : 1
|
||||
>map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
|
||||
>_ => _ : (_: number) => number
|
||||
>_ : number
|
||||
>_ : number
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
var a = [] = [1].map(_ => _);
|
||||
var b = [1].map(_ => _);
|
Loading…
Reference in a new issue