mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 23:08:20 -06:00
Update LKG
This commit is contained in:
parent
85f0240cea
commit
d04b6c4b2d
87
lib/tsc.js
87
lib/tsc.js
@ -1202,7 +1202,6 @@ var ts;
|
||||
_0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." },
|
||||
Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." },
|
||||
Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." },
|
||||
Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1246, category: ts.DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." },
|
||||
with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." },
|
||||
await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." },
|
||||
Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." },
|
||||
@ -1576,7 +1575,6 @@ var ts;
|
||||
Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." },
|
||||
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
|
||||
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
|
||||
Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." },
|
||||
Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." },
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." },
|
||||
Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." },
|
||||
@ -10633,17 +10631,54 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function isDefinedBefore(node1, node2) {
|
||||
var file1 = ts.getSourceFileOfNode(node1);
|
||||
var file2 = ts.getSourceFileOfNode(node2);
|
||||
if (file1 === file2) {
|
||||
return node1.pos <= node2.pos;
|
||||
function isBlockScopedNameDeclaredBeforeUse(declaration, usage) {
|
||||
var declarationFile = ts.getSourceFileOfNode(declaration);
|
||||
var useFile = ts.getSourceFileOfNode(usage);
|
||||
if (declarationFile !== useFile) {
|
||||
if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) {
|
||||
return true;
|
||||
}
|
||||
var sourceFiles = host.getSourceFiles();
|
||||
return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile);
|
||||
}
|
||||
if (!compilerOptions.outFile && !compilerOptions.out) {
|
||||
return true;
|
||||
if (declaration.pos <= usage.pos) {
|
||||
return declaration.kind !== 211 ||
|
||||
!isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
||||
}
|
||||
return isUsedInFunctionOrNonStaticProperty(declaration, usage);
|
||||
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
|
||||
var container = ts.getEnclosingBlockScopeContainer(declaration);
|
||||
if (declaration.parent.parent.kind === 193 ||
|
||||
declaration.parent.parent.kind === 199) {
|
||||
return isSameScopeDescendentOf(usage, declaration, container);
|
||||
}
|
||||
else if (declaration.parent.parent.kind === 201 ||
|
||||
declaration.parent.parent.kind === 200) {
|
||||
var expression = declaration.parent.parent.expression;
|
||||
return isSameScopeDescendentOf(usage, expression, container);
|
||||
}
|
||||
}
|
||||
function isUsedInFunctionOrNonStaticProperty(declaration, usage) {
|
||||
var container = ts.getEnclosingBlockScopeContainer(declaration);
|
||||
var current = usage;
|
||||
while (current) {
|
||||
if (current === container) {
|
||||
return false;
|
||||
}
|
||||
if (ts.isFunctionLike(current)) {
|
||||
return true;
|
||||
}
|
||||
var initializerOfNonStaticProperty = current.parent &&
|
||||
current.parent.kind === 141 &&
|
||||
(current.parent.flags & 128) === 0 &&
|
||||
current.parent.initializer === current;
|
||||
if (initializerOfNonStaticProperty) {
|
||||
return true;
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
var sourceFiles = host.getSourceFiles();
|
||||
return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2);
|
||||
}
|
||||
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) {
|
||||
var result;
|
||||
@ -10795,21 +10830,7 @@ var ts;
|
||||
ts.Debug.assert((result.flags & 2) !== 0);
|
||||
var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; });
|
||||
ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
|
||||
var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation);
|
||||
if (!isUsedBeforeDeclaration) {
|
||||
var variableDeclaration = ts.getAncestor(declaration, 211);
|
||||
var container = ts.getEnclosingBlockScopeContainer(variableDeclaration);
|
||||
if (variableDeclaration.parent.parent.kind === 193 ||
|
||||
variableDeclaration.parent.parent.kind === 199) {
|
||||
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container);
|
||||
}
|
||||
else if (variableDeclaration.parent.parent.kind === 201 ||
|
||||
variableDeclaration.parent.parent.kind === 200) {
|
||||
var expression = variableDeclaration.parent.parent.expression;
|
||||
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container);
|
||||
}
|
||||
}
|
||||
if (isUsedBeforeDeclaration) {
|
||||
if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211), errorLocation)) {
|
||||
error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
}
|
||||
@ -19245,9 +19266,6 @@ var ts;
|
||||
checkSignatureDeclaration(node);
|
||||
var isAsync = ts.isAsyncFunctionLike(node);
|
||||
if (isAsync) {
|
||||
if (!compilerOptions.experimentalAsyncFunctions) {
|
||||
error(node, ts.Diagnostics.Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning);
|
||||
}
|
||||
emitAwaiter = true;
|
||||
}
|
||||
if (node.name && node.name.kind === 136) {
|
||||
@ -20373,7 +20391,7 @@ var ts;
|
||||
if (member === propertyDecl) {
|
||||
return undefined;
|
||||
}
|
||||
if (!isDefinedBefore(propertyDecl, member)) {
|
||||
if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) {
|
||||
reportError = false;
|
||||
error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
||||
return undefined;
|
||||
@ -30544,10 +30562,6 @@ var ts;
|
||||
!options.experimentalDecorators) {
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
options.target !== 2) {
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.createProgram = createProgram;
|
||||
@ -30770,11 +30784,6 @@ var ts;
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Watch_input_files
|
||||
},
|
||||
{
|
||||
name: "experimentalAsyncFunctions",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Enables_experimental_support_for_ES7_async_functions
|
||||
},
|
||||
{
|
||||
name: "experimentalDecorators",
|
||||
type: "boolean",
|
||||
|
||||
122
lib/tsserver.js
122
lib/tsserver.js
@ -1202,7 +1202,6 @@ var ts;
|
||||
_0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." },
|
||||
Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." },
|
||||
Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." },
|
||||
Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1246, category: ts.DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." },
|
||||
with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." },
|
||||
await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." },
|
||||
Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." },
|
||||
@ -1576,7 +1575,6 @@ var ts;
|
||||
Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." },
|
||||
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
|
||||
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
|
||||
Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." },
|
||||
Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." },
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." },
|
||||
Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." },
|
||||
@ -3200,11 +3198,6 @@ var ts;
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Watch_input_files
|
||||
},
|
||||
{
|
||||
name: "experimentalAsyncFunctions",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Enables_experimental_support_for_ES7_async_functions
|
||||
},
|
||||
{
|
||||
name: "experimentalDecorators",
|
||||
type: "boolean",
|
||||
@ -11095,17 +11088,54 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function isDefinedBefore(node1, node2) {
|
||||
var file1 = ts.getSourceFileOfNode(node1);
|
||||
var file2 = ts.getSourceFileOfNode(node2);
|
||||
if (file1 === file2) {
|
||||
return node1.pos <= node2.pos;
|
||||
function isBlockScopedNameDeclaredBeforeUse(declaration, usage) {
|
||||
var declarationFile = ts.getSourceFileOfNode(declaration);
|
||||
var useFile = ts.getSourceFileOfNode(usage);
|
||||
if (declarationFile !== useFile) {
|
||||
if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) {
|
||||
return true;
|
||||
}
|
||||
var sourceFiles = host.getSourceFiles();
|
||||
return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile);
|
||||
}
|
||||
if (!compilerOptions.outFile && !compilerOptions.out) {
|
||||
return true;
|
||||
if (declaration.pos <= usage.pos) {
|
||||
return declaration.kind !== 211 ||
|
||||
!isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
||||
}
|
||||
return isUsedInFunctionOrNonStaticProperty(declaration, usage);
|
||||
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
|
||||
var container = ts.getEnclosingBlockScopeContainer(declaration);
|
||||
if (declaration.parent.parent.kind === 193 ||
|
||||
declaration.parent.parent.kind === 199) {
|
||||
return isSameScopeDescendentOf(usage, declaration, container);
|
||||
}
|
||||
else if (declaration.parent.parent.kind === 201 ||
|
||||
declaration.parent.parent.kind === 200) {
|
||||
var expression = declaration.parent.parent.expression;
|
||||
return isSameScopeDescendentOf(usage, expression, container);
|
||||
}
|
||||
}
|
||||
function isUsedInFunctionOrNonStaticProperty(declaration, usage) {
|
||||
var container = ts.getEnclosingBlockScopeContainer(declaration);
|
||||
var current = usage;
|
||||
while (current) {
|
||||
if (current === container) {
|
||||
return false;
|
||||
}
|
||||
if (ts.isFunctionLike(current)) {
|
||||
return true;
|
||||
}
|
||||
var initializerOfNonStaticProperty = current.parent &&
|
||||
current.parent.kind === 141 &&
|
||||
(current.parent.flags & 128) === 0 &&
|
||||
current.parent.initializer === current;
|
||||
if (initializerOfNonStaticProperty) {
|
||||
return true;
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
var sourceFiles = host.getSourceFiles();
|
||||
return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2);
|
||||
}
|
||||
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) {
|
||||
var result;
|
||||
@ -11257,21 +11287,7 @@ var ts;
|
||||
ts.Debug.assert((result.flags & 2) !== 0);
|
||||
var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; });
|
||||
ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
|
||||
var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation);
|
||||
if (!isUsedBeforeDeclaration) {
|
||||
var variableDeclaration = ts.getAncestor(declaration, 211);
|
||||
var container = ts.getEnclosingBlockScopeContainer(variableDeclaration);
|
||||
if (variableDeclaration.parent.parent.kind === 193 ||
|
||||
variableDeclaration.parent.parent.kind === 199) {
|
||||
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container);
|
||||
}
|
||||
else if (variableDeclaration.parent.parent.kind === 201 ||
|
||||
variableDeclaration.parent.parent.kind === 200) {
|
||||
var expression = variableDeclaration.parent.parent.expression;
|
||||
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container);
|
||||
}
|
||||
}
|
||||
if (isUsedBeforeDeclaration) {
|
||||
if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211), errorLocation)) {
|
||||
error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
}
|
||||
@ -19707,9 +19723,6 @@ var ts;
|
||||
checkSignatureDeclaration(node);
|
||||
var isAsync = ts.isAsyncFunctionLike(node);
|
||||
if (isAsync) {
|
||||
if (!compilerOptions.experimentalAsyncFunctions) {
|
||||
error(node, ts.Diagnostics.Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning);
|
||||
}
|
||||
emitAwaiter = true;
|
||||
}
|
||||
if (node.name && node.name.kind === 136) {
|
||||
@ -20835,7 +20848,7 @@ var ts;
|
||||
if (member === propertyDecl) {
|
||||
return undefined;
|
||||
}
|
||||
if (!isDefinedBefore(propertyDecl, member)) {
|
||||
if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) {
|
||||
reportError = false;
|
||||
error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
||||
return undefined;
|
||||
@ -31006,10 +31019,6 @@ var ts;
|
||||
!options.experimentalDecorators) {
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
options.target !== 2) {
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.createProgram = createProgram;
|
||||
@ -37577,6 +37586,7 @@ var ts;
|
||||
var node = currentToken;
|
||||
var isRightOfDot = false;
|
||||
var isRightOfOpenTag = false;
|
||||
var isStartingCloseTag = false;
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (contextToken) {
|
||||
if (isCompletionListBlocker(contextToken)) {
|
||||
@ -37597,9 +37607,14 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (kind === 25 && sourceFile.languageVariant === 1) {
|
||||
isRightOfOpenTag = true;
|
||||
location = contextToken;
|
||||
else if (sourceFile.languageVariant === 1) {
|
||||
if (kind === 25) {
|
||||
isRightOfOpenTag = true;
|
||||
location = contextToken;
|
||||
}
|
||||
else if (kind === 39 && contextToken.parent.kind === 237) {
|
||||
isStartingCloseTag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var semanticStart = new Date().getTime();
|
||||
@ -37620,6 +37635,12 @@ var ts;
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
else if (isStartingCloseTag) {
|
||||
var tagName = contextToken.parent.parent.openingElement.tagName;
|
||||
symbols = [typeChecker.getSymbolAtLocation(tagName)];
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
else {
|
||||
if (!tryGetGlobalSymbols()) {
|
||||
return undefined;
|
||||
@ -37710,10 +37731,25 @@ var ts;
|
||||
var start = new Date().getTime();
|
||||
var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
|
||||
isSolelyIdentifierDefinitionLocation(contextToken) ||
|
||||
isDotOfNumericLiteral(contextToken);
|
||||
isDotOfNumericLiteral(contextToken) ||
|
||||
isInJsxText(contextToken);
|
||||
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
|
||||
return result;
|
||||
}
|
||||
function isInJsxText(contextToken) {
|
||||
if (contextToken.kind === 236) {
|
||||
return true;
|
||||
}
|
||||
if (contextToken.kind === 27 && contextToken.parent) {
|
||||
if (contextToken.parent.kind === 235) {
|
||||
return true;
|
||||
}
|
||||
if (contextToken.parent.kind === 237 || contextToken.parent.kind === 234) {
|
||||
return contextToken.parent.parent && contextToken.parent.parent.kind === 233;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isNewIdentifierDefinitionLocation(previousToken) {
|
||||
if (previousToken) {
|
||||
var containingNodeKind = previousToken.parent.kind;
|
||||
|
||||
1
lib/typescript.d.ts
vendored
1
lib/typescript.d.ts
vendored
@ -1348,7 +1348,6 @@ declare namespace ts {
|
||||
watch?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
experimentalAsyncFunctions?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
moduleResolution?: ModuleResolutionKind;
|
||||
[option: string]: string | number | boolean;
|
||||
|
||||
@ -2088,7 +2088,6 @@ var ts;
|
||||
_0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." },
|
||||
Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." },
|
||||
Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." },
|
||||
Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1246, category: ts.DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." },
|
||||
with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." },
|
||||
await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." },
|
||||
Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." },
|
||||
@ -2462,7 +2461,6 @@ var ts;
|
||||
Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." },
|
||||
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
|
||||
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
|
||||
Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." },
|
||||
Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." },
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." },
|
||||
Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." },
|
||||
@ -13435,18 +13433,62 @@ var ts;
|
||||
}
|
||||
// return undefined if we can't find a symbol.
|
||||
}
|
||||
/** Returns true if node1 is defined before node 2**/
|
||||
function isDefinedBefore(node1, node2) {
|
||||
var file1 = ts.getSourceFileOfNode(node1);
|
||||
var file2 = ts.getSourceFileOfNode(node2);
|
||||
if (file1 === file2) {
|
||||
return node1.pos <= node2.pos;
|
||||
function isBlockScopedNameDeclaredBeforeUse(declaration, usage) {
|
||||
var declarationFile = ts.getSourceFileOfNode(declaration);
|
||||
var useFile = ts.getSourceFileOfNode(usage);
|
||||
if (declarationFile !== useFile) {
|
||||
if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) {
|
||||
// nodes are in different files and order cannot be determines
|
||||
return true;
|
||||
}
|
||||
var sourceFiles = host.getSourceFiles();
|
||||
return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile);
|
||||
}
|
||||
if (!compilerOptions.outFile && !compilerOptions.out) {
|
||||
return true;
|
||||
if (declaration.pos <= usage.pos) {
|
||||
// declaration is before usage
|
||||
// still might be illegal if usage is in the initializer of the variable declaration
|
||||
return declaration.kind !== 211 /* VariableDeclaration */ ||
|
||||
!isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
||||
}
|
||||
// declaration is after usage
|
||||
// can be legal if usage is deferred (i.e. inside function or in initializer of instance property)
|
||||
return isUsedInFunctionOrNonStaticProperty(declaration, usage);
|
||||
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
|
||||
var container = ts.getEnclosingBlockScopeContainer(declaration);
|
||||
if (declaration.parent.parent.kind === 193 /* VariableStatement */ ||
|
||||
declaration.parent.parent.kind === 199 /* ForStatement */) {
|
||||
// variable statement/for statement case,
|
||||
// use site should not be inside variable declaration (initializer of declaration or binding element)
|
||||
return isSameScopeDescendentOf(usage, declaration, container);
|
||||
}
|
||||
else if (declaration.parent.parent.kind === 201 /* ForOfStatement */ ||
|
||||
declaration.parent.parent.kind === 200 /* ForInStatement */) {
|
||||
// ForIn/ForOf case - use site should not be used in expression part
|
||||
var expression = declaration.parent.parent.expression;
|
||||
return isSameScopeDescendentOf(usage, expression, container);
|
||||
}
|
||||
}
|
||||
function isUsedInFunctionOrNonStaticProperty(declaration, usage) {
|
||||
var container = ts.getEnclosingBlockScopeContainer(declaration);
|
||||
var current = usage;
|
||||
while (current) {
|
||||
if (current === container) {
|
||||
return false;
|
||||
}
|
||||
if (ts.isFunctionLike(current)) {
|
||||
return true;
|
||||
}
|
||||
var initializerOfNonStaticProperty = current.parent &&
|
||||
current.parent.kind === 141 /* PropertyDeclaration */ &&
|
||||
(current.parent.flags & 128 /* Static */) === 0 &&
|
||||
current.parent.initializer === current;
|
||||
if (initializerOfNonStaticProperty) {
|
||||
return true;
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
var sourceFiles = host.getSourceFiles();
|
||||
return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2);
|
||||
}
|
||||
// Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and
|
||||
// the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
|
||||
@ -13663,32 +13705,7 @@ var ts;
|
||||
// Block-scoped variables cannot be used before their definition
|
||||
var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; });
|
||||
ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
|
||||
// first check if usage is lexically located after the declaration
|
||||
var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation);
|
||||
if (!isUsedBeforeDeclaration) {
|
||||
// lexical check succeeded however code still can be illegal.
|
||||
// - block scoped variables cannot be used in its initializers
|
||||
// let x = x; // illegal but usage is lexically after definition
|
||||
// - in ForIn/ForOf statements variable cannot be contained in expression part
|
||||
// for (let x in x)
|
||||
// for (let x of x)
|
||||
// climb up to the variable declaration skipping binding patterns
|
||||
var variableDeclaration = ts.getAncestor(declaration, 211 /* VariableDeclaration */);
|
||||
var container = ts.getEnclosingBlockScopeContainer(variableDeclaration);
|
||||
if (variableDeclaration.parent.parent.kind === 193 /* VariableStatement */ ||
|
||||
variableDeclaration.parent.parent.kind === 199 /* ForStatement */) {
|
||||
// variable statement/for statement case,
|
||||
// use site should not be inside variable declaration (initializer of declaration or binding element)
|
||||
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container);
|
||||
}
|
||||
else if (variableDeclaration.parent.parent.kind === 201 /* ForOfStatement */ ||
|
||||
variableDeclaration.parent.parent.kind === 200 /* ForInStatement */) {
|
||||
// ForIn/ForOf case - use site should not be used in expression part
|
||||
var expression = variableDeclaration.parent.parent.expression;
|
||||
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container);
|
||||
}
|
||||
}
|
||||
if (isUsedBeforeDeclaration) {
|
||||
if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211 /* VariableDeclaration */), errorLocation)) {
|
||||
error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
}
|
||||
@ -23765,9 +23782,6 @@ var ts;
|
||||
checkSignatureDeclaration(node);
|
||||
var isAsync = ts.isAsyncFunctionLike(node);
|
||||
if (isAsync) {
|
||||
if (!compilerOptions.experimentalAsyncFunctions) {
|
||||
error(node, ts.Diagnostics.Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning);
|
||||
}
|
||||
emitAwaiter = true;
|
||||
}
|
||||
// Do not use hasDynamicName here, because that returns false for well known symbols.
|
||||
@ -25163,7 +25177,7 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
// illegal case: forward reference
|
||||
if (!isDefinedBefore(propertyDecl, member)) {
|
||||
if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) {
|
||||
reportError = false;
|
||||
error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
||||
return undefined;
|
||||
@ -36716,10 +36730,6 @@ var ts;
|
||||
!options.experimentalDecorators) {
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
options.target !== 2 /* ES6 */) {
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.createProgram = createProgram;
|
||||
@ -36948,11 +36958,6 @@ var ts;
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Watch_input_files
|
||||
},
|
||||
{
|
||||
name: "experimentalAsyncFunctions",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Enables_experimental_support_for_ES7_async_functions
|
||||
},
|
||||
{
|
||||
name: "experimentalDecorators",
|
||||
type: "boolean",
|
||||
@ -44753,6 +44758,7 @@ var ts;
|
||||
var node = currentToken;
|
||||
var isRightOfDot = false;
|
||||
var isRightOfOpenTag = false;
|
||||
var isStartingCloseTag = false;
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (contextToken) {
|
||||
// Bail out if this is a known invalid completion location
|
||||
@ -44776,9 +44782,14 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (kind === 25 /* LessThanToken */ && sourceFile.languageVariant === 1 /* JSX */) {
|
||||
isRightOfOpenTag = true;
|
||||
location = contextToken;
|
||||
else if (sourceFile.languageVariant === 1 /* JSX */) {
|
||||
if (kind === 25 /* LessThanToken */) {
|
||||
isRightOfOpenTag = true;
|
||||
location = contextToken;
|
||||
}
|
||||
else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 237 /* JsxClosingElement */) {
|
||||
isStartingCloseTag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var semanticStart = new Date().getTime();
|
||||
@ -44799,6 +44810,12 @@ var ts;
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
else if (isStartingCloseTag) {
|
||||
var tagName = contextToken.parent.parent.openingElement.tagName;
|
||||
symbols = [typeChecker.getSymbolAtLocation(tagName)];
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
else {
|
||||
// For JavaScript or TypeScript, if we're not after a dot, then just try to get the
|
||||
// global symbols in scope. These results should be valid for either language as
|
||||
@ -44935,10 +44952,25 @@ var ts;
|
||||
var start = new Date().getTime();
|
||||
var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
|
||||
isSolelyIdentifierDefinitionLocation(contextToken) ||
|
||||
isDotOfNumericLiteral(contextToken);
|
||||
isDotOfNumericLiteral(contextToken) ||
|
||||
isInJsxText(contextToken);
|
||||
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
|
||||
return result;
|
||||
}
|
||||
function isInJsxText(contextToken) {
|
||||
if (contextToken.kind === 236 /* JsxText */) {
|
||||
return true;
|
||||
}
|
||||
if (contextToken.kind === 27 /* GreaterThanToken */ && contextToken.parent) {
|
||||
if (contextToken.parent.kind === 235 /* JsxOpeningElement */) {
|
||||
return true;
|
||||
}
|
||||
if (contextToken.parent.kind === 237 /* JsxClosingElement */ || contextToken.parent.kind === 234 /* JsxSelfClosingElement */) {
|
||||
return contextToken.parent.parent && contextToken.parent.parent.kind === 233 /* JsxElement */;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isNewIdentifierDefinitionLocation(previousToken) {
|
||||
if (previousToken) {
|
||||
var containingNodeKind = previousToken.parent.kind;
|
||||
|
||||
1
lib/typescriptServices.d.ts
vendored
1
lib/typescriptServices.d.ts
vendored
@ -1348,7 +1348,6 @@ declare namespace ts {
|
||||
watch?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
experimentalAsyncFunctions?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
moduleResolution?: ModuleResolutionKind;
|
||||
[option: string]: string | number | boolean;
|
||||
|
||||
@ -2088,7 +2088,6 @@ var ts;
|
||||
_0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." },
|
||||
Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." },
|
||||
Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." },
|
||||
Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1246, category: ts.DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." },
|
||||
with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." },
|
||||
await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." },
|
||||
Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." },
|
||||
@ -2462,7 +2461,6 @@ var ts;
|
||||
Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." },
|
||||
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
|
||||
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
|
||||
Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." },
|
||||
Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." },
|
||||
Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." },
|
||||
Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." },
|
||||
@ -13435,18 +13433,62 @@ var ts;
|
||||
}
|
||||
// return undefined if we can't find a symbol.
|
||||
}
|
||||
/** Returns true if node1 is defined before node 2**/
|
||||
function isDefinedBefore(node1, node2) {
|
||||
var file1 = ts.getSourceFileOfNode(node1);
|
||||
var file2 = ts.getSourceFileOfNode(node2);
|
||||
if (file1 === file2) {
|
||||
return node1.pos <= node2.pos;
|
||||
function isBlockScopedNameDeclaredBeforeUse(declaration, usage) {
|
||||
var declarationFile = ts.getSourceFileOfNode(declaration);
|
||||
var useFile = ts.getSourceFileOfNode(usage);
|
||||
if (declarationFile !== useFile) {
|
||||
if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) {
|
||||
// nodes are in different files and order cannot be determines
|
||||
return true;
|
||||
}
|
||||
var sourceFiles = host.getSourceFiles();
|
||||
return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile);
|
||||
}
|
||||
if (!compilerOptions.outFile && !compilerOptions.out) {
|
||||
return true;
|
||||
if (declaration.pos <= usage.pos) {
|
||||
// declaration is before usage
|
||||
// still might be illegal if usage is in the initializer of the variable declaration
|
||||
return declaration.kind !== 211 /* VariableDeclaration */ ||
|
||||
!isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
||||
}
|
||||
// declaration is after usage
|
||||
// can be legal if usage is deferred (i.e. inside function or in initializer of instance property)
|
||||
return isUsedInFunctionOrNonStaticProperty(declaration, usage);
|
||||
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
|
||||
var container = ts.getEnclosingBlockScopeContainer(declaration);
|
||||
if (declaration.parent.parent.kind === 193 /* VariableStatement */ ||
|
||||
declaration.parent.parent.kind === 199 /* ForStatement */) {
|
||||
// variable statement/for statement case,
|
||||
// use site should not be inside variable declaration (initializer of declaration or binding element)
|
||||
return isSameScopeDescendentOf(usage, declaration, container);
|
||||
}
|
||||
else if (declaration.parent.parent.kind === 201 /* ForOfStatement */ ||
|
||||
declaration.parent.parent.kind === 200 /* ForInStatement */) {
|
||||
// ForIn/ForOf case - use site should not be used in expression part
|
||||
var expression = declaration.parent.parent.expression;
|
||||
return isSameScopeDescendentOf(usage, expression, container);
|
||||
}
|
||||
}
|
||||
function isUsedInFunctionOrNonStaticProperty(declaration, usage) {
|
||||
var container = ts.getEnclosingBlockScopeContainer(declaration);
|
||||
var current = usage;
|
||||
while (current) {
|
||||
if (current === container) {
|
||||
return false;
|
||||
}
|
||||
if (ts.isFunctionLike(current)) {
|
||||
return true;
|
||||
}
|
||||
var initializerOfNonStaticProperty = current.parent &&
|
||||
current.parent.kind === 141 /* PropertyDeclaration */ &&
|
||||
(current.parent.flags & 128 /* Static */) === 0 &&
|
||||
current.parent.initializer === current;
|
||||
if (initializerOfNonStaticProperty) {
|
||||
return true;
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
var sourceFiles = host.getSourceFiles();
|
||||
return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2);
|
||||
}
|
||||
// Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and
|
||||
// the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
|
||||
@ -13663,32 +13705,7 @@ var ts;
|
||||
// Block-scoped variables cannot be used before their definition
|
||||
var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; });
|
||||
ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
|
||||
// first check if usage is lexically located after the declaration
|
||||
var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation);
|
||||
if (!isUsedBeforeDeclaration) {
|
||||
// lexical check succeeded however code still can be illegal.
|
||||
// - block scoped variables cannot be used in its initializers
|
||||
// let x = x; // illegal but usage is lexically after definition
|
||||
// - in ForIn/ForOf statements variable cannot be contained in expression part
|
||||
// for (let x in x)
|
||||
// for (let x of x)
|
||||
// climb up to the variable declaration skipping binding patterns
|
||||
var variableDeclaration = ts.getAncestor(declaration, 211 /* VariableDeclaration */);
|
||||
var container = ts.getEnclosingBlockScopeContainer(variableDeclaration);
|
||||
if (variableDeclaration.parent.parent.kind === 193 /* VariableStatement */ ||
|
||||
variableDeclaration.parent.parent.kind === 199 /* ForStatement */) {
|
||||
// variable statement/for statement case,
|
||||
// use site should not be inside variable declaration (initializer of declaration or binding element)
|
||||
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container);
|
||||
}
|
||||
else if (variableDeclaration.parent.parent.kind === 201 /* ForOfStatement */ ||
|
||||
variableDeclaration.parent.parent.kind === 200 /* ForInStatement */) {
|
||||
// ForIn/ForOf case - use site should not be used in expression part
|
||||
var expression = variableDeclaration.parent.parent.expression;
|
||||
isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container);
|
||||
}
|
||||
}
|
||||
if (isUsedBeforeDeclaration) {
|
||||
if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211 /* VariableDeclaration */), errorLocation)) {
|
||||
error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name));
|
||||
}
|
||||
}
|
||||
@ -23765,9 +23782,6 @@ var ts;
|
||||
checkSignatureDeclaration(node);
|
||||
var isAsync = ts.isAsyncFunctionLike(node);
|
||||
if (isAsync) {
|
||||
if (!compilerOptions.experimentalAsyncFunctions) {
|
||||
error(node, ts.Diagnostics.Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning);
|
||||
}
|
||||
emitAwaiter = true;
|
||||
}
|
||||
// Do not use hasDynamicName here, because that returns false for well known symbols.
|
||||
@ -25163,7 +25177,7 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
// illegal case: forward reference
|
||||
if (!isDefinedBefore(propertyDecl, member)) {
|
||||
if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) {
|
||||
reportError = false;
|
||||
error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
||||
return undefined;
|
||||
@ -36716,10 +36730,6 @@ var ts;
|
||||
!options.experimentalDecorators) {
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
options.target !== 2 /* ES6 */) {
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.createProgram = createProgram;
|
||||
@ -36948,11 +36958,6 @@ var ts;
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Watch_input_files
|
||||
},
|
||||
{
|
||||
name: "experimentalAsyncFunctions",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Enables_experimental_support_for_ES7_async_functions
|
||||
},
|
||||
{
|
||||
name: "experimentalDecorators",
|
||||
type: "boolean",
|
||||
@ -44753,6 +44758,7 @@ var ts;
|
||||
var node = currentToken;
|
||||
var isRightOfDot = false;
|
||||
var isRightOfOpenTag = false;
|
||||
var isStartingCloseTag = false;
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (contextToken) {
|
||||
// Bail out if this is a known invalid completion location
|
||||
@ -44776,9 +44782,14 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (kind === 25 /* LessThanToken */ && sourceFile.languageVariant === 1 /* JSX */) {
|
||||
isRightOfOpenTag = true;
|
||||
location = contextToken;
|
||||
else if (sourceFile.languageVariant === 1 /* JSX */) {
|
||||
if (kind === 25 /* LessThanToken */) {
|
||||
isRightOfOpenTag = true;
|
||||
location = contextToken;
|
||||
}
|
||||
else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 237 /* JsxClosingElement */) {
|
||||
isStartingCloseTag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var semanticStart = new Date().getTime();
|
||||
@ -44799,6 +44810,12 @@ var ts;
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
else if (isStartingCloseTag) {
|
||||
var tagName = contextToken.parent.parent.openingElement.tagName;
|
||||
symbols = [typeChecker.getSymbolAtLocation(tagName)];
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
else {
|
||||
// For JavaScript or TypeScript, if we're not after a dot, then just try to get the
|
||||
// global symbols in scope. These results should be valid for either language as
|
||||
@ -44935,10 +44952,25 @@ var ts;
|
||||
var start = new Date().getTime();
|
||||
var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
|
||||
isSolelyIdentifierDefinitionLocation(contextToken) ||
|
||||
isDotOfNumericLiteral(contextToken);
|
||||
isDotOfNumericLiteral(contextToken) ||
|
||||
isInJsxText(contextToken);
|
||||
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
|
||||
return result;
|
||||
}
|
||||
function isInJsxText(contextToken) {
|
||||
if (contextToken.kind === 236 /* JsxText */) {
|
||||
return true;
|
||||
}
|
||||
if (contextToken.kind === 27 /* GreaterThanToken */ && contextToken.parent) {
|
||||
if (contextToken.parent.kind === 235 /* JsxOpeningElement */) {
|
||||
return true;
|
||||
}
|
||||
if (contextToken.parent.kind === 237 /* JsxClosingElement */ || contextToken.parent.kind === 234 /* JsxSelfClosingElement */) {
|
||||
return contextToken.parent.parent && contextToken.parent.parent.kind === 233 /* JsxElement */;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isNewIdentifierDefinitionLocation(previousToken) {
|
||||
if (previousToken) {
|
||||
var containingNodeKind = previousToken.parent.kind;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user