mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into es6Typings
This commit is contained in:
+2132
-1776
File diff suppressed because it is too large
Load Diff
+2690
-2232
File diff suppressed because it is too large
Load Diff
+19
-2
@@ -53,6 +53,16 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if any of the following are true:
|
||||
* 1. declaration has no name
|
||||
* 2. declaration has a literal name (not computed)
|
||||
* 3. declaration has a computed property name that is a known symbol
|
||||
*/
|
||||
export function hasComputedNameButNotSymbol(declaration: Declaration): boolean {
|
||||
return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName;
|
||||
}
|
||||
|
||||
export function bindSourceFile(file: SourceFile) {
|
||||
|
||||
var parent: Node;
|
||||
@@ -84,13 +94,14 @@ module ts {
|
||||
if (symbolKind & SymbolFlags.Value && !symbol.valueDeclaration) symbol.valueDeclaration = node;
|
||||
}
|
||||
|
||||
// TODO(jfreeman): Implement getDeclarationName for property name
|
||||
// Should not be called on a declaration with a computed property name.
|
||||
function getDeclarationName(node: Declaration): string {
|
||||
if (node.name) {
|
||||
if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) {
|
||||
return '"' + (<LiteralExpression>node.name).text + '"';
|
||||
}
|
||||
return (<Identifier>node.name).text;
|
||||
Debug.assert(!hasComputedNameButNotSymbol(node));
|
||||
return (<Identifier | LiteralExpression>node.name).text;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ConstructorType:
|
||||
@@ -111,6 +122,12 @@ module ts {
|
||||
}
|
||||
|
||||
function declareSymbol(symbols: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol {
|
||||
// Nodes with computed property names will not get symbols, because the type checker
|
||||
// does not make properties for them.
|
||||
if (hasComputedNameButNotSymbol(node)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var name = getDeclarationName(node);
|
||||
if (name !== undefined) {
|
||||
var symbol = hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name));
|
||||
|
||||
+99
-78
@@ -1663,7 +1663,7 @@ module ts {
|
||||
if (declaration.kind === SyntaxKind.Parameter) {
|
||||
var func = <FunctionLikeDeclaration>declaration.parent;
|
||||
// For a parameter of a set accessor, use the type of the get accessor if one is present
|
||||
if (func.kind === SyntaxKind.SetAccessor) {
|
||||
if (func.kind === SyntaxKind.SetAccessor && !hasComputedNameButNotSymbol(func)) {
|
||||
var getter = <AccessorDeclaration>getDeclarationOfKind(declaration.parent.symbol, SyntaxKind.GetAccessor);
|
||||
if (getter) {
|
||||
return getReturnTypeOfSignature(getSignatureFromDeclaration(getter));
|
||||
@@ -2531,7 +2531,7 @@ module ts {
|
||||
else {
|
||||
// TypeScript 1.0 spec (April 2014):
|
||||
// If only one accessor includes a type annotation, the other behaves as if it had the same type annotation.
|
||||
if (declaration.kind === SyntaxKind.GetAccessor) {
|
||||
if (declaration.kind === SyntaxKind.GetAccessor && !hasComputedNameButNotSymbol(declaration)) {
|
||||
var setter = <AccessorDeclaration>getDeclarationOfKind(declaration.symbol, SyntaxKind.SetAccessor);
|
||||
returnType = getAnnotatedAccessorType(setter);
|
||||
}
|
||||
@@ -6106,6 +6106,12 @@ module ts {
|
||||
checkSignatureDeclaration(node);
|
||||
}
|
||||
}
|
||||
|
||||
if (fullTypeCheck) {
|
||||
checkCollisionWithCapturedSuperVariable(node, node.name);
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -6648,9 +6654,6 @@ module ts {
|
||||
checkSourceElement(node.type);
|
||||
}
|
||||
if (fullTypeCheck) {
|
||||
checkCollisionWithCapturedSuperVariable(node, node.name);
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
|
||||
checkCollisionWithArgumentsInGeneratedCode(node);
|
||||
if (compilerOptions.noImplicitAny && !node.type) {
|
||||
switch (node.kind) {
|
||||
@@ -6711,17 +6714,16 @@ module ts {
|
||||
}
|
||||
|
||||
function checkPropertyDeclaration(node: PropertyDeclaration) {
|
||||
// TODO
|
||||
checkVariableDeclaration(node);
|
||||
if (fullTypeCheck) {
|
||||
checkVariableOrPropertyInFullTypeCheck(node);
|
||||
}
|
||||
}
|
||||
|
||||
function checkMethodDeclaration(node: MethodDeclaration) {
|
||||
// TODO
|
||||
checkFunctionDeclaration(node);
|
||||
checkFunctionLikeDeclaration(node);
|
||||
}
|
||||
|
||||
function checkConstructorDeclaration(node: ConstructorDeclaration) {
|
||||
// TODO
|
||||
checkSignatureDeclaration(node);
|
||||
checkSourceElement(node.body);
|
||||
|
||||
@@ -6812,29 +6814,32 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
// TypeScript 1.0 spec (April 2014): 8.4.3
|
||||
// Accessors for the same member name must specify the same accessibility.
|
||||
var otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor;
|
||||
var otherAccessor = <AccessorDeclaration>getDeclarationOfKind(node.symbol, otherKind);
|
||||
if (otherAccessor) {
|
||||
if (((node.flags & NodeFlags.AccessibilityModifier) !== (otherAccessor.flags & NodeFlags.AccessibilityModifier))) {
|
||||
error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);
|
||||
}
|
||||
if (!hasComputedNameButNotSymbol(node)) {
|
||||
// TypeScript 1.0 spec (April 2014): 8.4.3
|
||||
// Accessors for the same member name must specify the same accessibility.
|
||||
var otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor;
|
||||
var otherAccessor = <AccessorDeclaration>getDeclarationOfKind(node.symbol, otherKind);
|
||||
if (otherAccessor) {
|
||||
if (((node.flags & NodeFlags.AccessibilityModifier) !== (otherAccessor.flags & NodeFlags.AccessibilityModifier))) {
|
||||
error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);
|
||||
}
|
||||
|
||||
var thisType = getAnnotatedAccessorType(node);
|
||||
var otherType = getAnnotatedAccessorType(otherAccessor);
|
||||
// TypeScript 1.0 spec (April 2014): 4.5
|
||||
// If both accessors include type annotations, the specified types must be identical.
|
||||
if (thisType && otherType) {
|
||||
if (!isTypeIdenticalTo(thisType, otherType)) {
|
||||
error(node, Diagnostics.get_and_set_accessor_must_have_the_same_type);
|
||||
var currentAccessorType = getAnnotatedAccessorType(node);
|
||||
var otherAccessorType = getAnnotatedAccessorType(otherAccessor);
|
||||
// TypeScript 1.0 spec (April 2014): 4.5
|
||||
// If both accessors include type annotations, the specified types must be identical.
|
||||
if (currentAccessorType && otherAccessorType) {
|
||||
if (!isTypeIdenticalTo(currentAccessorType, otherAccessorType)) {
|
||||
error(node, Diagnostics.get_and_set_accessor_must_have_the_same_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
|
||||
}
|
||||
}
|
||||
|
||||
checkFunctionDeclaration(node);
|
||||
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
|
||||
checkFunctionLikeDeclaration(node);
|
||||
}
|
||||
|
||||
function checkTypeReference(node: TypeReferenceNode) {
|
||||
@@ -7088,7 +7093,7 @@ module ts {
|
||||
}
|
||||
|
||||
if (duplicateFunctionDeclaration) {
|
||||
forEach( declarations, declaration => {
|
||||
forEach(declarations, declaration => {
|
||||
error(declaration.name, Diagnostics.Duplicate_function_implementation);
|
||||
});
|
||||
}
|
||||
@@ -7204,26 +7209,37 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkFunctionDeclaration(node: FunctionLikeDeclaration): void {
|
||||
function checkFunctionDeclaration(node: FunctionDeclaration): void {
|
||||
checkFunctionLikeDeclaration(node);
|
||||
if (fullTypeCheck) {
|
||||
checkCollisionWithCapturedSuperVariable(node, node.name);
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
|
||||
}
|
||||
}
|
||||
|
||||
function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void {
|
||||
checkSignatureDeclaration(node);
|
||||
|
||||
var symbol = getSymbolOfNode(node);
|
||||
// first we want to check the local symbol that contain this declaration
|
||||
// - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol
|
||||
// - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode
|
||||
var localSymbol = node.localSymbol || symbol;
|
||||
if (!hasComputedNameButNotSymbol(node)) {
|
||||
// first we want to check the local symbol that contain this declaration
|
||||
// - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol
|
||||
// - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var localSymbol = node.localSymbol || symbol;
|
||||
|
||||
var firstDeclaration = getDeclarationOfKind(localSymbol, node.kind);
|
||||
// Only type check the symbol once
|
||||
if (node === firstDeclaration) {
|
||||
checkFunctionOrConstructorSymbol(localSymbol);
|
||||
}
|
||||
var firstDeclaration = getDeclarationOfKind(localSymbol, node.kind);
|
||||
// Only type check the symbol once
|
||||
if (node === firstDeclaration) {
|
||||
checkFunctionOrConstructorSymbol(localSymbol);
|
||||
}
|
||||
|
||||
if (symbol.parent) {
|
||||
// run check once for the first declaration
|
||||
if (getDeclarationOfKind(symbol, node.kind) === node) {
|
||||
// run check on export symbol to check that modifiers agree across all exported declarations
|
||||
checkFunctionOrConstructorSymbol(symbol);
|
||||
if (symbol.parent) {
|
||||
// run check once for the first declaration
|
||||
if (getDeclarationOfKind(symbol, node.kind) === node) {
|
||||
// run check on export symbol to check that modifiers agree across all exported declarations
|
||||
checkFunctionOrConstructorSymbol(symbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7344,9 +7360,8 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(jfreeman): Decide what to do for computed properties
|
||||
function needCollisionCheckForIdentifier(node: Node, identifier: DeclarationName, name: string): boolean {
|
||||
if (!(identifier && (<Identifier>identifier).text === name)) {
|
||||
function needCollisionCheckForIdentifier(node: Node, identifier: Identifier, name: string): boolean {
|
||||
if (!identifier || identifier.text !== name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -7371,12 +7386,10 @@ module ts {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO(jfreeman): Decide what to do for computed properties
|
||||
function checkCollisionWithCapturedThisVariable(node: Node, name: DeclarationName): void {
|
||||
if (!needCollisionCheckForIdentifier(node, name, "_this")) {
|
||||
return;
|
||||
function checkCollisionWithCapturedThisVariable(node: Node, name: Identifier): void {
|
||||
if (needCollisionCheckForIdentifier(node, name, "_this")) {
|
||||
potentialThisCollisions.push(node);
|
||||
}
|
||||
potentialThisCollisions.push(node);
|
||||
}
|
||||
|
||||
// this function will run after checking the source file so 'CaptureThis' is correct for all nodes
|
||||
@@ -7397,7 +7410,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkCollisionWithCapturedSuperVariable(node: Node, name: DeclarationName) {
|
||||
function checkCollisionWithCapturedSuperVariable(node: Node, name: Identifier) {
|
||||
if (!needCollisionCheckForIdentifier(node, name, "_super")) {
|
||||
return;
|
||||
}
|
||||
@@ -7420,8 +7433,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(jfreeman): Decide what to do for computed properties
|
||||
function checkCollisionWithRequireExportsInGeneratedCode(node: Node, name: DeclarationName) {
|
||||
function checkCollisionWithRequireExportsInGeneratedCode(node: Node, name: Identifier) {
|
||||
if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
||||
return;
|
||||
}
|
||||
@@ -7472,40 +7484,49 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkVariableDeclaration(node: VariableDeclaration | PropertyDeclaration) {
|
||||
function checkVariableOrPropertyInFullTypeCheck(node: VariableDeclaration | PropertyDeclaration) {
|
||||
Debug.assert(fullTypeCheck);
|
||||
checkSourceElement(node.type);
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
|
||||
if (hasComputedNameButNotSymbol(node)) {
|
||||
// Just check the initializer, since this property won't contribute to the enclosing type
|
||||
return node.initializer ? checkAndMarkExpression(node.initializer) : anyType;
|
||||
}
|
||||
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var type: Type;
|
||||
if (symbol.valueDeclaration !== node) {
|
||||
type = getTypeOfVariableOrPropertyDeclaration(node);
|
||||
}
|
||||
else {
|
||||
type = getTypeOfVariableOrParameterOrProperty(symbol);
|
||||
}
|
||||
|
||||
if (node.initializer && !(getNodeLinks(node.initializer).flags & NodeCheckFlags.TypeChecked)) {
|
||||
// Use default messages
|
||||
checkTypeAssignableTo(checkAndMarkExpression(node.initializer), type, node, /*headMessage*/ undefined);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
function checkVariableDeclaration(node: VariableDeclaration) {
|
||||
if (fullTypeCheck) {
|
||||
var symbol = getSymbolOfNode(node);
|
||||
|
||||
var typeOfValueDeclaration = getTypeOfVariableOrParameterOrProperty(symbol);
|
||||
var type: Type;
|
||||
var useTypeFromValueDeclaration = node === symbol.valueDeclaration;
|
||||
if (useTypeFromValueDeclaration) {
|
||||
type = typeOfValueDeclaration;
|
||||
}
|
||||
else {
|
||||
type = getTypeOfVariableOrPropertyDeclaration(node);
|
||||
}
|
||||
|
||||
|
||||
var type = checkVariableOrPropertyInFullTypeCheck(node);
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
if (node.initializer) {
|
||||
if (!(getNodeLinks(node.initializer).flags & NodeCheckFlags.TypeChecked)) {
|
||||
// Use default messages
|
||||
checkTypeAssignableTo(checkAndMarkExpression(node.initializer), type, node, /*headMessage*/ undefined);
|
||||
}
|
||||
//TODO(jfreeman): Check that it is not a computed property
|
||||
checkCollisionWithConstDeclarations(<VariableDeclaration>node);
|
||||
checkCollisionWithConstDeclarations(node);
|
||||
}
|
||||
|
||||
checkCollisionWithCapturedSuperVariable(node, node.name);
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
|
||||
if (!useTypeFromValueDeclaration) {
|
||||
var symbol = getSymbolOfNode(node);
|
||||
if (node !== symbol.valueDeclaration) {
|
||||
// TypeScript 1.0 spec (April 2014): 5.1
|
||||
// Multiple declarations for the same variable name in the same declaration space are permitted,
|
||||
// provided that each declaration associates the same type with the variable.
|
||||
var typeOfValueDeclaration = getTypeOfVariableOrParameterOrProperty(symbol);
|
||||
if (typeOfValueDeclaration !== unknownType && type !== unknownType && !isTypeIdenticalTo(typeOfValueDeclaration, type)) {
|
||||
error(node.name, Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, declarationNameToString(node.name), typeToString(typeOfValueDeclaration), typeToString(type));
|
||||
}
|
||||
@@ -8365,7 +8386,7 @@ module ts {
|
||||
case SyntaxKind.ParenType:
|
||||
return checkSourceElement((<ParenTypeNode>node).type);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
return checkFunctionDeclaration(<FunctionLikeDeclaration>node);
|
||||
return checkFunctionDeclaration(<FunctionDeclaration>node);
|
||||
case SyntaxKind.Block:
|
||||
return checkBlock(<Block>node);
|
||||
case SyntaxKind.FunctionBlock:
|
||||
|
||||
@@ -126,6 +126,14 @@ module ts {
|
||||
Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." },
|
||||
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
|
||||
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." },
|
||||
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
|
||||
Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." },
|
||||
Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." },
|
||||
Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." },
|
||||
Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." },
|
||||
Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." },
|
||||
Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." },
|
||||
A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." },
|
||||
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." },
|
||||
@@ -414,5 +422,7 @@ module ts {
|
||||
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
|
||||
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
|
||||
generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "'generators' are not currently supported." },
|
||||
};
|
||||
}
|
||||
@@ -495,6 +495,38 @@
|
||||
"category": "Error",
|
||||
"code": 1163
|
||||
},
|
||||
"Computed property names are not allowed in enums.": {
|
||||
"category": "Error",
|
||||
"code": 1164
|
||||
},
|
||||
"Computed property names are not allowed in an ambient context.": {
|
||||
"category": "Error",
|
||||
"code": 1165
|
||||
},
|
||||
"Computed property names are not allowed in class property declarations.": {
|
||||
"category": "Error",
|
||||
"code": 1166
|
||||
},
|
||||
"Computed property names are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1167
|
||||
},
|
||||
"Computed property names are not allowed in method overloads.": {
|
||||
"category": "Error",
|
||||
"code": 1168
|
||||
},
|
||||
"Computed property names are not allowed in interfaces.": {
|
||||
"category": "Error",
|
||||
"code": 1169
|
||||
},
|
||||
"Computed property names are not allowed in type literals.": {
|
||||
"category": "Error",
|
||||
"code": 1170
|
||||
},
|
||||
"A comma expression is not allowed in a computed property name.": {
|
||||
"category": "Error",
|
||||
"code": 1171
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
@@ -1654,5 +1686,13 @@
|
||||
"You cannot rename this element.": {
|
||||
"category": "Error",
|
||||
"code": 8000
|
||||
},
|
||||
"'yield' expressions are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9000
|
||||
},
|
||||
"'generators' are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9001
|
||||
}
|
||||
}
|
||||
|
||||
+53
-24
@@ -277,24 +277,37 @@ module ts {
|
||||
var firstAccessor: AccessorDeclaration;
|
||||
var getAccessor: AccessorDeclaration;
|
||||
var setAccessor: AccessorDeclaration;
|
||||
forEach(node.members, (member: Declaration) => {
|
||||
// TODO(jfreeman): Handle computed names for accessor matching
|
||||
if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) &&
|
||||
(<Identifier>member.name).text === (<Identifier>accessor.name).text &&
|
||||
(member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) {
|
||||
if (!firstAccessor) {
|
||||
firstAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
|
||||
if (member.kind === SyntaxKind.GetAccessor && !getAccessor) {
|
||||
getAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
|
||||
if (member.kind === SyntaxKind.SetAccessor && !setAccessor) {
|
||||
setAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
if (accessor.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
firstAccessor = accessor;
|
||||
if (accessor.kind === SyntaxKind.GetAccessor) {
|
||||
getAccessor = accessor;
|
||||
}
|
||||
});
|
||||
else if (accessor.kind === SyntaxKind.SetAccessor) {
|
||||
setAccessor = accessor;
|
||||
}
|
||||
else {
|
||||
Debug.fail("Accessor has wrong kind");
|
||||
}
|
||||
}
|
||||
else {
|
||||
forEach(node.members,(member: Declaration) => {
|
||||
if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) &&
|
||||
(<Identifier>member.name).text === (<Identifier>accessor.name).text &&
|
||||
(member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) {
|
||||
if (!firstAccessor) {
|
||||
firstAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
|
||||
if (member.kind === SyntaxKind.GetAccessor && !getAccessor) {
|
||||
getAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
|
||||
if (member.kind === SyntaxKind.SetAccessor && !setAccessor) {
|
||||
setAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
firstAccessor,
|
||||
getAccessor,
|
||||
@@ -715,7 +728,7 @@ module ts {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function emitEnumDeclaration(node: EnumDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
@@ -2069,6 +2082,9 @@ module ts {
|
||||
if (node.kind === SyntaxKind.StringLiteral) {
|
||||
emitLiteral(<LiteralExpression>node);
|
||||
}
|
||||
else if (node.kind === SyntaxKind.ComputedPropertyName) {
|
||||
emit((<ComputedPropertyName>node).expression);
|
||||
}
|
||||
else {
|
||||
write("\"");
|
||||
|
||||
@@ -2189,6 +2205,12 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitComputedPropertyName(node: ComputedPropertyName) {
|
||||
write("[");
|
||||
emit(node.expression);
|
||||
write("]");
|
||||
}
|
||||
|
||||
function emitPropertyAssignment(node: PropertyDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
emit(node.name);
|
||||
@@ -2864,13 +2886,15 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO(jfreeman): Account for computed property name
|
||||
function emitMemberAccess(memberName: DeclarationName) {
|
||||
function emitMemberAccessForPropertyName(memberName: DeclarationName) {
|
||||
if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) {
|
||||
write("[");
|
||||
emitNode(memberName);
|
||||
write("]");
|
||||
}
|
||||
else if (memberName.kind === SyntaxKind.ComputedPropertyName) {
|
||||
emitComputedPropertyName(<ComputedPropertyName>memberName);
|
||||
}
|
||||
else {
|
||||
write(".");
|
||||
emitNode(memberName);
|
||||
@@ -2890,7 +2914,7 @@ module ts {
|
||||
else {
|
||||
write("this");
|
||||
}
|
||||
emitMemberAccess((<PropertyDeclaration>member).name);
|
||||
emitMemberAccessForPropertyName((<PropertyDeclaration>member).name);
|
||||
emitEnd((<PropertyDeclaration>member).name);
|
||||
write(" = ");
|
||||
emit((<PropertyDeclaration>member).initializer);
|
||||
@@ -2916,7 +2940,7 @@ module ts {
|
||||
if (!(member.flags & NodeFlags.Static)) {
|
||||
write(".prototype");
|
||||
}
|
||||
emitMemberAccess((<MethodDeclaration>member).name);
|
||||
emitMemberAccessForPropertyName((<MethodDeclaration>member).name);
|
||||
emitEnd((<MethodDeclaration>member).name);
|
||||
write(" = ");
|
||||
emitStart(member);
|
||||
@@ -3176,7 +3200,10 @@ module ts {
|
||||
}
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
if (getModuleInstanceState(node) !== ModuleInstanceState.Instantiated) {
|
||||
var shouldEmit = getModuleInstanceState(node) === ModuleInstanceState.Instantiated ||
|
||||
(getModuleInstanceState(node) === ModuleInstanceState.ConstEnumOnly && compilerOptions.preserveConstEnums);
|
||||
|
||||
if (!shouldEmit) {
|
||||
return emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
emitLeadingComments(node);
|
||||
@@ -3453,6 +3480,8 @@ module ts {
|
||||
return emitPropertyAssignment(<PropertyDeclaration>node);
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return emitShortHandPropertyAssignment(<ShortHandPropertyDeclaration>node);
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return emitComputedPropertyName(<ComputedPropertyName>node);
|
||||
case SyntaxKind.PropertyAccess:
|
||||
return emitPropertyAccess(<PropertyAccess>node);
|
||||
case SyntaxKind.IndexedAccess:
|
||||
@@ -3558,7 +3587,7 @@ module ts {
|
||||
return leadingComments;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getLeadingCommentsToEmit(node: Node) {
|
||||
// Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
|
||||
|
||||
+236
-73
@@ -71,8 +71,9 @@ module ts {
|
||||
return identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ && identifier.charCodeAt(2) === CharacterCodes._ ? identifier.substr(1) : identifier;
|
||||
}
|
||||
|
||||
// TODO(jfreeman): Implement declarationNameToString for computed properties
|
||||
// Return display name of an identifier
|
||||
// Computed property names will just be emitted as "[<expr>]", where <expr> is the source
|
||||
// text of the expression in the computed property.
|
||||
export function declarationNameToString(name: DeclarationName) {
|
||||
return name.kind === SyntaxKind.Missing ? "(Missing)" : getTextOfNode(name);
|
||||
}
|
||||
@@ -383,6 +384,8 @@ module ts {
|
||||
return child((<TemplateExpression>node).head) || children((<TemplateExpression>node).templateSpans);
|
||||
case SyntaxKind.TemplateSpan:
|
||||
return child((<TemplateSpan>node).expression) || child((<TemplateSpan>node).literal);
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return child((<ComputedPropertyName>node).expression);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,6 +612,7 @@ module ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
@@ -1155,6 +1159,15 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function parseOptionalToken(t: SyntaxKind): Node {
|
||||
if (token === t) {
|
||||
var node = createNode(t);
|
||||
nextToken();
|
||||
return finishNode(node);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function canParseSemicolon() {
|
||||
// If there's a real semicolon, then we can always parse it out.
|
||||
if (token === SyntaxKind.SemicolonToken) {
|
||||
@@ -1233,33 +1246,68 @@ module ts {
|
||||
return createIdentifier(token >= SyntaxKind.Identifier);
|
||||
}
|
||||
|
||||
function isPropertyName(): boolean {
|
||||
function isLiteralPropertyName(): boolean {
|
||||
return token >= SyntaxKind.Identifier ||
|
||||
token === SyntaxKind.StringLiteral ||
|
||||
token === SyntaxKind.NumericLiteral;
|
||||
}
|
||||
|
||||
function parsePropertyName(): Identifier {
|
||||
function parsePropertyName(): DeclarationName {
|
||||
if (token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral) {
|
||||
return parseLiteralNode(/*internName:*/ true);
|
||||
}
|
||||
if (token === SyntaxKind.OpenBracketToken) {
|
||||
return parseComputedPropertyName();
|
||||
}
|
||||
return parseIdentifierName();
|
||||
}
|
||||
|
||||
function parseComputedPropertyName(): ComputedPropertyName {
|
||||
// PropertyName[Yield,GeneratorParameter] :
|
||||
// LiteralPropertyName
|
||||
// [+GeneratorParameter] ComputedPropertyName
|
||||
// [~GeneratorParameter] ComputedPropertyName[?Yield]
|
||||
//
|
||||
// ComputedPropertyName[Yield] :
|
||||
// [ AssignmentExpression[In, ?Yield] ]
|
||||
//
|
||||
var node = <ComputedPropertyName>createNode(SyntaxKind.ComputedPropertyName);
|
||||
parseExpected(SyntaxKind.OpenBracketToken);
|
||||
|
||||
// We parse any expression (including a comma expression). But the grammar
|
||||
// says that only an assignment expression is allowed, so the grammar checker
|
||||
// will error if it sees a comma expression.
|
||||
var yieldContext = inYieldContext();
|
||||
if (inGeneratorParameterContext()) {
|
||||
setYieldContext(false);
|
||||
}
|
||||
node.expression = allowInAnd(parseExpression);
|
||||
if (inGeneratorParameterContext()) {
|
||||
setYieldContext(yieldContext);
|
||||
}
|
||||
|
||||
parseExpected(SyntaxKind.CloseBracketToken);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseContextualModifier(t: SyntaxKind): boolean {
|
||||
return token === t && tryParse(() => {
|
||||
nextToken();
|
||||
return token === SyntaxKind.OpenBracketToken || isPropertyName();
|
||||
return canFollowModifier();
|
||||
});
|
||||
}
|
||||
|
||||
function parseAnyContextualModifier(): boolean {
|
||||
return isModifier(token) && tryParse(() => {
|
||||
nextToken();
|
||||
return token === SyntaxKind.OpenBracketToken || token === SyntaxKind.AsteriskToken || isPropertyName();
|
||||
return canFollowModifier();
|
||||
});
|
||||
}
|
||||
|
||||
function canFollowModifier(): boolean {
|
||||
return token === SyntaxKind.OpenBracketToken || token === SyntaxKind.AsteriskToken || isLiteralPropertyName();
|
||||
}
|
||||
|
||||
// True if positioned at the start of a list element
|
||||
function isListElement(kind: ParsingContext, inErrorRecovery: boolean): boolean {
|
||||
switch (kind) {
|
||||
@@ -1276,9 +1324,11 @@ module ts {
|
||||
case ParsingContext.ClassMembers:
|
||||
return lookAhead(isClassMemberStart);
|
||||
case ParsingContext.EnumMembers:
|
||||
return isPropertyName();
|
||||
// Include open bracket computed properties. This technically also lets in indexers,
|
||||
// which would be a candidate for improved error reporting.
|
||||
return token === SyntaxKind.OpenBracketToken || isLiteralPropertyName();
|
||||
case ParsingContext.ObjectLiteralMembers:
|
||||
return token === SyntaxKind.AsteriskToken || isPropertyName();
|
||||
return token === SyntaxKind.OpenBracketToken || token === SyntaxKind.AsteriskToken || isLiteralPropertyName();
|
||||
case ParsingContext.BaseTypeReferences:
|
||||
return isIdentifier() && ((token !== SyntaxKind.ExtendsKeyword && token !== SyntaxKind.ImplementsKeyword) || !lookAhead(() => (nextToken(), isIdentifier())));
|
||||
case ParsingContext.VariableDeclarations:
|
||||
@@ -1765,6 +1815,65 @@ module ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function isIndexSignature(): boolean {
|
||||
if (token !== SyntaxKind.OpenBracketToken) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return lookAhead(() => {
|
||||
// The only allowed sequence is:
|
||||
//
|
||||
// [id:
|
||||
//
|
||||
// However, for error recovery, we also check the following cases:
|
||||
//
|
||||
// [...
|
||||
// [id,
|
||||
// [id?,
|
||||
// [id?:
|
||||
// [id?]
|
||||
// [public id
|
||||
// [private id
|
||||
// [protected id
|
||||
// []
|
||||
//
|
||||
if (nextToken() === SyntaxKind.DotDotDotToken || token === SyntaxKind.CloseBracketToken) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isModifier(token)) {
|
||||
nextToken();
|
||||
if (isIdentifier()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!isIdentifier()) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// Skip the identifier
|
||||
nextToken();
|
||||
}
|
||||
|
||||
// A colon signifies a well formed indexer
|
||||
// A comma should be a badly formed indexer because comma expressions are not allowed
|
||||
// in computed properties.
|
||||
if (token === SyntaxKind.ColonToken || token === SyntaxKind.CommaToken) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Question mark could be an indexer with an optional property,
|
||||
// or it could be a conditional expression in a computed property.
|
||||
if (token !== SyntaxKind.QuestionToken) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If any of the following tokens are after the question mark, it cannot
|
||||
// be a conditional expression, so treat it as an indexer.
|
||||
return nextToken() === SyntaxKind.ColonToken || token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBracketToken;
|
||||
});
|
||||
}
|
||||
|
||||
function parseIndexSignatureMember(fullStart: number, modifiers: ModifiersArray): SignatureDeclaration {
|
||||
var node = <SignatureDeclaration>createNode(SyntaxKind.IndexSignature, fullStart);
|
||||
setModifiers(node, modifiers);
|
||||
@@ -1808,10 +1917,10 @@ module ts {
|
||||
switch (token) {
|
||||
case SyntaxKind.OpenParenToken:
|
||||
case SyntaxKind.LessThanToken:
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
case SyntaxKind.OpenBracketToken: // Both for indexers and computed properties
|
||||
return true;
|
||||
default:
|
||||
return isPropertyName() && lookAhead(() => nextToken() === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken || token === SyntaxKind.QuestionToken ||
|
||||
return isLiteralPropertyName() && lookAhead(() => nextToken() === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken || token === SyntaxKind.QuestionToken ||
|
||||
token === SyntaxKind.ColonToken || canParseSemicolon());
|
||||
}
|
||||
}
|
||||
@@ -1822,7 +1931,8 @@ module ts {
|
||||
case SyntaxKind.LessThanToken:
|
||||
return parseSignatureMember(SyntaxKind.CallSignature, SyntaxKind.ColonToken);
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
return parseIndexSignatureMember(scanner.getStartPos(), /*modifiers:*/ undefined);
|
||||
// Indexer or computed property
|
||||
return isIndexSignature() ? parseIndexSignatureMember(scanner.getStartPos(), /*modifiers:*/ undefined) : parsePropertyOrMethod();
|
||||
case SyntaxKind.NewKeyword:
|
||||
if (lookAhead(() => nextToken() === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken)) {
|
||||
return parseSignatureMember(SyntaxKind.ConstructSignature, SyntaxKind.ColonToken);
|
||||
@@ -2202,10 +2312,7 @@ module ts {
|
||||
|
||||
if (!scanner.hasPrecedingLineBreak() &&
|
||||
(token === SyntaxKind.AsteriskToken || isStartOfExpression())) {
|
||||
if (parseOptional(SyntaxKind.AsteriskToken)) {
|
||||
node.flags = NodeFlags.YieldStar;
|
||||
}
|
||||
|
||||
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
node.expression = parseAssignmentExpression();
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -2255,7 +2362,7 @@ module ts {
|
||||
}
|
||||
else {
|
||||
// If not, we're probably better off bailing out and returning a bogus function expression.
|
||||
return makeFunctionExpression(SyntaxKind.ArrowFunction, pos, /* name */ undefined, sig, createMissingNode());
|
||||
return makeFunctionExpression(SyntaxKind.ArrowFunction, pos, /*asteriskToken:*/ undefined, /*name:*/ undefined, sig, createMissingNode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2395,7 +2502,7 @@ module ts {
|
||||
body = parseAssignmentExpression();
|
||||
}
|
||||
|
||||
return makeFunctionExpression(SyntaxKind.ArrowFunction, pos, /* name */ undefined, sig, body);
|
||||
return makeFunctionExpression(SyntaxKind.ArrowFunction, pos, /*asteriskToken:*/ undefined, /*name:*/ undefined, sig, body);
|
||||
}
|
||||
|
||||
function parseConditionalExpression(): Expression {
|
||||
@@ -2731,26 +2838,23 @@ module ts {
|
||||
|
||||
function parsePropertyAssignment(): Declaration {
|
||||
var nodePos = scanner.getStartPos();
|
||||
var isGenerator = parseOptional(SyntaxKind.AsteriskToken);
|
||||
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
var tokenIsIdentifier = isIdentifier();
|
||||
var nameToken = token;
|
||||
var propertyName = parsePropertyName();
|
||||
var node: Declaration;
|
||||
if (isGenerator || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
node = <PropertyDeclaration>createNode(SyntaxKind.PropertyAssignment, nodePos);
|
||||
node.name = propertyName;
|
||||
if (isGenerator) {
|
||||
node.flags |= NodeFlags.Generator;
|
||||
}
|
||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator);
|
||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken);
|
||||
|
||||
var body = parseFunctionBlock(isGenerator, /* ignoreMissingOpenBrace */ false);
|
||||
var body = parseFunctionBlock(!!asteriskToken, /* ignoreMissingOpenBrace */ false);
|
||||
// do not propagate property name as name for function expression
|
||||
// for scenarios like
|
||||
// var x = 1;
|
||||
// var y = { x() { } }
|
||||
// otherwise this will bring y.x into the scope of x which is incorrect
|
||||
(<PropertyDeclaration>node).initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, undefined, sig, body);
|
||||
(<PropertyDeclaration>node).initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, asteriskToken, undefined, sig, body);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -2808,24 +2912,21 @@ module ts {
|
||||
|
||||
var pos = getNodePos();
|
||||
parseExpected(SyntaxKind.FunctionKeyword);
|
||||
var isGenerator = parseOptional(SyntaxKind.AsteriskToken);
|
||||
var name = isGenerator ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier();
|
||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator);
|
||||
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
var name = asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier();
|
||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken);
|
||||
|
||||
var body = parseFunctionBlock(/*allowYield:*/ isGenerator, /* ignoreMissingOpenBrace */ false);
|
||||
return makeFunctionExpression(SyntaxKind.FunctionExpression, pos, name, sig, body, isGenerator ? NodeFlags.Generator : undefined);
|
||||
var body = parseFunctionBlock(/*allowYield:*/ !!asteriskToken, /* ignoreMissingOpenBrace */ false);
|
||||
return makeFunctionExpression(SyntaxKind.FunctionExpression, pos, asteriskToken, name, sig, body);
|
||||
}
|
||||
|
||||
function parseOptionalIdentifier() {
|
||||
return isIdentifier() ? parseIdentifier() : undefined;
|
||||
}
|
||||
|
||||
function makeFunctionExpression(kind: SyntaxKind, pos: number, name: Identifier, sig: ParsedSignature, body: Node, flags?: NodeFlags): FunctionExpression {
|
||||
function makeFunctionExpression(kind: SyntaxKind, pos: number, asteriskToken: Node, name: Identifier, sig: ParsedSignature, body: Node): FunctionExpression {
|
||||
var node = <FunctionExpression>createNode(kind, pos);
|
||||
if (flags) {
|
||||
node.flags = flags;
|
||||
}
|
||||
|
||||
node.asteriskToken = asteriskToken;
|
||||
node.name = name;
|
||||
node.typeParameters = sig.typeParameters;
|
||||
node.parameters = sig.parameters;
|
||||
@@ -3292,14 +3393,10 @@ module ts {
|
||||
var node = <FunctionLikeDeclaration>createNode(SyntaxKind.FunctionDeclaration, fullStart);
|
||||
setModifiers(node, modifiers);
|
||||
parseExpected(SyntaxKind.FunctionKeyword);
|
||||
var isGenerator = parseOptional(SyntaxKind.AsteriskToken);
|
||||
if (isGenerator) {
|
||||
node.flags |= NodeFlags.Generator;
|
||||
}
|
||||
|
||||
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
node.name = parseIdentifier();
|
||||
fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator, node);
|
||||
node.body = parseFunctionBlockOrSemicolon(isGenerator);
|
||||
fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ !!node.asteriskToken, node);
|
||||
node.body = parseFunctionBlockOrSemicolon(!!node.asteriskToken);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -3314,11 +3411,7 @@ module ts {
|
||||
|
||||
function parsePropertyMemberDeclaration(fullStart: number, modifiers: ModifiersArray): Declaration {
|
||||
var flags = modifiers ? modifiers.flags : 0;
|
||||
var isGenerator = parseOptional(SyntaxKind.AsteriskToken);
|
||||
if (isGenerator) {
|
||||
flags |= NodeFlags.Generator;
|
||||
}
|
||||
|
||||
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
var name = parsePropertyName();
|
||||
if (parseOptional(SyntaxKind.QuestionToken)) {
|
||||
// Note: this is not legal as per the grammar. But we allow it in the parser and
|
||||
@@ -3326,15 +3419,16 @@ module ts {
|
||||
flags |= NodeFlags.QuestionMark;
|
||||
}
|
||||
|
||||
if (isGenerator || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
var method = <MethodDeclaration>createNode(SyntaxKind.Method, fullStart);
|
||||
setModifiers(method, modifiers);
|
||||
if (flags) {
|
||||
method.flags = flags;
|
||||
}
|
||||
method.asteriskToken = asteriskToken;
|
||||
method.name = name;
|
||||
fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator, method);
|
||||
method.body = parseFunctionBlockOrSemicolon(isGenerator);
|
||||
fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken, method);
|
||||
method.body = parseFunctionBlockOrSemicolon(!!asteriskToken);
|
||||
return finishNode(method);
|
||||
}
|
||||
else {
|
||||
@@ -3375,12 +3469,12 @@ module ts {
|
||||
|
||||
// Try to get the first property-like token following all modifiers.
|
||||
// This can either be an identifier or the 'get' or 'set' keywords.
|
||||
if (isPropertyName()) {
|
||||
if (isLiteralPropertyName()) {
|
||||
idToken = token;
|
||||
nextToken();
|
||||
}
|
||||
|
||||
// Index signatures are class members; we can parse.
|
||||
// Index signatures and computed properties are class members; we can parse.
|
||||
if (token === SyntaxKind.OpenBracketToken) {
|
||||
return true;
|
||||
}
|
||||
@@ -3449,12 +3543,15 @@ module ts {
|
||||
if (token === SyntaxKind.ConstructorKeyword) {
|
||||
return parseConstructorDeclaration(fullStart, modifiers);
|
||||
}
|
||||
if (token >= SyntaxKind.Identifier || token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral || token === SyntaxKind.AsteriskToken) {
|
||||
return parsePropertyMemberDeclaration(fullStart, modifiers);
|
||||
}
|
||||
if (token === SyntaxKind.OpenBracketToken) {
|
||||
if (isIndexSignature()) {
|
||||
return parseIndexSignatureMember(fullStart, modifiers);
|
||||
}
|
||||
// It is very important that we check this *after* checking indexers because
|
||||
// the [ token can start an index signature or a computed property name
|
||||
if (token >= SyntaxKind.Identifier || token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral ||
|
||||
token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBracketToken) {
|
||||
return parsePropertyMemberDeclaration(fullStart, modifiers);
|
||||
}
|
||||
|
||||
// 'isClassMemberStart' should have hinted not to attempt parsing.
|
||||
Debug.fail("Should not have attempted to parse class member declaration.");
|
||||
@@ -3945,6 +4042,7 @@ module ts {
|
||||
case SyntaxKind.BinaryExpression: return checkBinaryExpression(<BinaryExpression>node);
|
||||
case SyntaxKind.CatchBlock: return checkCatchBlock(<CatchBlock>node);
|
||||
case SyntaxKind.ClassDeclaration: return checkClassDeclaration(<ClassDeclaration>node);
|
||||
case SyntaxKind.ComputedPropertyName: return checkComputedPropertyName(<ComputedPropertyName>node);
|
||||
case SyntaxKind.Constructor: return checkConstructor(<ConstructorDeclaration>node);
|
||||
case SyntaxKind.ExportAssignment: return checkExportAssignment(<ExportAssignment>node);
|
||||
case SyntaxKind.ForInStatement: return checkForInStatement(<ForInStatement>node);
|
||||
@@ -4232,13 +4330,17 @@ module ts {
|
||||
var enumIsConst = (enumDecl.flags & NodeFlags.Const) !== 0;
|
||||
|
||||
var hasError = false;
|
||||
|
||||
// skip checks below for const enums - they allow arbitrary initializers as long as they can be evaluated to constant expressions.
|
||||
// since all values are known in compile time - it is not necessary to check that constant enum section precedes computed enum members.
|
||||
if (!enumIsConst) {
|
||||
var inConstantEnumMemberSection = true;
|
||||
for (var i = 0, n = enumDecl.members.length; i < n; i++) {
|
||||
var node = enumDecl.members[i];
|
||||
if (inAmbientContext) {
|
||||
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
hasError = grammarErrorOnNode(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
||||
}
|
||||
else if (inAmbientContext) {
|
||||
if (node.initializer && !isIntegerLiteral(node.initializer)) {
|
||||
hasError = grammarErrorOnNode(node.name, Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError;
|
||||
}
|
||||
@@ -4302,12 +4404,20 @@ module ts {
|
||||
function checkFunctionDeclaration(node: FunctionLikeDeclaration) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
checkFunctionName(node.name) ||
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false);
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false) ||
|
||||
checkForGenerator(node);
|
||||
}
|
||||
|
||||
function checkForGenerator(node: FunctionLikeDeclaration) {
|
||||
if (node.asteriskToken) {
|
||||
return grammarErrorOnNode(node.asteriskToken, Diagnostics.generators_are_not_currently_supported);
|
||||
}
|
||||
}
|
||||
|
||||
function checkFunctionExpression(node: FunctionExpression) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
checkFunctionName(node.name);
|
||||
checkFunctionName(node.name) ||
|
||||
checkForGenerator(node);
|
||||
}
|
||||
|
||||
function checkFunctionName(name: Node) {
|
||||
@@ -4384,9 +4494,33 @@ module ts {
|
||||
}
|
||||
|
||||
function checkMethod(node: MethodDeclaration) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
if (checkAnyParsedSignature(node) ||
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false) ||
|
||||
(node.parent.kind === SyntaxKind.ClassDeclaration && checkForInvalidQuestionMark(node, Diagnostics.A_class_member_cannot_be_declared_optional));
|
||||
checkForGenerator(node)) {
|
||||
return true;
|
||||
}
|
||||
if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (checkForInvalidQuestionMark(node, Diagnostics.A_class_member_cannot_be_declared_optional)) {
|
||||
return true;
|
||||
}
|
||||
// Technically, computed properties in ambient contexts is disallowed
|
||||
// for property declarations and accessors too, not just methods.
|
||||
// However, property declarations disallow computed names in general,
|
||||
// and accessors are not allowed in ambient contexts in general,
|
||||
// so this error only really matters for methods.
|
||||
if (inAmbientContext) {
|
||||
return checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context);
|
||||
}
|
||||
else if (!node.body) {
|
||||
return checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads);
|
||||
}
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) {
|
||||
return checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces);
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.TypeLiteral) {
|
||||
return checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals);
|
||||
}
|
||||
}
|
||||
|
||||
function checkForBodyInAmbientContext(body: Block | Expression, isConstructor: boolean): boolean {
|
||||
@@ -4435,15 +4569,12 @@ module ts {
|
||||
var inStrictMode = (node.parserContextFlags & ParserContextFlags.StrictMode) !== 0;
|
||||
|
||||
for (var i = 0, n = node.properties.length; i < n; i++) {
|
||||
var prop = node.properties[i];
|
||||
// TODO(jfreeman): continue if we have a computed property
|
||||
if (prop.kind === SyntaxKind.OmittedExpression) {
|
||||
var prop = <Declaration>node.properties[i];
|
||||
var name = <Identifier>prop.name;
|
||||
if (prop.kind === SyntaxKind.OmittedExpression || name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var p = <Declaration>prop;
|
||||
var name = <Identifier>p.name;
|
||||
|
||||
// ECMA-262 11.1.5 Object Initialiser
|
||||
// If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
|
||||
// a.This production is contained in strict code and IsDataDescriptor(previous) is true and
|
||||
@@ -4453,20 +4584,20 @@ module ts {
|
||||
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
|
||||
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
|
||||
var currentKind: number;
|
||||
if (p.kind === SyntaxKind.PropertyAssignment) {
|
||||
if (prop.kind === SyntaxKind.PropertyAssignment) {
|
||||
currentKind = Property;
|
||||
}
|
||||
else if (p.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
else if (prop.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
currentKind = Property;
|
||||
}
|
||||
else if (p.kind === SyntaxKind.GetAccessor) {
|
||||
else if (prop.kind === SyntaxKind.GetAccessor) {
|
||||
currentKind = GetAccessor;
|
||||
}
|
||||
else if (p.kind === SyntaxKind.SetAccessor) {
|
||||
else if (prop.kind === SyntaxKind.SetAccessor) {
|
||||
currentKind = SetAccesor;
|
||||
}
|
||||
else {
|
||||
Debug.fail("Unexpected syntax kind:" + p.kind);
|
||||
Debug.fail("Unexpected syntax kind:" + prop.kind);
|
||||
}
|
||||
|
||||
if (!hasProperty(seen, name.text)) {
|
||||
@@ -4721,8 +4852,39 @@ module ts {
|
||||
}
|
||||
|
||||
function checkProperty(node: PropertyDeclaration) {
|
||||
return (node.parent.kind === SyntaxKind.ClassDeclaration && checkForInvalidQuestionMark(node, Diagnostics.A_class_member_cannot_be_declared_optional)) ||
|
||||
checkForInitializerInAmbientContext(node);
|
||||
if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (checkForInvalidQuestionMark(node, Diagnostics.A_class_member_cannot_be_declared_optional) ||
|
||||
checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) {
|
||||
if (checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.TypeLiteral) {
|
||||
if (checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return checkForInitializerInAmbientContext(node);
|
||||
}
|
||||
|
||||
function checkComputedPropertyName(node: ComputedPropertyName) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
}
|
||||
else if (node.expression.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>node.expression).operator === SyntaxKind.CommaToken) {
|
||||
return grammarErrorOnNode(node.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
|
||||
}
|
||||
}
|
||||
|
||||
function checkForDisallowedComputedProperty(node: DeclarationName, message: DiagnosticMessage) {
|
||||
if (node.kind === SyntaxKind.ComputedPropertyName) {
|
||||
return grammarErrorOnNode(node, message);
|
||||
}
|
||||
}
|
||||
|
||||
function checkForInitializerInAmbientContext(node: PropertyDeclaration) {
|
||||
@@ -4963,6 +5125,7 @@ module ts {
|
||||
if (!(node.parserContextFlags & ParserContextFlags.Yield)) {
|
||||
return grammarErrorOnFirstToken(node, Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration);
|
||||
}
|
||||
return grammarErrorOnFirstToken(node, Diagnostics.yield_expressions_are_not_currently_supported);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ module ts {
|
||||
Missing,
|
||||
// Names
|
||||
QualifiedName,
|
||||
ComputedPropertyName,
|
||||
// Signature elements
|
||||
TypeParameter,
|
||||
Parameter,
|
||||
@@ -271,8 +272,6 @@ module ts {
|
||||
Let = 0x00000800, // Variable declaration
|
||||
Const = 0x00001000, // Variable declaration
|
||||
OctalLiteral = 0x00002000,
|
||||
Generator = 0x00004000,
|
||||
YieldStar = 0x00008000,
|
||||
|
||||
Modifier = Export | Ambient | Public | Private | Protected | Static,
|
||||
AccessibilityModifier = Public | Private | Protected,
|
||||
@@ -372,11 +371,10 @@ module ts {
|
||||
* Examples:
|
||||
* FunctionDeclaration
|
||||
* MethodDeclaration
|
||||
* ConstructorDeclaration
|
||||
* AccessorDeclaration
|
||||
* FunctionExpression
|
||||
*/
|
||||
export interface FunctionLikeDeclaration extends Declaration, ParsedSignature {
|
||||
export interface FunctionLikeDeclaration extends SignatureDeclaration {
|
||||
asteriskToken?: Node;
|
||||
body?: Block | Expression;
|
||||
}
|
||||
|
||||
@@ -389,7 +387,7 @@ module ts {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
export interface ConstructorDeclaration extends FunctionLikeDeclaration {
|
||||
export interface ConstructorDeclaration extends Node, ParsedSignature {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
@@ -442,6 +440,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface YieldExpression extends Expression {
|
||||
asteriskToken?: Node;
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
@@ -632,7 +631,9 @@ module ts {
|
||||
}
|
||||
|
||||
export interface EnumMember extends Declaration {
|
||||
name: Identifier | LiteralExpression;
|
||||
// This does include ComputedPropertyName, but the parser will give an error
|
||||
// if it parses a ComputedPropertyName in an EnumMember
|
||||
name: DeclarationName;
|
||||
initializer?: Expression;
|
||||
}
|
||||
|
||||
@@ -1256,7 +1257,7 @@ module ts {
|
||||
export interface CommandLineOption {
|
||||
name: string;
|
||||
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'.
|
||||
shortName?: string; // A short mnemonic 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.
|
||||
error?: DiagnosticMessage; // The error given when the argument does not fit a customized 'type'.
|
||||
|
||||
@@ -505,7 +505,7 @@ module ts.formatting {
|
||||
|
||||
if (isToken(child)) {
|
||||
// if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules
|
||||
var tokenInfo = formattingScanner.readTokenInfo(node);
|
||||
var tokenInfo = formattingScanner.readTokenInfo(child);
|
||||
Debug.assert(tokenInfo.token.end === child.end);
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation);
|
||||
return inheritedIndentation;
|
||||
|
||||
@@ -114,7 +114,8 @@ module ts.formatting {
|
||||
}
|
||||
|
||||
function shouldRescanTemplateToken(container: Node): boolean {
|
||||
return container.kind === SyntaxKind.TemplateSpan;
|
||||
return container.kind === SyntaxKind.TemplateMiddle ||
|
||||
container.kind === SyntaxKind.TemplateTail;
|
||||
}
|
||||
|
||||
function startsWithSlashToken(t: SyntaxKind): boolean {
|
||||
|
||||
@@ -377,9 +377,10 @@ module ts.NavigationBar {
|
||||
// Add the constructor parameters in as children of the class (for property parameters).
|
||||
// Note that *all* parameters will be added to the nodes array, but parameters that
|
||||
// are not properties will be filtered out later by createChildItem.
|
||||
var nodes: Node[] = constructor
|
||||
? node.members.concat(constructor.parameters)
|
||||
: node.members;
|
||||
var nodes: Node[] = removeComputedProperties(node);
|
||||
if (constructor) {
|
||||
nodes.push.apply(nodes, constructor.parameters);
|
||||
}
|
||||
|
||||
var childItems = getItemsWorker(sortNodes(nodes), createChildItem);
|
||||
}
|
||||
@@ -394,7 +395,7 @@ module ts.NavigationBar {
|
||||
}
|
||||
|
||||
function createEnumItem(node: EnumDeclaration): ts.NavigationBarItem {
|
||||
var childItems = getItemsWorker(sortNodes(node.members), createChildItem);
|
||||
var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem);
|
||||
return getNavigationBarItem(
|
||||
node.name.text,
|
||||
ts.ScriptElementKind.enumElement,
|
||||
@@ -405,7 +406,7 @@ module ts.NavigationBar {
|
||||
}
|
||||
|
||||
function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem {
|
||||
var childItems = getItemsWorker(sortNodes(node.members), createChildItem);
|
||||
var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem);
|
||||
return getNavigationBarItem(
|
||||
node.name.text,
|
||||
ts.ScriptElementKind.interfaceElement,
|
||||
@@ -416,6 +417,10 @@ module ts.NavigationBar {
|
||||
}
|
||||
}
|
||||
|
||||
function removeComputedProperties(node: ClassDeclaration | InterfaceDeclaration | EnumDeclaration): Declaration[] {
|
||||
return filter<Declaration>(node.members, member => member.name === undefined || member.name.kind !== SyntaxKind.ComputedPropertyName);
|
||||
}
|
||||
|
||||
function getInnermostModule(node: ModuleDeclaration): ModuleDeclaration {
|
||||
while (node.body.kind === SyntaxKind.ModuleDeclaration) {
|
||||
node = <ModuleDeclaration>node.body;
|
||||
|
||||
@@ -3446,6 +3446,11 @@ module ts {
|
||||
if (hasKind(node.parent, SyntaxKind.GetAccessor) || hasKind(node.parent, SyntaxKind.SetAccessor)) {
|
||||
return getGetAndSetOccurrences(<AccessorDeclaration>node.parent);
|
||||
}
|
||||
default:
|
||||
if (isModifier(node.kind) && node.parent &&
|
||||
(isDeclaration(node.parent) || node.parent.kind === SyntaxKind.VariableStatement)) {
|
||||
return getModifierOccurrences(node.kind, node.parent);
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -3790,6 +3795,87 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getModifierOccurrences(modifier: SyntaxKind, declaration: Declaration) {
|
||||
var container = declaration.parent;
|
||||
|
||||
// Make sure we only highlight the keyword when it makes sense to do so.
|
||||
if (declaration.flags & NodeFlags.AccessibilityModifier) {
|
||||
if (!(container.kind === SyntaxKind.ClassDeclaration ||
|
||||
(declaration.kind === SyntaxKind.Parameter && hasKind(container, SyntaxKind.Constructor)))) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (declaration.flags & NodeFlags.Static) {
|
||||
if (container.kind !== SyntaxKind.ClassDeclaration) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (declaration.flags & (NodeFlags.Export | NodeFlags.Ambient)) {
|
||||
if (!(container.kind === SyntaxKind.ModuleBlock || container.kind === SyntaxKind.SourceFile)) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
var keywords: Node[] = [];
|
||||
var modifierFlag: NodeFlags = getFlagFromModifier(modifier);
|
||||
|
||||
var nodes: Node[];
|
||||
switch (container.kind) {
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.SourceFile:
|
||||
nodes = (<Block>container).statements;
|
||||
break;
|
||||
case SyntaxKind.Constructor:
|
||||
nodes = (<Node[]>(<ConstructorDeclaration>container).parameters).concat(
|
||||
(<ClassDeclaration>container.parent).members);
|
||||
break;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
nodes = (<ClassDeclaration>container).members;
|
||||
|
||||
// If we're an accessibility modifier, we're in an instance member and should search
|
||||
// the constructor's parameter list for instance members as well.
|
||||
if (modifierFlag & NodeFlags.AccessibilityModifier) {
|
||||
var constructor = forEach((<ClassDeclaration>container).members, member => {
|
||||
return member.kind === SyntaxKind.Constructor && <ConstructorDeclaration>member;
|
||||
});
|
||||
|
||||
if (constructor) {
|
||||
nodes = nodes.concat(constructor.parameters);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Debug.fail("Invalid container kind.")
|
||||
}
|
||||
|
||||
forEach(nodes, node => {
|
||||
if (node.flags & modifierFlag) {
|
||||
forEach(node.getChildren(), child => pushKeywordIf(keywords, child, modifier));
|
||||
}
|
||||
});
|
||||
|
||||
return map(keywords, getReferenceEntryFromNode);
|
||||
|
||||
function getFlagFromModifier(modifier: SyntaxKind) {
|
||||
switch (modifier) {
|
||||
case SyntaxKind.PublicKeyword:
|
||||
return NodeFlags.Public;
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
return NodeFlags.Private;
|
||||
case SyntaxKind.ProtectedKeyword:
|
||||
return NodeFlags.Protected;
|
||||
case SyntaxKind.StaticKeyword:
|
||||
return NodeFlags.Static;
|
||||
case SyntaxKind.ExportKeyword:
|
||||
return NodeFlags.Export;
|
||||
case SyntaxKind.DeclareKeyword:
|
||||
return NodeFlags.Ambient;
|
||||
default:
|
||||
Debug.fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// returns true if 'node' is defined and has a matching 'kind'.
|
||||
function hasKind(node: Node, kind: SyntaxKind) {
|
||||
return node !== undefined && node.kind === kind;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10_es6.ts(2,8): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10_es6.ts (1 errors) ====
|
||||
class C {
|
||||
[e] = 1
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts(2,7): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts(2,8): error TS1109: Expression expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts (3 errors) ====
|
||||
class C {
|
||||
[e]();
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,15 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts(2,7): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts(2,10): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts (3 errors) ====
|
||||
class C {
|
||||
[e]() { }
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1005: '=>' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13_es6.ts(1,11): error TS1022: An index signature parameter must have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13_es6.ts (1 errors) ====
|
||||
var v: { [e]: number };
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14_es6.ts(1,13): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14_es6.ts (1 errors) ====
|
||||
var v: { [e](): number };
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15_es6.ts(1,32): error TS1022: An index signature parameter must have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15_es6.ts (1 errors) ====
|
||||
var v: { [e: number]: string; [e]: number };
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
@@ -1,18 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(2,3): error TS1132: Enum member expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(2,3): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(2,4): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts (4 errors) ====
|
||||
enum E {
|
||||
[e] = 1
|
||||
~
|
||||
!!! error TS1132: Enum member expected.
|
||||
~~~
|
||||
!!! error TS2364: Invalid left-hand side of assignment expression.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,16 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,22): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,26): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,16): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts (4 errors) ====
|
||||
var v = { set [e](v) { } }
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18_es6.ts(1,13): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18_es6.ts (1 errors) ====
|
||||
var v: { [e]?(): number };
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19_es6.ts(1,13): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19_es6.ts (1 errors) ====
|
||||
var v: { [e]? };
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
@@ -1,13 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts(1,11): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts(1,15): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts(1,12): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts (3 errors) ====
|
||||
var v = { [e] };
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,19 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,11): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,14): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,16): error TS1134: Variable declaration expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,18): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,12): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts (5 errors) ====
|
||||
var v = { [e]: 1 };
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,16 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,11): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,17): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,21): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,12): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts (4 errors) ====
|
||||
var v = { [e]() { } };
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,16 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,21): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,25): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,16): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts (4 errors) ====
|
||||
var v = { get [e]() { } };
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,19 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,18): error TS1005: ':' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,28): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,32): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,18): error TS2304: Cannot find name 'get'.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,23): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts (5 errors) ====
|
||||
var v = { public get [e]() { } };
|
||||
~~~
|
||||
!!! error TS1005: ':' expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'get'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,28 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,11): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,14): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,16): error TS1134: Variable declaration expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,30): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,12): error TS2304: Cannot find name 'e'.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,20): error TS2304: Cannot find name 'e'.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,24): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts (8 errors) ====
|
||||
var v = { [e]: 1, [e + e]: 2 };
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7_es6.ts(2,5): error TS1022: An index signature parameter must have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7_es6.ts (1 errors) ====
|
||||
class C {
|
||||
[e]
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8_es6.ts(2,12): error TS1022: An index signature parameter must have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8_es6.ts (1 errors) ====
|
||||
class C {
|
||||
public [e]
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts(2,5): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts(2,9): error TS2304: Cannot find name 'Type'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts (2 errors) ====
|
||||
class C {
|
||||
[e]: Type
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'Type'.
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (1 errors) ====
|
||||
function * foo(a = yield => yield) {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
//// [FunctionDeclaration10_es6.ts]
|
||||
function * foo(a = yield => yield) {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration10_es6.js]
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = function (yield) { return yield; }; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts ===
|
||||
function * foo(a = yield => yield) {
|
||||
>foo : (a?: (yield: any) => any) => void
|
||||
>a : (yield: any) => any
|
||||
>yield => yield : (yield: any) => any
|
||||
>yield : any
|
||||
>yield : any
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts (1 errors) ====
|
||||
function * yield() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [FunctionDeclaration11_es6.ts]
|
||||
function * yield() {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration11_es6.js]
|
||||
function yield() {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts ===
|
||||
function * yield() {
|
||||
>yield : () => void
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (2 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v: yield;
|
||||
~~~~~
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
//// [FunctionDeclaration13_es6.ts]
|
||||
function * foo() {
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v: yield;
|
||||
}
|
||||
|
||||
|
||||
//// [FunctionDeclaration13_es6.js]
|
||||
function foo() {
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts (1 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [FunctionDeclaration1_es6.ts]
|
||||
function * foo() {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration1_es6.js]
|
||||
function foo() {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts ===
|
||||
function * foo() {
|
||||
>foo : () => void
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ====
|
||||
function*foo(a = yield) {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
//// [FunctionDeclaration6_es6.ts]
|
||||
function*foo(a = yield) {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration6_es6.js]
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = yield; }
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (2 errors) ====
|
||||
function*bar() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function*foo(a = yield) {
|
||||
~~~~~
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
//// [FunctionDeclaration7_es6.ts]
|
||||
function*bar() {
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function*foo(a = yield) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration7_es6.js]
|
||||
function bar() {
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = yield; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,7 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,18): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,24): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (4 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (1 errors) ====
|
||||
var v = { [yield]: foo }
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
@@ -1,15 +1,9 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,20): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (1 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
var v = { [yield]: foo }
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts (1 errors) ====
|
||||
var v = function * () { }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
@@ -1,6 +0,0 @@
|
||||
//// [FunctionExpression1_es6.ts]
|
||||
var v = function * () { }
|
||||
|
||||
//// [FunctionExpression1_es6.js]
|
||||
var v = function () {
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts ===
|
||||
var v = function * () { }
|
||||
>v : () => void
|
||||
>function * () { } : () => void
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts (1 errors) ====
|
||||
var v = function * foo() { }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
@@ -1,6 +0,0 @@
|
||||
//// [FunctionExpression2_es6.ts]
|
||||
var v = function * foo() { }
|
||||
|
||||
//// [FunctionExpression2_es6.js]
|
||||
var v = function foo() {
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts ===
|
||||
var v = function * foo() { }
|
||||
>v : () => void
|
||||
>function * foo() { } : () => void
|
||||
>foo : () => void
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts (1 errors) ====
|
||||
var v = { *foo() { } }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
@@ -1,6 +0,0 @@
|
||||
//// [FunctionPropertyAssignments1_es6.ts]
|
||||
var v = { *foo() { } }
|
||||
|
||||
//// [FunctionPropertyAssignments1_es6.js]
|
||||
var v = { foo: function () {
|
||||
} };
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts ===
|
||||
var v = { *foo() { } }
|
||||
>v : { foo: () => void; }
|
||||
>{ *foo() { } } : { foo: () => void; }
|
||||
>foo : () => void
|
||||
>*foo() { } : () => void
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,22): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,26): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (4 errors) ====
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ====
|
||||
var v = { *[foo()]() { } }
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts (1 errors) ====
|
||||
class C {
|
||||
*foo() { }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//// [MemberFunctionDeclaration1_es6.ts]
|
||||
class C {
|
||||
*foo() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration1_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
*foo() { }
|
||||
>foo : () => void
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts (1 errors) ====
|
||||
class C {
|
||||
public * foo() { }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//// [MemberFunctionDeclaration2_es6.ts]
|
||||
class C {
|
||||
public * foo() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration2_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
public * foo() { }
|
||||
>foo : () => void
|
||||
}
|
||||
@@ -1,18 +1,9 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,5): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,10): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,13): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (4 errors) ====
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (1 errors) ====
|
||||
class C {
|
||||
*[foo]() { }
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1005: '=>' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts (1 errors) ====
|
||||
class C {
|
||||
*foo<T>() { }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//// [MemberFunctionDeclaration7_es6.ts]
|
||||
class C {
|
||||
*foo<T>() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration7_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -1,8 +0,0 @@
|
||||
=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
*foo<T>() { }
|
||||
>foo : <T>() => void
|
||||
>T : T
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts (1 errors) ====
|
||||
var v = { * foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [YieldExpression10_es6.ts]
|
||||
var v = { * foo() {
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [YieldExpression10_es6.js]
|
||||
var v = { foo: function () {
|
||||
;
|
||||
} };
|
||||
@@ -1,11 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts ===
|
||||
var v = { * foo() {
|
||||
>v : { foo: () => void; }
|
||||
>{ * foo() { yield(foo); }} : { foo: () => void; }
|
||||
>foo : () => void
|
||||
>* foo() { yield(foo); } : () => void
|
||||
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (1 errors) ====
|
||||
class C {
|
||||
*foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//// [YieldExpression11_es6.ts]
|
||||
class C {
|
||||
*foo() {
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
|
||||
//// [YieldExpression11_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -1,10 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
*foo() {
|
||||
>foo : () => void
|
||||
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (1 errors) ====
|
||||
function* foo() { yield }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [YieldExpression13_es6.ts]
|
||||
function* foo() { yield }
|
||||
|
||||
//// [YieldExpression13_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts ===
|
||||
function* foo() { yield }
|
||||
>foo : () => void
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
function bar() {
|
||||
yield foo;
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (1 errors) ====
|
||||
function*foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
function bar() {
|
||||
function* quux() {
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
//// [YieldExpression19_es6.ts]
|
||||
function*foo() {
|
||||
function bar() {
|
||||
function* quux() {
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// [YieldExpression19_es6.js]
|
||||
function foo() {
|
||||
function bar() {
|
||||
function quux() {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts ===
|
||||
function*foo() {
|
||||
>foo : () => void
|
||||
|
||||
function bar() {
|
||||
>bar : () => void
|
||||
|
||||
function* quux() {
|
||||
>quux : () => void
|
||||
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield
|
||||
yield
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [YieldExpression3_es6.ts]
|
||||
function* foo() {
|
||||
yield
|
||||
yield
|
||||
}
|
||||
|
||||
//// [YieldExpression3_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => void
|
||||
|
||||
yield
|
||||
yield
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield;
|
||||
yield;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [YieldExpression4_es6.ts]
|
||||
function* foo() {
|
||||
yield;
|
||||
yield;
|
||||
}
|
||||
|
||||
//// [YieldExpression4_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => void
|
||||
|
||||
yield;
|
||||
yield;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield*foo
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [YieldExpression6_es6.ts]
|
||||
function* foo() {
|
||||
yield*foo
|
||||
}
|
||||
|
||||
//// [YieldExpression6_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => void
|
||||
|
||||
yield*foo
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield foo
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [YieldExpression7_es6.ts]
|
||||
function* foo() {
|
||||
yield foo
|
||||
}
|
||||
|
||||
//// [YieldExpression7_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => void
|
||||
|
||||
yield foo
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (2 errors) ====
|
||||
yield(foo);
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield(foo);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [YieldExpression8_es6.ts]
|
||||
yield(foo);
|
||||
function* foo() {
|
||||
yield(foo);
|
||||
}
|
||||
|
||||
//// [YieldExpression8_es6.js]
|
||||
yield(foo);
|
||||
function foo() {
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts (1 errors) ====
|
||||
var v = function*() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield(foo);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [YieldExpression9_es6.ts]
|
||||
var v = function*() {
|
||||
yield(foo);
|
||||
}
|
||||
|
||||
//// [YieldExpression9_es6.js]
|
||||
var v = function () {
|
||||
;
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts ===
|
||||
var v = function*() {
|
||||
>v : () => void
|
||||
>function*() { yield(foo);} : () => void
|
||||
|
||||
yield(foo);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [computedPropertyNames1.ts]
|
||||
var v = {
|
||||
get [0 + 1]() { return 0 },
|
||||
set [0 + 1](v: string) { } //No error
|
||||
}
|
||||
|
||||
//// [computedPropertyNames1.js]
|
||||
var v = {
|
||||
get [0 + 1]() {
|
||||
return 0;
|
||||
},
|
||||
set [0 + 1](v) {
|
||||
} //No error
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user