mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
merge with master
This commit is contained in:
+12
-3
@@ -394,6 +394,7 @@ var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
|
||||
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
|
||||
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
|
||||
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
|
||||
var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_standalone.d.ts");
|
||||
|
||||
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
|
||||
/*prefixes*/ [copyright],
|
||||
@@ -410,11 +411,19 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
|
||||
|
||||
prependFile(copyright, standaloneDefinitionsFile);
|
||||
|
||||
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
|
||||
// Stanalone/web definition file using global 'ts' namespace
|
||||
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
|
||||
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
|
||||
definitionFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
|
||||
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
|
||||
|
||||
// Official node package definition file, pointed to by 'typings' in package.json
|
||||
// Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module
|
||||
var nodeDefinitionsFileContents = definitionFileContents + "\r\nexport = ts;";
|
||||
fs.writeFileSync(nodeDefinitionsFile, nodeDefinitionsFileContents);
|
||||
|
||||
// Node package definition file to be distributed without the package. Created by replacing
|
||||
// 'ts' namespace with '"typescript"' as a module.
|
||||
var nodeStandaloneDefinitionsFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
|
||||
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Vendored
+30
-2
@@ -3928,6 +3928,7 @@ declare module Intl {
|
||||
timeZoneName?: string;
|
||||
formatMatcher?: string;
|
||||
hour12?: boolean;
|
||||
timeZone?: string;
|
||||
}
|
||||
|
||||
interface ResolvedDateTimeFormatOptions {
|
||||
@@ -3997,18 +3998,45 @@ interface Number {
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+30
-2
@@ -104,6 +104,7 @@ declare module Intl {
|
||||
timeZoneName?: string;
|
||||
formatMatcher?: string;
|
||||
hour12?: boolean;
|
||||
timeZone?: string;
|
||||
}
|
||||
|
||||
interface ResolvedDateTimeFormatOptions {
|
||||
@@ -173,18 +174,45 @@ interface Number {
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+30
-2
@@ -5216,6 +5216,7 @@ declare module Intl {
|
||||
timeZoneName?: string;
|
||||
formatMatcher?: string;
|
||||
hour12?: boolean;
|
||||
timeZone?: string;
|
||||
}
|
||||
|
||||
interface ResolvedDateTimeFormatOptions {
|
||||
@@ -5285,18 +5286,45 @@ interface Number {
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+30
-2
@@ -104,6 +104,7 @@ declare module Intl {
|
||||
timeZoneName?: string;
|
||||
formatMatcher?: string;
|
||||
hour12?: boolean;
|
||||
timeZone?: string;
|
||||
}
|
||||
|
||||
interface ResolvedDateTimeFormatOptions {
|
||||
@@ -173,18 +174,45 @@ interface Number {
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+384
-250
File diff suppressed because it is too large
Load Diff
+471
-523
File diff suppressed because it is too large
Load Diff
Vendored
+22
-17
@@ -13,7 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
declare module "typescript" {
|
||||
declare namespace ts {
|
||||
interface Map<T> {
|
||||
[index: string]: T;
|
||||
}
|
||||
@@ -1208,9 +1208,11 @@ declare module "typescript" {
|
||||
UnionOrIntersection = 49152,
|
||||
StructuredType = 130048,
|
||||
}
|
||||
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
|
||||
interface Type {
|
||||
flags: TypeFlags;
|
||||
symbol?: Symbol;
|
||||
pattern?: DestructuringPattern;
|
||||
}
|
||||
interface StringLiteralType extends Type {
|
||||
text: string;
|
||||
@@ -1237,7 +1239,6 @@ declare module "typescript" {
|
||||
}
|
||||
interface TupleType extends ObjectType {
|
||||
elementTypes: Type[];
|
||||
baseArrayType: TypeReference;
|
||||
}
|
||||
interface UnionOrIntersectionType extends Type {
|
||||
types: Type[];
|
||||
@@ -1382,9 +1383,12 @@ declare module "typescript" {
|
||||
}
|
||||
interface ResolvedModule {
|
||||
resolvedFileName: string;
|
||||
isExternalLibraryImport?: boolean;
|
||||
}
|
||||
interface ResolvedModuleWithFailedLookupLocations {
|
||||
resolvedModule: ResolvedModule;
|
||||
failedLookupLocations: string[];
|
||||
}
|
||||
type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
|
||||
interface CompilerHost extends ModuleResolutionHost {
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
@@ -1394,7 +1398,7 @@ declare module "typescript" {
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
getNewLine(): string;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
|
||||
}
|
||||
interface TextSpan {
|
||||
start: number;
|
||||
@@ -1405,7 +1409,7 @@ declare module "typescript" {
|
||||
newLength: number;
|
||||
}
|
||||
}
|
||||
declare module "typescript" {
|
||||
declare namespace ts {
|
||||
interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
@@ -1429,7 +1433,7 @@ declare module "typescript" {
|
||||
}
|
||||
var sys: System;
|
||||
}
|
||||
declare module "typescript" {
|
||||
declare namespace ts {
|
||||
interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: number): void;
|
||||
}
|
||||
@@ -1474,7 +1478,7 @@ declare module "typescript" {
|
||||
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
|
||||
}
|
||||
declare module "typescript" {
|
||||
declare namespace ts {
|
||||
function getDefaultLibFileName(options: CompilerOptions): string;
|
||||
function textSpanEnd(span: TextSpan): number;
|
||||
function textSpanIsEmpty(span: TextSpan): boolean;
|
||||
@@ -1504,33 +1508,32 @@ declare module "typescript" {
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
}
|
||||
declare module "typescript" {
|
||||
declare namespace ts {
|
||||
function getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
function createNode(kind: SyntaxKind): Node;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
}
|
||||
declare module "typescript" {
|
||||
declare namespace ts {
|
||||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
|
||||
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule;
|
||||
function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule;
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
|
||||
}
|
||||
declare module "typescript" {
|
||||
declare namespace ts {
|
||||
function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine;
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): {
|
||||
function readConfigFile(fileName: string, readFile: (path: string) => string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
@@ -1551,7 +1554,7 @@ declare module "typescript" {
|
||||
*/
|
||||
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
|
||||
}
|
||||
declare module "typescript" {
|
||||
declare namespace ts {
|
||||
/** The version of the language service API */
|
||||
let servicesVersion: string;
|
||||
interface Node {
|
||||
@@ -1649,7 +1652,7 @@ declare module "typescript" {
|
||||
trace?(s: string): void;
|
||||
error?(s: string): void;
|
||||
useCaseSensitiveFileNames?(): boolean;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
|
||||
}
|
||||
interface LanguageService {
|
||||
cleanupSemanticCache(): void;
|
||||
@@ -2139,3 +2142,5 @@ declare module "typescript" {
|
||||
*/
|
||||
function getDefaultLibFilePath(options: CompilerOptions): string;
|
||||
}
|
||||
|
||||
export = ts;
|
||||
+536
-314
File diff suppressed because it is too large
Load Diff
Vendored
+12
-9
@@ -1208,9 +1208,11 @@ declare namespace ts {
|
||||
UnionOrIntersection = 49152,
|
||||
StructuredType = 130048,
|
||||
}
|
||||
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
|
||||
interface Type {
|
||||
flags: TypeFlags;
|
||||
symbol?: Symbol;
|
||||
pattern?: DestructuringPattern;
|
||||
}
|
||||
interface StringLiteralType extends Type {
|
||||
text: string;
|
||||
@@ -1237,7 +1239,6 @@ declare namespace ts {
|
||||
}
|
||||
interface TupleType extends ObjectType {
|
||||
elementTypes: Type[];
|
||||
baseArrayType: TypeReference;
|
||||
}
|
||||
interface UnionOrIntersectionType extends Type {
|
||||
types: Type[];
|
||||
@@ -1382,9 +1383,12 @@ declare namespace ts {
|
||||
}
|
||||
interface ResolvedModule {
|
||||
resolvedFileName: string;
|
||||
isExternalLibraryImport?: boolean;
|
||||
}
|
||||
interface ResolvedModuleWithFailedLookupLocations {
|
||||
resolvedModule: ResolvedModule;
|
||||
failedLookupLocations: string[];
|
||||
}
|
||||
type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
|
||||
interface CompilerHost extends ModuleResolutionHost {
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
@@ -1394,7 +1398,7 @@ declare namespace ts {
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
getNewLine(): string;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
|
||||
}
|
||||
interface TextSpan {
|
||||
start: number;
|
||||
@@ -1515,10 +1519,9 @@ declare namespace ts {
|
||||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
|
||||
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule;
|
||||
function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule;
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
@@ -1530,7 +1533,7 @@ declare namespace ts {
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): {
|
||||
function readConfigFile(fileName: string, readFile: (path: string) => string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
@@ -1649,7 +1652,7 @@ declare namespace ts {
|
||||
trace?(s: string): void;
|
||||
error?(s: string): void;
|
||||
useCaseSensitiveFileNames?(): boolean;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
|
||||
}
|
||||
interface LanguageService {
|
||||
cleanupSemanticCache(): void;
|
||||
|
||||
+536
-314
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
|
||||
@@ -14246,7 +14246,10 @@ namespace ts {
|
||||
let symbols: Symbol[] = [];
|
||||
let name = symbol.name;
|
||||
forEach(getSymbolLinks(symbol).containingType.types, t => {
|
||||
symbols.push(getPropertyOfType(t, name));
|
||||
let symbol = getPropertyOfType(t, name);
|
||||
if (symbol) {
|
||||
symbols.push(symbol);
|
||||
}
|
||||
});
|
||||
return symbols;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,8 @@ namespace ts {
|
||||
"node": ModuleResolutionKind.NodeJs,
|
||||
"classic": ModuleResolutionKind.Classic
|
||||
},
|
||||
description: Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6
|
||||
description: Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,
|
||||
error: Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic,
|
||||
},
|
||||
{
|
||||
name: "noUnusedLabels",
|
||||
@@ -347,7 +348,7 @@ namespace ts {
|
||||
options[opt.name] = map[key];
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(opt.error));
|
||||
errors.push(createCompilerDiagnostic((<CommandLineOptionOfCustomType>opt).error));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -460,7 +461,7 @@ namespace ts {
|
||||
value = optType[key];
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(opt.error));
|
||||
errors.push(createCompilerDiagnostic((<CommandLineOptionOfCustomType>opt).error));
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,13 +565,14 @@ namespace ts {
|
||||
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
|
||||
NEWLINE: { code: 6061, category: DiagnosticCategory.Message, key: "NEWLINE" },
|
||||
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
|
||||
Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: DiagnosticCategory.Error, key: "Argument for '--moduleResolution' option must be 'node' or 'classic'." },
|
||||
Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" },
|
||||
Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." },
|
||||
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
|
||||
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
|
||||
Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." },
|
||||
Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." },
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." },
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." },
|
||||
Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." },
|
||||
Successfully_created_a_tsconfig_json_file: { code: 6071, category: DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." },
|
||||
Suppress_excess_property_checks_for_object_literals: { code: 6072, category: DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." },
|
||||
|
||||
@@ -1700,11 +1700,11 @@
|
||||
"Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.": {
|
||||
"category": "Error",
|
||||
"code": 2652
|
||||
},
|
||||
},
|
||||
"Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2653
|
||||
},
|
||||
},
|
||||
"Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.": {
|
||||
"category": "Error",
|
||||
"code": 2654
|
||||
@@ -1712,11 +1712,11 @@
|
||||
"Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition.": {
|
||||
"category": "Error",
|
||||
"code": 2655
|
||||
},
|
||||
},
|
||||
"Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.": {
|
||||
"category": "Error",
|
||||
"code": 2656
|
||||
},
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
@@ -2250,6 +2250,11 @@
|
||||
"category": "Error",
|
||||
"code": 6062
|
||||
},
|
||||
"Argument for '--moduleResolution' option must be 'node' or 'classic'.": {
|
||||
"category": "Error",
|
||||
"code": 6063
|
||||
},
|
||||
|
||||
"Specify JSX code generation: 'preserve' or 'react'": {
|
||||
"category": "Message",
|
||||
"code": 6080
|
||||
@@ -2274,7 +2279,7 @@
|
||||
"category": "Message",
|
||||
"code": 6068
|
||||
},
|
||||
"Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) .": {
|
||||
"Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).": {
|
||||
"category": "Message",
|
||||
"code": 6069
|
||||
},
|
||||
|
||||
+37
-22
@@ -3220,22 +3220,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function ensureIdentifier(expr: Expression): Expression {
|
||||
if (expr.kind !== SyntaxKind.Identifier) {
|
||||
let identifier = createTempVariable(TempFlags.Auto);
|
||||
if (!canDefineTempVariablesInPlace) {
|
||||
recordTempDeclaration(identifier);
|
||||
}
|
||||
emitAssignment(identifier, expr);
|
||||
expr = identifier;
|
||||
/**
|
||||
* Ensures that there exists a declared identifier whose value holds the given expression.
|
||||
* This function is useful to ensure that the expression's value can be read from in subsequent expressions.
|
||||
* Unless 'reuseIdentifierExpressions' is false, 'expr' will be returned if it is just an identifier.
|
||||
*
|
||||
* @param expr the expression whose value needs to be bound.
|
||||
* @param reuseIdentifierExpressions true if identifier expressions can simply be returned;
|
||||
* false if it is necessary to always emit an identifier.
|
||||
*/
|
||||
function ensureIdentifier(expr: Expression, reuseIdentifierExpressions: boolean): Expression {
|
||||
if (expr.kind === SyntaxKind.Identifier && reuseIdentifierExpressions) {
|
||||
return expr;
|
||||
}
|
||||
return expr;
|
||||
|
||||
let identifier = createTempVariable(TempFlags.Auto);
|
||||
if (!canDefineTempVariablesInPlace) {
|
||||
recordTempDeclaration(identifier);
|
||||
}
|
||||
emitAssignment(identifier, expr);
|
||||
return identifier;
|
||||
}
|
||||
|
||||
function createDefaultValueCheck(value: Expression, defaultValue: Expression): Expression {
|
||||
// The value expression will be evaluated twice, so for anything but a simple identifier
|
||||
// we need to generate a temporary variable
|
||||
value = ensureIdentifier(value);
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
|
||||
// Return the expression 'value === void 0 ? defaultValue : value'
|
||||
let equals = <BinaryExpression>createSynthesizedNode(SyntaxKind.BinaryExpression);
|
||||
equals.left = value;
|
||||
@@ -3286,7 +3296,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (properties.length !== 1) {
|
||||
// For anything but a single element destructuring we need to generate a temporary
|
||||
// to ensure value is evaluated exactly once.
|
||||
value = ensureIdentifier(value);
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
|
||||
}
|
||||
for (let p of properties) {
|
||||
if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
@@ -3301,7 +3311,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (elements.length !== 1) {
|
||||
// For anything but a single element destructuring we need to generate a temporary
|
||||
// to ensure value is evaluated exactly once.
|
||||
value = ensureIdentifier(value);
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
|
||||
}
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
let e = elements[i];
|
||||
@@ -3346,7 +3356,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (root.parent.kind !== SyntaxKind.ParenthesizedExpression) {
|
||||
write("(");
|
||||
}
|
||||
value = ensureIdentifier(value);
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
|
||||
emitDestructuringAssignment(target, value);
|
||||
write(", ");
|
||||
emit(value);
|
||||
@@ -3356,7 +3366,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function emitBindingElement(target: BindingElement, value: Expression) {
|
||||
function emitBindingElement(target: BindingElement | VariableDeclaration, value: Expression) {
|
||||
if (target.initializer) {
|
||||
// Combine value and initializer
|
||||
value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer;
|
||||
@@ -3366,14 +3376,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
value = createVoidZero();
|
||||
}
|
||||
if (isBindingPattern(target.name)) {
|
||||
let pattern = <BindingPattern>target.name;
|
||||
let elements = pattern.elements;
|
||||
if (elements.length !== 1) {
|
||||
// For anything but a single element destructuring we need to generate a temporary
|
||||
// to ensure value is evaluated exactly once.
|
||||
value = ensureIdentifier(value);
|
||||
const pattern = <BindingPattern>target.name;
|
||||
const elements = pattern.elements;
|
||||
const numElements = elements.length;
|
||||
|
||||
if (numElements !== 1) {
|
||||
// For anything other than a single-element destructuring we need to generate a temporary
|
||||
// to ensure value is evaluated exactly once. Additionally, if we have zero elements
|
||||
// we need to emit *something* to ensure that in case a 'var' keyword was already emitted,
|
||||
// so in that case, we'll intentionally create that temporary.
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0);
|
||||
}
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
|
||||
for (let i = 0; i < numElements; i++) {
|
||||
let element = elements[i];
|
||||
if (pattern.kind === SyntaxKind.ObjectBindingPattern) {
|
||||
// Rewrite element to a declaration with an initializer that fetches property
|
||||
@@ -3385,7 +3400,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
// Rewrite element to a declaration that accesses array element at index i
|
||||
emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i)));
|
||||
}
|
||||
else if (i === elements.length - 1) {
|
||||
else if (i === numElements - 1) {
|
||||
emitBindingElement(element, createSliceCall(value, i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace ts {
|
||||
|
||||
let emptyArray: any[] = [];
|
||||
|
||||
export const version = "1.6.0";
|
||||
export const version = "1.7.0";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
let fileName = "tsconfig.json";
|
||||
@@ -862,8 +862,8 @@ namespace ts {
|
||||
const importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]);
|
||||
if (importedFile && resolution.isExternalLibraryImport) {
|
||||
if (!isExternalModule(importedFile)) {
|
||||
let start = getTokenPosOfNode(file.imports[i], file)
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
|
||||
let start = getTokenPosOfNode(file.imports[i], file)
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
|
||||
}
|
||||
else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) {
|
||||
let start = getTokenPosOfNode(file.imports[i], file)
|
||||
|
||||
+15
-2
@@ -2122,17 +2122,30 @@ namespace ts {
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface CommandLineOption {
|
||||
export interface CommandLineOptionBase {
|
||||
name: string;
|
||||
type: string | Map<number>; // "string", "number", "boolean", or an object literal mapping named values to actual values
|
||||
isFilePath?: boolean; // True if option value is a path or fileName
|
||||
shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'
|
||||
description?: DiagnosticMessage; // The message describing what the command line switch does
|
||||
paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter
|
||||
error?: DiagnosticMessage; // The error given when the argument does not fit a customized 'type'
|
||||
experimental?: boolean;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase {
|
||||
type: string; // "string" | "number" | "boolean"
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface CommandLineOptionOfCustomType extends CommandLineOptionBase {
|
||||
type: Map<number>; // an object literal mapping named values to actual values
|
||||
error: DiagnosticMessage; // The error given when the argument does not fit a customized 'type'
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType;
|
||||
|
||||
/* @internal */
|
||||
export const enum CharacterCodes {
|
||||
nullCharacter = 0,
|
||||
|
||||
@@ -428,6 +428,7 @@ module Harness {
|
||||
args(): string[];
|
||||
getExecutingFilePath(): string;
|
||||
exit(exitCode?: number): void;
|
||||
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
|
||||
}
|
||||
export var IO: IO;
|
||||
|
||||
@@ -464,6 +465,7 @@ module Harness {
|
||||
export const directoryExists: typeof IO.directoryExists = fso.FolderExists;
|
||||
export const fileExists: typeof IO.fileExists = fso.FileExists;
|
||||
export const log: typeof IO.log = global.WScript && global.WScript.StdOut.WriteLine;
|
||||
export const readDirectory: typeof IO.readDirectory = (path, extension, exclude) => ts.sys.readDirectory(path, extension, exclude);
|
||||
|
||||
export function createDirectory(path: string) {
|
||||
if (directoryExists(path)) {
|
||||
@@ -532,6 +534,8 @@ module Harness {
|
||||
export const fileExists: typeof IO.fileExists = fs.existsSync;
|
||||
export const log: typeof IO.log = s => console.log(s);
|
||||
|
||||
export const readDirectory: typeof IO.readDirectory = (path, extension, exclude) => ts.sys.readDirectory(path, extension, exclude);
|
||||
|
||||
export function createDirectory(path: string) {
|
||||
if (!directoryExists(path)) {
|
||||
fs.mkdirSync(path);
|
||||
@@ -730,6 +734,10 @@ module Harness {
|
||||
export function writeFile(path: string, contents: string) {
|
||||
Http.writeToServerSync(serverRoot + path, "WRITE", contents);
|
||||
}
|
||||
|
||||
export function readDirectory(path: string, extension?: string, exclude?: string[]) {
|
||||
return listFiles(path).filter(f => !extension || ts.fileExtensionIs(f, extension));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,15 @@ var fs: any = require('fs');
|
||||
var path: any = require('path');
|
||||
|
||||
function instrumentForRecording(fn: string, tscPath: string) {
|
||||
instrument(tscPath, 'ts.sys = Playback.wrapSystem(ts.sys); ts.sys.startRecord("' + fn + '");', 'ts.sys.endRecord();');
|
||||
instrument(tscPath, `
|
||||
ts.sys = Playback.wrapSystem(ts.sys);
|
||||
ts.sys.startRecord("${ fn }");`, `ts.sys.endRecord();`);
|
||||
}
|
||||
|
||||
function instrumentForReplay(logFilename: string, tscPath: string) {
|
||||
instrument(tscPath, 'ts.sys = Playback.wrapSystem(ts.sys); ts.sys.startReplay("' + logFilename + '");');
|
||||
instrument(tscPath, `
|
||||
ts.sys = Playback.wrapSystem(ts.sys);
|
||||
ts.sys.startReplay("${ logFilename }");`);
|
||||
}
|
||||
|
||||
function instrument(tscPath: string, prepareCode: string, cleanupCode: string = '') {
|
||||
|
||||
+120
-91
@@ -59,6 +59,12 @@ interface IOLog {
|
||||
path: string;
|
||||
result?: string;
|
||||
}[];
|
||||
directoriesRead: {
|
||||
path: string,
|
||||
extension: string,
|
||||
exclude: string[],
|
||||
result: string[]
|
||||
}[];
|
||||
}
|
||||
|
||||
interface PlaybackControl {
|
||||
@@ -95,12 +101,15 @@ module Playback {
|
||||
|
||||
export interface PlaybackIO extends Harness.IO, PlaybackControl { }
|
||||
|
||||
export interface PlaybackSystem extends ts.System, PlaybackControl { }
|
||||
|
||||
function createEmptyLog(): IOLog {
|
||||
return {
|
||||
timestamp: (new Date()).toString(),
|
||||
arguments: [],
|
||||
currentDirectory: "",
|
||||
filesRead: [],
|
||||
directoriesRead: [],
|
||||
filesWritten: [],
|
||||
filesDeleted: [],
|
||||
filesAppended: [],
|
||||
@@ -114,8 +123,10 @@ module Playback {
|
||||
};
|
||||
}
|
||||
|
||||
function initWrapper<T>(wrapper: PlaybackControl, underlying: T) {
|
||||
Object.keys(underlying).forEach(prop => {
|
||||
function initWrapper(wrapper: PlaybackSystem, underlying: ts.System): void;
|
||||
function initWrapper(wrapper: PlaybackIO, underlying: Harness.IO): void;
|
||||
function initWrapper(wrapper: PlaybackSystem | PlaybackIO, underlying: ts.System | Harness.IO): void {
|
||||
ts.forEach(Object.keys(underlying), prop => {
|
||||
(<any>wrapper)[prop] = (<any>underlying)[prop];
|
||||
});
|
||||
|
||||
@@ -135,6 +146,93 @@ module Playback {
|
||||
wrapper.startRecord = (fileNameBase) => {
|
||||
recordLogFileNameBase = fileNameBase;
|
||||
recordLog = createEmptyLog();
|
||||
|
||||
if (typeof underlying.args !== "function") {
|
||||
recordLog.arguments = <string[]>underlying.args;
|
||||
}
|
||||
};
|
||||
|
||||
wrapper.startReplayFromFile = logFn => {
|
||||
wrapper.startReplayFromString(underlying.readFile(logFn));
|
||||
};
|
||||
wrapper.endRecord = () => {
|
||||
if (recordLog !== undefined) {
|
||||
let i = 0;
|
||||
let fn = () => recordLogFileNameBase + i + ".json";
|
||||
while (underlying.fileExists(fn())) i++;
|
||||
underlying.writeFile(fn(), JSON.stringify(recordLog));
|
||||
recordLog = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
wrapper.fileExists = recordReplay(wrapper.fileExists, underlying)(
|
||||
path => callAndRecord(underlying.fileExists(path), recordLog.fileExists, { path }),
|
||||
memoize(path => {
|
||||
// If we read from the file, it must exist
|
||||
if (findResultByPath(wrapper, replayLog.filesRead, path, null) !== null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return findResultByFields(replayLog.fileExists, { path }, false);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
wrapper.getExecutingFilePath = () => {
|
||||
if (replayLog !== undefined) {
|
||||
return replayLog.executingPath;
|
||||
}
|
||||
else if (recordLog !== undefined) {
|
||||
return recordLog.executingPath = underlying.getExecutingFilePath();
|
||||
}
|
||||
else {
|
||||
return underlying.getExecutingFilePath();
|
||||
}
|
||||
};
|
||||
|
||||
wrapper.getCurrentDirectory = () => {
|
||||
if (replayLog !== undefined) {
|
||||
return replayLog.currentDirectory || "";
|
||||
}
|
||||
else if (recordLog !== undefined) {
|
||||
return recordLog.currentDirectory = underlying.getCurrentDirectory();
|
||||
}
|
||||
else {
|
||||
return underlying.getCurrentDirectory();
|
||||
}
|
||||
};
|
||||
|
||||
wrapper.resolvePath = recordReplay(wrapper.resolvePath, underlying)(
|
||||
path => callAndRecord(underlying.resolvePath(path), recordLog.pathsResolved, { path }),
|
||||
memoize(path => findResultByFields(replayLog.pathsResolved, { path }, !ts.isRootedDiskPath(ts.normalizeSlashes(path)) && replayLog.currentDirectory ? replayLog.currentDirectory + "/" + path : ts.normalizeSlashes(path))));
|
||||
|
||||
wrapper.readFile = recordReplay(wrapper.readFile, underlying)(
|
||||
path => {
|
||||
let result = underlying.readFile(path);
|
||||
let logEntry = { path, codepage: 0, result: { contents: result, codepage: 0 } };
|
||||
recordLog.filesRead.push(logEntry);
|
||||
return result;
|
||||
},
|
||||
memoize(path => findResultByPath(wrapper, replayLog.filesRead, path).contents));
|
||||
|
||||
wrapper.readDirectory = recordReplay(wrapper.readDirectory, underlying)(
|
||||
(path, extension, exclude) => {
|
||||
let result = (<ts.System>underlying).readDirectory(path, extension, exclude);
|
||||
let logEntry = { path, extension, exclude, result };
|
||||
recordLog.directoriesRead.push(logEntry);
|
||||
return result;
|
||||
},
|
||||
(path, extension, exclude) => findResultByPath(wrapper, replayLog.directoriesRead.filter(d => d.extension === extension && ts.arrayIsEqualTo(d.exclude, exclude)), path));
|
||||
|
||||
wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)(
|
||||
(path, contents) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path, contents, bom: false }),
|
||||
(path, contents) => noOpReplay("writeFile"));
|
||||
|
||||
wrapper.exit = (exitCode) => {
|
||||
if (recordLog !== undefined) {
|
||||
wrapper.endRecord();
|
||||
}
|
||||
underlying.exit(exitCode);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -143,9 +241,11 @@ module Playback {
|
||||
return <any>(function () {
|
||||
if (replayLog !== undefined) {
|
||||
return replay.apply(undefined, arguments);
|
||||
} else if (recordLog !== undefined) {
|
||||
}
|
||||
else if (recordLog !== undefined) {
|
||||
return record.apply(undefined, arguments);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return original.apply(underlying, arguments);
|
||||
}
|
||||
});
|
||||
@@ -169,7 +269,8 @@ module Playback {
|
||||
if (results.length === 0) {
|
||||
if (defaultValue !== undefined) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new Error("No matching result in log array for: " + JSON.stringify(expectedFields));
|
||||
}
|
||||
}
|
||||
@@ -177,7 +278,7 @@ module Playback {
|
||||
}
|
||||
|
||||
function findResultByPath<T>(wrapper: { resolvePath(s: string): string }, logArray: { path: string; result?: T }[], expectedPath: string, defaultValue?: T): T {
|
||||
let normalizedName = ts.normalizeSlashes(expectedPath).toLowerCase();
|
||||
let normalizedName = ts.normalizePath(expectedPath).toLowerCase();
|
||||
// Try to find the result through normal fileName
|
||||
for (let i = 0; i < logArray.length; i++) {
|
||||
if (ts.normalizeSlashes(logArray[i].path).toLowerCase() === normalizedName) {
|
||||
@@ -193,10 +294,12 @@ module Playback {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we got here, we didn't find a match
|
||||
if (defaultValue === undefined) {
|
||||
throw new Error("No matching result in log array for path: " + expectedPath);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -214,7 +317,8 @@ module Playback {
|
||||
}
|
||||
if (pathEquivCache.hasOwnProperty(key)) {
|
||||
return pathEquivCache[key];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return pathEquivCache[key] = check();
|
||||
}
|
||||
}
|
||||
@@ -227,93 +331,18 @@ module Playback {
|
||||
let wrapper: PlaybackIO = <any>{};
|
||||
initWrapper(wrapper, underlying);
|
||||
|
||||
wrapper.startReplayFromFile = logFn => {
|
||||
wrapper.startReplayFromString(underlying.readFile(logFn));
|
||||
};
|
||||
wrapper.endRecord = () => {
|
||||
if (recordLog !== undefined) {
|
||||
let i = 0;
|
||||
let fn = () => recordLogFileNameBase + i + ".json";
|
||||
while (underlying.fileExists(fn())) i++;
|
||||
underlying.writeFile(fn(), JSON.stringify(recordLog));
|
||||
recordLog = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
wrapper.args = () => {
|
||||
if (replayLog !== undefined) {
|
||||
return replayLog.arguments;
|
||||
} else if (recordLog !== undefined) {
|
||||
recordLog.arguments = underlying.args();
|
||||
}
|
||||
return underlying.args();
|
||||
}
|
||||
|
||||
wrapper.newLine = () => underlying.newLine();
|
||||
wrapper.useCaseSensitiveFileNames = () => underlying.useCaseSensitiveFileNames();
|
||||
wrapper.directoryName = (path): string => { throw new Error("NotSupported"); };
|
||||
wrapper.createDirectory = path => { throw new Error("NotSupported"); };
|
||||
wrapper.createDirectory = (path): void => { throw new Error("NotSupported"); };
|
||||
wrapper.directoryExists = (path): boolean => { throw new Error("NotSupported"); };
|
||||
wrapper.deleteFile = path => { throw new Error("NotSupported"); };
|
||||
wrapper.deleteFile = (path): void => { throw new Error("NotSupported"); };
|
||||
wrapper.listFiles = (path, filter, options): string[] => { throw new Error("NotSupported"); };
|
||||
wrapper.log = text => underlying.log(text);
|
||||
|
||||
wrapper.fileExists = recordReplay(wrapper.fileExists, underlying)(
|
||||
(path) => callAndRecord(underlying.fileExists(path), recordLog.fileExists, { path: path }),
|
||||
memoize((path) => {
|
||||
// If we read from the file, it must exist
|
||||
if (findResultByPath(wrapper, replayLog.filesRead, path, null) !== null) {
|
||||
return true;
|
||||
} else {
|
||||
return findResultByFields(replayLog.fileExists, { path: path }, false);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
wrapper.getExecutingFilePath = () => {
|
||||
if (replayLog !== undefined) {
|
||||
return replayLog.executingPath;
|
||||
} else if (recordLog !== undefined) {
|
||||
return recordLog.executingPath = underlying.getExecutingFilePath();
|
||||
} else {
|
||||
return underlying.getExecutingFilePath();
|
||||
}
|
||||
};
|
||||
|
||||
wrapper.getCurrentDirectory = () => {
|
||||
if (replayLog !== undefined) {
|
||||
return replayLog.currentDirectory || "";
|
||||
} else if (recordLog !== undefined) {
|
||||
return recordLog.currentDirectory = underlying.getCurrentDirectory();
|
||||
} else {
|
||||
return underlying.getCurrentDirectory();
|
||||
}
|
||||
};
|
||||
|
||||
wrapper.resolvePath = recordReplay(wrapper.resolvePath, underlying)(
|
||||
(path) => callAndRecord(underlying.resolvePath(path), recordLog.pathsResolved, { path: path }),
|
||||
memoize((path) => findResultByFields(replayLog.pathsResolved, { path: path }, !ts.isRootedDiskPath(ts.normalizeSlashes(path)) && replayLog.currentDirectory ? replayLog.currentDirectory + "/" + path : ts.normalizeSlashes(path))));
|
||||
|
||||
wrapper.readFile = recordReplay(wrapper.readFile, underlying)(
|
||||
(path) => {
|
||||
let result = underlying.readFile(path);
|
||||
let logEntry = { path: path, codepage: 0, result: { contents: result, codepage: 0 } };
|
||||
recordLog.filesRead.push(logEntry);
|
||||
return result;
|
||||
},
|
||||
memoize((path) => findResultByPath(wrapper, replayLog.filesRead, path).contents));
|
||||
|
||||
wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)(
|
||||
(path, contents) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path: path, contents: contents, bom: false }),
|
||||
(path, contents) => noOpReplay("writeFile"));
|
||||
|
||||
wrapper.exit = (exitCode) => {
|
||||
if (recordLog !== undefined) {
|
||||
wrapper.endRecord();
|
||||
}
|
||||
underlying.exit(exitCode);
|
||||
};
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
export function wrapSystem(underlying: ts.System): PlaybackSystem {
|
||||
let wrapper: PlaybackSystem = <any>{};
|
||||
initWrapper(wrapper, underlying);
|
||||
return wrapper;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,11 @@ module RWC {
|
||||
}
|
||||
}
|
||||
|
||||
function isTsConfigFile(file: { path: string }): boolean {
|
||||
const tsConfigFileName = "tsconfig.json";
|
||||
return file.path.substr(file.path.length - tsConfigFileName.length).toLowerCase() === tsConfigFileName;
|
||||
}
|
||||
|
||||
export function runRWCTest(jsonPath: string) {
|
||||
describe("Testing a RWC project: " + jsonPath, () => {
|
||||
let inputFiles: { unitName: string; content: string; }[] = [];
|
||||
@@ -67,10 +72,21 @@ module RWC {
|
||||
runWithIOLog(ioLog, oldIO => {
|
||||
harnessCompiler.reset();
|
||||
|
||||
let fileNames = opts.fileNames;
|
||||
|
||||
let tsconfigFile = ts.forEach(ioLog.filesRead, f => isTsConfigFile(f) ? f : undefined);
|
||||
if (tsconfigFile) {
|
||||
let tsconfigFileContents = getHarnessCompilerInputUnit(tsconfigFile.path);
|
||||
let parsedTsconfigFileContents = ts.parseConfigFileText(tsconfigFile.path, tsconfigFileContents.content);
|
||||
let configParseResult = ts.parseConfigFile(parsedTsconfigFileContents.config, Harness.IO, ts.getDirectoryPath(tsconfigFile.path));
|
||||
fileNames = configParseResult.fileNames;
|
||||
opts.options = ts.extend(opts.options, configParseResult.options);
|
||||
}
|
||||
|
||||
// Load the files
|
||||
ts.forEach(opts.fileNames, fileName => {
|
||||
for (let fileName of fileNames) {
|
||||
inputFiles.push(getHarnessCompilerInputUnit(fileName));
|
||||
});
|
||||
}
|
||||
|
||||
// Add files to compilation
|
||||
let isInInputList = (resolvedPath: string) => (inputFile: { unitName: string; content: string; }) => inputFile.unitName === resolvedPath;
|
||||
@@ -79,6 +95,10 @@ module RWC {
|
||||
const resolvedPath = ts.normalizeSlashes(Harness.IO.resolvePath(fileRead.path));
|
||||
let inInputList = ts.forEach(inputFiles, isInInputList(resolvedPath));
|
||||
|
||||
if (isTsConfigFile(fileRead)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Harness.isLibraryFile(fileRead.path)) {
|
||||
if (inInputList) {
|
||||
continue;
|
||||
|
||||
@@ -2152,6 +2152,7 @@ namespace ts {
|
||||
//
|
||||
// export * from "mod"
|
||||
// export {a as b} from "mod"
|
||||
// export import i = require("mod")
|
||||
|
||||
while (token !== SyntaxKind.EndOfFileToken) {
|
||||
if (token === SyntaxKind.DeclareKeyword) {
|
||||
@@ -2276,6 +2277,25 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (token === SyntaxKind.ImportKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.Identifier || isKeyword(token)) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.EqualsToken) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.RequireKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.OpenParenToken) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
// export import i = require("mod");
|
||||
recordModuleName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
token = scanner.scan();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//// [emptyArrayBindingPatternParameter01.ts]
|
||||
|
||||
|
||||
function f([]) {
|
||||
var x, y, z;
|
||||
}
|
||||
@@ -9,3 +8,7 @@ function f([]) {
|
||||
function f(_a) {
|
||||
var x, y, z;
|
||||
}
|
||||
|
||||
|
||||
//// [emptyArrayBindingPatternParameter01.d.ts]
|
||||
declare function f([]: any[]): void;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter01.ts ===
|
||||
|
||||
|
||||
function f([]) {
|
||||
>f : Symbol(f, Decl(emptyArrayBindingPatternParameter01.ts, 0, 0))
|
||||
|
||||
var x, y, z;
|
||||
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter01.ts, 3, 7))
|
||||
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter01.ts, 3, 10))
|
||||
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter01.ts, 3, 13))
|
||||
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter01.ts, 2, 7))
|
||||
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter01.ts, 2, 10))
|
||||
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter01.ts, 2, 13))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter01.ts ===
|
||||
|
||||
|
||||
function f([]) {
|
||||
>f : ([]: any[]) => void
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//// [emptyArrayBindingPatternParameter02.ts]
|
||||
|
||||
|
||||
function f(a, []) {
|
||||
var x, y, z;
|
||||
}
|
||||
@@ -9,3 +8,7 @@ function f(a, []) {
|
||||
function f(a, _a) {
|
||||
var x, y, z;
|
||||
}
|
||||
|
||||
|
||||
//// [emptyArrayBindingPatternParameter02.d.ts]
|
||||
declare function f(a: any, []: any[]): void;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter02.ts ===
|
||||
|
||||
|
||||
function f(a, []) {
|
||||
>f : Symbol(f, Decl(emptyArrayBindingPatternParameter02.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(emptyArrayBindingPatternParameter02.ts, 2, 11))
|
||||
>a : Symbol(a, Decl(emptyArrayBindingPatternParameter02.ts, 1, 11))
|
||||
|
||||
var x, y, z;
|
||||
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter02.ts, 3, 7))
|
||||
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter02.ts, 3, 10))
|
||||
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter02.ts, 3, 13))
|
||||
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter02.ts, 2, 7))
|
||||
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter02.ts, 2, 10))
|
||||
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter02.ts, 2, 13))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter02.ts ===
|
||||
|
||||
|
||||
function f(a, []) {
|
||||
>f : (a: any, []: any[]) => void
|
||||
>a : any
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//// [emptyArrayBindingPatternParameter03.ts]
|
||||
|
||||
|
||||
function f(a, []) {
|
||||
var x, y, z;
|
||||
}
|
||||
@@ -9,3 +8,7 @@ function f(a, []) {
|
||||
function f(a, _a) {
|
||||
var x, y, z;
|
||||
}
|
||||
|
||||
|
||||
//// [emptyArrayBindingPatternParameter03.d.ts]
|
||||
declare function f(a: any, []: any[]): void;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter03.ts ===
|
||||
|
||||
|
||||
function f(a, []) {
|
||||
>f : Symbol(f, Decl(emptyArrayBindingPatternParameter03.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(emptyArrayBindingPatternParameter03.ts, 2, 11))
|
||||
>a : Symbol(a, Decl(emptyArrayBindingPatternParameter03.ts, 1, 11))
|
||||
|
||||
var x, y, z;
|
||||
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter03.ts, 3, 7))
|
||||
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter03.ts, 3, 10))
|
||||
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter03.ts, 3, 13))
|
||||
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter03.ts, 2, 7))
|
||||
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter03.ts, 2, 10))
|
||||
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter03.ts, 2, 13))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter03.ts ===
|
||||
|
||||
|
||||
function f(a, []) {
|
||||
>f : (a: any, []: any[]) => void
|
||||
>a : any
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//// [emptyArrayBindingPatternParameter04.ts]
|
||||
|
||||
|
||||
function f([] = [1,2,3,4]) {
|
||||
var x, y, z;
|
||||
}
|
||||
@@ -10,3 +9,7 @@ function f(_a) {
|
||||
var _a = [1, 2, 3, 4];
|
||||
var x, y, z;
|
||||
}
|
||||
|
||||
|
||||
//// [emptyArrayBindingPatternParameter04.d.ts]
|
||||
declare function f([]?: number[]): void;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter04.ts ===
|
||||
|
||||
|
||||
function f([] = [1,2,3,4]) {
|
||||
>f : Symbol(f, Decl(emptyArrayBindingPatternParameter04.ts, 0, 0))
|
||||
|
||||
var x, y, z;
|
||||
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter04.ts, 3, 7))
|
||||
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter04.ts, 3, 10))
|
||||
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter04.ts, 3, 13))
|
||||
>x : Symbol(x, Decl(emptyArrayBindingPatternParameter04.ts, 2, 7))
|
||||
>y : Symbol(y, Decl(emptyArrayBindingPatternParameter04.ts, 2, 10))
|
||||
>z : Symbol(z, Decl(emptyArrayBindingPatternParameter04.ts, 2, 13))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter04.ts ===
|
||||
|
||||
|
||||
function f([] = [1,2,3,4]) {
|
||||
>f : ([]?: number[]) => void
|
||||
>[1,2,3,4] : number[]
|
||||
|
||||
@@ -9,3 +9,7 @@ var a: any;
|
||||
var a;
|
||||
(a);
|
||||
(a);
|
||||
|
||||
|
||||
//// [emptyAssignmentPatterns01_ES5.d.ts]
|
||||
declare var a: any;
|
||||
|
||||
@@ -9,3 +9,7 @@ var a: any;
|
||||
var a;
|
||||
({} = a);
|
||||
([] = a);
|
||||
|
||||
|
||||
//// [emptyAssignmentPatterns01_ES6.d.ts]
|
||||
declare var a: any;
|
||||
|
||||
@@ -11,3 +11,8 @@ var a;
|
||||
var x, y, z, a1, a2, a3;
|
||||
((x = a.x, y = a.y, z = a.z, a));
|
||||
((a1 = a[0], a2 = a[1], a3 = a[2], a));
|
||||
|
||||
|
||||
//// [emptyAssignmentPatterns02_ES5.d.ts]
|
||||
declare var a: any;
|
||||
declare let x: any, y: any, z: any, a1: any, a2: any, a3: any;
|
||||
|
||||
@@ -11,3 +11,8 @@ var a;
|
||||
let x, y, z, a1, a2, a3;
|
||||
({} = { x, y, z } = a);
|
||||
([] = [a1, a2, a3] = a);
|
||||
|
||||
|
||||
//// [emptyAssignmentPatterns02_ES6.d.ts]
|
||||
declare var a: any;
|
||||
declare let x: any, y: any, z: any, a1: any, a2: any, a3: any;
|
||||
|
||||
@@ -9,3 +9,7 @@ var a: any;
|
||||
var a;
|
||||
(a);
|
||||
(a);
|
||||
|
||||
|
||||
//// [emptyAssignmentPatterns03_ES5.d.ts]
|
||||
declare var a: any;
|
||||
|
||||
@@ -9,3 +9,7 @@ var a: any;
|
||||
var a;
|
||||
({} = {} = a);
|
||||
([] = [] = a);
|
||||
|
||||
|
||||
//// [emptyAssignmentPatterns03_ES6.d.ts]
|
||||
declare var a: any;
|
||||
|
||||
@@ -12,3 +12,8 @@ var x, y, z, a1, a2, a3;
|
||||
(_a = a, x = _a.x, y = _a.y, z = _a.z, _a);
|
||||
(_b = a, a1 = _b[0], a2 = _b[1], a3 = _b[2], _b);
|
||||
var _a, _b;
|
||||
|
||||
|
||||
//// [emptyAssignmentPatterns04_ES5.d.ts]
|
||||
declare var a: any;
|
||||
declare let x: any, y: any, z: any, a1: any, a2: any, a3: any;
|
||||
|
||||
@@ -11,3 +11,8 @@ var a;
|
||||
let x, y, z, a1, a2, a3;
|
||||
({ x, y, z } = {} = a);
|
||||
([a1, a2, a3] = [] = a);
|
||||
|
||||
|
||||
//// [emptyAssignmentPatterns04_ES6.d.ts]
|
||||
declare var a: any;
|
||||
declare let x: any, y: any, z: any, a1: any, a2: any, a3: any;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//// [emptyObjectBindingPatternParameter01.ts]
|
||||
|
||||
|
||||
function f({}) {
|
||||
var x, y, z;
|
||||
}
|
||||
@@ -9,3 +8,7 @@ function f({}) {
|
||||
function f(_a) {
|
||||
var x, y, z;
|
||||
}
|
||||
|
||||
|
||||
//// [emptyObjectBindingPatternParameter01.d.ts]
|
||||
declare function f({}: {}): void;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter01.ts ===
|
||||
|
||||
|
||||
function f({}) {
|
||||
>f : Symbol(f, Decl(emptyObjectBindingPatternParameter01.ts, 0, 0))
|
||||
|
||||
var x, y, z;
|
||||
>x : Symbol(x, Decl(emptyObjectBindingPatternParameter01.ts, 3, 7))
|
||||
>y : Symbol(y, Decl(emptyObjectBindingPatternParameter01.ts, 3, 10))
|
||||
>z : Symbol(z, Decl(emptyObjectBindingPatternParameter01.ts, 3, 13))
|
||||
>x : Symbol(x, Decl(emptyObjectBindingPatternParameter01.ts, 2, 7))
|
||||
>y : Symbol(y, Decl(emptyObjectBindingPatternParameter01.ts, 2, 10))
|
||||
>z : Symbol(z, Decl(emptyObjectBindingPatternParameter01.ts, 2, 13))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter01.ts ===
|
||||
|
||||
|
||||
function f({}) {
|
||||
>f : ({}: {}) => void
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//// [emptyObjectBindingPatternParameter02.ts]
|
||||
|
||||
|
||||
function f(a, {}) {
|
||||
var x, y, z;
|
||||
}
|
||||
@@ -9,3 +8,7 @@ function f(a, {}) {
|
||||
function f(a, _a) {
|
||||
var x, y, z;
|
||||
}
|
||||
|
||||
|
||||
//// [emptyObjectBindingPatternParameter02.d.ts]
|
||||
declare function f(a: any, {}: {}): void;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter02.ts ===
|
||||
|
||||
|
||||
function f(a, {}) {
|
||||
>f : Symbol(f, Decl(emptyObjectBindingPatternParameter02.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(emptyObjectBindingPatternParameter02.ts, 2, 11))
|
||||
>a : Symbol(a, Decl(emptyObjectBindingPatternParameter02.ts, 1, 11))
|
||||
|
||||
var x, y, z;
|
||||
>x : Symbol(x, Decl(emptyObjectBindingPatternParameter02.ts, 3, 7))
|
||||
>y : Symbol(y, Decl(emptyObjectBindingPatternParameter02.ts, 3, 10))
|
||||
>z : Symbol(z, Decl(emptyObjectBindingPatternParameter02.ts, 3, 13))
|
||||
>x : Symbol(x, Decl(emptyObjectBindingPatternParameter02.ts, 2, 7))
|
||||
>y : Symbol(y, Decl(emptyObjectBindingPatternParameter02.ts, 2, 10))
|
||||
>z : Symbol(z, Decl(emptyObjectBindingPatternParameter02.ts, 2, 13))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter02.ts ===
|
||||
|
||||
|
||||
function f(a, {}) {
|
||||
>f : (a: any, {}: {}) => void
|
||||
>a : any
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//// [emptyObjectBindingPatternParameter03.ts]
|
||||
|
||||
|
||||
function f({}, a) {
|
||||
var x, y, z;
|
||||
}
|
||||
@@ -9,3 +8,7 @@ function f({}, a) {
|
||||
function f(_a, a) {
|
||||
var x, y, z;
|
||||
}
|
||||
|
||||
|
||||
//// [emptyObjectBindingPatternParameter03.d.ts]
|
||||
declare function f({}: {}, a: any): void;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter03.ts ===
|
||||
|
||||
|
||||
function f({}, a) {
|
||||
>f : Symbol(f, Decl(emptyObjectBindingPatternParameter03.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(emptyObjectBindingPatternParameter03.ts, 2, 14))
|
||||
>a : Symbol(a, Decl(emptyObjectBindingPatternParameter03.ts, 1, 14))
|
||||
|
||||
var x, y, z;
|
||||
>x : Symbol(x, Decl(emptyObjectBindingPatternParameter03.ts, 3, 7))
|
||||
>y : Symbol(y, Decl(emptyObjectBindingPatternParameter03.ts, 3, 10))
|
||||
>z : Symbol(z, Decl(emptyObjectBindingPatternParameter03.ts, 3, 13))
|
||||
>x : Symbol(x, Decl(emptyObjectBindingPatternParameter03.ts, 2, 7))
|
||||
>y : Symbol(y, Decl(emptyObjectBindingPatternParameter03.ts, 2, 10))
|
||||
>z : Symbol(z, Decl(emptyObjectBindingPatternParameter03.ts, 2, 13))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter03.ts ===
|
||||
|
||||
|
||||
function f({}, a) {
|
||||
>f : ({}: {}, a: any) => void
|
||||
>a : any
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts(3,18): error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{}'.
|
||||
tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts(3,24): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{}'.
|
||||
tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts(3,32): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type '{}'.
|
||||
tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts(2,18): error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{}'.
|
||||
tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts(2,24): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{}'.
|
||||
tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts(2,32): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type '{}'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts (3 errors) ====
|
||||
|
||||
|
||||
function f({} = {a: 1, b: "2", c: true}) {
|
||||
~
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{}'.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//// [emptyObjectBindingPatternParameter04.ts]
|
||||
|
||||
|
||||
function f({} = {a: 1, b: "2", c: true}) {
|
||||
var x, y, z;
|
||||
}
|
||||
@@ -10,3 +9,11 @@ function f(_a) {
|
||||
var _a = { a: 1, b: "2", c: true };
|
||||
var x, y, z;
|
||||
}
|
||||
|
||||
|
||||
//// [emptyObjectBindingPatternParameter04.d.ts]
|
||||
declare function f({}?: {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
}): void;
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
//// [emptyVariableDeclarationBindingPatterns01_ES5.ts]
|
||||
|
||||
(function () {
|
||||
var a: any;
|
||||
|
||||
var {} = a;
|
||||
let {} = a;
|
||||
const {} = a;
|
||||
|
||||
var [] = a;
|
||||
let [] = a;
|
||||
const [] = a;
|
||||
|
||||
var {} = a, [] = a;
|
||||
let {} = a, [] = a;
|
||||
const {} = a, [] = a;
|
||||
|
||||
var { p1: {}, p2: [] } = a;
|
||||
let { p1: {}, p2: [] } = a;
|
||||
const { p1: {}, p2: [] } = a;
|
||||
|
||||
for (var {} = {}, {} = {}; false; void 0) {
|
||||
}
|
||||
|
||||
function f({} = a, [] = a, { p: {} = a} = a) {
|
||||
return ({} = a, [] = a, { p: {} = a } = a) => a;
|
||||
}
|
||||
})();
|
||||
|
||||
(function () {
|
||||
const ns: number[][] = [];
|
||||
|
||||
for (var {} of ns) {
|
||||
}
|
||||
|
||||
for (let {} of ns) {
|
||||
}
|
||||
|
||||
for (const {} of ns) {
|
||||
}
|
||||
|
||||
for (var [] of ns) {
|
||||
}
|
||||
|
||||
for (let [] of ns) {
|
||||
}
|
||||
|
||||
for (const [] of ns) {
|
||||
}
|
||||
})();
|
||||
|
||||
//// [emptyVariableDeclarationBindingPatterns01_ES5.js]
|
||||
(function () {
|
||||
var a;
|
||||
var _a = a;
|
||||
var _b = a;
|
||||
var _c = a;
|
||||
var _d = a;
|
||||
var _e = a;
|
||||
var _f = a;
|
||||
var _g = a, _h = a;
|
||||
var _j = a, _k = a;
|
||||
var _l = a, _m = a;
|
||||
var _o = a.p1, _p = a.p2;
|
||||
var _q = a.p1, _r = a.p2;
|
||||
var _s = a.p1, _t = a.p2;
|
||||
for (var _u = {}, _v = {}; false; void 0) {
|
||||
}
|
||||
function f(_a, _b, _c) {
|
||||
var _a = a;
|
||||
var _b = a;
|
||||
var _d = (_c === void 0 ? a : _c).p, _e = _d === void 0 ? a : _d;
|
||||
return function (_a, _b, _c) {
|
||||
var _a = a;
|
||||
var _b = a;
|
||||
var _d = (_c === void 0 ? a : _c).p, _e = _d === void 0 ? a : _d;
|
||||
return a;
|
||||
};
|
||||
}
|
||||
})();
|
||||
(function () {
|
||||
var ns = [];
|
||||
for (var _i = 0; _i < ns.length; _i++) {
|
||||
var _a = ns[_i];
|
||||
}
|
||||
for (var _b = 0; _b < ns.length; _b++) {
|
||||
var _c = ns[_b];
|
||||
}
|
||||
for (var _d = 0; _d < ns.length; _d++) {
|
||||
var _e = ns[_d];
|
||||
}
|
||||
for (var _f = 0; _f < ns.length; _f++) {
|
||||
var _g = ns[_f];
|
||||
}
|
||||
for (var _h = 0; _h < ns.length; _h++) {
|
||||
var _j = ns[_h];
|
||||
}
|
||||
for (var _k = 0; _k < ns.length; _k++) {
|
||||
var _l = ns[_k];
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,92 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts ===
|
||||
|
||||
(function () {
|
||||
var a: any;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
var {} = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
let {} = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
const {} = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
var [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
let [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
const [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
var {} = a, [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
let {} = a, [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
const {} = a, [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
var { p1: {}, p2: [] } = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
let { p1: {}, p2: [] } = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
const { p1: {}, p2: [] } = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
for (var {} = {}, {} = {}; false; void 0) {
|
||||
}
|
||||
|
||||
function f({} = a, [] = a, { p: {} = a} = a) {
|
||||
>f : Symbol(f, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 21, 5))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
|
||||
return ({} = a, [] = a, { p: {} = a } = a) => a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7))
|
||||
}
|
||||
})();
|
||||
|
||||
(function () {
|
||||
const ns: number[][] = [];
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9))
|
||||
|
||||
for (var {} of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9))
|
||||
}
|
||||
|
||||
for (let {} of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9))
|
||||
}
|
||||
|
||||
for (const {} of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9))
|
||||
}
|
||||
|
||||
for (var [] of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9))
|
||||
}
|
||||
|
||||
for (let [] of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9))
|
||||
}
|
||||
|
||||
for (const [] of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9))
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,115 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts ===
|
||||
|
||||
(function () {
|
||||
>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }})() : void
|
||||
>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }}) : () => void
|
||||
>function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }} : () => void
|
||||
|
||||
var a: any;
|
||||
>a : any
|
||||
|
||||
var {} = a;
|
||||
>a : any
|
||||
|
||||
let {} = a;
|
||||
>a : any
|
||||
|
||||
const {} = a;
|
||||
>a : any
|
||||
|
||||
var [] = a;
|
||||
>a : any
|
||||
|
||||
let [] = a;
|
||||
>a : any
|
||||
|
||||
const [] = a;
|
||||
>a : any
|
||||
|
||||
var {} = a, [] = a;
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
let {} = a, [] = a;
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
const {} = a, [] = a;
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
var { p1: {}, p2: [] } = a;
|
||||
>p1 : any
|
||||
>p2 : any
|
||||
>a : any
|
||||
|
||||
let { p1: {}, p2: [] } = a;
|
||||
>p1 : any
|
||||
>p2 : any
|
||||
>a : any
|
||||
|
||||
const { p1: {}, p2: [] } = a;
|
||||
>p1 : any
|
||||
>p2 : any
|
||||
>a : any
|
||||
|
||||
for (var {} = {}, {} = {}; false; void 0) {
|
||||
>{} : {}
|
||||
>{} : {}
|
||||
>false : boolean
|
||||
>void 0 : undefined
|
||||
>0 : number
|
||||
}
|
||||
|
||||
function f({} = a, [] = a, { p: {} = a} = a) {
|
||||
>f : ({}?: any, []?: any, { p: {} = a}?: any) => ({}?: any, []?: any, { p: {} = a }?: any) => any
|
||||
>a : any
|
||||
>a : any
|
||||
>p : any
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
return ({} = a, [] = a, { p: {} = a } = a) => a;
|
||||
>({} = a, [] = a, { p: {} = a } = a) => a : ({}?: any, []?: any, { p: {} = a }?: any) => any
|
||||
>a : any
|
||||
>a : any
|
||||
>p : any
|
||||
>a : any
|
||||
>a : any
|
||||
>a : any
|
||||
}
|
||||
})();
|
||||
|
||||
(function () {
|
||||
>(function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }})() : void
|
||||
>(function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }}) : () => void
|
||||
>function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }} : () => void
|
||||
|
||||
const ns: number[][] = [];
|
||||
>ns : number[][]
|
||||
>[] : undefined[]
|
||||
|
||||
for (var {} of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
|
||||
for (let {} of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
|
||||
for (const {} of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
|
||||
for (var [] of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
|
||||
for (let [] of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
|
||||
for (const [] of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,87 @@
|
||||
//// [emptyVariableDeclarationBindingPatterns01_ES6.ts]
|
||||
|
||||
(function () {
|
||||
var a: any;
|
||||
|
||||
var {} = a;
|
||||
let {} = a;
|
||||
const {} = a;
|
||||
|
||||
var [] = a;
|
||||
let [] = a;
|
||||
const [] = a;
|
||||
|
||||
var {} = a, [] = a;
|
||||
let {} = a, [] = a;
|
||||
const {} = a, [] = a;
|
||||
|
||||
var { p1: {}, p2: [] } = a;
|
||||
let { p1: {}, p2: [] } = a;
|
||||
const { p1: {}, p2: [] } = a;
|
||||
|
||||
for (var {} = {}, {} = {}; false; void 0) {
|
||||
}
|
||||
|
||||
function f({} = a, [] = a, { p: {} = a} = a) {
|
||||
return ({} = a, [] = a, { p: {} = a } = a) => a;
|
||||
}
|
||||
})();
|
||||
|
||||
(function () {
|
||||
const ns: number[][] = [];
|
||||
|
||||
for (var {} of ns) {
|
||||
}
|
||||
|
||||
for (let {} of ns) {
|
||||
}
|
||||
|
||||
for (const {} of ns) {
|
||||
}
|
||||
|
||||
for (var [] of ns) {
|
||||
}
|
||||
|
||||
for (let [] of ns) {
|
||||
}
|
||||
|
||||
for (const [] of ns) {
|
||||
}
|
||||
})();
|
||||
|
||||
//// [emptyVariableDeclarationBindingPatterns01_ES6.js]
|
||||
(function () {
|
||||
var a;
|
||||
var { } = a;
|
||||
let { } = a;
|
||||
const { } = a;
|
||||
var [] = a;
|
||||
let [] = a;
|
||||
const [] = a;
|
||||
var { } = a, [] = a;
|
||||
let { } = a, [] = a;
|
||||
const { } = a, [] = a;
|
||||
var { p1: { }, p2: [] } = a;
|
||||
let { p1: { }, p2: [] } = a;
|
||||
const { p1: { }, p2: [] } = a;
|
||||
for (var { } = {}, { } = {}; false; void 0) {
|
||||
}
|
||||
function f({ } = a, [] = a, { p: { } = a } = a) {
|
||||
return ({ } = a, [] = a, { p: { } = a } = a) => a;
|
||||
}
|
||||
})();
|
||||
(function () {
|
||||
const ns = [];
|
||||
for (var { } of ns) {
|
||||
}
|
||||
for (let { } of ns) {
|
||||
}
|
||||
for (const { } of ns) {
|
||||
}
|
||||
for (var [] of ns) {
|
||||
}
|
||||
for (let [] of ns) {
|
||||
}
|
||||
for (const [] of ns) {
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,92 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts ===
|
||||
|
||||
(function () {
|
||||
var a: any;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
var {} = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
let {} = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
const {} = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
var [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
let [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
const [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
var {} = a, [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
let {} = a, [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
const {} = a, [] = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
var { p1: {}, p2: [] } = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
let { p1: {}, p2: [] } = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
const { p1: {}, p2: [] } = a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
for (var {} = {}, {} = {}; false; void 0) {
|
||||
}
|
||||
|
||||
function f({} = a, [] = a, { p: {} = a} = a) {
|
||||
>f : Symbol(f, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 21, 5))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
|
||||
return ({} = a, [] = a, { p: {} = a } = a) => a;
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7))
|
||||
}
|
||||
})();
|
||||
|
||||
(function () {
|
||||
const ns: number[][] = [];
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9))
|
||||
|
||||
for (var {} of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9))
|
||||
}
|
||||
|
||||
for (let {} of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9))
|
||||
}
|
||||
|
||||
for (const {} of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9))
|
||||
}
|
||||
|
||||
for (var [] of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9))
|
||||
}
|
||||
|
||||
for (let [] of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9))
|
||||
}
|
||||
|
||||
for (const [] of ns) {
|
||||
>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9))
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,115 @@
|
||||
=== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts ===
|
||||
|
||||
(function () {
|
||||
>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }})() : void
|
||||
>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }}) : () => void
|
||||
>function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }} : () => void
|
||||
|
||||
var a: any;
|
||||
>a : any
|
||||
|
||||
var {} = a;
|
||||
>a : any
|
||||
|
||||
let {} = a;
|
||||
>a : any
|
||||
|
||||
const {} = a;
|
||||
>a : any
|
||||
|
||||
var [] = a;
|
||||
>a : any
|
||||
|
||||
let [] = a;
|
||||
>a : any
|
||||
|
||||
const [] = a;
|
||||
>a : any
|
||||
|
||||
var {} = a, [] = a;
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
let {} = a, [] = a;
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
const {} = a, [] = a;
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
var { p1: {}, p2: [] } = a;
|
||||
>p1 : any
|
||||
>p2 : any
|
||||
>a : any
|
||||
|
||||
let { p1: {}, p2: [] } = a;
|
||||
>p1 : any
|
||||
>p2 : any
|
||||
>a : any
|
||||
|
||||
const { p1: {}, p2: [] } = a;
|
||||
>p1 : any
|
||||
>p2 : any
|
||||
>a : any
|
||||
|
||||
for (var {} = {}, {} = {}; false; void 0) {
|
||||
>{} : {}
|
||||
>{} : {}
|
||||
>false : boolean
|
||||
>void 0 : undefined
|
||||
>0 : number
|
||||
}
|
||||
|
||||
function f({} = a, [] = a, { p: {} = a} = a) {
|
||||
>f : ({}?: any, []?: any, { p: {} = a}?: any) => ({}?: any, []?: any, { p: {} = a }?: any) => any
|
||||
>a : any
|
||||
>a : any
|
||||
>p : any
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
return ({} = a, [] = a, { p: {} = a } = a) => a;
|
||||
>({} = a, [] = a, { p: {} = a } = a) => a : ({}?: any, []?: any, { p: {} = a }?: any) => any
|
||||
>a : any
|
||||
>a : any
|
||||
>p : any
|
||||
>a : any
|
||||
>a : any
|
||||
>a : any
|
||||
}
|
||||
})();
|
||||
|
||||
(function () {
|
||||
>(function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }})() : void
|
||||
>(function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }}) : () => void
|
||||
>function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }} : () => void
|
||||
|
||||
const ns: number[][] = [];
|
||||
>ns : number[][]
|
||||
>[] : undefined[]
|
||||
|
||||
for (var {} of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
|
||||
for (let {} of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
|
||||
for (const {} of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
|
||||
for (var [] of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
|
||||
for (let [] of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
|
||||
for (const [] of ns) {
|
||||
>ns : number[][]
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,31 @@
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(3,9): error TS1182: A destructuring declaration must have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(4,9): error TS1182: A destructuring declaration must have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(5,11): error TS1182: A destructuring declaration must have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(7,9): error TS1182: A destructuring declaration must have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(8,9): error TS1182: A destructuring declaration must have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(9,11): error TS1182: A destructuring declaration must have an initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts (6 errors) ====
|
||||
|
||||
(function () {
|
||||
var {};
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
let {};
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
const {};
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
|
||||
var [];
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
let [];
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
const [];
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
})();
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [emptyVariableDeclarationBindingPatterns02_ES5.ts]
|
||||
|
||||
(function () {
|
||||
var {};
|
||||
let {};
|
||||
const {};
|
||||
|
||||
var [];
|
||||
let [];
|
||||
const [];
|
||||
})();
|
||||
|
||||
//// [emptyVariableDeclarationBindingPatterns02_ES5.js]
|
||||
(function () {
|
||||
var _a = void 0;
|
||||
var _b = void 0;
|
||||
var _c = void 0;
|
||||
var _d = void 0;
|
||||
var _e = void 0;
|
||||
var _f = void 0;
|
||||
})();
|
||||
|
||||
|
||||
//// [emptyVariableDeclarationBindingPatterns02_ES5.d.ts]
|
||||
@@ -0,0 +1,31 @@
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(3,9): error TS1182: A destructuring declaration must have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(4,9): error TS1182: A destructuring declaration must have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(5,11): error TS1182: A destructuring declaration must have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(7,9): error TS1182: A destructuring declaration must have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(8,9): error TS1182: A destructuring declaration must have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(9,11): error TS1182: A destructuring declaration must have an initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts (6 errors) ====
|
||||
|
||||
(function () {
|
||||
var {};
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
let {};
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
const {};
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
|
||||
var [];
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
let [];
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
const [];
|
||||
~~
|
||||
!!! error TS1182: A destructuring declaration must have an initializer.
|
||||
})();
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [emptyVariableDeclarationBindingPatterns02_ES6.ts]
|
||||
|
||||
(function () {
|
||||
var {};
|
||||
let {};
|
||||
const {};
|
||||
|
||||
var [];
|
||||
let [];
|
||||
const [];
|
||||
})();
|
||||
|
||||
//// [emptyVariableDeclarationBindingPatterns02_ES6.js]
|
||||
(function () {
|
||||
var { };
|
||||
let { };
|
||||
const { };
|
||||
var [];
|
||||
let [];
|
||||
const [];
|
||||
})();
|
||||
|
||||
|
||||
//// [emptyVariableDeclarationBindingPatterns02_ES6.d.ts]
|
||||
@@ -1,5 +1,5 @@
|
||||
// @module: commonjs
|
||||
// @includebuiltfile: typescript.d.ts
|
||||
// @includebuiltfile: typescript_standalone.d.ts
|
||||
// @stripInternal:true
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @module: commonjs
|
||||
// @includebuiltfile: typescript.d.ts
|
||||
// @includebuiltfile: typescript_standalone.d.ts
|
||||
// @stripInternal:true
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @module: commonjs
|
||||
// @includebuiltfile: typescript.d.ts
|
||||
// @includebuiltfile: typescript_standalone.d.ts
|
||||
// @stripInternal:true
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @module: commonjs
|
||||
// @includebuiltfile: typescript.d.ts
|
||||
// @includebuiltfile: typescript_standalone.d.ts
|
||||
// @stripInternal:true
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
// @declaration: true
|
||||
|
||||
function f([]) {
|
||||
var x, y, z;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
// @declaration: true
|
||||
|
||||
function f(a, []) {
|
||||
var x, y, z;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
// @declaration: true
|
||||
|
||||
function f(a, []) {
|
||||
var x, y, z;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
// @declaration: true
|
||||
|
||||
function f([] = [1,2,3,4]) {
|
||||
var x, y, z;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @target: es5
|
||||
// @declaration: true
|
||||
|
||||
var a: any;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @target: es6
|
||||
// @declaration: true
|
||||
|
||||
var a: any;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @target: es5
|
||||
// @declaration: true
|
||||
|
||||
var a: any;
|
||||
let x, y, z, a1, a2, a3;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @target: es6
|
||||
// @declaration: true
|
||||
|
||||
var a: any;
|
||||
let x, y, z, a1, a2, a3;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @target: es5
|
||||
// @declaration: true
|
||||
|
||||
var a: any;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @target: es6
|
||||
// @declaration: true
|
||||
|
||||
var a: any;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @target: es5
|
||||
// @declaration: true
|
||||
|
||||
var a: any;
|
||||
let x, y, z, a1, a2, a3;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @target: es6
|
||||
// @declaration: true
|
||||
|
||||
var a: any;
|
||||
let x, y, z, a1, a2, a3;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
// @declaration: true
|
||||
|
||||
function f({}) {
|
||||
var x, y, z;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
// @declaration: true
|
||||
|
||||
function f(a, {}) {
|
||||
var x, y, z;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
// @declaration: true
|
||||
|
||||
function f({}, a) {
|
||||
var x, y, z;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
// @declaration: true
|
||||
|
||||
function f({} = {a: 1, b: "2", c: true}) {
|
||||
var x, y, z;
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
// @target: es5
|
||||
|
||||
(function () {
|
||||
var a: any;
|
||||
|
||||
var {} = a;
|
||||
let {} = a;
|
||||
const {} = a;
|
||||
|
||||
var [] = a;
|
||||
let [] = a;
|
||||
const [] = a;
|
||||
|
||||
var {} = a, [] = a;
|
||||
let {} = a, [] = a;
|
||||
const {} = a, [] = a;
|
||||
|
||||
var { p1: {}, p2: [] } = a;
|
||||
let { p1: {}, p2: [] } = a;
|
||||
const { p1: {}, p2: [] } = a;
|
||||
|
||||
for (var {} = {}, {} = {}; false; void 0) {
|
||||
}
|
||||
|
||||
function f({} = a, [] = a, { p: {} = a} = a) {
|
||||
return ({} = a, [] = a, { p: {} = a } = a) => a;
|
||||
}
|
||||
})();
|
||||
|
||||
(function () {
|
||||
const ns: number[][] = [];
|
||||
|
||||
for (var {} of ns) {
|
||||
}
|
||||
|
||||
for (let {} of ns) {
|
||||
}
|
||||
|
||||
for (const {} of ns) {
|
||||
}
|
||||
|
||||
for (var [] of ns) {
|
||||
}
|
||||
|
||||
for (let [] of ns) {
|
||||
}
|
||||
|
||||
for (const [] of ns) {
|
||||
}
|
||||
})();
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
// @target: es6
|
||||
|
||||
(function () {
|
||||
var a: any;
|
||||
|
||||
var {} = a;
|
||||
let {} = a;
|
||||
const {} = a;
|
||||
|
||||
var [] = a;
|
||||
let [] = a;
|
||||
const [] = a;
|
||||
|
||||
var {} = a, [] = a;
|
||||
let {} = a, [] = a;
|
||||
const {} = a, [] = a;
|
||||
|
||||
var { p1: {}, p2: [] } = a;
|
||||
let { p1: {}, p2: [] } = a;
|
||||
const { p1: {}, p2: [] } = a;
|
||||
|
||||
for (var {} = {}, {} = {}; false; void 0) {
|
||||
}
|
||||
|
||||
function f({} = a, [] = a, { p: {} = a} = a) {
|
||||
return ({} = a, [] = a, { p: {} = a } = a) => a;
|
||||
}
|
||||
})();
|
||||
|
||||
(function () {
|
||||
const ns: number[][] = [];
|
||||
|
||||
for (var {} of ns) {
|
||||
}
|
||||
|
||||
for (let {} of ns) {
|
||||
}
|
||||
|
||||
for (const {} of ns) {
|
||||
}
|
||||
|
||||
for (var [] of ns) {
|
||||
}
|
||||
|
||||
for (let [] of ns) {
|
||||
}
|
||||
|
||||
for (const [] of ns) {
|
||||
}
|
||||
})();
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// @target: es5
|
||||
// @declaration: true
|
||||
|
||||
(function () {
|
||||
var {};
|
||||
let {};
|
||||
const {};
|
||||
|
||||
var [];
|
||||
let [];
|
||||
const [];
|
||||
})();
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// @target: es6
|
||||
// @declaration: true
|
||||
|
||||
(function () {
|
||||
var {};
|
||||
let {};
|
||||
const {};
|
||||
|
||||
var [];
|
||||
let [];
|
||||
const [];
|
||||
})();
|
||||
@@ -0,0 +1,33 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// type MixinCtor<A, B> = new () => A & B & { constructor: MixinCtor<A, B> };
|
||||
//// function merge<A, B>(a: { prototype: A }, b: { prototype: B }): MixinCtor<A, B> {
|
||||
//// let merged = function() { }
|
||||
//// Object.assign(merged.prototype, a.prototype, b.prototype);
|
||||
//// return <MixinCtor<A, B>><any>merged;
|
||||
//// }
|
||||
////
|
||||
//// class TreeNode {
|
||||
//// value: any;
|
||||
//// }
|
||||
////
|
||||
//// abstract class LeftSideNode extends TreeNode {
|
||||
//// abstract right(): TreeNode;
|
||||
//// left(): TreeNode {
|
||||
//// return null;
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// abstract class RightSideNode extends TreeNode {
|
||||
//// abstract left(): TreeNode;
|
||||
//// right(): TreeNode {
|
||||
//// return null;
|
||||
//// };
|
||||
//// }
|
||||
////
|
||||
//// var obj = new (merge(LeftSideNode, RightSideNode))();
|
||||
//// obj./**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("left");
|
||||
verify.completionListContains("right");
|
||||
@@ -173,6 +173,20 @@ describe('PreProcessFile:', function () {
|
||||
isLibFile: false
|
||||
})
|
||||
});
|
||||
|
||||
it("Correctly handles export import declarations", function () {
|
||||
test("export import a = require(\"m1\");",
|
||||
true,
|
||||
{
|
||||
referencedFiles: [],
|
||||
importedFiles: [
|
||||
{ fileName: "m1", pos: 26, end: 28 }
|
||||
],
|
||||
ambientExternalModules: undefined,
|
||||
isLibFile: false
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user