mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into testPerf
This commit is contained in:
Vendored
+2
@@ -4766,6 +4766,7 @@ interface PromiseLike<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4779,6 +4780,7 @@ interface Promise<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
|
||||
Vendored
+2
@@ -4766,6 +4766,7 @@ interface PromiseLike<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4779,6 +4780,7 @@ interface Promise<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
|
||||
+244
-157
@@ -431,9 +431,13 @@ var ts;
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
if (path.lastIndexOf("file:///", 0) === 0) {
|
||||
return "file:///".length;
|
||||
}
|
||||
var idx = path.indexOf('://');
|
||||
if (idx !== -1)
|
||||
return idx + 3;
|
||||
if (idx !== -1) {
|
||||
return idx + "://".length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ts.getRootLength = getRootLength;
|
||||
@@ -584,10 +588,11 @@ var ts;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
var supportedExtensions = [".d.ts", ".ts", ".js"];
|
||||
ts.supportedExtensions = [".ts", ".d.ts"];
|
||||
var extensionsToRemove = [".d.ts", ".ts", ".js"];
|
||||
function removeFileExtension(path) {
|
||||
for (var _i = 0; _i < supportedExtensions.length; _i++) {
|
||||
var ext = supportedExtensions[_i];
|
||||
for (var _i = 0; _i < extensionsToRemove.length; _i++) {
|
||||
var ext = extensionsToRemove[_i];
|
||||
if (fileExtensionIs(path, ext)) {
|
||||
return path.substr(0, path.length - ext.length);
|
||||
}
|
||||
@@ -1277,6 +1282,8 @@ var ts;
|
||||
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
|
||||
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
|
||||
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
|
||||
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
|
||||
Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@@ -1356,8 +1363,8 @@ var ts;
|
||||
Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
|
||||
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
|
||||
Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.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: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
|
||||
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.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: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
|
||||
@@ -1377,7 +1384,7 @@ var ts;
|
||||
Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." },
|
||||
Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
|
||||
Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.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: ts.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: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." },
|
||||
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
@@ -1410,7 +1417,7 @@ var ts;
|
||||
Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
|
||||
Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." },
|
||||
File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." },
|
||||
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.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: ts.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: ts.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: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
|
||||
Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
|
||||
@@ -1431,7 +1438,6 @@ var ts;
|
||||
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
|
||||
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
|
||||
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
|
||||
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
|
||||
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
|
||||
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
@@ -3067,6 +3073,9 @@ var ts;
|
||||
else if (ts.isBlockOrCatchScoped(node)) {
|
||||
bindBlockScopedVariableDeclaration(node);
|
||||
}
|
||||
else if (ts.isParameterDeclaration(node)) {
|
||||
bindDeclaration(node, 1, 107455, false);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, 1, 107454, false);
|
||||
}
|
||||
@@ -3591,9 +3600,6 @@ var ts;
|
||||
case 141:
|
||||
case 143:
|
||||
case 144:
|
||||
case 163:
|
||||
case 164:
|
||||
case 201:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4175,6 +4181,18 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
ts.isModifier = isModifier;
|
||||
function isParameterDeclaration(node) {
|
||||
var root = getRootDeclaration(node);
|
||||
return root.kind === 130;
|
||||
}
|
||||
ts.isParameterDeclaration = isParameterDeclaration;
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
ts.getRootDeclaration = getRootDeclaration;
|
||||
function nodeStartsNewLexicalEnvironment(n) {
|
||||
return isFunctionLike(n) || n.kind === 206 || n.kind === 228;
|
||||
}
|
||||
@@ -5497,13 +5515,6 @@ var ts;
|
||||
return token === t && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
function nextTokenCanFollowModifier() {
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
function parseAnyContextualModifier() {
|
||||
return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier);
|
||||
}
|
||||
function nextTokenCanFollowContextualModifier() {
|
||||
if (token === 70) {
|
||||
return nextToken() === 77;
|
||||
}
|
||||
@@ -5520,6 +5531,9 @@ var ts;
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
function parseAnyContextualModifier() {
|
||||
return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
function canFollowModifier() {
|
||||
return token === 18
|
||||
|| token === 14
|
||||
@@ -8583,7 +8597,6 @@ var ts;
|
||||
var undefinedType = createIntrinsicType(32 | 262144, "undefined");
|
||||
var nullType = createIntrinsicType(64 | 262144, "null");
|
||||
var unknownType = createIntrinsicType(1, "unknown");
|
||||
var resolvingType = createIntrinsicType(1, "__resolving__");
|
||||
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
@@ -8613,6 +8626,8 @@ var ts;
|
||||
var emitExtends = false;
|
||||
var emitDecorate = false;
|
||||
var emitParam = false;
|
||||
var resolutionTargets = [];
|
||||
var resolutionResults = [];
|
||||
var mergedSymbols = [];
|
||||
var symbolLinks = [];
|
||||
var nodeLinks = [];
|
||||
@@ -8832,9 +8847,9 @@ var ts;
|
||||
}
|
||||
else if (location.kind === 228 ||
|
||||
(location.kind === 206 && location.name.kind === 8)) {
|
||||
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931);
|
||||
result = getSymbolOfNode(location).exports["default"];
|
||||
var localSymbol = ts.getLocalSymbolForExportDefault(result);
|
||||
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
|
||||
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
|
||||
break loop;
|
||||
}
|
||||
result = undefined;
|
||||
@@ -9163,7 +9178,8 @@ var ts;
|
||||
}
|
||||
var symbol;
|
||||
if (name.kind === 65) {
|
||||
symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name);
|
||||
var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
|
||||
symbol = resolveName(name, name.text, meaning, message, name);
|
||||
if (!symbol) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -9206,10 +9222,11 @@ var ts;
|
||||
return symbol;
|
||||
}
|
||||
}
|
||||
var fileName;
|
||||
var sourceFile;
|
||||
while (true) {
|
||||
var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName));
|
||||
sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts");
|
||||
fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName));
|
||||
sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); });
|
||||
if (sourceFile || isRelative) {
|
||||
break;
|
||||
}
|
||||
@@ -10134,14 +10151,28 @@ var ts;
|
||||
});
|
||||
}
|
||||
}
|
||||
function getRootDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
function pushTypeResolution(target) {
|
||||
var i = 0;
|
||||
var count = resolutionTargets.length;
|
||||
while (i < count && resolutionTargets[i] !== target) {
|
||||
i++;
|
||||
}
|
||||
return node;
|
||||
if (i < count) {
|
||||
do {
|
||||
resolutionResults[i++] = false;
|
||||
} while (i < count);
|
||||
return false;
|
||||
}
|
||||
resolutionTargets.push(target);
|
||||
resolutionResults.push(true);
|
||||
return true;
|
||||
}
|
||||
function popTypeResolution() {
|
||||
resolutionTargets.pop();
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
function getDeclarationContainer(node) {
|
||||
node = getRootDeclaration(node);
|
||||
node = ts.getRootDeclaration(node);
|
||||
return node.kind === 199 ? node.parent.parent.parent : node.parent;
|
||||
}
|
||||
function getTypeOfPrototypeProperty(prototype) {
|
||||
@@ -10291,7 +10322,7 @@ var ts;
|
||||
}
|
||||
type = declaration.dotDotDotToken ? anyArrayType : anyType;
|
||||
if (reportErrors && compilerOptions.noImplicitAny) {
|
||||
var root = getRootDeclaration(declaration);
|
||||
var root = ts.getRootDeclaration(declaration);
|
||||
if (!isPrivateWithinAmbient(root) && !(root.kind === 130 && isPrivateWithinAmbient(root.parent))) {
|
||||
reportImplicitAnyError(declaration, type);
|
||||
}
|
||||
@@ -10311,20 +10342,23 @@ var ts;
|
||||
if (declaration.kind === 215) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var diagnostic = symbol.valueDeclaration.type ?
|
||||
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
|
||||
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
|
||||
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
if (symbol.valueDeclaration.type) {
|
||||
type = unknownType;
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
||||
}
|
||||
else {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@@ -10345,13 +10379,10 @@ var ts;
|
||||
}
|
||||
function getTypeOfAccessors(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
checkAndStoreTypeOfAccessors(symbol, links);
|
||||
return links.type;
|
||||
}
|
||||
function checkAndStoreTypeOfAccessors(symbol, links) {
|
||||
links = links || getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
var getter = ts.getDeclarationOfKind(symbol, 137);
|
||||
var setter = ts.getDeclarationOfKind(symbol, 138);
|
||||
var type;
|
||||
@@ -10376,17 +10407,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var getter = ts.getDeclarationOfKind(symbol, 137);
|
||||
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var getter_1 = ts.getDeclarationOfKind(symbol, 137);
|
||||
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
function getTypeOfFuncClassEnumModule(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
@@ -10405,7 +10435,10 @@ var ts;
|
||||
function getTypeOfAlias(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = getTypeOfSymbol(resolveAlias(symbol));
|
||||
var targetSymbol = resolveAlias(symbol);
|
||||
links.type = targetSymbol.flags & 107455
|
||||
? getTypeOfSymbol(targetSymbol)
|
||||
: unknownType;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@@ -10548,17 +10581,16 @@ var ts;
|
||||
function getDeclaredTypeOfTypeAlias(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
links.declaredType = resolvingType;
|
||||
if (!pushTypeResolution(links)) {
|
||||
return unknownType;
|
||||
}
|
||||
var declaration = ts.getDeclarationOfKind(symbol, 204);
|
||||
var type = getTypeFromTypeNode(declaration.type);
|
||||
if (links.declaredType === resolvingType) {
|
||||
links.declaredType = type;
|
||||
if (!popTypeResolution()) {
|
||||
type = unknownType;
|
||||
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
else if (links.declaredType === resolvingType) {
|
||||
links.declaredType = unknownType;
|
||||
var declaration = ts.getDeclarationOfKind(symbol, 204);
|
||||
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
links.declaredType = type;
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
@@ -11097,7 +11129,9 @@ var ts;
|
||||
}
|
||||
function getReturnTypeOfSignature(signature) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!pushTypeResolution(signature)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type;
|
||||
if (signature.target) {
|
||||
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
|
||||
@@ -11108,21 +11142,19 @@ var ts;
|
||||
else {
|
||||
type = getReturnTypeFromBody(signature.declaration);
|
||||
}
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
}
|
||||
else if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
}
|
||||
}
|
||||
}
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
return signature.resolvedReturnType;
|
||||
}
|
||||
@@ -11420,7 +11452,13 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
var removeSubtypesStack = [];
|
||||
function removeSubtypes(types) {
|
||||
var typeListId = getTypeListId(types);
|
||||
if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) {
|
||||
return;
|
||||
}
|
||||
removeSubtypesStack.push(typeListId);
|
||||
var i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
@@ -11428,6 +11466,7 @@ var ts;
|
||||
types.splice(i, 1);
|
||||
}
|
||||
}
|
||||
removeSubtypesStack.pop();
|
||||
}
|
||||
function containsAnyType(types) {
|
||||
for (var _i = 0; _i < types.length; _i++) {
|
||||
@@ -12983,16 +13022,33 @@ var ts;
|
||||
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
|
||||
return type;
|
||||
}
|
||||
var targetType;
|
||||
var prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (!prototypeProperty) {
|
||||
return type;
|
||||
if (prototypeProperty) {
|
||||
var prototypePropertyType = getTypeOfSymbol(prototypeProperty);
|
||||
if (prototypePropertyType !== anyType) {
|
||||
targetType = prototypePropertyType;
|
||||
}
|
||||
}
|
||||
var targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
if (!targetType) {
|
||||
var constructSignatures;
|
||||
if (rightType.flags & 2048) {
|
||||
constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures;
|
||||
}
|
||||
else if (rightType.flags & 32768) {
|
||||
constructSignatures = getSignaturesOfType(rightType, 1);
|
||||
}
|
||||
if (constructSignatures && constructSignatures.length) {
|
||||
targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); }));
|
||||
}
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
if (targetType) {
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
if (type.flags & 16384) {
|
||||
return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); }));
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -14372,10 +14428,9 @@ var ts;
|
||||
if (isContextSensitive(node)) {
|
||||
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
|
||||
}
|
||||
if (!node.type) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!node.type && !signature.resolvedReturnType) {
|
||||
var returnType = getReturnTypeFromBody(node, contextualMapper);
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = returnType;
|
||||
}
|
||||
}
|
||||
@@ -15156,7 +15211,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
|
||||
getTypeOfAccessors(getSymbolOfNode(node));
|
||||
}
|
||||
checkFunctionLikeDeclaration(node);
|
||||
}
|
||||
@@ -15632,7 +15687,7 @@ var ts;
|
||||
if (ts.isInAmbientContext(node)) {
|
||||
return false;
|
||||
}
|
||||
var root = getRootDeclaration(node);
|
||||
var root = ts.getRootDeclaration(node);
|
||||
if (root.kind === 130 && ts.nodeIsMissing(root.parent.body)) {
|
||||
return false;
|
||||
}
|
||||
@@ -15693,7 +15748,7 @@ var ts;
|
||||
// - ScriptBody : StatementList
|
||||
// It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList
|
||||
// also occurs in the VarDeclaredNames of StatementList.
|
||||
if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) {
|
||||
if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || ts.isParameterDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
if (node.kind === 199 && !node.initializer) {
|
||||
@@ -15723,14 +15778,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function isParameterDeclaration(node) {
|
||||
while (node.kind === 153) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node.kind === 130;
|
||||
}
|
||||
function checkParameterInitializer(node) {
|
||||
if (getRootDeclaration(node).kind !== 130) {
|
||||
if (ts.getRootDeclaration(node).kind !== 130) {
|
||||
return;
|
||||
}
|
||||
var func = ts.getContainingFunction(node);
|
||||
@@ -15769,7 +15818,7 @@ var ts;
|
||||
if (ts.isBindingPattern(node.name)) {
|
||||
ts.forEach(node.name.elements, checkSourceElement);
|
||||
}
|
||||
if (node.initializer && getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
||||
if (node.initializer && ts.getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
||||
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
||||
return;
|
||||
}
|
||||
@@ -21224,7 +21273,7 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function emitListWithSpread(elements, multiLine, trailingComma) {
|
||||
function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) {
|
||||
var pos = 0;
|
||||
var group = 0;
|
||||
var length = elements.length;
|
||||
@@ -21240,6 +21289,9 @@ var ts;
|
||||
e = e.expression;
|
||||
emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e));
|
||||
pos++;
|
||||
if (pos === length && group === 0 && alwaysCopy && e.kind !== 154) {
|
||||
write(".slice()");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var i = pos;
|
||||
@@ -21277,7 +21329,7 @@ var ts;
|
||||
write("]");
|
||||
}
|
||||
else {
|
||||
emitListWithSpread(elements, (node.flags & 512) !== 0, elements.hasTrailingComma);
|
||||
emitListWithSpread(elements, true, (node.flags & 512) !== 0, elements.hasTrailingComma);
|
||||
}
|
||||
}
|
||||
function emitObjectLiteralBody(node, numElements) {
|
||||
@@ -21603,7 +21655,7 @@ var ts;
|
||||
write("void 0");
|
||||
}
|
||||
write(", ");
|
||||
emitListWithSpread(node.arguments, false, false);
|
||||
emitListWithSpread(node.arguments, false, false, false);
|
||||
write(")");
|
||||
}
|
||||
function emitCallExpression(node) {
|
||||
@@ -22231,7 +22283,7 @@ var ts;
|
||||
if (node.flags & 1) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
if (compilerOptions.module === 4) {
|
||||
if (compilerOptions.module === 4 && node.parent === currentSourceFile) {
|
||||
write(exportFunctionForFile + "(\"");
|
||||
if (node.flags & 256) {
|
||||
write("default");
|
||||
@@ -22569,12 +22621,14 @@ var ts;
|
||||
node.parent.kind === 228;
|
||||
}
|
||||
function emitVariableStatement(node) {
|
||||
var startIsEmitted = true;
|
||||
if (!(node.flags & 1)) {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
var startIsEmitted = false;
|
||||
if (node.flags & 1) {
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
else {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
if (startIsEmitted) {
|
||||
@@ -23240,15 +23294,6 @@ var ts;
|
||||
scopeEmitEnd();
|
||||
if (thisNodeIsDecorated) {
|
||||
write(";");
|
||||
if (node.name) {
|
||||
writeLine();
|
||||
write("Object.defineProperty(");
|
||||
emitDeclarationName(node);
|
||||
write(", \"name\", { value: \"");
|
||||
emitDeclarationName(node);
|
||||
write("\", configurable: true });");
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
if (isClassExpressionWithStaticProperties) {
|
||||
for (var _a = 0; _a < staticProperties.length; _a++) {
|
||||
@@ -23602,15 +23647,17 @@ var ts;
|
||||
if (!shouldEmitEnumDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
if (!(node.flags & 1) || isES6ExportedDeclaration(node)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
if (!shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
if (!(node.flags & 1) || 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);
|
||||
@@ -23632,7 +23679,7 @@ var ts;
|
||||
emitModuleMemberName(node);
|
||||
write(" = {}));");
|
||||
emitEnd(node);
|
||||
if (!isES6ExportedDeclaration(node) && node.flags & 1) {
|
||||
if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
@@ -23643,6 +23690,14 @@ var ts;
|
||||
write(";");
|
||||
}
|
||||
if (languageVersion < 2 && node.parent === currentSourceFile) {
|
||||
if (compilerOptions.module === 4 && (node.flags & 1)) {
|
||||
writeLine();
|
||||
write(exportFunctionForFile + "(\"");
|
||||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
}
|
||||
@@ -24229,12 +24284,25 @@ var ts;
|
||||
if (hoistedVars) {
|
||||
writeLine();
|
||||
write("var ");
|
||||
var seen = {};
|
||||
for (var i = 0; i < hoistedVars.length; ++i) {
|
||||
var local = hoistedVars[i];
|
||||
var name_21 = local.kind === 65
|
||||
? local
|
||||
: local.name;
|
||||
if (name_21) {
|
||||
var text = ts.unescapeIdentifier(name_21.text);
|
||||
if (ts.hasProperty(seen, text)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
seen[text] = text;
|
||||
}
|
||||
}
|
||||
if (i !== 0) {
|
||||
write(", ");
|
||||
}
|
||||
if (local.kind === 202 || local.kind === 206) {
|
||||
if (local.kind === 202 || local.kind === 206 || local.kind === 205) {
|
||||
emitDeclarationName(local);
|
||||
}
|
||||
else {
|
||||
@@ -24265,6 +24333,9 @@ var ts;
|
||||
}
|
||||
return exportedDeclarations;
|
||||
function visit(node) {
|
||||
if (node.flags & 2) {
|
||||
return;
|
||||
}
|
||||
if (node.kind === 201) {
|
||||
if (!hoistedFunctionDeclarations) {
|
||||
hoistedFunctionDeclarations = [];
|
||||
@@ -24279,24 +24350,35 @@ var ts;
|
||||
hoistedVars.push(node);
|
||||
return;
|
||||
}
|
||||
if (node.kind === 206 && shouldEmitModuleDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
if (node.kind === 205) {
|
||||
if (shouldEmitEnumDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (node.kind === 206) {
|
||||
if (shouldEmitModuleDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
}
|
||||
hoistedVars.push(node);
|
||||
return;
|
||||
}
|
||||
if (node.kind === 199 || node.kind === 153) {
|
||||
if (shouldHoistVariable(node, false)) {
|
||||
var name_21 = node.name;
|
||||
if (name_21.kind === 65) {
|
||||
var name_22 = node.name;
|
||||
if (name_22.kind === 65) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
hoistedVars.push(name_21);
|
||||
hoistedVars.push(name_22);
|
||||
}
|
||||
else {
|
||||
ts.forEachChild(name_21, visit);
|
||||
ts.forEachChild(name_22, visit);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -24966,7 +25048,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "1.5.0";
|
||||
ts.version = "1.5.2";
|
||||
var carriageReturnLineFeed = "\r\n";
|
||||
var lineFeed = "\n";
|
||||
function findConfigFile(searchPath) {
|
||||
@@ -25142,14 +25224,14 @@ var ts;
|
||||
if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) {
|
||||
return { diagnostics: [], sourceMaps: undefined, emitSkipped: true };
|
||||
}
|
||||
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
|
||||
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile);
|
||||
var start = new Date().getTime();
|
||||
var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile);
|
||||
ts.emitTime += new Date().getTime() - start;
|
||||
return emitResult;
|
||||
}
|
||||
function getSourceFile(fileName) {
|
||||
fileName = host.getCanonicalFileName(fileName);
|
||||
fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined;
|
||||
}
|
||||
function getDiagnosticsHelper(sourceFile, getDiagnostics) {
|
||||
@@ -25205,42 +25287,49 @@ var ts;
|
||||
function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {
|
||||
var start;
|
||||
var length;
|
||||
var extensions;
|
||||
var diagnosticArgument;
|
||||
if (refEnd !== undefined && refPos !== undefined) {
|
||||
start = refPos;
|
||||
length = refEnd - refPos;
|
||||
}
|
||||
var diagnostic;
|
||||
if (hasExtension(fileName)) {
|
||||
if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) {
|
||||
diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts;
|
||||
if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
|
||||
diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.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 (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
if (diagnostic) {
|
||||
if (refFile) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName));
|
||||
diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName));
|
||||
diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
}
|
||||
}
|
||||
function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) {
|
||||
var canonicalName = host.getCanonicalFileName(fileName);
|
||||
var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
|
||||
if (ts.hasProperty(filesByName, canonicalName)) {
|
||||
return getSourceFileFromCache(fileName, canonicalName, false);
|
||||
}
|
||||
@@ -25300,9 +25389,10 @@ var ts;
|
||||
var moduleNameText = moduleNameExpr.text;
|
||||
if (moduleNameText) {
|
||||
var searchPath = basePath;
|
||||
var searchName;
|
||||
while (true) {
|
||||
var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText));
|
||||
if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) {
|
||||
searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText));
|
||||
if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) {
|
||||
break;
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(searchPath);
|
||||
@@ -25322,10 +25412,7 @@ var ts;
|
||||
var moduleName = nameLiteral.text;
|
||||
if (moduleName) {
|
||||
var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName));
|
||||
var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral);
|
||||
if (!tsFile) {
|
||||
findModuleSourceFile(searchName + ".d.ts", nameLiteral);
|
||||
}
|
||||
ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -25415,10 +25502,10 @@ var ts;
|
||||
}
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -25556,7 +25643,7 @@ var ts;
|
||||
{
|
||||
name: "noEmitOnError",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported
|
||||
},
|
||||
{
|
||||
name: "noImplicitAny",
|
||||
|
||||
+303
-195
File diff suppressed because it is too large
Load Diff
Vendored
+1
@@ -1379,6 +1379,7 @@ declare module "typescript" {
|
||||
interface LanguageServiceHost {
|
||||
getCompilationSettings(): CompilerOptions;
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot;
|
||||
|
||||
+370
-202
File diff suppressed because it is too large
Load Diff
Vendored
+1
@@ -1379,6 +1379,7 @@ declare module ts {
|
||||
interface LanguageServiceHost {
|
||||
getCompilationSettings(): CompilerOptions;
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot;
|
||||
|
||||
+370
-202
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.2",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "Apache License 2.0",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+62
-30
@@ -88,6 +88,7 @@ module ts {
|
||||
let undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined");
|
||||
let nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null");
|
||||
let unknownType = createIntrinsicType(TypeFlags.Any, "unknown");
|
||||
let circularType = createIntrinsicType(TypeFlags.Any, "__circular__");
|
||||
|
||||
let emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
let anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
@@ -803,7 +804,9 @@ module ts {
|
||||
|
||||
let symbol: Symbol;
|
||||
if (name.kind === SyntaxKind.Identifier) {
|
||||
symbol = resolveName(name, (<Identifier>name).text, meaning, Diagnostics.Cannot_find_name_0, <Identifier>name);
|
||||
let message = meaning === SymbolFlags.Namespace ? Diagnostics.Cannot_find_namespace_0 : Diagnostics.Cannot_find_name_0;
|
||||
|
||||
symbol = resolveName(name, (<Identifier>name).text, meaning, message, <Identifier>name);
|
||||
if (!symbol) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -855,10 +858,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;
|
||||
}
|
||||
@@ -2048,13 +2052,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);
|
||||
|
||||
@@ -2412,7 +2409,16 @@ module ts {
|
||||
function getTypeOfAlias(symbol: Symbol): Type {
|
||||
let links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = getTypeOfSymbol(resolveAlias(symbol));
|
||||
let targetSymbol = resolveAlias(symbol);
|
||||
|
||||
// It only makes sense to get the type of a value symbol. If the result of resolving
|
||||
// the alias is not a value, then it has no type. To get the type associated with a
|
||||
// type symbol, call getDeclaredTypeOfSymbol.
|
||||
// This check is important because without it, a call to getTypeOfSymbol could end
|
||||
// up recursively calling getTypeOfAlias, causing a stack overflow.
|
||||
links.type = targetSymbol.flags & SymbolFlags.Value
|
||||
? getTypeOfSymbol(targetSymbol)
|
||||
: unknownType;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@@ -3632,10 +3638,20 @@ module ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
// Subtype reduction is basically an optimization we do to avoid excessively large union types, which take longer
|
||||
// to process and look strange in quick info and error messages. Semantically there is no difference between the
|
||||
// reduced type and the type itself. So, when we detect a circularity we simply say that the reduced type is the
|
||||
// type itself.
|
||||
function getReducedTypeOfUnionType(type: UnionType): Type {
|
||||
// If union type was created without subtype reduction, perform the deferred reduction now
|
||||
if (!type.reducedType) {
|
||||
type.reducedType = getUnionType(type.types, /*noSubtypeReduction*/ false);
|
||||
type.reducedType = circularType;
|
||||
let reducedType = getUnionType(type.types, /*noSubtypeReduction*/ false);
|
||||
if (type.reducedType === circularType) {
|
||||
type.reducedType = reducedType;
|
||||
}
|
||||
}
|
||||
else if (type.reducedType === circularType) {
|
||||
type.reducedType = type;
|
||||
}
|
||||
return type.reducedType;
|
||||
}
|
||||
@@ -5382,20 +5398,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) {
|
||||
return type;
|
||||
if (prototypeProperty) {
|
||||
// Target type is type of the protoype property
|
||||
let prototypePropertyType = getTypeOfSymbol(prototypeProperty);
|
||||
if (prototypePropertyType !== anyType) {
|
||||
targetType = prototypePropertyType;
|
||||
}
|
||||
}
|
||||
let targetType = getTypeOfSymbol(prototypeProperty);
|
||||
// Narrow to target type if it is a subtype of current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
|
||||
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))));
|
||||
}
|
||||
}
|
||||
// If current type is a union type, remove all constituents that aren't subtypes of target type
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, targetType)));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -9180,13 +9219,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) {
|
||||
|
||||
@@ -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",
|
||||
|
||||
+17
-5
@@ -459,8 +459,18 @@ module ts {
|
||||
if (path.charCodeAt(2) === CharacterCodes.slash) return 3;
|
||||
return 2;
|
||||
}
|
||||
// Per RFC 1738 'file' URI schema has the shape file://<host>/<path>
|
||||
// if <host> is omitted then it is assumed that host value is 'localhost',
|
||||
// however slash after the omitted <host> is not removed.
|
||||
// file:///folder1/file1 - this is a correct URI
|
||||
// file://folder2/file2 - this is an incorrect URI
|
||||
if (path.lastIndexOf("file:///", 0) === 0) {
|
||||
return "file:///".length;
|
||||
}
|
||||
let idx = path.indexOf('://');
|
||||
if (idx !== -1) return idx + 3
|
||||
if (idx !== -1) {
|
||||
return idx + "://".length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -640,16 +650,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -364,6 +364,7 @@ module ts {
|
||||
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
|
||||
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
|
||||
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
|
||||
Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@@ -443,8 +444,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." },
|
||||
@@ -464,7 +465,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)" },
|
||||
@@ -497,7 +498,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." },
|
||||
|
||||
@@ -1444,6 +1444,10 @@
|
||||
"category": "Error",
|
||||
"code": 2502
|
||||
},
|
||||
"Cannot find namespace '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2503
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
@@ -1761,11 +1765,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
|
||||
},
|
||||
@@ -1846,7 +1850,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
|
||||
},
|
||||
@@ -1978,7 +1982,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
|
||||
},
|
||||
|
||||
+83
-37
@@ -139,7 +139,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
let exportEquals: ExportAssignment;
|
||||
let hasExportStars: boolean;
|
||||
|
||||
/** write emitted output to disk*/
|
||||
/** Write emitted output to disk */
|
||||
let writeEmittedFiles = writeJavaScriptFile;
|
||||
|
||||
let detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[];
|
||||
@@ -1366,7 +1366,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
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;
|
||||
@@ -1383,6 +1383,9 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
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;
|
||||
@@ -1422,7 +1425,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
write("]");
|
||||
}
|
||||
else {
|
||||
emitListWithSpread(elements, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0,
|
||||
emitListWithSpread(elements, /*alwaysCopy*/ true, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0,
|
||||
/*trailingComma*/ elements.hasTrailingComma);
|
||||
}
|
||||
}
|
||||
@@ -1847,7 +1850,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
write("void 0");
|
||||
}
|
||||
write(", ");
|
||||
emitListWithSpread(node.arguments, /*multiLine*/ false, /*trailingComma*/ false);
|
||||
emitListWithSpread(node.arguments, /*alwaysCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false);
|
||||
write(")");
|
||||
}
|
||||
|
||||
@@ -2639,7 +2642,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
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}("`);
|
||||
@@ -3055,13 +3059,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
}
|
||||
|
||||
function emitVariableStatement(node: VariableStatement) {
|
||||
let startIsEmitted = true;
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
let startIsEmitted = false;
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
// Exported ES6 module member
|
||||
write("export ");
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
// Exported ES6 module member
|
||||
write("export ");
|
||||
else {
|
||||
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
|
||||
}
|
||||
if (startIsEmitted) {
|
||||
@@ -3898,6 +3904,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||
scopeEmitEnd();
|
||||
|
||||
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
|
||||
|
||||
// For a decorated class, we need to assign its name (if it has one). This is because we emit
|
||||
// the class as a class expression to avoid the double-binding of the identifier:
|
||||
//
|
||||
@@ -3907,15 +3915,6 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
//
|
||||
if (thisNodeIsDecorated) {
|
||||
write(";");
|
||||
if (node.name) {
|
||||
writeLine();
|
||||
write("Object.defineProperty(");
|
||||
emitDeclarationName(node);
|
||||
write(", \"name\", { value: \"");
|
||||
emitDeclarationName(node);
|
||||
write("\", configurable: true });");
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
|
||||
// Emit static property assignment. Because classDeclaration is lexically evaluated,
|
||||
@@ -4380,15 +4379,18 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
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);
|
||||
@@ -4410,7 +4412,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
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 ");
|
||||
@@ -4421,6 +4424,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -5101,7 +5113,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
// 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)[];
|
||||
|
||||
@@ -5110,13 +5122,30 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
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);
|
||||
@@ -5150,6 +5179,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return exportedDeclarations;
|
||||
|
||||
function visit(node: Node): void {
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration) {
|
||||
if (!hoistedFunctionDeclarations) {
|
||||
hoistedFunctionDeclarations = [];
|
||||
@@ -5160,7 +5193,6 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
// TODO: rename block scoped classes
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
@@ -5169,12 +5201,26 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -957,15 +957,6 @@ module ts {
|
||||
}
|
||||
|
||||
function nextTokenCanFollowModifier() {
|
||||
nextToken();
|
||||
return canFollowModifier();
|
||||
}
|
||||
|
||||
function parseAnyContextualModifier(): boolean {
|
||||
return isModifier(token) && tryParse(nextTokenCanFollowContextualModifier);
|
||||
}
|
||||
|
||||
function nextTokenCanFollowContextualModifier() {
|
||||
if (token === SyntaxKind.ConstKeyword) {
|
||||
// 'const' is only a modifier if followed by 'enum'.
|
||||
return nextToken() === SyntaxKind.EnumKeyword;
|
||||
@@ -984,6 +975,10 @@ module ts {
|
||||
return canFollowModifier();
|
||||
}
|
||||
|
||||
function parseAnyContextualModifier(): boolean {
|
||||
return isModifier(token) && tryParse(nextTokenCanFollowModifier);
|
||||
}
|
||||
|
||||
function canFollowModifier(): boolean {
|
||||
return token === SyntaxKind.OpenBracketToken
|
||||
|| token === SyntaxKind.OpenBraceToken
|
||||
|
||||
+27
-17
@@ -8,7 +8,7 @@ module ts {
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
export const version = "1.5.0";
|
||||
export const version = "1.5.2";
|
||||
|
||||
const carriageReturnLineFeed = "\r\n";
|
||||
const lineFeed = "\n";
|
||||
@@ -226,7 +226,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();
|
||||
|
||||
@@ -240,7 +245,7 @@ module ts {
|
||||
}
|
||||
|
||||
function getSourceFile(fileName: string) {
|
||||
fileName = host.getCanonicalFileName(fileName);
|
||||
fileName = host.getCanonicalFileName(normalizeSlashes(fileName));
|
||||
return hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined;
|
||||
}
|
||||
|
||||
@@ -314,45 +319,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);
|
||||
@@ -424,9 +436,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);
|
||||
@@ -455,10 +468,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));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -571,10 +581,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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1149,6 +1146,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;
|
||||
|
||||
@@ -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
|
||||
@@ -1159,7 +1159,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);
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ class FourSlashRunner extends RunnerBase {
|
||||
this.tests = this.enumerateFiles(this.basePath, /\.ts/i, { recursive: false });
|
||||
}
|
||||
|
||||
describe(this.testSuiteName, () => {
|
||||
this.tests.forEach((fn: string) => {
|
||||
fn = ts.normalizeSlashes(fn);
|
||||
describe(fn, () => {
|
||||
fn = ts.normalizeSlashes(fn);
|
||||
var justName = fn.replace(/^.*[\\\/]/, '');
|
||||
|
||||
// Convert to relative path
|
||||
|
||||
+14
-11
@@ -45,11 +45,13 @@ module Utils {
|
||||
export function getExecutionEnvironment() {
|
||||
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
|
||||
return ExecutionEnvironment.CScript;
|
||||
} else if (process && process.execPath && process.execPath.indexOf("node") !== -1) {
|
||||
return ExecutionEnvironment.Node;
|
||||
} else {
|
||||
}
|
||||
else if (typeof window !== "undefined") {
|
||||
return ExecutionEnvironment.Browser;
|
||||
}
|
||||
else {
|
||||
return ExecutionEnvironment.Node;
|
||||
}
|
||||
}
|
||||
|
||||
export var currentExecutionEnvironment = getExecutionEnvironment();
|
||||
@@ -946,6 +948,7 @@ module Harness {
|
||||
options = options || { noResolve: false };
|
||||
options.target = options.target || ts.ScriptTarget.ES3;
|
||||
options.module = options.module || ts.ModuleKind.None;
|
||||
options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed;
|
||||
options.noErrorTruncation = true;
|
||||
if (lightMode) {
|
||||
options.noLibCheck = true;
|
||||
@@ -1044,19 +1047,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':
|
||||
@@ -1078,11 +1081,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':
|
||||
@@ -1106,7 +1109,7 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'stripinternal':
|
||||
options.stripInternal = !!setting.value;
|
||||
options.stripInternal = setting.value === 'true';
|
||||
|
||||
case 'usecasesensitivefilenames':
|
||||
useCaseSensitiveFileNames = setting.value === 'true';
|
||||
@@ -1117,7 +1120,7 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'emitbom':
|
||||
options.emitBOM = !!setting.value;
|
||||
options.emitBOM = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'errortruncation':
|
||||
|
||||
Vendored
+2
@@ -3580,6 +3580,7 @@ interface PromiseLike<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3593,6 +3594,7 @@ interface Promise<T> {
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
|
||||
@@ -398,7 +398,7 @@ module ts.server {
|
||||
|
||||
export class ProjectService {
|
||||
filenameToScriptInfo: ts.Map<ScriptInfo> = {};
|
||||
// open, non-configured root files
|
||||
// open, non-configured root files
|
||||
openFileRoots: ScriptInfo[] = [];
|
||||
// projects built from openFileRoots
|
||||
inferredProjects: Project[] = [];
|
||||
@@ -421,7 +421,7 @@ module ts.server {
|
||||
hostInfo: "Unknown host"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getFormatCodeOptions(file?: string) {
|
||||
if (file) {
|
||||
var info = this.filenameToScriptInfo[file];
|
||||
@@ -448,7 +448,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log(msg: string, type = "Err") {
|
||||
this.psLogger.msg(msg, type);
|
||||
}
|
||||
@@ -457,17 +457,17 @@ module ts.server {
|
||||
if (args.file) {
|
||||
var info = this.filenameToScriptInfo[args.file];
|
||||
if (info) {
|
||||
info.setFormatOptions(args.formatOptions);
|
||||
info.setFormatOptions(args.formatOptions);
|
||||
this.log("Host configuration update for file " + args.file, "Info");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (args.hostInfo !== undefined) {
|
||||
this.hostConfiguration.hostInfo = args.hostInfo;
|
||||
this.log("Host information " + args.hostInfo, "Info");
|
||||
this.log("Host information " + args.hostInfo, "Info");
|
||||
}
|
||||
if (args.formatOptions) {
|
||||
mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions);
|
||||
mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions);
|
||||
this.log("Format host information updated", "Info");
|
||||
}
|
||||
}
|
||||
@@ -487,7 +487,7 @@ module ts.server {
|
||||
|
||||
fileDeletedInFilesystem(info: ScriptInfo) {
|
||||
this.psLogger.info(info.fileName + " deleted");
|
||||
|
||||
|
||||
if (info.fileWatcher) {
|
||||
info.fileWatcher.close();
|
||||
info.fileWatcher = undefined;
|
||||
@@ -537,7 +537,7 @@ module ts.server {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
addOpenFile(info: ScriptInfo) {
|
||||
if (this.setConfiguredProjectRoot(info)) {
|
||||
this.openFileRootsConfigured.push(info);
|
||||
@@ -561,7 +561,7 @@ module ts.server {
|
||||
copyListRemovingItem(r.defaultProject, this.inferredProjects);
|
||||
// put r in referenced open file list
|
||||
this.openFilesReferenced.push(r);
|
||||
// set default project of r to the new project
|
||||
// set default project of r to the new project
|
||||
r.defaultProject = info.defaultProject;
|
||||
}
|
||||
else {
|
||||
@@ -694,7 +694,7 @@ module ts.server {
|
||||
this.openFilesReferenced = openFilesReferenced;
|
||||
|
||||
// Then, loop through all of the open files that are project roots.
|
||||
// For each root file, note the project that it roots. Then see if
|
||||
// For each root file, note the project that it roots. Then see if
|
||||
// any other projects newly reference the file. If zero projects
|
||||
// newly reference the file, keep it as a root. If one or more
|
||||
// projects newly references the file, remove its project from the
|
||||
@@ -719,7 +719,7 @@ module ts.server {
|
||||
|
||||
// Finally, if we found any open, referenced files that are no longer
|
||||
// referenced by their default project, treat them as newly opened
|
||||
// by the editor.
|
||||
// by the editor.
|
||||
for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) {
|
||||
this.addOpenFile(unattachedOpenFiles[i]);
|
||||
}
|
||||
@@ -809,7 +809,7 @@ module ts.server {
|
||||
}
|
||||
else {
|
||||
this.log("Opened configuration file " + configFileName,"Info");
|
||||
this.configuredProjects.push(configResult.project);
|
||||
this.configuredProjects.push(configResult.project);
|
||||
}
|
||||
}
|
||||
var info = this.openFile(fileName, true);
|
||||
@@ -901,22 +901,22 @@ module ts.server {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult {
|
||||
configFilename = ts.normalizePath(configFilename);
|
||||
// file references will be relative to dirPath (or absolute)
|
||||
var dirPath = ts.getDirectoryPath(configFilename);
|
||||
var rawConfig = <ProjectOptions>ts.readConfigFile(configFilename);
|
||||
if (!rawConfig) {
|
||||
return { errorMsg: "tsconfig syntax error" };
|
||||
var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.readConfigFile(configFilename);
|
||||
if (rawConfig.error) {
|
||||
return rawConfig.error;
|
||||
}
|
||||
else {
|
||||
var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath);
|
||||
var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath);
|
||||
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
|
||||
return { errorMsg: "tsconfig option errors" };
|
||||
}
|
||||
else if (parsedCommandLine.fileNames) {
|
||||
var projectOptions: ProjectOptions = {
|
||||
var projectOptions: ProjectOptions = {
|
||||
files: parsedCommandLine.fileNames,
|
||||
compilerOptions: parsedCommandLine.options
|
||||
};
|
||||
@@ -1040,7 +1040,7 @@ module ts.server {
|
||||
startPath: LineCollection[];
|
||||
endBranch: LineCollection[] = [];
|
||||
branchNode: LineNode;
|
||||
// path to current node
|
||||
// path to current node
|
||||
stack: LineNode[];
|
||||
state = CharRangeSection.Entire;
|
||||
lineCollectionAtBranch: LineCollection;
|
||||
@@ -1242,7 +1242,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
// text change information
|
||||
// text change information
|
||||
class TextChange {
|
||||
constructor(public pos: number, public deleteLen: number, public insertedText?: string) {
|
||||
}
|
||||
@@ -1290,7 +1290,7 @@ module ts.server {
|
||||
if (cb)
|
||||
cb();
|
||||
}
|
||||
|
||||
|
||||
// reload whole script, leaving no change history behind reload
|
||||
reload(script: string) {
|
||||
this.currentVersion++;
|
||||
@@ -1300,7 +1300,7 @@ module ts.server {
|
||||
snap.index = new LineIndex();
|
||||
var lm = LineIndex.linesFromText(script);
|
||||
snap.index.load(lm.lines);
|
||||
// REVIEW: could use linked list
|
||||
// REVIEW: could use linked list
|
||||
for (var i = this.minVersion; i < this.currentVersion; i++) {
|
||||
this.versions[i] = undefined;
|
||||
}
|
||||
@@ -1381,7 +1381,7 @@ module ts.server {
|
||||
return this.index.root.charCount();
|
||||
}
|
||||
|
||||
// this requires linear space so don't hold on to these
|
||||
// this requires linear space so don't hold on to these
|
||||
getLineStartPositions(): number[] {
|
||||
var starts: number[] = [-1];
|
||||
var count = 1;
|
||||
@@ -1643,7 +1643,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) {
|
||||
// assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
|
||||
// assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
|
||||
var childIndex = 0;
|
||||
var child = this.children[0];
|
||||
var childCharCount = child.charCount();
|
||||
@@ -1729,7 +1729,7 @@ module ts.server {
|
||||
line: lineNumber,
|
||||
offset: charOffset
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (childInfo.child.isLeaf()) {
|
||||
return {
|
||||
line: lineNumber,
|
||||
@@ -1917,4 +1917,4 @@ module ts.server {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+78
-51
@@ -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;
|
||||
@@ -1632,7 +1633,7 @@ module ts {
|
||||
private fileNameToEntry: Map<HostFileInformation>;
|
||||
private _compilationSettings: CompilerOptions;
|
||||
|
||||
constructor(private host: LanguageServiceHost) {
|
||||
constructor(private host: LanguageServiceHost, private getCanonicalFileName: (fileName: string) => string) {
|
||||
// script id => script index
|
||||
this.fileNameToEntry = {};
|
||||
|
||||
@@ -1650,6 +1651,10 @@ module ts {
|
||||
return this._compilationSettings;
|
||||
}
|
||||
|
||||
private normalizeFileName(fileName: string): string {
|
||||
return this.getCanonicalFileName(normalizeSlashes(fileName));
|
||||
}
|
||||
|
||||
private createEntry(fileName: string) {
|
||||
let entry: HostFileInformation;
|
||||
let scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
@@ -1661,15 +1666,15 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
return this.fileNameToEntry[normalizeSlashes(fileName)] = entry;
|
||||
return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry;
|
||||
}
|
||||
|
||||
public getEntry(fileName: string): HostFileInformation {
|
||||
return lookUp(this.fileNameToEntry, normalizeSlashes(fileName));
|
||||
private getEntry(fileName: string): HostFileInformation {
|
||||
return lookUp(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
}
|
||||
|
||||
public contains(fileName: string): boolean {
|
||||
return hasProperty(this.fileNameToEntry, normalizeSlashes(fileName));
|
||||
private contains(fileName: string): boolean {
|
||||
return hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
}
|
||||
|
||||
public getOrCreateEntry(fileName: string): HostFileInformation {
|
||||
@@ -1684,8 +1689,10 @@ module ts {
|
||||
let fileNames: string[] = [];
|
||||
|
||||
forEachKey(this.fileNameToEntry, key => {
|
||||
if (hasProperty(this.fileNameToEntry, key) && this.fileNameToEntry[key])
|
||||
fileNames.push(key);
|
||||
let entry = this.getEntry(key);
|
||||
if (entry) {
|
||||
fileNames.push(entry.hostFileName);
|
||||
}
|
||||
});
|
||||
|
||||
return fileNames;
|
||||
@@ -2347,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());
|
||||
@@ -2386,8 +2394,20 @@ 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);
|
||||
let hostCache = new HostCache(host, getCanonicalFileName);
|
||||
|
||||
// If the program is already up-to-date, we can reuse it
|
||||
if (programUpToDate()) {
|
||||
@@ -2408,7 +2428,7 @@ module ts {
|
||||
let newProgram = createProgram(hostCache.getRootFileNames(), newSettings, {
|
||||
getSourceFile: getOrCreateSourceFile,
|
||||
getCancellationToken: () => cancellationToken,
|
||||
getCanonicalFileName: (fileName) => useCaseSensitivefileNames ? fileName : fileName.toLowerCase(),
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitivefileNames,
|
||||
getNewLine: () => host.getNewLine ? host.getNewLine() : "\r\n",
|
||||
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
|
||||
@@ -3019,46 +3039,47 @@ module ts {
|
||||
let containingNodeKind = previousToken.parent.kind;
|
||||
switch (previousToken.kind) {
|
||||
case SyntaxKind.CommaToken:
|
||||
return containingNodeKind === SyntaxKind.CallExpression // func( a, |
|
||||
|| containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion
|
||||
|| containingNodeKind === SyntaxKind.NewExpression // new C(a, |
|
||||
|| containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, |
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression; // let x = (a, |
|
||||
return containingNodeKind === SyntaxKind.CallExpression // func( a, |
|
||||
|| containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion
|
||||
|| containingNodeKind === SyntaxKind.NewExpression // new C(a, |
|
||||
|| containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, |
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression // let x = (a, |
|
||||
|| containingNodeKind === SyntaxKind.FunctionType; // var x: (s: string, list|
|
||||
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return containingNodeKind === SyntaxKind.CallExpression // func( |
|
||||
|| containingNodeKind === SyntaxKind.Constructor // constructor( |
|
||||
|| containingNodeKind === SyntaxKind.NewExpression // new C(a|
|
||||
|| containingNodeKind === SyntaxKind.ParenthesizedExpression; // let x = (a|
|
||||
|| containingNodeKind === SyntaxKind.ParenthesizedExpression // let x = (a|
|
||||
|| containingNodeKind === SyntaxKind.ParenthesizedType; // function F(pred: (a| this can become an arrow function, where 'a' is the argument
|
||||
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ |
|
||||
return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ |
|
||||
|
||||
case SyntaxKind.ModuleKeyword: // module |
|
||||
case SyntaxKind.NamespaceKeyword: // namespace |
|
||||
case SyntaxKind.ModuleKeyword: // module |
|
||||
case SyntaxKind.NamespaceKeyword: // namespace |
|
||||
return true;
|
||||
|
||||
case SyntaxKind.DotToken:
|
||||
return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.|
|
||||
return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.|
|
||||
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ |
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ |
|
||||
|
||||
case SyntaxKind.EqualsToken:
|
||||
return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a|
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression; // x = a|
|
||||
return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a|
|
||||
|| containingNodeKind === SyntaxKind.BinaryExpression; // x = a|
|
||||
|
||||
case SyntaxKind.TemplateHead:
|
||||
return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${|
|
||||
return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${|
|
||||
|
||||
case SyntaxKind.TemplateMiddle:
|
||||
return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${|
|
||||
return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${|
|
||||
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
case SyntaxKind.ProtectedKeyword:
|
||||
return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public |
|
||||
return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public |
|
||||
}
|
||||
|
||||
// Previous token may have been a keyword that was converted to an identifier.
|
||||
@@ -3137,40 +3158,43 @@ module ts {
|
||||
return containingNodeKind === SyntaxKind.VariableDeclaration ||
|
||||
containingNodeKind === SyntaxKind.VariableDeclarationList ||
|
||||
containingNodeKind === SyntaxKind.VariableStatement ||
|
||||
containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, |
|
||||
containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, |
|
||||
isFunction(containingNodeKind) ||
|
||||
containingNodeKind === SyntaxKind.ClassDeclaration || // class A<T, |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
|
||||
containingNodeKind === SyntaxKind.ArrayBindingPattern || // var [x, y|
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x, y|
|
||||
|
||||
containingNodeKind === SyntaxKind.ClassDeclaration || // class A<T, |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
|
||||
containingNodeKind === SyntaxKind.ArrayBindingPattern || // var [x, y|
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x, y|
|
||||
|
||||
case SyntaxKind.DotToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
|
||||
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
|
||||
|
||||
case SyntaxKind.ColonToken:
|
||||
return containingNodeKind === SyntaxKind.BindingElement; // var {x :html|
|
||||
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [x|
|
||||
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [x|
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return containingNodeKind === SyntaxKind.CatchClause ||
|
||||
isFunction(containingNodeKind);
|
||||
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface a { |
|
||||
containingNodeKind === SyntaxKind.TypeLiteral || // let x : { |
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x|
|
||||
return containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface a { |
|
||||
containingNodeKind === SyntaxKind.TypeLiteral || // let x : { |
|
||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x|
|
||||
|
||||
case SyntaxKind.SemicolonToken:
|
||||
return containingNodeKind === SyntaxKind.PropertySignature &&
|
||||
previousToken.parent && previousToken.parent.parent &&
|
||||
(previousToken.parent.parent.kind === SyntaxKind.InterfaceDeclaration || // interface a { f; |
|
||||
previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; |
|
||||
previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; |
|
||||
|
||||
case SyntaxKind.LessThanToken:
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration || // class A< |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A< |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A< |
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration || // class A< |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A< |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A< |
|
||||
isFunction(containingNodeKind);
|
||||
|
||||
case SyntaxKind.StaticKeyword:
|
||||
@@ -3180,7 +3204,7 @@ module ts {
|
||||
return containingNodeKind === SyntaxKind.Parameter ||
|
||||
containingNodeKind === SyntaxKind.Constructor ||
|
||||
(previousToken.parent && previousToken.parent.parent &&
|
||||
previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [ ...z|
|
||||
previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [...z|
|
||||
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
@@ -3198,6 +3222,7 @@ module ts {
|
||||
case SyntaxKind.LetKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
case SyntaxKind.YieldKeyword:
|
||||
case SyntaxKind.TypeKeyword: // type htm|
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6033,11 +6058,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);
|
||||
|
||||
+22
-12
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
@@ -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.*/
|
||||
@@ -83,7 +84,7 @@ module ts {
|
||||
export interface Shim {
|
||||
dispose(dummy: any): void;
|
||||
}
|
||||
|
||||
|
||||
export interface LanguageServiceShim extends Shim {
|
||||
languageService: LanguageService;
|
||||
|
||||
@@ -145,7 +146,7 @@ module ts {
|
||||
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[]
|
||||
*/
|
||||
getReferencesAtPosition(fileName: string, position: number): string;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { definition: <encoded>; references: <encoded>[] }[]
|
||||
@@ -162,8 +163,8 @@ module ts {
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { fileName: string; highlights: { start: number; length: number, isDefinition: boolean }[] }[]
|
||||
*
|
||||
* @param fileToSearch A JSON encoded string[] containing the file names that should be
|
||||
*
|
||||
* @param fileToSearch A JSON encoded string[] containing the file names that should be
|
||||
* considered when searching.
|
||||
*/
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string;
|
||||
@@ -244,7 +245,7 @@ module ts {
|
||||
|
||||
export class LanguageServiceShimHostAdapter implements LanguageServiceHost {
|
||||
private files: string[];
|
||||
|
||||
|
||||
constructor(private shimHost: LanguageServiceShimHost) {
|
||||
}
|
||||
|
||||
@@ -255,11 +256,20 @@ module ts {
|
||||
public trace(s: string): void {
|
||||
this.shimHost.trace(s);
|
||||
}
|
||||
|
||||
|
||||
public error(s: string): void {
|
||||
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 == "") {
|
||||
@@ -322,7 +332,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class CoreServicesShimHostAdapter implements ParseConfigHost {
|
||||
|
||||
constructor(private shimHost: CoreServicesShimHost) {
|
||||
@@ -587,7 +597,7 @@ module ts {
|
||||
|
||||
/**
|
||||
* Computes the definition location and file for the symbol
|
||||
* at the requested position.
|
||||
* at the requested position.
|
||||
*/
|
||||
public getDefinitionAtPosition(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
@@ -601,7 +611,7 @@ module ts {
|
||||
|
||||
/**
|
||||
* Computes the definition location of the type of the symbol
|
||||
* at the requested position.
|
||||
* at the requested position.
|
||||
*/
|
||||
public getTypeDefinitionAtPosition(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
@@ -684,8 +694,8 @@ module ts {
|
||||
/// COMPLETION LISTS
|
||||
|
||||
/**
|
||||
* Get a string based representation of the completions
|
||||
* to provide at the given source position and providing a member completion
|
||||
* Get a string based representation of the completions
|
||||
* to provide at the given source position and providing a member completion
|
||||
* list if requested.
|
||||
*/
|
||||
public getCompletionsAtPosition(fileName: string, position: number) {
|
||||
|
||||
-1
@@ -16,6 +16,5 @@ var A;
|
||||
}
|
||||
return B;
|
||||
})();
|
||||
A.beez;
|
||||
A.beez2 = new Array();
|
||||
})(A || (A = {}));
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(3,8): error TS1123: Variable declaration list cannot be empty.
|
||||
tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(4,5): error TS2304: Cannot find name 'let'.
|
||||
tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(5,10): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts (3 errors) ====
|
||||
|
||||
module Inner {
|
||||
var;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
let;
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'let'.
|
||||
const;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
export var a;
|
||||
export let b;
|
||||
export var c: string;
|
||||
export let d: number;
|
||||
class A {}
|
||||
export var e: A;
|
||||
export let f: A;
|
||||
|
||||
namespace B {
|
||||
export let a = 1, b, c = 2;
|
||||
export let x, y, z;
|
||||
}
|
||||
|
||||
module C {
|
||||
export var a = 1, b, c = 2;
|
||||
export var x, y, z;
|
||||
}
|
||||
|
||||
// Shouldn't be filtered
|
||||
export var a1 = 1;
|
||||
export let b1 = 1;
|
||||
export var c1: string = 'a';
|
||||
export let d1: number = 1;
|
||||
class D {}
|
||||
export var e1 = new D;
|
||||
export let f1 = new D;
|
||||
export var g1: D = new D;
|
||||
export let h1: D = new D;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//// [NonInitializedExportInInternalModule.ts]
|
||||
|
||||
module Inner {
|
||||
var;
|
||||
let;
|
||||
const;
|
||||
|
||||
export var a;
|
||||
export let b;
|
||||
export var c: string;
|
||||
export let d: number;
|
||||
class A {}
|
||||
export var e: A;
|
||||
export let f: A;
|
||||
|
||||
namespace B {
|
||||
export let a = 1, b, c = 2;
|
||||
export let x, y, z;
|
||||
}
|
||||
|
||||
module C {
|
||||
export var a = 1, b, c = 2;
|
||||
export var x, y, z;
|
||||
}
|
||||
|
||||
// Shouldn't be filtered
|
||||
export var a1 = 1;
|
||||
export let b1 = 1;
|
||||
export var c1: string = 'a';
|
||||
export let d1: number = 1;
|
||||
class D {}
|
||||
export var e1 = new D;
|
||||
export let f1 = new D;
|
||||
export var g1: D = new D;
|
||||
export let h1: D = new D;
|
||||
}
|
||||
|
||||
//// [NonInitializedExportInInternalModule.js]
|
||||
var Inner;
|
||||
(function (Inner) {
|
||||
var ;
|
||||
let;
|
||||
var ;
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B;
|
||||
(function (B) {
|
||||
B.a = 1, B.c = 2;
|
||||
})(B || (B = {}));
|
||||
var C;
|
||||
(function (C) {
|
||||
C.a = 1, C.c = 2;
|
||||
})(C || (C = {}));
|
||||
// Shouldn't be filtered
|
||||
Inner.a1 = 1;
|
||||
Inner.b1 = 1;
|
||||
Inner.c1 = 'a';
|
||||
Inner.d1 = 1;
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
})();
|
||||
Inner.e1 = new D;
|
||||
Inner.f1 = new D;
|
||||
Inner.g1 = new D;
|
||||
Inner.h1 = new D;
|
||||
})(Inner || (Inner = {}));
|
||||
-2
@@ -39,14 +39,12 @@ var A;
|
||||
(function (A) {
|
||||
var B;
|
||||
(function (B) {
|
||||
B.x;
|
||||
})(B = A.B || (A.B = {}));
|
||||
})(A || (A = {}));
|
||||
var A;
|
||||
(function (A) {
|
||||
var B;
|
||||
(function (B) {
|
||||
B.x;
|
||||
})(B || (B = {}));
|
||||
})(A || (A = {}));
|
||||
// ensure the right var decl is exported
|
||||
|
||||
@@ -55,7 +55,6 @@ var E;
|
||||
})(E || (E = {}));
|
||||
var M;
|
||||
(function (M) {
|
||||
M.a;
|
||||
})(M || (M = {}));
|
||||
var a;
|
||||
var b;
|
||||
|
||||
@@ -56,7 +56,6 @@ var E;
|
||||
})(E || (E = {}));
|
||||
var M;
|
||||
(function (M) {
|
||||
M.a;
|
||||
})(M || (M = {}));
|
||||
var a;
|
||||
var b;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/compiler/aliasErrors.ts(11,12): error TS2304: Cannot find name 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(12,13): error TS2304: Cannot find name 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(11,12): error TS2503: Cannot find namespace 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(12,13): error TS2503: Cannot find namespace 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(13,12): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/aliasErrors.ts(14,12): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/aliasErrors.ts(15,12): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/aliasErrors.ts(16,12): error TS2304: Cannot find name 'undefined'.
|
||||
tests/cases/compiler/aliasErrors.ts(16,12): error TS2503: Cannot find namespace 'undefined'.
|
||||
tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'.
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' h
|
||||
|
||||
import m = no;
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'no'.
|
||||
!!! error TS2503: Cannot find namespace 'no'.
|
||||
import m2 = no.mod;
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'no'.
|
||||
!!! error TS2503: Cannot find namespace 'no'.
|
||||
import n = 5;
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
@@ -35,7 +35,7 @@ tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' h
|
||||
!!! error TS1003: Identifier expected.
|
||||
import r = undefined;
|
||||
~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'undefined'.
|
||||
!!! error TS2503: Cannot find namespace 'undefined'.
|
||||
|
||||
|
||||
var p = new provide.Provide();
|
||||
|
||||
@@ -19,7 +19,6 @@ export var a = function () {
|
||||
|
||||
|
||||
//// [aliasUsedAsNameValue_0.js]
|
||||
exports.id;
|
||||
//// [aliasUsedAsNameValue_1.js]
|
||||
function b(a) { return null; }
|
||||
exports.b = b;
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
@@ -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[]
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.obj;
|
||||
__test2__.__val__obj = __test2__.obj;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
__test2__.__val__obj = __test1__.__val__obj4;
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.obj;
|
||||
__test2__.__val__obj = __test2__.obj;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
__test2__.__val__obj = __test1__.__val__obj4;
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -19,7 +19,6 @@ var __test1__;
|
||||
})(__test1__ || (__test1__ = {}));
|
||||
var __test2__;
|
||||
(function (__test2__) {
|
||||
__test2__.aa;
|
||||
;
|
||||
__test2__.__val__aa = __test2__.aa;
|
||||
})(__test2__ || (__test2__ = {}));
|
||||
|
||||
@@ -93,7 +93,6 @@ this = value;
|
||||
// identifiers: module, class, enum, function
|
||||
var M;
|
||||
(function (M) {
|
||||
M.a;
|
||||
})(M || (M = {}));
|
||||
M = value;
|
||||
C = value;
|
||||
|
||||
@@ -79,7 +79,6 @@ x = ''; // Error
|
||||
(x) = ''; // Error
|
||||
var M;
|
||||
(function (M) {
|
||||
M.y;
|
||||
})(M || (M = {}));
|
||||
M.y = 3; // OK
|
||||
(M).y = 3; // OK
|
||||
@@ -93,7 +92,6 @@ var M2;
|
||||
(function (M2) {
|
||||
var M3;
|
||||
(function (M3) {
|
||||
M3.x;
|
||||
})(M3 = M2.M3 || (M2.M3 = {}));
|
||||
M3 = { x: 3 }; // Error
|
||||
})(M2 || (M2 = {}));
|
||||
|
||||
@@ -84,7 +84,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// any other type var
|
||||
|
||||
@@ -50,7 +50,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// boolean type var
|
||||
|
||||
@@ -57,7 +57,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// number type var
|
||||
|
||||
@@ -56,7 +56,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// string type var
|
||||
|
||||
-1
@@ -27,7 +27,6 @@ var A = (function () {
|
||||
})();
|
||||
var A;
|
||||
(function (A) {
|
||||
A.v;
|
||||
})(A || (A = {}));
|
||||
var Foo;
|
||||
(function (Foo) {
|
||||
|
||||
@@ -16,7 +16,6 @@ export class Test1 {
|
||||
}
|
||||
|
||||
//// [classMemberInitializerWithLamdaScoping3_0.js]
|
||||
exports.field1;
|
||||
//// [classMemberInitializerWithLamdaScoping3_1.js]
|
||||
var Test1 = (function () {
|
||||
function Test1(field1) {
|
||||
|
||||
@@ -6,5 +6,4 @@ export var b: number;
|
||||
//// [commentsBeforeVariableStatement1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
/** b's comment*/
|
||||
exports.b;
|
||||
});
|
||||
|
||||
@@ -67,7 +67,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
var m1;
|
||||
(function (m1) {
|
||||
/** b's comment*/
|
||||
m1.b;
|
||||
/** foo's comment*/
|
||||
function foo() {
|
||||
return m1.b;
|
||||
@@ -98,7 +97,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
var m4;
|
||||
(function (m4) {
|
||||
/** b's comment */
|
||||
m4.b;
|
||||
/** foo's comment
|
||||
*/
|
||||
function foo() {
|
||||
|
||||
@@ -67,7 +67,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
var m1;
|
||||
(function (m1) {
|
||||
/** b's comment*/
|
||||
m1.b;
|
||||
/** foo's comment*/
|
||||
function foo() {
|
||||
return m1.b;
|
||||
@@ -98,7 +97,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
var m4;
|
||||
(function (m4) {
|
||||
/** b's comment */
|
||||
m4.b;
|
||||
/** foo's comment
|
||||
*/
|
||||
function foo() {
|
||||
|
||||
@@ -66,7 +66,6 @@ export var newVar2 = new extMod.m4.m2.c();
|
||||
var m1;
|
||||
(function (m1) {
|
||||
/** b's comment*/
|
||||
m1.b;
|
||||
/** foo's comment*/
|
||||
function foo() {
|
||||
return m1.b;
|
||||
@@ -97,7 +96,6 @@ var myvar = new m1.m2.c();
|
||||
var m4;
|
||||
(function (m4) {
|
||||
/** b's comment */
|
||||
m4.b;
|
||||
/** foo's comment
|
||||
*/
|
||||
function foo() {
|
||||
|
||||
@@ -102,7 +102,6 @@ new m7.m8.m9.c();
|
||||
var m1;
|
||||
(function (m1) {
|
||||
/** b's comment*/
|
||||
m1.b;
|
||||
/** foo's comment*/
|
||||
function foo() {
|
||||
return m1.b;
|
||||
|
||||
@@ -163,7 +163,6 @@ var m1;
|
||||
return C5;
|
||||
})();
|
||||
m1.C5 = C5;
|
||||
m1.v2;
|
||||
})(m1 || (m1 = {}));
|
||||
var C2 = (function () {
|
||||
function C2() {
|
||||
|
||||
@@ -156,7 +156,6 @@ this += value;
|
||||
// identifiers: module, class, enum, function
|
||||
var M;
|
||||
(function (M) {
|
||||
M.a;
|
||||
})(M || (M = {}));
|
||||
M *= value;
|
||||
M += value;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2503: Cannot find namespace 'module'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,19): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,35): error TS1005: ')' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -82,7 +83,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error T
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (82 errors) ====
|
||||
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (83 errors) ====
|
||||
declare module "fs" {
|
||||
export class File {
|
||||
constructor(filename: string);
|
||||
@@ -96,6 +97,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
|
||||
import fs = module("fs");
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'module'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
|
||||
@@ -283,7 +283,6 @@ var C4T5 = (function () {
|
||||
// CONTEXT: Module property assignment
|
||||
var C5T5;
|
||||
(function (C5T5) {
|
||||
C5T5.foo;
|
||||
C5T5.foo = function (i, s) {
|
||||
return s;
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -2,4 +2,4 @@
|
||||
var foo: {id:number;} = {id:4};
|
||||
|
||||
//// [contextualTyping1.js]
|
||||
var foo = { id: 4 };\n
|
||||
var foo = { id: 4 };
|
||||
|
||||
@@ -20,7 +20,6 @@ export var x: SubModule.m.m3.c;
|
||||
|
||||
//// [declFileAmbientExternalModuleWithSingleExportedModule_0.js]
|
||||
//// [declFileAmbientExternalModuleWithSingleExportedModule_1.js]
|
||||
exports.x;
|
||||
|
||||
|
||||
//// [declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts]
|
||||
|
||||
@@ -24,7 +24,6 @@ export = m;
|
||||
//// [declFileExportAssignmentImportInternalModule.js]
|
||||
var m3;
|
||||
(function (m3) {
|
||||
m3.server;
|
||||
})(m3 || (m3 = {}));
|
||||
var m = m3;
|
||||
module.exports = m;
|
||||
|
||||
@@ -17,7 +17,6 @@ define(["require", "exports"], function (require, exports) {
|
||||
});
|
||||
//// [declFileExportAssignmentOfGenericInterface_1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
exports.x;
|
||||
exports.x.a;
|
||||
});
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ define(["require", "exports", "declFileExportImportChain_b1"], function (require
|
||||
});
|
||||
//// [declFileExportImportChain_d.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
exports.x;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ define(["require", "exports", "declFileExportImportChain2_b"], function (require
|
||||
});
|
||||
//// [declFileExportImportChain2_d.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
exports.x;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ export import b = a;
|
||||
var z = b.x;
|
||||
|
||||
//// [declFileForExportedImport_0.js]
|
||||
exports.x;
|
||||
//// [declFileForExportedImport_1.js]
|
||||
///<reference path='declFileForExportedImport_0.ts'/>
|
||||
exports.a = require('declFileForExportedImport_0');
|
||||
|
||||
@@ -80,7 +80,6 @@ var C;
|
||||
})();
|
||||
C.D = D;
|
||||
})(C = exports.C || (exports.C = {}));
|
||||
exports.a;
|
||||
exports.b = C.F;
|
||||
exports.c = C.F2;
|
||||
exports.d = C.F3;
|
||||
|
||||
@@ -34,7 +34,6 @@ module M {
|
||||
//// [declFileTypeAnnotationTypeAlias.js]
|
||||
var M;
|
||||
(function (M) {
|
||||
M.x;
|
||||
var c = (function () {
|
||||
function c() {
|
||||
}
|
||||
@@ -61,7 +60,6 @@ var M;
|
||||
return Window;
|
||||
})();
|
||||
N.Window = Window;
|
||||
N.p;
|
||||
})(N = M.N || (M.N = {}));
|
||||
})(M || (M = {}));
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ var M;
|
||||
return Window;
|
||||
})();
|
||||
N.Window = Window;
|
||||
N.p; // Should report error that W is private
|
||||
// Should report error that W is private
|
||||
})(N = M.N || (M.N = {}));
|
||||
})(M || (M = {}));
|
||||
var M1;
|
||||
@@ -65,7 +65,7 @@ var M1;
|
||||
return Window;
|
||||
})();
|
||||
N.Window = Window;
|
||||
N.p; // No error
|
||||
// No error
|
||||
})(N = M1.N || (M1.N = {}));
|
||||
})(M1 || (M1 = {}));
|
||||
var M2;
|
||||
|
||||
@@ -51,7 +51,6 @@ var m;
|
||||
})();
|
||||
m2.public1 = public1;
|
||||
})(m2 || (m2 = {}));
|
||||
m.x;
|
||||
m.x2 = {
|
||||
x: new private1(),
|
||||
y: new m2.public1(),
|
||||
@@ -61,9 +60,7 @@ var m;
|
||||
};
|
||||
m.x3 = m.x;
|
||||
// Function type
|
||||
m.y;
|
||||
m.y2 = m.y;
|
||||
// constructor type
|
||||
m.z;
|
||||
m.z2 = m.z;
|
||||
})(m || (m = {}));
|
||||
|
||||
@@ -50,11 +50,9 @@ var m;
|
||||
// Directly using names from this module
|
||||
var x;
|
||||
var y = new private1();
|
||||
m.k;
|
||||
m.l = new private1();
|
||||
var x2;
|
||||
var y2 = new public1();
|
||||
m.k2;
|
||||
m.l2 = new public1();
|
||||
var m2;
|
||||
(function (m2) {
|
||||
@@ -67,6 +65,5 @@ var m;
|
||||
})(m2 || (m2 = {}));
|
||||
var x3;
|
||||
var y3 = new m2.public2();
|
||||
m.k3;
|
||||
m.l3 = new m2.public2();
|
||||
})(m || (m = {}));
|
||||
|
||||
@@ -16,13 +16,11 @@ var m2_2: typeof m2;
|
||||
//// [declFileTypeofModule.js]
|
||||
var m1;
|
||||
(function (m1) {
|
||||
m1.c;
|
||||
})(m1 || (m1 = {}));
|
||||
var m1_1 = m1;
|
||||
var m1_2;
|
||||
var m2;
|
||||
(function (m2) {
|
||||
m2.d;
|
||||
})(m2 || (m2 = {}));
|
||||
var m2_1 = m2;
|
||||
var m2_2;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,7 +22,6 @@ var m;
|
||||
})();
|
||||
c_1.c = c;
|
||||
})(c = m.c || (m.c = {}));
|
||||
m.a;
|
||||
})(m || (m = {}));
|
||||
module.exports = m;
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ var X;
|
||||
base.C = C;
|
||||
var M;
|
||||
(function (M) {
|
||||
M.v;
|
||||
})(M = base.M || (base.M = {}));
|
||||
(function (E) {
|
||||
})(base.E || (base.E = {}));
|
||||
|
||||
@@ -74,7 +74,7 @@ var M;
|
||||
D[D["f"] = 0] = "f";
|
||||
})(P.D || (P.D = {}));
|
||||
var D = P.D;
|
||||
P.v; // ok
|
||||
// ok
|
||||
P.w = M.D.f; // error, should be typeof M.D.f
|
||||
P.x = M.C.f; // error, should be typeof M.C.f
|
||||
P.x = M.E.f; // error, should be typeof M.E.f
|
||||
|
||||
@@ -9,7 +9,7 @@ export module M {
|
||||
//// [declarationEmit_nameConflictsWithAlias.js]
|
||||
var M;
|
||||
(function (M) {
|
||||
M.w; // Gets emitted as C.I, which is the wrong interface
|
||||
// Gets emitted as C.I, which is the wrong interface
|
||||
})(M = exports.M || (exports.M = {}));
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/declareModifierOnImport1.ts(1,1): error TS1079: A 'declare' modifier cannot be used with an import declaration.
|
||||
tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2304: Cannot find name 'b'.
|
||||
tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2503: Cannot find namespace 'b'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declareModifierOnImport1.ts (2 errors) ====
|
||||
@@ -7,4 +7,4 @@ tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2304: Cannot fin
|
||||
~~~~~~~
|
||||
!!! error TS1079: A 'declare' modifier cannot be used with an import declaration.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'b'.
|
||||
!!! error TS2503: Cannot find namespace 'b'.
|
||||
@@ -21,7 +21,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
function decorate() { }
|
||||
let Decorated = class {
|
||||
};
|
||||
Object.defineProperty(Decorated, "name", { value: "Decorated", configurable: true });
|
||||
Decorated = __decorate([
|
||||
decorate
|
||||
], Decorated);
|
||||
|
||||
@@ -13,5 +13,4 @@ module M2 {
|
||||
//// [decoratorOnImportEquals1.js]
|
||||
var M1;
|
||||
(function (M1) {
|
||||
M1.X;
|
||||
})(M1 || (M1 = {}));
|
||||
|
||||
@@ -10,5 +10,4 @@ import lib = require('./decoratorOnImportEquals2_0');
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
//// [decoratorOnImportEquals2_0.js]
|
||||
exports.X;
|
||||
//// [decoratorOnImportEquals2_1.js]
|
||||
|
||||
@@ -61,7 +61,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// any type var
|
||||
|
||||
@@ -93,7 +93,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// any type var
|
||||
|
||||
@@ -50,7 +50,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
// number type var
|
||||
|
||||
@@ -59,7 +59,6 @@ var A = (function () {
|
||||
})();
|
||||
var M;
|
||||
(function (M) {
|
||||
M.n;
|
||||
})(M || (M = {}));
|
||||
var objA = new A();
|
||||
//number type var
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user