parent
1fc1495863
commit
f9eb976319
|
@ -401,21 +401,18 @@ namespace ts {
|
|||
}
|
||||
|
||||
/**
|
||||
* Appends a range of value to begin of an array, returning the array.
|
||||
*
|
||||
* @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array
|
||||
* is created if `value` was appended.
|
||||
* @param from The values to append to the array. If `from` is `undefined`, nothing is
|
||||
* appended. If an element of `from` is `undefined`, that element is not appended.
|
||||
* Prepends statements to an array taking care of prologue directives.
|
||||
*/
|
||||
export function prependStatements<T extends Statement>(to: T[], from: ReadonlyArray<T> | undefined): T[] | undefined {
|
||||
export function prependStatements<T extends Statement>(to: T[], from: ReadonlyArray<T> | undefined): T[] {
|
||||
if (from === undefined || from.length === 0) return to;
|
||||
if (to === undefined) return from.slice();
|
||||
const prologue = to.length && isPrologueDirective(to[0]) && to.shift();
|
||||
to.unshift(...from);
|
||||
if (prologue) {
|
||||
to.unshift(prologue);
|
||||
let statementIndex = 0;
|
||||
// skip all prologue directives to insert at the correct position
|
||||
for (; statementIndex < to.length; ++statementIndex) {
|
||||
if (!isPrologueDirective(to[statementIndex])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
to.splice(statementIndex, 0, ...from);
|
||||
return to;
|
||||
}
|
||||
|
||||
|
|
|
@ -6094,14 +6094,9 @@ declare namespace ts {
|
|||
function nodeIsMissing(node: Node | undefined): boolean;
|
||||
function nodeIsPresent(node: Node | undefined): boolean;
|
||||
/**
|
||||
* Appends a range of value to begin of an array, returning the array.
|
||||
*
|
||||
* @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array
|
||||
* is created if `value` was appended.
|
||||
* @param from The values to append to the array. If `from` is `undefined`, nothing is
|
||||
* appended. If an element of `from` is `undefined`, that element is not appended.
|
||||
* Prepends statements to an array taking care of prologue directives.
|
||||
*/
|
||||
function prependStatements<T extends Statement>(to: T[], from: ReadonlyArray<T> | undefined): T[] | undefined;
|
||||
function prependStatements<T extends Statement>(to: T[], from: ReadonlyArray<T> | undefined): T[];
|
||||
/**
|
||||
* Determine if the given comment is a triple-slash
|
||||
*
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
//// [destructuringTempOccursAfterPrologue.ts]
|
||||
function test(p: any) {
|
||||
'use strict';
|
||||
'use strong';
|
||||
p = { prop: p } = p;
|
||||
}
|
||||
|
||||
//// [destructuringTempOccursAfterPrologue.js]
|
||||
function test(p) {
|
||||
'use strict';
|
||||
'use strong';
|
||||
var _a;
|
||||
p = (_a = p, p = _a.prop, _a);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@ function test(p: any) {
|
|||
>p : Symbol(p, Decl(destructuringTempOccursAfterPrologue.ts, 0, 14))
|
||||
|
||||
'use strict';
|
||||
'use strong';
|
||||
p = { prop: p } = p;
|
||||
>p : Symbol(p, Decl(destructuringTempOccursAfterPrologue.ts, 0, 14))
|
||||
>prop : Symbol(prop, Decl(destructuringTempOccursAfterPrologue.ts, 2, 9))
|
||||
>prop : Symbol(prop, Decl(destructuringTempOccursAfterPrologue.ts, 3, 9))
|
||||
>p : Symbol(p, Decl(destructuringTempOccursAfterPrologue.ts, 0, 14))
|
||||
>p : Symbol(p, Decl(destructuringTempOccursAfterPrologue.ts, 0, 14))
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@ function test(p: any) {
|
|||
'use strict';
|
||||
>'use strict' : "use strict"
|
||||
|
||||
'use strong';
|
||||
>'use strong' : "use strong"
|
||||
|
||||
p = { prop: p } = p;
|
||||
>p = { prop: p } = p : any
|
||||
>p : any
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
function test(p: any) {
|
||||
'use strict';
|
||||
'use strong';
|
||||
p = { prop: p } = p;
|
||||
}
|
Loading…
Reference in a new issue