Merge branch 'master' into classExpressions

This commit is contained in:
Cyrus Najmabadi 2015-03-31 14:53:39 -07:00
commit 478ac3d3ef
80 changed files with 1257 additions and 121 deletions

View file

@ -720,8 +720,14 @@ module ts {
function markExportAsReferenced(node: ImportEqualsDeclaration | ExportAssignment | ExportSpecifier) {
let symbol = getSymbolOfNode(node);
let target = resolveAlias(symbol);
if (target && target !== unknownSymbol && target.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(target)) {
markAliasSymbolAsReferenced(symbol);
if (target) {
let markAlias =
(target === unknownSymbol && compilerOptions.separateCompilation) ||
(target !== unknownSymbol && (target.flags & SymbolFlags.Value) && !isConstEnumOrConstEnumOnlyModule(target));
if (markAlias) {
markAliasSymbolAsReferenced(symbol);
}
}
}
@ -9789,7 +9795,9 @@ module ts {
checkKindsOfPropertyMemberOverrides(type, baseType);
}
}
if (type.baseTypes.length || (baseTypeNode && compilerOptions.separateCompilation)) {
// Check that base type can be evaluated as expression
checkExpressionOrQualifiedName(baseTypeNode.expression);
}
@ -10203,6 +10211,11 @@ module ts {
computeEnumMemberValues(node);
let enumIsConst = isConst(node);
if (compilerOptions.separateCompilation && enumIsConst && isInAmbientContext(node)) {
error(node.name, Diagnostics.Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided);
}
// Spec 2014 - Section 9.3:
// It isn't possible for one enum declaration to continue the automatic numbering sequence of another,
// and when an enum type has multiple declarations, only one declaration is permitted to omit a value
@ -10213,7 +10226,6 @@ module ts {
let firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind);
if (node === firstDeclaration) {
if (enumSymbol.declarations.length > 1) {
let enumIsConst = isConst(node);
// check that const is placed\omitted on all enum declarations
forEach(enumSymbol.declarations, decl => {
if (isConstEnumDeclaration(decl) !== enumIsConst) {
@ -10275,7 +10287,7 @@ module ts {
if (symbol.flags & SymbolFlags.ValueModule
&& symbol.declarations.length > 1
&& !isInAmbientContext(node)
&& isInstantiatedModule(node, compilerOptions.preserveConstEnums)) {
&& isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation)) {
let classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
if (classOrFunc) {
if (getSourceFileOfNode(node) !== getSourceFileOfNode(classOrFunc)) {
@ -11348,13 +11360,18 @@ module ts {
// parent is not source file or it is not reference to internal module
return false;
}
return isAliasResolvedToValue(getSymbolOfNode(node));
var isValue = isAliasResolvedToValue(getSymbolOfNode(node));
return isValue && node.moduleReference && !nodeIsMissing(node.moduleReference);
}
function isAliasResolvedToValue(symbol: Symbol): boolean {
let target = resolveAlias(symbol);
if (target === unknownSymbol && compilerOptions.separateCompilation) {
return true;
}
// const enums and modules that contain only const enums are not considered values from the emit perespective
return target !== unknownSymbol && target.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(target);
return target !== unknownSymbol && target && target.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(target);
}
function isConstEnumOrConstEnumOnlyModule(s: Symbol): boolean {
@ -12255,9 +12272,6 @@ module ts {
function checkGrammarVariableDeclaration(node: VariableDeclaration) {
if (node.parent.parent.kind !== SyntaxKind.ForInStatement && node.parent.parent.kind !== SyntaxKind.ForOfStatement) {
if (isInAmbientContext(node)) {
if (isBindingPattern(node.name)) {
return grammarErrorOnNode(node, Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts);
}
if (node.initializer) {
// Error on equals token which immediate precedes the initializer
let equalsTokenLength = "=".length;

View file

@ -9,10 +9,6 @@ module ts {
name: "charset",
type: "string",
},
{
name: "codepage",
type: "number",
},
{
name: "declaration",
shortName: "d",
@ -78,10 +74,6 @@ module ts {
name: "noLib",
type: "boolean",
},
{
name: "noLibCheck",
type: "boolean",
},
{
name: "noResolve",
type: "boolean",
@ -117,6 +109,10 @@ module ts {
type: "boolean",
description: Diagnostics.Do_not_emit_comments_to_output,
},
{
name: "separateCompilation",
type: "boolean",
},
{
name: "sourceMap",
type: "boolean",

View file

@ -1008,7 +1008,18 @@ module ts {
}
function emitBindingPattern(bindingPattern: BindingPattern) {
emitCommaList(bindingPattern.elements, emitBindingElement);
// Only select non-omitted expression from the bindingPattern's elements.
// We have to do this to avoid emitting trailing commas.
// For example:
// original: var [, c,,] = [ 2,3,4]
// emitted: declare var c: number; // instead of declare var c:number, ;
let elements: Node[] = [];
for (let element of bindingPattern.elements) {
if (element.kind !== SyntaxKind.OmittedExpression){
elements.push(element);
}
}
emitCommaList(elements, emitBindingElement);
}
function emitBindingElement(bindingElement: BindingElement) {
@ -1306,7 +1317,10 @@ module ts {
write("...");
}
if (isBindingPattern(node.name)) {
write("_" + indexOf((<FunctionLikeDeclaration>node.parent).parameters, node));
// For bindingPattern, we can't simply writeTextOfNode from the source file
// because we want to omit the initializer and using writeTextOfNode will result in initializer get emitted.
// Therefore, we will have to recursively emit each element in the bindingPattern.
emitBindingPattern(<BindingPattern>node.name);
}
else {
writeTextOfNode(currentSourceFile, node.name);
@ -1326,41 +1340,46 @@ module ts {
}
function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
let diagnosticMessage: DiagnosticMessage;
let diagnosticMessage: DiagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult);
return diagnosticMessage !== undefined ? {
diagnosticMessage,
errorNode: node,
typeName: node.name
} : undefined;
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult: SymbolAccessiblityResult): DiagnosticMessage {
switch (node.parent.kind) {
case SyntaxKind.Constructor:
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
break;
case SyntaxKind.ConstructSignature:
// Interfaces cannot have parameter types that cannot be named
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
return symbolAccesibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
case SyntaxKind.CallSignature:
// Interfaces cannot have parameter types that cannot be named
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
return symbolAccesibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
if (node.parent.flags & NodeFlags.Static) {
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
@ -1368,30 +1387,99 @@ module ts {
}
else {
// Interfaces cannot have parameter types that cannot be named
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
return symbolAccesibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
break;
case SyntaxKind.FunctionDeclaration:
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
return symbolAccesibilityResult.errorModuleName ?
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
default:
Debug.fail("This is unknown parent for parameter: " + node.parent.kind);
}
return {
diagnosticMessage,
errorNode: node,
typeName: node.name
};
}
function emitBindingPattern(bindingPattern: BindingPattern) {
// We have to explicitly emit square bracket and bracket because these tokens are not store inside the node.
if (bindingPattern.kind === SyntaxKind.ObjectBindingPattern) {
write("{");
emitCommaList(bindingPattern.elements, emitBindingElement);
write("}");
}
else if (bindingPattern.kind === SyntaxKind.ArrayBindingPattern) {
write("[");
let elements = bindingPattern.elements;
emitCommaList(elements, emitBindingElement);
if (elements && elements.hasTrailingComma) {
write(", ");
}
write("]");
}
}
function emitBindingElement(bindingElement: BindingElement) {
function getBindingElementTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
let diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult);
return diagnosticMessage !== undefined ? {
diagnosticMessage,
errorNode: bindingElement,
typeName: bindingElement.name
} : undefined;
}
if (bindingElement.kind === SyntaxKind.OmittedExpression) {
// If bindingElement is an omittedExpression (i.e. containing elision),
// we will emit blank space (although this may differ from users' original code,
// it allows emitSeparatedList to write separator appropriately)
// Example:
// original: function foo([, x, ,]) {}
// emit : function foo([ , x, , ]) {}
write(" ");
}
else if (bindingElement.kind === SyntaxKind.BindingElement) {
if (bindingElement.propertyName) {
// bindingElement has propertyName property in the following case:
// { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y"
// We have to explicitly emit the propertyName before descending into its binding elements.
// Example:
// original: function foo({y: [a,b,c]}) {}
// emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void;
writeTextOfNode(currentSourceFile, bindingElement.propertyName);
write(": ");
// If bindingElement has propertyName property, then its name must be another bindingPattern of SyntaxKind.ObjectBindingPattern
emitBindingPattern(<BindingPattern>bindingElement.name);
}
else if (bindingElement.name) {
if (isBindingPattern(bindingElement.name)) {
// If it is a nested binding pattern, we will recursively descend into each element and emit each one separately.
// In the case of rest element, we will omit rest element.
// Example:
// original: function foo([a, [[b]], c] = [1,[["string"]], 3]) {}
// emit : declare function foo([a, [[b]], c]: [number, [[string]], number]): void;
// original with rest: function foo([a, ...c]) {}
// emit : declare function foo([a, ...c]): void;
emitBindingPattern(<BindingPattern>bindingElement.name);
}
else {
Debug.assert(bindingElement.name.kind === SyntaxKind.Identifier);
// If the node is just an identifier, we will simply emit the text associated with the node's name
// Example:
// original: function foo({y = 10, x}) {}
// emit : declare function foo({y, x}: {number, any}): void;
if (bindingElement.dotDotDotToken) {
write("...");
}
writeTextOfNode(currentSourceFile, bindingElement.name);
}
}
}
}
}
function emitNode(node: Node) {

View file

@ -165,6 +165,8 @@ module ts {
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." },
Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@ -436,6 +438,11 @@ module ts {
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." },
Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." },
Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." },
Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." },
Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." },
Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." },
Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." },
Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." },
Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." },

View file

@ -651,7 +651,14 @@
"category": "Error",
"code": 1207
},
"Cannot compile non-external modules when the '--separateCompilation' flag is provided.": {
"category": "Error",
"code": 1208
},
"Ambient const enums are not allowed when the '--separateCompilation' flag is provided.": {
"category": "Error",
"code": 1209
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2300
@ -1737,6 +1744,26 @@
"category": "Error",
"code": 5042
},
"Option 'sourceMap' cannot be specified with option 'separateCompilation'.": {
"category": "Error",
"code": 5043
},
"Option 'declaration' cannot be specified with option 'separateCompilation'.": {
"category": "Error",
"code": 5044
},
"Option 'noEmitOnError' cannot be specified with option 'separateCompilation'.": {
"category": "Error",
"code": 5045
},
"Option 'out' cannot be specified with option 'separateCompilation'.": {
"category": "Error",
"code": 5046
},
"Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": {
"category": "Error",
"code": 5047
},
"Concatenate and emit output to single file.": {
"category": "Message",
"code": 6001

View file

@ -1641,6 +1641,11 @@ module ts {
}
function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean {
if (compilerOptions.separateCompilation) {
// do not inline enum values in separate compilation mode
return false;
}
let constantValue = resolver.getConstantValue(node);
if (constantValue !== undefined) {
write(constantValue.toString());
@ -3901,7 +3906,7 @@ module ts {
function shouldEmitEnumDeclaration(node: EnumDeclaration) {
let isConstEnum = isConst(node);
return !isConstEnum || compilerOptions.preserveConstEnums;
return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation;
}
function emitEnumDeclaration(node: EnumDeclaration) {
@ -3993,7 +3998,7 @@ module ts {
}
function shouldEmitModuleDeclaration(node: ModuleDeclaration) {
return isInstantiatedModule(node, compilerOptions.preserveConstEnums);
return isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation);
}
function emitModuleDeclaration(node: ModuleDeclaration) {

View file

@ -8,7 +8,7 @@ module ts {
/* @internal */ export let ioWriteTime = 0;
/** The version of the TypeScript compiler release */
export let version = "1.5.0.0";
export let version = "1.5.0";
export function findConfigFile(searchPath: string): string {
var fileName = "tsconfig.json";
@ -454,6 +454,24 @@ module ts {
}
function verifyCompilerOptions() {
if (options.separateCompilation) {
if (options.sourceMap) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation));
}
if (options.declaration) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation));
}
if (options.noEmitOnError) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation));
}
if (options.out) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation));
}
}
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
if (options.mapRoot) {
@ -468,12 +486,21 @@ module ts {
let languageVersion = options.target || ScriptTarget.ES3;
let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined);
if (firstExternalModuleSourceFile && !options.module) {
if (options.separateCompilation) {
if (!options.module && languageVersion < ScriptTarget.ES6) {
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
}
let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
if (firstNonExternalModuleSourceFile) {
let span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided));
}
}
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) {
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
}
// Cannot specify module gen target when in es6 or above
@ -481,11 +508,11 @@ module ts {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher));
}
// there has to be common source directory if user specified --outdir || --sourcRoot
// there has to be common source directory if user specified --outdir || --sourceRoot
// if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted
if (options.outDir || // there is --outDir specified
options.sourceRoot || // there is --sourceRoot specified
(options.mapRoot && // there is --mapRoot Specified and there would be multiple js files generated
(options.mapRoot && // there is --mapRoot specified and there would be multiple js files generated
(!options.out || firstExternalModuleSourceFile !== undefined))) {
let commonPathComponents: string[];

View file

@ -1579,7 +1579,6 @@ module ts {
export interface CompilerOptions {
allowNonTsExtensions?: boolean;
charset?: string;
codepage?: number;
declaration?: boolean;
diagnostics?: boolean;
emitBOM?: boolean;
@ -1593,7 +1592,6 @@ module ts {
noErrorTruncation?: boolean;
noImplicitAny?: boolean;
noLib?: boolean;
noLibCheck?: boolean;
noResolve?: boolean;
out?: string;
outDir?: string;
@ -1606,6 +1604,7 @@ module ts {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
/* @internal */ stripInternal?: boolean;
[option: string]: string | number | boolean;
}

View file

@ -274,6 +274,13 @@ module ts {
export function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan {
let errorNode = node;
switch (node.kind) {
case SyntaxKind.SourceFile:
let pos = skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false);
if (pos === sourceFile.text.length) {
// file is empty - return span for the beginning of the file
return createTextSpan(0, 0);
}
return getSpanOfTokenAtPosition(sourceFile, pos);
// This list is a work in progress. Add missing node kinds to improve their error
// spans.
case SyntaxKind.VariableDeclaration:

View file

@ -1036,17 +1036,7 @@ module Harness {
useCaseSensitiveFileNames = setting.value === 'true';
break;
case 'mapsourcefiles':
case 'maproot':
case 'generatedeclarationfiles':
case 'gatherDiagnostics':
case 'codepage':
case 'createFileLog':
case 'filename':
case 'removecomments':
case 'watch':
case 'allowautomaticsemicoloninsertion':
case 'locale':
// Not supported yet
break;
@ -1062,6 +1052,10 @@ module Harness {
options.preserveConstEnums = setting.value === 'true';
break;
case 'separatecompilation':
options.separateCompilation = setting.value === 'true';
break;
case 'suppressimplicitanyindexerrors':
options.suppressImplicitAnyIndexErrors = setting.value === 'true';
break;
@ -1461,7 +1455,12 @@ module Harness {
var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
// List of allowed metadata names
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noemitonerror", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames", "preserveconstenums", "includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal"];
var fileMetadataNames = ["filename", "comments", "declaration", "module",
"nolib", "sourcemap", "target", "out", "outdir", "noemitonerror",
"noimplicitany", "noresolve", "newline", "newlines", "emitbom",
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
"includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal",
"separatecompilation"];
function extractCompilerSettings(content: string): CompilerSetting[] {

View file

@ -4,7 +4,11 @@
/// Windows Script Host APIS
/////////////////////////////
declare var ActiveXObject: { new (s: string): any; };
interface ActiveXObject {
new (s: string): any;
}
declare var ActiveXObject: ActiveXObject;
interface ITextWriter {
Write(s: string): void;
@ -12,11 +16,157 @@ interface ITextWriter {
Close(): void;
}
declare var WScript: {
Echo(s: any): void;
StdErr: ITextWriter;
StdOut: ITextWriter;
Arguments: { length: number; Item(n: number): string; };
ScriptFullName: string;
Quit(exitCode?: number): number;
interface TextStreamBase {
/**
* The column number of the current character position in an input stream.
*/
Column: number;
/**
* The current line number in an input stream.
*/
Line: number;
/**
* Closes a text stream.
* It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid.
*/
Close(): void;
}
interface TextStreamWriter extends TextStreamBase {
/**
* Sends a string to an output stream.
*/
Write(s: string): void;
/**
* Sends a specified number of blank lines (newline characters) to an output stream.
*/
WriteBlankLines(intLines: number): void;
/**
* Sends a string followed by a newline character to an output stream.
*/
WriteLine(s: string): void;
}
interface TextStreamReader extends TextStreamBase {
/**
* Returns a specified number of characters from an input stream, beginning at the current pointer position.
* Does not return until the ENTER key is pressed.
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
*/
Read(characters: number): string;
/**
* Returns all characters from an input stream.
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
*/
ReadAll(): string;
/**
* Returns an entire line from an input stream.
* Although this method extracts the newline character, it does not add it to the returned string.
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
*/
ReadLine(): string;
/**
* Skips a specified number of characters when reading from an input text stream.
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
*/
Skip(characters: number): void;
/**
* Skips the next line when reading from an input text stream.
* Can only be used on a stream in reading mode, not writing or appending mode.
*/
SkipLine(): void;
/**
* Indicates whether the stream pointer position is at the end of a line.
*/
AtEndOfLine: boolean;
/**
* Indicates whether the stream pointer position is at the end of a stream.
*/
AtEndOfStream: boolean;
}
declare var WScript: {
/**
* Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext).
*/
Echo(s: any): void;
/**
* Exposes the write-only error output stream for the current script.
* Can be accessed only while using CScript.exe.
*/
StdErr: TextStreamWriter;
/**
* Exposes the write-only output stream for the current script.
* Can be accessed only while using CScript.exe.
*/
StdOut: TextStreamWriter;
Arguments: { length: number; Item(n: number): string; };
/**
* The full path of the currently running script.
*/
ScriptFullName: string;
/**
* Forces the script to stop immediately, with an optional exit code.
*/
Quit(exitCode?: number): number;
/**
* The Windows Script Host build version number.
*/
BuildVersion: number;
/**
* Fully qualified path of the host executable.
*/
FullName: string;
/**
* Gets/sets the script mode - interactive(true) or batch(false).
*/
Interactive: boolean;
/**
* The name of the host executable (WScript.exe or CScript.exe).
*/
Name: string;
/**
* Path of the directory containing the host executable.
*/
Path: string;
/**
* The filename of the currently running script.
*/
ScriptName: string;
/**
* Exposes the read-only input stream for the current script.
* Can be accessed only while using CScript.exe.
*/
StdIn: TextStreamReader;
/**
* Windows Script Host version
*/
Version: string;
/**
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
*/
ConnectObject(objEventSource: any, strPrefix: string): void;
/**
* Creates a COM object.
* @param strProgiID
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
*/
CreateObject(strProgID: string, strPrefix?: string): any;
/**
* Disconnects a COM object from its event sources.
*/
DisconnectObject(obj: any): void;
/**
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
* @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string.
* @param strProgID
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
*/
GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
/**
* Suspends script execution for a specified length of time, then continues execution.
* @param intTime Interval (in milliseconds) to suspend script execution.
*/
Sleep(intTime: number): void;
};

View file

@ -1635,6 +1635,61 @@ module ts {
sourceFile.scriptSnapshot = scriptSnapshot;
}
/*
* This function will compile source text from 'input' argument using specified compiler options.
* If not options are provided - it will use a set of default compiler options.
* Extra compiler options that will unconditionally be used bu this function are:
* - separateCompilation = true
* - allowNonTsExtensions = true
*/
export function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string {
let options = compilerOptions ? clone(compilerOptions) : getDefaultCompilerOptions();
options.separateCompilation = true;
// Filename can be non-ts file.
options.allowNonTsExtensions = true;
// Parse
var inputFileName = fileName || "module.ts";
var sourceFile = createSourceFile(inputFileName, input, options.target);
// Store syntactic diagnostics
if (diagnostics && sourceFile.parseDiagnostics) {
diagnostics.push(...sourceFile.parseDiagnostics);
}
// Output
let outputText: string;
// Create a compilerHost object to allow the compiler to read and write files
var compilerHost: CompilerHost = {
getSourceFile: (fileName, target) => fileName === inputFileName ? sourceFile : undefined,
writeFile: (name, text, writeByteOrderMark) => {
Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name);
outputText = text;
},
getDefaultLibFileName: () => "lib.d.ts",
useCaseSensitiveFileNames: () => false,
getCanonicalFileName: fileName => fileName,
getCurrentDirectory: () => "",
getNewLine: () => "\r\n"
};
var program = createProgram([inputFileName], options, compilerHost);
if (diagnostics) {
diagnostics.push(...program.getGlobalDiagnostics());
}
// Emit
program.emit();
Debug.assert(outputText !== undefined, "Output generation failed");
return outputText;
}
export function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile {
let sourceFile = createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents);
setSourceFileFields(sourceFile, scriptSnapshot, version);
@ -3641,8 +3696,24 @@ module ts {
}
}
/// References and Occurrences
function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
let results = getOccurrencesAtPositionCore(fileName, position);
if (results) {
let sourceFile = getCanonicalFileName(normalizeSlashes(fileName));
// ensure the results are in the file we're interested in
results.forEach((value) => {
let targetFile = getCanonicalFileName(normalizeSlashes(value.fileName));
Debug.assert(sourceFile == targetFile, `Unexpected file in results. Found results in ${targetFile} expected only results in ${sourceFile}.`);
});
}
return results;
}
/// References and Occurrences
function getOccurrencesAtPositionCore(fileName: string, position: number): ReferenceEntry[] {
synchronizeHostData();
let sourceFile = getValidSourceFile(fileName);

View file

@ -1230,7 +1230,6 @@ declare module "typescript" {
interface CompilerOptions {
allowNonTsExtensions?: boolean;
charset?: string;
codepage?: number;
declaration?: boolean;
diagnostics?: boolean;
emitBOM?: boolean;
@ -1244,7 +1243,6 @@ declare module "typescript" {
noErrorTruncation?: boolean;
noImplicitAny?: boolean;
noLib?: boolean;
noLibCheck?: boolean;
noResolve?: boolean;
out?: string;
outDir?: string;
@ -1257,6 +1255,7 @@ declare module "typescript" {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
@ -1998,6 +1997,7 @@ declare module "typescript" {
isCancellationRequested(): boolean;
throwIfCancellationRequested(): void;
}
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
let disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;

View file

@ -3940,9 +3940,6 @@ declare module "typescript" {
charset?: string;
>charset : string
codepage?: number;
>codepage : number
declaration?: boolean;
>declaration : boolean
@ -3983,9 +3980,6 @@ declare module "typescript" {
noLib?: boolean;
>noLib : boolean
noLibCheck?: boolean;
>noLibCheck : boolean
noResolve?: boolean;
>noResolve : boolean
@ -4023,6 +4017,9 @@ declare module "typescript" {
watch?: boolean;
>watch : boolean
separateCompilation?: boolean;
>separateCompilation : boolean
[option: string]: string | number | boolean;
>option : string
}
@ -6199,6 +6196,15 @@ declare module "typescript" {
throwIfCancellationRequested(): void;
>throwIfCancellationRequested : () => void
}
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
>transpile : (input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]) => string
>input : string
>compilerOptions : CompilerOptions
>CompilerOptions : CompilerOptions
>fileName : string
>diagnostics : Diagnostic[]
>Diagnostic : Diagnostic
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile
>fileName : string

View file

@ -1261,7 +1261,6 @@ declare module "typescript" {
interface CompilerOptions {
allowNonTsExtensions?: boolean;
charset?: string;
codepage?: number;
declaration?: boolean;
diagnostics?: boolean;
emitBOM?: boolean;
@ -1275,7 +1274,6 @@ declare module "typescript" {
noErrorTruncation?: boolean;
noImplicitAny?: boolean;
noLib?: boolean;
noLibCheck?: boolean;
noResolve?: boolean;
out?: string;
outDir?: string;
@ -1288,6 +1286,7 @@ declare module "typescript" {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
@ -2029,6 +2028,7 @@ declare module "typescript" {
isCancellationRequested(): boolean;
throwIfCancellationRequested(): void;
}
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
let disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;

View file

@ -4086,9 +4086,6 @@ declare module "typescript" {
charset?: string;
>charset : string
codepage?: number;
>codepage : number
declaration?: boolean;
>declaration : boolean
@ -4129,9 +4126,6 @@ declare module "typescript" {
noLib?: boolean;
>noLib : boolean
noLibCheck?: boolean;
>noLibCheck : boolean
noResolve?: boolean;
>noResolve : boolean
@ -4169,6 +4163,9 @@ declare module "typescript" {
watch?: boolean;
>watch : boolean
separateCompilation?: boolean;
>separateCompilation : boolean
[option: string]: string | number | boolean;
>option : string
}
@ -6345,6 +6342,15 @@ declare module "typescript" {
throwIfCancellationRequested(): void;
>throwIfCancellationRequested : () => void
}
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
>transpile : (input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]) => string
>input : string
>compilerOptions : CompilerOptions
>CompilerOptions : CompilerOptions
>fileName : string
>diagnostics : Diagnostic[]
>Diagnostic : Diagnostic
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile
>fileName : string

View file

@ -1262,7 +1262,6 @@ declare module "typescript" {
interface CompilerOptions {
allowNonTsExtensions?: boolean;
charset?: string;
codepage?: number;
declaration?: boolean;
diagnostics?: boolean;
emitBOM?: boolean;
@ -1276,7 +1275,6 @@ declare module "typescript" {
noErrorTruncation?: boolean;
noImplicitAny?: boolean;
noLib?: boolean;
noLibCheck?: boolean;
noResolve?: boolean;
out?: string;
outDir?: string;
@ -1289,6 +1287,7 @@ declare module "typescript" {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
@ -2030,6 +2029,7 @@ declare module "typescript" {
isCancellationRequested(): boolean;
throwIfCancellationRequested(): void;
}
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
let disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;

View file

@ -4036,9 +4036,6 @@ declare module "typescript" {
charset?: string;
>charset : string
codepage?: number;
>codepage : number
declaration?: boolean;
>declaration : boolean
@ -4079,9 +4076,6 @@ declare module "typescript" {
noLib?: boolean;
>noLib : boolean
noLibCheck?: boolean;
>noLibCheck : boolean
noResolve?: boolean;
>noResolve : boolean
@ -4119,6 +4113,9 @@ declare module "typescript" {
watch?: boolean;
>watch : boolean
separateCompilation?: boolean;
>separateCompilation : boolean
[option: string]: string | number | boolean;
>option : string
}
@ -6295,6 +6292,15 @@ declare module "typescript" {
throwIfCancellationRequested(): void;
>throwIfCancellationRequested : () => void
}
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
>transpile : (input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]) => string
>input : string
>compilerOptions : CompilerOptions
>CompilerOptions : CompilerOptions
>fileName : string
>diagnostics : Diagnostic[]
>Diagnostic : Diagnostic
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile
>fileName : string

View file

@ -1299,7 +1299,6 @@ declare module "typescript" {
interface CompilerOptions {
allowNonTsExtensions?: boolean;
charset?: string;
codepage?: number;
declaration?: boolean;
diagnostics?: boolean;
emitBOM?: boolean;
@ -1313,7 +1312,6 @@ declare module "typescript" {
noErrorTruncation?: boolean;
noImplicitAny?: boolean;
noLib?: boolean;
noLibCheck?: boolean;
noResolve?: boolean;
out?: string;
outDir?: string;
@ -1326,6 +1324,7 @@ declare module "typescript" {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
@ -2067,6 +2066,7 @@ declare module "typescript" {
isCancellationRequested(): boolean;
throwIfCancellationRequested(): void;
}
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
let disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;

View file

@ -4209,9 +4209,6 @@ declare module "typescript" {
charset?: string;
>charset : string
codepage?: number;
>codepage : number
declaration?: boolean;
>declaration : boolean
@ -4252,9 +4249,6 @@ declare module "typescript" {
noLib?: boolean;
>noLib : boolean
noLibCheck?: boolean;
>noLibCheck : boolean
noResolve?: boolean;
>noResolve : boolean
@ -4292,6 +4286,9 @@ declare module "typescript" {
watch?: boolean;
>watch : boolean
separateCompilation?: boolean;
>separateCompilation : boolean
[option: string]: string | number | boolean;
>option : string
}
@ -6468,6 +6465,15 @@ declare module "typescript" {
throwIfCancellationRequested(): void;
>throwIfCancellationRequested : () => void
}
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
>transpile : (input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]) => string
>input : string
>compilerOptions : CompilerOptions
>CompilerOptions : CompilerOptions
>fileName : string
>diagnostics : Diagnostic[]
>Diagnostic : Diagnostic
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile
>fileName : string

View file

@ -0,0 +1,37 @@
//// [declarationEmitDestructuring1.ts]
function foo([a, b, c]: [string, string, string]): void { }
function far([a, [b], [[c]]]: [number, boolean[], string[][]]): void { }
function bar({a1, b1, c1}: { a1: number, b1: boolean, c1: string }): void { }
function baz({a2, b2: {b1, c1}}: { a2: number, b2: { b1: boolean, c1: string } }): void { }
//// [declarationEmitDestructuring1.js]
function foo(_a) {
var a = _a[0], b = _a[1], c = _a[2];
}
function far(_a) {
var a = _a[0], b = _a[1][0], c = _a[2][0][0];
}
function bar(_a) {
var a1 = _a.a1, b1 = _a.b1, c1 = _a.c1;
}
function baz(_a) {
var a2 = _a.a2, _b = _a.b2, b1 = _b.b1, c1 = _b.c1;
}
//// [declarationEmitDestructuring1.d.ts]
declare function foo([a, b, c]: [string, string, string]): void;
declare function far([a, [b], [[c]]]: [number, boolean[], string[][]]): void;
declare function bar({a1, b1, c1}: {
a1: number;
b1: boolean;
c1: string;
}): void;
declare function baz({a2, b2: {b1, c1}}: {
a2: number;
b2: {
b1: boolean;
c1: string;
};
}): void;

View file

@ -0,0 +1,33 @@
=== tests/cases/compiler/declarationEmitDestructuring1.ts ===
function foo([a, b, c]: [string, string, string]): void { }
>foo : ([a, b, c]: [string, string, string]) => void
>a : string
>b : string
>c : string
function far([a, [b], [[c]]]: [number, boolean[], string[][]]): void { }
>far : ([a, [b], [[c]]]: [number, boolean[], string[][]]) => void
>a : number
>b : boolean
>c : string
function bar({a1, b1, c1}: { a1: number, b1: boolean, c1: string }): void { }
>bar : ({a1, b1, c1}: { a1: number; b1: boolean; c1: string; }) => void
>a1 : number
>b1 : boolean
>c1 : string
>a1 : number
>b1 : boolean
>c1 : string
function baz({a2, b2: {b1, c1}}: { a2: number, b2: { b1: boolean, c1: string } }): void { }
>baz : ({a2, b2: {b1, c1}}: { a2: number; b2: { b1: boolean; c1: string; }; }) => void
>a2 : number
>b2 : unknown
>b1 : boolean
>c1 : string
>a2 : number
>b2 : { b1: boolean; c1: string; }
>b1 : boolean
>c1 : string

View file

@ -0,0 +1,43 @@
//// [declarationEmitDestructuring2.ts]
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}}]){ }
function h1([a, [b], [[c]], {x = 10, y = [1, 2, 3], z: {a1, b1}}]){ }
//// [declarationEmitDestructuring2.js]
function f(_a) {
var _b = _a === void 0 ? { x: 10, y: [2, 4, 6, 8] } : _a, _c = _b.x, x = _c === void 0 ? 10 : _c, _d = _b.y, _e = _d === void 0 ? [1, 2, 3, 4] : _d, a = _e[0], b = _e[1], c = _e[2], d = _e[3];
}
function g(_a) {
var _b = _a === void 0 ? [1, 2, 3, 4] : _a, a = _b[0], b = _b[1], c = _b[2], d = _b[3];
}
function h(_a) {
var a = _a[0], b = _a[1][0], c = _a[2][0][0], _b = _a[3], _c = _b.x, x = _c === void 0 ? 10 : _c, _d = _b.y, a = _d[0], b = _d[1], c = _d[2], _e = _b.z, a1 = _e.a1, b1 = _e.b1;
}
function h1(_a) {
var a = _a[0], b = _a[1][0], c = _a[2][0][0], _b = _a[3], _c = _b.x, x = _c === void 0 ? 10 : _c, _d = _b.y, y = _d === void 0 ? [1, 2, 3] : _d, _e = _b.z, a1 = _e.a1, b1 = _e.b1;
}
//// [declarationEmitDestructuring2.d.ts]
declare function f({x, y: [a, b, c, d]}?: {
x: number;
y: [number, number, number, number];
}): void;
declare function g([a, b, c, d]?: [number, number, number, number]): void;
declare function h([a, [b], [[c]], {x, y: [a, b, c], z: {a1, b1}}]: [any, [any], [[any]], {
x?: number;
y: [any, any, any];
z: {
a1: any;
b1: any;
};
}]): void;
declare function h1([a, [b], [[c]], {x, y, z: {a1, b1}}]: [any, [any], [[any]], {
x?: number;
y?: number[];
z: {
a1: any;
b1: any;
};
}]): void;

View file

@ -0,0 +1,49 @@
=== 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
>y : unknown
>a : number
>b : number
>c : number
>d : number
>[1, 2, 3, 4] : [number, number, number, number]
>{ x: 10, y: [2, 4, 6, 8] } : { x: number; y: [number, number, number, number]; }
>x : number
>y : [number, number, number, number]
>[2, 4, 6, 8] : [number, number, number, 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]
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
>y : unknown
>a : any
>b : any
>c : any
>z : unknown
>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
>y : number[]
>[1, 2, 3] : number[]
>z : unknown
>a1 : any
>b1 : any

View file

@ -0,0 +1,18 @@
//// [declarationEmitDestructuring3.ts]
function bar([x, z, ...w]) { }
function foo([x, ...y] = [1, "string", true]) { }
//// [declarationEmitDestructuring3.js]
function bar(_a) {
var x = _a[0], z = _a[1], w = _a.slice(2);
}
function foo(_a) {
var _b = _a === void 0 ? [1, "string", true] : _a, x = _b[0], y = _b.slice(1);
}
//// [declarationEmitDestructuring3.d.ts]
declare function bar([x, z, ...w]: any[]): void;
declare function foo([x, ...y]?: (string | number | boolean)[]): void;

View file

@ -0,0 +1,14 @@
=== tests/cases/compiler/declarationEmitDestructuring3.ts ===
function bar([x, z, ...w]) { }
>bar : ([x, z, ...w]: any[]) => void
>x : any
>z : any
>w : any[]
function foo([x, ...y] = [1, "string", true]) { }
>foo : ([x, ...y]?: (string | number | boolean)[]) => void
>x : string | number | boolean
>y : (string | number | boolean)[]
>[1, "string", true] : (string | number | boolean)[]

View file

@ -0,0 +1,42 @@
//// [declarationEmitDestructuring4.ts]
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz([]) { }
function baz1([] = [1,2,3]) { }
function baz2([[]] = [[1,2,3]]) { }
function baz3({}) { }
function baz4({} = { x: 10 }) { }
//// [declarationEmitDestructuring4.js]
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz(_a) {
var ;
}
function baz1(_a) {
var _b = _a === void 0 ? [1, 2, 3] : _a;
}
function baz2(_a) {
var _b = (_a === void 0 ? [[1, 2, 3]] : _a)[0];
}
function baz3(_a) {
var ;
}
function baz4(_a) {
var _b = _a === void 0 ? { x: 10 } : _a;
}
//// [declarationEmitDestructuring4.d.ts]
declare function baz([]: any[]): void;
declare function baz1([]?: number[]): void;
declare function baz2([[]]?: [number[]]): void;
declare function baz3({}: {}): void;
declare function baz4({}?: {
x: number;
}): void;

View file

@ -0,0 +1,25 @@
=== tests/cases/compiler/declarationEmitDestructuring4.ts ===
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz([]) { }
>baz : ([]: any[]) => void
function baz1([] = [1,2,3]) { }
>baz1 : ([]?: number[]) => void
>[1,2,3] : number[]
function baz2([[]] = [[1,2,3]]) { }
>baz2 : ([[]]?: [number[]]) => void
>[[1,2,3]] : [number[]]
>[1,2,3] : number[]
function baz3({}) { }
>baz3 : ({}: {}) => void
function baz4({} = { x: 10 }) { }
>baz4 : ({}?: { x: number; }) => void
>{ x: 10 } : { x: number; }
>x : number

View file

@ -0,0 +1,31 @@
//// [declarationEmitDestructuring5.ts]
function baz([, z, , ]) { }
function foo([, b, ]: [any, any]): void { }
function bar([z, , , ]) { }
function bar1([z, , , ] = [1, 3, 4, 6, 7]) { }
function bar2([,,z, , , ]) { }
//// [declarationEmitDestructuring5.js]
function baz(_a) {
var z = _a[1];
}
function foo(_a) {
var b = _a[1];
}
function bar(_a) {
var z = _a[0];
}
function bar1(_a) {
var _b = _a === void 0 ? [1, 3, 4, 6, 7] : _a, z = _b[0];
}
function bar2(_a) {
var z = _a[2];
}
//// [declarationEmitDestructuring5.d.ts]
declare function baz([ , z, , ]: [any, any, any]): void;
declare function foo([ , b, ]: [any, any]): void;
declare function bar([z, , , ]: [any, any, any]): void;
declare function bar1([z, , , ]?: [number, number, number, number, number]): void;
declare function bar2([ , , z, , , ]: [any, any, any, any, any]): void;

View file

@ -0,0 +1,22 @@
=== tests/cases/compiler/declarationEmitDestructuring5.ts ===
function baz([, z, , ]) { }
>baz : ([, z, , ]: [any, any, any]) => void
>z : any
function foo([, b, ]: [any, any]): void { }
>foo : ([, b, ]: [any, any]) => void
>b : any
function bar([z, , , ]) { }
>bar : ([z, , , ]: [any, any, any]) => void
>z : any
function bar1([z, , , ] = [1, 3, 4, 6, 7]) { }
>bar1 : ([z, , , ]?: [number, number, number, number, number]) => void
>z : number
>[1, 3, 4, 6, 7] : [number, number, number, number, number]
function bar2([,,z, , , ]) { }
>bar2 : ([,,z, , , ]: [any, any, any, any, any]) => void
>z : any

View file

@ -0,0 +1,15 @@
//// [declarationEmitDestructuringArrayPattern5.ts]
var [, , z] = [1, 2, 4];
var [, a, , ] = [3, 4, 5];
var [, , [, b, ]] = [3,5,[0, 1]];
//// [declarationEmitDestructuringArrayPattern5.js]
var _a = [1, 2, 4], z = _a[2];
var _b = [3, 4, 5], a = _b[1];
var _c = [3, 5, [0, 1]], _d = _c[2], b = _d[1];
//// [declarationEmitDestructuringArrayPattern5.d.ts]
declare var z: number;
declare var a: number;
declare var b: number;

View file

@ -0,0 +1,14 @@
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern5.ts ===
var [, , z] = [1, 2, 4];
>z : number
>[1, 2, 4] : [number, number, number]
var [, a, , ] = [3, 4, 5];
>a : number
>[3, 4, 5] : [number, number, number]
var [, , [, b, ]] = [3,5,[0, 1]];
>b : number
>[3,5,[0, 1]] : [number, number, [number, number]]
>[0, 1] : [number, number]

View file

@ -25,8 +25,8 @@ function foo2() {
//// [declarationEmitDestructuringOptionalBindingParametersInOverloads.d.ts]
declare function foo(_0?: [string, number, boolean]): any;
declare function foo2(_0?: {
declare function foo([x, y, z]?: [string, number, boolean]): any;
declare function foo2({x, y, z}?: {
x: string;
y: number;
z: boolean;

View file

@ -43,12 +43,12 @@ var C3 = (function () {
//// [declarationEmitDestructuringParameterProperties.d.ts]
declare class C1 {
x: string, y: string, z: string;
constructor(_0: string[]);
constructor([x, y, z]: string[]);
}
declare type TupleType1 = [string, number, boolean];
declare class C2 {
x: string, y: number, z: boolean;
constructor(_0: TupleType1);
constructor([x, y, z]: TupleType1);
}
declare type ObjType1 = {
x: number;
@ -57,5 +57,5 @@ declare type ObjType1 = {
};
declare class C3 {
x: number, y: string, z: boolean;
constructor(_0: ObjType1);
constructor({x, y, z}: ObjType1);
}

View file

@ -14,8 +14,8 @@ function foo1(_a) {
//// [declarationEmitDestructuringWithOptionalBindingParameters.d.ts]
declare function foo(_0?: [string, number, boolean]): void;
declare function foo1(_0?: {
declare function foo([x, y, z]?: [string, number, boolean]): void;
declare function foo1({x, y, z}?: {
x: string;
y: number;
z: boolean;

View file

@ -1,12 +0,0 @@
tests/cases/conformance/es6/destructuring/declarationInAmbientContext.ts(1,13): error TS1183: Destructuring declarations are not allowed in ambient contexts.
tests/cases/conformance/es6/destructuring/declarationInAmbientContext.ts(2,13): error TS1183: Destructuring declarations are not allowed in ambient contexts.
==== tests/cases/conformance/es6/destructuring/declarationInAmbientContext.ts (2 errors) ====
declare var [a, b]; // Error, destructuring declaration not allowed in ambient context
~~~~~~
!!! error TS1183: Destructuring declarations are not allowed in ambient contexts.
declare var {c, d}; // Error, destructuring declaration not allowed in ambient context
~~~~~~
!!! error TS1183: Destructuring declarations are not allowed in ambient contexts.

View file

@ -0,0 +1,9 @@
=== tests/cases/conformance/es6/destructuring/declarationInAmbientContext.ts ===
declare var [a, b]; // Error, destructuring declaration not allowed in ambient context
>a : any
>b : any
declare var {c, d}; // Error, destructuring declaration not allowed in ambient context
>c : any
>d : any

View file

@ -0,0 +1,10 @@
tests/cases/compiler/separateCompilationAmbientConstEnum.ts(3,20): error TS1209: Ambient const enums are not allowed when the '--separateCompilation' flag is provided.
==== tests/cases/compiler/separateCompilationAmbientConstEnum.ts (1 errors) ====
declare const enum E { X = 1}
~
!!! error TS1209: Ambient const enums are not allowed when the '--separateCompilation' flag is provided.
export var y;

View file

@ -0,0 +1,8 @@
//// [separateCompilationAmbientConstEnum.ts]
declare const enum E { X = 1}
export var y;
//// [separateCompilationAmbientConstEnum.js]
export var y;

View file

@ -0,0 +1,7 @@
error TS5044: Option 'declaration' cannot be specified with option 'separateCompilation'.
!!! error TS5044: Option 'declaration' cannot be specified with option 'separateCompilation'.
==== tests/cases/compiler/separateCompilationDeclaration.ts (0 errors) ====
export var x;

View file

@ -0,0 +1,10 @@
//// [separateCompilationDeclaration.ts]
export var x;
//// [separateCompilationDeclaration.js]
export var x;
//// [separateCompilationDeclaration.d.ts]
export declare var x: any;

View file

@ -0,0 +1,5 @@
//// [separateCompilationES6.ts]
export var x;
//// [separateCompilationES6.js]
export var x;

View file

@ -0,0 +1,4 @@
=== tests/cases/compiler/separateCompilationES6.ts ===
export var x;
>x : any

View file

@ -0,0 +1,28 @@
tests/cases/compiler/separateCompilationImportExportElision.ts(2,17): error TS2307: Cannot find external module 'module'.
tests/cases/compiler/separateCompilationImportExportElision.ts(3,18): error TS2307: Cannot find external module 'module'.
tests/cases/compiler/separateCompilationImportExportElision.ts(4,21): error TS2307: Cannot find external module 'module'.
tests/cases/compiler/separateCompilationImportExportElision.ts(12,18): error TS2307: Cannot find external module 'module'.
==== tests/cases/compiler/separateCompilationImportExportElision.ts (4 errors) ====
import {c} from "module"
~~~~~~~~
!!! error TS2307: Cannot find external module 'module'.
import {c2} from "module"
~~~~~~~~
!!! error TS2307: Cannot find external module 'module'.
import * as ns from "module"
~~~~~~~~
!!! error TS2307: Cannot find external module 'module'.
class C extends c2.C {
}
let x = new c();
let y = ns.value;
export {c1} from "module";
~~~~~~~~
!!! error TS2307: Cannot find external module 'module'.
export var z = x;

View file

@ -0,0 +1,37 @@
//// [separateCompilationImportExportElision.ts]
import {c} from "module"
import {c2} from "module"
import * as ns from "module"
class C extends c2.C {
}
let x = new c();
let y = ns.value;
export {c1} from "module";
export var z = x;
//// [separateCompilationImportExportElision.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var module_1 = require("module");
var module_2 = require("module");
var ns = require("module");
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
}
return C;
})(module_2.c2.C);
var x = new module_1.c();
var y = ns.value;
var module_3 = require("module");
exports.c1 = module_3.c1;
exports.z = x;

View file

@ -0,0 +1,7 @@
error TS5045: Option 'noEmitOnError' cannot be specified with option 'separateCompilation'.
!!! error TS5045: Option 'noEmitOnError' cannot be specified with option 'separateCompilation'.
==== tests/cases/compiler/separateCompilationNoEmitOnError.ts (0 errors) ====
export var x;

View file

@ -0,0 +1,8 @@
tests/cases/compiler/separateCompilationNoExternalModule.ts(2,1): error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
==== tests/cases/compiler/separateCompilationNoExternalModule.ts (1 errors) ====
var x;
~~~
!!! error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.

View file

@ -0,0 +1,6 @@
//// [separateCompilationNoExternalModule.ts]
var x;
//// [separateCompilationNoExternalModule.js]
var x;

View file

@ -0,0 +1,14 @@
//// [separateCompilationNonAmbientConstEnum.ts]
const enum E { X = 100 };
var e = E.X;
export var x;
//// [separateCompilationNonAmbientConstEnum.js]
var E;
(function (E) {
E[E["X"] = 100] = "X";
})(E || (E = {}));
;
var e = E.X;
export var x;

View file

@ -0,0 +1,15 @@
=== tests/cases/compiler/separateCompilationNonAmbientConstEnum.ts ===
const enum E { X = 100 };
>E : E
>X : E
var e = E.X;
>e : E
>E.X : E
>E : typeof E
>X : E
export var x;
>x : any

View file

@ -0,0 +1,12 @@
error TS5046: Option 'out' cannot be specified with option 'separateCompilation'.
tests/cases/compiler/file2.ts(1,1): error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
!!! error TS5046: Option 'out' cannot be specified with option 'separateCompilation'.
==== tests/cases/compiler/file1.ts (0 errors) ====
export var x;
==== tests/cases/compiler/file2.ts (1 errors) ====
var y;
~~~
!!! error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.

View file

@ -0,0 +1,12 @@
//// [tests/cases/compiler/separateCompilationOut.ts] ////
//// [file1.ts]
export var x;
//// [file2.ts]
var y;
//// [file1.js]
export var x;
//// [all.js]
var y;

View file

@ -0,0 +1,7 @@
error TS5043: Option 'sourceMap' cannot be specified with option 'separateCompilation'.
!!! error TS5043: Option 'sourceMap' cannot be specified with option 'separateCompilation'.
==== tests/cases/compiler/separateCompilationSourceMap.ts (0 errors) ====
export var x;

View file

@ -0,0 +1,7 @@
//// [separateCompilationSourceMap.ts]
export var x;
//// [separateCompilationSourceMap.js]
export var x;
//# sourceMappingURL=separateCompilationSourceMap.js.map

View file

@ -0,0 +1,2 @@
//// [separateCompilationSourceMap.js.map]
{"version":3,"file":"separateCompilationSourceMap.js","sourceRoot":"","sources":["separateCompilationSourceMap.ts"],"names":[],"mappings":"AACA,WAAW,CAAC,CAAC"}

View file

@ -0,0 +1,27 @@
===================================================================
JsFile: separateCompilationSourceMap.js
mapUrl: separateCompilationSourceMap.js.map
sourceRoot:
sources: separateCompilationSourceMap.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/separateCompilationSourceMap.js
sourceFile:separateCompilationSourceMap.ts
-------------------------------------------------------------------
>>>export var x;
1 >
2 >^^^^^^^^^^^
3 > ^
4 > ^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >export var
3 > x
4 > ;
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(1, 12) Source(2, 12) + SourceIndex(0)
3 >Emitted(1, 13) Source(2, 13) + SourceIndex(0)
4 >Emitted(1, 14) Source(2, 14) + SourceIndex(0)
---
>>>//# sourceMappingURL=separateCompilationSourceMap.js.map

View file

@ -0,0 +1,5 @@
//// [separateCompilationSpecifiedModule.ts]
export var x;
//// [separateCompilationSpecifiedModule.js]
exports.x;

View file

@ -0,0 +1,4 @@
=== tests/cases/compiler/separateCompilationSpecifiedModule.ts ===
export var x;
>x : any

View file

@ -0,0 +1,6 @@
error TS5047: Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.
!!! error TS5047: Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.
==== tests/cases/compiler/separateCompilationUnspecifiedModule.ts (0 errors) ====
export var x;

View file

@ -0,0 +1,5 @@
//// [separateCompilationUnspecifiedModule.ts]
export var x;
//// [separateCompilationUnspecifiedModule.js]
exports.x;

View file

@ -0,0 +1,11 @@
//// [tests/cases/compiler/separateCompilationWithDeclarationFile.ts] ////
//// [file1.d.ts]
declare function foo(): void;
//// [file1.ts]
export var x;
//// [file1.js]
export var x;

View file

@ -0,0 +1,9 @@
=== tests/cases/compiler/file1.d.ts ===
declare function foo(): void;
>foo : () => void
=== tests/cases/compiler/file1.ts ===
export var x;
>x : any

View file

@ -0,0 +1,5 @@
// @declaration: true
function foo([a, b, c]: [string, string, string]): void { }
function far([a, [b], [[c]]]: [number, boolean[], string[][]]): void { }
function bar({a1, b1, c1}: { a1: number, b1: boolean, c1: string }): void { }
function baz({a2, b2: {b1, c1}}: { a2: number, b2: { b1: boolean, c1: string } }): void { }

View file

@ -0,0 +1,5 @@
// @declaration: true
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}}]){ }
function h1([a, [b], [[c]], {x = 10, y = [1, 2, 3], z: {a1, b1}}]){ }

View file

@ -0,0 +1,4 @@
// @declaration: true
function bar([x, z, ...w]) { }
function foo([x, ...y] = [1, "string", true]) { }

View file

@ -0,0 +1,11 @@
// @declaration: true
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz([]) { }
function baz1([] = [1,2,3]) { }
function baz2([[]] = [[1,2,3]]) { }
function baz3({}) { }
function baz4({} = { x: 10 }) { }

View file

@ -0,0 +1,6 @@
// @declaration: true
function baz([, z, , ]) { }
function foo([, b, ]: [any, any]): void { }
function bar([z, , , ]) { }
function bar1([z, , , ] = [1, 3, 4, 6, 7]) { }
function bar2([,,z, , , ]) { }

View file

@ -0,0 +1,4 @@
// @declaration: true
var [, , z] = [1, 2, 4];
var [, a, , ] = [3, 4, 5];
var [, , [, b, ]] = [3,5,[0, 1]];

View file

@ -0,0 +1,7 @@
// @separateCompilation: true
// @target: es6
// @filename: file1.ts
declare const enum E { X = 1}
export var y;

View file

@ -0,0 +1,6 @@
// @separateCompilation: true
// @declaration: true
// @target: es6
// @filename: file1.ts
export var x;

View file

@ -0,0 +1,4 @@
// @separateCompilation: true
// @target: es6
// @filename: file1.ts
export var x;

View file

@ -0,0 +1,17 @@
// @separateCompilation: true
// @target: es5
// @module: commonjs
// @filename: file1.ts
import {c} from "module"
import {c2} from "module"
import * as ns from "module"
class C extends c2.C {
}
let x = new c();
let y = ns.value;
export {c1} from "module";
export var z = x;

View file

@ -0,0 +1,6 @@
// @separateCompilation: true
// @noEmitOnError:true
// @target: es6
// @filename: file1.ts
export var x;

View file

@ -0,0 +1,5 @@
// @separateCompilation: true
// @target: es6
// @filename: file1.ts
var x;

View file

@ -0,0 +1,7 @@
// @separateCompilation: true
// @target: es6
// @filename: file1.ts
const enum E { X = 100 };
var e = E.X;
export var x;

View file

@ -0,0 +1,8 @@
// @separateCompilation: true
// @out:all.js
// @target: es6
// @filename: file1.ts
export var x;
// @filename: file2.ts
var y;

View file

@ -0,0 +1,6 @@
// @separateCompilation: true
// @sourceMap:sourcemap.map
// @target: es6
// @filename: file1.ts
export var x;

View file

@ -0,0 +1,4 @@
// @separateCompilation: true
// @module: commonjs
// @filename: file1.ts
export var x;

View file

@ -0,0 +1,3 @@
// @separateCompilation: true
// @filename: file1.ts
export var x;

View file

@ -0,0 +1,8 @@
// @separateCompilation: true
// @target: es6
// @filename: file1.d.ts
declare function foo(): void;
// @filename: file1.ts
export var x;