Merge branch 'master' into asyncFunctions

This commit is contained in:
Ron Buckton
2015-05-13 11:47:56 -07:00
118 changed files with 1784 additions and 2508 deletions
+12
View File
@@ -440,6 +440,18 @@ module ts {
else if (isBlockOrCatchScoped(<Declaration>node)) {
bindBlockScopedVariableDeclaration(<Declaration>node);
}
else if (isParameterDeclaration(<VariableLikeDeclaration>node)) {
// It is safe to walk up parent chain to find whether the node is a destructing parameter declaration
// because its parent chain has already been set up, since parents are set before descending into children.
//
// If node is a binding element in parameter declaration, we need to use ParameterExcludes.
// Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration
// For example:
// function foo([a,a]) {} // Duplicate Identifier error
// function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter
// // which correctly set excluded symbols
bindDeclaration(<Declaration>node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes, /*isBlockScopeContainer*/ false);
}
else {
bindDeclaration(<Declaration>node, SymbolFlags.FunctionScopedVariable, SymbolFlags.FunctionScopedVariableExcludes, /*isBlockScopeContainer*/ false);
}
+33 -41
View File
@@ -866,10 +866,11 @@ module ts {
return symbol;
}
}
let fileName: string;
let sourceFile: SourceFile;
while (true) {
let fileName = normalizePath(combinePaths(searchPath, moduleName));
sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts");
fileName = normalizePath(combinePaths(searchPath, moduleName));
sourceFile = forEach(supportedExtensions, extension => host.getSourceFile(fileName + extension));
if (sourceFile || isRelative) {
break;
}
@@ -2059,13 +2060,6 @@ module ts {
return resolutionResults.pop();
}
function getRootDeclaration(node: Node): Node {
while (node.kind === SyntaxKind.BindingElement) {
node = node.parent.parent;
}
return node;
}
function getDeclarationContainer(node: Node): Node {
node = getRootDeclaration(node);
@@ -5395,38 +5389,43 @@ module ts {
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
return type;
}
// Target type is type of prototype property
let targetType: Type;
let prototypeProperty = getPropertyOfType(rightType, "prototype");
if (prototypeProperty) {
let targetType = getTypeOfSymbol(prototypeProperty);
if (targetType !== anyType) {
// Narrow to the target type if it's a subtype of the current type
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
}
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
if (type.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, targetType)));
}
// Target type is type of the protoype property
let prototypePropertyType = getTypeOfSymbol(prototypeProperty);
if (prototypePropertyType !== anyType) {
targetType = prototypePropertyType;
}
}
// Target type is type of construct signature
let constructSignatures: Signature[];
if (rightType.flags & TypeFlags.Interface) {
constructSignatures = resolveDeclaredMembers(<InterfaceType>rightType).declaredConstructSignatures;
}
else if (rightType.flags & TypeFlags.Anonymous) {
constructSignatures = getSignaturesOfType(rightType, SignatureKind.Construct);
}
if (constructSignatures && constructSignatures.length !== 0) {
let instanceType = getUnionType(map(constructSignatures, signature => getReturnTypeOfSignature(getErasedSignature(signature))));
// Pickup type from union types
if (type.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, instanceType)));
if (!targetType) {
// Target type is type of construct signature
let constructSignatures: Signature[];
if (rightType.flags & TypeFlags.Interface) {
constructSignatures = resolveDeclaredMembers(<InterfaceType>rightType).declaredConstructSignatures;
}
else if (rightType.flags & TypeFlags.Anonymous) {
constructSignatures = getSignaturesOfType(rightType, SignatureKind.Construct);
}
if (constructSignatures && constructSignatures.length) {
targetType = getUnionType(map(constructSignatures, signature => getReturnTypeOfSignature(getErasedSignature(signature))));
}
return instanceType;
}
if (targetType) {
// Narrow to the target type if it's a subtype of the current type
if (isTypeSubtypeOf(targetType, type)) {
return targetType;
}
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
if (type.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, targetType)));
}
}
return type;
}
@@ -9529,13 +9528,6 @@ module ts {
}
}
function isParameterDeclaration(node: VariableLikeDeclaration) {
while (node.kind === SyntaxKind.BindingElement) {
node = <VariableLikeDeclaration>node.parent.parent;
}
return node.kind === SyntaxKind.Parameter;
}
// Check that a parameter initializer contains no references to parameters declared to the right of itself
function checkParameterInitializer(node: VariableLikeDeclaration): void {
if (getRootDeclaration(node).kind !== SyntaxKind.Parameter) {
+1 -1
View File
@@ -88,7 +88,7 @@ module ts {
{
name: "noEmitOnError",
type: "boolean",
description: Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported,
description: Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
},
{
name: "noImplicitAny",
+6 -4
View File
@@ -640,16 +640,18 @@ module ts {
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
}
let supportedExtensions = [".d.ts", ".ts", ".js"];
/**
* List of supported extensions in order of file resolution precedence.
*/
export const supportedExtensions = [".ts", ".d.ts"];
const extensionsToRemove = [".d.ts", ".ts", ".js"];
export function removeFileExtension(path: string): string {
for (let ext of supportedExtensions) {
for (let ext of extensionsToRemove) {
if (fileExtensionIs(path, ext)) {
return path.substr(0, path.length - ext.length);
}
}
return path;
}
@@ -456,8 +456,8 @@ module ts {
Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." },
Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." },
Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." },
Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." },
Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
@@ -477,7 +477,7 @@ module ts {
Watch_input_files: { code: 6005, category: DiagnosticCategory.Message, key: "Watch input files." },
Redirect_output_structure_to_the_directory: { code: 6006, category: DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." },
Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." },
Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." },
Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." },
Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." },
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
@@ -510,7 +510,7 @@ module ts {
Corrupted_locale_file_0: { code: 6051, category: DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." },
File_0_not_found: { code: 6053, category: DiagnosticCategory.Error, key: "File '{0}' not found." },
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." },
Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." },
Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
+4 -4
View File
@@ -1815,11 +1815,11 @@
"category": "Error",
"code": 5033
},
"Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.": {
"Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.": {
"category": "Error",
"code": 5038
},
"Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.": {
"Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.": {
"category": "Error",
"code": 5039
},
@@ -1900,7 +1900,7 @@
"category": "Message",
"code": 6007
},
"Do not emit outputs if any type checking errors were reported.": {
"Do not emit outputs if any errors were reported.": {
"category": "Message",
"code": 6008
},
@@ -2032,7 +2032,7 @@
"category": "Error",
"code": 6053
},
"File '{0}' must have extension '.ts' or '.d.ts'.": {
"File '{0}' has unsupported extension. The only supported extensions are {1}.": {
"category": "Error",
"code": 6054
},
+72 -21
View File
@@ -1406,7 +1406,7 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
return true;
}
function emitListWithSpread(elements: Expression[], multiLine: boolean, trailingComma: boolean) {
function emitListWithSpread(elements: Expression[], alwaysCopy: boolean, multiLine: boolean, trailingComma: boolean) {
let pos = 0;
let group = 0;
let length = elements.length;
@@ -1423,6 +1423,9 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
e = (<SpreadElementExpression>e).expression;
emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e));
pos++;
if (pos === length && group === 0 && alwaysCopy && e.kind !== SyntaxKind.ArrayLiteralExpression) {
write(".slice()");
}
}
else {
let i = pos;
@@ -1462,7 +1465,7 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
write("]");
}
else {
emitListWithSpread(elements, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0,
emitListWithSpread(elements, /*alwaysCopy*/ true, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0,
/*trailingComma*/ elements.hasTrailingComma);
}
}
@@ -1887,7 +1890,7 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
write("void 0");
}
write(", ");
emitListWithSpread(node.arguments, /*multiLine*/ false, /*trailingComma*/ false);
emitListWithSpread(node.arguments, /*alwaysCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false);
write(")");
}
@@ -2679,7 +2682,8 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
writeLine();
emitStart(node);
if (compilerOptions.module === ModuleKind.System) {
// emit call to exporter only for top level nodes
if (compilerOptions.module === ModuleKind.System && node.parent === currentSourceFile) {
// emit export default <smth> as
// export("default", <smth>)
write(`${exportFunctionForFile}("`);
@@ -4528,15 +4532,18 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
return;
}
if (!(node.flags & NodeFlags.Export) || isES6ExportedDeclaration(node)) {
emitStart(node);
if (isES6ExportedDeclaration(node)) {
write("export ");
if (!shouldHoistDeclarationInSystemJsModule(node)) {
// do not emit var if variable was already hoisted
if (!(node.flags & NodeFlags.Export) || isES6ExportedDeclaration(node)) {
emitStart(node);
if (isES6ExportedDeclaration(node)) {
write("export ");
}
write("var ");
emit(node.name);
emitEnd(node);
write(";");
}
write("var ");
emit(node.name);
emitEnd(node);
write(";");
}
writeLine();
emitStart(node);
@@ -4558,7 +4565,8 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
emitModuleMemberName(node);
write(" = {}));");
emitEnd(node);
if (!isES6ExportedDeclaration(node) && node.flags & NodeFlags.Export) {
if (!isES6ExportedDeclaration(node) && node.flags & NodeFlags.Export && !shouldHoistDeclarationInSystemJsModule(node)) {
// do not emit var if variable was already hoisted
writeLine();
emitStart(node);
write("var ");
@@ -4569,6 +4577,15 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
write(";");
}
if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) {
if (compilerOptions.module === ModuleKind.System && (node.flags & NodeFlags.Export)) {
// write the call to exporter for enum
writeLine();
write(`${exportFunctionForFile}("`);
emitDeclarationName(node);
write(`", `);
emitDeclarationName(node);
write(")");
}
emitExportMemberAssignments(node.name);
}
}
@@ -5249,7 +5266,7 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
// in theory we should hoist only exported functions and its dependencies
// in practice to simplify things we'll hoist all source level functions and variable declaration
// including variables declarations for module and class declarations
let hoistedVars: (Identifier | ClassDeclaration | ModuleDeclaration)[];
let hoistedVars: (Identifier | ClassDeclaration | ModuleDeclaration | EnumDeclaration)[];
let hoistedFunctionDeclarations: FunctionDeclaration[];
let exportedDeclarations: (Identifier | Declaration)[];
@@ -5258,13 +5275,30 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
if (hoistedVars) {
writeLine();
write("var ");
let seen: Map<string> = {};
for (let i = 0; i < hoistedVars.length; ++i) {
let local = hoistedVars[i];
let name = local.kind === SyntaxKind.Identifier
? <Identifier>local
: <Identifier>(<ClassDeclaration | ModuleDeclaration | EnumDeclaration>local).name;
if (name) {
// do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables
let text = unescapeIdentifier(name.text);
if (hasProperty(seen, text)) {
continue;
}
else {
seen[text] = text;
}
}
if (i !== 0) {
write(", ");
}
if (local.kind === SyntaxKind.ClassDeclaration || local.kind === SyntaxKind.ModuleDeclaration) {
emitDeclarationName(<ClassDeclaration | ModuleDeclaration>local);
if (local.kind === SyntaxKind.ClassDeclaration || local.kind === SyntaxKind.ModuleDeclaration || local.kind === SyntaxKind.EnumDeclaration) {
emitDeclarationName(<ClassDeclaration | ModuleDeclaration | EnumDeclaration>local);
}
else {
emit(local);
@@ -5298,6 +5332,10 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
return exportedDeclarations;
function visit(node: Node): void {
if (node.flags & NodeFlags.Ambient) {
return;
}
if (node.kind === SyntaxKind.FunctionDeclaration) {
if (!hoistedFunctionDeclarations) {
hoistedFunctionDeclarations = [];
@@ -5308,7 +5346,6 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
}
if (node.kind === SyntaxKind.ClassDeclaration) {
// TODO: rename block scoped classes
if (!hoistedVars) {
hoistedVars = [];
}
@@ -5317,12 +5354,26 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
return;
}
if (node.kind === SyntaxKind.ModuleDeclaration && shouldEmitModuleDeclaration(<ModuleDeclaration>node)) {
if (!hoistedVars) {
hoistedVars = [];
if (node.kind === SyntaxKind.EnumDeclaration) {
if (shouldEmitEnumDeclaration(<EnumDeclaration>node)) {
if (!hoistedVars) {
hoistedVars = [];
}
hoistedVars.push(<ModuleDeclaration>node);
}
hoistedVars.push(<ModuleDeclaration>node);
return;
}
if (node.kind === SyntaxKind.ModuleDeclaration) {
if (shouldEmitModuleDeclaration(<ModuleDeclaration>node)) {
if (!hoistedVars) {
hoistedVars = [];
}
hoistedVars.push(<ModuleDeclaration>node);
}
return;
}
+7 -12
View File
@@ -988,17 +988,6 @@ module ts {
}
function nextTokenCanFollowModifier() {
nextToken();
return canFollowModifier();
}
function parseAnyContextualModifier(isArrowFunction?: boolean): boolean {
return isModifier(token) && tryParse(isArrowFunction
? nextTokenCanFollowModifierForArrowFunction
: nextTokenCanFollowContextualModifier);
}
function nextTokenCanFollowContextualModifier() {
if (token === SyntaxKind.ConstKeyword) {
// 'const' is only a modifier if followed by 'enum'.
return nextToken() === SyntaxKind.EnumKeyword;
@@ -1017,7 +1006,13 @@ module ts {
return canFollowModifier();
}
function canFollowModifierForArrowFunction(): boolean {
function parseAnyContextualModifier(isArrowFunction?: boolean): boolean {
return isModifier(token) && tryParse(isArrowFunction
? nextTokenCanFollowModifierForArrowFunction
: nextTokenCanFollowModifier);
}
function canFollowModifierForArrowFunction(): boolean {
// Arrow functions can have an `async` modifier, but the rules for what can follow that modifier
// differ from the rules for any other declaration.
// The `async` modifier on an async function can only be followed by an open parenthesis,
+26 -16
View File
@@ -219,7 +219,12 @@ module ts {
// Create the emit resolver outside of the "emitTime" tracking code below. That way
// any cost associated with it (like type checking) are appropriate associated with
// the type-checking counter.
let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
//
// If the -out option is specified, we should not pass the source file to getEmitResolver.
// This is because in the -out scenario all files need to be emitted, and therefore all
// files need to be type checked. And the way to specify that all files need to be type
// checked is to not pass the file to getEmitResolver.
let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile);
let start = new Date().getTime();
@@ -233,7 +238,7 @@ module ts {
}
function getSourceFile(fileName: string) {
fileName = host.getCanonicalFileName(fileName);
fileName = host.getCanonicalFileName(normalizeSlashes(fileName));
return hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined;
}
@@ -307,45 +312,52 @@ module ts {
function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) {
let start: number;
let length: number;
let extensions: string;
let diagnosticArgument: string[];
if (refEnd !== undefined && refPos !== undefined) {
start = refPos;
length = refEnd - refPos;
}
let diagnostic: DiagnosticMessage;
if (hasExtension(fileName)) {
if (!options.allowNonTsExtensions && !fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) {
diagnostic = Diagnostics.File_0_must_have_extension_ts_or_d_ts;
if (!options.allowNonTsExtensions && !forEach(supportedExtensions, extension => fileExtensionIs(host.getCanonicalFileName(fileName), extension))) {
diagnostic = Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
}
else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
diagnostic = Diagnostics.File_0_not_found;
diagnosticArgument = [fileName];
}
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
diagnostic = Diagnostics.A_file_cannot_have_a_reference_to_itself;
diagnosticArgument = [fileName];
}
}
else {
if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
diagnostic = Diagnostics.File_0_not_found;
diagnosticArgument = [fileName];
}
else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) {
else if (!forEach(supportedExtensions, extension => findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd))) {
diagnostic = Diagnostics.File_0_not_found;
fileName += ".ts";
diagnosticArgument = [fileName];
}
}
if (diagnostic) {
if (refFile) {
diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, fileName));
diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, ...diagnosticArgument));
}
else {
diagnostics.add(createCompilerDiagnostic(diagnostic, fileName));
diagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument));
}
}
}
// Get source file from normalized fileName
function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile {
let canonicalName = host.getCanonicalFileName(fileName);
let canonicalName = host.getCanonicalFileName(normalizeSlashes(fileName));
if (hasProperty(filesByName, canonicalName)) {
// We've already looked for this file, use cached result
return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false);
@@ -417,9 +429,10 @@ module ts {
let moduleNameText = (<LiteralExpression>moduleNameExpr).text;
if (moduleNameText) {
let searchPath = basePath;
let searchName: string;
while (true) {
let searchName = normalizePath(combinePaths(searchPath, moduleNameText));
if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) {
searchName = normalizePath(combinePaths(searchPath, moduleNameText));
if (forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, moduleNameExpr))) {
break;
}
let parentPath = getDirectoryPath(searchPath);
@@ -448,10 +461,7 @@ module ts {
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
// only through top - level external module names. Relative external module names are not permitted.
let searchName = normalizePath(combinePaths(basePath, moduleName));
let tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral);
if (!tsFile) {
findModuleSourceFile(searchName + ".d.ts", nameLiteral);
}
forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, nameLiteral));
}
}
});
@@ -564,10 +574,10 @@ module ts {
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
if (options.mapRoot) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option));
}
if (options.sourceRoot) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option));
}
return;
}
+12 -3
View File
@@ -484,9 +484,6 @@ module ts {
case SyntaxKind.IndexSignature:
case SyntaxKind.FunctionType:
case SyntaxKind.ConstructorType:
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
case SyntaxKind.FunctionDeclaration:
return true;
}
}
@@ -1167,6 +1164,18 @@ module ts {
}
return false;
}
export function isParameterDeclaration(node: VariableLikeDeclaration) {
let root = getRootDeclaration(node);
return root.kind === SyntaxKind.Parameter;
}
export function getRootDeclaration(node: Node): Node {
while (node.kind === SyntaxKind.BindingElement) {
node = node.parent.parent;
}
return node;
}
export function nodeStartsNewLexicalEnvironment(n: Node): boolean {
return isFunctionLike(n) || n.kind === SyntaxKind.ModuleDeclaration || n.kind === SyntaxKind.SourceFile;
+5 -5
View File
@@ -144,10 +144,10 @@ module FourSlash {
if (globalOptions.hasOwnProperty(prop)) {
switch (prop) {
case metadataOptionNames.allowNonTsExtensions:
settings.allowNonTsExtensions = true;
settings.allowNonTsExtensions = globalOptions[prop] === "true";
break;
case metadataOptionNames.declaration:
settings.declaration = true;
settings.declaration = globalOptions[prop] === "true";
break;
case metadataOptionNames.mapRoot:
settings.mapRoot = globalOptions[prop];
@@ -174,7 +174,7 @@ module FourSlash {
settings.outDir = globalOptions[prop];
break;
case metadataOptionNames.sourceMap:
settings.sourceMap = true;
settings.sourceMap = globalOptions[prop] === "true";
break;
case metadataOptionNames.sourceRoot:
settings.sourceRoot = globalOptions[prop];
@@ -308,7 +308,7 @@ module FourSlash {
ts.forEach(testData.files, file => {
// Create map between fileName and its content for easily looking up when resolveReference flag is specified
this.inputFiles[file.fileName] = file.content;
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference]) {
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference] === "true") {
startResolveFileRef = file;
} else if (startResolveFileRef) {
// If entry point for resolving file references is already specified, report duplication error
@@ -1158,7 +1158,7 @@ module FourSlash {
var allFourSlashFiles = this.testData.files;
for (var idx = 0; idx < allFourSlashFiles.length; ++idx) {
var file = allFourSlashFiles[idx];
if (file.fileOptions[metadataOptionNames.emitThisFile]) {
if (file.fileOptions[metadataOptionNames.emitThisFile] === "true") {
// Find a file with the flag emitThisFile turned on
emitFiles.push(file);
}
+8 -8
View File
@@ -1008,19 +1008,19 @@ module Harness {
break;
case 'noemitonerror':
options.noEmitOnError = !!setting.value;
options.noEmitOnError = setting.value === 'true';
break;
case 'noresolve':
options.noResolve = !!setting.value;
options.noResolve = setting.value === 'true';
break;
case 'noimplicitany':
options.noImplicitAny = !!setting.value;
options.noImplicitAny = setting.value === 'true';
break;
case 'nolib':
options.noLib = !!setting.value;
options.noLib = setting.value === 'true';
break;
case 'out':
@@ -1042,11 +1042,11 @@ module Harness {
break;
case 'sourcemap':
options.sourceMap = !!setting.value;
options.sourceMap = setting.value === 'true';
break;
case 'declaration':
options.declaration = !!setting.value;
options.declaration = setting.value === 'true';
break;
case 'newline':
@@ -1070,7 +1070,7 @@ module Harness {
break;
case 'stripinternal':
options.stripInternal = !!setting.value;
options.stripInternal = setting.value === 'true';
case 'usecasesensitivefilenames':
useCaseSensitiveFileNames = setting.value === 'true';
@@ -1081,7 +1081,7 @@ module Harness {
break;
case 'emitbom':
options.emitBOM = !!setting.value;
options.emitBOM = setting.value === 'true';
break;
case 'errortruncation':
+20 -4
View File
@@ -949,6 +949,7 @@ module ts {
export interface LanguageServiceHost {
getCompilationSettings(): CompilerOptions;
getNewLine?(): string;
getProjectVersion?(): string;
getScriptFileNames(): string[];
getScriptVersion(fileName: string): string;
getScriptSnapshot(fileName: string): IScriptSnapshot;
@@ -2353,6 +2354,7 @@ module ts {
let syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host);
let ruleProvider: formatting.RulesProvider;
let program: Program;
let lastProjectVersion: string;
let useCaseSensitivefileNames = false;
let cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());
@@ -2392,6 +2394,18 @@ module ts {
}
function synchronizeHostData(): void {
// perform fast check if host supports it
if (host.getProjectVersion) {
let hostProjectVersion = host.getProjectVersion();
if (hostProjectVersion) {
if (lastProjectVersion === hostProjectVersion) {
return;
}
lastProjectVersion = hostProjectVersion;
}
}
// Get a fresh cache of the host information
let hostCache = new HostCache(host, getCanonicalFileName);
@@ -6039,11 +6053,13 @@ module ts {
let end = triviaScanner.getTextPos();
let width = end - start;
if (textSpanIntersectsWith(span, start, width)) {
if (!isTrivia(kind)) {
return;
}
// The moment we get something that isn't trivia, then stop processing.
if (!isTrivia(kind)) {
return;
}
// Only bother with the trivia if it at least intersects the span of interest.
if (textSpanIntersectsWith(span, start, width)) {
if (isComment(kind)) {
// Simple comment. Just add as is.
pushClassification(start, width, ClassificationType.comment);
+11 -1
View File
@@ -55,6 +55,7 @@ module ts {
getCurrentDirectory(): string;
getDefaultLibFileName(options: string): string;
getNewLine?(): string;
getProjectVersion?(): string;
}
/** Public interface of the the of a config service shim instance.*/
@@ -260,6 +261,15 @@ module ts {
this.shimHost.error(s);
}
public getProjectVersion(): string {
if (!this.shimHost.getProjectVersion) {
// shimmed host does not support getProjectVersion
return undefined;
}
return this.shimHost.getProjectVersion();
}
public getCompilationSettings(): CompilerOptions {
var settingsJson = this.shimHost.getCompilationSettings();
if (settingsJson == null || settingsJson == "") {
@@ -883,7 +893,7 @@ module ts {
return {
options: configFile.options,
files: configFile.fileNames,
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
errors: realizeDiagnostics(configFile.errors, '\r\n')
};
});
}
@@ -26,7 +26,7 @@ function f2() {
//// [arrayLiteralSpread.js]
function f0() {
var a = [1, 2, 3];
var a1 = a;
var a1 = a.slice();
var a2 = [1].concat(a);
var a3 = [1, 2].concat(a);
var a4 = a.concat([1]);
@@ -93,12 +93,12 @@ var temp2 = [[1, 2, 3], ["hello", "string"]];
var temp3 = [undefined, null, undefined];
var temp4 = [];
var d0 = [1, true].concat(temp); // has type (string|number|boolean)[]
var d1 = temp; // has type string[]
var d2 = temp1;
var d3 = temp1;
var d1 = temp.slice(); // has type string[]
var d2 = temp1.slice();
var d3 = temp1.slice();
var d4 = temp.concat(temp1);
var d5 = temp3;
var d6 = temp4;
var d7 = temp1;
var d8 = [temp1];
var d9 = [temp1].concat(["hello"]);
var d5 = temp3.slice();
var d6 = temp4.slice();
var d7 = temp1.slice();
var d8 = [temp1.slice()];
var d9 = [temp1.slice()].concat(["hello"]);
+2 -2
View File
@@ -55,6 +55,6 @@ var _a = [1, 2, "string", true], b1 = _a[0], b2 = _a[1];
var temp = ["s", "t", "r"];
var temp1 = [1, 2, 3];
var temp2 = [[1, 2, 3], ["hello", "string"]];
var c0 = temp2; // Error
var c1 = temp1; // Error cannot assign number[] to [number, number, number]
var c0 = temp2.slice(); // Error
var c1 = temp1.slice(); // Error cannot assign number[] to [number, number, number]
var c2 = temp1.concat(temp); // Error cannot assign (number|string)[] to number[]
@@ -0,0 +1,25 @@
tests/cases/compiler/declarationEmitDestructuring2.ts(3,13): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/declarationEmitDestructuring2.ts(3,17): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/declarationEmitDestructuring2.ts(3,23): error TS2300: Duplicate identifier 'c'.
tests/cases/compiler/declarationEmitDestructuring2.ts(3,41): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/declarationEmitDestructuring2.ts(3,44): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/declarationEmitDestructuring2.ts(3,47): error TS2300: Duplicate identifier 'c'.
==== tests/cases/compiler/declarationEmitDestructuring2.ts (6 errors) ====
function f({x = 10, y: [a, b, c, d] = [1, 2, 3, 4]} = { x: 10, y: [2, 4, 6, 8] }) { }
function g([a, b, c, d] = [1, 2, 3, 4]) { }
function h([a, [b], [[c]], {x = 10, y: [a, b, c], z: {a1, b1}}]){ }
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'b'.
~
!!! error TS2300: Duplicate identifier 'c'.
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'b'.
~
!!! error TS2300: Duplicate identifier 'c'.
function h1([a, [b], [[c]], {x = 10, y = [1, 2, 3], z: {a1, b1}}]){ }
@@ -1,40 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuring2.ts ===
function f({x = 10, y: [a, b, c, d] = [1, 2, 3, 4]} = { x: 10, y: [2, 4, 6, 8] }) { }
>f : Symbol(f, Decl(declarationEmitDestructuring2.ts, 0, 0))
>x : Symbol(x, Decl(declarationEmitDestructuring2.ts, 0, 12))
>a : Symbol(a, Decl(declarationEmitDestructuring2.ts, 0, 24))
>b : Symbol(b, Decl(declarationEmitDestructuring2.ts, 0, 26))
>c : Symbol(c, Decl(declarationEmitDestructuring2.ts, 0, 29))
>d : Symbol(d, Decl(declarationEmitDestructuring2.ts, 0, 32))
>x : Symbol(x, Decl(declarationEmitDestructuring2.ts, 0, 55))
>y : Symbol(y, Decl(declarationEmitDestructuring2.ts, 0, 62))
function g([a, b, c, d] = [1, 2, 3, 4]) { }
>g : Symbol(g, Decl(declarationEmitDestructuring2.ts, 0, 85))
>a : Symbol(a, Decl(declarationEmitDestructuring2.ts, 1, 12))
>b : Symbol(b, Decl(declarationEmitDestructuring2.ts, 1, 14))
>c : Symbol(c, Decl(declarationEmitDestructuring2.ts, 1, 17))
>d : Symbol(d, Decl(declarationEmitDestructuring2.ts, 1, 20))
function h([a, [b], [[c]], {x = 10, y: [a, b, c], z: {a1, b1}}]){ }
>h : Symbol(h, Decl(declarationEmitDestructuring2.ts, 1, 43))
>a : Symbol(a, Decl(declarationEmitDestructuring2.ts, 2, 12), Decl(declarationEmitDestructuring2.ts, 2, 40))
>b : Symbol(b, Decl(declarationEmitDestructuring2.ts, 2, 16), Decl(declarationEmitDestructuring2.ts, 2, 42))
>c : Symbol(c, Decl(declarationEmitDestructuring2.ts, 2, 22), Decl(declarationEmitDestructuring2.ts, 2, 45))
>x : Symbol(x, Decl(declarationEmitDestructuring2.ts, 2, 28))
>a : Symbol(a, Decl(declarationEmitDestructuring2.ts, 2, 12), Decl(declarationEmitDestructuring2.ts, 2, 40))
>b : Symbol(b, Decl(declarationEmitDestructuring2.ts, 2, 16), Decl(declarationEmitDestructuring2.ts, 2, 42))
>c : Symbol(c, Decl(declarationEmitDestructuring2.ts, 2, 22), Decl(declarationEmitDestructuring2.ts, 2, 45))
>a1 : Symbol(a1, Decl(declarationEmitDestructuring2.ts, 2, 54))
>b1 : Symbol(b1, Decl(declarationEmitDestructuring2.ts, 2, 57))
function h1([a, [b], [[c]], {x = 10, y = [1, 2, 3], z: {a1, b1}}]){ }
>h1 : Symbol(h1, Decl(declarationEmitDestructuring2.ts, 2, 67))
>a : Symbol(a, Decl(declarationEmitDestructuring2.ts, 3, 13))
>b : Symbol(b, Decl(declarationEmitDestructuring2.ts, 3, 17))
>c : Symbol(c, Decl(declarationEmitDestructuring2.ts, 3, 23))
>x : Symbol(x, Decl(declarationEmitDestructuring2.ts, 3, 29))
>y : Symbol(y, Decl(declarationEmitDestructuring2.ts, 3, 36))
>a1 : Symbol(a1, Decl(declarationEmitDestructuring2.ts, 3, 56))
>b1 : Symbol(b1, Decl(declarationEmitDestructuring2.ts, 3, 59))
@@ -1,68 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuring2.ts ===
function f({x = 10, y: [a, b, c, d] = [1, 2, 3, 4]} = { x: 10, y: [2, 4, 6, 8] }) { }
>f : ({x = 10, y: [a, b, c, d] = [1, 2, 3, 4]}?: { x: number; y: [number, number, number, number]; }) => void
>x : number
>10 : number
>y : any
>a : number
>b : number
>c : number
>d : number
>[1, 2, 3, 4] : [number, number, number, number]
>1 : number
>2 : number
>3 : number
>4 : number
>{ x: 10, y: [2, 4, 6, 8] } : { x: number; y: [number, number, number, number]; }
>x : number
>10 : number
>y : [number, number, number, number]
>[2, 4, 6, 8] : [number, number, number, number]
>2 : number
>4 : number
>6 : number
>8 : number
function g([a, b, c, d] = [1, 2, 3, 4]) { }
>g : ([a, b, c, d]?: [number, number, number, number]) => void
>a : number
>b : number
>c : number
>d : number
>[1, 2, 3, 4] : [number, number, number, number]
>1 : number
>2 : number
>3 : number
>4 : number
function h([a, [b], [[c]], {x = 10, y: [a, b, c], z: {a1, b1}}]){ }
>h : ([a, [b], [[c]], {x = 10, y: [a, b, c], z: {a1, b1}}]: [any, [any], [[any]], { x?: number; y: [any, any, any]; z: { a1: any; b1: any; }; }]) => void
>a : any
>b : any
>c : any
>x : number
>10 : number
>y : any
>a : any
>b : any
>c : any
>z : any
>a1 : any
>b1 : any
function h1([a, [b], [[c]], {x = 10, y = [1, 2, 3], z: {a1, b1}}]){ }
>h1 : ([a, [b], [[c]], {x = 10, y = [1, 2, 3], z: {a1, b1}}]: [any, [any], [[any]], { x?: number; y?: number[]; z: { a1: any; b1: any; }; }]) => void
>a : any
>b : any
>c : any
>x : number
>10 : number
>y : number[]
>[1, 2, 3] : number[]
>1 : number
>2 : number
>3 : number
>z : any
>a1 : any
>b1 : any
@@ -88,7 +88,7 @@ var _e = foo(), b6 = _e[0], b7 = _e[1];
var b8 = foo().slice(0);
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
var temp = [1, 2, 3];
var _f = temp, c0 = _f[0], c1 = _f[1];
var _f = temp.slice(), c0 = _f[0], c1 = _f[1];
var c2 = [][0];
var _g = [[[]], [[[[]]]]], c3 = _g[0][0][0], c4 = _g[1][0][0][0][0];
var _h = [[1], true], c5 = _h[0][0], c6 = _h[1];
@@ -50,8 +50,8 @@ var _c = bar(), _d = _c[0], b3 = _d === void 0 ? "string" : _d, b4 = _c[1], b5 =
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
var temp = [1, 2, 3];
var _e = temp, c0 = _e[0], c1 = _e[1]; // Error
var _f = temp, c2 = _f[0], c3 = _f[1]; // Error
var _e = temp.slice(), c0 = _e[0], c1 = _e[1]; // Error
var _f = temp.slice(), c2 = _f[0], c3 = _f[1]; // Error
function foo(idx) {
return {
2: true
@@ -0,0 +1,111 @@
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts(96,18): error TS2300: Duplicate identifier 'number'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts(96,26): error TS2300: Duplicate identifier 'number'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts(96,34): error TS2300: Duplicate identifier 'number'.
==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts (3 errors) ====
// Conformance for emitting ES6
// A parameter declaration may specify either an identifier or a binding pattern.
// The identifiers specified in parameter declarations and binding patterns
// in a parameter list must be unique within that parameter list.
// If the declaration includes a type annotation, the parameter is of that type
function a1([a, b, [[c]]]: [number, number, string[][]]) { }
function a2(o: { x: number, a: number }) { }
function a3({j, k, l: {m, n}, q: [a, b, c]}: { j: number, k: string, l: { m: boolean, n: number }, q: (number|string)[] }) { };
function a4({x, a}: { x: number, a: number }) { }
a1([1, 2, [["world"]]]);
a1([1, 2, [["world"]], 3]);
// If the declaration includes an initializer expression (which is permitted only
// when the parameter list occurs in conjunction with a function body),
// the parameter type is the widened form (section 3.11) of the type of the initializer expression.
function b1(z = [undefined, null]) { };
function b2(z = null, o = { x: 0, y: undefined }) { }
function b3({z: {x, y: {j}}} = { z: { x: "hi", y: { j: 1 } } }) { }
interface F1 {
b5(z, y, [, a, b], {p, m: { q, r}});
}
function b6([a, z, y] = [undefined, null, undefined]) { }
function b7([[a], b, [[c, d]]] = [[undefined], undefined, [[undefined, undefined]]]) { }
b1([1, 2, 3]); // z is widen to the type any[]
b2("string", { x: 200, y: "string" });
b2("string", { x: 200, y: true });
// If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3)
enum Foo { a }
function c0({z: {x, y: {j}}}) { }
function c1({z} = { z: 10 }) { }
function c2({z = 10}) { }
function c3({b}: { b: number|string} = { b: "hello" }) { }
function c5([a, b, [[c]]]) { }
function c6([a, b, [[c=1]]]) { }
c0({z : { x: 1, y: { j: "world" } }}); // Implied type is { z: {x: any, y: {j: any}} }
c0({z : { x: "string", y: { j: true } }}); // Implied type is { z: {x: any, y: {j: any}} }
c1(); // Implied type is {z:number}?
c1({ z: 1 }) // Implied type is {z:number}?
c2({}); // Implied type is {z?: number}
c2({z:1}); // Implied type is {z?: number}
c3({ b: 1 }); // Implied type is { b: number|string }.
c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]]
c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]]
// A parameter can be marked optional by following its name or binding pattern with a question mark (?)
// or by including an initializer.
interface F2 {
d3([a, b, c]?);
d4({x, y, z}?);
e0([a, b, c]);
}
class C2 implements F2 {
constructor() { }
d3() { }
d4() { }
e0([a, b, c]) { }
}
class C3 implements F2 {
d3([a, b, c]) { }
d4({x, y, z}) { }
e0([a, b, c]) { }
}
function d5({x, y} = { x: 1, y: 2 }) { }
d5(); // Parameter is optional as its declaration included an initializer
// Destructuring parameter declarations do not permit type annotations on the individual binding patterns,
// as such annotations would conflict with the already established meaning of colons in object literals.
// Type annotations must instead be written on the top- level parameter declaration
function e1({x: number}) { } // x has type any NOT number
function e2({x}: { x: number }) { } // x is type number
function e3({x}: { x?: number }) { } // x is an optional with type number
function e4({x: [number,string,any] }) { } // x has type [any, any, any]
function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any]
function e6({x: [number, number, number]}) { } // error, duplicate identifier;
~~~~~~
!!! error TS2300: Duplicate identifier 'number'.
~~~~~~
!!! error TS2300: Duplicate identifier 'number'.
~~~~~~
!!! error TS2300: Duplicate identifier 'number'.
@@ -94,7 +94,7 @@ function e3({x}: { x?: number }) { } // x is an optional with type number
function e4({x: [number,string,any] }) { } // x has type [any, any, any]
function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any]
function e6({x: [number, number, number]}) { } // should be an error, duplicate identifier;
function e6({x: [number, number, number]}) { } // error, duplicate identifier;
@@ -166,4 +166,4 @@ function e2({ x }) { } // x is type number
function e3({ x }) { } // x is an optional with type number
function e4({ x: [number, string, any] }) { } // x has type [any, any, any]
function e5({ x: [a, b, c] }) { } // x has type [any, any, any]
function e6({ x: [number, number, number] }) { } // should be an error, duplicate identifier;
function e6({ x: [number, number, number] }) { } // error, duplicate identifier;
@@ -1,314 +0,0 @@
=== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts ===
// Conformance for emitting ES6
// A parameter declaration may specify either an identifier or a binding pattern.
// The identifiers specified in parameter declarations and binding patterns
// in a parameter list must be unique within that parameter list.
// If the declaration includes a type annotation, the parameter is of that type
function a1([a, b, [[c]]]: [number, number, string[][]]) { }
>a1 : Symbol(a1, Decl(destructuringParameterDeclaration1ES6.ts, 0, 0))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 7, 13))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 7, 15))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 7, 21))
function a2(o: { x: number, a: number }) { }
>a2 : Symbol(a2, Decl(destructuringParameterDeclaration1ES6.ts, 7, 60))
>o : Symbol(o, Decl(destructuringParameterDeclaration1ES6.ts, 8, 12))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 8, 16))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 8, 27))
function a3({j, k, l: {m, n}, q: [a, b, c]}: { j: number, k: string, l: { m: boolean, n: number }, q: (number|string)[] }) { };
>a3 : Symbol(a3, Decl(destructuringParameterDeclaration1ES6.ts, 8, 44))
>j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 9, 13))
>k : Symbol(k, Decl(destructuringParameterDeclaration1ES6.ts, 9, 15))
>m : Symbol(m, Decl(destructuringParameterDeclaration1ES6.ts, 9, 23))
>n : Symbol(n, Decl(destructuringParameterDeclaration1ES6.ts, 9, 25))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 9, 34))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 9, 36))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 9, 39))
>j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 9, 46))
>k : Symbol(k, Decl(destructuringParameterDeclaration1ES6.ts, 9, 57))
>l : Symbol(l, Decl(destructuringParameterDeclaration1ES6.ts, 9, 68))
>m : Symbol(m, Decl(destructuringParameterDeclaration1ES6.ts, 9, 73))
>n : Symbol(n, Decl(destructuringParameterDeclaration1ES6.ts, 9, 85))
>q : Symbol(q, Decl(destructuringParameterDeclaration1ES6.ts, 9, 98))
function a4({x, a}: { x: number, a: number }) { }
>a4 : Symbol(a4, Decl(destructuringParameterDeclaration1ES6.ts, 9, 127))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 10, 13))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 10, 15))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 10, 21))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 10, 32))
a1([1, 2, [["world"]]]);
>a1 : Symbol(a1, Decl(destructuringParameterDeclaration1ES6.ts, 0, 0))
a1([1, 2, [["world"]], 3]);
>a1 : Symbol(a1, Decl(destructuringParameterDeclaration1ES6.ts, 0, 0))
// If the declaration includes an initializer expression (which is permitted only
// when the parameter list occurs in conjunction with a function body),
// the parameter type is the widened form (section 3.11) of the type of the initializer expression.
function b1(z = [undefined, null]) { };
>b1 : Symbol(b1, Decl(destructuringParameterDeclaration1ES6.ts, 13, 27))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 20, 12))
>undefined : Symbol(undefined)
function b2(z = null, o = { x: 0, y: undefined }) { }
>b2 : Symbol(b2, Decl(destructuringParameterDeclaration1ES6.ts, 20, 39))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 21, 12))
>o : Symbol(o, Decl(destructuringParameterDeclaration1ES6.ts, 21, 21))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 21, 27))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 21, 33))
>undefined : Symbol(undefined)
function b3({z: {x, y: {j}}} = { z: { x: "hi", y: { j: 1 } } }) { }
>b3 : Symbol(b3, Decl(destructuringParameterDeclaration1ES6.ts, 21, 53))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 22, 17))
>j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 22, 24))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 22, 32))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 22, 37))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 22, 46))
>j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 22, 51))
interface F1 {
>F1 : Symbol(F1, Decl(destructuringParameterDeclaration1ES6.ts, 22, 67))
b5(z, y, [, a, b], {p, m: { q, r}});
>b5 : Symbol(b5, Decl(destructuringParameterDeclaration1ES6.ts, 24, 14))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 25, 7))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 25, 9))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 25, 15))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 25, 18))
>p : Symbol(p, Decl(destructuringParameterDeclaration1ES6.ts, 25, 24))
>q : Symbol(q, Decl(destructuringParameterDeclaration1ES6.ts, 25, 31))
>r : Symbol(r, Decl(destructuringParameterDeclaration1ES6.ts, 25, 34))
}
function b6([a, z, y] = [undefined, null, undefined]) { }
>b6 : Symbol(b6, Decl(destructuringParameterDeclaration1ES6.ts, 26, 1))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 28, 13))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 28, 15))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 28, 18))
>undefined : Symbol(undefined)
>undefined : Symbol(undefined)
function b7([[a], b, [[c, d]]] = [[undefined], undefined, [[undefined, undefined]]]) { }
>b7 : Symbol(b7, Decl(destructuringParameterDeclaration1ES6.ts, 28, 57))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 29, 14))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 29, 17))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 29, 23))
>d : Symbol(d, Decl(destructuringParameterDeclaration1ES6.ts, 29, 25))
>undefined : Symbol(undefined)
>undefined : Symbol(undefined)
>undefined : Symbol(undefined)
>undefined : Symbol(undefined)
b1([1, 2, 3]); // z is widen to the type any[]
>b1 : Symbol(b1, Decl(destructuringParameterDeclaration1ES6.ts, 13, 27))
b2("string", { x: 200, y: "string" });
>b2 : Symbol(b2, Decl(destructuringParameterDeclaration1ES6.ts, 20, 39))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 32, 14))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 32, 22))
b2("string", { x: 200, y: true });
>b2 : Symbol(b2, Decl(destructuringParameterDeclaration1ES6.ts, 20, 39))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 33, 14))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 33, 22))
// If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3)
enum Foo { a }
>Foo : Symbol(Foo, Decl(destructuringParameterDeclaration1ES6.ts, 33, 34))
>a : Symbol(Foo.a, Decl(destructuringParameterDeclaration1ES6.ts, 37, 10))
function c0({z: {x, y: {j}}}) { }
>c0 : Symbol(c0, Decl(destructuringParameterDeclaration1ES6.ts, 37, 14))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 38, 17))
>j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 38, 24))
function c1({z} = { z: 10 }) { }
>c1 : Symbol(c1, Decl(destructuringParameterDeclaration1ES6.ts, 38, 33))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 39, 13))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 39, 19))
function c2({z = 10}) { }
>c2 : Symbol(c2, Decl(destructuringParameterDeclaration1ES6.ts, 39, 32))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 40, 13))
function c3({b}: { b: number|string} = { b: "hello" }) { }
>c3 : Symbol(c3, Decl(destructuringParameterDeclaration1ES6.ts, 40, 25))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 41, 13))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 41, 18))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 41, 40))
function c5([a, b, [[c]]]) { }
>c5 : Symbol(c5, Decl(destructuringParameterDeclaration1ES6.ts, 41, 58))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 42, 13))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 42, 15))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 42, 21))
function c6([a, b, [[c=1]]]) { }
>c6 : Symbol(c6, Decl(destructuringParameterDeclaration1ES6.ts, 42, 30))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 43, 13))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 43, 15))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 43, 21))
c0({z : { x: 1, y: { j: "world" } }}); // Implied type is { z: {x: any, y: {j: any}} }
>c0 : Symbol(c0, Decl(destructuringParameterDeclaration1ES6.ts, 37, 14))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 45, 4))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 45, 9))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 45, 15))
>j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 45, 20))
c0({z : { x: "string", y: { j: true } }}); // Implied type is { z: {x: any, y: {j: any}} }
>c0 : Symbol(c0, Decl(destructuringParameterDeclaration1ES6.ts, 37, 14))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 46, 4))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 46, 9))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 46, 22))
>j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 46, 27))
c1(); // Implied type is {z:number}?
>c1 : Symbol(c1, Decl(destructuringParameterDeclaration1ES6.ts, 38, 33))
c1({ z: 1 }) // Implied type is {z:number}?
>c1 : Symbol(c1, Decl(destructuringParameterDeclaration1ES6.ts, 38, 33))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 49, 4))
c2({}); // Implied type is {z?: number}
>c2 : Symbol(c2, Decl(destructuringParameterDeclaration1ES6.ts, 39, 32))
c2({z:1}); // Implied type is {z?: number}
>c2 : Symbol(c2, Decl(destructuringParameterDeclaration1ES6.ts, 39, 32))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 52, 4))
c3({ b: 1 }); // Implied type is { b: number|string }.
>c3 : Symbol(c3, Decl(destructuringParameterDeclaration1ES6.ts, 40, 25))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 54, 4))
c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]]
>c5 : Symbol(c5, Decl(destructuringParameterDeclaration1ES6.ts, 41, 58))
c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]]
>c5 : Symbol(c5, Decl(destructuringParameterDeclaration1ES6.ts, 41, 58))
// A parameter can be marked optional by following its name or binding pattern with a question mark (?)
// or by including an initializer.
interface F2 {
>F2 : Symbol(F2, Decl(destructuringParameterDeclaration1ES6.ts, 57, 38))
d3([a, b, c]?);
>d3 : Symbol(d3, Decl(destructuringParameterDeclaration1ES6.ts, 63, 14))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 64, 8))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 64, 10))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 64, 13))
d4({x, y, z}?);
>d4 : Symbol(d4, Decl(destructuringParameterDeclaration1ES6.ts, 64, 19))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 65, 8))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 65, 10))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 65, 13))
e0([a, b, c]);
>e0 : Symbol(e0, Decl(destructuringParameterDeclaration1ES6.ts, 65, 19))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 66, 8))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 66, 10))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 66, 13))
}
class C2 implements F2 {
>C2 : Symbol(C2, Decl(destructuringParameterDeclaration1ES6.ts, 67, 1))
>F2 : Symbol(F2, Decl(destructuringParameterDeclaration1ES6.ts, 57, 38))
constructor() { }
d3() { }
>d3 : Symbol(d3, Decl(destructuringParameterDeclaration1ES6.ts, 70, 21))
d4() { }
>d4 : Symbol(d4, Decl(destructuringParameterDeclaration1ES6.ts, 71, 12))
e0([a, b, c]) { }
>e0 : Symbol(e0, Decl(destructuringParameterDeclaration1ES6.ts, 72, 12))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 73, 8))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 73, 10))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 73, 13))
}
class C3 implements F2 {
>C3 : Symbol(C3, Decl(destructuringParameterDeclaration1ES6.ts, 74, 1))
>F2 : Symbol(F2, Decl(destructuringParameterDeclaration1ES6.ts, 57, 38))
d3([a, b, c]) { }
>d3 : Symbol(d3, Decl(destructuringParameterDeclaration1ES6.ts, 76, 24))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 77, 8))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 77, 10))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 77, 13))
d4({x, y, z}) { }
>d4 : Symbol(d4, Decl(destructuringParameterDeclaration1ES6.ts, 77, 21))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 78, 8))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 78, 10))
>z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 78, 13))
e0([a, b, c]) { }
>e0 : Symbol(e0, Decl(destructuringParameterDeclaration1ES6.ts, 78, 21))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 79, 8))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 79, 10))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 79, 13))
}
function d5({x, y} = { x: 1, y: 2 }) { }
>d5 : Symbol(d5, Decl(destructuringParameterDeclaration1ES6.ts, 80, 1))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 82, 13))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 82, 15))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 82, 22))
>y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 82, 28))
d5(); // Parameter is optional as its declaration included an initializer
>d5 : Symbol(d5, Decl(destructuringParameterDeclaration1ES6.ts, 80, 1))
// Destructuring parameter declarations do not permit type annotations on the individual binding patterns,
// as such annotations would conflict with the already established meaning of colons in object literals.
// Type annotations must instead be written on the top- level parameter declaration
function e1({x: number}) { } // x has type any NOT number
>e1 : Symbol(e1, Decl(destructuringParameterDeclaration1ES6.ts, 83, 5))
>number : Symbol(number, Decl(destructuringParameterDeclaration1ES6.ts, 89, 13))
function e2({x}: { x: number }) { } // x is type number
>e2 : Symbol(e2, Decl(destructuringParameterDeclaration1ES6.ts, 89, 28))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 90, 13))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 90, 18))
function e3({x}: { x?: number }) { } // x is an optional with type number
>e3 : Symbol(e3, Decl(destructuringParameterDeclaration1ES6.ts, 90, 35))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 91, 13))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 91, 18))
function e4({x: [number,string,any] }) { } // x has type [any, any, any]
>e4 : Symbol(e4, Decl(destructuringParameterDeclaration1ES6.ts, 91, 36))
>number : Symbol(number, Decl(destructuringParameterDeclaration1ES6.ts, 92, 17))
>string : Symbol(string, Decl(destructuringParameterDeclaration1ES6.ts, 92, 24))
>any : Symbol(any, Decl(destructuringParameterDeclaration1ES6.ts, 92, 31))
function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any]
>e5 : Symbol(e5, Decl(destructuringParameterDeclaration1ES6.ts, 92, 42))
>a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 93, 17))
>b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 93, 19))
>c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 93, 22))
>x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 93, 29))
function e6({x: [number, number, number]}) { } // should be an error, duplicate identifier;
>e6 : Symbol(e6, Decl(destructuringParameterDeclaration1ES6.ts, 93, 64))
>number : Symbol(number, Decl(destructuringParameterDeclaration1ES6.ts, 95, 17), Decl(destructuringParameterDeclaration1ES6.ts, 95, 24), Decl(destructuringParameterDeclaration1ES6.ts, 95, 32))
>number : Symbol(number, Decl(destructuringParameterDeclaration1ES6.ts, 95, 17), Decl(destructuringParameterDeclaration1ES6.ts, 95, 24), Decl(destructuringParameterDeclaration1ES6.ts, 95, 32))
>number : Symbol(number, Decl(destructuringParameterDeclaration1ES6.ts, 95, 17), Decl(destructuringParameterDeclaration1ES6.ts, 95, 24), Decl(destructuringParameterDeclaration1ES6.ts, 95, 32))
@@ -1,422 +0,0 @@
=== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts ===
// Conformance for emitting ES6
// A parameter declaration may specify either an identifier or a binding pattern.
// The identifiers specified in parameter declarations and binding patterns
// in a parameter list must be unique within that parameter list.
// If the declaration includes a type annotation, the parameter is of that type
function a1([a, b, [[c]]]: [number, number, string[][]]) { }
>a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void
>a : number
>b : number
>c : string
function a2(o: { x: number, a: number }) { }
>a2 : (o: { x: number; a: number; }) => void
>o : { x: number; a: number; }
>x : number
>a : number
function a3({j, k, l: {m, n}, q: [a, b, c]}: { j: number, k: string, l: { m: boolean, n: number }, q: (number|string)[] }) { };
>a3 : ({j, k, l: {m, n}, q: [a, b, c]}: { j: number; k: string; l: { m: boolean; n: number; }; q: (string | number)[]; }) => void
>j : number
>k : string
>l : any
>m : boolean
>n : number
>q : any
>a : string | number
>b : string | number
>c : string | number
>j : number
>k : string
>l : { m: boolean; n: number; }
>m : boolean
>n : number
>q : (string | number)[]
function a4({x, a}: { x: number, a: number }) { }
>a4 : ({x, a}: { x: number; a: number; }) => void
>x : number
>a : number
>x : number
>a : number
a1([1, 2, [["world"]]]);
>a1([1, 2, [["world"]]]) : void
>a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void
>[1, 2, [["world"]]] : [number, number, string[][]]
>1 : number
>2 : number
>[["world"]] : string[][]
>["world"] : string[]
>"world" : string
a1([1, 2, [["world"]], 3]);
>a1([1, 2, [["world"]], 3]) : void
>a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void
>[1, 2, [["world"]], 3] : [number, number, string[][], number]
>1 : number
>2 : number
>[["world"]] : string[][]
>["world"] : string[]
>"world" : string
>3 : number
// If the declaration includes an initializer expression (which is permitted only
// when the parameter list occurs in conjunction with a function body),
// the parameter type is the widened form (section 3.11) of the type of the initializer expression.
function b1(z = [undefined, null]) { };
>b1 : (z?: any[]) => void
>z : any[]
>[undefined, null] : null[]
>undefined : undefined
>null : null
function b2(z = null, o = { x: 0, y: undefined }) { }
>b2 : (z?: any, o?: { x: number; y: any; }) => void
>z : any
>null : null
>o : { x: number; y: any; }
>{ x: 0, y: undefined } : { x: number; y: undefined; }
>x : number
>0 : number
>y : undefined
>undefined : undefined
function b3({z: {x, y: {j}}} = { z: { x: "hi", y: { j: 1 } } }) { }
>b3 : ({z: {x, y: {j}}}?: { z: { x: string; y: { j: number; }; }; }) => void
>z : any
>x : string
>y : any
>j : number
>{ z: { x: "hi", y: { j: 1 } } } : { z: { x: string; y: { j: number; }; }; }
>z : { x: string; y: { j: number; }; }
>{ x: "hi", y: { j: 1 } } : { x: string; y: { j: number; }; }
>x : string
>"hi" : string
>y : { j: number; }
>{ j: 1 } : { j: number; }
>j : number
>1 : number
interface F1 {
>F1 : F1
b5(z, y, [, a, b], {p, m: { q, r}});
>b5 : (z: any, y: any, [, a, b]: [any, any, any], {p, m: { q, r}}: { p: any; m: { q: any; r: any; }; }) => any
>z : any
>y : any
> : undefined
>a : any
>b : any
>p : any
>m : any
>q : any
>r : any
}
function b6([a, z, y] = [undefined, null, undefined]) { }
>b6 : ([a, z, y]?: [undefined, null, undefined]) => void
>a : any
>z : any
>y : any
>[undefined, null, undefined] : [undefined, null, undefined]
>undefined : undefined
>null : null
>undefined : undefined
function b7([[a], b, [[c, d]]] = [[undefined], undefined, [[undefined, undefined]]]) { }
>b7 : ([[a], b, [[c, d]]]?: [[undefined], undefined, [[undefined, undefined]]]) => void
>a : any
>b : any
>c : any
>d : any
>[[undefined], undefined, [[undefined, undefined]]] : [[undefined], undefined, [[undefined, undefined]]]
>[undefined] : [undefined]
>undefined : undefined
>undefined : undefined
>[[undefined, undefined]] : [[undefined, undefined]]
>[undefined, undefined] : [undefined, undefined]
>undefined : undefined
>undefined : undefined
b1([1, 2, 3]); // z is widen to the type any[]
>b1([1, 2, 3]) : void
>b1 : (z?: any[]) => void
>[1, 2, 3] : number[]
>1 : number
>2 : number
>3 : number
b2("string", { x: 200, y: "string" });
>b2("string", { x: 200, y: "string" }) : void
>b2 : (z?: any, o?: { x: number; y: any; }) => void
>"string" : string
>{ x: 200, y: "string" } : { x: number; y: string; }
>x : number
>200 : number
>y : string
>"string" : string
b2("string", { x: 200, y: true });
>b2("string", { x: 200, y: true }) : void
>b2 : (z?: any, o?: { x: number; y: any; }) => void
>"string" : string
>{ x: 200, y: true } : { x: number; y: boolean; }
>x : number
>200 : number
>y : boolean
>true : boolean
// If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3)
enum Foo { a }
>Foo : Foo
>a : Foo
function c0({z: {x, y: {j}}}) { }
>c0 : ({z: {x, y: {j}}}: { z: { x: any; y: { j: any; }; }; }) => void
>z : any
>x : any
>y : any
>j : any
function c1({z} = { z: 10 }) { }
>c1 : ({z}?: { z: number; }) => void
>z : number
>{ z: 10 } : { z: number; }
>z : number
>10 : number
function c2({z = 10}) { }
>c2 : ({z = 10}: { z?: number; }) => void
>z : number
>10 : number
function c3({b}: { b: number|string} = { b: "hello" }) { }
>c3 : ({b}?: { b: string | number; }) => void
>b : string | number
>b : string | number
>{ b: "hello" } : { b: string; }
>b : string
>"hello" : string
function c5([a, b, [[c]]]) { }
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
>a : any
>b : any
>c : any
function c6([a, b, [[c=1]]]) { }
>c6 : ([a, b, [[c=1]]]: [any, any, [[number]]]) => void
>a : any
>b : any
>c : number
>1 : number
c0({z : { x: 1, y: { j: "world" } }}); // Implied type is { z: {x: any, y: {j: any}} }
>c0({z : { x: 1, y: { j: "world" } }}) : void
>c0 : ({z: {x, y: {j}}}: { z: { x: any; y: { j: any; }; }; }) => void
>{z : { x: 1, y: { j: "world" } }} : { z: { x: number; y: { j: string; }; }; }
>z : { x: number; y: { j: string; }; }
>{ x: 1, y: { j: "world" } } : { x: number; y: { j: string; }; }
>x : number
>1 : number
>y : { j: string; }
>{ j: "world" } : { j: string; }
>j : string
>"world" : string
c0({z : { x: "string", y: { j: true } }}); // Implied type is { z: {x: any, y: {j: any}} }
>c0({z : { x: "string", y: { j: true } }}) : void
>c0 : ({z: {x, y: {j}}}: { z: { x: any; y: { j: any; }; }; }) => void
>{z : { x: "string", y: { j: true } }} : { z: { x: string; y: { j: boolean; }; }; }
>z : { x: string; y: { j: boolean; }; }
>{ x: "string", y: { j: true } } : { x: string; y: { j: boolean; }; }
>x : string
>"string" : string
>y : { j: boolean; }
>{ j: true } : { j: boolean; }
>j : boolean
>true : boolean
c1(); // Implied type is {z:number}?
>c1() : void
>c1 : ({z}?: { z: number; }) => void
c1({ z: 1 }) // Implied type is {z:number}?
>c1({ z: 1 }) : void
>c1 : ({z}?: { z: number; }) => void
>{ z: 1 } : { z: number; }
>z : number
>1 : number
c2({}); // Implied type is {z?: number}
>c2({}) : void
>c2 : ({z = 10}: { z?: number; }) => void
>{} : {}
c2({z:1}); // Implied type is {z?: number}
>c2({z:1}) : void
>c2 : ({z = 10}: { z?: number; }) => void
>{z:1} : { z: number; }
>z : number
>1 : number
c3({ b: 1 }); // Implied type is { b: number|string }.
>c3({ b: 1 }) : void
>c3 : ({b}?: { b: string | number; }) => void
>{ b: 1 } : { b: number; }
>b : number
>1 : number
c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]]
>c5([1, 2, [["string"]]]) : void
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
>[1, 2, [["string"]]] : [number, number, [[string]]]
>1 : number
>2 : number
>[["string"]] : [[string]]
>["string"] : [string]
>"string" : string
c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]]
>c5([1, 2, [["string"]], false, true]) : void
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
>1 : number
>2 : number
>[["string"]] : [[string]]
>["string"] : [string]
>"string" : string
>false : boolean
>true : boolean
// A parameter can be marked optional by following its name or binding pattern with a question mark (?)
// or by including an initializer.
interface F2 {
>F2 : F2
d3([a, b, c]?);
>d3 : ([a, b, c]?: [any, any, any]) => any
>a : any
>b : any
>c : any
d4({x, y, z}?);
>d4 : ({x, y, z}?: { x: any; y: any; z: any; }) => any
>x : any
>y : any
>z : any
e0([a, b, c]);
>e0 : ([a, b, c]: [any, any, any]) => any
>a : any
>b : any
>c : any
}
class C2 implements F2 {
>C2 : C2
>F2 : F2
constructor() { }
d3() { }
>d3 : () => void
d4() { }
>d4 : () => void
e0([a, b, c]) { }
>e0 : ([a, b, c]: [any, any, any]) => void
>a : any
>b : any
>c : any
}
class C3 implements F2 {
>C3 : C3
>F2 : F2
d3([a, b, c]) { }
>d3 : ([a, b, c]: [any, any, any]) => void
>a : any
>b : any
>c : any
d4({x, y, z}) { }
>d4 : ({x, y, z}: { x: any; y: any; z: any; }) => void
>x : any
>y : any
>z : any
e0([a, b, c]) { }
>e0 : ([a, b, c]: [any, any, any]) => void
>a : any
>b : any
>c : any
}
function d5({x, y} = { x: 1, y: 2 }) { }
>d5 : ({x, y}?: { x: number; y: number; }) => void
>x : number
>y : number
>{ x: 1, y: 2 } : { x: number; y: number; }
>x : number
>1 : number
>y : number
>2 : number
d5(); // Parameter is optional as its declaration included an initializer
>d5() : void
>d5 : ({x, y}?: { x: number; y: number; }) => void
// Destructuring parameter declarations do not permit type annotations on the individual binding patterns,
// as such annotations would conflict with the already established meaning of colons in object literals.
// Type annotations must instead be written on the top- level parameter declaration
function e1({x: number}) { } // x has type any NOT number
>e1 : ({x: number}: { x: any; }) => void
>x : any
>number : any
function e2({x}: { x: number }) { } // x is type number
>e2 : ({x}: { x: number; }) => void
>x : number
>x : number
function e3({x}: { x?: number }) { } // x is an optional with type number
>e3 : ({x}: { x?: number; }) => void
>x : number
>x : number
function e4({x: [number,string,any] }) { } // x has type [any, any, any]
>e4 : ({x: [number,string,any] }: { x: [any, any, any]; }) => void
>x : any
>number : any
>string : any
>any : any
function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any]
>e5 : ({x: [a, b, c]}: { x: [number, number, number]; }) => void
>x : any
>a : number
>b : number
>c : number
>x : [number, number, number]
function e6({x: [number, number, number]}) { } // should be an error, duplicate identifier;
>e6 : ({x: [number, number, number]}: { x: [any, any, any]; }) => void
>x : any
>number : any
>number : any
>number : any
@@ -50,9 +50,12 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
Type '{ x: any; y: any; c: any; }' is not assignable to type '{ x: any; y: any; z: any; }'.
Property 'z' is missing in type '{ x: any; y: any; c: any; }'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(56,8): error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,18): error TS2300: Duplicate identifier 'number'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,26): error TS2300: Duplicate identifier 'number'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,34): error TS2300: Duplicate identifier 'number'.
==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts (19 errors) ====
==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts (22 errors) ====
// A parameter declaration may specify either an identifier or a binding pattern.
// The identifiers specified in parameter declarations and binding patterns
// in a parameter list must be unique within that parameter list.
@@ -188,7 +191,13 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
// as such annotations would conflict with the already established meaning of colons in object literals.
// Type annotations must instead be written on the top- level parameter declaration
function e0({x: [number, number, number]}) { } // should be an error, duplicate identifier;
function e0({x: [number, number, number]}) { } // error, duplicate identifier;
~~~~~~
!!! error TS2300: Duplicate identifier 'number'.
~~~~~~
!!! error TS2300: Duplicate identifier 'number'.
~~~~~~
!!! error TS2300: Duplicate identifier 'number'.
@@ -63,7 +63,7 @@ class C4 implements F2 {
// as such annotations would conflict with the already established meaning of colons in object literals.
// Type annotations must instead be written on the top- level parameter declaration
function e0({x: [number, number, number]}) { } // should be an error, duplicate identifier;
function e0({x: [number, number, number]}) { } // error, duplicate identifier;
@@ -146,4 +146,4 @@ var C4 = (function () {
// Type annotations must instead be written on the top- level parameter declaration
function e0(_a) {
var _b = _a.x, number = _b[0], number = _b[1], number = _b[2];
} // should be an error, duplicate identifier;
} // error, duplicate identifier;
@@ -0,0 +1,75 @@
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(2,13): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(2,17): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(2,21): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(2,27): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(3,14): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(3,17): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(4,14): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(4,19): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(5,14): error TS2300: Duplicate identifier 'c'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(5,17): error TS2300: Duplicate identifier 'c'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(5,22): error TS2300: Duplicate identifier 'c'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(6,14): error TS2300: Duplicate identifier 'd'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(6,20): error TS2300: Duplicate identifier 'd'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,14): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,21): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,27): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,34): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,39): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,48): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(8,14): error TS2300: Duplicate identifier 'f'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(8,20): error TS2300: Duplicate identifier 'f'.
==== tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts (21 errors) ====
function f0(a, [a, [b]], {b}) { }
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'b'.
~
!!! error TS2300: Duplicate identifier 'b'.
function f1([a, a]) { }
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
function f2({b}, {b}) { }
~
!!! error TS2300: Duplicate identifier 'b'.
~
!!! error TS2300: Duplicate identifier 'b'.
function f3([c,[c],[[c]]]) { }
~
!!! error TS2300: Duplicate identifier 'c'.
~
!!! error TS2300: Duplicate identifier 'c'.
~
!!! error TS2300: Duplicate identifier 'c'.
function f4({d, d:{d}}) { }
~
!!! error TS2300: Duplicate identifier 'd'.
~
!!! error TS2300: Duplicate identifier 'd'.
function f5({e, e: {e}}, {e}, [d,e, [[e]]], ...e) { }
~
!!! error TS2300: Duplicate identifier 'e'.
~
!!! error TS2300: Duplicate identifier 'e'.
~
!!! error TS2300: Duplicate identifier 'e'.
~
!!! error TS2300: Duplicate identifier 'e'.
~
!!! error TS2300: Duplicate identifier 'e'.
~
!!! error TS2300: Duplicate identifier 'e'.
function f6([f, ...f]) { }
~
!!! error TS2300: Duplicate identifier 'f'.
~
!!! error TS2300: Duplicate identifier 'f'.
function f7(a, func = (a) => { return 1 }) { } // not error
@@ -0,0 +1,44 @@
//// [duplicateIdentifierBindingElementInParameterDeclaration1.ts]
function f0(a, [a, [b]], {b}) { }
function f1([a, a]) { }
function f2({b}, {b}) { }
function f3([c,[c],[[c]]]) { }
function f4({d, d:{d}}) { }
function f5({e, e: {e}}, {e}, [d,e, [[e]]], ...e) { }
function f6([f, ...f]) { }
function f7(a, func = (a) => { return 1 }) { } // not error
//// [duplicateIdentifierBindingElementInParameterDeclaration1.js]
function f0(a, _a, _b) {
var a = _a[0], b = _a[1][0];
var b = _b.b;
}
function f1(_a) {
var a = _a[0], a = _a[1];
}
function f2(_a, _b) {
var b = _a.b;
var b = _b.b;
}
function f3(_a) {
var c = _a[0], c = _a[1][0], c = _a[2][0][0];
}
function f4(_a) {
var d = _a.d, d = _a.d.d;
}
function f5(_a, _b, _c) {
var e = _a.e, e = _a.e.e;
var e = _b.e;
var d = _c[0], e = _c[1], e = _c[2][0][0];
var e = [];
for (var _i = 3; _i < arguments.length; _i++) {
e[_i - 3] = arguments[_i];
}
}
function f6(_a) {
var f = _a[0], f = _a.slice(1);
}
function f7(a, func) {
if (func === void 0) { func = function (a) { return 1; }; }
} // not error
@@ -0,0 +1,76 @@
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(3,13): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(3,17): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(3,21): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(3,27): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(4,14): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(4,17): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(5,14): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(5,19): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(6,14): error TS2300: Duplicate identifier 'c'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(6,18): error TS2300: Duplicate identifier 'c'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(6,24): error TS2300: Duplicate identifier 'c'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(7,14): error TS2300: Duplicate identifier 'd'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(7,21): error TS2300: Duplicate identifier 'd'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,14): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,21): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,27): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,35): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,40): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,49): error TS2300: Duplicate identifier 'e'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(9,14): error TS2300: Duplicate identifier 'f'.
tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(9,20): error TS2300: Duplicate identifier 'f'.
==== tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts (21 errors) ====
"use strict"
function f0(a, [a, [b]], {b}) { }
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'b'.
~
!!! error TS2300: Duplicate identifier 'b'.
function f1([a, a]) { }
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
function f2({b}, {b}) { }
~
!!! error TS2300: Duplicate identifier 'b'.
~
!!! error TS2300: Duplicate identifier 'b'.
function f3([c, [c], [[c]]]) { }
~
!!! error TS2300: Duplicate identifier 'c'.
~
!!! error TS2300: Duplicate identifier 'c'.
~
!!! error TS2300: Duplicate identifier 'c'.
function f4({d, d: {d}}) { }
~
!!! error TS2300: Duplicate identifier 'd'.
~
!!! error TS2300: Duplicate identifier 'd'.
function f5({e, e: {e}}, {e}, [d, e, [[e]]], ...e) { }
~
!!! error TS2300: Duplicate identifier 'e'.
~
!!! error TS2300: Duplicate identifier 'e'.
~
!!! error TS2300: Duplicate identifier 'e'.
~
!!! error TS2300: Duplicate identifier 'e'.
~
!!! error TS2300: Duplicate identifier 'e'.
~
!!! error TS2300: Duplicate identifier 'e'.
function f6([f, ...f]) { }
~
!!! error TS2300: Duplicate identifier 'f'.
~
!!! error TS2300: Duplicate identifier 'f'.
function f7(a, func = (a) => { return 1 }){ } // not error
@@ -0,0 +1,46 @@
//// [duplicateIdentifierBindingElementInParameterDeclaration2.ts]
"use strict"
function f0(a, [a, [b]], {b}) { }
function f1([a, a]) { }
function f2({b}, {b}) { }
function f3([c, [c], [[c]]]) { }
function f4({d, d: {d}}) { }
function f5({e, e: {e}}, {e}, [d, e, [[e]]], ...e) { }
function f6([f, ...f]) { }
function f7(a, func = (a) => { return 1 }){ } // not error
//// [duplicateIdentifierBindingElementInParameterDeclaration2.js]
"use strict";
function f0(a, _a, _b) {
var a = _a[0], b = _a[1][0];
var b = _b.b;
}
function f1(_a) {
var a = _a[0], a = _a[1];
}
function f2(_a, _b) {
var b = _a.b;
var b = _b.b;
}
function f3(_a) {
var c = _a[0], c = _a[1][0], c = _a[2][0][0];
}
function f4(_a) {
var d = _a.d, d = _a.d.d;
}
function f5(_a, _b, _c) {
var e = _a.e, e = _a.e.e;
var e = _b.e;
var d = _c[0], e = _c[1], e = _c[2][0][0];
var e = [];
for (var _i = 3; _i < arguments.length; _i++) {
e[_i - 3] = arguments[_i];
}
}
function f6(_a) {
var f = _a[0], f = _a.slice(1);
}
function f7(a, func) {
if (func === void 0) { func = function (a) { return 1; }; }
} // not error
@@ -2,6 +2,6 @@
//// [emptyFile-declaration.js]
//# sourceMappingURL=emptyFile-declaration.js.map
//// [emptyFile-declaration.d.ts]
@@ -1,2 +0,0 @@
//// [emptyFile-declaration.js.map]
{"version":3,"file":"emptyFile-declaration.js","sourceRoot":"","sources":["emptyFile-declaration.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
===================================================================
JsFile: emptyFile-declaration.js
mapUrl: emptyFile-declaration.js.map
sourceRoot:
sources: emptyFile-declaration.ts
===================================================================
>>>//# sourceMappingURL=emptyFile-declaration.js.map
@@ -2,6 +2,4 @@
//// [emptyFile-souremap.js]
//# sourceMappingURL=emptyFile-souremap.js.map
//// [emptyFile-souremap.d.ts]
//# sourceMappingURL=emptyFile-souremap.js.map
-7
View File
@@ -22,10 +22,3 @@ var A = (function () {
};
return A;
})();
//# sourceMappingURL=es3-amd.js.map
//// [es3-amd.d.ts]
declare class A {
constructor();
B(): number;
}
-2
View File
@@ -1,2 +0,0 @@
//// [es3-amd.js.map]
{"version":3,"file":"es3-amd.js","sourceRoot":"","sources":["es3-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
@@ -1,115 +0,0 @@
===================================================================
JsFile: es3-amd.js
mapUrl: es3-amd.js.map
sourceRoot:
sources: es3-amd.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es3-amd.js
sourceFile:es3-amd.ts
-------------------------------------------------------------------
>>>var A = (function () {
1 >
2 >^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
---
>>>})();
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=es3-amd.js.map
@@ -22,7 +22,7 @@ var A = (function () {
};
return A;
})();
//# sourceMappingURL=es3-declaration-amd.js.map
//// [es3-declaration-amd.d.ts]
declare class A {
@@ -1,2 +0,0 @@
//// [es3-declaration-amd.js.map]
{"version":3,"file":"es3-declaration-amd.js","sourceRoot":"","sources":["es3-declaration-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
@@ -1,115 +0,0 @@
===================================================================
JsFile: es3-declaration-amd.js
mapUrl: es3-declaration-amd.js.map
sourceRoot:
sources: es3-declaration-amd.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es3-declaration-amd.js
sourceFile:es3-declaration-amd.ts
-------------------------------------------------------------------
>>>var A = (function () {
1 >
2 >^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
---
>>>})();
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=es3-declaration-amd.js.map
-7
View File
@@ -22,10 +22,3 @@ var A = (function () {
};
return A;
})();
//# sourceMappingURL=es5-amd.js.map
//// [es5-amd.d.ts]
declare class A {
constructor();
B(): number;
}
-2
View File
@@ -1,2 +0,0 @@
//// [es5-amd.js.map]
{"version":3,"file":"es5-amd.js","sourceRoot":"","sources":["es5-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
@@ -1,115 +0,0 @@
===================================================================
JsFile: es5-amd.js
mapUrl: es5-amd.js.map
sourceRoot:
sources: es5-amd.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es5-amd.js
sourceFile:es5-amd.ts
-------------------------------------------------------------------
>>>var A = (function () {
1 >
2 >^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
---
>>>})();
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=es5-amd.js.map
@@ -22,7 +22,7 @@ var A = (function () {
};
return A;
})();
//# sourceMappingURL=es5-declaration-amd.js.map
//// [es5-declaration-amd.d.ts]
declare class A {
@@ -1,2 +0,0 @@
//// [es5-declaration-amd.js.map]
{"version":3,"file":"es5-declaration-amd.js","sourceRoot":"","sources":["es5-declaration-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
@@ -1,115 +0,0 @@
===================================================================
JsFile: es5-declaration-amd.js
mapUrl: es5-declaration-amd.js.map
sourceRoot:
sources: es5-declaration-amd.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es5-declaration-amd.js
sourceFile:es5-declaration-amd.ts
-------------------------------------------------------------------
>>>var A = (function () {
1 >
2 >^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
---
>>>})();
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=es5-declaration-amd.js.map
-7
View File
@@ -23,10 +23,3 @@ var A = (function () {
};
return A;
})();
//# sourceMappingURL=es5-umd.js.map
//// [es5-umd.d.ts]
declare class A {
constructor();
B(): number;
}
-2
View File
@@ -1,2 +0,0 @@
//// [es5-umd.js.map]
{"version":3,"file":"es5-umd.js","sourceRoot":"","sources":["es5-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
@@ -1,115 +0,0 @@
===================================================================
JsFile: es5-umd.js
mapUrl: es5-umd.js.map
sourceRoot:
sources: es5-umd.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es5-umd.js
sourceFile:es5-umd.ts
-------------------------------------------------------------------
>>>var A = (function () {
1 >
2 >^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
---
>>>})();
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=es5-umd.js.map
-7
View File
@@ -33,10 +33,3 @@ export class A
})();
exports.A = A;
});
//# sourceMappingURL=es5-umd2.js.map
//// [es5-umd2.d.ts]
export declare class A {
constructor();
B(): number;
}
@@ -1,2 +0,0 @@
//// [es5-umd2.js.map]
{"version":3,"file":"es5-umd2.js","sourceRoot":"","sources":["es5-umd2.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAXY,SAAC,IAWb,CAAA"}
@@ -1,149 +0,0 @@
===================================================================
JsFile: es5-umd2.js
mapUrl: es5-umd2.js.map
sourceRoot:
sources: es5-umd2.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es5-umd2.js
sourceFile:es5-umd2.ts
-------------------------------------------------------------------
>>>(function (deps, factory) {
>>> if (typeof module === 'object' && typeof module.exports === 'object') {
>>> var v = factory(require, exports); if (v !== undefined) module.exports = v;
>>> }
>>> else if (typeof define === 'function' && define.amd) {
>>> define(deps, factory);
>>> }
>>>})(["require", "exports"], function (require, exports) {
>>> var A = (function () {
1 >^^^^
2 > ^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^^^^^
2 > ^^->
1->export class A
>{
>
1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A)
---
>>> })();
1 >^^^^
2 > ^
3 >
4 > ^^^^
5 > ^^^^^^^^^^->
1 >
2 > }
3 >
4 > export class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0)
4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0)
---
>>> exports.A = A;
1->^^^^
2 > ^^^^^^^^^
3 > ^^^^
4 > ^
1->
2 > A
3 >
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
4 >
1->Emitted(17, 5) Source(2, 14) + SourceIndex(0)
2 >Emitted(17, 14) Source(2, 15) + SourceIndex(0)
3 >Emitted(17, 18) Source(13, 2) + SourceIndex(0)
4 >Emitted(17, 19) Source(13, 2) + SourceIndex(0)
---
>>>});
>>>//# sourceMappingURL=es5-umd2.js.map
-7
View File
@@ -33,10 +33,3 @@ export default class A
})();
exports.default = A;
});
//# sourceMappingURL=es5-umd3.js.map
//// [es5-umd3.d.ts]
export default class A {
constructor();
B(): number;
}
@@ -1,2 +0,0 @@
//// [es5-umd3.js.map]
{"version":3,"file":"es5-umd3.js","sourceRoot":"","sources":["es5-umd3.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAXD,mBAWC,CAAA"}
@@ -1,146 +0,0 @@
===================================================================
JsFile: es5-umd3.js
mapUrl: es5-umd3.js.map
sourceRoot:
sources: es5-umd3.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es5-umd3.js
sourceFile:es5-umd3.ts
-------------------------------------------------------------------
>>>(function (deps, factory) {
>>> if (typeof module === 'object' && typeof module.exports === 'object') {
>>> var v = factory(require, exports); if (v !== undefined) module.exports = v;
>>> }
>>> else if (typeof define === 'function' && define.amd) {
>>> define(deps, factory);
>>> }
>>>})(["require", "exports"], function (require, exports) {
>>> var A = (function () {
1 >^^^^
2 > ^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^^^^^
2 > ^^->
1->export default class A
>{
>
1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A)
---
>>> })();
1 >^^^^
2 > ^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^->
1 >
2 > }
3 >
4 > export default class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0)
4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0)
---
>>> exports.default = A;
1->^^^^
2 > ^^^^^^^^^^^^^^^^^^^
3 > ^
1->
2 > export default class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
3 >
1->Emitted(17, 5) Source(2, 1) + SourceIndex(0)
2 >Emitted(17, 24) Source(13, 2) + SourceIndex(0)
3 >Emitted(17, 25) Source(13, 2) + SourceIndex(0)
---
>>>});
>>>//# sourceMappingURL=es5-umd3.js.map
-8
View File
@@ -35,11 +35,3 @@ export = A;
})();
return A;
});
//# sourceMappingURL=es5-umd4.js.map
//// [es5-umd4.d.ts]
declare class A {
constructor();
B(): number;
}
export = A;
@@ -1,2 +0,0 @@
//// [es5-umd4.js.map]
{"version":3,"file":"es5-umd4.js","sourceRoot":"","sources":["es5-umd4.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAEU,AAAX,OAAS,CAAC,CAAC"}
@@ -1,143 +0,0 @@
===================================================================
JsFile: es5-umd4.js
mapUrl: es5-umd4.js.map
sourceRoot:
sources: es5-umd4.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es5-umd4.js
sourceFile:es5-umd4.ts
-------------------------------------------------------------------
>>>(function (deps, factory) {
>>> if (typeof module === 'object' && typeof module.exports === 'object') {
>>> var v = factory(require, exports); if (v !== undefined) module.exports = v;
>>> }
>>> else if (typeof define === 'function' && define.amd) {
>>> define(deps, factory);
>>> }
>>>})(["require", "exports"], function (require, exports) {
>>> var A = (function () {
1 >^^^^
2 > ^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0)
---
>>> function A() {
1->^^^^^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> A.prototype.B = function () {
1->^^^^^^^^
2 > ^^^^^^^^^^^^^
3 > ^^^
1->
>
> public
2 > B
3 >
1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A)
3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A)
---
>>> return 42;
1 >^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1 >public B()
> {
>
2 > return
3 >
4 > 42
5 > ;
1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> };
1 >^^^^^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>> return A;
1->^^^^^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A)
---
>>> })();
1 >^^^^
2 > ^
3 >
4 > ^^^^
5 > ^^^^^->
1 >
2 > }
3 >
4 > class A
> {
> constructor ()
> {
>
> }
>
> public B()
> {
> return 42;
> }
> }
1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A)
3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0)
4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0)
---
>>> return A;
1->^^^^
2 >
3 > ^^^^^^^
4 > ^
5 > ^
1->
>
>export = A;
2 >
3 > export =
4 > A
5 > ;
1->Emitted(17, 5) Source(15, 12) + SourceIndex(0)
2 >Emitted(17, 5) Source(15, 1) + SourceIndex(0)
3 >Emitted(17, 12) Source(15, 10) + SourceIndex(0)
4 >Emitted(17, 13) Source(15, 11) + SourceIndex(0)
5 >Emitted(17, 14) Source(15, 12) + SourceIndex(0)
---
>>>});
>>>//# sourceMappingURL=es5-umd4.js.map
-7
View File
@@ -21,10 +21,3 @@ class A {
return 42;
}
}
//# sourceMappingURL=es6-amd.js.map
//// [es6-amd.d.ts]
declare class A {
constructor();
B(): number;
}
-2
View File
@@ -1,2 +0,0 @@
//// [es6-amd.js.map]
{"version":3,"file":"es6-amd.js","sourceRoot":"","sources":["es6-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"}
@@ -1,91 +0,0 @@
===================================================================
JsFile: es6-amd.js
mapUrl: es6-amd.js.map
sourceRoot:
sources: es6-amd.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es6-amd.js
sourceFile:es6-amd.ts
-------------------------------------------------------------------
>>>class A {
1 >
2 >^^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> constructor() {
1->^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> B() {
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^->
1->
>
> public
2 > B
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A)
---
>>> return 42;
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1->()
> {
>
2 > return
3 >
4 > 42
5 > ;
1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> }
1 >^^^^
2 > ^
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A)
---
>>>//# sourceMappingURL=es6-amd.js.map1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->
1->Emitted(8, 1) Source(13, 2) + SourceIndex(0)
---
@@ -21,7 +21,7 @@ class A {
return 42;
}
}
//# sourceMappingURL=es6-declaration-amd.js.map
//// [es6-declaration-amd.d.ts]
declare class A {
@@ -1,2 +0,0 @@
//// [es6-declaration-amd.js.map]
{"version":3,"file":"es6-declaration-amd.js","sourceRoot":"","sources":["es6-declaration-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"}
@@ -1,91 +0,0 @@
===================================================================
JsFile: es6-declaration-amd.js
mapUrl: es6-declaration-amd.js.map
sourceRoot:
sources: es6-declaration-amd.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es6-declaration-amd.js
sourceFile:es6-declaration-amd.ts
-------------------------------------------------------------------
>>>class A {
1 >
2 >^^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> constructor() {
1->^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> B() {
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^->
1->
>
> public
2 > B
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A)
---
>>> return 42;
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1->()
> {
>
2 > return
3 >
4 > 42
5 > ;
1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> }
1 >^^^^
2 > ^
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A)
---
>>>//# sourceMappingURL=es6-declaration-amd.js.map1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->
1->Emitted(8, 1) Source(13, 2) + SourceIndex(0)
---
-7
View File
@@ -21,10 +21,3 @@ class A {
return 42;
}
}
//# sourceMappingURL=es6-umd.js.map
//// [es6-umd.d.ts]
declare class A {
constructor();
B(): number;
}
-2
View File
@@ -1,2 +0,0 @@
//// [es6-umd.js.map]
{"version":3,"file":"es6-umd.js","sourceRoot":"","sources":["es6-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"}
@@ -1,91 +0,0 @@
===================================================================
JsFile: es6-umd.js
mapUrl: es6-umd.js.map
sourceRoot:
sources: es6-umd.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es6-umd.js
sourceFile:es6-umd.ts
-------------------------------------------------------------------
>>>class A {
1 >
2 >^^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> constructor() {
1->^^^^
2 > ^^->
1->class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> B() {
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^->
1->
>
> public
2 > B
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A)
---
>>> return 42;
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1->()
> {
>
2 > return
3 >
4 > 42
5 > ;
1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> }
1 >^^^^
2 > ^
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A)
---
>>>//# sourceMappingURL=es6-umd.js.map1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->
1->Emitted(8, 1) Source(13, 2) + SourceIndex(0)
---
-7
View File
@@ -21,10 +21,3 @@ export class A {
return 42;
}
}
//# sourceMappingURL=es6-umd2.js.map
//// [es6-umd2.d.ts]
export declare class A {
constructor();
B(): number;
}
@@ -1,2 +0,0 @@
//// [es6-umd2.js.map]
{"version":3,"file":"es6-umd2.js","sourceRoot":"","sources":["es6-umd2.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"}
@@ -1,91 +0,0 @@
===================================================================
JsFile: es6-umd2.js
mapUrl: es6-umd2.js.map
sourceRoot:
sources: es6-umd2.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/es6-umd2.js
sourceFile:es6-umd2.ts
-------------------------------------------------------------------
>>>export class A {
1 >
2 >^^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
---
>>> constructor() {
1->^^^^
2 > ^^->
1->export class A
>{
>
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
---
>>> }
1->^^^^
2 > ^
3 > ^^^^^->
1->constructor ()
> {
>
>
2 > }
1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
---
>>> B() {
1->^^^^
2 > ^
3 > ^^^^^^^^^^^^^^->
1->
>
> public
2 > B
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A)
---
>>> return 42;
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^
5 > ^
1->()
> {
>
2 > return
3 >
4 > 42
5 > ;
1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
---
>>> }
1 >^^^^
2 > ^
1 >
>
2 > }
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A)
2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A)
---
>>>//# sourceMappingURL=es6-umd2.js.map1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->
1->Emitted(8, 1) Source(13, 2) + SourceIndex(0)
---
@@ -0,0 +1,12 @@
EmitSkipped: false
FileName : out.js
/// <reference path='my.d.ts' />
var foo;
(function (foo) {
var bar;
(function (bar) {
var baz1 = bar.Baz.prototype; // Should emit as bar.Baz.prototype
})(bar = foo.bar || (foo.bar = {}));
})(foo || (foo = {}));
var x;
@@ -0,0 +1,53 @@
//// [narrowTypeByInstanceof.ts]
class Match {
public range(): any {
return undefined;
}
}
class FileMatch {
public resource(): any {
return undefined;
}
}
type FileMatchOrMatch = FileMatch | Match;
let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch;
if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
let a = elementA.resource().path;
let b = elementB.resource().path;
} else if (elementA instanceof Match && elementB instanceof Match) {
let a = elementA.range();
let b = elementB.range();
}
//// [narrowTypeByInstanceof.js]
var Match = (function () {
function Match() {
}
Match.prototype.range = function () {
return undefined;
};
return Match;
})();
var FileMatch = (function () {
function FileMatch() {
}
FileMatch.prototype.resource = function () {
return undefined;
};
return FileMatch;
})();
var elementA, elementB;
if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
var a = elementA.resource().path;
var b = elementB.resource().path;
}
else if (elementA instanceof Match && elementB instanceof Match) {
var a = elementA.range();
var b = elementB.range();
}
@@ -0,0 +1,72 @@
=== tests/cases/compiler/narrowTypeByInstanceof.ts ===
class Match {
>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0))
public range(): any {
>range : Symbol(range, Decl(narrowTypeByInstanceof.ts, 0, 17))
return undefined;
>undefined : Symbol(undefined)
}
}
class FileMatch {
>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5))
public resource(): any {
>resource : Symbol(resource, Decl(narrowTypeByInstanceof.ts, 6, 21))
return undefined;
>undefined : Symbol(undefined)
}
}
type FileMatchOrMatch = FileMatch | Match;
>FileMatchOrMatch : Symbol(FileMatchOrMatch, Decl(narrowTypeByInstanceof.ts, 10, 5))
>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5))
>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0))
let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch;
>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3))
>FileMatchOrMatch : Symbol(FileMatchOrMatch, Decl(narrowTypeByInstanceof.ts, 10, 5))
>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31))
>FileMatchOrMatch : Symbol(FileMatchOrMatch, Decl(narrowTypeByInstanceof.ts, 10, 5))
if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3))
>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5))
>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31))
>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5))
let a = elementA.resource().path;
>a : Symbol(a, Decl(narrowTypeByInstanceof.ts, 18, 7))
>elementA.resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21))
>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3))
>resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21))
let b = elementB.resource().path;
>b : Symbol(b, Decl(narrowTypeByInstanceof.ts, 19, 7))
>elementB.resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21))
>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31))
>resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21))
} else if (elementA instanceof Match && elementB instanceof Match) {
>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3))
>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0))
>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31))
>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0))
let a = elementA.range();
>a : Symbol(a, Decl(narrowTypeByInstanceof.ts, 21, 7))
>elementA.range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17))
>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3))
>range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17))
let b = elementB.range();
>b : Symbol(b, Decl(narrowTypeByInstanceof.ts, 22, 7))
>elementB.range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17))
>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31))
>range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17))
}
@@ -0,0 +1,86 @@
=== tests/cases/compiler/narrowTypeByInstanceof.ts ===
class Match {
>Match : Match
public range(): any {
>range : () => any
return undefined;
>undefined : undefined
}
}
class FileMatch {
>FileMatch : FileMatch
public resource(): any {
>resource : () => any
return undefined;
>undefined : undefined
}
}
type FileMatchOrMatch = FileMatch | Match;
>FileMatchOrMatch : Match | FileMatch
>FileMatch : FileMatch
>Match : Match
let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch;
>elementA : Match | FileMatch
>FileMatchOrMatch : Match | FileMatch
>elementB : Match | FileMatch
>FileMatchOrMatch : Match | FileMatch
if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
>elementA instanceof FileMatch && elementB instanceof FileMatch : boolean
>elementA instanceof FileMatch : boolean
>elementA : Match | FileMatch
>FileMatch : typeof FileMatch
>elementB instanceof FileMatch : boolean
>elementB : Match | FileMatch
>FileMatch : typeof FileMatch
let a = elementA.resource().path;
>a : any
>elementA.resource().path : any
>elementA.resource() : any
>elementA.resource : () => any
>elementA : FileMatch
>resource : () => any
>path : any
let b = elementB.resource().path;
>b : any
>elementB.resource().path : any
>elementB.resource() : any
>elementB.resource : () => any
>elementB : FileMatch
>resource : () => any
>path : any
} else if (elementA instanceof Match && elementB instanceof Match) {
>elementA instanceof Match && elementB instanceof Match : boolean
>elementA instanceof Match : boolean
>elementA : Match | FileMatch
>Match : typeof Match
>elementB instanceof Match : boolean
>elementB : Match | FileMatch
>Match : typeof Match
let a = elementA.range();
>a : any
>elementA.range() : any
>elementA.range : () => any
>elementA : Match
>range : () => any
let b = elementB.range();
>b : any
>elementB.range() : any
>elementB.range : () => any
>elementB : Match
>range : () => any
}
@@ -1,6 +1,6 @@
error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'.
error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
error TS6053: File 'a.ts' not found.
!!! error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'.
!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
!!! error TS6053: File 'a.ts' not found.
@@ -1,6 +1,6 @@
error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'.
error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
error TS6053: File 'a.ts' not found.
!!! error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'.
!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
!!! error TS6053: File 'a.ts' not found.
@@ -1,9 +1,9 @@
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
@@ -1,9 +1,9 @@
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
@@ -1,7 +1,7 @@
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
@@ -1,7 +1,7 @@
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
@@ -1,7 +1,7 @@
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
@@ -1,7 +1,7 @@
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
@@ -0,0 +1,84 @@
//// [tests/cases/compiler/systemModuleAmbientDeclarations.ts] ////
//// [file1.ts]
declare class Promise { }
declare function Foo(): void;
declare class C {}
declare enum E {X = 1};
export var promise = Promise;
export var foo = Foo;
export var c = C;
export var e = E;
//// [file2.ts]
export declare function foo();
//// [file3.ts]
export declare class C {}
//// [file4.ts]
export declare var v: number;
//// [file5.ts]
export declare enum E {X = 1}
//// [file6.ts]
export declare module M { var v: number; }
//// [file1.js]
System.register([], function(exports_1) {
var promise, foo, c, e;
return {
setters:[],
execute: function() {
;
exports_1("promise", promise = Promise);
exports_1("foo", foo = Foo);
exports_1("c", c = C);
exports_1("e", e = E);
}
}
});
//// [file2.js]
System.register([], function(exports_1) {
return {
setters:[],
execute: function() {
}
}
});
//// [file3.js]
System.register([], function(exports_1) {
return {
setters:[],
execute: function() {
}
}
});
//// [file4.js]
System.register([], function(exports_1) {
return {
setters:[],
execute: function() {
}
}
});
//// [file5.js]
System.register([], function(exports_1) {
return {
setters:[],
execute: function() {
}
}
});
//// [file6.js]
System.register([], function(exports_1) {
return {
setters:[],
execute: function() {
}
}
});
@@ -0,0 +1,53 @@
=== tests/cases/compiler/file1.ts ===
declare class Promise { }
>Promise : Symbol(Promise, Decl(file1.ts, 0, 0))
declare function Foo(): void;
>Foo : Symbol(Foo, Decl(file1.ts, 1, 25))
declare class C {}
>C : Symbol(C, Decl(file1.ts, 2, 29))
declare enum E {X = 1};
>E : Symbol(E, Decl(file1.ts, 3, 18))
>X : Symbol(E.X, Decl(file1.ts, 4, 16))
export var promise = Promise;
>promise : Symbol(promise, Decl(file1.ts, 6, 10))
>Promise : Symbol(Promise, Decl(file1.ts, 0, 0))
export var foo = Foo;
>foo : Symbol(foo, Decl(file1.ts, 7, 10))
>Foo : Symbol(Foo, Decl(file1.ts, 1, 25))
export var c = C;
>c : Symbol(c, Decl(file1.ts, 8, 10))
>C : Symbol(C, Decl(file1.ts, 2, 29))
export var e = E;
>e : Symbol(e, Decl(file1.ts, 9, 10))
>E : Symbol(E, Decl(file1.ts, 3, 18))
=== tests/cases/compiler/file2.ts ===
export declare function foo();
>foo : Symbol(foo, Decl(file2.ts, 0, 0))
=== tests/cases/compiler/file3.ts ===
export declare class C {}
>C : Symbol(C, Decl(file3.ts, 0, 0))
=== tests/cases/compiler/file4.ts ===
export declare var v: number;
>v : Symbol(v, Decl(file4.ts, 0, 18))
=== tests/cases/compiler/file5.ts ===
export declare enum E {X = 1}
>E : Symbol(E, Decl(file5.ts, 0, 0))
>X : Symbol(E.X, Decl(file5.ts, 0, 23))
=== tests/cases/compiler/file6.ts ===
export declare module M { var v: number; }
>M : Symbol(M, Decl(file6.ts, 0, 0))
>v : Symbol(v, Decl(file6.ts, 0, 29))
@@ -0,0 +1,55 @@
=== tests/cases/compiler/file1.ts ===
declare class Promise { }
>Promise : Promise
declare function Foo(): void;
>Foo : () => void
declare class C {}
>C : C
declare enum E {X = 1};
>E : E
>X : E
>1 : number
export var promise = Promise;
>promise : typeof Promise
>Promise : typeof Promise
export var foo = Foo;
>foo : () => void
>Foo : () => void
export var c = C;
>c : typeof C
>C : typeof C
export var e = E;
>e : typeof E
>E : typeof E
=== tests/cases/compiler/file2.ts ===
export declare function foo();
>foo : () => any
=== tests/cases/compiler/file3.ts ===
export declare class C {}
>C : C
=== tests/cases/compiler/file4.ts ===
export declare var v: number;
>v : number
=== tests/cases/compiler/file5.ts ===
export declare enum E {X = 1}
>E : E
>X : E
>1 : number
=== tests/cases/compiler/file6.ts ===
export declare module M { var v: number; }
>M : typeof M
>v : number
@@ -0,0 +1,27 @@
//// [systemModuleConstEnums.ts]
declare function use(a: any);
const enum TopLevelConstEnum { X }
export function foo() {
use(TopLevelConstEnum.X);
use(M.NonTopLevelConstEnum.X);
}
module M {
export const enum NonTopLevelConstEnum { X }
}
//// [systemModuleConstEnums.js]
System.register([], function(exports_1) {
function foo() {
use(0 /* X */);
use(0 /* X */);
}
exports_1("foo", foo);
return {
setters:[],
execute: function() {
}
}
});
@@ -0,0 +1,35 @@
=== tests/cases/compiler/systemModuleConstEnums.ts ===
declare function use(a: any);
>use : Symbol(use, Decl(systemModuleConstEnums.ts, 0, 0))
>a : Symbol(a, Decl(systemModuleConstEnums.ts, 1, 21))
const enum TopLevelConstEnum { X }
>TopLevelConstEnum : Symbol(TopLevelConstEnum, Decl(systemModuleConstEnums.ts, 1, 29))
>X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 2, 30))
export function foo() {
>foo : Symbol(foo, Decl(systemModuleConstEnums.ts, 2, 34))
use(TopLevelConstEnum.X);
>use : Symbol(use, Decl(systemModuleConstEnums.ts, 0, 0))
>TopLevelConstEnum.X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 2, 30))
>TopLevelConstEnum : Symbol(TopLevelConstEnum, Decl(systemModuleConstEnums.ts, 1, 29))
>X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 2, 30))
use(M.NonTopLevelConstEnum.X);
>use : Symbol(use, Decl(systemModuleConstEnums.ts, 0, 0))
>M.NonTopLevelConstEnum.X : Symbol(M.NonTopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 10, 44))
>M.NonTopLevelConstEnum : Symbol(M.NonTopLevelConstEnum, Decl(systemModuleConstEnums.ts, 9, 10))
>M : Symbol(M, Decl(systemModuleConstEnums.ts, 7, 1))
>NonTopLevelConstEnum : Symbol(M.NonTopLevelConstEnum, Decl(systemModuleConstEnums.ts, 9, 10))
>X : Symbol(M.NonTopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 10, 44))
}
module M {
>M : Symbol(M, Decl(systemModuleConstEnums.ts, 7, 1))
export const enum NonTopLevelConstEnum { X }
>NonTopLevelConstEnum : Symbol(NonTopLevelConstEnum, Decl(systemModuleConstEnums.ts, 9, 10))
>X : Symbol(NonTopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 10, 44))
}
@@ -0,0 +1,37 @@
=== tests/cases/compiler/systemModuleConstEnums.ts ===
declare function use(a: any);
>use : (a: any) => any
>a : any
const enum TopLevelConstEnum { X }
>TopLevelConstEnum : TopLevelConstEnum
>X : TopLevelConstEnum
export function foo() {
>foo : () => void
use(TopLevelConstEnum.X);
>use(TopLevelConstEnum.X) : any
>use : (a: any) => any
>TopLevelConstEnum.X : TopLevelConstEnum
>TopLevelConstEnum : typeof TopLevelConstEnum
>X : TopLevelConstEnum
use(M.NonTopLevelConstEnum.X);
>use(M.NonTopLevelConstEnum.X) : any
>use : (a: any) => any
>M.NonTopLevelConstEnum.X : M.NonTopLevelConstEnum
>M.NonTopLevelConstEnum : typeof M.NonTopLevelConstEnum
>M : typeof M
>NonTopLevelConstEnum : typeof M.NonTopLevelConstEnum
>X : M.NonTopLevelConstEnum
}
module M {
>M : typeof M
export const enum NonTopLevelConstEnum { X }
>NonTopLevelConstEnum : NonTopLevelConstEnum
>X : NonTopLevelConstEnum
}
@@ -0,0 +1,37 @@
//// [systemModuleConstEnumsSeparateCompilation.ts]
declare function use(a: any);
const enum TopLevelConstEnum { X }
export function foo() {
use(TopLevelConstEnum.X);
use(M.NonTopLevelConstEnum.X);
}
module M {
export const enum NonTopLevelConstEnum { X }
}
//// [systemModuleConstEnumsSeparateCompilation.js]
System.register([], function(exports_1) {
var TopLevelConstEnum, M;
function foo() {
use(TopLevelConstEnum.X);
use(M.NonTopLevelConstEnum.X);
}
exports_1("foo", foo);
return {
setters:[],
execute: function() {
(function (TopLevelConstEnum) {
TopLevelConstEnum[TopLevelConstEnum["X"] = 0] = "X";
})(TopLevelConstEnum || (TopLevelConstEnum = {}));
(function (M) {
(function (NonTopLevelConstEnum) {
NonTopLevelConstEnum[NonTopLevelConstEnum["X"] = 0] = "X";
})(M.NonTopLevelConstEnum || (M.NonTopLevelConstEnum = {}));
var NonTopLevelConstEnum = M.NonTopLevelConstEnum;
})(M || (M = {}));
}
}
});
@@ -0,0 +1,35 @@
=== tests/cases/compiler/systemModuleConstEnumsSeparateCompilation.ts ===
declare function use(a: any);
>use : Symbol(use, Decl(systemModuleConstEnumsSeparateCompilation.ts, 0, 0))
>a : Symbol(a, Decl(systemModuleConstEnumsSeparateCompilation.ts, 1, 21))
const enum TopLevelConstEnum { X }
>TopLevelConstEnum : Symbol(TopLevelConstEnum, Decl(systemModuleConstEnumsSeparateCompilation.ts, 1, 29))
>X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 2, 30))
export function foo() {
>foo : Symbol(foo, Decl(systemModuleConstEnumsSeparateCompilation.ts, 2, 34))
use(TopLevelConstEnum.X);
>use : Symbol(use, Decl(systemModuleConstEnumsSeparateCompilation.ts, 0, 0))
>TopLevelConstEnum.X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 2, 30))
>TopLevelConstEnum : Symbol(TopLevelConstEnum, Decl(systemModuleConstEnumsSeparateCompilation.ts, 1, 29))
>X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 2, 30))
use(M.NonTopLevelConstEnum.X);
>use : Symbol(use, Decl(systemModuleConstEnumsSeparateCompilation.ts, 0, 0))
>M.NonTopLevelConstEnum.X : Symbol(M.NonTopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 10, 44))
>M.NonTopLevelConstEnum : Symbol(M.NonTopLevelConstEnum, Decl(systemModuleConstEnumsSeparateCompilation.ts, 9, 10))
>M : Symbol(M, Decl(systemModuleConstEnumsSeparateCompilation.ts, 7, 1))
>NonTopLevelConstEnum : Symbol(M.NonTopLevelConstEnum, Decl(systemModuleConstEnumsSeparateCompilation.ts, 9, 10))
>X : Symbol(M.NonTopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 10, 44))
}
module M {
>M : Symbol(M, Decl(systemModuleConstEnumsSeparateCompilation.ts, 7, 1))
export const enum NonTopLevelConstEnum { X }
>NonTopLevelConstEnum : Symbol(NonTopLevelConstEnum, Decl(systemModuleConstEnumsSeparateCompilation.ts, 9, 10))
>X : Symbol(NonTopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 10, 44))
}
@@ -0,0 +1,37 @@
=== tests/cases/compiler/systemModuleConstEnumsSeparateCompilation.ts ===
declare function use(a: any);
>use : (a: any) => any
>a : any
const enum TopLevelConstEnum { X }
>TopLevelConstEnum : TopLevelConstEnum
>X : TopLevelConstEnum
export function foo() {
>foo : () => void
use(TopLevelConstEnum.X);
>use(TopLevelConstEnum.X) : any
>use : (a: any) => any
>TopLevelConstEnum.X : TopLevelConstEnum
>TopLevelConstEnum : typeof TopLevelConstEnum
>X : TopLevelConstEnum
use(M.NonTopLevelConstEnum.X);
>use(M.NonTopLevelConstEnum.X) : any
>use : (a: any) => any
>M.NonTopLevelConstEnum.X : M.NonTopLevelConstEnum
>M.NonTopLevelConstEnum : typeof M.NonTopLevelConstEnum
>M : typeof M
>NonTopLevelConstEnum : typeof M.NonTopLevelConstEnum
>X : M.NonTopLevelConstEnum
}
module M {
>M : typeof M
export const enum NonTopLevelConstEnum { X }
>NonTopLevelConstEnum : NonTopLevelConstEnum
>X : NonTopLevelConstEnum
}
@@ -0,0 +1,43 @@
//// [systemModuleDeclarationMerging.ts]
export function F() {}
export module F { var x; }
export class C {}
export module C { var x; }
export enum E {}
export module E { var x; }
//// [systemModuleDeclarationMerging.js]
System.register([], function(exports_1) {
var F, C, E;
function F() { }
exports_1("F", F);
return {
setters:[],
execute: function() {
(function (F) {
var x;
})(F = F || (F = {}));
exports_1("F", F)
C = (function () {
function C() {
}
return C;
})();
exports_1("C", C);
(function (C) {
var x;
})(C = C || (C = {}));
exports_1("C", C)
(function (E) {
})(E || (E = {}));
exports_1("E", E)
(function (E) {
var x;
})(E = E || (E = {}));
exports_1("E", E)
}
}
});
@@ -0,0 +1,23 @@
=== tests/cases/compiler/systemModuleDeclarationMerging.ts ===
export function F() {}
>F : Symbol(F, Decl(systemModuleDeclarationMerging.ts, 0, 0), Decl(systemModuleDeclarationMerging.ts, 1, 22))
export module F { var x; }
>F : Symbol(F, Decl(systemModuleDeclarationMerging.ts, 0, 0), Decl(systemModuleDeclarationMerging.ts, 1, 22))
>x : Symbol(x, Decl(systemModuleDeclarationMerging.ts, 2, 21))
export class C {}
>C : Symbol(C, Decl(systemModuleDeclarationMerging.ts, 2, 26), Decl(systemModuleDeclarationMerging.ts, 4, 17))
export module C { var x; }
>C : Symbol(C, Decl(systemModuleDeclarationMerging.ts, 2, 26), Decl(systemModuleDeclarationMerging.ts, 4, 17))
>x : Symbol(x, Decl(systemModuleDeclarationMerging.ts, 5, 21))
export enum E {}
>E : Symbol(E, Decl(systemModuleDeclarationMerging.ts, 5, 26), Decl(systemModuleDeclarationMerging.ts, 7, 16))
export module E { var x; }
>E : Symbol(E, Decl(systemModuleDeclarationMerging.ts, 5, 26), Decl(systemModuleDeclarationMerging.ts, 7, 16))
>x : Symbol(x, Decl(systemModuleDeclarationMerging.ts, 8, 21))
@@ -0,0 +1,23 @@
=== tests/cases/compiler/systemModuleDeclarationMerging.ts ===
export function F() {}
>F : typeof F
export module F { var x; }
>F : typeof F
>x : any
export class C {}
>C : C
export module C { var x; }
>C : typeof C
>x : any
export enum E {}
>E : E
export module E { var x; }
>E : typeof E
>x : any
@@ -0,0 +1,67 @@
//// [tests/cases/compiler/systemModuleExportDefault.ts] ////
//// [file1.ts]
export default function() {}
//// [file2.ts]
export default function foo() {}
//// [file3.ts]
export default class {}
//// [file4.ts]
export default class C {}
//// [file1.js]
System.register([], function(exports_1) {
function default_1() { }
exports_1("default", default_1);
return {
setters:[],
execute: function() {
}
}
});
//// [file2.js]
System.register([], function(exports_1) {
function foo() { }
exports_1("default", foo);
return {
setters:[],
execute: function() {
}
}
});
//// [file3.js]
System.register([], function(exports_1) {
var default_1;
return {
setters:[],
execute: function() {
default_1 = (function () {
function default_1() {
}
return default_1;
})();
exports_1("default", default_1);
}
}
});
//// [file4.js]
System.register([], function(exports_1) {
var C;
return {
setters:[],
execute: function() {
C = (function () {
function C() {
}
return C;
})();
exports_1("default", C);
}
}
});
@@ -0,0 +1,16 @@
=== tests/cases/compiler/file1.ts ===
No type information for this code.export default function() {}
No type information for this code.
No type information for this code.=== tests/cases/compiler/file2.ts ===
export default function foo() {}
>foo : Symbol(foo, Decl(file2.ts, 0, 0))
=== tests/cases/compiler/file3.ts ===
export default class {}
No type information for this code.
No type information for this code.=== tests/cases/compiler/file4.ts ===
export default class C {}
>C : Symbol(C, Decl(file4.ts, 0, 0))
@@ -0,0 +1,16 @@
=== tests/cases/compiler/file1.ts ===
No type information for this code.export default function() {}
No type information for this code.
No type information for this code.=== tests/cases/compiler/file2.ts ===
export default function foo() {}
>foo : () => void
=== tests/cases/compiler/file3.ts ===
export default class {}
No type information for this code.
No type information for this code.=== tests/cases/compiler/file4.ts ===
export default class C {}
>C : C
@@ -0,0 +1,58 @@
//// [systemModuleNonTopLevelModuleMembers.ts]
export class TopLevelClass {}
export module TopLevelModule {var v;}
export function TopLevelFunction(): void {}
export enum TopLevelEnum {E}
export module TopLevelModule2 {
export class NonTopLevelClass {}
export module NonTopLevelModule {var v;}
export function NonTopLevelFunction(): void {}
export enum NonTopLevelEnum {E}
}
//// [systemModuleNonTopLevelModuleMembers.js]
System.register([], function(exports_1) {
var TopLevelClass, TopLevelModule, TopLevelEnum, TopLevelModule2;
function TopLevelFunction() { }
exports_1("TopLevelFunction", TopLevelFunction);
return {
setters:[],
execute: function() {
TopLevelClass = (function () {
function TopLevelClass() {
}
return TopLevelClass;
})();
exports_1("TopLevelClass", TopLevelClass);
(function (TopLevelModule) {
var v;
})(TopLevelModule = TopLevelModule || (TopLevelModule = {}));
exports_1("TopLevelModule", TopLevelModule)
(function (TopLevelEnum) {
TopLevelEnum[TopLevelEnum["E"] = 0] = "E";
})(TopLevelEnum || (TopLevelEnum = {}));
exports_1("TopLevelEnum", TopLevelEnum)
(function (TopLevelModule2) {
var NonTopLevelClass = (function () {
function NonTopLevelClass() {
}
return NonTopLevelClass;
})();
TopLevelModule2.NonTopLevelClass = NonTopLevelClass;
var NonTopLevelModule;
(function (NonTopLevelModule) {
var v;
})(NonTopLevelModule = TopLevelModule2.NonTopLevelModule || (TopLevelModule2.NonTopLevelModule = {}));
function NonTopLevelFunction() { }
TopLevelModule2.NonTopLevelFunction = NonTopLevelFunction;
(function (NonTopLevelEnum) {
NonTopLevelEnum[NonTopLevelEnum["E"] = 0] = "E";
})(TopLevelModule2.NonTopLevelEnum || (TopLevelModule2.NonTopLevelEnum = {}));
var NonTopLevelEnum = TopLevelModule2.NonTopLevelEnum;
})(TopLevelModule2 = TopLevelModule2 || (TopLevelModule2 = {}));
exports_1("TopLevelModule2", TopLevelModule2)
}
}
});

Some files were not shown because too many files have changed in this diff Show More