mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Merge branch 'master' into templates
Conflicts: src/compiler/diagnosticInformationMap.generated.ts src/compiler/diagnosticMessages.json src/compiler/types.ts src/services/utilities.ts
This commit is contained in:
commit
35cf95c146
2957
bin/tsc.js
2957
bin/tsc.js
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -360,6 +360,9 @@ module ts {
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Enum, SymbolFlags.EnumExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
|
||||
@ -86,6 +86,7 @@ module ts {
|
||||
emitFiles: invokeEmitter,
|
||||
getParentOfSymbol: getParentOfSymbol,
|
||||
getTypeOfSymbol: getTypeOfSymbol,
|
||||
getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol,
|
||||
getPropertiesOfType: getPropertiesOfType,
|
||||
getPropertyOfType: getPropertyOfType,
|
||||
getSignaturesOfType: getSignaturesOfType,
|
||||
@ -191,6 +192,7 @@ module ts {
|
||||
if (flags & SymbolFlags.GetAccessor) result |= SymbolFlags.GetAccessorExcludes;
|
||||
if (flags & SymbolFlags.SetAccessor) result |= SymbolFlags.SetAccessorExcludes;
|
||||
if (flags & SymbolFlags.TypeParameter) result |= SymbolFlags.TypeParameterExcludes;
|
||||
if (flags & SymbolFlags.TypeAlias) result |= SymbolFlags.TypeAliasExcludes;
|
||||
if (flags & SymbolFlags.Import) result |= SymbolFlags.ImportExcludes;
|
||||
return result;
|
||||
}
|
||||
@ -479,7 +481,7 @@ module ts {
|
||||
// import a = |b.c|; // Value, type, namespace
|
||||
// import a = |b.c|.d; // Namespace
|
||||
if (entityName.kind === SyntaxKind.Identifier && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
|
||||
entityName = entityName.parent;
|
||||
entityName = <QualifiedName>entityName.parent;
|
||||
}
|
||||
// Check for case 1 and 3 in the above example
|
||||
if (entityName.kind === SyntaxKind.Identifier || entityName.parent.kind === SyntaxKind.QualifiedName) {
|
||||
@ -1022,6 +1024,19 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getTypeAliasForTypeLiteral(type: Type): Symbol {
|
||||
if (type.symbol && type.symbol.flags & SymbolFlags.TypeLiteral) {
|
||||
var node = type.symbol.declarations[0].parent;
|
||||
while (node.kind === SyntaxKind.ParenType) {
|
||||
node = node.parent;
|
||||
}
|
||||
if (node.kind === SyntaxKind.TypeAliasDeclaration) {
|
||||
return getSymbolOfNode(node);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// This is for caching the result of getSymbolDisplayBuilder. Do not access directly.
|
||||
var _displayBuilder: SymbolDisplayBuilder;
|
||||
function getSymbolDisplayBuilder(): SymbolDisplayBuilder {
|
||||
@ -1212,8 +1227,15 @@ module ts {
|
||||
writeTypeofSymbol(type);
|
||||
}
|
||||
else if (typeStack && contains(typeStack, type)) {
|
||||
// Recursive usage, use any
|
||||
writeKeyword(writer, SyntaxKind.AnyKeyword);
|
||||
// If type is an anonymous type literal in a type alias declaration, use type alias name
|
||||
var typeAlias = getTypeAliasForTypeLiteral(type);
|
||||
if (typeAlias) {
|
||||
buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, SymbolFlags.Type);
|
||||
}
|
||||
else {
|
||||
// Recursive usage, use any
|
||||
writeKeyword(writer, SyntaxKind.AnyKeyword);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!typeStack) {
|
||||
@ -1537,6 +1559,7 @@ module ts {
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
@ -1940,6 +1963,24 @@ module ts {
|
||||
return <InterfaceType>links.declaredType;
|
||||
}
|
||||
|
||||
function getDeclaredTypeOfTypeAlias(symbol: Symbol): Type {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
links.declaredType = resolvingType;
|
||||
var declaration = <TypeAliasDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration);
|
||||
var type = getTypeFromTypeNode(declaration.type);
|
||||
if (links.declaredType === resolvingType) {
|
||||
links.declaredType = type;
|
||||
}
|
||||
}
|
||||
else if (links.declaredType === resolvingType) {
|
||||
links.declaredType = unknownType;
|
||||
var declaration = <TypeAliasDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration);
|
||||
error(declaration.name, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
|
||||
function getDeclaredTypeOfEnum(symbol: Symbol): Type {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
@ -1979,6 +2020,9 @@ module ts {
|
||||
if (symbol.flags & SymbolFlags.Interface) {
|
||||
return getDeclaredTypeOfInterface(symbol);
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.TypeAlias) {
|
||||
return getDeclaredTypeOfTypeAlias(symbol);
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.Enum) {
|
||||
return getDeclaredTypeOfEnum(symbol);
|
||||
}
|
||||
@ -7590,6 +7634,10 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkTypeAliasDeclaration(node: TypeAliasDeclaration) {
|
||||
checkSourceElement(node.type);
|
||||
}
|
||||
|
||||
function getConstantValueForExpression(node: Expression): number {
|
||||
var isNegative = false;
|
||||
if (node.kind === SyntaxKind.PrefixOperator) {
|
||||
@ -7882,6 +7930,8 @@ module ts {
|
||||
return checkClassDeclaration(<ClassDeclaration>node);
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
return checkInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
return checkTypeAliasDeclaration(<TypeAliasDeclaration>node);
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return checkEnumDeclaration(<EnumDeclaration>node);
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
@ -8127,6 +8177,7 @@ module ts {
|
||||
case SyntaxKind.TypeParameter:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return true;
|
||||
}
|
||||
@ -8216,7 +8267,7 @@ module ts {
|
||||
|
||||
function isInRightSideOfImportOrExportAssignment(node: EntityName) {
|
||||
while (node.parent.kind === SyntaxKind.QualifiedName) {
|
||||
node = node.parent;
|
||||
node = <QualifiedName>node.parent;
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.ImportDeclaration) {
|
||||
@ -8250,7 +8301,7 @@ module ts {
|
||||
}
|
||||
|
||||
if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
|
||||
entityName = entityName.parent;
|
||||
entityName = <QualifiedName>entityName.parent;
|
||||
}
|
||||
|
||||
if (isExpression(entityName)) {
|
||||
@ -8263,7 +8314,7 @@ module ts {
|
||||
else if (entityName.kind === SyntaxKind.QualifiedName || entityName.kind === SyntaxKind.PropertyAccess) {
|
||||
var symbol = getNodeLinks(entityName).resolvedSymbol;
|
||||
if (!symbol) {
|
||||
checkPropertyAccess(<PropertyAccess>entityName);
|
||||
checkPropertyAccess(<QualifiedName>entityName);
|
||||
}
|
||||
return getNodeLinks(entityName).resolvedSymbol;
|
||||
}
|
||||
@ -8295,10 +8346,10 @@ module ts {
|
||||
return getSymbolOfNode(node.parent);
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.Identifier && isInRightSideOfImportOrExportAssignment(node)) {
|
||||
if (node.kind === SyntaxKind.Identifier && isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
|
||||
return node.parent.kind === SyntaxKind.ExportAssignment
|
||||
? getSymbolOfEntityName(<Identifier>node)
|
||||
: getSymbolOfPartOfRightHandSideOfImport(node);
|
||||
: getSymbolOfPartOfRightHandSideOfImport(<Identifier>node);
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
@ -8379,7 +8430,7 @@ module ts {
|
||||
return symbol && getTypeOfSymbol(symbol);
|
||||
}
|
||||
|
||||
if (isInRightSideOfImportOrExportAssignment(node)) {
|
||||
if (isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
|
||||
var symbol = getSymbolInfo(node);
|
||||
var declaredType = symbol && getDeclaredTypeOfSymbol(symbol);
|
||||
return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);
|
||||
|
||||
@ -183,9 +183,10 @@ module ts {
|
||||
break;
|
||||
// If not a primitive, the possible types are specified in what is effectively a map of options.
|
||||
default:
|
||||
var value = (args[i++] || "").toLowerCase();
|
||||
if (hasProperty(opt.type, value)) {
|
||||
options[opt.name] = opt.type[value];
|
||||
var map = <Map<number>>opt.type;
|
||||
var key = (args[i++] || "").toLowerCase();
|
||||
if (hasProperty(map, key)) {
|
||||
options[opt.name] = map[key];
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(opt.error));
|
||||
|
||||
@ -120,8 +120,9 @@ module ts {
|
||||
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" },
|
||||
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." },
|
||||
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." },
|
||||
Invalid_template_literal_expected: { code: 1158, category: DiagnosticCategory.Error, key: "Invalid template literal; expected '}'" },
|
||||
Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." },
|
||||
Aliased_type_cannot_be_an_object_type_literal_Use_an_interface_declaration_instead: { code: 1158, category: DiagnosticCategory.Error, key: "Aliased type cannot be an object type literal. Use an interface declaration instead." },
|
||||
Invalid_template_literal_expected: { code: 1159, category: DiagnosticCategory.Error, key: "Invalid template literal; expected '}'" },
|
||||
Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1160, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
@ -268,6 +269,7 @@ module ts {
|
||||
An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: DiagnosticCategory.Error, key: "An enum member cannot have a numeric name." },
|
||||
The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: DiagnosticCategory.Error, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." },
|
||||
Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: DiagnosticCategory.Error, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." },
|
||||
Type_alias_0_circularly_references_itself: { code: 2456, category: DiagnosticCategory.Error, key: "Type alias '{0}' circularly references itself." },
|
||||
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_name_1_from_private_module_2: { code: 4001, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
|
||||
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}'." },
|
||||
@ -347,6 +349,9 @@ module ts {
|
||||
Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
|
||||
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." },
|
||||
Exported_type_alias_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4079, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Exported_type_alias_0_has_or_is_using_name_1_from_private_module_2: { code: 4080, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using name '{1}' from private module '{2}'." },
|
||||
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." },
|
||||
The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." },
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." },
|
||||
Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" },
|
||||
|
||||
@ -471,13 +471,17 @@
|
||||
"category": "Error",
|
||||
"code": 1157
|
||||
},
|
||||
"Aliased type cannot be an object type literal. Use an interface declaration instead.": {
|
||||
"category": "Error",
|
||||
"code": 1158
|
||||
},
|
||||
"Invalid template literal; expected '}'": {
|
||||
"category": "Error",
|
||||
"code": 1158
|
||||
"code": 1159
|
||||
},
|
||||
"Tagged templates are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1159
|
||||
"code": 1160
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
@ -1072,6 +1076,10 @@
|
||||
"category": "Error",
|
||||
"code": 2455
|
||||
},
|
||||
"Type alias '{0}' circularly references itself.": {
|
||||
"category": "Error",
|
||||
"code": 2456
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
@ -1389,6 +1397,18 @@
|
||||
"category": "Error",
|
||||
"code": 4078
|
||||
},
|
||||
"Exported type alias '{0}' has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 4079
|
||||
},
|
||||
"Exported type alias '{0}' has or is using name '{1}' from private module '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 4080
|
||||
},
|
||||
"Exported type alias '{0}' has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4081
|
||||
},
|
||||
|
||||
|
||||
"The current host does not support the '{0}' option.": {
|
||||
|
||||
@ -2692,6 +2692,32 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitTypeAliasDeclaration(node: TypeAliasDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
emitDeclarationFlags(node);
|
||||
write("type ");
|
||||
emitSourceTextOfNode(node.name);
|
||||
write(" = ");
|
||||
getSymbolVisibilityDiagnosticMessage = getTypeAliasDeclarationVisibilityError;
|
||||
resolver.writeTypeAtLocation(node.type, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
}
|
||||
function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
var diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Exported_type_alias_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Exported_type_alias_0_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1;
|
||||
return {
|
||||
diagnosticMessage: diagnosticMessage,
|
||||
errorNode: node,
|
||||
typeName: node.name
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function emitEnumDeclaration(node: EnumDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
@ -3289,6 +3315,8 @@ module ts {
|
||||
return emitInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return emitClassDeclaration(<ClassDeclaration>node);
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
return emitTypeAliasDeclaration(<TypeAliasDeclaration>node);
|
||||
case SyntaxKind.EnumMember:
|
||||
return emitEnumMemberDeclaration(<EnumMember>node);
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
|
||||
@ -336,6 +336,9 @@ module ts {
|
||||
children((<InterfaceDeclaration>node).typeParameters) ||
|
||||
children((<InterfaceDeclaration>node).baseTypes) ||
|
||||
children((<InterfaceDeclaration>node).members);
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
return child((<TypeAliasDeclaration>node).name) ||
|
||||
child((<TypeAliasDeclaration>node).type);
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return child((<EnumDeclaration>node).name) ||
|
||||
children((<EnumDeclaration>node).members);
|
||||
@ -572,6 +575,7 @@ module ts {
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
@ -634,6 +638,7 @@ module ts {
|
||||
return <ClassDeclaration>node;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
// early exit cases - declarations cannot be nested in classes
|
||||
@ -1108,7 +1113,6 @@ module ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
error(Diagnostics.Identifier_expected);
|
||||
|
||||
var node = <Identifier>createMissingNode();
|
||||
node.text = "";
|
||||
return node;
|
||||
@ -3265,6 +3269,7 @@ module ts {
|
||||
case SyntaxKind.ClassKeyword:
|
||||
case SyntaxKind.ModuleKeyword:
|
||||
case SyntaxKind.EnumKeyword:
|
||||
case SyntaxKind.TypeKeyword:
|
||||
// When followed by an identifier, these do not start a statement but might
|
||||
// instead be following declarations
|
||||
if (isDeclarationStart()) {
|
||||
@ -3842,7 +3847,25 @@ module ts {
|
||||
}
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
|
||||
function parseTypeAliasDeclaration(pos: number, flags: NodeFlags): TypeAliasDeclaration {
|
||||
var node = <TypeAliasDeclaration>createNode(SyntaxKind.TypeAliasDeclaration, pos);
|
||||
node.flags = flags;
|
||||
parseExpected(SyntaxKind.TypeKeyword);
|
||||
node.name = parseIdentifier();
|
||||
parseExpected(SyntaxKind.EqualsToken);
|
||||
node.type = parseType();
|
||||
parseSemicolon();
|
||||
var n = node.type;
|
||||
while (n.kind === SyntaxKind.ParenType) {
|
||||
n = (<ParenTypeNode>n).type;
|
||||
}
|
||||
if (n.kind === SyntaxKind.TypeLiteral && (n.pos !== (<TypeLiteralNode>n).members.pos || n.end !== (<TypeLiteralNode>n).members.end)) {
|
||||
grammarErrorOnNode(node.type, Diagnostics.Aliased_type_cannot_be_an_object_type_literal_Use_an_interface_declaration_instead);
|
||||
}
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseAndCheckEnumDeclaration(pos: number, flags: NodeFlags): EnumDeclaration {
|
||||
function isIntegerLiteral(expression: Expression): boolean {
|
||||
function isInteger(literalExpression: LiteralExpression): boolean {
|
||||
@ -4004,6 +4027,7 @@ module ts {
|
||||
case SyntaxKind.InterfaceKeyword:
|
||||
case SyntaxKind.EnumKeyword:
|
||||
case SyntaxKind.ImportKeyword:
|
||||
case SyntaxKind.TypeKeyword:
|
||||
// Not true keywords so ensure an identifier follows
|
||||
return lookAhead(() => nextToken() >= SyntaxKind.Identifier);
|
||||
case SyntaxKind.ModuleKeyword:
|
||||
@ -4061,6 +4085,9 @@ module ts {
|
||||
case SyntaxKind.InterfaceKeyword:
|
||||
result = parseInterfaceDeclaration(pos, flags);
|
||||
break;
|
||||
case SyntaxKind.TypeKeyword:
|
||||
result = parseTypeAliasDeclaration(pos, flags);
|
||||
break;
|
||||
case SyntaxKind.EnumKeyword:
|
||||
result = parseAndCheckEnumDeclaration(pos, flags);
|
||||
break;
|
||||
|
||||
@ -81,6 +81,7 @@ module ts {
|
||||
"throw": SyntaxKind.ThrowKeyword,
|
||||
"true": SyntaxKind.TrueKeyword,
|
||||
"try": SyntaxKind.TryKeyword,
|
||||
"type": SyntaxKind.TypeKeyword,
|
||||
"typeof": SyntaxKind.TypeOfKeyword,
|
||||
"var": SyntaxKind.VarKeyword,
|
||||
"void": SyntaxKind.VoidKeyword,
|
||||
|
||||
@ -137,6 +137,7 @@ module ts {
|
||||
NumberKeyword,
|
||||
SetKeyword,
|
||||
StringKeyword,
|
||||
TypeKeyword,
|
||||
// Parse tree nodes
|
||||
Missing,
|
||||
// Names
|
||||
@ -210,6 +211,7 @@ module ts {
|
||||
FunctionBlock,
|
||||
ClassDeclaration,
|
||||
InterfaceDeclaration,
|
||||
TypeAliasDeclaration,
|
||||
EnumDeclaration,
|
||||
ModuleDeclaration,
|
||||
ModuleBlock,
|
||||
@ -230,7 +232,7 @@ module ts {
|
||||
FirstReservedWord = BreakKeyword,
|
||||
LastReservedWord = WithKeyword,
|
||||
FirstKeyword = BreakKeyword,
|
||||
LastKeyword = StringKeyword,
|
||||
LastKeyword = TypeKeyword,
|
||||
FirstFutureReservedWord = ImplementsKeyword,
|
||||
LastFutureReservedWord = YieldKeyword,
|
||||
FirstTypeNode = TypeReference,
|
||||
@ -238,7 +240,7 @@ module ts {
|
||||
FirstPunctuation = OpenBraceToken,
|
||||
LastPunctuation = CaretEqualsToken,
|
||||
FirstToken = EndOfFileToken,
|
||||
LastToken = StringKeyword,
|
||||
LastToken = TypeKeyword,
|
||||
FirstTriviaToken = SingleLineCommentTrivia,
|
||||
LastTriviaToken = WhitespaceTrivia,
|
||||
FirstLiteralToken = NumericLiteral,
|
||||
@ -292,9 +294,7 @@ module ts {
|
||||
right: Identifier;
|
||||
}
|
||||
|
||||
export interface EntityName extends Node {
|
||||
// Identifier, QualifiedName, or Missing
|
||||
}
|
||||
export type EntityName = Identifier | QualifiedName;
|
||||
|
||||
export interface ParsedSignature {
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
@ -322,7 +322,7 @@ module ts {
|
||||
export interface ParameterDeclaration extends VariableDeclaration { }
|
||||
|
||||
export interface FunctionDeclaration extends Declaration, ParsedSignature {
|
||||
body?: Node; // Block or Expression
|
||||
body?: Block | Expression;
|
||||
}
|
||||
|
||||
export interface MethodDeclaration extends FunctionDeclaration { }
|
||||
@ -388,7 +388,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface FunctionExpression extends Expression, FunctionDeclaration {
|
||||
body: Node; // Required, whereas the member inherited from FunctionDeclaration is optional
|
||||
body: Block | Expression; // Required, whereas the member inherited from FunctionDeclaration is optional
|
||||
}
|
||||
|
||||
// The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral,
|
||||
@ -549,6 +549,10 @@ module ts {
|
||||
members: NodeArray<Node>;
|
||||
}
|
||||
|
||||
export interface TypeAliasDeclaration extends Declaration {
|
||||
type: TypeNode;
|
||||
}
|
||||
|
||||
export interface EnumMember extends Declaration {
|
||||
initializer?: Expression;
|
||||
}
|
||||
@ -558,7 +562,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface ModuleDeclaration extends Declaration {
|
||||
body: Node; // Block or ModuleDeclaration
|
||||
body: Block | ModuleDeclaration;
|
||||
}
|
||||
|
||||
export interface ImportDeclaration extends Declaration {
|
||||
@ -610,40 +614,24 @@ module ts {
|
||||
}
|
||||
|
||||
export interface SourceMapSpan {
|
||||
/** Line number in the js file*/
|
||||
emittedLine: number;
|
||||
/** Column number in the js file */
|
||||
emittedColumn: number;
|
||||
/** Line number in the ts file */
|
||||
sourceLine: number;
|
||||
/** Column number in the ts file */
|
||||
sourceColumn: number;
|
||||
/** Optional name (index into names array) associated with this span */
|
||||
nameIndex?: number;
|
||||
/** ts file (index into sources array) associated with this span*/
|
||||
sourceIndex: number;
|
||||
emittedLine: number; // Line number in the .js file
|
||||
emittedColumn: number; // Column number in the .js file
|
||||
sourceLine: number; // Line number in the .ts file
|
||||
sourceColumn: number; // Column number in the .ts file
|
||||
nameIndex?: number; // Optional name (index into names array) associated with this span
|
||||
sourceIndex: number; // .ts file (index into sources array) associated with this span*/
|
||||
}
|
||||
|
||||
export interface SourceMapData {
|
||||
/** Where the sourcemap file is written */
|
||||
sourceMapFilePath: string;
|
||||
/** source map URL written in the js file */
|
||||
jsSourceMappingURL: string;
|
||||
/** Source map's file field - js file name*/
|
||||
sourceMapFile: string;
|
||||
/** Source map's sourceRoot field - location where the sources will be present if not "" */
|
||||
sourceMapSourceRoot: string;
|
||||
/** Source map's sources field - list of sources that can be indexed in this source map*/
|
||||
sourceMapSources: string[];
|
||||
/** input source file (which one can use on program to get the file)
|
||||
this is one to one mapping with the sourceMapSources list*/
|
||||
inputSourceFileNames: string[];
|
||||
/** Source map's names field - list of names that can be indexed in this source map*/
|
||||
sourceMapNames?: string[];
|
||||
/** Source map's mapping field - encoded source map spans*/
|
||||
sourceMapMappings: string;
|
||||
/** Raw source map spans that were encoded into the sourceMapMappings*/
|
||||
sourceMapDecodedMappings: SourceMapSpan[];
|
||||
sourceMapFilePath: string; // Where the sourcemap file is written
|
||||
jsSourceMappingURL: string; // source map URL written in the .js file
|
||||
sourceMapFile: string; // Source map's file field - .js file name
|
||||
sourceMapSourceRoot: string; // Source map's sourceRoot field - location where the sources will be present if not ""
|
||||
sourceMapSources: string[]; // Source map's sources field - list of sources that can be indexed in this source map
|
||||
inputSourceFileNames: string[]; // Input source file (which one can use on program to get the file), 1:1 mapping with the sourceMapSources list
|
||||
sourceMapNames?: string[]; // Source map's names field - list of names that can be indexed in this source map
|
||||
sourceMapMappings: string; // Source map's mapping field - encoded source map spans
|
||||
sourceMapDecodedMappings: SourceMapSpan[]; // Raw source map spans that were encoded into the sourceMapMappings
|
||||
}
|
||||
|
||||
// Return code used by getEmitOutput function to indicate status of the function
|
||||
@ -674,6 +662,7 @@ module ts {
|
||||
emitFiles(targetSourceFile?: SourceFile): EmitResult;
|
||||
getParentOfSymbol(symbol: Symbol): Symbol;
|
||||
getTypeOfSymbol(symbol: Symbol): Type;
|
||||
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
|
||||
getPropertiesOfType(type: Type): Symbol[];
|
||||
getPropertyOfType(type: Type, propertyName: string): Symbol;
|
||||
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
|
||||
@ -695,11 +684,8 @@ module ts {
|
||||
isUndefinedSymbol(symbol: Symbol): boolean;
|
||||
isArgumentsSymbol(symbol: Symbol): boolean;
|
||||
hasEarlyErrors(sourceFile?: SourceFile): boolean;
|
||||
|
||||
// Returns the constant value of this enum member, or 'undefined' if the enum member has a
|
||||
// computed value.
|
||||
// Returns the constant value of this enum member, or 'undefined' if the enum member has a computed value.
|
||||
getEnumMemberValue(node: EnumMember): number;
|
||||
|
||||
isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
}
|
||||
@ -786,65 +772,60 @@ module ts {
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isImportDeclarationEntityNameReferenceDeclarationVisibile(entityName: EntityName): SymbolAccessiblityResult;
|
||||
|
||||
// Returns the constant value this property access resolves to, or 'undefined' if it does
|
||||
// resolve to a constant.
|
||||
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
|
||||
getConstantValue(node: PropertyAccess): number;
|
||||
hasEarlyErrors(sourceFile?: SourceFile): boolean;
|
||||
}
|
||||
|
||||
export enum SymbolFlags {
|
||||
FunctionScopedVariable = 0x00000001, // Variable (var) or parameter
|
||||
Property = 0x00000002, // Property or enum member
|
||||
EnumMember = 0x00000004, // Enum member
|
||||
Function = 0x00000008, // Function
|
||||
Class = 0x00000010, // Class
|
||||
Interface = 0x00000020, // Interface
|
||||
Enum = 0x00000040, // Enum
|
||||
ValueModule = 0x00000080, // Instantiated module
|
||||
NamespaceModule = 0x00000100, // Uninstantiated module
|
||||
TypeLiteral = 0x00000200, // Type Literal
|
||||
ObjectLiteral = 0x00000400, // Object Literal
|
||||
Method = 0x00000800, // Method
|
||||
Constructor = 0x00001000, // Constructor
|
||||
GetAccessor = 0x00002000, // Get accessor
|
||||
SetAccessor = 0x00004000, // Set accessor
|
||||
CallSignature = 0x00008000, // Call signature
|
||||
ConstructSignature = 0x00010000, // Construct signature
|
||||
IndexSignature = 0x00020000, // Index signature
|
||||
TypeParameter = 0x00040000, // Type parameter
|
||||
BlockScopedVariable = 0x00000002, // A block-scoped variable (let or const)
|
||||
Property = 0x00000004, // Property or enum member
|
||||
EnumMember = 0x00000008, // Enum member
|
||||
Function = 0x00000010, // Function
|
||||
Class = 0x00000020, // Class
|
||||
Interface = 0x00000040, // Interface
|
||||
Enum = 0x00000080, // Enum
|
||||
ValueModule = 0x00000100, // Instantiated module
|
||||
NamespaceModule = 0x00000200, // Uninstantiated module
|
||||
TypeLiteral = 0x00000400, // Type Literal
|
||||
ObjectLiteral = 0x00000800, // Object Literal
|
||||
Method = 0x00001000, // Method
|
||||
Constructor = 0x00002000, // Constructor
|
||||
GetAccessor = 0x00004000, // Get accessor
|
||||
SetAccessor = 0x00008000, // Set accessor
|
||||
CallSignature = 0x00010000, // Call signature
|
||||
ConstructSignature = 0x00020000, // Construct signature
|
||||
IndexSignature = 0x00040000, // Index signature
|
||||
TypeParameter = 0x00080000, // Type parameter
|
||||
TypeAlias = 0x00100000, // Type alias
|
||||
|
||||
// Export markers (see comment in declareModuleMember in binder)
|
||||
ExportValue = 0x00080000, // Exported value marker
|
||||
ExportType = 0x00100000, // Exported type marker
|
||||
ExportNamespace = 0x00200000, // Exported namespace marker
|
||||
|
||||
Import = 0x00400000, // Import
|
||||
Instantiated = 0x00800000, // Instantiated symbol
|
||||
Merged = 0x01000000, // Merged symbol (created during program binding)
|
||||
Transient = 0x02000000, // Transient symbol (created during type check)
|
||||
Prototype = 0x04000000, // Prototype property (no source representation)
|
||||
UnionProperty = 0x08000000, // Property in union type
|
||||
|
||||
BlockScopedVariable = 0x10000000, // A block-scoped variable (let or const)
|
||||
ExportValue = 0x00200000, // Exported value marker
|
||||
ExportType = 0x00400000, // Exported type marker
|
||||
ExportNamespace = 0x00800000, // Exported namespace marker
|
||||
Import = 0x01000000, // Import
|
||||
Instantiated = 0x02000000, // Instantiated symbol
|
||||
Merged = 0x04000000, // Merged symbol (created during program binding)
|
||||
Transient = 0x08000000, // Transient symbol (created during type check)
|
||||
Prototype = 0x10000000, // Prototype property (no source representation)
|
||||
UnionProperty = 0x20000000, // Property in union type
|
||||
|
||||
Variable = FunctionScopedVariable | BlockScopedVariable,
|
||||
Value = Variable | Property | EnumMember | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor,
|
||||
|
||||
Type = Class | Interface | Enum | TypeLiteral | ObjectLiteral | TypeParameter,
|
||||
Type = Class | Interface | Enum | TypeLiteral | ObjectLiteral | TypeParameter | TypeAlias,
|
||||
Namespace = ValueModule | NamespaceModule,
|
||||
Module = ValueModule | NamespaceModule,
|
||||
Accessor = GetAccessor | SetAccessor,
|
||||
Signature = CallSignature | ConstructSignature | IndexSignature,
|
||||
|
||||
|
||||
// Variables can be redeclared, but can not redeclare a block-scoped declaration with the
|
||||
// same name, or any other value that is not a variable, e.g. ValueModule or Class
|
||||
FunctionScopedVariableExcludes = Value & ~FunctionScopedVariable,
|
||||
|
||||
// Block-scoped declarations are not allowed to be re-declared
|
||||
// they can not merge with anything in the value space
|
||||
BlockScopedVariableExcludes = Value,
|
||||
BlockScopedVariableExcludes = Value,
|
||||
|
||||
ParameterExcludes = Value,
|
||||
PropertyExcludes = Value,
|
||||
@ -859,12 +840,10 @@ module ts {
|
||||
GetAccessorExcludes = Value & ~SetAccessor,
|
||||
SetAccessorExcludes = Value & ~GetAccessor,
|
||||
TypeParameterExcludes = Type & ~TypeParameter,
|
||||
TypeAliasExcludes = Type,
|
||||
ImportExcludes = Import, // Imports collide with all other imports with the same name
|
||||
|
||||
|
||||
// Imports collide with all other imports with the same name.
|
||||
ImportExcludes = Import,
|
||||
|
||||
ModuleMember = Variable | Function | Class | Interface | Enum | Module | Import,
|
||||
ModuleMember = Variable | Function | Class | Interface | Enum | Module | TypeAlias | Import,
|
||||
|
||||
ExportHasLocal = Function | Class | Enum | ValueModule,
|
||||
|
||||
@ -872,9 +851,9 @@ module ts {
|
||||
HasExports = Class | Enum | Module,
|
||||
HasMembers = Class | Interface | TypeLiteral | ObjectLiteral,
|
||||
|
||||
IsContainer = HasLocals | HasExports | HasMembers,
|
||||
PropertyOrAccessor = Property | Accessor,
|
||||
Export = ExportNamespace | ExportType | ExportValue,
|
||||
IsContainer = HasLocals | HasExports | HasMembers,
|
||||
PropertyOrAccessor = Property | Accessor,
|
||||
Export = ExportNamespace | ExportType | ExportValue,
|
||||
}
|
||||
|
||||
export interface Symbol {
|
||||
@ -1124,7 +1103,7 @@ module ts {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
[option: string]: any;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
|
||||
export enum ModuleKind {
|
||||
@ -1157,7 +1136,7 @@ module ts {
|
||||
|
||||
export interface CommandLineOption {
|
||||
name: string;
|
||||
type: any; // "string", "number", "boolean", or an object literal mapping named values to actual values
|
||||
type: string | Map<number>; // "string", "number", "boolean", or an object literal mapping named values to actual values
|
||||
shortName?: string; // A short pneumonic for convenience - for instance, 'h' can be used in place of 'help'.
|
||||
description?: DiagnosticMessage; // The message describing what the command line switch does
|
||||
paramName?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter.
|
||||
|
||||
@ -108,7 +108,7 @@ module ts.formatting {
|
||||
function getActualIndentationForListItemBeforeComma(commaToken: Node, sourceFile: SourceFile, options: TypeScript.FormattingOptions): number {
|
||||
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
|
||||
var commaItemInfo = findListItemInfo(commaToken);
|
||||
Debug.assert(commaItemInfo.listItemIndex > 0);
|
||||
Debug.assert(commaItemInfo && commaItemInfo.listItemIndex > 0);
|
||||
// The item we're interested in is right before the comma
|
||||
return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options);
|
||||
}
|
||||
|
||||
@ -711,6 +711,7 @@ module ts {
|
||||
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
@ -1191,6 +1192,9 @@ module ts {
|
||||
// interface Y {}
|
||||
static interfaceElement = "interface";
|
||||
|
||||
// type T = ...
|
||||
static typeElement = "type";
|
||||
|
||||
// enum E
|
||||
static enumElement = "enum";
|
||||
|
||||
@ -2395,8 +2399,8 @@ module ts {
|
||||
node = currentToken;
|
||||
isRightOfDot = false;
|
||||
}
|
||||
|
||||
// Clear the current activeCompletionSession for this session
|
||||
|
||||
// Clear the current activeCompletionSession for this session
|
||||
activeCompletionSession = {
|
||||
filename: filename,
|
||||
position: position,
|
||||
@ -2443,8 +2447,8 @@ module ts {
|
||||
}
|
||||
else {
|
||||
var containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(previousToken);
|
||||
if (containingObjectLiteral) {
|
||||
// Object literal expression, look up possible property names from contextual type
|
||||
if (containingObjectLiteral) {
|
||||
// Object literal expression, look up possible property names from contextual type
|
||||
isMemberCompletion = true;
|
||||
|
||||
var contextualType = typeInfoResolver.getContextualType(containingObjectLiteral);
|
||||
@ -2747,6 +2751,7 @@ module ts {
|
||||
|
||||
if (flags & SymbolFlags.Class) return ScriptElementKind.classElement;
|
||||
if (flags & SymbolFlags.Enum) return ScriptElementKind.enumElement;
|
||||
if (flags & SymbolFlags.TypeAlias) return ScriptElementKind.typeElement;
|
||||
if (flags & SymbolFlags.Interface) return ScriptElementKind.interfaceElement;
|
||||
if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement;
|
||||
|
||||
@ -2818,6 +2823,7 @@ module ts {
|
||||
case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement;
|
||||
case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement;
|
||||
case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement;
|
||||
case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement;
|
||||
case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement;
|
||||
case SyntaxKind.VariableDeclaration: return node.flags & NodeFlags.Const ? ScriptElementKind.constantElement: ScriptElementKind.variableElement;
|
||||
case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement;
|
||||
@ -2832,8 +2838,8 @@ module ts {
|
||||
case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement;
|
||||
case SyntaxKind.EnumMember: return ScriptElementKind.variableElement;
|
||||
case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement;
|
||||
return ScriptElementKind.unknown;
|
||||
}
|
||||
return ScriptElementKind.unknown;
|
||||
}
|
||||
|
||||
function getSymbolModifiers(symbol: Symbol): string {
|
||||
@ -2982,6 +2988,16 @@ module ts {
|
||||
addFullSymbolName(symbol);
|
||||
writeTypeParametersOfSymbol(symbol, sourceFile);
|
||||
}
|
||||
if (symbolFlags & SymbolFlags.TypeAlias) {
|
||||
addNewLineIfDisplayPartsExist();
|
||||
displayParts.push(keywordPart(SyntaxKind.TypeKeyword));
|
||||
displayParts.push(spacePart());
|
||||
addFullSymbolName(symbol);
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(punctuationPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, typeResolver.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration));
|
||||
}
|
||||
if (symbolFlags & SymbolFlags.Enum) {
|
||||
addNewLineIfDisplayPartsExist();
|
||||
displayParts.push(keywordPart(SyntaxKind.EnumKeyword));
|
||||
@ -4569,6 +4585,7 @@ module ts {
|
||||
|
||||
case SyntaxKind.TypeParameter:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
return SemanticMeaning.Type;
|
||||
|
||||
@ -4615,11 +4632,10 @@ module ts {
|
||||
return root.parent.kind === SyntaxKind.TypeReference && !isLastClause;
|
||||
}
|
||||
|
||||
function isInRightSideOfImport(node: EntityName) {
|
||||
function isInRightSideOfImport(node: Node) {
|
||||
while (node.parent.kind === SyntaxKind.QualifiedName) {
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return node.parent.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node.parent).entityName === node;
|
||||
}
|
||||
|
||||
|
||||
@ -226,12 +226,12 @@ module ts.SignatureHelp {
|
||||
};
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.GreaterThanToken
|
||||
|| node.kind === SyntaxKind.CloseParenToken
|
||||
|| node === parent.func) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// findListItemInfo can return undefined if we are not in parent's argument list
|
||||
// or type argument list. This includes cases where the cursor is:
|
||||
// - To the right of the closing paren
|
||||
// - Between the type arguments and the arguments (greater than token)
|
||||
// - On the target of the call (parent.func)
|
||||
// - On the 'new' keyword in a 'new' expression
|
||||
return findListItemInfo(node);
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,15 @@ module ts {
|
||||
|
||||
export function findListItemInfo(node: Node): ListItemInfo {
|
||||
var syntaxList = findContainingList(node);
|
||||
|
||||
// It is possible at this point for syntaxList to be undefined, either if
|
||||
// node.parent had no list child, or if none of its list children contained
|
||||
// the span of node. If this happens, return undefined. The caller should
|
||||
// handle this case.
|
||||
if (!syntaxList) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var children = syntaxList.getChildren();
|
||||
var index = indexOf(children, node);
|
||||
|
||||
@ -32,13 +41,6 @@ module ts {
|
||||
}
|
||||
});
|
||||
|
||||
// syntaxList should not be undefined here. If it is, there is a problem. Find out if
|
||||
// there at least is a child that is a list.
|
||||
if (!syntaxList) {
|
||||
Debug.assert(findChildOfKind(node.parent, SyntaxKind.SyntaxList) !== undefined,
|
||||
"Node of kind " + SyntaxKind[node.parent.kind] + " has no list children");
|
||||
}
|
||||
|
||||
return syntaxList;
|
||||
}
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(12,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(14,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(16,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(18,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(20,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(22,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(12,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(14,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(16,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(18,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(20,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(22,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts (10 errors) ====
|
||||
@ -24,39 +24,39 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTyped
|
||||
|
||||
f `abc`
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc`.member
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`.member;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc`["member"];
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`["member"];
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc`[0].member `abc${1}def${2}ghi`;
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`["member"].member `abc${1}def${2}ghi`;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f.thisIsNotATag(`abc`);
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts(13,21): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts(13,21): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts (1 errors) ====
|
||||
@ -16,6 +16,6 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMember
|
||||
|
||||
var x = new new new f `abc${ 0 }def`.member("hello")(42) === true;
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(3,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(5,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(7,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(9,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(11,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(13,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(15,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(17,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(19,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(19,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(21,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(21,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(3,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(5,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(7,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(9,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(11,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(13,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(15,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(17,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(19,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(19,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(21,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(21,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts (12 errors) ====
|
||||
@ -17,47 +17,47 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts
|
||||
|
||||
f `abc`
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f.g.h `abc`
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f.g.h `abc${1}def${2}ghi`;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc`.member
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`.member;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc`["member"];
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`["member"];
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc`["member"].someOtherTag `abc${1}def${2}ghi`;
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`["member"].someOtherTag `abc${1}def${2}ghi`;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f.thisIsNotATag(`abc`);
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(12,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(14,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(16,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(18,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(20,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(22,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(24,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(24,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(12,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(14,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(16,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(18,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(20,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(22,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(24,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(24,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,1): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts (10 errors) ====
|
||||
@ -24,39 +24,39 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,1
|
||||
|
||||
f `abc`
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc`.member
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`.member;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc`["member"];
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`["member"];
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc`[0].member `abc${1}def${2}ghi`;
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f `abc${1}def${2}ghi`["member"].member `abc${1}def${2}ghi`;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
f.thisIsNotATag(`abc`);
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,21): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,24): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,1): error TS2304: Cannot find name 'declare'.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS2304: Cannot find name 'module'.
|
||||
@ -15,7 +15,7 @@ tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error
|
||||
~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~
|
||||
@ -28,7 +28,7 @@ tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error
|
||||
~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(1,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(1,9): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,5): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,8): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,10): error TS1134: Variable declaration expected.
|
||||
@ -12,7 +12,7 @@ tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(4,1): err
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
`b`: 321
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(1,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(1,9): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(2,5): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(2,8): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(2,10): error TS1134: Variable declaration expected.
|
||||
@ -10,7 +10,7 @@ tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(3,1): err
|
||||
~
|
||||
`a`: 321
|
||||
~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(1,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(1,9): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(2,5): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(2,32): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(2,34): error TS1134: Variable declaration expected.
|
||||
@ -10,7 +10,7 @@ tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(3,1): err
|
||||
~
|
||||
`abc${ 123 }def${ 456 }ghi`: 321
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,9): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,15): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,13): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,11): error TS2304: Cannot find name 'gen'.
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,13): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
@ -16,7 +16,7 @@ tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,13): err
|
||||
// Once this is supported, the inner expression does not need to be parenthesized.
|
||||
var x = yield `abc${ x }def`;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,9): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,15): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,26): error TS1158: Invalid template literal; expected '}'
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,30): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,26): error TS1159: Invalid template literal; expected '}'
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,30): error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(5,1): error TS1126: Unexpected end of text.
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,11): error TS2304: Cannot find name 'gen'.
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,20): error TS2304: Cannot find name 'yield'.
|
||||
@ -19,7 +19,7 @@ tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(
|
||||
// Once this is supported, yield *must* be parenthesized.
|
||||
var x = `abc${ yield 10 }def`;
|
||||
~~
|
||||
!!! error TS1158: Invalid template literal; expected '}'
|
||||
!!! error TS1159: Invalid template literal; expected '}'
|
||||
~~~~~
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
@ -29,6 +29,6 @@ tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(
|
||||
~
|
||||
|
||||
|
||||
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS1160: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
!!! error TS1126: Unexpected end of text.
|
||||
@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,9): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,17): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,26): error TS1158: Invalid template literal; expected '}'
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,26): error TS1159: Invalid template literal; expected '}'
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(5,1): error TS1126: Unexpected end of text.
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,11): error TS2304: Cannot find name 'gen'.
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,20): error TS2304: Cannot find name 'yield'.
|
||||
@ -18,7 +18,7 @@ tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.
|
||||
// Once this is supported, yield *must* be parenthesized.
|
||||
var x = `abc${ yield 10 }def`;
|
||||
~~
|
||||
!!! error TS1158: Invalid template literal; expected '}'
|
||||
!!! error TS1159: Invalid template literal; expected '}'
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
~~~
|
||||
|
||||
14
tests/cases/fourslash/noSignatureHelpOnNewKeyword.ts
Normal file
14
tests/cases/fourslash/noSignatureHelpOnNewKeyword.ts
Normal file
@ -0,0 +1,14 @@
|
||||
///<reference path="fourslash.ts"/>
|
||||
|
||||
////class Foo { }
|
||||
////new/*1*/ Foo
|
||||
////new /*2*/Foo(/*3*/)
|
||||
|
||||
goTo.marker('1');
|
||||
verify.not.signatureHelpPresent();
|
||||
|
||||
goTo.marker('2');
|
||||
verify.not.signatureHelpPresent();
|
||||
|
||||
goTo.marker('3');
|
||||
verify.signatureHelpPresent();
|
||||
Loading…
x
Reference in New Issue
Block a user