Merge branch 'master' of https://github.com/Microsoft/TypeScript into ms_master

This commit is contained in:
Zhengbo Li
2015-06-01 16:34:06 -07:00
388 changed files with 6933 additions and 1084 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "1.5.2",
"version": "1.5.3",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
+4 -4
View File
@@ -519,17 +519,17 @@ module ts {
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.Class, SymbolFlags.ClassExcludes);
break;
case SyntaxKind.InterfaceDeclaration:
bindDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes, /*isBlockScopeContainer*/ false);
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes);
break;
case SyntaxKind.TypeAliasDeclaration:
bindDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes, /*isBlockScopeContainer*/ false);
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
break;
case SyntaxKind.EnumDeclaration:
if (isConst(node)) {
bindDeclaration(<Declaration>node, SymbolFlags.ConstEnum, SymbolFlags.ConstEnumExcludes, /*isBlockScopeContainer*/ false);
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.ConstEnum, SymbolFlags.ConstEnumExcludes);
}
else {
bindDeclaration(<Declaration>node, SymbolFlags.RegularEnum, SymbolFlags.RegularEnumExcludes, /*isBlockScopeContainer*/ false);
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.RegularEnum, SymbolFlags.RegularEnumExcludes);
}
break;
case SyntaxKind.ModuleDeclaration:
+529 -277
View File
File diff suppressed because it is too large Load Diff
+10
View File
@@ -129,6 +129,16 @@ module ts {
}
}
export function rangeEquals<T>(array1: T[], array2: T[], pos: number, end: number) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
return false;
}
pos++;
}
return true;
}
/**
* Returns the last element of an array if non-empty, undefined otherwise.
*/
@@ -120,7 +120,7 @@ module ts {
Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." },
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." },
A_yield_expression_is_only_allowed_in_a_generator_body: { code: 1163, category: DiagnosticCategory.Error, key: "A 'yield' expression is only allowed in a generator body." },
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." },
A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." },
@@ -174,7 +174,10 @@ module ts {
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
_0_tag_already_specified: { code: 1219, category: DiagnosticCategory.Error, key: "'{0}' tag already specified." },
Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1219, category: DiagnosticCategory.Error, key: "Generators are only available when targeting ECMAScript 6 or higher." },
Generators_are_not_allowed_in_an_ambient_context: { code: 1220, category: DiagnosticCategory.Error, key: "Generators are not allowed in an ambient context." },
An_overload_signature_cannot_be_declared_as_a_generator: { code: 1221, category: DiagnosticCategory.Error, key: "An overload signature cannot be declared as a generator." },
_0_tag_already_specified: { code: 1222, category: DiagnosticCategory.Error, key: "'{0}' tag already specified." },
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." },
@@ -366,6 +369,8 @@ module ts {
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
No_best_common_type_exists_among_yield_expressions: { code: 2504, category: DiagnosticCategory.Error, key: "No best common type exists among yield expressions." },
A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: DiagnosticCategory.Error, key: "A generator cannot have a 'void' type annotation." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -523,6 +528,7 @@ module ts {
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 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." },
Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: DiagnosticCategory.Error, key: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." },
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." },
import_can_only_be_used_in_a_ts_file: { code: 8002, category: DiagnosticCategory.Error, key: "'import ... =' can only be used in a .ts file." },
@@ -540,10 +546,7 @@ module ts {
enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in a .ts file." },
type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in a .ts file." },
decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: DiagnosticCategory.Error, key: "'decorators' can only be used in a .ts file." },
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." },
Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." },
class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." },
class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." },
};
}
+31 -17
View File
@@ -467,7 +467,7 @@
"category": "Error",
"code": 1162
},
"'yield' expression must be contained_within a generator declaration.": {
"A 'yield' expression is only allowed in a generator body.": {
"category": "Error",
"code": 1163
},
@@ -682,11 +682,25 @@
"Export assignment is not supported when '--module' flag is 'system'.": {
"category": "Error",
"code": 1218
},
"'{0}' tag already specified.": {
},
"Generators are only available when targeting ECMAScript 6 or higher.": {
"category": "Error",
"code": 1219
},
"Generators are not allowed in an ambient context.": {
"category": "Error",
"code": 1220
},
"An overload signature cannot be declared as a generator.": {
"category": "Error",
"code": 1221
},
"'{0}' tag already specified.": {
"category": "Error",
"code": 1222
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2300
@@ -1442,15 +1456,23 @@
"A rest element cannot contain a binding pattern.": {
"category": "Error",
"code": 2501
},
},
"'{0}' is referenced directly or indirectly in its own type annotation.": {
"category": "Error",
"code": 2502
},
},
"Cannot find namespace '{0}'.": {
"category": "Error",
"code": 2503
},
"No best common type exists among yield expressions.": {
"category": "Error",
"code": 2504
},
"A generator cannot have a 'void' type annotation.": {
"category": "Error",
"code": 2505
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
@@ -2083,6 +2105,10 @@
"category": "Error",
"code": 7024
},
"Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type.": {
"category": "Error",
"code": 7025
},
"You cannot rename this element.": {
"category": "Error",
"code": 8000
@@ -2152,14 +2178,6 @@
"code": 8017
},
"'yield' expressions are not currently supported.": {
"category": "Error",
"code": 9000
},
"Generators are not currently supported.": {
"category": "Error",
"code": 9001
},
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
"category": "Error",
"code": 9002
@@ -2167,9 +2185,5 @@
"'class' expressions are not currently supported.": {
"category": "Error",
"code": 9003
},
"'class' declarations are only supported directly inside a module or as a top level declaration.": {
"category": "Error",
"code": 9004
}
}
+245 -301
View File
@@ -401,7 +401,7 @@ module ts {
module Parser {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ true);
const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true);
const disallowInAndDecoratorContext = ParserContextFlags.DisallowIn | ParserContextFlags.Decorator;
let sourceFile: SourceFile;
@@ -493,6 +493,13 @@ module ts {
// attached to the EOF token.
let parseErrorBeforeNextFinishedNode: boolean = false;
export const enum StatementFlags {
None = 0,
Statement = 1,
ModuleElement = 2,
StatementOrModuleElement = Statement | ModuleElement
}
export function parseSourceFile(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor, setParentNodes?: boolean): SourceFile {
initializeState(fileName, _sourceText, languageVersion, _syntaxCursor);
@@ -847,7 +854,7 @@ module ts {
// was in immediately prior to invoking the callback. The result of invoking the callback
// is returned from this function.
function lookAhead<T>(callback: () => T): T {
return speculationHelper(callback, /*isLookAhead:*/ true);
return speculationHelper(callback, /*isLookAhead*/ true);
}
// Invokes the provided callback. If the callback returns something falsy, then it restores
@@ -855,7 +862,7 @@ module ts {
// callback returns something truthy, then the parser state is not rolled back. The result
// of invoking the callback is returned from this function.
function tryParse<T>(callback: () => T): T {
return speculationHelper(callback, /*isLookAhead:*/ false);
return speculationHelper(callback, /*isLookAhead*/ false);
}
// Ignore strict mode flag because we will report an error in type checker instead.
@@ -1004,7 +1011,7 @@ module ts {
return finishNode(node);
}
return <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition:*/ false, diagnosticMessage || Diagnostics.Identifier_expected);
return <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ false, diagnosticMessage || Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage?: DiagnosticMessage): Identifier {
@@ -1023,7 +1030,7 @@ module ts {
function parsePropertyNameWorker(allowComputedPropertyNames: boolean): DeclarationName {
if (token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral) {
return parseLiteralNode(/*internName:*/ true);
return parseLiteralNode(/*internName*/ true);
}
if (allowComputedPropertyNames && token === SyntaxKind.OpenBracketToken) {
return parseComputedPropertyName();
@@ -1121,10 +1128,17 @@ module ts {
switch (parsingContext) {
case ParsingContext.SourceElements:
case ParsingContext.ModuleElements:
return isSourceElement(inErrorRecovery);
// If we're in error recovery, then we don't want to treat ';' as an empty statement.
// The problem is that ';' can show up in far too many contexts, and if we see one
// and assume it's a statement, then we may bail out inappropriately from whatever
// we're parsing. For example, if we have a semicolon in the middle of a class, then
// we really don't want to assume the class is over and we're on a statement in the
// outer module. We just want to consume and move on.
return !(token === SyntaxKind.SemicolonToken && inErrorRecovery) && isStartOfModuleElement();
case ParsingContext.BlockStatements:
case ParsingContext.SwitchClauseStatements:
return isStartOfStatement(inErrorRecovery);
// During error recovery we don't treat empty statements as statements
return !(token === SyntaxKind.SemicolonToken && inErrorRecovery) && isStartOfStatement();
case ParsingContext.SwitchClauses:
return token === SyntaxKind.CaseKeyword || token === SyntaxKind.DefaultKeyword;
case ParsingContext.TypeMembers:
@@ -1805,7 +1819,7 @@ module ts {
// Report that we need an identifier. However, report it right after the dot,
// and not on the next token. This is because the next token might actually
// be an identifier and the error woudl be quite confusing.
return <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentToken:*/ true, Diagnostics.Identifier_expected);
return <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentToken*/ true, Diagnostics.Identifier_expected);
}
}
@@ -1843,7 +1857,7 @@ module ts {
literal = parseLiteralNode();
}
else {
literal = <LiteralExpression>parseExpectedToken(SyntaxKind.TemplateTail, /*reportAtCurrentPosition:*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.CloseBraceToken));
literal = <LiteralExpression>parseExpectedToken(SyntaxKind.TemplateTail, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.CloseBraceToken));
}
span.literal = literal;
@@ -1936,7 +1950,7 @@ module ts {
function parseParameterType(): TypeNode {
if (parseOptional(SyntaxKind.ColonToken)) {
return token === SyntaxKind.StringLiteral
? <StringLiteral>parseLiteralNode(/*internName:*/ true)
? <StringLiteral>parseLiteralNode(/*internName*/ true)
: parseType();
}
@@ -2077,7 +2091,7 @@ module ts {
if (kind === SyntaxKind.ConstructSignature) {
parseExpected(SyntaxKind.NewKeyword);
}
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
parseTypeMemberSemicolon();
return finishNode(node);
}
@@ -2167,7 +2181,7 @@ module ts {
// Method signatues don't exist in expression contexts. So they have neither
// [Yield] nor [GeneratorParameter]
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, method);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ false, method);
parseTypeMemberSemicolon();
return finishNode(method);
}
@@ -2224,7 +2238,7 @@ module ts {
case SyntaxKind.OpenBracketToken:
// Indexer or computed property
return isIndexSignature()
? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined)
? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined)
: parsePropertyOrMethodSignature();
case SyntaxKind.NewKeyword:
if (lookAhead(isStartOfConstructSignature)) {
@@ -2306,7 +2320,7 @@ module ts {
if (kind === SyntaxKind.ConstructorType) {
parseExpected(SyntaxKind.NewKeyword);
}
fillSignature(SyntaxKind.EqualsGreaterThanToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
fillSignature(SyntaxKind.EqualsGreaterThanToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
return finishNode(node);
}
@@ -2615,7 +2629,7 @@ module ts {
// Otherwise, we try to parse out the conditional expression bit. We want to allow any
// binary expression here, so we pass in the 'lowest' precedence here so that it matches
// and consumes anything.
let expr = parseBinaryExpressionOrHigher(/*precedence:*/ 0);
let expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
// To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
@@ -2677,12 +2691,6 @@ module ts {
return !scanner.hasPrecedingLineBreak() && isIdentifier()
}
function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() {
nextToken();
return !scanner.hasPrecedingLineBreak() &&
(isIdentifier() || token === SyntaxKind.OpenBraceToken || token === SyntaxKind.OpenBracketToken);
}
function parseYieldExpression(): YieldExpression {
let node = <YieldExpression>createNode(SyntaxKind.YieldExpression);
@@ -2737,7 +2745,7 @@ module ts {
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
// expression instead.
let arrowFunction = triState === Tristate.True
? parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity:*/ true)
? parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ true)
: tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead);
if (!arrowFunction) {
@@ -2748,7 +2756,7 @@ module ts {
// If we have an arrow, then try to parse the body. Even if not, try to parse if we
// have an opening brace, just in case we're in an error state.
var lastToken = token;
arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, /*reportAtCurrentPosition:*/false, Diagnostics._0_expected, "=>");
arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, /*reportAtCurrentPosition*/false, Diagnostics._0_expected, "=>");
arrowFunction.body = (lastToken === SyntaxKind.EqualsGreaterThanToken || lastToken === SyntaxKind.OpenBraceToken)
? parseArrowFunctionExpressionBody()
: parseIdentifier();
@@ -2846,7 +2854,7 @@ module ts {
}
function parsePossibleParenthesizedArrowFunctionExpressionHead(): ArrowFunction {
return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity:*/ false);
return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity: boolean): ArrowFunction {
@@ -2858,7 +2866,7 @@ module ts {
// a => (b => c)
// And think that "(b =>" was actually a parenthesized arrow function with a missing
// close paren.
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ !allowAmbiguity, node);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ !allowAmbiguity, node);
// If we couldn't get parameters, we definitely could not parse out an arrow function.
if (!node.parameters) {
@@ -2883,14 +2891,14 @@ module ts {
function parseArrowFunctionExpressionBody(): Block | Expression {
if (token === SyntaxKind.OpenBraceToken) {
return parseFunctionBlock(/*allowYield:*/ false, /* ignoreMissingOpenBrace */ false);
return parseFunctionBlock(/*allowYield*/ false, /*ignoreMissingOpenBrace*/ false);
}
if (isStartOfStatement(/*inErrorRecovery:*/ true) &&
!isStartOfExpressionStatement() &&
if (token !== SyntaxKind.SemicolonToken &&
token !== SyntaxKind.FunctionKeyword &&
token !== SyntaxKind.ClassKeyword) {
token !== SyntaxKind.ClassKeyword &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
// Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
//
// Here we try to recover from a potential error situation in the case where the
@@ -2905,7 +2913,7 @@ module ts {
// up preemptively closing the containing construct.
//
// Note: even when 'ignoreMissingOpenBrace' is passed as true, parseBody will still error.
return parseFunctionBlock(/*allowYield:*/ false, /* ignoreMissingOpenBrace */ true);
return parseFunctionBlock(/*allowYield*/ false, /*ignoreMissingOpenBrace*/ true);
}
return parseAssignmentExpressionOrHigher();
@@ -2924,7 +2932,7 @@ module ts {
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
node.colonToken = parseExpectedToken(SyntaxKind.ColonToken, /*reportAtCurrentPosition:*/ false,
node.colonToken = parseExpectedToken(SyntaxKind.ColonToken, /*reportAtCurrentPosition*/ false,
Diagnostics._0_expected, tokenToString(SyntaxKind.ColonToken));
node.whenFalse = parseAssignmentExpressionOrHigher();
return finishNode(node);
@@ -3188,8 +3196,8 @@ module ts {
// If it wasn't then just try to parse out a '.' and report an error.
let node = <PropertyAccessExpression>createNode(SyntaxKind.PropertyAccessExpression, expression.pos);
node.expression = expression;
node.dotToken = parseExpectedToken(SyntaxKind.DotToken, /*reportAtCurrentPosition:*/ false, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(/*allowIdentifierNames:*/ true);
node.dotToken = parseExpectedToken(SyntaxKind.DotToken, /*reportAtCurrentPosition*/ false, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
return finishNode(node);
}
@@ -3209,7 +3217,7 @@ module ts {
let propertyAccess = <PropertyAccessExpression>createNode(SyntaxKind.PropertyAccessExpression, expression.pos);
propertyAccess.expression = expression;
propertyAccess.dotToken = dotToken;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames:*/ true);
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
continue;
}
@@ -3472,7 +3480,7 @@ module ts {
node.flags |= NodeFlags.MultiLine;
}
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimeter:*/ true);
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimeter*/ true);
parseExpected(SyntaxKind.CloseBraceToken);
return finishNode(node);
}
@@ -3490,8 +3498,8 @@ module ts {
parseExpected(SyntaxKind.FunctionKeyword);
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier();
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!node.asteriskToken, /*requireCompleteParameterList:*/ false, node);
node.body = parseFunctionBlock(/*allowYield:*/ !!node.asteriskToken, /* ignoreMissingOpenBrace */ false);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ !!node.asteriskToken, /*requireCompleteParameterList*/ false, node);
node.body = parseFunctionBlock(/*allowYield*/ !!node.asteriskToken, /* ignoreMissingOpenBrace */ false);
if (saveDecoratorContext) {
setDecoratorContext(true);
}
@@ -3601,7 +3609,7 @@ module ts {
let initializer: VariableDeclarationList | Expression = undefined;
if (token !== SyntaxKind.SemicolonToken) {
if (token === SyntaxKind.VarKeyword || token === SyntaxKind.LetKeyword || token === SyntaxKind.ConstKeyword) {
initializer = parseVariableDeclarationList(/*inForStatementInitializer:*/ true);
initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true);
}
else {
initializer = disallowInAnd(parseExpression);
@@ -3731,14 +3739,14 @@ module ts {
let node = <TryStatement>createNode(SyntaxKind.TryStatement);
parseExpected(SyntaxKind.TryKeyword);
node.tryBlock = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode*/ false);
node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false, /*checkForStrictMode*/ false);
node.catchClause = token === SyntaxKind.CatchKeyword ? parseCatchClause() : undefined;
// If we don't have a catch clause, then we must have a finally clause. Try to parse
// one out no matter what.
if (!node.catchClause || token === SyntaxKind.FinallyKeyword) {
parseExpected(SyntaxKind.FinallyKeyword);
node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode*/ false);
node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false, /*checkForStrictMode*/ false);
}
return finishNode(node);
@@ -3752,7 +3760,7 @@ module ts {
}
parseExpected(SyntaxKind.CloseParenToken);
result.block = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode:*/ false);
result.block = parseBlock(/*ignoreMissingOpenBrace*/ false, /*checkForStrictMode*/ false);
return finishNode(result);
}
@@ -3784,34 +3792,72 @@ module ts {
}
}
function isStartOfStatement(inErrorRecovery: boolean): boolean {
// Functions, variable statements and classes are allowed as a statement. But as per
// the grammar, they also allow modifiers. So we have to check for those statements
// that might be following modifiers.This ensures that things work properly when
// incrementally parsing as the parser will produce the same FunctionDeclaraiton,
// VariableStatement or ClassDeclaration, if it has the same text regardless of whether
// it is inside a block or not.
if (isModifier(token)) {
let result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers);
if (result) {
return true;
function isIdentifierOrKeyword() {
return token >= SyntaxKind.Identifier;
}
function nextTokenIsIdentifierOrKeywordOnSameLine() {
nextToken();
return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak();
}
function parseDeclarationFlags(): StatementFlags {
while (true) {
switch (token) {
case SyntaxKind.VarKeyword:
case SyntaxKind.LetKeyword:
case SyntaxKind.ConstKeyword:
case SyntaxKind.FunctionKeyword:
case SyntaxKind.ClassKeyword:
case SyntaxKind.EnumKeyword:
return StatementFlags.Statement;
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.TypeKeyword:
nextToken();
return isIdentifierOrKeyword() ? StatementFlags.Statement : StatementFlags.None;
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
nextToken();
return isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral ? StatementFlags.ModuleElement : StatementFlags.None;
case SyntaxKind.ImportKeyword:
nextToken();
return token === SyntaxKind.StringLiteral || token === SyntaxKind.AsteriskToken ||
token === SyntaxKind.OpenBraceToken || isIdentifierOrKeyword() ?
StatementFlags.ModuleElement : StatementFlags.None;
case SyntaxKind.ExportKeyword:
nextToken();
if (token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken ||
token === SyntaxKind.OpenBraceToken || token === SyntaxKind.DefaultKeyword) {
return StatementFlags.ModuleElement;
}
continue;
case SyntaxKind.DeclareKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.StaticKeyword:
nextToken();
continue;
default:
return StatementFlags.None;
}
}
}
function getDeclarationFlags(): StatementFlags {
return lookAhead(parseDeclarationFlags);
}
function getStatementFlags(): StatementFlags {
switch (token) {
case SyntaxKind.AtToken:
case SyntaxKind.SemicolonToken:
// If we're in error recovery, then we don't want to treat ';' as an empty statement.
// The problem is that ';' can show up in far too many contexts, and if we see one
// and assume it's a statement, then we may bail out inappropriately from whatever
// we're parsing. For example, if we have a semicolon in the middle of a class, then
// we really don't want to assume the class is over and we're on a statement in the
// outer module. We just want to consume and move on.
return !inErrorRecovery;
case SyntaxKind.OpenBraceToken:
case SyntaxKind.VarKeyword:
case SyntaxKind.LetKeyword:
case SyntaxKind.FunctionKeyword:
case SyntaxKind.ClassKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.IfKeyword:
case SyntaxKind.DoKeyword:
case SyntaxKind.WhileKeyword:
@@ -3828,62 +3874,84 @@ module ts {
// however, we say they are here so that we may gracefully parse them and error later.
case SyntaxKind.CatchKeyword:
case SyntaxKind.FinallyKeyword:
return true;
return StatementFlags.Statement;
case SyntaxKind.ConstKeyword:
// const keyword can precede enum keyword when defining constant enums
// 'const enum' do not start statement.
// In ES 6 'enum' is a future reserved keyword, so it should not be used as identifier
let isConstEnum = lookAhead(nextTokenIsEnumKeyword);
return !isConstEnum;
case SyntaxKind.ExportKeyword:
case SyntaxKind.ImportKeyword:
return getDeclarationFlags();
case SyntaxKind.DeclareKeyword:
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.TypeKeyword:
// When followed by an identifier, these do not start a statement but might
// instead be following declarations
if (isDeclarationStart()) {
return false;
}
// When these don't start a declaration, they're an identifier in an expression statement
return getDeclarationFlags() || StatementFlags.Statement;
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.StaticKeyword:
// When followed by an identifier or keyword, these do not start a statement but
// might instead be following type members
if (lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine)) {
return false;
}
// When these don't start a declaration, they may be the start of a class member if an identifier
// immediately follows. Otherwise they're an identifier in an expression statement.
return getDeclarationFlags() ||
(lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? StatementFlags.None : StatementFlags.Statement);
default:
return isStartOfExpression();
return isStartOfExpression() ? StatementFlags.Statement : StatementFlags.None;
}
}
function nextTokenIsEnumKeyword() {
nextToken();
return token === SyntaxKind.EnumKeyword
function isStartOfStatement(): boolean {
return (getStatementFlags() & StatementFlags.Statement) !== 0;
}
function nextTokenIsIdentifierOrKeywordOnSameLine() {
function isStartOfModuleElement(): boolean {
return (getStatementFlags() & StatementFlags.StatementOrModuleElement) !== 0;
}
function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() {
nextToken();
return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak();
return !scanner.hasPrecedingLineBreak() &&
(isIdentifier() || token === SyntaxKind.OpenBraceToken || token === SyntaxKind.OpenBracketToken);
}
function isLetDeclaration() {
// It is let declaration if in strict mode or next token is identifier\open bracket\open curly on same line.
// otherwise it needs to be treated like identifier
return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine);
}
function parseStatement(): Statement {
return <Statement>parseModuleElementOfKind(StatementFlags.Statement);
}
function parseModuleElement(): ModuleElement {
return parseModuleElementOfKind(StatementFlags.StatementOrModuleElement);
}
function parseSourceElement(): ModuleElement {
return parseModuleElementOfKind(StatementFlags.StatementOrModuleElement);
}
function parseModuleElementOfKind(flags: StatementFlags): ModuleElement {
switch (token) {
case SyntaxKind.OpenBraceToken:
return parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode:*/ false);
case SyntaxKind.VarKeyword:
case SyntaxKind.ConstKeyword:
// const here should always be parsed as const declaration because of check in 'isStatement'
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
case SyntaxKind.ClassKeyword:
return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
case SyntaxKind.SemicolonToken:
return parseEmptyStatement();
case SyntaxKind.OpenBraceToken:
return parseBlock(/*ignoreMissingOpenBrace*/ false, /*checkForStrictMode*/ false);
case SyntaxKind.VarKeyword:
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);
case SyntaxKind.LetKeyword:
if (isLetDeclaration()) {
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);
}
break;
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);
case SyntaxKind.ClassKeyword:
return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);
case SyntaxKind.IfKeyword:
return parseIfStatement();
case SyntaxKind.DoKeyword:
@@ -3911,61 +3979,69 @@ module ts {
return parseTryStatement();
case SyntaxKind.DebuggerKeyword:
return parseDebuggerStatement();
case SyntaxKind.LetKeyword:
// If let follows identifier on the same line, it is declaration parse it as variable statement
if (isLetDeclaration()) {
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
case SyntaxKind.AtToken:
return parseDeclaration();
case SyntaxKind.ConstKeyword:
case SyntaxKind.DeclareKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.ExportKeyword:
case SyntaxKind.ImportKeyword:
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.StaticKeyword:
case SyntaxKind.TypeKeyword:
if (getDeclarationFlags() & flags) {
return parseDeclaration();
}
// Else parse it like identifier - fall through
default:
// Functions and variable statements are allowed as a statement. But as per
// the grammar, they also allow modifiers. So we have to check for those
// statements that might be following modifiers. This ensures that things
// work properly when incrementally parsing as the parser will produce the
// same FunctionDeclaraiton or VariableStatement if it has the same text
// regardless of whether it is inside a block or not.
// Even though variable statements and function declarations cannot have decorators,
// we parse them here to provide better error recovery.
if (isModifier(token) || token === SyntaxKind.AtToken) {
let result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers);
if (result) {
return result;
}
}
return parseExpressionOrLabeledStatement();
break;
}
return parseExpressionOrLabeledStatement();
}
function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers(): FunctionDeclaration | VariableStatement | ClassDeclaration {
let start = scanner.getStartPos();
function parseDeclaration(): ModuleElement {
let fullStart = getNodePos();
let decorators = parseDecorators();
let modifiers = parseModifiers();
switch (token) {
case SyntaxKind.ConstKeyword:
let nextTokenIsEnum = lookAhead(nextTokenIsEnumKeyword)
if (nextTokenIsEnum) {
return undefined;
}
return parseVariableStatement(start, decorators, modifiers);
case SyntaxKind.LetKeyword:
if (!isLetDeclaration()) {
return undefined;
}
return parseVariableStatement(start, decorators, modifiers);
case SyntaxKind.VarKeyword:
return parseVariableStatement(start, decorators, modifiers);
case SyntaxKind.LetKeyword:
case SyntaxKind.ConstKeyword:
return parseVariableStatement(fullStart, decorators, modifiers);
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(start, decorators, modifiers);
return parseFunctionDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ClassKeyword:
return parseClassDeclaration(start, decorators, modifiers);
return parseClassDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.InterfaceKeyword:
return parseInterfaceDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.TypeKeyword:
return parseTypeAliasDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.EnumKeyword:
return parseEnumDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
return parseModuleDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ImportKeyword:
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ExportKeyword:
nextToken();
return token === SyntaxKind.DefaultKeyword || token === SyntaxKind.EqualsToken ?
parseExportAssignment(fullStart, decorators, modifiers) :
parseExportDeclaration(fullStart, decorators, modifiers);
default:
if (decorators) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
let node = <ModuleElement>createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
node.pos = fullStart;
node.decorators = decorators;
setModifiers(node, modifiers);
return finishNode(node);
}
}
return undefined;
}
function parseFunctionBlockOrSemicolon(isGenerator: boolean, diagnosticMessage?: DiagnosticMessage): Block {
@@ -3974,7 +4050,7 @@ module ts {
return;
}
return parseFunctionBlock(isGenerator, /*ignoreMissingOpenBrace:*/ false, diagnosticMessage);
return parseFunctionBlock(isGenerator, /*ignoreMissingOpenBrace*/ false, diagnosticMessage);
}
// DECLARATIONS
@@ -4097,7 +4173,7 @@ module ts {
let node = <VariableStatement>createNode(SyntaxKind.VariableStatement, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer:*/ false);
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);
parseSemicolon();
return finishNode(node);
}
@@ -4109,7 +4185,7 @@ module ts {
parseExpected(SyntaxKind.FunctionKeyword);
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
node.name = node.flags & NodeFlags.Default ? parseOptionalIdentifier() : parseIdentifier();
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!node.asteriskToken, /*requireCompleteParameterList:*/ false, node);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ !!node.asteriskToken, /*requireCompleteParameterList*/ false, node);
node.body = parseFunctionBlockOrSemicolon(!!node.asteriskToken, Diagnostics.or_expected);
return finishNode(node);
}
@@ -4119,8 +4195,8 @@ module ts {
node.decorators = decorators;
setModifiers(node, modifiers);
parseExpected(SyntaxKind.ConstructorKeyword);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
node.body = parseFunctionBlockOrSemicolon(/*isGenerator:*/ false, Diagnostics.or_expected);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, Diagnostics.or_expected);
return finishNode(node);
}
@@ -4131,7 +4207,7 @@ module ts {
method.asteriskToken = asteriskToken;
method.name = name;
method.questionToken = questionToken;
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken, /*requireCompleteParameterList:*/ false, method);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ !!asteriskToken, /*requireCompleteParameterList*/ false, method);
method.body = parseFunctionBlockOrSemicolon(!!asteriskToken, diagnosticMessage);
return finishNode(method);
}
@@ -4143,7 +4219,20 @@ module ts {
property.name = name;
property.questionToken = questionToken;
property.type = parseTypeAnnotation();
property.initializer = allowInAnd(parseNonParameterInitializer);
// For instance properties specifically, since they are evaluated inside the constructor,
// we do *not * want to parse yield expressions, so we specifically turn the yield context
// off. The grammar would look something like this:
//
// MemberVariableDeclaration[Yield]:
// AccessibilityModifier_opt PropertyName TypeAnnotation_opt Initialiser_opt[In];
// AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initialiser_opt[In, ?Yield];
//
// The checker may still error in the static case to explicitly disallow the yield expression.
property.initializer = modifiers && modifiers.flags & NodeFlags.Static
? allowInAnd(parseNonParameterInitializer)
: doOutsideOfContext(ParserContextFlags.Yield | ParserContextFlags.DisallowIn, parseNonParameterInitializer);
parseSemicolon();
return finishNode(property);
}
@@ -4172,8 +4261,8 @@ module ts {
node.decorators = decorators;
setModifiers(node, modifiers);
node.name = parsePropertyName();
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
node.body = parseFunctionBlockOrSemicolon(/*isGenerator:*/ false);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false);
return finishNode(node);
}
@@ -4352,9 +4441,9 @@ module ts {
function parseClassExpression(): ClassExpression {
return <ClassExpression>parseClassDeclarationOrExpression(
/*fullStart:*/ scanner.getStartPos(),
/*decorators:*/ undefined,
/*modifiers:*/ undefined,
/*fullStart*/ scanner.getStartPos(),
/*decorators*/ undefined,
/*modifiers*/ undefined,
SyntaxKind.ClassExpression);
}
@@ -4373,7 +4462,7 @@ module ts {
parseExpected(SyntaxKind.ClassKeyword);
node.name = parseOptionalIdentifier();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause:*/ true);
node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ true);
if (parseExpected(SyntaxKind.OpenBraceToken)) {
// ClassTail[Yield,GeneratorParameter] : See 14.5
@@ -4409,7 +4498,7 @@ module ts {
}
function parseHeritageClausesWorker() {
return parseList(ParsingContext.HeritageClauses, /*checkForStrictMode:*/ false, parseHeritageClause);
return parseList(ParsingContext.HeritageClauses, /*checkForStrictMode*/ false, parseHeritageClause);
}
function parseHeritageClause() {
@@ -4449,7 +4538,7 @@ module ts {
parseExpected(SyntaxKind.InterfaceKeyword);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause:*/ false);
node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ false);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
@@ -4512,7 +4601,7 @@ module ts {
node.flags |= flags;
node.name = parseIdentifier();
node.body = parseOptional(SyntaxKind.DotToken)
? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers:*/undefined, NodeFlags.Export)
? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, NodeFlags.Export)
: parseModuleBlock();
return finishNode(node);
}
@@ -4521,7 +4610,7 @@ module ts {
let node = <ModuleDeclaration>createNode(SyntaxKind.ModuleDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.name = parseLiteralNode(/*internName:*/ true);
node.name = parseLiteralNode(/*internName*/ true);
node.body = parseModuleBlock();
return finishNode(node);
}
@@ -4748,151 +4837,6 @@ module ts {
return finishNode(node);
}
function isLetDeclaration() {
// It is let declaration if in strict mode or next token is identifier\open bracket\open curly on same line.
// otherwise it needs to be treated like identifier
return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine);
}
function isDeclarationStart(followsModifier?: boolean): boolean {
switch (token) {
case SyntaxKind.VarKeyword:
case SyntaxKind.ConstKeyword:
case SyntaxKind.FunctionKeyword:
return true;
case SyntaxKind.LetKeyword:
return isLetDeclaration();
case SyntaxKind.ClassKeyword:
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.TypeKeyword:
// Not true keywords so ensure an identifier follows
return lookAhead(nextTokenIsIdentifierOrKeyword);
case SyntaxKind.ImportKeyword:
// Not true keywords so ensure an identifier follows or is string literal or asterisk or open brace
return lookAhead(nextTokenCanFollowImportKeyword);
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
// Not a true keyword so ensure an identifier or string literal follows
return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral);
case SyntaxKind.ExportKeyword:
// Check for export assignment or modifier on source element
return lookAhead(nextTokenCanFollowExportKeyword);
case SyntaxKind.DeclareKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.StaticKeyword:
// Check for modifier on source element
return lookAhead(nextTokenIsDeclarationStart);
case SyntaxKind.AtToken:
// a lookahead here is too costly, and decorators are only valid on a declaration.
// We will assume we are parsing a declaration here and report an error later
return !followsModifier;
}
}
function isIdentifierOrKeyword() {
return token >= SyntaxKind.Identifier;
}
function nextTokenIsIdentifierOrKeyword() {
nextToken();
return isIdentifierOrKeyword();
}
function nextTokenIsIdentifierOrKeywordOrStringLiteral() {
nextToken();
return isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral;
}
function nextTokenCanFollowImportKeyword() {
nextToken();
return isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral ||
token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBraceToken;
}
function nextTokenCanFollowExportKeyword() {
nextToken();
return token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken ||
token === SyntaxKind.OpenBraceToken || token === SyntaxKind.DefaultKeyword || isDeclarationStart(/*followsModifier*/ true);
}
function nextTokenIsDeclarationStart() {
nextToken();
return isDeclarationStart(/*followsModifier*/ true);
}
function nextTokenIsAsKeyword() {
return nextToken() === SyntaxKind.AsKeyword;
}
function parseDeclaration(): ModuleElement {
let fullStart = getNodePos();
let decorators = parseDecorators();
let modifiers = parseModifiers();
if (token === SyntaxKind.ExportKeyword) {
nextToken();
if (token === SyntaxKind.DefaultKeyword || token === SyntaxKind.EqualsToken) {
return parseExportAssignment(fullStart, decorators, modifiers);
}
if (token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBraceToken) {
return parseExportDeclaration(fullStart, decorators, modifiers);
}
}
switch (token) {
case SyntaxKind.VarKeyword:
case SyntaxKind.LetKeyword:
case SyntaxKind.ConstKeyword:
return parseVariableStatement(fullStart, decorators, modifiers);
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ClassKeyword:
return parseClassDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.InterfaceKeyword:
return parseInterfaceDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.TypeKeyword:
return parseTypeAliasDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.EnumKeyword:
return parseEnumDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
return parseModuleDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ImportKeyword:
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
default:
if (decorators) {
// We reached this point because we encountered an AtToken and assumed a declaration would
// follow. For recovery and error reporting purposes, return an incomplete declaration.
let node = <ModuleElement>createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
node.pos = fullStart;
node.decorators = decorators;
setModifiers(node, modifiers);
return finishNode(node);
}
Debug.fail("Mismatch between isDeclarationStart and parseDeclaration");
}
}
function isSourceElement(inErrorRecovery: boolean): boolean {
return isDeclarationStart() || isStartOfStatement(inErrorRecovery);
}
function parseSourceElement() {
return parseSourceElementOrModuleElement();
}
function parseModuleElement() {
return parseSourceElementOrModuleElement();
}
function parseSourceElementOrModuleElement(): ModuleElement {
return isDeclarationStart()
? parseDeclaration()
: parseStatement();
}
function processReferenceComments(sourceFile: SourceFile): void {
let triviaScanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/false, sourceText);
let referencedFiles: FileReference[] = [];
@@ -5899,7 +5843,7 @@ module ts {
if (child.pos > changeRangeOldEnd) {
// Node is entirely past the change range. We need to move both its pos and
// end, forward or backward appropriately.
moveElementEntirelyPastChangeRange(child, /*isArray:*/ false, delta, oldText, newText, aggressiveChecks);
moveElementEntirelyPastChangeRange(child, /*isArray*/ false, delta, oldText, newText, aggressiveChecks);
return;
}
@@ -5928,7 +5872,7 @@ module ts {
if (array.pos > changeRangeOldEnd) {
// Array is entirely after the change range. We need to move it, and move any of
// its children.
moveElementEntirelyPastChangeRange(array, /*isArray:*/ true, delta, oldText, newText, aggressiveChecks);
moveElementEntirelyPastChangeRange(array, /*isArray*/ true, delta, oldText, newText, aggressiveChecks);
return;
}
+1 -1
View File
@@ -231,7 +231,7 @@ module ts {
var directories: string[] = [];
for (let current of files) {
var name = combinePaths(path, current);
var stat = _fs.lstatSync(name);
var stat = _fs.statSync(name);
if (stat.isFile()) {
if (!extension || fileExtensionIs(name, extension)) {
result.push(name);
+13 -4
View File
@@ -693,7 +693,7 @@ module ts {
export interface YieldExpression extends Expression {
asteriskToken?: Node;
expression: Expression;
expression?: Expression;
}
export interface BinaryExpression extends Expression {
@@ -917,7 +917,7 @@ module ts {
_classElementBrand: any;
}
export interface InterfaceDeclaration extends Declaration, ModuleElement {
export interface InterfaceDeclaration extends Declaration, Statement {
name: Identifier;
typeParameters?: NodeArray<TypeParameterDeclaration>;
heritageClauses?: NodeArray<HeritageClause>;
@@ -929,7 +929,7 @@ module ts {
types?: NodeArray<ExpressionWithTypeArguments>;
}
export interface TypeAliasDeclaration extends Declaration, ModuleElement {
export interface TypeAliasDeclaration extends Declaration, Statement {
name: Identifier;
type: TypeNode;
}
@@ -941,7 +941,7 @@ module ts {
initializer?: Expression;
}
export interface EnumDeclaration extends Declaration, ModuleElement {
export interface EnumDeclaration extends Declaration, Statement {
name: Identifier;
members: NodeArray<EnumMember>;
}
@@ -1626,6 +1626,8 @@ module ts {
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
export interface InterfaceType extends ObjectType {
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
outerTypeParameters: TypeParameter[]; // Outer type parameters (undefined if none)
localTypeParameters: TypeParameter[]; // Local type parameters (undefined if none)
}
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
@@ -1676,6 +1678,13 @@ module ts {
numberIndexType: Type; // Numeric index type
}
// Just a place to cache element types of iterables and iterators
/* @internal */
export interface IterableOrIteratorType extends ObjectType, UnionType {
iterableElementType?: Type;
iteratorElementType?: Type;
}
// Type parameters (TypeFlags.TypeParameter)
export interface TypeParameter extends Type {
constraint: Type; // Constraint
+128
View File
@@ -408,6 +408,93 @@ module ts {
export let fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/
export function isTypeNode(node: Node): boolean {
if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) {
return true;
}
switch (node.kind) {
case SyntaxKind.AnyKeyword:
case SyntaxKind.NumberKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.BooleanKeyword:
case SyntaxKind.SymbolKeyword:
return true;
case SyntaxKind.VoidKeyword:
return node.parent.kind !== SyntaxKind.VoidExpression;
case SyntaxKind.StringLiteral:
// Specialized signatures can have string literals as their parameters' type names
return node.parent.kind === SyntaxKind.Parameter;
case SyntaxKind.ExpressionWithTypeArguments:
return true;
// Identifiers and qualified names may be type nodes, depending on their context. Climb
// above them to find the lowest container
case SyntaxKind.Identifier:
// If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
if (node.parent.kind === SyntaxKind.QualifiedName && (<QualifiedName>node.parent).right === node) {
node = node.parent;
}
else if (node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).name === node) {
node = node.parent;
}
// fall through
case SyntaxKind.QualifiedName:
case SyntaxKind.PropertyAccessExpression:
// At this point, node is either a qualified name or an identifier
Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression,
"'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'.");
let parent = node.parent;
if (parent.kind === SyntaxKind.TypeQuery) {
return false;
}
// Do not recursively call isTypeNode on the parent. In the example:
//
// let a: A.B.C;
//
// Calling isTypeNode would consider the qualified name A.B a type node. Only C or
// A.B.C is a type node.
if (SyntaxKind.FirstTypeNode <= parent.kind && parent.kind <= SyntaxKind.LastTypeNode) {
return true;
}
switch (parent.kind) {
case SyntaxKind.ExpressionWithTypeArguments:
return true;
case SyntaxKind.TypeParameter:
return node === (<TypeParameterDeclaration>parent).constraint;
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
case SyntaxKind.Parameter:
case SyntaxKind.VariableDeclaration:
return node === (<VariableLikeDeclaration>parent).type;
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
case SyntaxKind.Constructor:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return node === (<FunctionLikeDeclaration>parent).type;
case SyntaxKind.CallSignature:
case SyntaxKind.ConstructSignature:
case SyntaxKind.IndexSignature:
return node === (<SignatureDeclaration>parent).type;
case SyntaxKind.TypeAssertionExpression:
return node === (<TypeAssertion>parent).type;
case SyntaxKind.CallExpression:
case SyntaxKind.NewExpression:
return (<CallExpression>parent).typeArguments && indexOf((<CallExpression>parent).typeArguments, node) >= 0;
case SyntaxKind.TaggedTemplateExpression:
// TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.
return false;
}
}
return false;
}
// Warning: This has the same semantics as the forEach family of functions,
// in that traversal terminates in the event that 'visitor' supplies a truthy value.
export function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T {
@@ -438,6 +525,46 @@ module ts {
}
}
export function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void {
return traverse(body);
function traverse(node: Node): void {
switch (node.kind) {
case SyntaxKind.YieldExpression:
visitor(<YieldExpression>node);
let operand = (<YieldExpression>node).expression;
if (operand) {
traverse(operand);
}
case SyntaxKind.EnumDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.ClassDeclaration:
// These are not allowed inside a generator now, but eventually they may be allowed
// as local types. Regardless, any yield statements contained within them should be
// skipped in this traversal.
return;
default:
if (isFunctionLike(node)) {
let name = (<FunctionLikeDeclaration>node).name;
if (name && name.kind === SyntaxKind.ComputedPropertyName) {
// Note that we will not include methods/accessors of a class because they would require
// first descending into the class. This is by design.
traverse((<ComputedPropertyName>name).expression);
return;
}
}
else if (!isTypeNode(node)) {
// This is the general case, which should include mostly expressions and statements.
// Also includes NodeArrays.
forEachChild(node, traverse);
}
}
}
}
export function isVariableLike(node: Node): boolean {
if (node) {
switch (node.kind) {
@@ -739,6 +866,7 @@ module ts {
case SyntaxKind.TemplateExpression:
case SyntaxKind.NoSubstitutionTemplateLiteral:
case SyntaxKind.OmittedExpression:
case SyntaxKind.YieldExpression:
return true;
case SyntaxKind.QualifiedName:
while (node.parent.kind === SyntaxKind.QualifiedName) {
-8
View File
@@ -505,14 +505,6 @@ interface GeneratorFunctionConstructor {
}
declare var GeneratorFunction: GeneratorFunctionConstructor;
interface Generator<T> extends IterableIterator<T> {
next(value?: any): IteratorResult<T>;
throw(exception: any): IteratorResult<T>;
return(value: T): IteratorResult<T>;
[Symbol.iterator](): Generator<T>;
[Symbol.toStringTag]: string;
}
interface Math {
/**
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
+22 -1
View File
@@ -193,12 +193,18 @@ module ts.formatting {
// Insert space after function keyword for anonymous functions
public SpaceAfterAnonymousFunctionKeyword: Rule;
public NoSpaceAfterAnonymousFunctionKeyword: Rule;
// Insert space after @ in decorator
public SpaceBeforeAt: Rule;
public NoSpaceAfterAt: Rule;
public SpaceAfterDecorator: Rule;
// Generator: function*
public NoSpaceBetweenFunctionKeywordAndStar: Rule;
public SpaceAfterStarInGeneratorDeclaration: Rule;
public NoSpaceBetweenYieldKeywordAndStar: Rule;
public SpaceBetweenYieldOrYieldStarAndOperand: Rule;
constructor() {
///
/// Common Rules
@@ -340,6 +346,11 @@ module ts.formatting {
this.NoSpaceAfterAt = new Rule(RuleDescriptor.create3(SyntaxKind.AtToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
this.SpaceAfterDecorator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.ExportKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.ClassKeyword, SyntaxKind.StaticKeyword, SyntaxKind.PublicKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.GetKeyword, SyntaxKind.SetKeyword, SyntaxKind.OpenBracketToken, SyntaxKind.AsteriskToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), RuleAction.Space));
this.NoSpaceBetweenFunctionKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), RuleAction.Delete));
this.SpaceAfterStarInGeneratorDeclaration = new Rule(RuleDescriptor.create3(SyntaxKind.AsteriskToken, Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), RuleAction.Space));
this.NoSpaceBetweenYieldKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Delete));
this.SpaceBetweenYieldOrYieldStarAndOperand = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Space));
// These rules are higher in priority than user-configurable rules.
this.HighPriorityCommonRules =
[
@@ -357,7 +368,9 @@ module ts.formatting {
this.NoSpaceAfterCloseBrace,
this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext,
this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets,
this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration,
this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember,
this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand,
this.NoSpaceBetweenReturnAndSemicolon,
this.SpaceAfterCertainKeywords,
this.SpaceAfterLetConstInVariableDeclaration,
@@ -574,6 +587,10 @@ module ts.formatting {
return false;
}
static IsFunctionDeclarationOrFunctionExpressionContext(context: FormattingContext): boolean {
return context.contextNode.kind === SyntaxKind.FunctionDeclaration || context.contextNode.kind === SyntaxKind.FunctionExpression;
}
static IsTypeScriptDeclWithBlockContext(context: FormattingContext): boolean {
return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode);
}
@@ -717,5 +734,9 @@ module ts.formatting {
static IsVoidOpContext(context: FormattingContext): boolean {
return context.currentTokenSpan.kind === SyntaxKind.VoidKeyword && context.currentTokenParent.kind === SyntaxKind.VoidExpression;
}
static IsYieldOrYieldStarWithOperand(context: FormattingContext): boolean {
return context.contextNode.kind === SyntaxKind.YieldExpression && (<YieldExpression>context.contextNode).expression !== undefined;
}
}
}
+5
View File
@@ -2475,6 +2475,10 @@ module ts {
}
}
// hostCache is captured in the closure for 'getOrCreateSourceFile' but it should not be used past this point.
// It needs to be cleared to allow all collected snapshots to be released
hostCache = undefined;
program = newProgram;
// Make sure all the nodes in the program are both bound, and have their parent
@@ -2483,6 +2487,7 @@ module ts {
return;
function getOrCreateSourceFile(fileName: string): SourceFile {
Debug.assert(hostCache !== undefined);
// The program is asking for this file, check first if the host can locate it.
// If the host can not locate the file, then it does not exist. return undefined
// to the program to allow reporting of errors for missing files.
+1 -1
View File
@@ -989,4 +989,4 @@ module TypeScript.Services {
}
/* @internal */
let toolsVersion = "1.4";
let toolsVersion = "1.5";
@@ -1,8 +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,10): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (1 errors) ====
function * foo(a = yield => yield) {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,8 +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,10): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts (1 errors) ====
function * yield() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,11 +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(1,10): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (2 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
// Legal to use 'yield' in a type context.
var v: yield;
~~~~~
@@ -1,8 +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,10): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts (1 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,11 +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,9): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ====
function*foo(a = yield) {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}
@@ -1,16 +1,16 @@
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,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,11): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (3 errors) ====
function*bar() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
// 'yield' here is an identifier, and not a yield expression.
function*foo(a = yield) {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}
@@ -1,12 +1,9 @@
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(2,14): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (1 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
var v = { [yield]: foo }
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,7 +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,18): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts (1 errors) ====
var v = function * () { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,7 +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,18): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts (1 errors) ====
var v = function * foo() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,7 +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,11): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts (1 errors) ====
var v = { *foo() { } }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,10 +1,10 @@
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,11): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ====
var v = { *[foo()]() { } }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
~~~
!!! error TS2304: Cannot find name 'foo'.
@@ -1,9 +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(2,4): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts (1 errors) ====
class C {
*foo() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,9 +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(2,11): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts (1 errors) ====
class C {
public * foo() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,4 +1,4 @@
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(2,4): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,6): error TS2304: Cannot find name 'foo'.
@@ -6,7 +6,7 @@ tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration
class C {
*[foo]() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
~~~
!!! error TS2304: Cannot find name 'foo'.
}
@@ -1,9 +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(2,4): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts (1 errors) ====
class C {
*foo<T>() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,14 +1,14 @@
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(2,5): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(2,11): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts (2 errors) ====
var v = { * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
~~~
!!! error TS2304: Cannot find name 'foo'.
}
}
@@ -1,14 +1,14 @@
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(3,5): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (2 errors) ====
class C {
*foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
~~~
!!! error TS2304: Cannot find name 'foo'.
}
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts (1 errors) ====
@@ -6,6 +6,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): erro
constructor() {
yield foo
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
}
}
@@ -1,10 +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,19): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (1 errors) ====
function* foo() { yield }
~
!!! error TS9001: Generators are not currently supported.
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts (1 errors) ====
@@ -6,6 +6,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): erro
foo() {
yield foo
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
}
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts(2,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts(2,6): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts (1 errors) ====
var v = () => {
yield foo
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
}
@@ -1,14 +1,14 @@
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(3,5): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (2 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
function bar() {
yield foo;
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
}
}
@@ -1,6 +1,6 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts (3 errors) ====
@@ -10,4 +10,4 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): err
~~~
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
@@ -1,8 +1,8 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts (1 errors) ====
"use strict";
yield(foo);
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
@@ -1,19 +1,16 @@
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(3,13): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(4,7): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(3,13): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (2 errors) ====
function*foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
function bar() {
function* quux() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
}
@@ -1,7 +1,7 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts(1,1): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts(1,1): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts (1 errors) ====
yield foo;
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
@@ -1,16 +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(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
yield
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
yield
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,16 +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(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
yield;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
yield;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,12 +1,12 @@
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(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(2,9): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts (2 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
yield*foo
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
~~~
!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
}
@@ -1,12 +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(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
yield foo
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,16 +1,13 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
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(3,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (3 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.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,12 +1,12 @@
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(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(2,9): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts (2 errors) ====
var v = function*() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
~~~
!!! error TS2304: Cannot find name 'foo'.
}
@@ -0,0 +1,10 @@
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression1_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression1_es6.ts(1,9): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression1_es6.ts (2 errors) ====
yield * [];
~~~~~
!!! error TS2304: Cannot find name 'yield'.
~~
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -0,0 +1,5 @@
//// [YieldStarExpression1_es6.ts]
yield * [];
//// [YieldStarExpression1_es6.js]
yield * [];
@@ -0,0 +1,10 @@
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression2_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression2_es6.ts(1,8): error TS1109: Expression expected.
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression2_es6.ts (2 errors) ====
yield *;
~~~~~
!!! error TS2304: Cannot find name 'yield'.
~
!!! error TS1109: Expression expected.
@@ -0,0 +1,5 @@
//// [YieldStarExpression2_es6.ts]
yield *;
//// [YieldStarExpression2_es6.js]
yield * ;
@@ -0,0 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression3_es6.ts(2,12): error TS1109: Expression expected.
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression3_es6.ts (1 errors) ====
function *g() {
yield *;
~
!!! error TS1109: Expression expected.
}
@@ -0,0 +1,9 @@
//// [YieldStarExpression3_es6.ts]
function *g() {
yield *;
}
//// [YieldStarExpression3_es6.js]
function g() {
yield* ;
}
@@ -0,0 +1,12 @@
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts(1,10): error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts(2,13): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts (2 errors) ====
function *g() {
~
!!! error TS1219: Generators are only available when targeting ECMAScript 6 or higher.
yield * [];
~~
!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
}
@@ -0,0 +1,9 @@
//// [YieldStarExpression4_es6.ts]
function *g() {
yield * [];
}
//// [YieldStarExpression4_es6.js]
function g() {
yield* [];
}
@@ -1,13 +0,0 @@
tests/cases/compiler/classDeclarationBlockScoping1.ts(5,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
==== tests/cases/compiler/classDeclarationBlockScoping1.ts (1 errors) ====
class C {
}
{
class C {
~
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
}
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/classDeclarationBlockScoping1.ts ===
class C {
>C : Symbol(C, Decl(classDeclarationBlockScoping1.ts, 0, 0))
}
{
class C {
>C : Symbol(C, Decl(classDeclarationBlockScoping1.ts, 3, 1))
}
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/classDeclarationBlockScoping1.ts ===
class C {
>C : C
}
{
class C {
>C : C
}
}
@@ -1,18 +0,0 @@
tests/cases/compiler/classDeclarationBlockScoping2.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
tests/cases/compiler/classDeclarationBlockScoping2.ts(5,15): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
==== tests/cases/compiler/classDeclarationBlockScoping2.ts (2 errors) ====
function f() {
class C {}
~
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
var c1 = C;
{
class C {}
~
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
var c2 = C;
}
return C === c1;
}
@@ -0,0 +1,22 @@
=== tests/cases/compiler/classDeclarationBlockScoping2.ts ===
function f() {
>f : Symbol(f, Decl(classDeclarationBlockScoping2.ts, 0, 0))
class C {}
>C : Symbol(C, Decl(classDeclarationBlockScoping2.ts, 0, 14))
var c1 = C;
>c1 : Symbol(c1, Decl(classDeclarationBlockScoping2.ts, 2, 7))
>C : Symbol(C, Decl(classDeclarationBlockScoping2.ts, 0, 14))
{
class C {}
>C : Symbol(C, Decl(classDeclarationBlockScoping2.ts, 3, 5))
var c2 = C;
>c2 : Symbol(c2, Decl(classDeclarationBlockScoping2.ts, 5, 11))
>C : Symbol(C, Decl(classDeclarationBlockScoping2.ts, 3, 5))
}
return C === c1;
>C : Symbol(C, Decl(classDeclarationBlockScoping2.ts, 0, 14))
>c1 : Symbol(c1, Decl(classDeclarationBlockScoping2.ts, 2, 7))
}
@@ -0,0 +1,23 @@
=== tests/cases/compiler/classDeclarationBlockScoping2.ts ===
function f() {
>f : () => boolean
class C {}
>C : C
var c1 = C;
>c1 : typeof C
>C : typeof C
{
class C {}
>C : C
var c2 = C;
>c2 : typeof C
>C : typeof C
}
return C === c1;
>C === c1 : boolean
>C : typeof C
>c1 : typeof C
}
@@ -1,18 +0,0 @@
tests/cases/compiler/classExpressionTest1.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
==== tests/cases/compiler/classExpressionTest1.ts (1 errors) ====
function M() {
class C<X> {
~
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
f<T>() {
var t: T;
var x: X;
return { t, x };
}
}
var v = new C<number>();
return v.f<string>();
}
@@ -0,0 +1,35 @@
=== tests/cases/compiler/classExpressionTest1.ts ===
function M() {
>M : Symbol(M, Decl(classExpressionTest1.ts, 0, 0))
class C<X> {
>C : Symbol(C, Decl(classExpressionTest1.ts, 0, 14))
>X : Symbol(X, Decl(classExpressionTest1.ts, 1, 12))
f<T>() {
>f : Symbol(f, Decl(classExpressionTest1.ts, 1, 16))
>T : Symbol(T, Decl(classExpressionTest1.ts, 2, 10))
var t: T;
>t : Symbol(t, Decl(classExpressionTest1.ts, 3, 15))
>T : Symbol(T, Decl(classExpressionTest1.ts, 2, 10))
var x: X;
>x : Symbol(x, Decl(classExpressionTest1.ts, 4, 15))
>X : Symbol(X, Decl(classExpressionTest1.ts, 1, 12))
return { t, x };
>t : Symbol(t, Decl(classExpressionTest1.ts, 5, 20))
>x : Symbol(x, Decl(classExpressionTest1.ts, 5, 23))
}
}
var v = new C<number>();
>v : Symbol(v, Decl(classExpressionTest1.ts, 9, 7))
>C : Symbol(C, Decl(classExpressionTest1.ts, 0, 14))
return v.f<string>();
>v.f : Symbol(C.f, Decl(classExpressionTest1.ts, 1, 16))
>v : Symbol(v, Decl(classExpressionTest1.ts, 9, 7))
>f : Symbol(C.f, Decl(classExpressionTest1.ts, 1, 16))
}
@@ -0,0 +1,38 @@
=== tests/cases/compiler/classExpressionTest1.ts ===
function M() {
>M : () => { t: string; x: number; }
class C<X> {
>C : C<X>
>X : X
f<T>() {
>f : <T>() => { t: T; x: X; }
>T : T
var t: T;
>t : T
>T : T
var x: X;
>x : X
>X : X
return { t, x };
>{ t, x } : { t: T; x: X; }
>t : T
>x : X
}
}
var v = new C<number>();
>v : C<number>
>new C<number>() : C<number>
>C : typeof C
return v.f<string>();
>v.f<string>() : { t: string; x: number; }
>v.f : <T>() => { t: T; x: number; }
>v : C<number>
>f : <T>() => { t: T; x: number; }
}
@@ -1,9 +0,0 @@
tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
==== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts (1 errors) ====
function foo() {
class C { }
~
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
}
@@ -0,0 +1,7 @@
=== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts ===
function foo() {
>foo : Symbol(foo, Decl(classInsideBlock.ts, 0, 0))
class C { }
>C : Symbol(C, Decl(classInsideBlock.ts, 0, 16))
}
@@ -0,0 +1,7 @@
=== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts ===
function foo() {
>foo : () => void
class C { }
>C : C
}
@@ -5,7 +5,7 @@ function f() {
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1699, 1))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1691, 60))
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
let arguments = 100;
@@ -8,7 +8,7 @@ function f() {
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1699, 1))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1691, 60))
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
const arguments = 100;
@@ -8,7 +8,7 @@ function f() {
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1699, 1))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1691, 60))
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
return () => arguments[0];
@@ -9,7 +9,7 @@ function f() {
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1699, 1))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1691, 60))
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
return () => arguments[0];
@@ -9,7 +9,7 @@ function f() {
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1699, 1))
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1691, 60))
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
return () => arguments;
+1 -1
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of37.ts ===
var map = new Map([["", true]]);
>map : Symbol(map, Decl(for-of37.ts, 0, 3))
>Map : Symbol(Map, Decl(lib.d.ts, 1872, 1), Decl(lib.d.ts, 1894, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1864, 1), Decl(lib.d.ts, 1886, 11))
for (var v of map) {
>v : Symbol(v, Decl(for-of37.ts, 1, 8))
+1 -1
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of38.ts ===
var map = new Map([["", true]]);
>map : Symbol(map, Decl(for-of38.ts, 0, 3))
>Map : Symbol(Map, Decl(lib.d.ts, 1872, 1), Decl(lib.d.ts, 1894, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1864, 1), Decl(lib.d.ts, 1886, 11))
for (var [k, v] of map) {
>k : Symbol(k, Decl(for-of38.ts, 1, 10))
+1 -1
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of40.ts ===
var map = new Map([["", true]]);
>map : Symbol(map, Decl(for-of40.ts, 0, 3))
>Map : Symbol(Map, Decl(lib.d.ts, 1872, 1), Decl(lib.d.ts, 1894, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1864, 1), Decl(lib.d.ts, 1886, 11))
for (var [k = "", v = false] of map) {
>k : Symbol(k, Decl(for-of40.ts, 1, 10))
+1 -1
View File
@@ -5,7 +5,7 @@ var k: string, v: boolean;
var map = new Map([["", true]]);
>map : Symbol(map, Decl(for-of45.ts, 1, 3))
>Map : Symbol(Map, Decl(lib.d.ts, 1872, 1), Decl(lib.d.ts, 1894, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1864, 1), Decl(lib.d.ts, 1886, 11))
for ([k = "", v = false] of map) {
>k : Symbol(k, Decl(for-of45.ts, 0, 3))
+1 -1
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of50.ts ===
var map = new Map([["", true]]);
>map : Symbol(map, Decl(for-of50.ts, 0, 3))
>Map : Symbol(Map, Decl(lib.d.ts, 1872, 1), Decl(lib.d.ts, 1894, 11))
>Map : Symbol(Map, Decl(lib.d.ts, 1864, 1), Decl(lib.d.ts, 1886, 11))
for (const [k, v] of map) {
>k : Symbol(k, Decl(for-of50.ts, 1, 12))
@@ -4,12 +4,11 @@ tests/cases/compiler/functionsWithModifiersInBlocks1.ts(2,25): error TS1184: An
tests/cases/compiler/functionsWithModifiersInBlocks1.ts(3,4): error TS1184: Modifiers cannot appear here.
tests/cases/compiler/functionsWithModifiersInBlocks1.ts(3,20): error TS2393: Duplicate function implementation.
tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,4): error TS1184: Modifiers cannot appear here.
tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,12): error TS1029: 'export' modifier must precede 'declare' modifier.
tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,28): error TS2393: Duplicate function implementation.
tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,32): error TS1184: An implementation cannot be declared in ambient contexts.
==== tests/cases/compiler/functionsWithModifiersInBlocks1.ts (9 errors) ====
==== tests/cases/compiler/functionsWithModifiersInBlocks1.ts (8 errors) ====
{
declare function f() { }
~~~~~~~
@@ -26,8 +25,6 @@ tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,32): error TS1184: An
declare export function f() { }
~~~~~~~
!!! error TS1184: Modifiers cannot appear here.
~~~~~~
!!! error TS1029: 'export' modifier must precede 'declare' modifier.
~
!!! error TS2393: Duplicate function implementation.
~
@@ -1,12 +0,0 @@
tests/cases/compiler/generatorES6_1.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_1.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_1.ts (2 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
yield
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -0,0 +1,6 @@
=== tests/cases/compiler/generatorES6_1.ts ===
function* foo() {
>foo : Symbol(foo, Decl(generatorES6_1.ts, 0, 0))
yield
}
@@ -0,0 +1,7 @@
=== tests/cases/compiler/generatorES6_1.ts ===
function* foo() {
>foo : () => IterableIterator<any>
yield
>yield : any
}
@@ -1,14 +0,0 @@
tests/cases/compiler/generatorES6_2.ts(2,12): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_2.ts(3,9): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_2.ts (2 errors) ====
class C {
public * foo() {
~
!!! error TS9001: Generators are not currently supported.
yield 1
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/generatorES6_2.ts ===
class C {
>C : Symbol(C, Decl(generatorES6_2.ts, 0, 0))
public * foo() {
>foo : Symbol(foo, Decl(generatorES6_2.ts, 0, 9))
yield 1
}
}
@@ -0,0 +1,12 @@
=== tests/cases/compiler/generatorES6_2.ts ===
class C {
>C : C
public * foo() {
>foo : () => IterableIterator<number>
yield 1
>yield 1 : any
>1 : number
}
}
@@ -1,12 +0,0 @@
tests/cases/compiler/generatorES6_3.ts(1,17): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_3.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_3.ts (2 errors) ====
var v = function*() {
~
!!! error TS9001: Generators are not currently supported.
yield 0
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -0,0 +1,6 @@
=== tests/cases/compiler/generatorES6_3.ts ===
var v = function*() {
>v : Symbol(v, Decl(generatorES6_3.ts, 0, 3))
yield 0
}
@@ -0,0 +1,9 @@
=== tests/cases/compiler/generatorES6_3.ts ===
var v = function*() {
>v : () => IterableIterator<number>
>function*() { yield 0} : () => IterableIterator<number>
yield 0
>yield 0 : any
>0 : number
}
@@ -1,14 +0,0 @@
tests/cases/compiler/generatorES6_4.ts(2,4): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_4.ts(3,8): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_4.ts (2 errors) ====
var v = {
*foo() {
~
!!! error TS9001: Generators are not currently supported.
yield 0
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/generatorES6_4.ts ===
var v = {
>v : Symbol(v, Decl(generatorES6_4.ts, 0, 3))
*foo() {
>foo : Symbol(foo, Decl(generatorES6_4.ts, 0, 9))
yield 0
}
}
@@ -0,0 +1,13 @@
=== tests/cases/compiler/generatorES6_4.ts ===
var v = {
>v : { foo(): IterableIterator<number>; }
>{ *foo() { yield 0 }} : { foo(): IterableIterator<number>; }
*foo() {
>foo : () => IterableIterator<number>
yield 0
>yield 0 : any
>0 : number
}
}
@@ -1,12 +1,15 @@
tests/cases/compiler/generatorES6_5.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_5.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
tests/cases/compiler/generatorES6_5.ts(2,11): error TS2304: Cannot find name 'a'.
tests/cases/compiler/generatorES6_5.ts(2,15): error TS2304: Cannot find name 'b'.
tests/cases/compiler/generatorES6_5.ts(2,19): error TS2304: Cannot find name 'c'.
==== tests/cases/compiler/generatorES6_5.ts (2 errors) ====
==== tests/cases/compiler/generatorES6_5.ts (3 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
yield a ? b : c;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'b'.
~
!!! error TS2304: Cannot find name 'c'.
}
@@ -1,14 +0,0 @@
tests/cases/compiler/generatorES6_6.ts(2,3): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_6.ts(3,13): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_6.ts (2 errors) ====
class C {
*[Symbol.iterator]() {
~
!!! error TS9001: Generators are not currently supported.
let a = yield 1;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
@@ -0,0 +1,13 @@
=== tests/cases/compiler/generatorES6_6.ts ===
class C {
>C : Symbol(C, Decl(generatorES6_6.ts, 0, 0))
*[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31))
let a = yield 1;
>a : Symbol(a, Decl(generatorES6_6.ts, 2, 7))
}
}
@@ -0,0 +1,15 @@
=== tests/cases/compiler/generatorES6_6.ts ===
class C {
>C : C
*[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
let a = yield 1;
>a : any
>yield 1 : any
>1 : number
}
}
@@ -0,0 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/generatorInAmbientContext1.ts(2,5): error TS1220: Generators are not allowed in an ambient context.
==== tests/cases/conformance/es6/yieldExpressions/generatorInAmbientContext1.ts (1 errors) ====
declare class C {
*generator(): any;
~
!!! error TS1220: Generators are not allowed in an ambient context.
}
@@ -0,0 +1,6 @@
//// [generatorInAmbientContext1.ts]
declare class C {
*generator(): any;
}
//// [generatorInAmbientContext1.js]
@@ -0,0 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/generatorInAmbientContext2.ts(2,14): error TS1220: Generators are not allowed in an ambient context.
==== tests/cases/conformance/es6/yieldExpressions/generatorInAmbientContext2.ts (1 errors) ====
declare module M {
function *generator(): any;
~
!!! error TS1220: Generators are not allowed in an ambient context.
}
@@ -0,0 +1,6 @@
//// [generatorInAmbientContext2.ts]
declare module M {
function *generator(): any;
}
//// [generatorInAmbientContext2.js]
@@ -0,0 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/generatorInAmbientContext3.d.ts(2,5): error TS1220: Generators are not allowed in an ambient context.
==== tests/cases/conformance/es6/yieldExpressions/generatorInAmbientContext3.d.ts (1 errors) ====
declare class C {
*generator(): any;
~
!!! error TS1220: Generators are not allowed in an ambient context.
}
@@ -0,0 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/generatorInAmbientContext4.d.ts(2,14): error TS1220: Generators are not allowed in an ambient context.
==== tests/cases/conformance/es6/yieldExpressions/generatorInAmbientContext4.d.ts (1 errors) ====
declare module M {
function *generator(): any;
~
!!! error TS1220: Generators are not allowed in an ambient context.
}
@@ -0,0 +1,15 @@
//// [generatorInAmbientContext5.ts]
class C {
*generator(): any { }
}
//// [generatorInAmbientContext5.js]
class C {
*generator() { }
}
//// [generatorInAmbientContext5.d.ts]
declare class C {
generator(): any;
}

Some files were not shown because too many files have changed in this diff Show More