From f0b7315a2cdcf3571319c58f8f833349e417479e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Nov 2014 18:47:49 -0800 Subject: [PATCH 01/20] Use a separate field on a node to specify parser context flags. --- src/compiler/parser.ts | 53 ++++++++++++++++++++++++------------------ src/compiler/types.ts | 3 +++ 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index efceaeb596732..b88f08dc6ca40 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -897,6 +897,23 @@ module ts { // understand when these values should be changed versus when they should be inherited. var strictModeContext = false; var disallowInContext = false; + var contextFlags: number = 0; + + function updateContextFlags() { + contextFlags = + (strictModeContext ? NodeFlags.ParsedInStrictModeContext : 0) | + (disallowInContext ? NodeFlags.ParsedInDisallowInContext : 0); + } + + function setStrictModeContext(val: boolean) { + strictModeContext = val; + updateContextFlags(); + } + + function setDisallowInContext(val: boolean) { + disallowInContext = val; + updateContextFlags(); + } function allowInAnd(func: () => T): T { if (disallowInContext) { @@ -922,10 +939,6 @@ module ts { return result; } - function setDisallowInContext(val: boolean) { - disallowInContext = val; - } - function getLineStarts(): number[] { return lineStarts || (lineStarts = computeLineStarts(sourceText)); } @@ -1108,12 +1121,8 @@ module ts { function finishNode(node: T): T { node.end = scanner.getStartPos(); - if (strictModeContext) { - node.flags |= NodeFlags.ParsedInStrictModeContext; - } - - if (disallowInContext) { - node.flags |= NodeFlags.ParsedInDisallowInContext + if (contextFlags) { + node.parserContextFlags = contextFlags; } return node; @@ -1310,7 +1319,7 @@ module ts { if (!strictModeContext && checkForStrictMode) { if (isPrologueDirective(element)) { if (isUseStrictPrologueDirective(element)) { - strictModeContext = true; + setStrictModeContext(true); checkForStrictMode = false; } } @@ -1327,7 +1336,7 @@ module ts { nextToken(); } } - strictModeContext = savedStrictModeContext; + setStrictModeContext(savedStrictModeContext); result.end = getNodeEnd(); parsingContext = saveParsingContext; return result; @@ -3750,7 +3759,7 @@ module ts { } function checkBinaryExpression(node: BinaryExpression) { - if (node.flags & NodeFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext) { if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { if (isEvalOrArgumentsIdentifier(node.left)) { // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an @@ -3902,7 +3911,7 @@ module ts { var colonStart = skipTrivia(sourceText, node.variable.end); return grammarErrorAtPos(colonStart, ":".length, Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); } - if (node.flags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.variable)) { + if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.variable)) { // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the // Catch production is eval or arguments return reportInvalidUseInStrictMode(node.variable); @@ -4022,7 +4031,7 @@ module ts { } function checkFunctionName(name: Node) { - if (name && name.flags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(name)) { + if (name && name.parserContextFlags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(name)) { // It is a SyntaxError to use within strict mode code the identifiers eval or arguments as the // Identifier of a FunctionLikeDeclaration or FunctionExpression or as a formal parameter name(13.1) return reportInvalidUseInStrictMode(name); @@ -4143,7 +4152,7 @@ module ts { var GetAccessor = 2; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; - var inStrictMode = (node.flags & NodeFlags.ParsedInStrictModeContext) !== 0; + var inStrictMode = (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext) !== 0; for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; @@ -4207,7 +4216,7 @@ module ts { function checkNumericLiteral(node: LiteralExpression): boolean { if (node.flags & NodeFlags.OctalLiteral) { - if (node.flags & NodeFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext) { return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); } else if (languageVersion >= ScriptTarget.ES5) { @@ -4351,7 +4360,7 @@ module ts { // or if its FunctionBody is strict code(11.1.5). // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) - if (node.flags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.name)) { + if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.name)) { return reportInvalidUseInStrictMode(node.name); } } @@ -4410,13 +4419,13 @@ module ts { // The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. - if (node.flags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.operand)) { + if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.operand)) { return reportInvalidUseInStrictMode(node.operand); } } function checkPrefixOperator(node: UnaryExpression) { - if (node.flags & NodeFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext) { // The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator @@ -4601,7 +4610,7 @@ module ts { if (!inAmbientContext && !node.initializer && isConst(node)) { return grammarErrorOnNode(node, Diagnostics.const_declarations_must_be_initialized); } - if (node.flags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.name)) { + if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.name)) { // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code // and its Identifier is eval or arguments return reportInvalidUseInStrictMode(node.name); @@ -4663,7 +4672,7 @@ module ts { } function checkWithStatement(node: WithStatement): boolean { - if (node.flags & NodeFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext) { // Strict mode code may not include a WithStatement. The occurrence of a WithStatement in such // a context is an return grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ee01e40b66a33..6e4efbc3926d2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -285,6 +285,9 @@ module ts { export interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; + // Specific context the parser was in when this node was created. Normally undefined. + // Only set when the parser was in some interesting context (like async/yield). + parserContextFlags?: NodeFlags; id?: number; // Unique id (used to look up NodeLinks) parent?: Node; // Parent node (initialized by binding) symbol?: Symbol; // Symbol declared by node (initialized by binding) From 14f90b889da619711b14ce5411f6a6e561b9cc9c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Nov 2014 18:51:07 -0800 Subject: [PATCH 02/20] Update fidelity to match names. --- src/services/syntax/parser.ts | 231 +++++++++++++++++----------------- 1 file changed, 115 insertions(+), 116 deletions(-) diff --git a/src/services/syntax/parser.ts b/src/services/syntax/parser.ts index 3a16f23e2b1a8..37e25579bf159 100644 --- a/src/services/syntax/parser.ts +++ b/src/services/syntax/parser.ts @@ -199,6 +199,7 @@ module TypeScript.Parser { var disallowInContext: boolean = false; var yieldContext: boolean = false; var generatorParameterContext: boolean = false; + var contextFlags: number = 0; // Current state of the parser. If we need to rewind we will store and reset these values as // appropriate. @@ -209,8 +210,6 @@ module TypeScript.Parser { // started at. var diagnostics: Diagnostic[] = []; - var parseNodeData: number = 0; - var _skippedTokens: ISyntaxToken[] = undefined; function parseSyntaxTree(_source: IParserSource, isDeclaration: boolean): SyntaxTree { @@ -224,7 +223,7 @@ module TypeScript.Parser { // Now, clear out our state so that our singleton parser doesn't keep things alive. diagnostics = []; - parseNodeData = SyntaxNodeConstants.None; + contextFlags = SyntaxNodeConstants.None; fileName = undefined; source.release(); source = undefined; @@ -634,8 +633,8 @@ module TypeScript.Parser { throw Errors.invalidOperation(); } - function updateParseNodeData() { - parseNodeData = + function updateContextFlags() { + contextFlags = (strictModeContext ? SyntaxNodeConstants.ParsedInStrictModeContext : 0) | (disallowInContext ? SyntaxNodeConstants.ParsedInDisallowInContext : 0) | (yieldContext ? SyntaxNodeConstants.ParsedInYieldContext : 0) | @@ -644,22 +643,22 @@ module TypeScript.Parser { function setStrictModeContext(val: boolean) { strictModeContext = val; - updateParseNodeData(); + updateContextFlags(); } function setDisallowInContext(val: boolean) { disallowInContext = val; - updateParseNodeData(); + updateContextFlags(); } function setYieldContext(val: boolean) { yieldContext = val; - updateParseNodeData(); + updateContextFlags(); } function setGeneratorParameterContext(val: boolean) { generatorParameterContext = val; - updateParseNodeData(); + updateContextFlags(); } function parseSourceUnit(): SourceUnitSyntax { @@ -674,7 +673,7 @@ module TypeScript.Parser { setStrictModeContext(savedIsInStrictMode); - var sourceUnit = new SourceUnitSyntax(parseNodeData, moduleElements, consumeToken(currentToken())); + var sourceUnit = new SourceUnitSyntax(contextFlags, moduleElements, consumeToken(currentToken())); if (Debug.shouldAssert(AssertionLevel.Aggressive)) { Debug.assert(fullWidth(sourceUnit) === source.text.length()); @@ -789,12 +788,12 @@ module TypeScript.Parser { } function parseImportDeclaration(): ImportDeclarationSyntax { - return new ImportDeclarationSyntax(parseNodeData, + return new ImportDeclarationSyntax(contextFlags, parseModifiers(), eatToken(SyntaxKind.ImportKeyword), eatIdentifierToken(), eatToken(SyntaxKind.EqualsToken), parseModuleReference(), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); } function parseExportAssignment(): ExportAssignmentSyntax { - return new ExportAssignmentSyntax(parseNodeData, + return new ExportAssignmentSyntax(contextFlags, eatToken(SyntaxKind.ExportKeyword), eatToken(SyntaxKind.EqualsToken), eatIdentifierToken(), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); } @@ -808,12 +807,12 @@ module TypeScript.Parser { } function parseExternalModuleReference(): ExternalModuleReferenceSyntax { - return new ExternalModuleReferenceSyntax(parseNodeData, + return new ExternalModuleReferenceSyntax(contextFlags, eatToken(SyntaxKind.RequireKeyword), eatToken(SyntaxKind.OpenParenToken), eatToken(SyntaxKind.StringLiteral), eatToken(SyntaxKind.CloseParenToken)); } function parseModuleNameModuleReference(): ModuleNameModuleReferenceSyntax { - return new ModuleNameModuleReferenceSyntax(parseNodeData, parseName(/*allowIdentifierNames:*/ false)); + return new ModuleNameModuleReferenceSyntax(contextFlags, parseName(/*allowIdentifierNames:*/ false)); } function tryParseTypeArgumentList(inExpression: boolean): TypeArgumentListSyntax { @@ -825,7 +824,7 @@ module TypeScript.Parser { if (!inExpression) { // if we're not in an expression, this must be a type argument list. Just parse // it out as such. - return new TypeArgumentListSyntax(parseNodeData, + return new TypeArgumentListSyntax(contextFlags, consumeToken(_currentToken), parseSeparatedSyntaxList(ListParsingState.TypeArgumentList_Types), eatToken(SyntaxKind.GreaterThanToken)); @@ -851,7 +850,7 @@ module TypeScript.Parser { } else { releaseRewindPoint(rewindPoint); - return new TypeArgumentListSyntax(parseNodeData, lessThanToken, typeArguments, greaterThanToken); + return new TypeArgumentListSyntax(contextFlags, lessThanToken, typeArguments, greaterThanToken); } } @@ -944,7 +943,7 @@ module TypeScript.Parser { var dotToken = consumeToken(currentToken()); var identifierName = eatRightSideOfName(allowIdentifierNames); - current = new QualifiedNameSyntax(parseNodeData, current, dotToken, identifierName); + current = new QualifiedNameSyntax(contextFlags, current, dotToken, identifierName); shouldContinue = identifierName.fullWidth() > 0; } @@ -954,7 +953,7 @@ module TypeScript.Parser { function parseEnumDeclaration(): EnumDeclarationSyntax { var openBraceToken: ISyntaxToken; - return new EnumDeclarationSyntax(parseNodeData, + return new EnumDeclarationSyntax(contextFlags, parseModifiers(), eatToken(SyntaxKind.EnumKeyword), eatIdentifierToken(), @@ -1059,7 +1058,7 @@ module TypeScript.Parser { return undefined; } - return new EnumElementSyntax(parseNodeData, parsePropertyName(), tryParseEnumElementEqualsValueClause()); + return new EnumElementSyntax(contextFlags, parsePropertyName(), tryParseEnumElementEqualsValueClause()); } function isModifierKind(kind: SyntaxKind): boolean { @@ -1151,7 +1150,7 @@ module TypeScript.Parser { function parseClassDeclaration(): ClassDeclarationSyntax { var openBraceToken: ISyntaxToken; - return new ClassDeclarationSyntax(parseNodeData, + return new ClassDeclarationSyntax(contextFlags, parseModifiers(), eatToken(SyntaxKind.ClassKeyword), eatIdentifierToken(), @@ -1207,14 +1206,14 @@ module TypeScript.Parser { } function parseGetAccessor(modifiers: ISyntaxToken[], getKeyword: ISyntaxToken): GetAccessorSyntax { - return new GetAccessorSyntax(parseNodeData, + return new GetAccessorSyntax(contextFlags, modifiers, consumeToken(getKeyword), parsePropertyName(), parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameter:*/ false), parseFunctionBody(/*isGenerator:*/ false)); } function parseSetAccessor(modifiers: ISyntaxToken[], setKeyword: ISyntaxToken): SetAccessorSyntax { - return new SetAccessorSyntax(parseNodeData, + return new SetAccessorSyntax(contextFlags, modifiers, consumeToken(setKeyword), parsePropertyName(), parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameterContext:*/ false), parseFunctionBody(/*isGenerator:*/ false)); @@ -1342,7 +1341,7 @@ module TypeScript.Parser { // Note: if we see an arrow after the close paren, then try to parse out a function // block anyways. It's likely the user just though '=> expr' was legal anywhere a // block was legal. - return new ConstructorDeclarationSyntax(parseNodeData, + return new ConstructorDeclarationSyntax(contextFlags, parseModifiers(), eatToken(SyntaxKind.ConstructorKeyword), parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameterContext:*/ false), @@ -1354,7 +1353,7 @@ module TypeScript.Parser { // block anyways. It's likely the user just though '=> expr' was legal anywhere a // block was legal. var isGenerator = asteriskToken !== undefined; - return new MemberFunctionDeclarationSyntax(parseNodeData, + return new MemberFunctionDeclarationSyntax(contextFlags, modifiers, asteriskToken, propertyName, @@ -1363,9 +1362,9 @@ module TypeScript.Parser { } function parseMemberVariableDeclaration(modifiers: ISyntaxToken[], propertyName: IPropertyNameSyntax): MemberVariableDeclarationSyntax { - return new MemberVariableDeclarationSyntax(parseNodeData, + return new MemberVariableDeclarationSyntax(contextFlags, modifiers, - new VariableDeclaratorSyntax(parseNodeData, propertyName, + new VariableDeclaratorSyntax(contextFlags, propertyName, parseOptionalTypeAnnotation(/*allowStringLiteral:*/ false), isEqualsValueClause(/*inParameter*/ false) ? allowInAnd(parseEqualsValueClause) : undefined), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); @@ -1376,7 +1375,7 @@ module TypeScript.Parser { } function parseIndexMemberDeclaration(): IndexMemberDeclarationSyntax { - return new IndexMemberDeclarationSyntax(parseNodeData, + return new IndexMemberDeclarationSyntax(contextFlags, parseModifiers(), parseIndexSignature(), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewLine:*/ false)); } @@ -1394,7 +1393,7 @@ module TypeScript.Parser { // function * BindingIdentifier[?Yield](FormalParameters[Yield, GeneratorParameter]) { GeneratorBody[Yield] } var isGenerator = asteriskToken !== undefined; - return new FunctionDeclarationSyntax(parseNodeData, + return new FunctionDeclarationSyntax(contextFlags, modifiers, functionKeyword, asteriskToken, @@ -1417,7 +1416,7 @@ module TypeScript.Parser { function parseModuleDeclaration(): ModuleDeclarationSyntax { var openBraceToken: ISyntaxToken; - return new ModuleDeclarationSyntax(parseNodeData, + return new ModuleDeclarationSyntax(contextFlags, parseModifiers(), eatToken(SyntaxKind.ModuleKeyword), parseModuleName(), @@ -1427,7 +1426,7 @@ module TypeScript.Parser { } function parseInterfaceDeclaration(): InterfaceDeclarationSyntax { - return new InterfaceDeclarationSyntax(parseNodeData, + return new InterfaceDeclarationSyntax(contextFlags, parseModifiers(), eatToken(SyntaxKind.InterfaceKeyword), eatIdentifierToken(), @@ -1439,14 +1438,14 @@ module TypeScript.Parser { function parseObjectType(): ObjectTypeSyntax { var openBraceToken: ISyntaxToken; - return new ObjectTypeSyntax(parseNodeData, + return new ObjectTypeSyntax(contextFlags, openBraceToken = eatToken(SyntaxKind.OpenBraceToken), openBraceToken.fullWidth() > 0 ? parseSeparatedSyntaxList(ListParsingState.ObjectType_TypeMembers) : [], eatToken(SyntaxKind.CloseBraceToken)); } function parseTupleType(currentToken: ISyntaxToken): TupleTypeSyntax { - return new TupleTypeSyntax(parseNodeData, + return new TupleTypeSyntax(contextFlags, consumeToken(currentToken), parseSeparatedSyntaxList(ListParsingState.TupleType_Types), eatToken(SyntaxKind.CloseBracketToken)); @@ -1529,13 +1528,13 @@ module TypeScript.Parser { function parseConstructSignature(): ConstructSignatureSyntax { // Construct signatures have no [Yield] or [GeneratorParameter] restrictions. - return new ConstructSignatureSyntax(parseNodeData, + return new ConstructSignatureSyntax(contextFlags, eatToken(SyntaxKind.NewKeyword), parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameterContext:*/ false)); } function parseIndexSignature(): IndexSignatureSyntax { - return new IndexSignatureSyntax(parseNodeData, + return new IndexSignatureSyntax(contextFlags, eatToken(SyntaxKind.OpenBracketToken), parseSeparatedSyntaxList(ListParsingState.IndexSignature_Parameters), eatToken(SyntaxKind.CloseBracketToken), parseOptionalTypeAnnotation(/*allowStringLiteral:*/ false)); @@ -1544,14 +1543,14 @@ module TypeScript.Parser { function parseMethodSignature(propertyName: IPropertyNameSyntax, questionToken: ISyntaxToken): MethodSignatureSyntax { // Method signatues don't exist in expression contexts. So they have neither // [Yield] nor [GeneratorParameter] - return new MethodSignatureSyntax(parseNodeData, + return new MethodSignatureSyntax(contextFlags, propertyName, questionToken, parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameterContext:*/ false)); } function parsePropertySignature(propertyName: IPropertyNameSyntax, questionToken: ISyntaxToken): PropertySignatureSyntax { - return new PropertySignatureSyntax(parseNodeData, + return new PropertySignatureSyntax(contextFlags, propertyName, questionToken, parseOptionalTypeAnnotation(/*allowStringLiteral:*/ false)); } @@ -1632,7 +1631,7 @@ module TypeScript.Parser { return undefined; } - return new HeritageClauseSyntax(parseNodeData, + return new HeritageClauseSyntax(contextFlags, consumeToken(extendsOrImplementsKeyword), parseSeparatedSyntaxList(ListParsingState.HeritageClause_TypeNameList)); } @@ -1813,7 +1812,7 @@ module TypeScript.Parser { } function parseDebuggerStatement(debuggerKeyword: ISyntaxToken): DebuggerStatementSyntax { - return new DebuggerStatementSyntax(parseNodeData, consumeToken(debuggerKeyword), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); + return new DebuggerStatementSyntax(contextFlags, consumeToken(debuggerKeyword), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); } function parseDoStatement(doKeyword: ISyntaxToken): DoStatementSyntax { @@ -1824,7 +1823,7 @@ module TypeScript.Parser { // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby // do;while(0)x will have a semicolon inserted before x. - return new DoStatementSyntax(parseNodeData, + return new DoStatementSyntax(contextFlags, consumeToken(doKeyword), parseStatement(/*inErrorRecovery:*/ false), eatToken(SyntaxKind.WhileKeyword), eatToken(SyntaxKind.OpenParenToken), allowInAnd(parseExpression), eatToken(SyntaxKind.CloseParenToken), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ true)); } @@ -1834,7 +1833,7 @@ module TypeScript.Parser { } function parseLabeledStatement(identifierToken: ISyntaxToken): LabeledStatementSyntax { - return new LabeledStatementSyntax(parseNodeData, + return new LabeledStatementSyntax(contextFlags, consumeToken(identifierToken), eatToken(SyntaxKind.ColonToken), parseStatement(/*inErrorRecovery:*/ false)); } @@ -1858,7 +1857,7 @@ module TypeScript.Parser { finallyClause = parseFinallyClause(); } - return new TryStatementSyntax(parseNodeData, tryKeyword, block, catchClause, finallyClause); + return new TryStatementSyntax(contextFlags, tryKeyword, block, catchClause, finallyClause); } function parseCatchClauseBlock(): BlockSyntax { @@ -1871,13 +1870,13 @@ module TypeScript.Parser { } function parseCatchClause(): CatchClauseSyntax { - return new CatchClauseSyntax(parseNodeData, + return new CatchClauseSyntax(contextFlags, eatToken(SyntaxKind.CatchKeyword), eatToken(SyntaxKind.OpenParenToken), eatIdentifierToken(), parseOptionalTypeAnnotation(/*allowStringLiteral:*/ false), eatToken(SyntaxKind.CloseParenToken), parseCatchClauseBlock()); } function parseFinallyClause(): FinallyClauseSyntax { - return new FinallyClauseSyntax(parseNodeData, + return new FinallyClauseSyntax(contextFlags, eatToken(SyntaxKind.FinallyKeyword), parseStatementBlock()); } @@ -1886,7 +1885,7 @@ module TypeScript.Parser { // WithStatement[Yield, Return] : // with (Expression[In, ?Yield]) Statement[?Yield, ?Return] - return new WithStatementSyntax(parseNodeData, + return new WithStatementSyntax(contextFlags, consumeToken(withKeyword), eatToken(SyntaxKind.OpenParenToken), allowInAnd(parseExpression), @@ -1898,7 +1897,7 @@ module TypeScript.Parser { // IterationStatement[Yield, Return] : // while (Expression[In, ?Yield]) Statement[?Yield, ?Return] - return new WhileStatementSyntax(parseNodeData, + return new WhileStatementSyntax(contextFlags, consumeToken(whileKeyword), eatToken(SyntaxKind.OpenParenToken), allowInAnd(parseExpression), @@ -1921,7 +1920,7 @@ module TypeScript.Parser { } function parseEmptyStatement(semicolonToken: ISyntaxToken): EmptyStatementSyntax { - return new EmptyStatementSyntax(parseNodeData, consumeToken(semicolonToken)); + return new EmptyStatementSyntax(contextFlags, consumeToken(semicolonToken)); } function parseForOrForInStatement(forKeyword: ISyntaxToken): IStatementSyntax { @@ -1957,7 +1956,7 @@ module TypeScript.Parser { // for ( var ForBinding[?Yield] in Expression[In, ?Yield] ) Statement[?Yield, ?Return] // for ( ForDeclaration[?Yield] in Expression[In, ?Yield] ) Statement[?Yield, ?Return] - return new ForInStatementSyntax(parseNodeData, + return new ForInStatementSyntax(contextFlags, forKeyword, openParenToken, initializer, eatToken(SyntaxKind.InKeyword), allowInAnd(parseExpression), eatToken(SyntaxKind.CloseParenToken), parseStatement(/*inErrorRecovery:*/ false)); } @@ -1968,7 +1967,7 @@ module TypeScript.Parser { // for (ExpressionNoInopt; Expressionopt ; Expressionopt ) Statement // for (var VariableDeclarationListNoIn; Expressionopt; Expressionopt) Statement - return new ForStatementSyntax(parseNodeData, + return new ForStatementSyntax(contextFlags, forKeyword, openParenToken, initializer, eatToken(SyntaxKind.SemicolonToken), tryParseForStatementCondition(), eatToken(SyntaxKind.SemicolonToken), tryParseForStatementIncrementor(), @@ -2014,12 +2013,12 @@ module TypeScript.Parser { } function parseBreakStatement(breakKeyword: ISyntaxToken): BreakStatementSyntax { - return new BreakStatementSyntax(parseNodeData, + return new BreakStatementSyntax(contextFlags, consumeToken(breakKeyword), tryEatBreakOrContinueLabel(), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); } function parseContinueStatement(continueKeyword: ISyntaxToken): ContinueStatementSyntax { - return new ContinueStatementSyntax(parseNodeData, + return new ContinueStatementSyntax(contextFlags, consumeToken(continueKeyword), tryEatBreakOrContinueLabel(), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); } @@ -2037,7 +2036,7 @@ module TypeScript.Parser { var openParenToken: ISyntaxToken; var openBraceToken: ISyntaxToken; - return new SwitchStatementSyntax(parseNodeData, + return new SwitchStatementSyntax(contextFlags, consumeToken(switchKeyword), openParenToken = eatToken(SyntaxKind.OpenParenToken), parseSwitchExpression(openParenToken), @@ -2082,7 +2081,7 @@ module TypeScript.Parser { // CaseClause[Yield, Return] : // case Expression[In, ?Yield] : StatementList[?Yield, ?Return]opt - return new CaseSwitchClauseSyntax(parseNodeData, + return new CaseSwitchClauseSyntax(contextFlags, consumeToken(caseKeyword), allowInAnd(parseExpression), eatToken(SyntaxKind.ColonToken), @@ -2092,14 +2091,14 @@ module TypeScript.Parser { function parseDefaultSwitchClause(defaultKeyword: ISyntaxToken): DefaultSwitchClauseSyntax { // Debug.assert(isDefaultSwitchClause()); - return new DefaultSwitchClauseSyntax(parseNodeData, + return new DefaultSwitchClauseSyntax(contextFlags, consumeToken(defaultKeyword), eatToken(SyntaxKind.ColonToken), parseSyntaxList(ListParsingState.SwitchClause_Statements)); } function parseThrowStatement(throwKeyword: ISyntaxToken): ThrowStatementSyntax { - return new ThrowStatementSyntax(parseNodeData, + return new ThrowStatementSyntax(contextFlags, consumeToken(throwKeyword), tryParseThrowStatementExpression(), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); } @@ -2116,7 +2115,7 @@ module TypeScript.Parser { } function parseReturnStatement(returnKeyword: ISyntaxToken): ReturnStatementSyntax { - return new ReturnStatementSyntax(parseNodeData, + return new ReturnStatementSyntax(contextFlags, consumeToken(returnKeyword), tryParseReturnStatementExpression(), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); } @@ -2145,7 +2144,7 @@ module TypeScript.Parser { // Elisionopt AssignmentExpression[In, ?Yield] if (currentToken().kind === SyntaxKind.CommaToken) { - return new OmittedExpressionSyntax(parseNodeData); + return new OmittedExpressionSyntax(contextFlags); } return allowInAnd(tryParseAssignmentExpressionOrHigher); @@ -2227,7 +2226,7 @@ module TypeScript.Parser { // ExpressionStatement[Yield] : // [lookahead not-in {{, function, class, let [ }] Expression[In, ?Yield]; - return new ExpressionStatementSyntax(parseNodeData, + return new ExpressionStatementSyntax(contextFlags, allowInAnd(parseExpression), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); } @@ -2237,7 +2236,7 @@ module TypeScript.Parser { // if (Expression[In, ?Yield]) Statement[?Yield, ?Return] else Statement[?Yield, ?Return] // if (Expression[In, ?Yield]) Statement[?Yield, ?Return] - return new IfStatementSyntax(parseNodeData, + return new IfStatementSyntax(contextFlags, consumeToken(ifKeyword), eatToken(SyntaxKind.OpenParenToken), allowInAnd(parseExpression), @@ -2250,7 +2249,7 @@ module TypeScript.Parser { } function parseElseClause(): ElseClauseSyntax { - return new ElseClauseSyntax(parseNodeData, eatToken(SyntaxKind.ElseKeyword), parseStatement(/*inErrorRecovery:*/ false)); + return new ElseClauseSyntax(contextFlags, eatToken(SyntaxKind.ElseKeyword), parseStatement(/*inErrorRecovery:*/ false)); } function isVariableStatement(modifierCount: number): boolean { @@ -2261,14 +2260,14 @@ module TypeScript.Parser { // VariableStatement[Yield] : // var VariableDeclarationList[In, ?Yield]; - return new VariableStatementSyntax(parseNodeData, + return new VariableStatementSyntax(contextFlags, parseModifiers(), allowInAnd(parseVariableDeclaration), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false)); } function parseVariableDeclaration(): VariableDeclarationSyntax { // Debug.assert(currentToken().kind === SyntaxKind.VarKeyword); - return new VariableDeclarationSyntax(parseNodeData, + return new VariableDeclarationSyntax(contextFlags, eatToken(SyntaxKind.VarKeyword), parseSeparatedSyntaxList(ListParsingState.VariableDeclaration_VariableDeclarators)); } @@ -2328,7 +2327,7 @@ module TypeScript.Parser { } } - return new VariableDeclaratorSyntax(parseNodeData, propertyName, typeAnnotation, equalsValueClause); + return new VariableDeclaratorSyntax(contextFlags, propertyName, typeAnnotation, equalsValueClause); } function isEqualsValueClause(inParameter: boolean): boolean { @@ -2372,7 +2371,7 @@ module TypeScript.Parser { // Initializer[In, Yield] : // = AssignmentExpression[?In, ?Yield] - return new EqualsValueClauseSyntax(parseNodeData, + return new EqualsValueClauseSyntax(contextFlags, eatToken(SyntaxKind.EqualsToken), parseAssignmentExpressionOrHigher()); } @@ -2389,7 +2388,7 @@ module TypeScript.Parser { break; } - leftOperand = new BinaryExpressionSyntax(parseNodeData, + leftOperand = new BinaryExpressionSyntax(contextFlags, leftOperand, consumeToken(_currentToken), parseAssignmentExpressionOrHigher()); @@ -2458,7 +2457,7 @@ module TypeScript.Parser { // Check for recursive assignment expressions. if (SyntaxFacts.isAssignmentOperatorToken(operatorToken.kind)) { - return new BinaryExpressionSyntax(parseNodeData, + return new BinaryExpressionSyntax(contextFlags, leftOperand, consumeToken(operatorToken), parseAssignmentExpressionOrHigher()); @@ -2518,12 +2517,12 @@ module TypeScript.Parser { if (!isOnDifferentLineThanPreviousToken(_currentToken) && (_currentToken.kind === SyntaxKind.AsteriskToken || isExpression(_currentToken))) { - return new YieldExpressionSyntax(parseNodeData, yieldKeyword, tryEatToken(SyntaxKind.AsteriskToken), parseAssignmentExpressionOrHigher()); + return new YieldExpressionSyntax(contextFlags, yieldKeyword, tryEatToken(SyntaxKind.AsteriskToken), parseAssignmentExpressionOrHigher()); } else { // if the next token is not on the same line as yield. or we don't have an '*' or // the start of an expressin, then this is just a simple "yield" expression. - return new YieldExpressionSyntax(parseNodeData, yieldKeyword, /*asterixToken:*/ undefined, /*expression;*/ undefined); + return new YieldExpressionSyntax(contextFlags, yieldKeyword, /*asterixToken:*/ undefined, /*expression;*/ undefined); } } @@ -2543,7 +2542,7 @@ module TypeScript.Parser { case SyntaxKind.ExclamationToken: case SyntaxKind.PlusPlusToken: case SyntaxKind.MinusMinusToken: - return new PrefixUnaryExpressionSyntax(parseNodeData, consumeToken(_currentToken), tryParseUnaryExpressionOrHigher(currentToken(), /*force:*/ true)); + return new PrefixUnaryExpressionSyntax(contextFlags, consumeToken(_currentToken), tryParseUnaryExpressionOrHigher(currentToken(), /*force:*/ true)); case SyntaxKind.TypeOfKeyword: return parseTypeOfExpression(_currentToken); case SyntaxKind.VoidKeyword: return parseVoidExpression(_currentToken); case SyntaxKind.DeleteKeyword: return parseDeleteExpression(_currentToken); @@ -2583,7 +2582,7 @@ module TypeScript.Parser { // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - return new ConditionalExpressionSyntax(parseNodeData, + return new ConditionalExpressionSyntax(contextFlags, leftOperand, consumeToken(_currentToken), allowInAnd(parseAssignmentExpressionOrHigher), @@ -2627,7 +2626,7 @@ module TypeScript.Parser { // Precedence is okay, so we'll "take" this operator. // Now skip the operator token we're on. - leftOperand = new BinaryExpressionSyntax(parseNodeData, leftOperand, consumeToken(operatorToken), + leftOperand = new BinaryExpressionSyntax(contextFlags, leftOperand, consumeToken(operatorToken), tryParseBinaryExpressionOrHigher(currentToken(), /*force:*/ true, newPrecedence)); } @@ -2713,7 +2712,7 @@ module TypeScript.Parser { switch (currentTokenKind) { case SyntaxKind.OpenParenToken: - expression = new InvocationExpressionSyntax(parseNodeData, expression, parseArgumentList(/*typeArgumentList:*/ undefined, _currentToken)); + expression = new InvocationExpressionSyntax(contextFlags, expression, parseArgumentList(/*typeArgumentList:*/ undefined, _currentToken)); continue; case SyntaxKind.LessThanToken: @@ -2726,7 +2725,7 @@ module TypeScript.Parser { break; } - expression = new InvocationExpressionSyntax(parseNodeData, expression, argumentList); + expression = new InvocationExpressionSyntax(contextFlags, expression, argumentList); continue; case SyntaxKind.OpenBracketToken: @@ -2734,12 +2733,12 @@ module TypeScript.Parser { continue; case SyntaxKind.DotToken: - expression = new MemberAccessExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken), eatIdentifierNameToken()); + expression = new MemberAccessExpressionSyntax(contextFlags, expression, consumeToken(_currentToken), eatIdentifierNameToken()); continue; case SyntaxKind.NoSubstitutionTemplateToken: case SyntaxKind.TemplateStartToken: - expression = new TemplateAccessExpressionSyntax(parseNodeData, expression, parseTemplateExpression(_currentToken)); + expression = new TemplateAccessExpressionSyntax(contextFlags, expression, parseTemplateExpression(_currentToken)); continue; } @@ -2758,12 +2757,12 @@ module TypeScript.Parser { continue; case SyntaxKind.DotToken: - expression = new MemberAccessExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken), eatIdentifierNameToken()); + expression = new MemberAccessExpressionSyntax(contextFlags, expression, consumeToken(_currentToken), eatIdentifierNameToken()); continue; case SyntaxKind.NoSubstitutionTemplateToken: case SyntaxKind.TemplateStartToken: - expression = new TemplateAccessExpressionSyntax(parseNodeData, expression, parseTemplateExpression(_currentToken)); + expression = new TemplateAccessExpressionSyntax(contextFlags, expression, parseTemplateExpression(_currentToken)); continue; } @@ -2827,7 +2826,7 @@ module TypeScript.Parser { var currentTokenKind = currentToken().kind; return currentTokenKind === SyntaxKind.OpenParenToken || currentTokenKind === SyntaxKind.DotToken ? expression - : new MemberAccessExpressionSyntax(parseNodeData, expression, eatToken(SyntaxKind.DotToken), eatIdentifierNameToken()); + : new MemberAccessExpressionSyntax(contextFlags, expression, eatToken(SyntaxKind.DotToken), eatIdentifierNameToken()); } function tryParsePostfixExpressionOrHigher(_currentToken: ISyntaxToken, force: boolean): IPostfixExpressionSyntax { @@ -2848,7 +2847,7 @@ module TypeScript.Parser { break; } - return new PostfixUnaryExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken)); + return new PostfixUnaryExpressionSyntax(contextFlags, expression, consumeToken(_currentToken)); } return expression; @@ -2887,7 +2886,7 @@ module TypeScript.Parser { // we'll bail out here and give a poor error message when we try to parse this // as an arithmetic expression. if (isDot) { - return new ArgumentListSyntax(parseNodeData, typeArgumentList, + return new ArgumentListSyntax(contextFlags, typeArgumentList, createMissingToken(SyntaxKind.OpenParenToken, undefined, DiagnosticCode.A_parameter_list_must_follow_a_generic_type_argument_list_expected), [], eatToken(SyntaxKind.CloseParenToken)); @@ -2916,7 +2915,7 @@ module TypeScript.Parser { function parseArgumentList(typeArgumentList: TypeArgumentListSyntax, openParenToken: ISyntaxToken): ArgumentListSyntax { Debug.assert(openParenToken.kind === SyntaxKind.OpenParenToken && openParenToken.fullWidth() > 0); - return new ArgumentListSyntax(parseNodeData, + return new ArgumentListSyntax(contextFlags, typeArgumentList, consumeToken(openParenToken), parseSeparatedSyntaxList(ListParsingState.ArgumentList_AssignmentExpressions), @@ -2948,7 +2947,7 @@ module TypeScript.Parser { function parseElementAccessExpression(expression: ILeftHandSideExpressionSyntax, openBracketToken: ISyntaxToken): ElementAccessExpressionSyntax { // Debug.assert(currentToken().kind === SyntaxKind.OpenBracketToken); - return new ElementAccessExpressionSyntax(parseNodeData, expression, consumeToken(openBracketToken), + return new ElementAccessExpressionSyntax(contextFlags, expression, consumeToken(openBracketToken), parseElementAccessArgumentExpression(openBracketToken), eatToken(SyntaxKind.CloseBracketToken)); } @@ -3016,15 +3015,15 @@ module TypeScript.Parser { } function parseTypeOfExpression(typeOfKeyword: ISyntaxToken): TypeOfExpressionSyntax { - return new TypeOfExpressionSyntax(parseNodeData, consumeToken(typeOfKeyword), tryParseUnaryExpressionOrHigher(currentToken(), /*force:*/ true)); + return new TypeOfExpressionSyntax(contextFlags, consumeToken(typeOfKeyword), tryParseUnaryExpressionOrHigher(currentToken(), /*force:*/ true)); } function parseDeleteExpression(deleteKeyword: ISyntaxToken): DeleteExpressionSyntax { - return new DeleteExpressionSyntax(parseNodeData, consumeToken(deleteKeyword), tryParseUnaryExpressionOrHigher(currentToken(), /*force:*/ true)); + return new DeleteExpressionSyntax(contextFlags, consumeToken(deleteKeyword), tryParseUnaryExpressionOrHigher(currentToken(), /*force:*/ true)); } function parseVoidExpression(voidKeyword: ISyntaxToken): VoidExpressionSyntax { - return new VoidExpressionSyntax(parseNodeData, consumeToken(voidKeyword), tryParseUnaryExpressionOrHigher(currentToken(), /*force:*/ true)); + return new VoidExpressionSyntax(contextFlags, consumeToken(voidKeyword), tryParseUnaryExpressionOrHigher(currentToken(), /*force:*/ true)); } function parseFunctionExpression(functionKeyword: ISyntaxToken): FunctionExpressionSyntax { @@ -3036,7 +3035,7 @@ module TypeScript.Parser { // function * BindingIdentifier[Yield]opt (FormalParameters[Yield, GeneratorParameter]) { GeneratorBody[Yield] } var isGenerator = asteriskToken !== undefined; - return new FunctionExpressionSyntax(parseNodeData, + return new FunctionExpressionSyntax(contextFlags, functionKeyword, asteriskToken, enterYieldContextAnd(eatOptionalIdentifierToken), @@ -3054,7 +3053,7 @@ module TypeScript.Parser { // See comment in tryParseMemberExpressionOrHigher for a more complete explanation of // this decision. - return new ObjectCreationExpressionSyntax(parseNodeData, + return new ObjectCreationExpressionSyntax(contextFlags, consumeToken(newKeyword), tryParseMemberExpressionOrHigher(currentToken(), /*force:*/ true), tryParseArgumentList()); } @@ -3074,7 +3073,7 @@ module TypeScript.Parser { } while (templateClauses[templateClauses.length - 1].templateMiddleOrEndToken.kind === SyntaxKind.TemplateMiddleToken); - return new TemplateExpressionSyntax(parseNodeData, startToken, Syntax.list(templateClauses)); + return new TemplateExpressionSyntax(contextFlags, startToken, Syntax.list(templateClauses)); } function parseTemplateClause(): TemplateClauseSyntax { @@ -3095,18 +3094,18 @@ module TypeScript.Parser { token = createMissingToken(SyntaxKind.TemplateEndToken, undefined, DiagnosticCode._0_expected, ["{"]); } - return new TemplateClauseSyntax(parseNodeData, expression, token); + return new TemplateClauseSyntax(contextFlags, expression, token); } function parseCastExpression(lessThanToken: ISyntaxToken): CastExpressionSyntax { - return new CastExpressionSyntax(parseNodeData, + return new CastExpressionSyntax(contextFlags, consumeToken(lessThanToken), parseType(), eatToken(SyntaxKind.GreaterThanToken), tryParseUnaryExpressionOrHigher(currentToken(), /*force:*/ true)); } function parseParenthesizedExpression(openParenToken: ISyntaxToken): ParenthesizedExpressionSyntax { // ( Expression[In, ?Yield] ) - return new ParenthesizedExpressionSyntax(parseNodeData, + return new ParenthesizedExpressionSyntax(contextFlags, consumeToken(openParenToken), allowInAnd(parseExpression), eatToken(SyntaxKind.CloseParenToken)); @@ -3171,7 +3170,7 @@ module TypeScript.Parser { return undefined; } - return new ParenthesizedArrowFunctionExpressionSyntax(parseNodeData, + return new ParenthesizedArrowFunctionExpressionSyntax(contextFlags, callSignature, eatToken(SyntaxKind.EqualsGreaterThanToken), parseArrowFunctionBody()); @@ -3202,7 +3201,7 @@ module TypeScript.Parser { // We've seen a statement (and it isn't an expressionStatement like 'foo()'), so // treat this like a block with a missing open brace. - return new BlockSyntax(parseNodeData, + return new BlockSyntax(contextFlags, /*equalsGreaterThanToken*/ undefined, eatToken(SyntaxKind.OpenBraceToken), parseFunctionBlockStatements(), @@ -3226,7 +3225,7 @@ module TypeScript.Parser { function parseSimpleArrowFunctionExpression(): SimpleArrowFunctionExpressionSyntax { // Debug.assert(isSimpleArrowFunctionExpression()); - return new SimpleArrowFunctionExpressionSyntax(parseNodeData, + return new SimpleArrowFunctionExpressionSyntax(contextFlags, eatSimpleParameter(), eatToken(SyntaxKind.EqualsGreaterThanToken), parseArrowFunctionBody()); @@ -3403,7 +3402,7 @@ module TypeScript.Parser { function parseObjectLiteralExpression(openBraceToken: ISyntaxToken): ObjectLiteralExpressionSyntax { // Debug.assert(currentToken().kind === SyntaxKind.OpenBraceToken); - return new ObjectLiteralExpressionSyntax(parseNodeData, + return new ObjectLiteralExpressionSyntax(contextFlags, consumeToken(openBraceToken), parseSeparatedSyntaxList(ListParsingState.ObjectLiteralExpression_PropertyAssignments), eatToken(SyntaxKind.CloseBraceToken)); @@ -3463,7 +3462,7 @@ module TypeScript.Parser { // // Also, if we have an identifier and it is followed by a colon then this is // definitely a simple property assignment. - return new SimplePropertyAssignmentSyntax(parseNodeData, + return new SimplePropertyAssignmentSyntax(contextFlags, propertyName, eatToken(SyntaxKind.ColonToken), allowInAnd(parseAssignmentExpressionOrHigher)); @@ -3548,7 +3547,7 @@ module TypeScript.Parser { // ComputedPropertyName[Yield] : // [AssignmentExpression[In, ?Yield]] - return new ComputedPropertyNameSyntax(parseNodeData, + return new ComputedPropertyNameSyntax(contextFlags, eatToken(SyntaxKind.OpenBracketToken), allowInAnd(parseAssignmentExpressionOrHigher), eatToken(SyntaxKind.CloseBracketToken)); @@ -3556,7 +3555,7 @@ module TypeScript.Parser { function parseFunctionPropertyAssignment(asteriskToken: ISyntaxToken, propertyName: IPropertyNameSyntax): FunctionPropertyAssignmentSyntax { var isGenerator = asteriskToken !== undefined; - return new FunctionPropertyAssignmentSyntax(parseNodeData, + return new FunctionPropertyAssignmentSyntax(contextFlags, asteriskToken, propertyName, parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yield:*/ isGenerator, /*generatorParameter:*/ isGenerator), @@ -3565,7 +3564,7 @@ module TypeScript.Parser { function parseArrayLiteralExpression(openBracketToken: ISyntaxToken): ArrayLiteralExpressionSyntax { // Debug.assert(currentToken().kind === SyntaxKind.OpenBracketToken); - return new ArrayLiteralExpressionSyntax(parseNodeData, + return new ArrayLiteralExpressionSyntax(contextFlags, consumeToken(openBracketToken), parseSeparatedSyntaxList(ListParsingState.ArrayLiteralExpression_AssignmentExpressions), eatToken(SyntaxKind.CloseBracketToken)); @@ -3575,7 +3574,7 @@ module TypeScript.Parser { // Different from function blocks in that we don't check for strict mode, nor do accept // a block without an open curly. var openBraceToken: ISyntaxToken; - return new BlockSyntax(parseNodeData, + return new BlockSyntax(contextFlags, tryEatToken(SyntaxKind.EqualsGreaterThanToken), openBraceToken = eatToken(SyntaxKind.OpenBraceToken), openBraceToken.fullWidth() > 0 ? parseSyntaxList(ListParsingState.Block_Statements) : [], @@ -3591,7 +3590,7 @@ module TypeScript.Parser { // check if they wrote something like: => expr // or if it was more like : => statement if (isExpression(currentToken())) { - return new ExpressionBody(parseNodeData, equalsGreaterThanToken, parseExpression()); + return new ExpressionBody(contextFlags, equalsGreaterThanToken, parseExpression()); } } @@ -3600,7 +3599,7 @@ module TypeScript.Parser { function parseFunctionBlock(_allowYield: boolean, equalsGreaterThanToken: ISyntaxToken): BlockSyntax { var openBraceToken: ISyntaxToken; - return new BlockSyntax(parseNodeData, + return new BlockSyntax(contextFlags, equalsGreaterThanToken, openBraceToken = eatToken(SyntaxKind.OpenBraceToken), equalsGreaterThanToken || openBraceToken.fullWidth() > 0 @@ -3618,7 +3617,7 @@ module TypeScript.Parser { } function parseCallSignature(requireCompleteTypeParameterList: boolean, _yieldContext: boolean, _generatorParameterContext: boolean): CallSignatureSyntax { - return new CallSignatureSyntax(parseNodeData, + return new CallSignatureSyntax(contextFlags, tryParseTypeParameterList(requireCompleteTypeParameterList), parseParameterList(_yieldContext, _generatorParameterContext), parseOptionalTypeAnnotation(/*allowStringLiteral:*/ false)); @@ -3645,7 +3644,7 @@ module TypeScript.Parser { } else { releaseRewindPoint(rewindPoint); - return new TypeParameterListSyntax(parseNodeData, lessThanToken, typeParameters, greaterThanToken); + return new TypeParameterListSyntax(contextFlags, lessThanToken, typeParameters, greaterThanToken); } } @@ -3659,7 +3658,7 @@ module TypeScript.Parser { return undefined; } - return new TypeParameterSyntax(parseNodeData, eatIdentifierToken(), tryParseConstraint()); + return new TypeParameterSyntax(contextFlags, eatIdentifierToken(), tryParseConstraint()); } function tryParseConstraint(): ConstraintSyntax { @@ -3667,7 +3666,7 @@ module TypeScript.Parser { return undefined; } - return new ConstraintSyntax(parseNodeData, eatToken(SyntaxKind.ExtendsKeyword), parseTypeOrExpression()); + return new ConstraintSyntax(contextFlags, eatToken(SyntaxKind.ExtendsKeyword), parseTypeOrExpression()); } function parseParameterList(_yieldContext: boolean, _generatorParameterContext: boolean): ParameterListSyntax { @@ -3693,7 +3692,7 @@ module TypeScript.Parser { setGeneratorParameterContext(_generatorParameterContext); var openParenToken: ISyntaxToken; - var result = new ParameterListSyntax(parseNodeData, + var result = new ParameterListSyntax(contextFlags, openParenToken = eatToken(SyntaxKind.OpenParenToken), openParenToken.fullWidth() > 0 ? parseSeparatedSyntaxList(ListParsingState.ParameterList_Parameters) : [], eatToken(SyntaxKind.CloseParenToken)); @@ -3720,7 +3719,7 @@ module TypeScript.Parser { } function parseTypeAnnotation(allowStringLiteral: boolean): TypeAnnotationSyntax { - return new TypeAnnotationSyntax(parseNodeData, consumeToken(currentToken()), parseTypeAnnotationType(allowStringLiteral)); + return new TypeAnnotationSyntax(contextFlags, consumeToken(currentToken()), parseTypeAnnotationType(allowStringLiteral)); } function isType(): boolean { @@ -3804,7 +3803,7 @@ module TypeScript.Parser { if (type) { var barToken: ISyntaxToken; while ((barToken = currentToken()).kind === SyntaxKind.BarToken) { - type = new UnionTypeSyntax(parseNodeData, type, consumeToken(barToken), parsePrimaryType()); + type = new UnionTypeSyntax(contextFlags, type, consumeToken(barToken), parsePrimaryType()); } } @@ -3832,14 +3831,14 @@ module TypeScript.Parser { break; } - type = new ArrayTypeSyntax(parseNodeData, type, consumeToken(_currentToken), eatToken(SyntaxKind.CloseBracketToken)); + type = new ArrayTypeSyntax(contextFlags, type, consumeToken(_currentToken), eatToken(SyntaxKind.CloseBracketToken)); } return type; } function parseTypeQuery(typeOfKeyword: ISyntaxToken): TypeQuerySyntax { - return new TypeQuerySyntax(parseNodeData, consumeToken(typeOfKeyword), parseName(/*allowIdentifierNames:*/ true)); + return new TypeQuerySyntax(contextFlags, consumeToken(typeOfKeyword), parseName(/*allowIdentifierNames:*/ true)); } function tryParseNonArrayType(): ITypeSyntax { @@ -3867,7 +3866,7 @@ module TypeScript.Parser { } function parseParenthesizedType(openParenToken: ISyntaxToken): ParenthesizedTypeSyntax { - return new ParenthesizedTypeSyntax(parseNodeData, consumeToken(openParenToken), parseType(), eatToken(SyntaxKind.CloseParenToken)); + return new ParenthesizedTypeSyntax(contextFlags, consumeToken(openParenToken), parseType(), eatToken(SyntaxKind.CloseParenToken)); } function tryParseNameOrGenericType(): ITypeSyntax { @@ -3887,7 +3886,7 @@ module TypeScript.Parser { var typeArgumentList = tryParseTypeArgumentList(/*inExpression:*/ false); return !typeArgumentList ? name - : new GenericTypeSyntax(parseNodeData, name, typeArgumentList); + : new GenericTypeSyntax(contextFlags, name, typeArgumentList); } function isFunctionType(): boolean { @@ -3955,7 +3954,7 @@ module TypeScript.Parser { function parseFunctionType(): FunctionTypeSyntax { // Function types only exist in the type space and not the expression space. So they // aren't in the [Yield] or [GeneratorParameter] context. - return new FunctionTypeSyntax(parseNodeData, + return new FunctionTypeSyntax(contextFlags, tryParseTypeParameterList(/*requireCompleteTypeParameterList:*/ false), parseParameterList(/*yield:*/ false, /*generatorParameter:*/ false), eatToken(SyntaxKind.EqualsGreaterThanToken), parseType()); @@ -3964,7 +3963,7 @@ module TypeScript.Parser { function parseConstructorType(): ConstructorTypeSyntax { // Constructor types only exist in the type space and not the expression space. So they // aren't in the [Yield] or [GeneratorParameter] context. - return new ConstructorTypeSyntax(parseNodeData, + return new ConstructorTypeSyntax(contextFlags, eatToken(SyntaxKind.NewKeyword), tryParseTypeParameterList(/*requireCompleteTypeParameterList:*/ false), parseParameterList(/*yield:*/ false, /*generatorParameter:*/ false), @@ -3987,7 +3986,7 @@ module TypeScript.Parser { } function eatSimpleParameter() { - return new ParameterSyntax(parseNodeData, + return new ParameterSyntax(contextFlags, /*dotDotDotToken:*/ undefined, /*modifiers:*/ [], eatIdentifierToken(), /*questionToken:*/ undefined, /*typeAnnotation:*/ undefined, /*equalsValueClause:*/ undefined); } @@ -4036,7 +4035,7 @@ module TypeScript.Parser { : parseEqualsValueClause(); } - return new ParameterSyntax(parseNodeData, dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause); + return new ParameterSyntax(contextFlags, dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause); } function parseSyntaxList(currentListType: ListParsingState, processItems?: (items: any[]) => void): T[] { From 8a615669e5045fb47d27844d409bddeb192378bd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Nov 2014 18:56:53 -0800 Subject: [PATCH 03/20] Extract context flags into their own enum. --- src/compiler/parser.ts | 28 ++++++++++++++++------------ src/compiler/types.ts | 16 ++++++++++------ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b88f08dc6ca40..60ffa5d4b3cfc 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -897,12 +897,16 @@ module ts { // understand when these values should be changed versus when they should be inherited. var strictModeContext = false; var disallowInContext = false; + var yieldContext: boolean = false; + var generatorParameterContext: boolean = false; var contextFlags: number = 0; function updateContextFlags() { contextFlags = - (strictModeContext ? NodeFlags.ParsedInStrictModeContext : 0) | - (disallowInContext ? NodeFlags.ParsedInDisallowInContext : 0); + (strictModeContext ? ParserContextFlags.ParsedInStrictModeContext : 0) | + (disallowInContext ? ParserContextFlags.ParsedInDisallowInContext : 0) | + (yieldContext ? ParserContextFlags.ParsedInYieldContext : 0) | + (generatorParameterContext ? ParserContextFlags.ParsedInGeneratorParameterContext : 0); } function setStrictModeContext(val: boolean) { @@ -3759,7 +3763,7 @@ module ts { } function checkBinaryExpression(node: BinaryExpression) { - if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext) { if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { if (isEvalOrArgumentsIdentifier(node.left)) { // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an @@ -3911,7 +3915,7 @@ module ts { var colonStart = skipTrivia(sourceText, node.variable.end); return grammarErrorAtPos(colonStart, ":".length, Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); } - if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.variable)) { + if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.variable)) { // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the // Catch production is eval or arguments return reportInvalidUseInStrictMode(node.variable); @@ -4031,7 +4035,7 @@ module ts { } function checkFunctionName(name: Node) { - if (name && name.parserContextFlags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(name)) { + if (name && name.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(name)) { // It is a SyntaxError to use within strict mode code the identifiers eval or arguments as the // Identifier of a FunctionLikeDeclaration or FunctionExpression or as a formal parameter name(13.1) return reportInvalidUseInStrictMode(name); @@ -4152,7 +4156,7 @@ module ts { var GetAccessor = 2; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; - var inStrictMode = (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext) !== 0; + var inStrictMode = (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext) !== 0; for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; @@ -4216,7 +4220,7 @@ module ts { function checkNumericLiteral(node: LiteralExpression): boolean { if (node.flags & NodeFlags.OctalLiteral) { - if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext) { return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); } else if (languageVersion >= ScriptTarget.ES5) { @@ -4360,7 +4364,7 @@ module ts { // or if its FunctionBody is strict code(11.1.5). // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) - if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.name)) { + if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.name)) { return reportInvalidUseInStrictMode(node.name); } } @@ -4419,13 +4423,13 @@ module ts { // The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. - if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.operand)) { + if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.operand)) { return reportInvalidUseInStrictMode(node.operand); } } function checkPrefixOperator(node: UnaryExpression) { - if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext) { // The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator @@ -4610,7 +4614,7 @@ module ts { if (!inAmbientContext && !node.initializer && isConst(node)) { return grammarErrorOnNode(node, Diagnostics.const_declarations_must_be_initialized); } - if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.name)) { + if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.name)) { // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code // and its Identifier is eval or arguments return reportInvalidUseInStrictMode(node.name); @@ -4672,7 +4676,7 @@ module ts { } function checkWithStatement(node: WithStatement): boolean { - if (node.parserContextFlags & NodeFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext) { // Strict mode code may not include a WithStatement. The occurrence of a WithStatement in such // a context is an return grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6e4efbc3926d2..8539ac8fc8307 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -270,18 +270,22 @@ module ts { Let = 0x00000800, // Variable declaration Const = 0x00001000, // Variable declaration - // Set if this node was parsed in strict mode. Used for grammar error checks, as well as - // checking if the node can be reused in incremental settings. - ParsedInStrictModeContext = 0x00002000, - ParsedInDisallowInContext = 0x00004000, - - OctalLiteral = 0x00008000, + OctalLiteral = 0x00002000, Modifier = Export | Ambient | Public | Private | Protected | Static, AccessibilityModifier = Public | Private | Protected, BlockScoped = Let | Const } + export const enum ParserContextFlags { + // Set if this node was parsed in strict mode. Used for grammar error checks, as well as + // checking if the node can be reused in incremental settings. + ParsedInStrictModeContext = 0x1, + ParsedInDisallowInContext = 0x2, + ParsedInYieldContext = 0x4, + ParsedInGeneratorParameterContext = 0x8, + } + export interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; From 726de4b40232083433220ee6fed8643453528034 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Nov 2014 21:04:46 -0800 Subject: [PATCH 04/20] Add the context mutation operators. --- src/compiler/parser.ts | 58 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 60ffa5d4b3cfc..a7dff2ea809c1 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -919,6 +919,16 @@ module ts { updateContextFlags(); } + function setYieldContext(val: boolean) { + yieldContext = val; + updateContextFlags(); + } + + function setGeneratorParameterContext(val: boolean) { + generatorParameterContext = val; + updateContextFlags(); + } + function allowInAnd(func: () => T): T { if (disallowInContext) { setDisallowInContext(false); @@ -943,6 +953,54 @@ module ts { return result; } + function enterYieldContextAnd(func: () => T): T { + if (yieldContext) { + // no need to do anything special if we're already in the [Yield] context. + return func(); + } + + setYieldContext(true); + var result = func(); + setYieldContext(false); + return result; + } + + function exitYieldContextAnd(func: () => T): T { + if (yieldContext) { + setYieldContext(false); + var result = func(); + setYieldContext(true); + return result; + } + + // no need to do anything special if we're not in the [Yield] context. + return func(); + } + + function enterGeneratorParameterContextAnd(func: () => T): T { + if (generatorParameterContext) { + // no need to do anything special if we're already in the [GeneratorParameter] context + return func(); + } + + setGeneratorParameterContext(true); + var result = func(); + setGeneratorParameterContext(false); + return result; + } + + function exitGeneratorParameterContextAnd(func: () => T): T { + if (generatorParameterContext) { + setGeneratorParameterContext(false); + var result = func(); + setGeneratorParameterContext(true); + return result; + } + + // no need to do anything special if we're not in the [GeneratorParameter] context + return func(); + } + function getLineStarts(): number[] { return lineStarts || (lineStarts = computeLineStarts(sourceText)); } From 7e1a62a8c298aaed45fef9b840f5ccbbb87f11db Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Nov 2014 22:40:28 -0800 Subject: [PATCH 05/20] Add support for parsing generator functions and yield expressions. --- .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 + src/compiler/parser.ts | 333 ++++++++++++++---- src/compiler/types.ts | 7 +- 4 files changed, 268 insertions(+), 77 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index cac9f75e2eeab..c877c6f9773eb 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -125,6 +125,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." }, 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." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index adf1bf041cf7e..5ee797482a9ea 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -491,6 +491,10 @@ "category": "Error", "code": 1162 }, + "'yield' expression must be contained_within a generator declaration.": { + "category": "Error", + "code": 1163 + }, "Duplicate identifier '{0}'.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index a7dff2ea809c1..88f4a9b4adb44 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -977,30 +977,6 @@ module ts { return func(); } - function enterGeneratorParameterContextAnd(func: () => T): T { - if (generatorParameterContext) { - // no need to do anything special if we're already in the [GeneratorParameter] context - return func(); - } - - setGeneratorParameterContext(true); - var result = func(); - setGeneratorParameterContext(false); - return result; - } - - function exitGeneratorParameterContextAnd(func: () => T): T { - if (generatorParameterContext) { - setGeneratorParameterContext(false); - var result = func(); - setGeneratorParameterContext(true); - return result; - } - - // no need to do anything special if we're not in the [GeneratorParameter] context - return func(); - } - function getLineStarts(): number[] { return lineStarts || (lineStarts = computeLineStarts(sourceText)); } @@ -1126,7 +1102,17 @@ module ts { } function isIdentifier(): boolean { - return token === SyntaxKind.Identifier || (strictModeContext ? token > SyntaxKind.LastFutureReservedWord : token > SyntaxKind.LastReservedWord); + if (token === SyntaxKind.Identifier) { + return true; + } + + // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is + // considered a keyword and is not an identifier. + if (token === SyntaxKind.YieldKeyword && yieldContext) { + return false; + } + + return strictModeContext ? token > SyntaxKind.LastFutureReservedWord : token > SyntaxKind.LastReservedWord; } function parseExpected(t: SyntaxKind): boolean { @@ -1247,7 +1233,7 @@ module ts { function parseAnyContextualModifier(): boolean { return isModifier(token) && tryParse(() => { nextToken(); - return token === SyntaxKind.OpenBracketToken || isPropertyName(); + return token === SyntaxKind.OpenBracketToken || token === SyntaxKind.AsteriskToken || isPropertyName(); }); } @@ -1268,7 +1254,7 @@ module ts { return lookAhead(isClassMemberStart); case ParsingContext.EnumMembers: case ParsingContext.ObjectLiteralMembers: - return isPropertyName(); + return token === SyntaxKind.AsteriskToken || isPropertyName(); case ParsingContext.BaseTypeReferences: return isIdentifier() && ((token !== SyntaxKind.ExtendsKeyword && token !== SyntaxKind.ImplementsKeyword) || !lookAhead(() => (nextToken(), isIdentifier()))); case ParsingContext.VariableDeclarations: @@ -1460,12 +1446,13 @@ module ts { return result; } - function parseBracketedList(kind: ParsingContext, parseElement: () => T, startToken: SyntaxKind, endToken: SyntaxKind): NodeArray { - if (parseExpected(startToken)) { + function parseBracketedList(kind: ParsingContext, parseElement: () => T, open: SyntaxKind, close: SyntaxKind): NodeArray { + if (parseExpected(open)) { var result = parseDelimitedList(kind, parseElement); - parseExpected(endToken); + parseExpected(close); return result; } + return createMissingList(); } @@ -1637,7 +1624,15 @@ module ts { if (parseOptional(SyntaxKind.DotDotDotToken)) { node.flags |= NodeFlags.Rest; } - node.name = parseIdentifier(); + + // SingleNameBinding[Yield,GeneratorParameter] : See 13.2.3 + // [+GeneratorParameter]BindingIdentifier[Yield]Initializer[In]opt + // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt + + node.name = generatorParameterContext + ? enterYieldContextAnd(parseIdentifier) + : parseIdentifier(); + if (node.name.kind === SyntaxKind.Missing && node.flags === 0 && isModifier(token)) { // in cases like // 'use strict' @@ -1654,7 +1649,9 @@ module ts { node.flags |= NodeFlags.QuestionMark; } node.type = parseParameterType(); - node.initializer = parseInitializer(/*inParameter*/ true); + node.initializer = generatorParameterContext + ? exitYieldContextAnd(parseParameterInitializer) + : parseParameterInitializer(); // Do not check for initializers in an ambient context for parameters. This is not // a grammar error because the grammar allows arbitrary call signatures in @@ -1667,18 +1664,28 @@ module ts { return finishNode(node); } - function parseSignature(kind: SyntaxKind, returnToken: SyntaxKind, returnTokenRequired: boolean): ParsedSignature { + function parseParameterInitializer() { + return parseInitializer(/*inParameter*/ true); + } + + function parseSignature(kind: SyntaxKind, returnToken: SyntaxKind, returnTokenRequired: boolean, isGenerator: boolean): ParsedSignature { var signature = {}; - fillSignature(kind, returnToken, returnTokenRequired, signature); + fillSignature(kind, returnToken, returnTokenRequired, isGenerator, signature); return signature; } - function fillSignature(kind: SyntaxKind, returnToken: SyntaxKind, returnTokenRequired: boolean, signature: ParsedSignature): void { + function fillSignature( + kind: SyntaxKind, + returnToken: SyntaxKind, + returnTokenRequired: boolean, + isGenerator: boolean, + signature: ParsedSignature): void { + if (kind === SyntaxKind.ConstructSignature) { parseExpected(SyntaxKind.NewKeyword); } signature.typeParameters = parseTypeParameters(); - signature.parameters = parseParameterList(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken); + signature.parameters = parseParameterList(/*yieldContext:*/ isGenerator, /*generatorParameterContext:*/ isGenerator); if (returnTokenRequired) { parseExpected(returnToken); @@ -1691,13 +1698,43 @@ module ts { // Because we use this for index signatures as well, we sometimes use // parentheses, and sometimes use brackets. - function parseParameterList(startDelimiter: SyntaxKind, endDelimiter: SyntaxKind) { - return parseBracketedList(ParsingContext.Parameters, parseParameter, startDelimiter, endDelimiter); + function parseParameterList(_yieldContext: boolean, _generatorParameterContext: boolean) { + // FormalParameters[Yield,GeneratorParameter] : + // ... + // + // FormalParameter[Yield,GeneratorParameter] : + // BindingElement[?Yield, ?GeneratorParameter] + // + // BindingElement[Yield, GeneratorParameter ] : See 13.2.3 + // SingleNameBinding[?Yield, ?GeneratorParameter] + // [+GeneratorParameter]BindingPattern[?Yield, GeneratorParameter]Initializer[In]opt + // [~GeneratorParameter]BindingPattern[?Yield]Initializer[In, ?Yield]opt + // + // SingleNameBinding[Yield, GeneratorParameter] : See 13.2.3 + // [+GeneratorParameter]BindingIdentifier[Yield]Initializer[In]opt + // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt + if (parseExpected(SyntaxKind.OpenParenToken)) { + var savedYieldContext = yieldContext; + var savedGeneratorParameterContext = generatorParameterContext; + + setYieldContext(_yieldContext); + setGeneratorParameterContext(_generatorParameterContext); + + var result = parseDelimitedList(ParsingContext.Parameters, parseParameter); + parseExpected(SyntaxKind.CloseParenToken); + + setYieldContext(savedYieldContext); + setGeneratorParameterContext(savedGeneratorParameterContext); + + return result; + } + + return createMissingList(); } function parseSignatureMember(kind: SyntaxKind, returnToken: SyntaxKind): SignatureDeclaration { var node = createNode(kind); - fillSignature(kind, returnToken, /* returnTokenRequired */ false, node); + fillSignature(kind, returnToken, /* returnTokenRequired */ false, /*isGenerator:*/ false, node); parseSemicolon(); return finishNode(node); } @@ -1705,7 +1742,7 @@ module ts { function parseIndexSignatureMember(fullStart: number, modifiers: ModifiersArray): SignatureDeclaration { var node = createNode(SyntaxKind.IndexSignature, fullStart); setModifiers(node, modifiers); - node.parameters = parseParameterList(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); + node.parameters = parseBracketedList(ParsingContext.Parameters, parseParameter, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); node.type = parseTypeAnnotation(); parseSemicolon(); return finishNode(node) @@ -1723,7 +1760,11 @@ module ts { var method = createNode(SyntaxKind.Method, fullStart); method.name = name; method.flags = flags; - fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, method); + + // Method signatues don't exist in expression contexts. So they have neither + // [Yield] nor [GeneratorParameter] + fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ false, method); + parseSemicolon(); return finishNode(method); } @@ -1806,7 +1847,7 @@ module ts { function parseFunctionType(typeKind: SyntaxKind): SignatureDeclaration { var node = createNode(typeKind); fillSignature(typeKind === SyntaxKind.FunctionType ? SyntaxKind.CallSignature : SyntaxKind.ConstructSignature, - SyntaxKind.EqualsGreaterThanToken, /* returnTokenRequired */ true, node); + SyntaxKind.EqualsGreaterThanToken, /* returnTokenRequired */ true, /*isGenerator:*/ false, node); return finishNode(node); } @@ -1926,6 +1967,23 @@ module ts { } function parseType(): TypeNode { + // The rules about 'yield' only apply to actual code/expression contexts. They don't + // apply to 'type' contexts. So we disable these parameters here before moving on. + var savedYieldContext = yieldContext; + var savedGeneratorParameterContext = generatorParameterContext; + + setYieldContext(false); + setGeneratorParameterContext(false); + + var result = parseTypeWorker(); + + setYieldContext(savedYieldContext); + setGeneratorParameterContext(savedGeneratorParameterContext); + + return result; + } + + function parseTypeWorker(): TypeNode { if (isStartOfFunctionType()) { return parseFunctionType(SyntaxKind.FunctionType); } @@ -1970,6 +2028,10 @@ module ts { case SyntaxKind.MinusMinusToken: case SyntaxKind.LessThanToken: case SyntaxKind.Identifier: + case SyntaxKind.YieldKeyword: + // Yield always starts an expression. Either it is an identifier (in which case + // it is definitely an expression). Or it's a keyword (either because we're in + // a generator, or in strict mode (or both)) and it started a yield expression. return true; default: return isIdentifier(); @@ -2018,18 +2080,22 @@ module ts { } function parseAssignmentExpression(): Expression { - // Augmented by TypeScript: - // - // AssignmentExpression[in]: - // 1) ConditionalExpression[in] - // 2) LeftHandSideExpression = AssignmentExpression[in] - // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[in] - // 4) ArrowFunctionExpression <-- added by TypeScript + // AssignmentExpression[in,yield]: + // 1) ConditionalExpression[?in,?yield] + // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield] + // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield] + // 4) ArrowFunctionExpression[?in,?yield] + // 5) [+Yield] YieldExpression[?In] // // Note: for ease of implementation we treat productions '2' and '3' as the same thing. // (i.e. they're both BinaryExpressions with an assignment operator in it). - // First, check if we have an arrow function (production '4') that starts with a parenthesized + // First, do the simple check if we have a YieldExpression (production '5'). + if (isYieldExpression()) { + return parseYieldExpression(); + } + + // Then, check if we have an arrow function (production '4') that starts with a parenthesized // parameter list. If we do, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done // with AssignmentExpression if we see one. @@ -2062,6 +2128,66 @@ module ts { return expr; } + function isYieldExpression(): boolean { + if (token === SyntaxKind.YieldKeyword) { + // If we have a 'yield' keyword, and htis is a context where yield expressions are + // allowed, then definitely parse out a yield expression. + if (yieldContext) { + return true; + } + + if (strictModeContext) { + // If we're in strict mode, then 'yield' is a keyword, could only ever start + // a yield expression. + return true; + } + + // We're in a context where 'yield expr' is not allowed. However, if we can + // definitely tell that the user was trying to parse a 'yield expr' and not + // just a normal expr that start with a 'yield' identifier, then parse out + // a 'yield expr'. We can then report an error later that they are only + // allowed in generator expressions. + // + // for example, if we see 'yield(foo)', then we'll have to treat that as an + // invocation expression of something called 'yield'. However, if we have + // 'yield foo' then that is not legal as a normal expression, so we can + // definitely recognize this as a yield expression. + // + // for now we just check if the next token is an identifier. More heuristics + // can be added here later as necessary. We just need to make sure that we + // don't accidently consume something legal. + return lookAhead(() => { + nextToken(); + return !scanner.hasPrecedingLineBreak() && isIdentifier(); + }); + } + + return false; + } + + function parseYieldExpression(): YieldExpression { + var node = createNode(SyntaxKind.YieldExpression); + + // YieldExpression[In] : + // yield + // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] + // yield [no LineTerminator here] * [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] + nextToken(); + + if (!scanner.hasPrecedingLineBreak() && + (token === SyntaxKind.AsteriskToken || isStartOfExpression())) { + parseOptional(SyntaxKind.AsteriskToken); + + node.expression = parseAssignmentExpression(); + return finishNode(node); + } + else { + // if the next token is not on the same line as yield. or we don't have an '*' or + // the start of an expressin, then this is just a simple "yield" expression. + return finishNode(node); + } + } + function parseSimpleArrowFunctionExpression(identifier: Identifier): Expression { Debug.assert(token === SyntaxKind.EqualsGreaterThanToken, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); parseExpected(SyntaxKind.EqualsGreaterThanToken); @@ -2091,7 +2217,8 @@ module ts { var pos = getNodePos(); if (triState === Tristate.True) { - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); + // Arrow function are never generators. + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ false); // 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. @@ -2194,7 +2321,8 @@ module ts { function tryParseSignatureIfArrowOrBraceFollows(): ParsedSignature { return tryParse(() => { - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); + // Arrow functions are never generators. + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ false); // Parsing a signature isn't enough. // Parenthesized arrow signatures often look like other valid expressions. @@ -2216,7 +2344,7 @@ module ts { var body: Node; if (token === SyntaxKind.OpenBraceToken) { - body = parseFunctionBlock(/* ignoreMissingOpenBrace */ false); + body = parseFunctionBlock(/*allowYield:*/ false, /* ignoreMissingOpenBrace */ false); } else if (isStatement(/* inErrorRecovery */ true) && !isStartOfExpressionStatement() && token !== SyntaxKind.FunctionKeyword) { // Check if we got a plain statement (i.e. no expression-statements, no functions expressions/declarations) @@ -2233,7 +2361,7 @@ module ts { // up preemptively closing the containing construct. // // Note: even when 'ignoreMissingOpenBrace' is passed as true, parseBody will still error. - body = parseFunctionBlock(/* ignoreMissingOpenBrace */ true); + body = parseFunctionBlock(/*allowYield:*/ false, /* ignoreMissingOpenBrace */ true); } else { body = parseAssignmentExpression(); @@ -2575,15 +2703,17 @@ module ts { function parsePropertyAssignment(): Declaration { var nodePos = scanner.getStartPos(); + var isGenerator = parseOptional(SyntaxKind.AsteriskToken); var tokenIsIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); var node: Declaration; - if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { + if (isGenerator || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { node = createNode(SyntaxKind.PropertyAssignment, nodePos); node.name = propertyName; - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); - var body = parseFunctionBlock(/* ignoreMissingOpenBrace */ false); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator); + + var body = parseFunctionBlock(isGenerator, /* ignoreMissingOpenBrace */ false); // do not propagate property name as name for function expression // for scenarios like // var x = 1; @@ -2640,14 +2770,25 @@ module ts { } function parseFunctionExpression(): FunctionExpression { + // GeneratorExpression : + // function * BindingIdentifier[Yield]opt (FormalParameters[Yield, GeneratorParameter]) { GeneratorBody[Yield] } + // FunctionExpression: + // function BindingIdentifieropt(FormalParameters) { FunctionBody } + var pos = getNodePos(); parseExpected(SyntaxKind.FunctionKeyword); - var name = isIdentifier() ? parseIdentifier() : undefined; - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); - var body = parseFunctionBlock(/* ignoreMissingOpenBrace */ false); + var isGenerator = parseOptional(SyntaxKind.AsteriskToken); + var name = isGenerator ? enterYieldContextAnd(parseOptionalIdentifier) : parseOptionalIdentifier(); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator); + + var body = parseFunctionBlock(/*allowYield:*/ isGenerator, /* ignoreMissingOpenBrace */ false); return makeFunctionExpression(SyntaxKind.FunctionExpression, pos, name, sig, body); } + function parseOptionalIdentifier() { + return isIdentifier() ? parseIdentifier() : undefined; + } + function makeFunctionExpression(kind: SyntaxKind, pos: number, name: Identifier, sig: ParsedSignature, body: Node): FunctionExpression { var node = createNode(kind, pos); node.name = name; @@ -2682,10 +2823,15 @@ module ts { return finishNode(node); } - function parseFunctionBlock(ignoreMissingOpenBrace: boolean): Block { + function parseFunctionBlock(allowYield: boolean, ignoreMissingOpenBrace: boolean): Block { + var savedYieldContext = yieldContext; + setYieldContext(allowYield); + var block = parseBlock(ignoreMissingOpenBrace, /*checkForStrictMode*/ true); block.kind = SyntaxKind.FunctionBlock; + setYieldContext(savedYieldContext); + return block; } @@ -3050,9 +3196,9 @@ module ts { } } - function parseFunctionBlockOrSemicolon(): Block { + function parseFunctionBlockOrSemicolon(isGenerator: boolean): Block { if (token === SyntaxKind.OpenBraceToken) { - return parseFunctionBlock(/* ignoreMissingOpenBrace */ false); + return parseFunctionBlock(isGenerator, /* ignoreMissingOpenBrace */ false); } if (canParseSemicolon()) { @@ -3111,9 +3257,10 @@ module ts { var node = createNode(SyntaxKind.FunctionDeclaration, fullStart); setModifiers(node, modifiers); parseExpected(SyntaxKind.FunctionKeyword); + var isGenerator = parseOptional(SyntaxKind.AsteriskToken); node.name = parseIdentifier(); - fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, node); - node.body = parseFunctionBlockOrSemicolon(); + fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator, node); + node.body = parseFunctionBlockOrSemicolon(isGenerator); return finishNode(node); } @@ -3121,12 +3268,13 @@ module ts { var node = createNode(SyntaxKind.Constructor, pos); setModifiers(node, modifiers); parseExpected(SyntaxKind.ConstructorKeyword); - fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, node); - node.body = parseFunctionBlockOrSemicolon(); + fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ false, node); + node.body = parseFunctionBlockOrSemicolon(/*isGenerator:*/ false); return finishNode(node); } function parsePropertyMemberDeclaration(fullStart: number, modifiers: ModifiersArray): Declaration { + var isGenerator = parseOptional(SyntaxKind.AsteriskToken); var name = parsePropertyName(); var flags = modifiers ? modifiers.flags : 0; if (parseOptional(SyntaxKind.QuestionToken)) { @@ -3135,15 +3283,15 @@ module ts { flags |= NodeFlags.QuestionMark; } - if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { + if (isGenerator || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { var method = createNode(SyntaxKind.Method, fullStart); setModifiers(method, modifiers); if (flags) { method.flags = flags; } method.name = name; - fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, method); - method.body = parseFunctionBlockOrSemicolon(); + fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator, method); + method.body = parseFunctionBlockOrSemicolon(isGenerator); return finishNode(method); } else { @@ -3164,8 +3312,8 @@ module ts { var node = createNode(kind, fullStart); setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, node); - node.body = parseFunctionBlockOrSemicolon(); + fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ false, node); + node.body = parseFunctionBlockOrSemicolon(/*isGenerator:*/ false); return finishNode(node); } @@ -3178,6 +3326,10 @@ module ts { nextToken(); } + if (token === SyntaxKind.AsteriskToken) { + return true; + } + // Try to get the first property-like token following all modifiers. // This can either be an identifier or the 'get' or 'set' keywords. if (isPropertyName()) { @@ -3254,7 +3406,7 @@ module ts { if (token === SyntaxKind.ConstructorKeyword) { return parseConstructorDeclaration(fullStart, modifiers); } - if (token >= SyntaxKind.Identifier || token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral) { + if (token >= SyntaxKind.Identifier || token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral || token === SyntaxKind.AsteriskToken) { return parsePropertyMemberDeclaration(fullStart, modifiers); } if (token === SyntaxKind.OpenBracketToken) { @@ -3273,12 +3425,26 @@ module ts { node.typeParameters = parseTypeParameters(); // TODO(jfreeman): Parse arbitrary sequence of heritage clauses and error for order and duplicates - node.baseType = parseOptional(SyntaxKind.ExtendsKeyword) ? parseTypeReference() : undefined; + + // ClassTail[Yield,GeneratorParameter] : See 14.5 + // [~GeneratorParameter]ClassHeritage[?Yield]opt { ClassBody[?Yield]opt } + // [+GeneratorParameter] ClassHeritageopt { ClassBodyopt } + + node.baseType = generatorParameterContext + ? exitYieldContextAnd(parseClassBaseType) + : parseClassBaseType(); + if (parseOptional(SyntaxKind.ImplementsKeyword)) { node.implementedTypes = parseDelimitedList(ParsingContext.BaseTypeReferences, parseTypeReference); } if (parseExpected(SyntaxKind.OpenBraceToken)) { - node.members = parseList(ParsingContext.ClassMembers, /*checkForStrictMode*/ false, parseClassMemberDeclaration); + // ClassTail[Yield,GeneratorParameter] : See 14.5 + // [~GeneratorParameter]ClassHeritage[?Yield]opt { ClassBody[?Yield]opt } + // [+GeneratorParameter] ClassHeritageopt { ClassBodyopt } + + node.members = generatorParameterContext + ? exitYieldContextAnd(parseClassMembers) + : parseClassMembers(); parseExpected(SyntaxKind.CloseBraceToken); } else { @@ -3287,6 +3453,14 @@ module ts { return finishNode(node); } + function parseClassMembers() { + return parseList(ParsingContext.ClassMembers, /*checkForStrictMode*/ false, parseClassMemberDeclaration); + } + + function parseClassBaseType(): TypeReferenceNode { + return parseOptional(SyntaxKind.ExtendsKeyword) ? parseTypeReference() : undefined; + } + function parseInterfaceDeclaration(fullStart: number, modifiers: ModifiersArray): InterfaceDeclaration { var node = createNode(SyntaxKind.InterfaceDeclaration, fullStart); setModifiers(node, modifiers); @@ -3725,7 +3899,6 @@ module ts { return checkCallOrNewExpression(node); case SyntaxKind.EnumDeclaration: return checkEnumDeclaration(node); - case SyntaxKind.Parameter: return checkParameter(node); case SyntaxKind.BinaryExpression: return checkBinaryExpression(node); case SyntaxKind.CatchBlock: return checkCatchBlock(node); case SyntaxKind.ClassDeclaration: return checkClassDeclaration(node); @@ -3744,6 +3917,7 @@ module ts { case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(node); case SyntaxKind.ObjectLiteral: return checkObjectLiteral(node); case SyntaxKind.NumericLiteral: return checkNumericLiteral(node); + case SyntaxKind.Parameter: return checkParameter(node); case SyntaxKind.PostfixOperator: return checkPostfixOperator(node); case SyntaxKind.PrefixOperator: return checkPrefixOperator(node); case SyntaxKind.Property: return checkProperty(node); @@ -3760,6 +3934,7 @@ module ts { case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); case SyntaxKind.VariableStatement: return checkVariableStatement(node); case SyntaxKind.WithStatement: return checkWithStatement(node); + case SyntaxKind.YieldExpression: return checkYieldExpression(node); } } @@ -4740,6 +4915,12 @@ module ts { return grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); } } + + function checkYieldExpression(node: YieldExpression): boolean { + if (!(node.parserContextFlags & ParserContextFlags.ParsedInYieldContext)) { + return grammarErrorOnFirstToken(node, Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration); + } + } } export function createProgram(rootNames: string[], options: CompilerOptions, host: CompilerHost): Program { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8539ac8fc8307..68d74385c03bd 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -183,6 +183,7 @@ module ts { ConditionalExpression, TemplateExpression, TemplateSpan, + YieldExpression, OmittedExpression, // Element Block, @@ -291,7 +292,7 @@ module ts { flags: NodeFlags; // Specific context the parser was in when this node was created. Normally undefined. // Only set when the parser was in some interesting context (like async/yield). - parserContextFlags?: NodeFlags; + parserContextFlags?: ParserContextFlags; id?: number; // Unique id (used to look up NodeLinks) parent?: Node; // Parent node (initialized by binding) symbol?: Symbol; // Symbol declared by node (initialized by binding) @@ -438,6 +439,10 @@ module ts { operator: SyntaxKind; operand: Expression; } + + export interface YieldExpression extends Expression { + expression: Expression; + } export interface BinaryExpression extends Expression { left: Expression; From 78cd1b5f7e80788b763411abd5b08cfa363b321b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Nov 2014 22:40:54 -0800 Subject: [PATCH 06/20] Parser tests for generators and yield expressions. --- .../es6/computedPropertyNames/ComputedPropertyName1.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName10.ts | 3 +++ .../es6/computedPropertyNames/ComputedPropertyName11.ts | 3 +++ .../es6/computedPropertyNames/ComputedPropertyName12.ts | 3 +++ .../es6/computedPropertyNames/ComputedPropertyName13.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName14.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName15.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName16.ts | 3 +++ .../es6/computedPropertyNames/ComputedPropertyName17.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName18.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName19.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName2.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName3.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName4.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName5.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName6.ts | 1 + .../es6/computedPropertyNames/ComputedPropertyName7.ts | 3 +++ .../es6/computedPropertyNames/ComputedPropertyName8.ts | 3 +++ .../es6/computedPropertyNames/ComputedPropertyName9.ts | 3 +++ .../MemberFunctionDeclaration1.ts | 3 +++ .../MemberFunctionDeclaration2.ts | 3 +++ .../MemberFunctionDeclaration3.ts | 3 +++ .../MemberFunctionDeclaration4.ts | 3 +++ .../MemberFunctionDeclaration5.ts | 3 +++ .../MemberFunctionDeclaration6.ts | 3 +++ .../MemberFunctionDeclaration7.ts | 3 +++ .../MemberFunctionDeclaration8.ts | 7 +++++++ .../es6/functionDeclarations/FunctionDeclaration1.ts | 2 ++ .../es6/functionDeclarations/FunctionDeclaration10.ts | 2 ++ .../es6/functionDeclarations/FunctionDeclaration11.ts | 2 ++ .../es6/functionDeclarations/FunctionDeclaration12.ts | 1 + .../es6/functionDeclarations/FunctionDeclaration13.ts | 4 ++++ .../es6/functionDeclarations/FunctionDeclaration2.ts | 2 ++ .../es6/functionDeclarations/FunctionDeclaration3.ts | 2 ++ .../es6/functionDeclarations/FunctionDeclaration4.ts | 2 ++ .../es6/functionDeclarations/FunctionDeclaration5.ts | 2 ++ .../es6/functionDeclarations/FunctionDeclaration6.ts | 2 ++ .../es6/functionDeclarations/FunctionDeclaration7.ts | 5 +++++ .../es6/functionDeclarations/FunctionDeclaration8.ts | 1 + .../es6/functionDeclarations/FunctionDeclaration9.ts | 3 +++ .../es6/functionExpressions/FunctionExpression1.ts | 1 + .../es6/functionExpressions/FunctionExpression2.ts | 1 + .../FunctionPropertyAssignments1.ts | 1 + .../FunctionPropertyAssignments2.ts | 1 + .../FunctionPropertyAssignments3.ts | 1 + .../FunctionPropertyAssignments4.ts | 1 + .../FunctionPropertyAssignments5.ts | 1 + .../FunctionPropertyAssignments6.ts | 1 + .../cases/conformance/es6/templates/TemplateExpression1.ts | 1 + .../es6/templates/templateStringInYieldKeyword.ts | 2 +- .../conformance/es6/yieldExpressions/YieldExpression1.ts | 1 + .../conformance/es6/yieldExpressions/YieldExpression10.ts | 4 ++++ .../conformance/es6/yieldExpressions/YieldExpression11.ts | 5 +++++ .../conformance/es6/yieldExpressions/YieldExpression12.ts | 5 +++++ .../conformance/es6/yieldExpressions/YieldExpression13.ts | 1 + .../conformance/es6/yieldExpressions/YieldExpression14.ts | 5 +++++ .../conformance/es6/yieldExpressions/YieldExpression15.ts | 3 +++ .../conformance/es6/yieldExpressions/YieldExpression16.ts | 5 +++++ .../conformance/es6/yieldExpressions/YieldExpression17.ts | 1 + .../conformance/es6/yieldExpressions/YieldExpression18.ts | 2 ++ .../conformance/es6/yieldExpressions/YieldExpression19.ts | 7 +++++++ .../conformance/es6/yieldExpressions/YieldExpression2.ts | 1 + .../conformance/es6/yieldExpressions/YieldExpression3.ts | 4 ++++ .../conformance/es6/yieldExpressions/YieldExpression4.ts | 4 ++++ .../conformance/es6/yieldExpressions/YieldExpression5.ts | 3 +++ .../conformance/es6/yieldExpressions/YieldExpression6.ts | 3 +++ .../conformance/es6/yieldExpressions/YieldExpression7.ts | 3 +++ .../conformance/es6/yieldExpressions/YieldExpression8.ts | 4 ++++ .../conformance/es6/yieldExpressions/YieldExpression9.ts | 3 +++ 69 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8.ts create mode 100644 tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts create mode 100644 tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration1.ts create mode 100644 tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration2.ts create mode 100644 tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts create mode 100644 tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts create mode 100644 tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts create mode 100644 tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts create mode 100644 tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration7.ts create mode 100644 tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts create mode 100644 tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts create mode 100644 tests/cases/conformance/es6/functionExpressions/FunctionExpression1.ts create mode 100644 tests/cases/conformance/es6/functionExpressions/FunctionExpression2.ts create mode 100644 tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1.ts create mode 100644 tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2.ts create mode 100644 tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3.ts create mode 100644 tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4.ts create mode 100644 tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts create mode 100644 tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6.ts create mode 100644 tests/cases/conformance/es6/templates/TemplateExpression1.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression1.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression10.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression11.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression12.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression13.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression14.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression15.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression16.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression17.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression18.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression19.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression2.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression3.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression4.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression5.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression6.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression7.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression8.ts create mode 100644 tests/cases/conformance/es6/yieldExpressions/YieldExpression9.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts new file mode 100644 index 0000000000000..0703648cf0ba6 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts @@ -0,0 +1 @@ +var v = { [e] }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10.ts new file mode 100644 index 0000000000000..64f8b999003ac --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10.ts @@ -0,0 +1,3 @@ +class C { + [e] = 1 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts new file mode 100644 index 0000000000000..cfb1c736b404c --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts @@ -0,0 +1,3 @@ +class C { + [e](); +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts new file mode 100644 index 0000000000000..7e030263fcc03 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts @@ -0,0 +1,3 @@ +class C { + [e]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13.ts new file mode 100644 index 0000000000000..2783955e8043f --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13.ts @@ -0,0 +1 @@ +var v: { [e]: number }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14.ts new file mode 100644 index 0000000000000..534b418854bfa --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14.ts @@ -0,0 +1 @@ +var v: { [e](): number }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15.ts new file mode 100644 index 0000000000000..7b9965e8177d0 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15.ts @@ -0,0 +1 @@ +var v: { [e: number]: string; [e]: number }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts new file mode 100644 index 0000000000000..a088319bf9425 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts @@ -0,0 +1,3 @@ +enum E { + [e] = 1 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts new file mode 100644 index 0000000000000..2d002e9ca43de --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts @@ -0,0 +1 @@ +var v = { set [e](v) { } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18.ts new file mode 100644 index 0000000000000..0659070d643e5 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18.ts @@ -0,0 +1 @@ +var v: { [e]?(): number }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19.ts new file mode 100644 index 0000000000000..b6c1756d097a2 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19.ts @@ -0,0 +1 @@ +var v: { [e]? }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts new file mode 100644 index 0000000000000..34c9d6d918a09 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts @@ -0,0 +1 @@ +var v = { [e]: 1 }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts new file mode 100644 index 0000000000000..08ad781e2ba21 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts @@ -0,0 +1 @@ +var v = { [e]() { } }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts new file mode 100644 index 0000000000000..d5a331ebb4c9c --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts @@ -0,0 +1 @@ +var v = { get [e]() { } }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts new file mode 100644 index 0000000000000..a254f65ee6735 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts @@ -0,0 +1 @@ +var v = { public get [e]() { } }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts new file mode 100644 index 0000000000000..c09627a0d46a7 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts @@ -0,0 +1 @@ +var v = { [e]: 1, [e + e]: 2 }; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7.ts new file mode 100644 index 0000000000000..b23944da7962b --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7.ts @@ -0,0 +1,3 @@ +class C { + [e] +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8.ts new file mode 100644 index 0000000000000..18f1fd61276d5 --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8.ts @@ -0,0 +1,3 @@ +class C { + public [e] +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts new file mode 100644 index 0000000000000..18e290722aadc --- /dev/null +++ b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts @@ -0,0 +1,3 @@ +class C { + [e]: Type +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration1.ts b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration1.ts new file mode 100644 index 0000000000000..3bb832ccf494f --- /dev/null +++ b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration1.ts @@ -0,0 +1,3 @@ +class C { + *foo() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration2.ts b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration2.ts new file mode 100644 index 0000000000000..2174110723d7a --- /dev/null +++ b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration2.ts @@ -0,0 +1,3 @@ +class C { + public * foo() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts new file mode 100644 index 0000000000000..8db736f99bbfd --- /dev/null +++ b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts @@ -0,0 +1,3 @@ +class C { + *[foo]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts new file mode 100644 index 0000000000000..0fa98ce98c4fa --- /dev/null +++ b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts @@ -0,0 +1,3 @@ +class C { + *() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts new file mode 100644 index 0000000000000..474316195f0af --- /dev/null +++ b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts @@ -0,0 +1,3 @@ +class C { + * +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts new file mode 100644 index 0000000000000..1efad0a784293 --- /dev/null +++ b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts @@ -0,0 +1,3 @@ +class C { + *foo +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration7.ts b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration7.ts new file mode 100644 index 0000000000000..93f05494107c9 --- /dev/null +++ b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration7.ts @@ -0,0 +1,3 @@ +class C { + *foo() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts new file mode 100644 index 0000000000000..069d7339869e6 --- /dev/null +++ b/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts @@ -0,0 +1,7 @@ +class C { + foo() { + // Make sure we don't think of *bar as the start of a generator method. + if (a) # * bar; + return bar; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1.ts new file mode 100644 index 0000000000000..650e619fc0099 --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1.ts @@ -0,0 +1,2 @@ +function * foo() { +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10.ts new file mode 100644 index 0000000000000..fa7a20f78ba65 --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10.ts @@ -0,0 +1,2 @@ +function * foo(a = yield => yield) { +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11.ts new file mode 100644 index 0000000000000..07b452678eb78 --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11.ts @@ -0,0 +1,2 @@ +function * yield() { +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts new file mode 100644 index 0000000000000..ff08bd514afdf --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts @@ -0,0 +1 @@ +var v = function * yield() { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13.ts new file mode 100644 index 0000000000000..e5e30dc4b0e22 --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13.ts @@ -0,0 +1,4 @@ +function * foo() { + // Legal to use 'yield' in a type context. + var v: yield; +} diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2.ts new file mode 100644 index 0000000000000..136dd1f9b4352 --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2.ts @@ -0,0 +1,2 @@ +function f(yield) { +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3.ts new file mode 100644 index 0000000000000..33324d8815803 --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3.ts @@ -0,0 +1,2 @@ +function f(yield = yield) { +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4.ts new file mode 100644 index 0000000000000..fd9170a726a4a --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4.ts @@ -0,0 +1,2 @@ +function yield() { +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts new file mode 100644 index 0000000000000..3e97edf26a683 --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts @@ -0,0 +1,2 @@ +function*foo(yield) { +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6.ts new file mode 100644 index 0000000000000..144aae6b63c44 --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6.ts @@ -0,0 +1,2 @@ +function*foo(a = yield) { +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7.ts new file mode 100644 index 0000000000000..3cc50e85592ca --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7.ts @@ -0,0 +1,5 @@ +function*bar() { + // 'yield' here is an identifier, and not a yield expression. + function*foo(a = yield) { + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts new file mode 100644 index 0000000000000..4b65f204babb1 --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts @@ -0,0 +1 @@ +var v = { [yield]: foo } \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts new file mode 100644 index 0000000000000..d30d6535d4b67 --- /dev/null +++ b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts @@ -0,0 +1,3 @@ +function * foo() { + var v = { [yield]: foo } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionExpressions/FunctionExpression1.ts b/tests/cases/conformance/es6/functionExpressions/FunctionExpression1.ts new file mode 100644 index 0000000000000..42ff543edf78c --- /dev/null +++ b/tests/cases/conformance/es6/functionExpressions/FunctionExpression1.ts @@ -0,0 +1 @@ +var v = function * () { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionExpressions/FunctionExpression2.ts b/tests/cases/conformance/es6/functionExpressions/FunctionExpression2.ts new file mode 100644 index 0000000000000..2669a3e386fdf --- /dev/null +++ b/tests/cases/conformance/es6/functionExpressions/FunctionExpression2.ts @@ -0,0 +1 @@ +var v = function * foo() { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1.ts new file mode 100644 index 0000000000000..1d6cb9f92fb2a --- /dev/null +++ b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1.ts @@ -0,0 +1 @@ +var v = { *foo() { } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2.ts new file mode 100644 index 0000000000000..e58c7077a4954 --- /dev/null +++ b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2.ts @@ -0,0 +1 @@ +var v = { *() { } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3.ts new file mode 100644 index 0000000000000..ebcd542a2a0b3 --- /dev/null +++ b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3.ts @@ -0,0 +1 @@ +var v = { *{ } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4.ts new file mode 100644 index 0000000000000..3b23ea4fc9735 --- /dev/null +++ b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4.ts @@ -0,0 +1 @@ +var v = { * } \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts new file mode 100644 index 0000000000000..b1628dd2f2cbd --- /dev/null +++ b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts @@ -0,0 +1 @@ +var v = { *[foo()]() { } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6.ts new file mode 100644 index 0000000000000..6bfae9ec77c82 --- /dev/null +++ b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6.ts @@ -0,0 +1 @@ +var v = { *() { } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/TemplateExpression1.ts b/tests/cases/conformance/es6/templates/TemplateExpression1.ts new file mode 100644 index 0000000000000..e6980c4c8e246 --- /dev/null +++ b/tests/cases/conformance/es6/templates/TemplateExpression1.ts @@ -0,0 +1 @@ +var v = `foo ${ a \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts b/tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts index 4a80e452251b3..d020d7c76075d 100644 --- a/tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts +++ b/tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts @@ -1,4 +1,4 @@ -function* gen { +function* gen() { // Once this is supported, the inner expression does not need to be parenthesized. var x = yield `abc${ x }def`; } diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression1.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression1.ts new file mode 100644 index 0000000000000..bdbfe1e27a72b --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression1.ts @@ -0,0 +1 @@ +yield; \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression10.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression10.ts new file mode 100644 index 0000000000000..b95174babdf97 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression10.ts @@ -0,0 +1,4 @@ +var v = { * foo() { + yield(foo); + } +} diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression11.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression11.ts new file mode 100644 index 0000000000000..7577e5ce46bab --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression11.ts @@ -0,0 +1,5 @@ +class C { + *foo() { + yield(foo); + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression12.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression12.ts new file mode 100644 index 0000000000000..3ee6a46404975 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression12.ts @@ -0,0 +1,5 @@ +class C { + constructor() { + yield foo + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression13.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression13.ts new file mode 100644 index 0000000000000..2ac6f63146540 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression13.ts @@ -0,0 +1 @@ +function* foo() { yield } \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression14.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression14.ts new file mode 100644 index 0000000000000..d545175c94a1a --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression14.ts @@ -0,0 +1,5 @@ +class C { + foo() { + yield foo + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression15.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression15.ts new file mode 100644 index 0000000000000..b2793208aaa6d --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression15.ts @@ -0,0 +1,3 @@ +var v = () => { + yield foo + } \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression16.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression16.ts new file mode 100644 index 0000000000000..1933df26ecfe4 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression16.ts @@ -0,0 +1,5 @@ +function* foo() { + function bar() { + yield foo; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression17.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression17.ts new file mode 100644 index 0000000000000..7ef3a1fe35054 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression17.ts @@ -0,0 +1 @@ +var v = { get foo() { yield foo; } } \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression18.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression18.ts new file mode 100644 index 0000000000000..f91016aabf0e2 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression18.ts @@ -0,0 +1,2 @@ +"use strict"; +yield(foo); \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression19.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression19.ts new file mode 100644 index 0000000000000..0183d72ea61e8 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression19.ts @@ -0,0 +1,7 @@ +function*foo() { + function bar() { + function* quux() { + yield(foo); + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression2.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression2.ts new file mode 100644 index 0000000000000..39bbe4e7eb0be --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression2.ts @@ -0,0 +1 @@ +yield foo; \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression3.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression3.ts new file mode 100644 index 0000000000000..04ae4b8d22375 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression3.ts @@ -0,0 +1,4 @@ +function* foo() { + yield + yield +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression4.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression4.ts new file mode 100644 index 0000000000000..cd2f970804802 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression4.ts @@ -0,0 +1,4 @@ +function* foo() { + yield; + yield; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression5.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression5.ts new file mode 100644 index 0000000000000..af4b3a84d2f2a --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression5.ts @@ -0,0 +1,3 @@ +function* foo() { + yield* +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression6.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression6.ts new file mode 100644 index 0000000000000..87d307dcda047 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression6.ts @@ -0,0 +1,3 @@ +function* foo() { + yield*foo +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression7.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression7.ts new file mode 100644 index 0000000000000..0db38fd498bc2 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression7.ts @@ -0,0 +1,3 @@ +function* foo() { + yield foo +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression8.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression8.ts new file mode 100644 index 0000000000000..b6b0830123926 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression8.ts @@ -0,0 +1,4 @@ +yield(foo); +function* foo() { + yield(foo); +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression9.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression9.ts new file mode 100644 index 0000000000000..9119deae832af --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/YieldExpression9.ts @@ -0,0 +1,3 @@ +var v = function*() { + yield(foo); +} \ No newline at end of file From 2f075a1c06f900321b97130bf7c0f9dab9055c40 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Nov 2014 22:41:55 -0800 Subject: [PATCH 07/20] Fix parsing of function expression names. --- src/services/syntax/parser.ts | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/src/services/syntax/parser.ts b/src/services/syntax/parser.ts index 37e25579bf159..6b03a4721c1bd 100644 --- a/src/services/syntax/parser.ts +++ b/src/services/syntax/parser.ts @@ -1018,30 +1018,6 @@ module TypeScript.Parser { // no need to do anything special if we're not in the [Yield] context. return func(); } - - function enterGeneratorParameterContextAnd(func: () => T): T { - if (generatorParameterContext) { - // no need to do anything special if we're already in the [GeneratorParameter] context - return func(); - } - - setGeneratorParameterContext(true); - var result = func(); - setGeneratorParameterContext(false); - return result; - } - - function exitGeneratorParameterContextAnd(func: () => T): T { - if (generatorParameterContext) { - setGeneratorParameterContext(false); - var result = func(); - setGeneratorParameterContext(true); - return result; - } - - // no need to do anything special if we're not in the [GeneratorParameter] context - return func(); - } function tryParseEnumElementEqualsValueClause(): EqualsValueClauseSyntax { return isEqualsValueClause(/*inParameter*/ false) ? allowInAnd(parseEqualsValueClause) : undefined; @@ -2410,8 +2386,6 @@ module TypeScript.Parser { // precedence than 'comma'. Otherwise we'll get: "var a = (1, (b = 2))", instead of // "var a = (1), b = (2)"); function tryParseAssignmentExpressionOrHigherWorker(force: boolean): IExpressionSyntax { - // Augmented by TypeScript: - // // AssignmentExpression[in,yield]: // 1) ConditionalExpression[?in,?yield] // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield] @@ -3033,12 +3007,14 @@ module TypeScript.Parser { function parseFunctionExpressionWorker(functionKeyword: ISyntaxToken, asteriskToken: ISyntaxToken) { // GeneratorExpression : // function * BindingIdentifier[Yield]opt (FormalParameters[Yield, GeneratorParameter]) { GeneratorBody[Yield] } + // FunctionExpression: + // function BindingIdentifieropt(FormalParameters) { FunctionBody } var isGenerator = asteriskToken !== undefined; return new FunctionExpressionSyntax(contextFlags, functionKeyword, asteriskToken, - enterYieldContextAnd(eatOptionalIdentifierToken), + asteriskToken ? enterYieldContextAnd(eatOptionalIdentifierToken) : eatOptionalIdentifierToken(), parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yield:*/ isGenerator, /*generatorParameter:*/ isGenerator), parseFunctionBody(isGenerator)); } From d11eabc81b6bcc7d242ede5425dfea05d0fc2026 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Nov 2014 22:45:33 -0800 Subject: [PATCH 08/20] Add test baselines. --- .../ComputedPropertyName1.errors.txt | 13 +++++++ .../ComputedPropertyName10.errors.txt | 9 +++++ .../ComputedPropertyName11.errors.txt | 15 ++++++++ .../ComputedPropertyName12.errors.txt | 15 ++++++++ .../ComputedPropertyName13.errors.txt | 7 ++++ .../ComputedPropertyName14.errors.txt | 7 ++++ .../ComputedPropertyName15.errors.txt | 7 ++++ .../ComputedPropertyName16.errors.txt | 18 ++++++++++ .../ComputedPropertyName17.errors.txt | 16 +++++++++ .../ComputedPropertyName18.errors.txt | 7 ++++ .../ComputedPropertyName19.errors.txt | 7 ++++ .../ComputedPropertyName2.errors.txt | 19 +++++++++++ .../ComputedPropertyName3.errors.txt | 16 +++++++++ .../ComputedPropertyName4.errors.txt | 16 +++++++++ .../ComputedPropertyName5.errors.txt | 19 +++++++++++ .../ComputedPropertyName6.errors.txt | 28 +++++++++++++++ .../ComputedPropertyName7.errors.txt | 9 +++++ .../ComputedPropertyName8.errors.txt | 9 +++++ .../ComputedPropertyName9.errors.txt | 12 +++++++ .../reference/FunctionDeclaration1.js | 7 ++++ .../reference/FunctionDeclaration1.types | 4 +++ .../reference/FunctionDeclaration10.js | 8 +++++ .../reference/FunctionDeclaration10.types | 8 +++++ .../reference/FunctionDeclaration11.js | 7 ++++ .../reference/FunctionDeclaration11.types | 4 +++ .../FunctionDeclaration12.errors.txt | 13 +++++++ .../FunctionDeclaration13.errors.txt | 11 ++++++ .../reference/FunctionDeclaration13.js | 12 +++++++ .../reference/FunctionDeclaration2.js | 7 ++++ .../reference/FunctionDeclaration2.types | 5 +++ .../reference/FunctionDeclaration4.types | 4 +++ .../reference/FunctionDeclaration5.errors.txt | 17 ++++++++++ .../reference/FunctionDeclaration8.errors.txt | 16 +++++++++ .../reference/FunctionDeclaration9.errors.txt | 15 ++++++++ .../reference/FunctionExpression1.js | 6 ++++ .../reference/FunctionExpression1.types | 5 +++ .../reference/FunctionExpression2.js | 6 ++++ .../reference/FunctionExpression2.types | 6 ++++ .../reference/FunctionPropertyAssignments1.js | 6 ++++ .../FunctionPropertyAssignments1.types | 7 ++++ .../FunctionPropertyAssignments2.errors.txt | 7 ++++ .../FunctionPropertyAssignments3.errors.txt | 7 ++++ .../FunctionPropertyAssignments4.errors.txt | 7 ++++ .../FunctionPropertyAssignments5.errors.txt | 16 +++++++++ .../FunctionPropertyAssignments6.errors.txt | 7 ++++ .../reference/MemberFunctionDeclaration1.js | 13 +++++++ .../MemberFunctionDeclaration1.types | 7 ++++ .../reference/MemberFunctionDeclaration2.js | 13 +++++++ .../MemberFunctionDeclaration2.types | 7 ++++ .../MemberFunctionDeclaration3.errors.txt | 18 ++++++++++ .../MemberFunctionDeclaration4.errors.txt | 9 +++++ .../MemberFunctionDeclaration5.errors.txt | 9 +++++ .../MemberFunctionDeclaration6.errors.txt | 12 +++++++ .../reference/MemberFunctionDeclaration7.js | 13 +++++++ .../MemberFunctionDeclaration7.types | 8 +++++ .../MemberFunctionDeclaration8.errors.txt | 34 +++++++++++++++++++ .../reference/TemplateExpression1.errors.txt | 10 ++++++ .../reference/YieldExpression1.errors.txt | 7 ++++ tests/baselines/reference/YieldExpression1.js | 5 +++ .../baselines/reference/YieldExpression10.js | 11 ++++++ .../reference/YieldExpression10.types | 11 ++++++ .../baselines/reference/YieldExpression11.js | 16 +++++++++ .../reference/YieldExpression11.types | 10 ++++++ .../reference/YieldExpression12.errors.txt | 11 ++++++ .../baselines/reference/YieldExpression13.js | 7 ++++ .../reference/YieldExpression13.types | 4 +++ .../reference/YieldExpression14.errors.txt | 11 ++++++ .../reference/YieldExpression15.errors.txt | 9 +++++ .../reference/YieldExpression16.errors.txt | 11 ++++++ .../reference/YieldExpression17.errors.txt | 10 ++++++ .../reference/YieldExpression18.errors.txt | 8 +++++ .../baselines/reference/YieldExpression19.js | 17 ++++++++++ .../reference/YieldExpression19.types | 14 ++++++++ .../reference/YieldExpression2.errors.txt | 7 ++++ tests/baselines/reference/YieldExpression3.js | 11 ++++++ .../reference/YieldExpression3.types | 7 ++++ tests/baselines/reference/YieldExpression4.js | 11 ++++++ .../reference/YieldExpression4.types | 7 ++++ .../reference/YieldExpression5.errors.txt | 9 +++++ tests/baselines/reference/YieldExpression6.js | 9 +++++ .../reference/YieldExpression6.types | 6 ++++ tests/baselines/reference/YieldExpression7.js | 9 +++++ .../reference/YieldExpression7.types | 6 ++++ .../reference/YieldExpression8.errors.txt | 10 ++++++ tests/baselines/reference/YieldExpression8.js | 11 ++++++ tests/baselines/reference/YieldExpression9.js | 9 +++++ .../reference/YieldExpression9.types | 7 ++++ .../templateStringInYieldKeyword.errors.txt | 20 ----------- .../reference/templateStringInYieldKeyword.js | 12 +++++++ .../templateStringInYieldKeyword.types | 9 +++++ ...eStringWithEmbeddedYieldKeyword.errors.txt | 26 +++----------- ...ringWithEmbeddedYieldKeywordES6.errors.txt | 29 ---------------- ...mplateStringWithEmbeddedYieldKeywordES6.js | 12 +++++++ ...ateStringWithEmbeddedYieldKeywordES6.types | 9 +++++ 94 files changed, 947 insertions(+), 71 deletions(-) create mode 100644 tests/baselines/reference/ComputedPropertyName1.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName10.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName11.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName12.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName13.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName14.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName15.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName16.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName17.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName18.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName19.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName2.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName3.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName4.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName5.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName6.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName7.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName8.errors.txt create mode 100644 tests/baselines/reference/ComputedPropertyName9.errors.txt create mode 100644 tests/baselines/reference/FunctionDeclaration1.js create mode 100644 tests/baselines/reference/FunctionDeclaration1.types create mode 100644 tests/baselines/reference/FunctionDeclaration10.js create mode 100644 tests/baselines/reference/FunctionDeclaration10.types create mode 100644 tests/baselines/reference/FunctionDeclaration11.js create mode 100644 tests/baselines/reference/FunctionDeclaration11.types create mode 100644 tests/baselines/reference/FunctionDeclaration12.errors.txt create mode 100644 tests/baselines/reference/FunctionDeclaration13.errors.txt create mode 100644 tests/baselines/reference/FunctionDeclaration13.js create mode 100644 tests/baselines/reference/FunctionDeclaration2.js create mode 100644 tests/baselines/reference/FunctionDeclaration2.types create mode 100644 tests/baselines/reference/FunctionDeclaration4.types create mode 100644 tests/baselines/reference/FunctionDeclaration5.errors.txt create mode 100644 tests/baselines/reference/FunctionDeclaration8.errors.txt create mode 100644 tests/baselines/reference/FunctionDeclaration9.errors.txt create mode 100644 tests/baselines/reference/FunctionExpression1.js create mode 100644 tests/baselines/reference/FunctionExpression1.types create mode 100644 tests/baselines/reference/FunctionExpression2.js create mode 100644 tests/baselines/reference/FunctionExpression2.types create mode 100644 tests/baselines/reference/FunctionPropertyAssignments1.js create mode 100644 tests/baselines/reference/FunctionPropertyAssignments1.types create mode 100644 tests/baselines/reference/FunctionPropertyAssignments2.errors.txt create mode 100644 tests/baselines/reference/FunctionPropertyAssignments3.errors.txt create mode 100644 tests/baselines/reference/FunctionPropertyAssignments4.errors.txt create mode 100644 tests/baselines/reference/FunctionPropertyAssignments5.errors.txt create mode 100644 tests/baselines/reference/FunctionPropertyAssignments6.errors.txt create mode 100644 tests/baselines/reference/MemberFunctionDeclaration1.js create mode 100644 tests/baselines/reference/MemberFunctionDeclaration1.types create mode 100644 tests/baselines/reference/MemberFunctionDeclaration2.js create mode 100644 tests/baselines/reference/MemberFunctionDeclaration2.types create mode 100644 tests/baselines/reference/MemberFunctionDeclaration3.errors.txt create mode 100644 tests/baselines/reference/MemberFunctionDeclaration4.errors.txt create mode 100644 tests/baselines/reference/MemberFunctionDeclaration5.errors.txt create mode 100644 tests/baselines/reference/MemberFunctionDeclaration6.errors.txt create mode 100644 tests/baselines/reference/MemberFunctionDeclaration7.js create mode 100644 tests/baselines/reference/MemberFunctionDeclaration7.types create mode 100644 tests/baselines/reference/MemberFunctionDeclaration8.errors.txt create mode 100644 tests/baselines/reference/TemplateExpression1.errors.txt create mode 100644 tests/baselines/reference/YieldExpression1.errors.txt create mode 100644 tests/baselines/reference/YieldExpression1.js create mode 100644 tests/baselines/reference/YieldExpression10.js create mode 100644 tests/baselines/reference/YieldExpression10.types create mode 100644 tests/baselines/reference/YieldExpression11.js create mode 100644 tests/baselines/reference/YieldExpression11.types create mode 100644 tests/baselines/reference/YieldExpression12.errors.txt create mode 100644 tests/baselines/reference/YieldExpression13.js create mode 100644 tests/baselines/reference/YieldExpression13.types create mode 100644 tests/baselines/reference/YieldExpression14.errors.txt create mode 100644 tests/baselines/reference/YieldExpression15.errors.txt create mode 100644 tests/baselines/reference/YieldExpression16.errors.txt create mode 100644 tests/baselines/reference/YieldExpression17.errors.txt create mode 100644 tests/baselines/reference/YieldExpression18.errors.txt create mode 100644 tests/baselines/reference/YieldExpression19.js create mode 100644 tests/baselines/reference/YieldExpression19.types create mode 100644 tests/baselines/reference/YieldExpression2.errors.txt create mode 100644 tests/baselines/reference/YieldExpression3.js create mode 100644 tests/baselines/reference/YieldExpression3.types create mode 100644 tests/baselines/reference/YieldExpression4.js create mode 100644 tests/baselines/reference/YieldExpression4.types create mode 100644 tests/baselines/reference/YieldExpression5.errors.txt create mode 100644 tests/baselines/reference/YieldExpression6.js create mode 100644 tests/baselines/reference/YieldExpression6.types create mode 100644 tests/baselines/reference/YieldExpression7.js create mode 100644 tests/baselines/reference/YieldExpression7.types create mode 100644 tests/baselines/reference/YieldExpression8.errors.txt create mode 100644 tests/baselines/reference/YieldExpression8.js create mode 100644 tests/baselines/reference/YieldExpression9.js create mode 100644 tests/baselines/reference/YieldExpression9.types delete mode 100644 tests/baselines/reference/templateStringInYieldKeyword.errors.txt create mode 100644 tests/baselines/reference/templateStringInYieldKeyword.js create mode 100644 tests/baselines/reference/templateStringInYieldKeyword.types delete mode 100644 tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt create mode 100644 tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.js create mode 100644 tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.types diff --git a/tests/baselines/reference/ComputedPropertyName1.errors.txt b/tests/baselines/reference/ComputedPropertyName1.errors.txt new file mode 100644 index 0000000000000..89423599a44b3 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName1.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts(1,11): error TS1136: Property assignment expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts(1,15): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts(1,12): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts (3 errors) ==== + var v = { [e] }; + ~ +!!! error TS1136: Property assignment expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName10.errors.txt b/tests/baselines/reference/ComputedPropertyName10.errors.txt new file mode 100644 index 0000000000000..c880e57859cc4 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName10.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10.ts(2,8): error TS1005: ';' expected. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10.ts (1 errors) ==== + class C { + [e] = 1 + ~ +!!! error TS1005: ';' expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName11.errors.txt b/tests/baselines/reference/ComputedPropertyName11.errors.txt new file mode 100644 index 0000000000000..3b23c2f8287a1 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName11.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts(2,7): error TS1005: ';' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts(2,8): error TS1109: Expression expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts(3,1): error TS1128: Declaration or statement expected. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts (3 errors) ==== + class C { + [e](); + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1109: Expression expected. + } + ~ +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName12.errors.txt b/tests/baselines/reference/ComputedPropertyName12.errors.txt new file mode 100644 index 0000000000000..575574c2d7e93 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName12.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts(2,7): error TS1005: ';' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts(2,10): error TS1005: '=>' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts(3,1): error TS1128: Declaration or statement expected. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts (3 errors) ==== + class C { + [e]() { } + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1005: '=>' expected. + } + ~ +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName13.errors.txt b/tests/baselines/reference/ComputedPropertyName13.errors.txt new file mode 100644 index 0000000000000..2024b4d7128b5 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName13.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13.ts(1,11): error TS1022: An index signature parameter must have a type annotation. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13.ts (1 errors) ==== + var v: { [e]: number }; + ~ +!!! error TS1022: An index signature parameter must have a type annotation. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName14.errors.txt b/tests/baselines/reference/ComputedPropertyName14.errors.txt new file mode 100644 index 0000000000000..4fe3cf4e12173 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName14.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14.ts(1,13): error TS1005: ';' expected. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14.ts (1 errors) ==== + var v: { [e](): number }; + ~ +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName15.errors.txt b/tests/baselines/reference/ComputedPropertyName15.errors.txt new file mode 100644 index 0000000000000..4ab96e131e9bc --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName15.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15.ts(1,32): error TS1022: An index signature parameter must have a type annotation. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15.ts (1 errors) ==== + var v: { [e: number]: string; [e]: number }; + ~ +!!! error TS1022: An index signature parameter must have a type annotation. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName16.errors.txt b/tests/baselines/reference/ComputedPropertyName16.errors.txt new file mode 100644 index 0000000000000..631449a818e4b --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName16.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts(2,3): error TS1132: Enum member expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts(3,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts(2,3): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts(2,4): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts (4 errors) ==== + enum E { + [e] = 1 + ~ +!!! error TS1132: Enum member expected. + ~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + ~ +!!! error TS2304: Cannot find name 'e'. + } + ~ +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName17.errors.txt b/tests/baselines/reference/ComputedPropertyName17.errors.txt new file mode 100644 index 0000000000000..3a3d5ca80f9df --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName17.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts(1,15): error TS1003: Identifier expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts(1,22): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts(1,26): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts(1,16): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts (4 errors) ==== + var v = { set [e](v) { } } + ~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName18.errors.txt b/tests/baselines/reference/ComputedPropertyName18.errors.txt new file mode 100644 index 0000000000000..1df180bc9c1ce --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName18.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18.ts(1,13): error TS1005: ';' expected. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18.ts (1 errors) ==== + var v: { [e]?(): number }; + ~ +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName19.errors.txt b/tests/baselines/reference/ComputedPropertyName19.errors.txt new file mode 100644 index 0000000000000..7e063befdc895 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName19.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19.ts(1,13): error TS1005: ';' expected. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19.ts (1 errors) ==== + var v: { [e]? }; + ~ +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName2.errors.txt b/tests/baselines/reference/ComputedPropertyName2.errors.txt new file mode 100644 index 0000000000000..fd2bf09a09441 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName2.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts(1,11): error TS1136: Property assignment expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts(1,14): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts(1,16): error TS1134: Variable declaration expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts(1,18): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts (5 errors) ==== + var v = { [e]: 1 }; + ~ +!!! error TS1136: Property assignment expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName3.errors.txt b/tests/baselines/reference/ComputedPropertyName3.errors.txt new file mode 100644 index 0000000000000..4aaaa46ca688c --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName3.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts(1,11): error TS1136: Property assignment expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts(1,17): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts(1,21): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts (4 errors) ==== + var v = { [e]() { } }; + ~ +!!! error TS1136: Property assignment expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName4.errors.txt b/tests/baselines/reference/ComputedPropertyName4.errors.txt new file mode 100644 index 0000000000000..d03de72fb54d5 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName4.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts(1,15): error TS1003: Identifier expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts(1,21): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts(1,25): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts (4 errors) ==== + var v = { get [e]() { } }; + ~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName5.errors.txt b/tests/baselines/reference/ComputedPropertyName5.errors.txt new file mode 100644 index 0000000000000..61906ddccede6 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts(1,18): error TS1005: ':' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts(1,28): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts(1,32): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts(1,18): error TS2304: Cannot find name 'get'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts(1,23): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts (5 errors) ==== + var v = { public get [e]() { } }; + ~~~ +!!! error TS1005: ':' expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~ +!!! error TS2304: Cannot find name 'get'. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName6.errors.txt b/tests/baselines/reference/ComputedPropertyName6.errors.txt new file mode 100644 index 0000000000000..979ad0a664fee --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName6.errors.txt @@ -0,0 +1,28 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,11): error TS1136: Property assignment expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,14): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,16): error TS1134: Variable declaration expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,26): error TS1005: ';' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,30): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,12): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,20): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,24): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts (8 errors) ==== + var v = { [e]: 1, [e + e]: 2 }; + ~ +!!! error TS1136: Property assignment expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS2304: Cannot find name 'e'. + ~ +!!! error TS2304: Cannot find name 'e'. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName7.errors.txt b/tests/baselines/reference/ComputedPropertyName7.errors.txt new file mode 100644 index 0000000000000..594928afa1f92 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName7.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7.ts(2,5): error TS1022: An index signature parameter must have a type annotation. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7.ts (1 errors) ==== + class C { + [e] + ~ +!!! error TS1022: An index signature parameter must have a type annotation. + } \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName8.errors.txt b/tests/baselines/reference/ComputedPropertyName8.errors.txt new file mode 100644 index 0000000000000..881d107a80b70 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName8.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8.ts(2,12): error TS1022: An index signature parameter must have a type annotation. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8.ts (1 errors) ==== + class C { + public [e] + ~ +!!! error TS1022: An index signature parameter must have a type annotation. + } \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName9.errors.txt b/tests/baselines/reference/ComputedPropertyName9.errors.txt new file mode 100644 index 0000000000000..e11503bb2fe96 --- /dev/null +++ b/tests/baselines/reference/ComputedPropertyName9.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts(2,5): error TS1022: An index signature parameter must have a type annotation. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. + + +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts (2 errors) ==== + class C { + [e]: Type + ~ +!!! error TS1022: An index signature parameter must have a type annotation. + ~~~~ +!!! error TS2304: Cannot find name 'Type'. + } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration1.js b/tests/baselines/reference/FunctionDeclaration1.js new file mode 100644 index 0000000000000..bc5afa0fece26 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration1.js @@ -0,0 +1,7 @@ +//// [FunctionDeclaration1.ts] +function * foo() { +} + +//// [FunctionDeclaration1.js] +function foo() { +} diff --git a/tests/baselines/reference/FunctionDeclaration1.types b/tests/baselines/reference/FunctionDeclaration1.types new file mode 100644 index 0000000000000..94f1f2d456c8e --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration1.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1.ts === +function * foo() { +>foo : () => void +} diff --git a/tests/baselines/reference/FunctionDeclaration10.js b/tests/baselines/reference/FunctionDeclaration10.js new file mode 100644 index 0000000000000..069433637ebfa --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration10.js @@ -0,0 +1,8 @@ +//// [FunctionDeclaration10.ts] +function * foo(a = yield => yield) { +} + +//// [FunctionDeclaration10.js] +function foo(a) { + if (a === void 0) { a = function (yield) { return yield; }; } +} diff --git a/tests/baselines/reference/FunctionDeclaration10.types b/tests/baselines/reference/FunctionDeclaration10.types new file mode 100644 index 0000000000000..0e88aeecf07ad --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration10.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10.ts === +function * foo(a = yield => yield) { +>foo : (a?: (yield: any) => any) => void +>a : (yield: any) => any +>yield => yield : (yield: any) => any +>yield : any +>yield : any +} diff --git a/tests/baselines/reference/FunctionDeclaration11.js b/tests/baselines/reference/FunctionDeclaration11.js new file mode 100644 index 0000000000000..a458755491072 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration11.js @@ -0,0 +1,7 @@ +//// [FunctionDeclaration11.ts] +function * yield() { +} + +//// [FunctionDeclaration11.js] +function yield() { +} diff --git a/tests/baselines/reference/FunctionDeclaration11.types b/tests/baselines/reference/FunctionDeclaration11.types new file mode 100644 index 0000000000000..8ba840b02025d --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration11.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11.ts === +function * yield() { +>yield : () => void +} diff --git a/tests/baselines/reference/FunctionDeclaration12.errors.txt b/tests/baselines/reference/FunctionDeclaration12.errors.txt new file mode 100644 index 0000000000000..5bea114c4b348 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration12.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts(1,20): error TS1005: '(' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts(1,25): error TS1005: '=' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts(1,28): error TS1005: '=>' expected. + + +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts (3 errors) ==== + var v = function * yield() { } + ~~~~~ +!!! error TS1005: '(' expected. + ~ +!!! error TS1005: '=' expected. + ~ +!!! error TS1005: '=>' expected. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration13.errors.txt b/tests/baselines/reference/FunctionDeclaration13.errors.txt new file mode 100644 index 0000000000000..2a0fc461e0528 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration13.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13.ts(3,11): error TS2304: Cannot find name 'yield'. + + +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13.ts (1 errors) ==== + function * foo() { + // Legal to use 'yield' in a type context. + var v: yield; + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration13.js b/tests/baselines/reference/FunctionDeclaration13.js new file mode 100644 index 0000000000000..9846e19c14037 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration13.js @@ -0,0 +1,12 @@ +//// [FunctionDeclaration13.ts] +function * foo() { + // Legal to use 'yield' in a type context. + var v: yield; +} + + +//// [FunctionDeclaration13.js] +function foo() { + // Legal to use 'yield' in a type context. + var v; +} diff --git a/tests/baselines/reference/FunctionDeclaration2.js b/tests/baselines/reference/FunctionDeclaration2.js new file mode 100644 index 0000000000000..09f3d6dd4c073 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration2.js @@ -0,0 +1,7 @@ +//// [FunctionDeclaration2.ts] +function f(yield) { +} + +//// [FunctionDeclaration2.js] +function f(yield) { +} diff --git a/tests/baselines/reference/FunctionDeclaration2.types b/tests/baselines/reference/FunctionDeclaration2.types new file mode 100644 index 0000000000000..89fcb53b20c73 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration2.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2.ts === +function f(yield) { +>f : (yield: any) => void +>yield : any +} diff --git a/tests/baselines/reference/FunctionDeclaration4.types b/tests/baselines/reference/FunctionDeclaration4.types new file mode 100644 index 0000000000000..f261867809533 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration4.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4.ts === +function yield() { +>yield : () => void +} diff --git a/tests/baselines/reference/FunctionDeclaration5.errors.txt b/tests/baselines/reference/FunctionDeclaration5.errors.txt new file mode 100644 index 0000000000000..eebbae4d8c530 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration5.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts(1,14): error TS1138: Parameter declaration expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts(1,19): error TS1005: ';' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts(1,14): error TS2304: Cannot find name 'yield'. + + +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts (4 errors) ==== + function*foo(yield) { + ~~~~~ +!!! error TS1138: Parameter declaration expected. + ~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. + } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration8.errors.txt b/tests/baselines/reference/FunctionDeclaration8.errors.txt new file mode 100644 index 0000000000000..a5deb7f655c51 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration8.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts(1,11): error TS1136: Property assignment expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts(1,18): error TS1005: ',' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts(1,24): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts(1,12): error TS2304: Cannot find name 'yield'. + + +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts (4 errors) ==== + var v = { [yield]: foo } + ~ +!!! error TS1136: Property assignment expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration9.errors.txt b/tests/baselines/reference/FunctionDeclaration9.errors.txt new file mode 100644 index 0000000000000..2d070e90ebbfe --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration9.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts(2,13): error TS1136: Property assignment expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts(2,20): error TS1005: ',' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts(3,1): error TS1128: Declaration or statement expected. + + +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts (3 errors) ==== + function * foo() { + var v = { [yield]: foo } + ~ +!!! error TS1136: Property assignment expected. + ~ +!!! error TS1005: ',' expected. + } + ~ +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionExpression1.js b/tests/baselines/reference/FunctionExpression1.js new file mode 100644 index 0000000000000..d74342ef366c6 --- /dev/null +++ b/tests/baselines/reference/FunctionExpression1.js @@ -0,0 +1,6 @@ +//// [FunctionExpression1.ts] +var v = function * () { } + +//// [FunctionExpression1.js] +var v = function () { +}; diff --git a/tests/baselines/reference/FunctionExpression1.types b/tests/baselines/reference/FunctionExpression1.types new file mode 100644 index 0000000000000..6a501aedf2289 --- /dev/null +++ b/tests/baselines/reference/FunctionExpression1.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/functionExpressions/FunctionExpression1.ts === +var v = function * () { } +>v : () => void +>function * () { } : () => void + diff --git a/tests/baselines/reference/FunctionExpression2.js b/tests/baselines/reference/FunctionExpression2.js new file mode 100644 index 0000000000000..784aea781a34a --- /dev/null +++ b/tests/baselines/reference/FunctionExpression2.js @@ -0,0 +1,6 @@ +//// [FunctionExpression2.ts] +var v = function * foo() { } + +//// [FunctionExpression2.js] +var v = function foo() { +}; diff --git a/tests/baselines/reference/FunctionExpression2.types b/tests/baselines/reference/FunctionExpression2.types new file mode 100644 index 0000000000000..488c181f3e5ce --- /dev/null +++ b/tests/baselines/reference/FunctionExpression2.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/functionExpressions/FunctionExpression2.ts === +var v = function * foo() { } +>v : () => void +>function * foo() { } : () => void +>foo : () => void + diff --git a/tests/baselines/reference/FunctionPropertyAssignments1.js b/tests/baselines/reference/FunctionPropertyAssignments1.js new file mode 100644 index 0000000000000..8285f88a5ee4f --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments1.js @@ -0,0 +1,6 @@ +//// [FunctionPropertyAssignments1.ts] +var v = { *foo() { } } + +//// [FunctionPropertyAssignments1.js] +var v = { foo: function () { +} }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments1.types b/tests/baselines/reference/FunctionPropertyAssignments1.types new file mode 100644 index 0000000000000..5821956b66e81 --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments1.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1.ts === +var v = { *foo() { } } +>v : { foo: () => void; } +>{ *foo() { } } : { foo: () => void; } +>foo : () => void +>*foo() { } : () => void + diff --git a/tests/baselines/reference/FunctionPropertyAssignments2.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments2.errors.txt new file mode 100644 index 0000000000000..1737a65e02905 --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments2.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2.ts(1,12): error TS1003: Identifier expected. + + +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2.ts (1 errors) ==== + var v = { *() { } } + ~ +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments3.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments3.errors.txt new file mode 100644 index 0000000000000..a0e8a3b5e5844 --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments3.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3.ts(1,12): error TS1003: Identifier expected. + + +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3.ts (1 errors) ==== + var v = { *{ } } + ~ +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments4.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments4.errors.txt new file mode 100644 index 0000000000000..19288b269aa39 --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments4.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4.ts(1,13): error TS1003: Identifier expected. + + +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4.ts (1 errors) ==== + var v = { * } + ~ +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments5.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments5.errors.txt new file mode 100644 index 0000000000000..5b4a4b5a59187 --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts(1,12): error TS1003: Identifier expected. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts(1,22): error TS1005: ',' expected. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts(1,26): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts(1,13): error TS2304: Cannot find name 'foo'. + + +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts (4 errors) ==== + var v = { *[foo()]() { } } + ~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments6.errors.txt new file mode 100644 index 0000000000000..bf0e237aadb0e --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6.ts(1,12): error TS1003: Identifier expected. + + +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6.ts (1 errors) ==== + var v = { *() { } } + ~ +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration1.js b/tests/baselines/reference/MemberFunctionDeclaration1.js new file mode 100644 index 0000000000000..b5630337c9a51 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration1.js @@ -0,0 +1,13 @@ +//// [MemberFunctionDeclaration1.ts] +class C { + *foo() { } +} + +//// [MemberFunctionDeclaration1.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration1.types b/tests/baselines/reference/MemberFunctionDeclaration1.types new file mode 100644 index 0000000000000..869592d072a33 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration1.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration1.ts === +class C { +>C : C + + *foo() { } +>foo : () => void +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration2.js b/tests/baselines/reference/MemberFunctionDeclaration2.js new file mode 100644 index 0000000000000..22589facd294e --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration2.js @@ -0,0 +1,13 @@ +//// [MemberFunctionDeclaration2.ts] +class C { + public * foo() { } +} + +//// [MemberFunctionDeclaration2.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration2.types b/tests/baselines/reference/MemberFunctionDeclaration2.types new file mode 100644 index 0000000000000..ad076636a2f22 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration2.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration2.ts === +class C { +>C : C + + public * foo() { } +>foo : () => void +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration3.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration3.errors.txt new file mode 100644 index 0000000000000..a9091ef1de7cc --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration3.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts(2,5): error TS1003: Identifier expected. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts(2,10): error TS1005: ';' expected. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts(2,13): error TS1005: '=>' expected. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts(3,1): error TS1128: Declaration or statement expected. + + +==== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts (4 errors) ==== + class C { + *[foo]() { } + ~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1005: '=>' expected. + } + ~ +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration4.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration4.errors.txt new file mode 100644 index 0000000000000..262942cccb40a --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts(2,5): error TS1003: Identifier expected. + + +==== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts (1 errors) ==== + class C { + *() { } + ~ +!!! error TS1003: Identifier expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration5.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration5.errors.txt new file mode 100644 index 0000000000000..262b9011e25db --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts(3,1): error TS1003: Identifier expected. + + +==== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts (1 errors) ==== + class C { + * + } + ~ +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration6.errors.txt new file mode 100644 index 0000000000000..eabbfc9ae7993 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration6.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts(3,1): error TS1005: '(' expected. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts(2,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + +==== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts (2 errors) ==== + class C { + *foo + ~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + } + ~ +!!! error TS1005: '(' expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration7.js b/tests/baselines/reference/MemberFunctionDeclaration7.js new file mode 100644 index 0000000000000..fbb3a10aab756 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration7.js @@ -0,0 +1,13 @@ +//// [MemberFunctionDeclaration7.ts] +class C { + *foo() { } +} + +//// [MemberFunctionDeclaration7.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration7.types b/tests/baselines/reference/MemberFunctionDeclaration7.types new file mode 100644 index 0000000000000..8c72504978202 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration7.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration7.ts === +class C { +>C : C + + *foo() { } +>foo : () => void +>T : T +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration8.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration8.errors.txt new file mode 100644 index 0000000000000..32f67c71ead4d --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration8.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(4,12): error TS1127: Invalid character. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(4,14): error TS1129: Statement expected. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(4,19): error TS1005: '(' expected. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(5,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(6,3): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(7,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(4,9): error TS2304: Cannot find name 'a'. +tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(4,16): error TS2391: Function implementation is missing or not immediately following the declaration. + + +==== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts (8 errors) ==== + class C { + foo() { + // Make sure we don't think of *bar as the start of a generator method. + if (a) # * bar; + +!!! error TS1127: Invalid character. + ~ +!!! error TS1129: Statement expected. + ~ +!!! error TS1005: '(' expected. + ~ +!!! error TS2304: Cannot find name 'a'. + ~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + return bar; + ~~~~~~ +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + } + ~ +!!! error TS1128: Declaration or statement expected. + } + ~ +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/TemplateExpression1.errors.txt b/tests/baselines/reference/TemplateExpression1.errors.txt new file mode 100644 index 0000000000000..bf57f5ef24ec5 --- /dev/null +++ b/tests/baselines/reference/TemplateExpression1.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,19): error TS1158: Invalid template literal; expected '}' +tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,17): error TS2304: Cannot find name 'a'. + + +==== tests/cases/conformance/es6/templates/TemplateExpression1.ts (2 errors) ==== + var v = `foo ${ a + +!!! error TS1158: Invalid template literal; expected '}' + ~ +!!! error TS2304: Cannot find name 'a'. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression1.errors.txt b/tests/baselines/reference/YieldExpression1.errors.txt new file mode 100644 index 0000000000000..ac9bdd04aba2c --- /dev/null +++ b/tests/baselines/reference/YieldExpression1.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression1.ts(1,1): error TS2304: Cannot find name 'yield'. + + +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression1.ts (1 errors) ==== + yield; + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression1.js b/tests/baselines/reference/YieldExpression1.js new file mode 100644 index 0000000000000..84f01f084a692 --- /dev/null +++ b/tests/baselines/reference/YieldExpression1.js @@ -0,0 +1,5 @@ +//// [YieldExpression1.ts] +yield; + +//// [YieldExpression1.js] +yield; diff --git a/tests/baselines/reference/YieldExpression10.js b/tests/baselines/reference/YieldExpression10.js new file mode 100644 index 0000000000000..8d6a1bcfd74fa --- /dev/null +++ b/tests/baselines/reference/YieldExpression10.js @@ -0,0 +1,11 @@ +//// [YieldExpression10.ts] +var v = { * foo() { + yield(foo); + } +} + + +//// [YieldExpression10.js] +var v = { foo: function () { + ; +} }; diff --git a/tests/baselines/reference/YieldExpression10.types b/tests/baselines/reference/YieldExpression10.types new file mode 100644 index 0000000000000..1cc2cebafc1d2 --- /dev/null +++ b/tests/baselines/reference/YieldExpression10.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression10.ts === +var v = { * foo() { +>v : { foo: () => void; } +>{ * foo() { yield(foo); }} : { foo: () => void; } +>foo : () => void +>* foo() { yield(foo); } : () => void + + yield(foo); + } +} + diff --git a/tests/baselines/reference/YieldExpression11.js b/tests/baselines/reference/YieldExpression11.js new file mode 100644 index 0000000000000..e69d9b6c06481 --- /dev/null +++ b/tests/baselines/reference/YieldExpression11.js @@ -0,0 +1,16 @@ +//// [YieldExpression11.ts] +class C { + *foo() { + yield(foo); + } +} + +//// [YieldExpression11.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + ; + }; + return C; +})(); diff --git a/tests/baselines/reference/YieldExpression11.types b/tests/baselines/reference/YieldExpression11.types new file mode 100644 index 0000000000000..da261ed041ff4 --- /dev/null +++ b/tests/baselines/reference/YieldExpression11.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression11.ts === +class C { +>C : C + + *foo() { +>foo : () => void + + yield(foo); + } +} diff --git a/tests/baselines/reference/YieldExpression12.errors.txt b/tests/baselines/reference/YieldExpression12.errors.txt new file mode 100644 index 0000000000000..47f3edc220df1 --- /dev/null +++ b/tests/baselines/reference/YieldExpression12.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression12.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration. + + +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression12.ts (1 errors) ==== + class C { + constructor() { + yield foo + ~~~~~ +!!! error TS1163: 'yield' expression must be contained_within a generator declaration. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression13.js b/tests/baselines/reference/YieldExpression13.js new file mode 100644 index 0000000000000..f3f36cfecd3e5 --- /dev/null +++ b/tests/baselines/reference/YieldExpression13.js @@ -0,0 +1,7 @@ +//// [YieldExpression13.ts] +function* foo() { yield } + +//// [YieldExpression13.js] +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression13.types b/tests/baselines/reference/YieldExpression13.types new file mode 100644 index 0000000000000..0d1cb06ba5194 --- /dev/null +++ b/tests/baselines/reference/YieldExpression13.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression13.ts === +function* foo() { yield } +>foo : () => void + diff --git a/tests/baselines/reference/YieldExpression14.errors.txt b/tests/baselines/reference/YieldExpression14.errors.txt new file mode 100644 index 0000000000000..89d0cf477cfe6 --- /dev/null +++ b/tests/baselines/reference/YieldExpression14.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression14.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration. + + +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression14.ts (1 errors) ==== + class C { + foo() { + yield foo + ~~~~~ +!!! error TS1163: 'yield' expression must be contained_within a generator declaration. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression15.errors.txt b/tests/baselines/reference/YieldExpression15.errors.txt new file mode 100644 index 0000000000000..3f90fce59932c --- /dev/null +++ b/tests/baselines/reference/YieldExpression15.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression15.ts(2,6): error TS1163: 'yield' expression must be contained_within a generator declaration. + + +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression15.ts (1 errors) ==== + var v = () => { + yield foo + ~~~~~ +!!! error TS1163: 'yield' expression must be contained_within a generator declaration. + } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression16.errors.txt b/tests/baselines/reference/YieldExpression16.errors.txt new file mode 100644 index 0000000000000..8fb1775222dd3 --- /dev/null +++ b/tests/baselines/reference/YieldExpression16.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression16.ts(3,5): error TS1163: 'yield' expression must be contained_within a generator declaration. + + +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16.ts (1 errors) ==== + function* foo() { + function bar() { + yield foo; + ~~~~~ +!!! error TS1163: 'yield' expression must be contained_within a generator declaration. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression17.errors.txt b/tests/baselines/reference/YieldExpression17.errors.txt new file mode 100644 index 0000000000000..9477ff2f13400 --- /dev/null +++ b/tests/baselines/reference/YieldExpression17.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression17.ts(1,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/yieldExpressions/YieldExpression17.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.ts (2 errors) ==== + var v = { get foo() { yield foo; } } + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression18.errors.txt b/tests/baselines/reference/YieldExpression18.errors.txt new file mode 100644 index 0000000000000..2707e5780b04c --- /dev/null +++ b/tests/baselines/reference/YieldExpression18.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression18.ts(2,1): error TS1163: 'yield' expression must be contained_within a generator declaration. + + +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression18.ts (1 errors) ==== + "use strict"; + yield(foo); + ~~~~~ +!!! error TS1163: 'yield' expression must be contained_within a generator declaration. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression19.js b/tests/baselines/reference/YieldExpression19.js new file mode 100644 index 0000000000000..39b9cda44f9ad --- /dev/null +++ b/tests/baselines/reference/YieldExpression19.js @@ -0,0 +1,17 @@ +//// [YieldExpression19.ts] +function*foo() { + function bar() { + function* quux() { + yield(foo); + } + } +} + +//// [YieldExpression19.js] +function foo() { + function bar() { + function quux() { + ; + } + } +} diff --git a/tests/baselines/reference/YieldExpression19.types b/tests/baselines/reference/YieldExpression19.types new file mode 100644 index 0000000000000..315c1a541ccfb --- /dev/null +++ b/tests/baselines/reference/YieldExpression19.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression19.ts === +function*foo() { +>foo : () => void + + function bar() { +>bar : () => void + + function* quux() { +>quux : () => void + + yield(foo); + } + } +} diff --git a/tests/baselines/reference/YieldExpression2.errors.txt b/tests/baselines/reference/YieldExpression2.errors.txt new file mode 100644 index 0000000000000..4b4e549d7bfeb --- /dev/null +++ b/tests/baselines/reference/YieldExpression2.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression2.ts(1,1): error TS1163: 'yield' expression must be contained_within a generator declaration. + + +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression2.ts (1 errors) ==== + yield foo; + ~~~~~ +!!! error TS1163: 'yield' expression must be contained_within a generator declaration. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression3.js b/tests/baselines/reference/YieldExpression3.js new file mode 100644 index 0000000000000..39a1c419e9b1d --- /dev/null +++ b/tests/baselines/reference/YieldExpression3.js @@ -0,0 +1,11 @@ +//// [YieldExpression3.ts] +function* foo() { + yield + yield +} + +//// [YieldExpression3.js] +function foo() { + ; + ; +} diff --git a/tests/baselines/reference/YieldExpression3.types b/tests/baselines/reference/YieldExpression3.types new file mode 100644 index 0000000000000..702584b44f866 --- /dev/null +++ b/tests/baselines/reference/YieldExpression3.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression3.ts === +function* foo() { +>foo : () => void + + yield + yield +} diff --git a/tests/baselines/reference/YieldExpression4.js b/tests/baselines/reference/YieldExpression4.js new file mode 100644 index 0000000000000..e85a41e85814a --- /dev/null +++ b/tests/baselines/reference/YieldExpression4.js @@ -0,0 +1,11 @@ +//// [YieldExpression4.ts] +function* foo() { + yield; + yield; +} + +//// [YieldExpression4.js] +function foo() { + ; + ; +} diff --git a/tests/baselines/reference/YieldExpression4.types b/tests/baselines/reference/YieldExpression4.types new file mode 100644 index 0000000000000..cd57f45ba730a --- /dev/null +++ b/tests/baselines/reference/YieldExpression4.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression4.ts === +function* foo() { +>foo : () => void + + yield; + yield; +} diff --git a/tests/baselines/reference/YieldExpression5.errors.txt b/tests/baselines/reference/YieldExpression5.errors.txt new file mode 100644 index 0000000000000..8036304387449 --- /dev/null +++ b/tests/baselines/reference/YieldExpression5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression5.ts(3,1): error TS1109: Expression expected. + + +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression5.ts (1 errors) ==== + function* foo() { + yield* + } + ~ +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression6.js b/tests/baselines/reference/YieldExpression6.js new file mode 100644 index 0000000000000..27fda405cd715 --- /dev/null +++ b/tests/baselines/reference/YieldExpression6.js @@ -0,0 +1,9 @@ +//// [YieldExpression6.ts] +function* foo() { + yield*foo +} + +//// [YieldExpression6.js] +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression6.types b/tests/baselines/reference/YieldExpression6.types new file mode 100644 index 0000000000000..6df16df5271f4 --- /dev/null +++ b/tests/baselines/reference/YieldExpression6.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression6.ts === +function* foo() { +>foo : () => void + + yield*foo +} diff --git a/tests/baselines/reference/YieldExpression7.js b/tests/baselines/reference/YieldExpression7.js new file mode 100644 index 0000000000000..152fe36db5031 --- /dev/null +++ b/tests/baselines/reference/YieldExpression7.js @@ -0,0 +1,9 @@ +//// [YieldExpression7.ts] +function* foo() { + yield foo +} + +//// [YieldExpression7.js] +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression7.types b/tests/baselines/reference/YieldExpression7.types new file mode 100644 index 0000000000000..40d4506c86ee2 --- /dev/null +++ b/tests/baselines/reference/YieldExpression7.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression7.ts === +function* foo() { +>foo : () => void + + yield foo +} diff --git a/tests/baselines/reference/YieldExpression8.errors.txt b/tests/baselines/reference/YieldExpression8.errors.txt new file mode 100644 index 0000000000000..ee0e57893135b --- /dev/null +++ b/tests/baselines/reference/YieldExpression8.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression8.ts(1,1): error TS2304: Cannot find name 'yield'. + + +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8.ts (1 errors) ==== + yield(foo); + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. + function* foo() { + yield(foo); + } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression8.js b/tests/baselines/reference/YieldExpression8.js new file mode 100644 index 0000000000000..07b80cf3e51aa --- /dev/null +++ b/tests/baselines/reference/YieldExpression8.js @@ -0,0 +1,11 @@ +//// [YieldExpression8.ts] +yield(foo); +function* foo() { + yield(foo); +} + +//// [YieldExpression8.js] +yield(foo); +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression9.js b/tests/baselines/reference/YieldExpression9.js new file mode 100644 index 0000000000000..72365abcd70e8 --- /dev/null +++ b/tests/baselines/reference/YieldExpression9.js @@ -0,0 +1,9 @@ +//// [YieldExpression9.ts] +var v = function*() { + yield(foo); +} + +//// [YieldExpression9.js] +var v = function () { + ; +}; diff --git a/tests/baselines/reference/YieldExpression9.types b/tests/baselines/reference/YieldExpression9.types new file mode 100644 index 0000000000000..4c5242369c000 --- /dev/null +++ b/tests/baselines/reference/YieldExpression9.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression9.ts === +var v = function*() { +>v : () => void +>function*() { yield(foo);} : () => void + + yield(foo); +} diff --git a/tests/baselines/reference/templateStringInYieldKeyword.errors.txt b/tests/baselines/reference/templateStringInYieldKeyword.errors.txt deleted file mode 100644 index 50b780ad3cb06..0000000000000 --- a/tests/baselines/reference/templateStringInYieldKeyword.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,9): error TS1003: Identifier expected. -tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,15): error TS1005: ';' expected. -tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,11): error TS2304: Cannot find name 'gen'. -tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,13): error TS2304: Cannot find name 'yield'. - - -==== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts (4 errors) ==== - function* gen { - ~ -!!! error TS1003: Identifier expected. - ~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name 'gen'. - // Once this is supported, the inner expression does not need to be parenthesized. - var x = yield `abc${ x }def`; - ~~~~~ -!!! error TS2304: Cannot find name 'yield'. - } - \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInYieldKeyword.js b/tests/baselines/reference/templateStringInYieldKeyword.js new file mode 100644 index 0000000000000..8e98b269cd009 --- /dev/null +++ b/tests/baselines/reference/templateStringInYieldKeyword.js @@ -0,0 +1,12 @@ +//// [templateStringInYieldKeyword.ts] +function* gen() { + // Once this is supported, the inner expression does not need to be parenthesized. + var x = yield `abc${ x }def`; +} + + +//// [templateStringInYieldKeyword.js] +function gen() { + // Once this is supported, the inner expression does not need to be parenthesized. + var x = ; +} diff --git a/tests/baselines/reference/templateStringInYieldKeyword.types b/tests/baselines/reference/templateStringInYieldKeyword.types new file mode 100644 index 0000000000000..c3d49ddffb743 --- /dev/null +++ b/tests/baselines/reference/templateStringInYieldKeyword.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts === +function* gen() { +>gen : () => void + + // Once this is supported, the inner expression does not need to be parenthesized. + var x = yield `abc${ x }def`; +>x : unknown +} + diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt b/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt index 3bf910f369051..28f33943732e9 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt +++ b/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt @@ -1,29 +1,11 @@ -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,9): error TS1003: Identifier expected. -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,15): error TS1005: ';' expected. -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,26): error TS1158: Invalid template literal; expected '}' -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(5,1): error TS1160: Unterminated template literal. -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,11): error TS2304: Cannot find name 'gen'. -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,20): error TS2304: Cannot find name 'yield'. -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,30): error TS2304: Cannot find name 'def'. +tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,15): error TS1005: '(' expected. -==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts (7 errors) ==== +==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts (1 errors) ==== function* gen { - ~ -!!! error TS1003: Identifier expected. ~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name 'gen'. +!!! error TS1005: '(' expected. // Once this is supported, yield *must* be parenthesized. var x = `abc${ yield 10 }def`; - ~~ -!!! error TS1158: Invalid template literal; expected '}' - ~~~~~ -!!! error TS2304: Cannot find name 'yield'. - ~~~ -!!! error TS2304: Cannot find name 'def'. } - - -!!! error TS1160: Unterminated template literal. \ No newline at end of file + \ No newline at end of file diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt deleted file mode 100644 index 4e62197e0315f..0000000000000 --- a/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,9): error TS1003: Identifier expected. -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,17): error TS1005: ';' expected. -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,26): error TS1158: Invalid template literal; expected '}' -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(5,1): error TS1160: Unterminated template literal. -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,11): error TS2304: Cannot find name 'gen'. -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,20): error TS2304: Cannot find name 'yield'. -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,30): error TS2304: Cannot find name 'def'. - - -==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts (7 errors) ==== - function* gen() { - ~ -!!! error TS1003: Identifier expected. - ~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name 'gen'. - // Once this is supported, yield *must* be parenthesized. - var x = `abc${ yield 10 }def`; - ~~ -!!! error TS1158: Invalid template literal; expected '}' - ~~~~~ -!!! error TS2304: Cannot find name 'yield'. - ~~~ -!!! error TS2304: Cannot find name 'def'. - } - - -!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.js b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.js new file mode 100644 index 0000000000000..80021ecae2e90 --- /dev/null +++ b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.js @@ -0,0 +1,12 @@ +//// [templateStringWithEmbeddedYieldKeywordES6.ts] +function* gen() { + // Once this is supported, yield *must* be parenthesized. + var x = `abc${ yield 10 }def`; +} + + +//// [templateStringWithEmbeddedYieldKeywordES6.js] +function gen() { + // Once this is supported, yield *must* be parenthesized. + var x = `abc${}def`; +} diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.types b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.types new file mode 100644 index 0000000000000..c55b40148b164 --- /dev/null +++ b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts === +function* gen() { +>gen : () => void + + // Once this is supported, yield *must* be parenthesized. + var x = `abc${ yield 10 }def`; +>x : string +} + From 3b253e9a4a0f402f16dc3368d78ea8379b456cff Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 24 Nov 2014 22:53:55 -0800 Subject: [PATCH 09/20] Add an _es6 suffix to prevent name collisions. --- ... => ComputedPropertyName10_es6.errors.txt} | 4 +-- ... => ComputedPropertyName11_es6.errors.txt} | 8 ++--- ... => ComputedPropertyName12_es6.errors.txt} | 8 ++--- ... => ComputedPropertyName13_es6.errors.txt} | 4 +-- ... => ComputedPropertyName14_es6.errors.txt} | 4 +-- ... => ComputedPropertyName15_es6.errors.txt} | 4 +-- ... => ComputedPropertyName16_es6.errors.txt} | 10 +++--- ... => ComputedPropertyName17_es6.errors.txt} | 10 +++--- ... => ComputedPropertyName18_es6.errors.txt} | 4 +-- ... => ComputedPropertyName19_es6.errors.txt} | 4 +-- ...t => ComputedPropertyName1_es6.errors.txt} | 8 ++--- ...t => ComputedPropertyName2_es6.errors.txt} | 12 +++---- ...t => ComputedPropertyName3_es6.errors.txt} | 10 +++--- ...t => ComputedPropertyName4_es6.errors.txt} | 10 +++--- ...t => ComputedPropertyName5_es6.errors.txt} | 12 +++---- ...t => ComputedPropertyName6_es6.errors.txt} | 18 +++++----- ...t => ComputedPropertyName7_es6.errors.txt} | 4 +-- ...t => ComputedPropertyName8_es6.errors.txt} | 4 +-- ...t => ComputedPropertyName9_es6.errors.txt} | 6 ++-- .../reference/FunctionDeclaration1.js | 7 ---- ...tion10.js => FunctionDeclaration10_es6.js} | 4 +-- ....types => FunctionDeclaration10_es6.types} | 2 +- .../reference/FunctionDeclaration11.js | 7 ---- .../reference/FunctionDeclaration11_es6.js | 7 ++++ ....types => FunctionDeclaration11_es6.types} | 2 +- ...t => FunctionDeclaration12_es6.errors.txt} | 8 ++--- ...t => FunctionDeclaration13_es6.errors.txt} | 4 +-- ...tion13.js => FunctionDeclaration13_es6.js} | 4 +-- .../reference/FunctionDeclaration1_es6.js | 7 ++++ ...1.types => FunctionDeclaration1_es6.types} | 2 +- .../reference/FunctionDeclaration2.js | 7 ---- .../reference/FunctionDeclaration2_es6.js | 7 ++++ ...2.types => FunctionDeclaration2_es6.types} | 2 +- .../FunctionDeclaration3_es6.errors.txt | 8 +++++ .../reference/FunctionDeclaration3_es6.js | 8 +++++ .../reference/FunctionDeclaration4_es6.js | 7 ++++ ...4.types => FunctionDeclaration4_es6.types} | 2 +- ...xt => FunctionDeclaration5_es6.errors.txt} | 10 +++--- .../FunctionDeclaration6_es6.errors.txt | 8 +++++ .../reference/FunctionDeclaration6_es6.js | 8 +++++ .../FunctionDeclaration7_es6.errors.txt | 11 ++++++ .../reference/FunctionDeclaration7_es6.js | 14 ++++++++ ...xt => FunctionDeclaration8_es6.errors.txt} | 10 +++--- ...xt => FunctionDeclaration9_es6.errors.txt} | 8 ++--- .../reference/FunctionExpression1.js | 6 ---- .../reference/FunctionExpression1_es6.js | 6 ++++ ...n1.types => FunctionExpression1_es6.types} | 2 +- .../reference/FunctionExpression2.js | 6 ---- .../reference/FunctionExpression2_es6.js | 6 ++++ ...n2.types => FunctionExpression2_es6.types} | 2 +- .../reference/FunctionPropertyAssignments1.js | 6 ---- .../FunctionPropertyAssignments1_es6.js | 6 ++++ ...=> FunctionPropertyAssignments1_es6.types} | 2 +- ...nctionPropertyAssignments2_es6.errors.txt} | 4 +-- ...nctionPropertyAssignments3_es6.errors.txt} | 4 +-- ...nctionPropertyAssignments4_es6.errors.txt} | 4 +-- ...nctionPropertyAssignments5_es6.errors.txt} | 10 +++--- ...nctionPropertyAssignments6_es6.errors.txt} | 4 +-- .../MemberFunctionDeclaration1.types | 7 ---- ...1.js => MemberFunctionDeclaration1_es6.js} | 4 +-- .../MemberFunctionDeclaration1_es6.types | 7 ++++ .../MemberFunctionDeclaration2.types | 7 ---- ...2.js => MemberFunctionDeclaration2_es6.js} | 4 +-- .../MemberFunctionDeclaration2_es6.types | 7 ++++ .../MemberFunctionDeclaration3.errors.txt | 18 ---------- .../MemberFunctionDeclaration3_es6.errors.txt | 18 ++++++++++ .../MemberFunctionDeclaration4.errors.txt | 9 ----- .../MemberFunctionDeclaration4_es6.errors.txt | 9 +++++ .../MemberFunctionDeclaration5.errors.txt | 9 ----- .../MemberFunctionDeclaration5_es6.errors.txt | 9 +++++ .../MemberFunctionDeclaration6.errors.txt | 12 ------- .../MemberFunctionDeclaration6_es6.errors.txt | 12 +++++++ .../MemberFunctionDeclaration7.types | 8 ----- ...7.js => MemberFunctionDeclaration7_es6.js} | 4 +-- .../MemberFunctionDeclaration7_es6.types | 8 +++++ .../MemberFunctionDeclaration8.errors.txt | 34 ------------------- .../MemberFunctionDeclaration8_es6.errors.txt | 34 +++++++++++++++++++ .../reference/YieldExpression1.errors.txt | 7 ---- tests/baselines/reference/YieldExpression1.js | 5 --- ...pression10.js => YieldExpression10_es6.js} | 4 +-- ...on10.types => YieldExpression10_es6.types} | 2 +- ...pression11.js => YieldExpression11_es6.js} | 4 +-- ...on11.types => YieldExpression11_es6.types} | 2 +- ...s.txt => YieldExpression12_es6.errors.txt} | 4 +-- .../baselines/reference/YieldExpression13.js | 7 ---- .../reference/YieldExpression13_es6.js | 7 ++++ ...on13.types => YieldExpression13_es6.types} | 2 +- ...s.txt => YieldExpression14_es6.errors.txt} | 4 +-- ...s.txt => YieldExpression15_es6.errors.txt} | 4 +-- ...s.txt => YieldExpression16_es6.errors.txt} | 4 +-- .../reference/YieldExpression17.errors.txt | 10 ------ .../YieldExpression17_es6.errors.txt | 10 ++++++ ...s.txt => YieldExpression18_es6.errors.txt} | 4 +-- ...pression19.js => YieldExpression19_es6.js} | 4 +-- ...on19.types => YieldExpression19_es6.types} | 2 +- .../reference/YieldExpression1_es6.errors.txt | 7 ++++ .../reference/YieldExpression1_es6.js | 5 +++ .../reference/YieldExpression2.errors.txt | 7 ---- .../reference/YieldExpression2_es6.errors.txt | 7 ++++ tests/baselines/reference/YieldExpression3.js | 11 ------ .../reference/YieldExpression3_es6.js | 11 ++++++ ...sion3.types => YieldExpression3_es6.types} | 2 +- ...Expression4.js => YieldExpression4_es6.js} | 4 +-- ...sion4.types => YieldExpression4_es6.types} | 2 +- ...rs.txt => YieldExpression5_es6.errors.txt} | 4 +-- tests/baselines/reference/YieldExpression6.js | 9 ----- .../reference/YieldExpression6_es6.js | 9 +++++ ...sion6.types => YieldExpression6_es6.types} | 2 +- tests/baselines/reference/YieldExpression7.js | 9 ----- .../reference/YieldExpression7_es6.js | 9 +++++ ...sion7.types => YieldExpression7_es6.types} | 2 +- ...rs.txt => YieldExpression8_es6.errors.txt} | 4 +-- ...Expression8.js => YieldExpression8_es6.js} | 4 +-- ...Expression9.js => YieldExpression9_es6.js} | 4 +-- ...sion9.types => YieldExpression9_es6.types} | 2 +- ...ame10.ts => ComputedPropertyName10_es6.ts} | 0 ...ame11.ts => ComputedPropertyName11_es6.ts} | 0 ...ame12.ts => ComputedPropertyName12_es6.ts} | 0 ...ame13.ts => ComputedPropertyName13_es6.ts} | 0 ...ame14.ts => ComputedPropertyName14_es6.ts} | 0 ...ame15.ts => ComputedPropertyName15_es6.ts} | 0 ...ame16.ts => ComputedPropertyName16_es6.ts} | 0 ...ame17.ts => ComputedPropertyName17_es6.ts} | 0 ...ame18.ts => ComputedPropertyName18_es6.ts} | 0 ...ame19.ts => ComputedPropertyName19_es6.ts} | 0 ...yName1.ts => ComputedPropertyName1_es6.ts} | 0 ...yName2.ts => ComputedPropertyName2_es6.ts} | 0 ...yName3.ts => ComputedPropertyName3_es6.ts} | 0 ...yName4.ts => ComputedPropertyName4_es6.ts} | 0 ...yName5.ts => ComputedPropertyName5_es6.ts} | 0 ...yName6.ts => ComputedPropertyName6_es6.ts} | 0 ...yName7.ts => ComputedPropertyName7_es6.ts} | 0 ...yName8.ts => ComputedPropertyName8_es6.ts} | 0 ...yName9.ts => ComputedPropertyName9_es6.ts} | 0 ...tion10.ts => FunctionDeclaration10_es6.ts} | 0 ...tion11.ts => FunctionDeclaration11_es6.ts} | 0 ...tion12.ts => FunctionDeclaration12_es6.ts} | 0 ...tion13.ts => FunctionDeclaration13_es6.ts} | 0 ...ration1.ts => FunctionDeclaration1_es6.ts} | 0 ...ration2.ts => FunctionDeclaration2_es6.ts} | 0 ...ration3.ts => FunctionDeclaration3_es6.ts} | 0 ...ration4.ts => FunctionDeclaration4_es6.ts} | 0 ...ration5.ts => FunctionDeclaration5_es6.ts} | 0 ...ration6.ts => FunctionDeclaration6_es6.ts} | 0 ...ration7.ts => FunctionDeclaration7_es6.ts} | 0 ...ration8.ts => FunctionDeclaration8_es6.ts} | 0 ...ration9.ts => FunctionDeclaration9_es6.ts} | 0 ...ression1.ts => FunctionExpression1_es6.ts} | 0 ...ression2.ts => FunctionExpression2_es6.ts} | 0 ...ts => FunctionPropertyAssignments1_es6.ts} | 0 ...ts => FunctionPropertyAssignments2_es6.ts} | 0 ...ts => FunctionPropertyAssignments3_es6.ts} | 0 ...ts => FunctionPropertyAssignments4_es6.ts} | 0 ...ts => FunctionPropertyAssignments5_es6.ts} | 0 ...ts => FunctionPropertyAssignments6_es6.ts} | 0 .../MemberFunctionDeclaration1_es6.ts} | 0 .../MemberFunctionDeclaration2_es6.ts} | 0 .../MemberFunctionDeclaration3_es6.ts} | 0 .../MemberFunctionDeclaration4_es6.ts} | 0 .../MemberFunctionDeclaration5_es6.ts} | 0 .../MemberFunctionDeclaration6_es6.ts} | 0 .../MemberFunctionDeclaration7_es6.ts} | 0 .../MemberFunctionDeclaration8_es6.ts} | 0 ...pression10.ts => YieldExpression10_es6.ts} | 0 ...pression11.ts => YieldExpression11_es6.ts} | 0 ...pression12.ts => YieldExpression12_es6.ts} | 0 ...pression13.ts => YieldExpression13_es6.ts} | 0 ...pression14.ts => YieldExpression14_es6.ts} | 0 ...pression15.ts => YieldExpression15_es6.ts} | 0 ...pression16.ts => YieldExpression16_es6.ts} | 0 ...pression17.ts => YieldExpression17_es6.ts} | 0 ...pression18.ts => YieldExpression18_es6.ts} | 0 ...pression19.ts => YieldExpression19_es6.ts} | 0 ...Expression1.ts => YieldExpression1_es6.ts} | 0 ...Expression2.ts => YieldExpression2_es6.ts} | 0 ...Expression3.ts => YieldExpression3_es6.ts} | 0 ...Expression4.ts => YieldExpression4_es6.ts} | 0 ...Expression5.ts => YieldExpression5_es6.ts} | 0 ...Expression6.ts => YieldExpression6_es6.ts} | 0 ...Expression7.ts => YieldExpression7_es6.ts} | 0 ...Expression8.ts => YieldExpression8_es6.ts} | 0 ...Expression9.ts => YieldExpression9_es6.ts} | 0 182 files changed, 430 insertions(+), 366 deletions(-) rename tests/baselines/reference/{ComputedPropertyName10.errors.txt => ComputedPropertyName10_es6.errors.txt} (68%) rename tests/baselines/reference/{ComputedPropertyName11.errors.txt => ComputedPropertyName11_es6.errors.txt} (66%) rename tests/baselines/reference/{ComputedPropertyName12.errors.txt => ComputedPropertyName12_es6.errors.txt} (66%) rename tests/baselines/reference/{ComputedPropertyName13.errors.txt => ComputedPropertyName13_es6.errors.txt} (64%) rename tests/baselines/reference/{ComputedPropertyName14.errors.txt => ComputedPropertyName14_es6.errors.txt} (68%) rename tests/baselines/reference/{ComputedPropertyName15.errors.txt => ComputedPropertyName15_es6.errors.txt} (67%) rename tests/baselines/reference/{ComputedPropertyName16.errors.txt => ComputedPropertyName16_es6.errors.txt} (64%) rename tests/baselines/reference/{ComputedPropertyName17.errors.txt => ComputedPropertyName17_es6.errors.txt} (67%) rename tests/baselines/reference/{ComputedPropertyName18.errors.txt => ComputedPropertyName18_es6.errors.txt} (69%) rename tests/baselines/reference/{ComputedPropertyName19.errors.txt => ComputedPropertyName19_es6.errors.txt} (68%) rename tests/baselines/reference/{ComputedPropertyName1.errors.txt => ComputedPropertyName1_es6.errors.txt} (66%) rename tests/baselines/reference/{ComputedPropertyName2.errors.txt => ComputedPropertyName2_es6.errors.txt} (66%) rename tests/baselines/reference/{ComputedPropertyName3.errors.txt => ComputedPropertyName3_es6.errors.txt} (67%) rename tests/baselines/reference/{ComputedPropertyName4.errors.txt => ComputedPropertyName4_es6.errors.txt} (68%) rename tests/baselines/reference/{ComputedPropertyName5.errors.txt => ComputedPropertyName5_es6.errors.txt} (69%) rename tests/baselines/reference/{ComputedPropertyName6.errors.txt => ComputedPropertyName6_es6.errors.txt} (67%) rename tests/baselines/reference/{ComputedPropertyName7.errors.txt => ComputedPropertyName7_es6.errors.txt} (64%) rename tests/baselines/reference/{ComputedPropertyName8.errors.txt => ComputedPropertyName8_es6.errors.txt} (65%) rename tests/baselines/reference/{ComputedPropertyName9.errors.txt => ComputedPropertyName9_es6.errors.txt} (65%) delete mode 100644 tests/baselines/reference/FunctionDeclaration1.js rename tests/baselines/reference/{FunctionDeclaration10.js => FunctionDeclaration10_es6.js} (61%) rename tests/baselines/reference/{FunctionDeclaration10.types => FunctionDeclaration10_es6.types} (88%) delete mode 100644 tests/baselines/reference/FunctionDeclaration11.js create mode 100644 tests/baselines/reference/FunctionDeclaration11_es6.js rename tests/baselines/reference/{FunctionDeclaration11.types => FunctionDeclaration11_es6.types} (80%) rename tests/baselines/reference/{FunctionDeclaration12.errors.txt => FunctionDeclaration12_es6.errors.txt} (71%) rename tests/baselines/reference/{FunctionDeclaration13.errors.txt => FunctionDeclaration13_es6.errors.txt} (73%) rename tests/baselines/reference/{FunctionDeclaration13.js => FunctionDeclaration13_es6.js} (67%) create mode 100644 tests/baselines/reference/FunctionDeclaration1_es6.js rename tests/baselines/reference/{FunctionDeclaration1.types => FunctionDeclaration1_es6.types} (80%) delete mode 100644 tests/baselines/reference/FunctionDeclaration2.js create mode 100644 tests/baselines/reference/FunctionDeclaration2_es6.js rename tests/baselines/reference/{FunctionDeclaration2.types => FunctionDeclaration2_es6.types} (82%) create mode 100644 tests/baselines/reference/FunctionDeclaration3_es6.errors.txt create mode 100644 tests/baselines/reference/FunctionDeclaration3_es6.js create mode 100644 tests/baselines/reference/FunctionDeclaration4_es6.js rename tests/baselines/reference/{FunctionDeclaration4.types => FunctionDeclaration4_es6.types} (80%) rename tests/baselines/reference/{FunctionDeclaration5.errors.txt => FunctionDeclaration5_es6.errors.txt} (66%) create mode 100644 tests/baselines/reference/FunctionDeclaration6_es6.errors.txt create mode 100644 tests/baselines/reference/FunctionDeclaration6_es6.js create mode 100644 tests/baselines/reference/FunctionDeclaration7_es6.errors.txt create mode 100644 tests/baselines/reference/FunctionDeclaration7_es6.js rename tests/baselines/reference/{FunctionDeclaration8.errors.txt => FunctionDeclaration8_es6.errors.txt} (67%) rename tests/baselines/reference/{FunctionDeclaration9.errors.txt => FunctionDeclaration9_es6.errors.txt} (68%) delete mode 100644 tests/baselines/reference/FunctionExpression1.js create mode 100644 tests/baselines/reference/FunctionExpression1_es6.js rename tests/baselines/reference/{FunctionExpression1.types => FunctionExpression1_es6.types} (85%) delete mode 100644 tests/baselines/reference/FunctionExpression2.js create mode 100644 tests/baselines/reference/FunctionExpression2_es6.js rename tests/baselines/reference/{FunctionExpression2.types => FunctionExpression2_es6.types} (86%) delete mode 100644 tests/baselines/reference/FunctionPropertyAssignments1.js create mode 100644 tests/baselines/reference/FunctionPropertyAssignments1_es6.js rename tests/baselines/reference/{FunctionPropertyAssignments1.types => FunctionPropertyAssignments1_es6.types} (82%) rename tests/baselines/reference/{FunctionPropertyAssignments2.errors.txt => FunctionPropertyAssignments2_es6.errors.txt} (62%) rename tests/baselines/reference/{FunctionPropertyAssignments3.errors.txt => FunctionPropertyAssignments3_es6.errors.txt} (62%) rename tests/baselines/reference/{FunctionPropertyAssignments4.errors.txt => FunctionPropertyAssignments4_es6.errors.txt} (62%) rename tests/baselines/reference/{FunctionPropertyAssignments5.errors.txt => FunctionPropertyAssignments5_es6.errors.txt} (63%) rename tests/baselines/reference/{FunctionPropertyAssignments6.errors.txt => FunctionPropertyAssignments6_es6.errors.txt} (62%) delete mode 100644 tests/baselines/reference/MemberFunctionDeclaration1.types rename tests/baselines/reference/{MemberFunctionDeclaration1.js => MemberFunctionDeclaration1_es6.js} (59%) create mode 100644 tests/baselines/reference/MemberFunctionDeclaration1_es6.types delete mode 100644 tests/baselines/reference/MemberFunctionDeclaration2.types rename tests/baselines/reference/{MemberFunctionDeclaration2.js => MemberFunctionDeclaration2_es6.js} (61%) create mode 100644 tests/baselines/reference/MemberFunctionDeclaration2_es6.types delete mode 100644 tests/baselines/reference/MemberFunctionDeclaration3.errors.txt create mode 100644 tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt delete mode 100644 tests/baselines/reference/MemberFunctionDeclaration4.errors.txt create mode 100644 tests/baselines/reference/MemberFunctionDeclaration4_es6.errors.txt delete mode 100644 tests/baselines/reference/MemberFunctionDeclaration5.errors.txt create mode 100644 tests/baselines/reference/MemberFunctionDeclaration5_es6.errors.txt delete mode 100644 tests/baselines/reference/MemberFunctionDeclaration6.errors.txt create mode 100644 tests/baselines/reference/MemberFunctionDeclaration6_es6.errors.txt delete mode 100644 tests/baselines/reference/MemberFunctionDeclaration7.types rename tests/baselines/reference/{MemberFunctionDeclaration7.js => MemberFunctionDeclaration7_es6.js} (60%) create mode 100644 tests/baselines/reference/MemberFunctionDeclaration7_es6.types delete mode 100644 tests/baselines/reference/MemberFunctionDeclaration8.errors.txt create mode 100644 tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt delete mode 100644 tests/baselines/reference/YieldExpression1.errors.txt delete mode 100644 tests/baselines/reference/YieldExpression1.js rename tests/baselines/reference/{YieldExpression10.js => YieldExpression10_es6.js} (54%) rename tests/baselines/reference/{YieldExpression10.types => YieldExpression10_es6.types} (90%) rename tests/baselines/reference/{YieldExpression11.js => YieldExpression11_es6.js} (68%) rename tests/baselines/reference/{YieldExpression11.types => YieldExpression11_es6.types} (84%) rename tests/baselines/reference/{YieldExpression12.errors.txt => YieldExpression12_es6.errors.txt} (54%) delete mode 100644 tests/baselines/reference/YieldExpression13.js create mode 100644 tests/baselines/reference/YieldExpression13_es6.js rename tests/baselines/reference/{YieldExpression13.types => YieldExpression13_es6.types} (85%) rename tests/baselines/reference/{YieldExpression14.errors.txt => YieldExpression14_es6.errors.txt} (53%) rename tests/baselines/reference/{YieldExpression15.errors.txt => YieldExpression15_es6.errors.txt} (52%) rename tests/baselines/reference/{YieldExpression16.errors.txt => YieldExpression16_es6.errors.txt} (55%) delete mode 100644 tests/baselines/reference/YieldExpression17.errors.txt create mode 100644 tests/baselines/reference/YieldExpression17_es6.errors.txt rename tests/baselines/reference/{YieldExpression18.errors.txt => YieldExpression18_es6.errors.txt} (50%) rename tests/baselines/reference/{YieldExpression19.js => YieldExpression19_es6.js} (71%) rename tests/baselines/reference/{YieldExpression19.types => YieldExpression19_es6.types} (88%) create mode 100644 tests/baselines/reference/YieldExpression1_es6.errors.txt create mode 100644 tests/baselines/reference/YieldExpression1_es6.js delete mode 100644 tests/baselines/reference/YieldExpression2.errors.txt create mode 100644 tests/baselines/reference/YieldExpression2_es6.errors.txt delete mode 100644 tests/baselines/reference/YieldExpression3.js create mode 100644 tests/baselines/reference/YieldExpression3_es6.js rename tests/baselines/reference/{YieldExpression3.types => YieldExpression3_es6.types} (85%) rename tests/baselines/reference/{YieldExpression4.js => YieldExpression4_es6.js} (50%) rename tests/baselines/reference/{YieldExpression4.types => YieldExpression4_es6.types} (85%) rename tests/baselines/reference/{YieldExpression5.errors.txt => YieldExpression5_es6.errors.txt} (51%) delete mode 100644 tests/baselines/reference/YieldExpression6.js create mode 100644 tests/baselines/reference/YieldExpression6_es6.js rename tests/baselines/reference/{YieldExpression6.types => YieldExpression6_es6.types} (85%) delete mode 100644 tests/baselines/reference/YieldExpression7.js create mode 100644 tests/baselines/reference/YieldExpression7_es6.js rename tests/baselines/reference/{YieldExpression7.types => YieldExpression7_es6.types} (85%) rename tests/baselines/reference/{YieldExpression8.errors.txt => YieldExpression8_es6.errors.txt} (54%) rename tests/baselines/reference/{YieldExpression8.js => YieldExpression8_es6.js} (54%) rename tests/baselines/reference/{YieldExpression9.js => YieldExpression9_es6.js} (50%) rename tests/baselines/reference/{YieldExpression9.types => YieldExpression9_es6.types} (88%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName10.ts => ComputedPropertyName10_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName11.ts => ComputedPropertyName11_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName12.ts => ComputedPropertyName12_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName13.ts => ComputedPropertyName13_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName14.ts => ComputedPropertyName14_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName15.ts => ComputedPropertyName15_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName16.ts => ComputedPropertyName16_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName17.ts => ComputedPropertyName17_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName18.ts => ComputedPropertyName18_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName19.ts => ComputedPropertyName19_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName1.ts => ComputedPropertyName1_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName2.ts => ComputedPropertyName2_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName3.ts => ComputedPropertyName3_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName4.ts => ComputedPropertyName4_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName5.ts => ComputedPropertyName5_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName6.ts => ComputedPropertyName6_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName7.ts => ComputedPropertyName7_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName8.ts => ComputedPropertyName8_es6.ts} (100%) rename tests/cases/conformance/es6/computedPropertyNames/{ComputedPropertyName9.ts => ComputedPropertyName9_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration10.ts => FunctionDeclaration10_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration11.ts => FunctionDeclaration11_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration12.ts => FunctionDeclaration12_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration13.ts => FunctionDeclaration13_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration1.ts => FunctionDeclaration1_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration2.ts => FunctionDeclaration2_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration3.ts => FunctionDeclaration3_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration4.ts => FunctionDeclaration4_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration5.ts => FunctionDeclaration5_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration6.ts => FunctionDeclaration6_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration7.ts => FunctionDeclaration7_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration8.ts => FunctionDeclaration8_es6.ts} (100%) rename tests/cases/conformance/es6/functionDeclarations/{FunctionDeclaration9.ts => FunctionDeclaration9_es6.ts} (100%) rename tests/cases/conformance/es6/functionExpressions/{FunctionExpression1.ts => FunctionExpression1_es6.ts} (100%) rename tests/cases/conformance/es6/functionExpressions/{FunctionExpression2.ts => FunctionExpression2_es6.ts} (100%) rename tests/cases/conformance/es6/functionPropertyAssignments/{FunctionPropertyAssignments1.ts => FunctionPropertyAssignments1_es6.ts} (100%) rename tests/cases/conformance/es6/functionPropertyAssignments/{FunctionPropertyAssignments2.ts => FunctionPropertyAssignments2_es6.ts} (100%) rename tests/cases/conformance/es6/functionPropertyAssignments/{FunctionPropertyAssignments3.ts => FunctionPropertyAssignments3_es6.ts} (100%) rename tests/cases/conformance/es6/functionPropertyAssignments/{FunctionPropertyAssignments4.ts => FunctionPropertyAssignments4_es6.ts} (100%) rename tests/cases/conformance/es6/functionPropertyAssignments/{FunctionPropertyAssignments5.ts => FunctionPropertyAssignments5_es6.ts} (100%) rename tests/cases/conformance/es6/functionPropertyAssignments/{FunctionPropertyAssignments6.ts => FunctionPropertyAssignments6_es6.ts} (100%) rename tests/cases/conformance/es6/{fmmberFunctionDeclarations/MemberFunctionDeclaration1.ts => memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts} (100%) rename tests/cases/conformance/es6/{fmmberFunctionDeclarations/MemberFunctionDeclaration2.ts => memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts} (100%) rename tests/cases/conformance/es6/{fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts => memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts} (100%) rename tests/cases/conformance/es6/{fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts => memberFunctionDeclarations/MemberFunctionDeclaration4_es6.ts} (100%) rename tests/cases/conformance/es6/{fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts => memberFunctionDeclarations/MemberFunctionDeclaration5_es6.ts} (100%) rename tests/cases/conformance/es6/{fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts => memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts} (100%) rename tests/cases/conformance/es6/{fmmberFunctionDeclarations/MemberFunctionDeclaration7.ts => memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts} (100%) rename tests/cases/conformance/es6/{fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts => memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression10.ts => YieldExpression10_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression11.ts => YieldExpression11_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression12.ts => YieldExpression12_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression13.ts => YieldExpression13_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression14.ts => YieldExpression14_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression15.ts => YieldExpression15_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression16.ts => YieldExpression16_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression17.ts => YieldExpression17_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression18.ts => YieldExpression18_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression19.ts => YieldExpression19_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression1.ts => YieldExpression1_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression2.ts => YieldExpression2_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression3.ts => YieldExpression3_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression4.ts => YieldExpression4_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression5.ts => YieldExpression5_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression6.ts => YieldExpression6_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression7.ts => YieldExpression7_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression8.ts => YieldExpression8_es6.ts} (100%) rename tests/cases/conformance/es6/yieldExpressions/{YieldExpression9.ts => YieldExpression9_es6.ts} (100%) diff --git a/tests/baselines/reference/ComputedPropertyName10.errors.txt b/tests/baselines/reference/ComputedPropertyName10_es6.errors.txt similarity index 68% rename from tests/baselines/reference/ComputedPropertyName10.errors.txt rename to tests/baselines/reference/ComputedPropertyName10_es6.errors.txt index c880e57859cc4..ba7154a929808 100644 --- a/tests/baselines/reference/ComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName10_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10.ts(2,8): error TS1005: ';' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10_es6.ts(2,8): error TS1005: ';' expected. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10_es6.ts (1 errors) ==== class C { [e] = 1 ~ diff --git a/tests/baselines/reference/ComputedPropertyName11.errors.txt b/tests/baselines/reference/ComputedPropertyName11_es6.errors.txt similarity index 66% rename from tests/baselines/reference/ComputedPropertyName11.errors.txt rename to tests/baselines/reference/ComputedPropertyName11_es6.errors.txt index 3b23c2f8287a1..3f96913c1d583 100644 --- a/tests/baselines/reference/ComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName11_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts(2,7): error TS1005: ';' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts(2,8): error TS1109: Expression expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts(3,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts(2,7): error TS1005: ';' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts(2,8): error TS1109: Expression expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts(3,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts (3 errors) ==== class C { [e](); ~ diff --git a/tests/baselines/reference/ComputedPropertyName12.errors.txt b/tests/baselines/reference/ComputedPropertyName12_es6.errors.txt similarity index 66% rename from tests/baselines/reference/ComputedPropertyName12.errors.txt rename to tests/baselines/reference/ComputedPropertyName12_es6.errors.txt index 575574c2d7e93..fefff058fe127 100644 --- a/tests/baselines/reference/ComputedPropertyName12.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName12_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts(2,7): error TS1005: ';' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts(2,10): error TS1005: '=>' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts(3,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts(2,7): error TS1005: ';' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts(2,10): error TS1005: '=>' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts(3,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts (3 errors) ==== class C { [e]() { } ~ diff --git a/tests/baselines/reference/ComputedPropertyName13.errors.txt b/tests/baselines/reference/ComputedPropertyName13_es6.errors.txt similarity index 64% rename from tests/baselines/reference/ComputedPropertyName13.errors.txt rename to tests/baselines/reference/ComputedPropertyName13_es6.errors.txt index 2024b4d7128b5..3f8c10fc6431d 100644 --- a/tests/baselines/reference/ComputedPropertyName13.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName13_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13.ts(1,11): error TS1022: An index signature parameter must have a type annotation. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13_es6.ts(1,11): error TS1022: An index signature parameter must have a type annotation. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13_es6.ts (1 errors) ==== var v: { [e]: number }; ~ !!! error TS1022: An index signature parameter must have a type annotation. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName14.errors.txt b/tests/baselines/reference/ComputedPropertyName14_es6.errors.txt similarity index 68% rename from tests/baselines/reference/ComputedPropertyName14.errors.txt rename to tests/baselines/reference/ComputedPropertyName14_es6.errors.txt index 4fe3cf4e12173..7d6052b4179c4 100644 --- a/tests/baselines/reference/ComputedPropertyName14.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName14_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14.ts(1,13): error TS1005: ';' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14_es6.ts(1,13): error TS1005: ';' expected. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14_es6.ts (1 errors) ==== var v: { [e](): number }; ~ !!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName15.errors.txt b/tests/baselines/reference/ComputedPropertyName15_es6.errors.txt similarity index 67% rename from tests/baselines/reference/ComputedPropertyName15.errors.txt rename to tests/baselines/reference/ComputedPropertyName15_es6.errors.txt index 4ab96e131e9bc..689df40f985c0 100644 --- a/tests/baselines/reference/ComputedPropertyName15.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName15_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15.ts(1,32): error TS1022: An index signature parameter must have a type annotation. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15_es6.ts(1,32): error TS1022: An index signature parameter must have a type annotation. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15_es6.ts (1 errors) ==== var v: { [e: number]: string; [e]: number }; ~ !!! error TS1022: An index signature parameter must have a type annotation. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName16.errors.txt b/tests/baselines/reference/ComputedPropertyName16_es6.errors.txt similarity index 64% rename from tests/baselines/reference/ComputedPropertyName16.errors.txt rename to tests/baselines/reference/ComputedPropertyName16_es6.errors.txt index 631449a818e4b..c3de61ddf079e 100644 --- a/tests/baselines/reference/ComputedPropertyName16.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName16_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts(2,3): error TS1132: Enum member expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts(3,1): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts(2,3): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts(2,4): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(2,3): error TS1132: Enum member expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(3,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(2,3): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(2,4): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts (4 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts (4 errors) ==== enum E { [e] = 1 ~ diff --git a/tests/baselines/reference/ComputedPropertyName17.errors.txt b/tests/baselines/reference/ComputedPropertyName17_es6.errors.txt similarity index 67% rename from tests/baselines/reference/ComputedPropertyName17.errors.txt rename to tests/baselines/reference/ComputedPropertyName17_es6.errors.txt index 3a3d5ca80f9df..4b8caf1e62dce 100644 --- a/tests/baselines/reference/ComputedPropertyName17.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName17_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts(1,15): error TS1003: Identifier expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts(1,22): error TS1005: ',' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts(1,26): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts(1,16): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,15): error TS1003: Identifier expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,22): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,26): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,16): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts (4 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts (4 errors) ==== var v = { set [e](v) { } } ~ !!! error TS1003: Identifier expected. diff --git a/tests/baselines/reference/ComputedPropertyName18.errors.txt b/tests/baselines/reference/ComputedPropertyName18_es6.errors.txt similarity index 69% rename from tests/baselines/reference/ComputedPropertyName18.errors.txt rename to tests/baselines/reference/ComputedPropertyName18_es6.errors.txt index 1df180bc9c1ce..8e409750b5c73 100644 --- a/tests/baselines/reference/ComputedPropertyName18.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName18_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18.ts(1,13): error TS1005: ';' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18_es6.ts(1,13): error TS1005: ';' expected. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18_es6.ts (1 errors) ==== var v: { [e]?(): number }; ~ !!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName19.errors.txt b/tests/baselines/reference/ComputedPropertyName19_es6.errors.txt similarity index 68% rename from tests/baselines/reference/ComputedPropertyName19.errors.txt rename to tests/baselines/reference/ComputedPropertyName19_es6.errors.txt index 7e063befdc895..1833deef7896d 100644 --- a/tests/baselines/reference/ComputedPropertyName19.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName19_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19.ts(1,13): error TS1005: ';' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19_es6.ts(1,13): error TS1005: ';' expected. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19_es6.ts (1 errors) ==== var v: { [e]? }; ~ !!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/ComputedPropertyName1.errors.txt b/tests/baselines/reference/ComputedPropertyName1_es6.errors.txt similarity index 66% rename from tests/baselines/reference/ComputedPropertyName1.errors.txt rename to tests/baselines/reference/ComputedPropertyName1_es6.errors.txt index 89423599a44b3..260ff20dc3656 100644 --- a/tests/baselines/reference/ComputedPropertyName1.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName1_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts(1,11): error TS1136: Property assignment expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts(1,15): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts(1,12): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts(1,11): error TS1136: Property assignment expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts(1,15): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts (3 errors) ==== var v = { [e] }; ~ !!! error TS1136: Property assignment expected. diff --git a/tests/baselines/reference/ComputedPropertyName2.errors.txt b/tests/baselines/reference/ComputedPropertyName2_es6.errors.txt similarity index 66% rename from tests/baselines/reference/ComputedPropertyName2.errors.txt rename to tests/baselines/reference/ComputedPropertyName2_es6.errors.txt index fd2bf09a09441..f0a06ef84bcd2 100644 --- a/tests/baselines/reference/ComputedPropertyName2.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName2_es6.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts(1,11): error TS1136: Property assignment expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts(1,14): error TS1005: ',' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts(1,16): error TS1134: Variable declaration expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts(1,18): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,11): error TS1136: Property assignment expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,14): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,16): error TS1134: Variable declaration expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,18): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts (5 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts (5 errors) ==== var v = { [e]: 1 }; ~ !!! error TS1136: Property assignment expected. diff --git a/tests/baselines/reference/ComputedPropertyName3.errors.txt b/tests/baselines/reference/ComputedPropertyName3_es6.errors.txt similarity index 67% rename from tests/baselines/reference/ComputedPropertyName3.errors.txt rename to tests/baselines/reference/ComputedPropertyName3_es6.errors.txt index 4aaaa46ca688c..3f1e5d707a841 100644 --- a/tests/baselines/reference/ComputedPropertyName3.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName3_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts(1,11): error TS1136: Property assignment expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts(1,17): error TS1005: ',' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts(1,21): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,11): error TS1136: Property assignment expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,17): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,21): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts (4 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts (4 errors) ==== var v = { [e]() { } }; ~ !!! error TS1136: Property assignment expected. diff --git a/tests/baselines/reference/ComputedPropertyName4.errors.txt b/tests/baselines/reference/ComputedPropertyName4_es6.errors.txt similarity index 68% rename from tests/baselines/reference/ComputedPropertyName4.errors.txt rename to tests/baselines/reference/ComputedPropertyName4_es6.errors.txt index d03de72fb54d5..a1f22f611f95d 100644 --- a/tests/baselines/reference/ComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName4_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts(1,15): error TS1003: Identifier expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts(1,21): error TS1005: ',' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts(1,25): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,15): error TS1003: Identifier expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,21): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,25): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,16): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts (4 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts (4 errors) ==== var v = { get [e]() { } }; ~ !!! error TS1003: Identifier expected. diff --git a/tests/baselines/reference/ComputedPropertyName5.errors.txt b/tests/baselines/reference/ComputedPropertyName5_es6.errors.txt similarity index 69% rename from tests/baselines/reference/ComputedPropertyName5.errors.txt rename to tests/baselines/reference/ComputedPropertyName5_es6.errors.txt index 61906ddccede6..2ce2faaee6271 100644 --- a/tests/baselines/reference/ComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName5_es6.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts(1,18): error TS1005: ':' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts(1,28): error TS1005: ',' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts(1,32): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts(1,18): error TS2304: Cannot find name 'get'. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts(1,23): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,18): error TS1005: ':' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,28): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,32): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,18): error TS2304: Cannot find name 'get'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,23): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts (5 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts (5 errors) ==== var v = { public get [e]() { } }; ~~~ !!! error TS1005: ':' expected. diff --git a/tests/baselines/reference/ComputedPropertyName6.errors.txt b/tests/baselines/reference/ComputedPropertyName6_es6.errors.txt similarity index 67% rename from tests/baselines/reference/ComputedPropertyName6.errors.txt rename to tests/baselines/reference/ComputedPropertyName6_es6.errors.txt index 979ad0a664fee..ca6bce482958e 100644 --- a/tests/baselines/reference/ComputedPropertyName6.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName6_es6.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,11): error TS1136: Property assignment expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,14): error TS1005: ',' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,16): error TS1134: Variable declaration expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,26): error TS1005: ';' expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,30): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,12): error TS2304: Cannot find name 'e'. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,20): error TS2304: Cannot find name 'e'. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts(1,24): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,11): error TS1136: Property assignment expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,14): error TS1005: ',' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,16): error TS1134: Variable declaration expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,26): error TS1005: ';' expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,30): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,12): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,20): error TS2304: Cannot find name 'e'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,24): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts (8 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts (8 errors) ==== var v = { [e]: 1, [e + e]: 2 }; ~ !!! error TS1136: Property assignment expected. diff --git a/tests/baselines/reference/ComputedPropertyName7.errors.txt b/tests/baselines/reference/ComputedPropertyName7_es6.errors.txt similarity index 64% rename from tests/baselines/reference/ComputedPropertyName7.errors.txt rename to tests/baselines/reference/ComputedPropertyName7_es6.errors.txt index 594928afa1f92..00be8f610e024 100644 --- a/tests/baselines/reference/ComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName7_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7.ts(2,5): error TS1022: An index signature parameter must have a type annotation. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7_es6.ts(2,5): error TS1022: An index signature parameter must have a type annotation. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7_es6.ts (1 errors) ==== class C { [e] ~ diff --git a/tests/baselines/reference/ComputedPropertyName8.errors.txt b/tests/baselines/reference/ComputedPropertyName8_es6.errors.txt similarity index 65% rename from tests/baselines/reference/ComputedPropertyName8.errors.txt rename to tests/baselines/reference/ComputedPropertyName8_es6.errors.txt index 881d107a80b70..58386bbe17774 100644 --- a/tests/baselines/reference/ComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName8_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8.ts(2,12): error TS1022: An index signature parameter must have a type annotation. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8_es6.ts(2,12): error TS1022: An index signature parameter must have a type annotation. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8_es6.ts (1 errors) ==== class C { public [e] ~ diff --git a/tests/baselines/reference/ComputedPropertyName9.errors.txt b/tests/baselines/reference/ComputedPropertyName9_es6.errors.txt similarity index 65% rename from tests/baselines/reference/ComputedPropertyName9.errors.txt rename to tests/baselines/reference/ComputedPropertyName9_es6.errors.txt index e11503bb2fe96..0872f69aebe8f 100644 --- a/tests/baselines/reference/ComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/ComputedPropertyName9_es6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts(2,5): error TS1022: An index signature parameter must have a type annotation. -tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts(2,5): error TS1022: An index signature parameter must have a type annotation. +tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts(2,9): error TS2304: Cannot find name 'Type'. -==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts (2 errors) ==== class C { [e]: Type ~ diff --git a/tests/baselines/reference/FunctionDeclaration1.js b/tests/baselines/reference/FunctionDeclaration1.js deleted file mode 100644 index bc5afa0fece26..0000000000000 --- a/tests/baselines/reference/FunctionDeclaration1.js +++ /dev/null @@ -1,7 +0,0 @@ -//// [FunctionDeclaration1.ts] -function * foo() { -} - -//// [FunctionDeclaration1.js] -function foo() { -} diff --git a/tests/baselines/reference/FunctionDeclaration10.js b/tests/baselines/reference/FunctionDeclaration10_es6.js similarity index 61% rename from tests/baselines/reference/FunctionDeclaration10.js rename to tests/baselines/reference/FunctionDeclaration10_es6.js index 069433637ebfa..5169453396463 100644 --- a/tests/baselines/reference/FunctionDeclaration10.js +++ b/tests/baselines/reference/FunctionDeclaration10_es6.js @@ -1,8 +1,8 @@ -//// [FunctionDeclaration10.ts] +//// [FunctionDeclaration10_es6.ts] function * foo(a = yield => yield) { } -//// [FunctionDeclaration10.js] +//// [FunctionDeclaration10_es6.js] function foo(a) { if (a === void 0) { a = function (yield) { return yield; }; } } diff --git a/tests/baselines/reference/FunctionDeclaration10.types b/tests/baselines/reference/FunctionDeclaration10_es6.types similarity index 88% rename from tests/baselines/reference/FunctionDeclaration10.types rename to tests/baselines/reference/FunctionDeclaration10_es6.types index 0e88aeecf07ad..973de97fab165 100644 --- a/tests/baselines/reference/FunctionDeclaration10.types +++ b/tests/baselines/reference/FunctionDeclaration10_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10.ts === +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts === function * foo(a = yield => yield) { >foo : (a?: (yield: any) => any) => void >a : (yield: any) => any diff --git a/tests/baselines/reference/FunctionDeclaration11.js b/tests/baselines/reference/FunctionDeclaration11.js deleted file mode 100644 index a458755491072..0000000000000 --- a/tests/baselines/reference/FunctionDeclaration11.js +++ /dev/null @@ -1,7 +0,0 @@ -//// [FunctionDeclaration11.ts] -function * yield() { -} - -//// [FunctionDeclaration11.js] -function yield() { -} diff --git a/tests/baselines/reference/FunctionDeclaration11_es6.js b/tests/baselines/reference/FunctionDeclaration11_es6.js new file mode 100644 index 0000000000000..ba497b3e529d7 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration11_es6.js @@ -0,0 +1,7 @@ +//// [FunctionDeclaration11_es6.ts] +function * yield() { +} + +//// [FunctionDeclaration11_es6.js] +function yield() { +} diff --git a/tests/baselines/reference/FunctionDeclaration11.types b/tests/baselines/reference/FunctionDeclaration11_es6.types similarity index 80% rename from tests/baselines/reference/FunctionDeclaration11.types rename to tests/baselines/reference/FunctionDeclaration11_es6.types index 8ba840b02025d..f57a385c3592a 100644 --- a/tests/baselines/reference/FunctionDeclaration11.types +++ b/tests/baselines/reference/FunctionDeclaration11_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11.ts === +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts === function * yield() { >yield : () => void } diff --git a/tests/baselines/reference/FunctionDeclaration12.errors.txt b/tests/baselines/reference/FunctionDeclaration12_es6.errors.txt similarity index 71% rename from tests/baselines/reference/FunctionDeclaration12.errors.txt rename to tests/baselines/reference/FunctionDeclaration12_es6.errors.txt index 5bea114c4b348..358ec5ea0414a 100644 --- a/tests/baselines/reference/FunctionDeclaration12.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration12_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts(1,20): error TS1005: '(' expected. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts(1,25): error TS1005: '=' expected. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts(1,28): error TS1005: '=>' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12_es6.ts(1,20): error TS1005: '(' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12_es6.ts(1,25): error TS1005: '=' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12_es6.ts(1,28): error TS1005: '=>' expected. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12_es6.ts (3 errors) ==== var v = function * yield() { } ~~~~~ !!! error TS1005: '(' expected. diff --git a/tests/baselines/reference/FunctionDeclaration13.errors.txt b/tests/baselines/reference/FunctionDeclaration13_es6.errors.txt similarity index 73% rename from tests/baselines/reference/FunctionDeclaration13.errors.txt rename to tests/baselines/reference/FunctionDeclaration13_es6.errors.txt index 2a0fc461e0528..1f921475fd330 100644 --- a/tests/baselines/reference/FunctionDeclaration13.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration13_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13.ts(3,11): error TS2304: Cannot find name 'yield'. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'yield'. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13.ts (1 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (1 errors) ==== function * foo() { // Legal to use 'yield' in a type context. var v: yield; diff --git a/tests/baselines/reference/FunctionDeclaration13.js b/tests/baselines/reference/FunctionDeclaration13_es6.js similarity index 67% rename from tests/baselines/reference/FunctionDeclaration13.js rename to tests/baselines/reference/FunctionDeclaration13_es6.js index 9846e19c14037..4c82b0375697c 100644 --- a/tests/baselines/reference/FunctionDeclaration13.js +++ b/tests/baselines/reference/FunctionDeclaration13_es6.js @@ -1,11 +1,11 @@ -//// [FunctionDeclaration13.ts] +//// [FunctionDeclaration13_es6.ts] function * foo() { // Legal to use 'yield' in a type context. var v: yield; } -//// [FunctionDeclaration13.js] +//// [FunctionDeclaration13_es6.js] function foo() { // Legal to use 'yield' in a type context. var v; diff --git a/tests/baselines/reference/FunctionDeclaration1_es6.js b/tests/baselines/reference/FunctionDeclaration1_es6.js new file mode 100644 index 0000000000000..262c7ea02fbb1 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration1_es6.js @@ -0,0 +1,7 @@ +//// [FunctionDeclaration1_es6.ts] +function * foo() { +} + +//// [FunctionDeclaration1_es6.js] +function foo() { +} diff --git a/tests/baselines/reference/FunctionDeclaration1.types b/tests/baselines/reference/FunctionDeclaration1_es6.types similarity index 80% rename from tests/baselines/reference/FunctionDeclaration1.types rename to tests/baselines/reference/FunctionDeclaration1_es6.types index 94f1f2d456c8e..69b26e5dd1007 100644 --- a/tests/baselines/reference/FunctionDeclaration1.types +++ b/tests/baselines/reference/FunctionDeclaration1_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1.ts === +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts === function * foo() { >foo : () => void } diff --git a/tests/baselines/reference/FunctionDeclaration2.js b/tests/baselines/reference/FunctionDeclaration2.js deleted file mode 100644 index 09f3d6dd4c073..0000000000000 --- a/tests/baselines/reference/FunctionDeclaration2.js +++ /dev/null @@ -1,7 +0,0 @@ -//// [FunctionDeclaration2.ts] -function f(yield) { -} - -//// [FunctionDeclaration2.js] -function f(yield) { -} diff --git a/tests/baselines/reference/FunctionDeclaration2_es6.js b/tests/baselines/reference/FunctionDeclaration2_es6.js new file mode 100644 index 0000000000000..dc73cad330f19 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration2_es6.js @@ -0,0 +1,7 @@ +//// [FunctionDeclaration2_es6.ts] +function f(yield) { +} + +//// [FunctionDeclaration2_es6.js] +function f(yield) { +} diff --git a/tests/baselines/reference/FunctionDeclaration2.types b/tests/baselines/reference/FunctionDeclaration2_es6.types similarity index 82% rename from tests/baselines/reference/FunctionDeclaration2.types rename to tests/baselines/reference/FunctionDeclaration2_es6.types index 89fcb53b20c73..f23d9cf6840eb 100644 --- a/tests/baselines/reference/FunctionDeclaration2.types +++ b/tests/baselines/reference/FunctionDeclaration2_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2.ts === +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2_es6.ts === function f(yield) { >f : (yield: any) => void >yield : any diff --git a/tests/baselines/reference/FunctionDeclaration3_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration3_es6.errors.txt new file mode 100644 index 0000000000000..409baef3a500e --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration3_es6.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3_es6.ts(1,20): error TS2372: Parameter 'yield' cannot be referenced in its initializer. + + +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3_es6.ts (1 errors) ==== + function f(yield = yield) { + ~~~~~ +!!! error TS2372: Parameter 'yield' cannot be referenced in its initializer. + } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration3_es6.js b/tests/baselines/reference/FunctionDeclaration3_es6.js new file mode 100644 index 0000000000000..e1df936dd21fe --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration3_es6.js @@ -0,0 +1,8 @@ +//// [FunctionDeclaration3_es6.ts] +function f(yield = yield) { +} + +//// [FunctionDeclaration3_es6.js] +function f(yield) { + if (yield === void 0) { yield = yield; } +} diff --git a/tests/baselines/reference/FunctionDeclaration4_es6.js b/tests/baselines/reference/FunctionDeclaration4_es6.js new file mode 100644 index 0000000000000..da6c695fcb9ea --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration4_es6.js @@ -0,0 +1,7 @@ +//// [FunctionDeclaration4_es6.ts] +function yield() { +} + +//// [FunctionDeclaration4_es6.js] +function yield() { +} diff --git a/tests/baselines/reference/FunctionDeclaration4.types b/tests/baselines/reference/FunctionDeclaration4_es6.types similarity index 80% rename from tests/baselines/reference/FunctionDeclaration4.types rename to tests/baselines/reference/FunctionDeclaration4_es6.types index f261867809533..e4f102a8f706a 100644 --- a/tests/baselines/reference/FunctionDeclaration4.types +++ b/tests/baselines/reference/FunctionDeclaration4_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4.ts === +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4_es6.ts === function yield() { >yield : () => void } diff --git a/tests/baselines/reference/FunctionDeclaration5.errors.txt b/tests/baselines/reference/FunctionDeclaration5_es6.errors.txt similarity index 66% rename from tests/baselines/reference/FunctionDeclaration5.errors.txt rename to tests/baselines/reference/FunctionDeclaration5_es6.errors.txt index eebbae4d8c530..9a8be9217959b 100644 --- a/tests/baselines/reference/FunctionDeclaration5.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration5_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts(1,14): error TS1138: Parameter declaration expected. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts(1,19): error TS1005: ';' expected. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts(1,14): error TS2304: Cannot find name 'yield'. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,14): error TS1138: Parameter declaration expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,19): error TS1005: ';' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,14): error TS2304: Cannot find name 'yield'. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts (4 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts (4 errors) ==== function*foo(yield) { ~~~~~ !!! error TS1138: Parameter declaration expected. diff --git a/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt new file mode 100644 index 0000000000000..7d5eb768be697 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2304: Cannot find name 'yield'. + + +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (1 errors) ==== + function*foo(a = yield) { + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. + } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration6_es6.js b/tests/baselines/reference/FunctionDeclaration6_es6.js new file mode 100644 index 0000000000000..07b3ff52212a0 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration6_es6.js @@ -0,0 +1,8 @@ +//// [FunctionDeclaration6_es6.ts] +function*foo(a = yield) { +} + +//// [FunctionDeclaration6_es6.js] +function foo(a) { + if (a === void 0) { a = yield; } +} diff --git a/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt new file mode 100644 index 0000000000000..95ad904bdd99f --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'. + + +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (1 errors) ==== + function*bar() { + // 'yield' here is an identifier, and not a yield expression. + function*foo(a = yield) { + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration7_es6.js b/tests/baselines/reference/FunctionDeclaration7_es6.js new file mode 100644 index 0000000000000..661e1668e0ff2 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration7_es6.js @@ -0,0 +1,14 @@ +//// [FunctionDeclaration7_es6.ts] +function*bar() { + // 'yield' here is an identifier, and not a yield expression. + function*foo(a = yield) { + } +} + +//// [FunctionDeclaration7_es6.js] +function bar() { + // 'yield' here is an identifier, and not a yield expression. + function foo(a) { + if (a === void 0) { a = yield; } + } +} diff --git a/tests/baselines/reference/FunctionDeclaration8.errors.txt b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt similarity index 67% rename from tests/baselines/reference/FunctionDeclaration8.errors.txt rename to tests/baselines/reference/FunctionDeclaration8_es6.errors.txt index a5deb7f655c51..a30b8d8031089 100644 --- a/tests/baselines/reference/FunctionDeclaration8.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts(1,11): error TS1136: Property assignment expected. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts(1,18): error TS1005: ',' expected. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts(1,24): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts(1,12): error TS2304: Cannot find name 'yield'. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1136: Property assignment expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,18): error TS1005: ',' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,24): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'yield'. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts (4 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (4 errors) ==== var v = { [yield]: foo } ~ !!! error TS1136: Property assignment expected. diff --git a/tests/baselines/reference/FunctionDeclaration9.errors.txt b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt similarity index 68% rename from tests/baselines/reference/FunctionDeclaration9.errors.txt rename to tests/baselines/reference/FunctionDeclaration9_es6.errors.txt index 2d070e90ebbfe..b4cf83a7b6c6d 100644 --- a/tests/baselines/reference/FunctionDeclaration9.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts(2,13): error TS1136: Property assignment expected. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts(2,20): error TS1005: ',' expected. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts(3,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1136: Property assignment expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,20): error TS1005: ',' expected. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(3,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ==== function * foo() { var v = { [yield]: foo } ~ diff --git a/tests/baselines/reference/FunctionExpression1.js b/tests/baselines/reference/FunctionExpression1.js deleted file mode 100644 index d74342ef366c6..0000000000000 --- a/tests/baselines/reference/FunctionExpression1.js +++ /dev/null @@ -1,6 +0,0 @@ -//// [FunctionExpression1.ts] -var v = function * () { } - -//// [FunctionExpression1.js] -var v = function () { -}; diff --git a/tests/baselines/reference/FunctionExpression1_es6.js b/tests/baselines/reference/FunctionExpression1_es6.js new file mode 100644 index 0000000000000..7c8d82f4ca82f --- /dev/null +++ b/tests/baselines/reference/FunctionExpression1_es6.js @@ -0,0 +1,6 @@ +//// [FunctionExpression1_es6.ts] +var v = function * () { } + +//// [FunctionExpression1_es6.js] +var v = function () { +}; diff --git a/tests/baselines/reference/FunctionExpression1.types b/tests/baselines/reference/FunctionExpression1_es6.types similarity index 85% rename from tests/baselines/reference/FunctionExpression1.types rename to tests/baselines/reference/FunctionExpression1_es6.types index 6a501aedf2289..c857d53baba40 100644 --- a/tests/baselines/reference/FunctionExpression1.types +++ b/tests/baselines/reference/FunctionExpression1_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/functionExpressions/FunctionExpression1.ts === +=== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts === var v = function * () { } >v : () => void >function * () { } : () => void diff --git a/tests/baselines/reference/FunctionExpression2.js b/tests/baselines/reference/FunctionExpression2.js deleted file mode 100644 index 784aea781a34a..0000000000000 --- a/tests/baselines/reference/FunctionExpression2.js +++ /dev/null @@ -1,6 +0,0 @@ -//// [FunctionExpression2.ts] -var v = function * foo() { } - -//// [FunctionExpression2.js] -var v = function foo() { -}; diff --git a/tests/baselines/reference/FunctionExpression2_es6.js b/tests/baselines/reference/FunctionExpression2_es6.js new file mode 100644 index 0000000000000..0a2468bcb8cd2 --- /dev/null +++ b/tests/baselines/reference/FunctionExpression2_es6.js @@ -0,0 +1,6 @@ +//// [FunctionExpression2_es6.ts] +var v = function * foo() { } + +//// [FunctionExpression2_es6.js] +var v = function foo() { +}; diff --git a/tests/baselines/reference/FunctionExpression2.types b/tests/baselines/reference/FunctionExpression2_es6.types similarity index 86% rename from tests/baselines/reference/FunctionExpression2.types rename to tests/baselines/reference/FunctionExpression2_es6.types index 488c181f3e5ce..7bd9f0904356d 100644 --- a/tests/baselines/reference/FunctionExpression2.types +++ b/tests/baselines/reference/FunctionExpression2_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/functionExpressions/FunctionExpression2.ts === +=== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts === var v = function * foo() { } >v : () => void >function * foo() { } : () => void diff --git a/tests/baselines/reference/FunctionPropertyAssignments1.js b/tests/baselines/reference/FunctionPropertyAssignments1.js deleted file mode 100644 index 8285f88a5ee4f..0000000000000 --- a/tests/baselines/reference/FunctionPropertyAssignments1.js +++ /dev/null @@ -1,6 +0,0 @@ -//// [FunctionPropertyAssignments1.ts] -var v = { *foo() { } } - -//// [FunctionPropertyAssignments1.js] -var v = { foo: function () { -} }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments1_es6.js b/tests/baselines/reference/FunctionPropertyAssignments1_es6.js new file mode 100644 index 0000000000000..a451dcfb3632d --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments1_es6.js @@ -0,0 +1,6 @@ +//// [FunctionPropertyAssignments1_es6.ts] +var v = { *foo() { } } + +//// [FunctionPropertyAssignments1_es6.js] +var v = { foo: function () { +} }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments1.types b/tests/baselines/reference/FunctionPropertyAssignments1_es6.types similarity index 82% rename from tests/baselines/reference/FunctionPropertyAssignments1.types rename to tests/baselines/reference/FunctionPropertyAssignments1_es6.types index 5821956b66e81..2dfbf5cb6575a 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments1.types +++ b/tests/baselines/reference/FunctionPropertyAssignments1_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1.ts === +=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts === var v = { *foo() { } } >v : { foo: () => void; } >{ *foo() { } } : { foo: () => void; } diff --git a/tests/baselines/reference/FunctionPropertyAssignments2.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments2_es6.errors.txt similarity index 62% rename from tests/baselines/reference/FunctionPropertyAssignments2.errors.txt rename to tests/baselines/reference/FunctionPropertyAssignments2_es6.errors.txt index 1737a65e02905..f0287f12696f1 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments2.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments2_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2.ts(1,12): error TS1003: Identifier expected. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2_es6.ts(1,12): error TS1003: Identifier expected. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2.ts (1 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2_es6.ts (1 errors) ==== var v = { *() { } } ~ !!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments3.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments3_es6.errors.txt similarity index 62% rename from tests/baselines/reference/FunctionPropertyAssignments3.errors.txt rename to tests/baselines/reference/FunctionPropertyAssignments3_es6.errors.txt index a0e8a3b5e5844..b5873e807961b 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments3.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments3_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3.ts(1,12): error TS1003: Identifier expected. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3_es6.ts(1,12): error TS1003: Identifier expected. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3.ts (1 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3_es6.ts (1 errors) ==== var v = { *{ } } ~ !!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments4.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments4_es6.errors.txt similarity index 62% rename from tests/baselines/reference/FunctionPropertyAssignments4.errors.txt rename to tests/baselines/reference/FunctionPropertyAssignments4_es6.errors.txt index 19288b269aa39..285341f04dc2d 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments4.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments4_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4.ts(1,13): error TS1003: Identifier expected. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4_es6.ts(1,13): error TS1003: Identifier expected. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4.ts (1 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4_es6.ts (1 errors) ==== var v = { * } ~ !!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments5.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt similarity index 63% rename from tests/baselines/reference/FunctionPropertyAssignments5.errors.txt rename to tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt index 5b4a4b5a59187..961dabaa996ea 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts(1,12): error TS1003: Identifier expected. -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts(1,22): error TS1005: ',' expected. -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts(1,26): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts(1,13): error TS2304: Cannot find name 'foo'. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1003: Identifier expected. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,22): error TS1005: ',' expected. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,26): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts (4 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (4 errors) ==== var v = { *[foo()]() { } } ~ !!! error TS1003: Identifier expected. diff --git a/tests/baselines/reference/FunctionPropertyAssignments6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments6_es6.errors.txt similarity index 62% rename from tests/baselines/reference/FunctionPropertyAssignments6.errors.txt rename to tests/baselines/reference/FunctionPropertyAssignments6_es6.errors.txt index bf0e237aadb0e..a4e8450bd73e5 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments6.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments6_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6.ts(1,12): error TS1003: Identifier expected. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6_es6.ts(1,12): error TS1003: Identifier expected. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6.ts (1 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6_es6.ts (1 errors) ==== var v = { *() { } } ~ !!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration1.types b/tests/baselines/reference/MemberFunctionDeclaration1.types deleted file mode 100644 index 869592d072a33..0000000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration1.types +++ /dev/null @@ -1,7 +0,0 @@ -=== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration1.ts === -class C { ->C : C - - *foo() { } ->foo : () => void -} diff --git a/tests/baselines/reference/MemberFunctionDeclaration1.js b/tests/baselines/reference/MemberFunctionDeclaration1_es6.js similarity index 59% rename from tests/baselines/reference/MemberFunctionDeclaration1.js rename to tests/baselines/reference/MemberFunctionDeclaration1_es6.js index b5630337c9a51..86e7c9d418a8a 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration1.js +++ b/tests/baselines/reference/MemberFunctionDeclaration1_es6.js @@ -1,9 +1,9 @@ -//// [MemberFunctionDeclaration1.ts] +//// [MemberFunctionDeclaration1_es6.ts] class C { *foo() { } } -//// [MemberFunctionDeclaration1.js] +//// [MemberFunctionDeclaration1_es6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/MemberFunctionDeclaration1_es6.types b/tests/baselines/reference/MemberFunctionDeclaration1_es6.types new file mode 100644 index 0000000000000..265d3fdb29135 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration1_es6.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts === +class C { +>C : C + + *foo() { } +>foo : () => void +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration2.types b/tests/baselines/reference/MemberFunctionDeclaration2.types deleted file mode 100644 index ad076636a2f22..0000000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration2.types +++ /dev/null @@ -1,7 +0,0 @@ -=== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration2.ts === -class C { ->C : C - - public * foo() { } ->foo : () => void -} diff --git a/tests/baselines/reference/MemberFunctionDeclaration2.js b/tests/baselines/reference/MemberFunctionDeclaration2_es6.js similarity index 61% rename from tests/baselines/reference/MemberFunctionDeclaration2.js rename to tests/baselines/reference/MemberFunctionDeclaration2_es6.js index 22589facd294e..efd60844dc7fe 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration2.js +++ b/tests/baselines/reference/MemberFunctionDeclaration2_es6.js @@ -1,9 +1,9 @@ -//// [MemberFunctionDeclaration2.ts] +//// [MemberFunctionDeclaration2_es6.ts] class C { public * foo() { } } -//// [MemberFunctionDeclaration2.js] +//// [MemberFunctionDeclaration2_es6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/MemberFunctionDeclaration2_es6.types b/tests/baselines/reference/MemberFunctionDeclaration2_es6.types new file mode 100644 index 0000000000000..e1e3f9d17e53d --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration2_es6.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts === +class C { +>C : C + + public * foo() { } +>foo : () => void +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration3.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration3.errors.txt deleted file mode 100644 index a9091ef1de7cc..0000000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration3.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts(2,5): error TS1003: Identifier expected. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts(2,10): error TS1005: ';' expected. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts(2,13): error TS1005: '=>' expected. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts(3,1): error TS1128: Declaration or statement expected. - - -==== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts (4 errors) ==== - class C { - *[foo]() { } - ~ -!!! error TS1003: Identifier expected. - ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS1005: '=>' expected. - } - ~ -!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt new file mode 100644 index 0000000000000..b3a2de4eec66d --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,5): error TS1003: Identifier expected. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,10): error TS1005: ';' expected. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,13): error TS1005: '=>' expected. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(3,1): error TS1128: Declaration or statement expected. + + +==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (4 errors) ==== + class C { + *[foo]() { } + ~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1005: '=>' expected. + } + ~ +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration4.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration4.errors.txt deleted file mode 100644 index 262942cccb40a..0000000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration4.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts(2,5): error TS1003: Identifier expected. - - -==== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts (1 errors) ==== - class C { - *() { } - ~ -!!! error TS1003: Identifier expected. - } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration4_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration4_es6.errors.txt new file mode 100644 index 0000000000000..988527ccfd7a2 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration4_es6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration4_es6.ts(2,5): error TS1003: Identifier expected. + + +==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration4_es6.ts (1 errors) ==== + class C { + *() { } + ~ +!!! error TS1003: Identifier expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration5.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration5.errors.txt deleted file mode 100644 index 262b9011e25db..0000000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration5.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts(3,1): error TS1003: Identifier expected. - - -==== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts (1 errors) ==== - class C { - * - } - ~ -!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration5_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration5_es6.errors.txt new file mode 100644 index 0000000000000..e27d6198104bf --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration5_es6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration5_es6.ts(3,1): error TS1003: Identifier expected. + + +==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration5_es6.ts (1 errors) ==== + class C { + * + } + ~ +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration6.errors.txt deleted file mode 100644 index eabbfc9ae7993..0000000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration6.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts(3,1): error TS1005: '(' expected. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts(2,5): error TS2391: Function implementation is missing or not immediately following the declaration. - - -==== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts (2 errors) ==== - class C { - *foo - ~~~ -!!! error TS2391: Function implementation is missing or not immediately following the declaration. - } - ~ -!!! error TS1005: '(' expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration6_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration6_es6.errors.txt new file mode 100644 index 0000000000000..b79a61c886692 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration6_es6.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts(3,1): error TS1005: '(' expected. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts(2,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + +==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts (2 errors) ==== + class C { + *foo + ~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + } + ~ +!!! error TS1005: '(' expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration7.types b/tests/baselines/reference/MemberFunctionDeclaration7.types deleted file mode 100644 index 8c72504978202..0000000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration7.types +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration7.ts === -class C { ->C : C - - *foo() { } ->foo : () => void ->T : T -} diff --git a/tests/baselines/reference/MemberFunctionDeclaration7.js b/tests/baselines/reference/MemberFunctionDeclaration7_es6.js similarity index 60% rename from tests/baselines/reference/MemberFunctionDeclaration7.js rename to tests/baselines/reference/MemberFunctionDeclaration7_es6.js index fbb3a10aab756..211713c6e14a2 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration7.js +++ b/tests/baselines/reference/MemberFunctionDeclaration7_es6.js @@ -1,9 +1,9 @@ -//// [MemberFunctionDeclaration7.ts] +//// [MemberFunctionDeclaration7_es6.ts] class C { *foo() { } } -//// [MemberFunctionDeclaration7.js] +//// [MemberFunctionDeclaration7_es6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/MemberFunctionDeclaration7_es6.types b/tests/baselines/reference/MemberFunctionDeclaration7_es6.types new file mode 100644 index 0000000000000..e4c864b9422ad --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration7_es6.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts === +class C { +>C : C + + *foo() { } +>foo : () => void +>T : T +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration8.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration8.errors.txt deleted file mode 100644 index 32f67c71ead4d..0000000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration8.errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(4,12): error TS1127: Invalid character. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(4,14): error TS1129: Statement expected. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(4,19): error TS1005: '(' expected. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(5,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(6,3): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(7,1): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(4,9): error TS2304: Cannot find name 'a'. -tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts(4,16): error TS2391: Function implementation is missing or not immediately following the declaration. - - -==== tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts (8 errors) ==== - class C { - foo() { - // Make sure we don't think of *bar as the start of a generator method. - if (a) # * bar; - -!!! error TS1127: Invalid character. - ~ -!!! error TS1129: Statement expected. - ~ -!!! error TS1005: '(' expected. - ~ -!!! error TS2304: Cannot find name 'a'. - ~~~ -!!! error TS2391: Function implementation is missing or not immediately following the declaration. - return bar; - ~~~~~~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - } - ~ -!!! error TS1128: Declaration or statement expected. - } - ~ -!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt new file mode 100644 index 0000000000000..1b216b72c8918 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,12): error TS1127: Invalid character. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,14): error TS1129: Statement expected. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,19): error TS1005: '(' expected. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(5,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(6,3): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(7,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,9): error TS2304: Cannot find name 'a'. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,16): error TS2391: Function implementation is missing or not immediately following the declaration. + + +==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts (8 errors) ==== + class C { + foo() { + // Make sure we don't think of *bar as the start of a generator method. + if (a) # * bar; + +!!! error TS1127: Invalid character. + ~ +!!! error TS1129: Statement expected. + ~ +!!! error TS1005: '(' expected. + ~ +!!! error TS2304: Cannot find name 'a'. + ~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + return bar; + ~~~~~~ +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + } + ~ +!!! error TS1128: Declaration or statement expected. + } + ~ +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression1.errors.txt b/tests/baselines/reference/YieldExpression1.errors.txt deleted file mode 100644 index ac9bdd04aba2c..0000000000000 --- a/tests/baselines/reference/YieldExpression1.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression1.ts(1,1): error TS2304: Cannot find name 'yield'. - - -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression1.ts (1 errors) ==== - yield; - ~~~~~ -!!! error TS2304: Cannot find name 'yield'. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression1.js b/tests/baselines/reference/YieldExpression1.js deleted file mode 100644 index 84f01f084a692..0000000000000 --- a/tests/baselines/reference/YieldExpression1.js +++ /dev/null @@ -1,5 +0,0 @@ -//// [YieldExpression1.ts] -yield; - -//// [YieldExpression1.js] -yield; diff --git a/tests/baselines/reference/YieldExpression10.js b/tests/baselines/reference/YieldExpression10_es6.js similarity index 54% rename from tests/baselines/reference/YieldExpression10.js rename to tests/baselines/reference/YieldExpression10_es6.js index 8d6a1bcfd74fa..f111e6e1bdf39 100644 --- a/tests/baselines/reference/YieldExpression10.js +++ b/tests/baselines/reference/YieldExpression10_es6.js @@ -1,11 +1,11 @@ -//// [YieldExpression10.ts] +//// [YieldExpression10_es6.ts] var v = { * foo() { yield(foo); } } -//// [YieldExpression10.js] +//// [YieldExpression10_es6.js] var v = { foo: function () { ; } }; diff --git a/tests/baselines/reference/YieldExpression10.types b/tests/baselines/reference/YieldExpression10_es6.types similarity index 90% rename from tests/baselines/reference/YieldExpression10.types rename to tests/baselines/reference/YieldExpression10_es6.types index 1cc2cebafc1d2..e0d3f84c6c865 100644 --- a/tests/baselines/reference/YieldExpression10.types +++ b/tests/baselines/reference/YieldExpression10_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/yieldExpressions/YieldExpression10.ts === +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts === var v = { * foo() { >v : { foo: () => void; } >{ * foo() { yield(foo); }} : { foo: () => void; } diff --git a/tests/baselines/reference/YieldExpression11.js b/tests/baselines/reference/YieldExpression11_es6.js similarity index 68% rename from tests/baselines/reference/YieldExpression11.js rename to tests/baselines/reference/YieldExpression11_es6.js index e69d9b6c06481..306cef3051e6c 100644 --- a/tests/baselines/reference/YieldExpression11.js +++ b/tests/baselines/reference/YieldExpression11_es6.js @@ -1,11 +1,11 @@ -//// [YieldExpression11.ts] +//// [YieldExpression11_es6.ts] class C { *foo() { yield(foo); } } -//// [YieldExpression11.js] +//// [YieldExpression11_es6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/YieldExpression11.types b/tests/baselines/reference/YieldExpression11_es6.types similarity index 84% rename from tests/baselines/reference/YieldExpression11.types rename to tests/baselines/reference/YieldExpression11_es6.types index da261ed041ff4..cdb70b3af0dbb 100644 --- a/tests/baselines/reference/YieldExpression11.types +++ b/tests/baselines/reference/YieldExpression11_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/yieldExpressions/YieldExpression11.ts === +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts === class C { >C : C diff --git a/tests/baselines/reference/YieldExpression12.errors.txt b/tests/baselines/reference/YieldExpression12_es6.errors.txt similarity index 54% rename from tests/baselines/reference/YieldExpression12.errors.txt rename to tests/baselines/reference/YieldExpression12_es6.errors.txt index 47f3edc220df1..10843421a3f4a 100644 --- a/tests/baselines/reference/YieldExpression12.errors.txt +++ b/tests/baselines/reference/YieldExpression12_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression12.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: 'yield' expression must be contained_within a generator declaration. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression12.ts (1 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts (1 errors) ==== class C { constructor() { yield foo diff --git a/tests/baselines/reference/YieldExpression13.js b/tests/baselines/reference/YieldExpression13.js deleted file mode 100644 index f3f36cfecd3e5..0000000000000 --- a/tests/baselines/reference/YieldExpression13.js +++ /dev/null @@ -1,7 +0,0 @@ -//// [YieldExpression13.ts] -function* foo() { yield } - -//// [YieldExpression13.js] -function foo() { - ; -} diff --git a/tests/baselines/reference/YieldExpression13_es6.js b/tests/baselines/reference/YieldExpression13_es6.js new file mode 100644 index 0000000000000..328fc80dbdd0f --- /dev/null +++ b/tests/baselines/reference/YieldExpression13_es6.js @@ -0,0 +1,7 @@ +//// [YieldExpression13_es6.ts] +function* foo() { yield } + +//// [YieldExpression13_es6.js] +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression13.types b/tests/baselines/reference/YieldExpression13_es6.types similarity index 85% rename from tests/baselines/reference/YieldExpression13.types rename to tests/baselines/reference/YieldExpression13_es6.types index 0d1cb06ba5194..23a9fe6299a88 100644 --- a/tests/baselines/reference/YieldExpression13.types +++ b/tests/baselines/reference/YieldExpression13_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/yieldExpressions/YieldExpression13.ts === +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts === function* foo() { yield } >foo : () => void diff --git a/tests/baselines/reference/YieldExpression14.errors.txt b/tests/baselines/reference/YieldExpression14_es6.errors.txt similarity index 53% rename from tests/baselines/reference/YieldExpression14.errors.txt rename to tests/baselines/reference/YieldExpression14_es6.errors.txt index 89d0cf477cfe6..baeaf3ba30ed3 100644 --- a/tests/baselines/reference/YieldExpression14.errors.txt +++ b/tests/baselines/reference/YieldExpression14_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression14.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: 'yield' expression must be contained_within a generator declaration. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression14.ts (1 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts (1 errors) ==== class C { foo() { yield foo diff --git a/tests/baselines/reference/YieldExpression15.errors.txt b/tests/baselines/reference/YieldExpression15_es6.errors.txt similarity index 52% rename from tests/baselines/reference/YieldExpression15.errors.txt rename to tests/baselines/reference/YieldExpression15_es6.errors.txt index 3f90fce59932c..5e548799f5d5b 100644 --- a/tests/baselines/reference/YieldExpression15.errors.txt +++ b/tests/baselines/reference/YieldExpression15_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression15.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: 'yield' expression must be contained_within a generator declaration. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression15.ts (1 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts (1 errors) ==== var v = () => { yield foo ~~~~~ diff --git a/tests/baselines/reference/YieldExpression16.errors.txt b/tests/baselines/reference/YieldExpression16_es6.errors.txt similarity index 55% rename from tests/baselines/reference/YieldExpression16.errors.txt rename to tests/baselines/reference/YieldExpression16_es6.errors.txt index 8fb1775222dd3..e5a9b93eecea8 100644 --- a/tests/baselines/reference/YieldExpression16.errors.txt +++ b/tests/baselines/reference/YieldExpression16_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression16.ts(3,5): error TS1163: 'yield' expression must be contained_within a generator declaration. +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.ts (1 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (1 errors) ==== function* foo() { function bar() { yield foo; diff --git a/tests/baselines/reference/YieldExpression17.errors.txt b/tests/baselines/reference/YieldExpression17.errors.txt deleted file mode 100644 index 9477ff2f13400..0000000000000 --- a/tests/baselines/reference/YieldExpression17.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression17.ts(1,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/es6/yieldExpressions/YieldExpression17.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.ts (2 errors) ==== - var v = { get foo() { yield foo; } } - ~~~ -!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression17_es6.errors.txt b/tests/baselines/reference/YieldExpression17_es6.errors.txt new file mode 100644 index 0000000000000..38969a9c6fbb5 --- /dev/null +++ b/tests/baselines/reference/YieldExpression17_es6.errors.txt @@ -0,0 +1,10 @@ +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 (2 errors) ==== + var v = { get foo() { yield foo; } } + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression18.errors.txt b/tests/baselines/reference/YieldExpression18_es6.errors.txt similarity index 50% rename from tests/baselines/reference/YieldExpression18.errors.txt rename to tests/baselines/reference/YieldExpression18_es6.errors.txt index 2707e5780b04c..3a67acdebcdff 100644 --- a/tests/baselines/reference/YieldExpression18.errors.txt +++ b/tests/baselines/reference/YieldExpression18_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression18.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: 'yield' expression must be contained_within a generator declaration. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression18.ts (1 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts (1 errors) ==== "use strict"; yield(foo); ~~~~~ diff --git a/tests/baselines/reference/YieldExpression19.js b/tests/baselines/reference/YieldExpression19_es6.js similarity index 71% rename from tests/baselines/reference/YieldExpression19.js rename to tests/baselines/reference/YieldExpression19_es6.js index 39b9cda44f9ad..91643e09b0ed4 100644 --- a/tests/baselines/reference/YieldExpression19.js +++ b/tests/baselines/reference/YieldExpression19_es6.js @@ -1,4 +1,4 @@ -//// [YieldExpression19.ts] +//// [YieldExpression19_es6.ts] function*foo() { function bar() { function* quux() { @@ -7,7 +7,7 @@ function*foo() { } } -//// [YieldExpression19.js] +//// [YieldExpression19_es6.js] function foo() { function bar() { function quux() { diff --git a/tests/baselines/reference/YieldExpression19.types b/tests/baselines/reference/YieldExpression19_es6.types similarity index 88% rename from tests/baselines/reference/YieldExpression19.types rename to tests/baselines/reference/YieldExpression19_es6.types index 315c1a541ccfb..a8af884c98f1d 100644 --- a/tests/baselines/reference/YieldExpression19.types +++ b/tests/baselines/reference/YieldExpression19_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/yieldExpressions/YieldExpression19.ts === +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts === function*foo() { >foo : () => void diff --git a/tests/baselines/reference/YieldExpression1_es6.errors.txt b/tests/baselines/reference/YieldExpression1_es6.errors.txt new file mode 100644 index 0000000000000..f8a13fe54099b --- /dev/null +++ b/tests/baselines/reference/YieldExpression1_es6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/yieldExpressions/YieldExpression1_es6.ts(1,1): error TS2304: Cannot find name 'yield'. + + +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression1_es6.ts (1 errors) ==== + yield; + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression1_es6.js b/tests/baselines/reference/YieldExpression1_es6.js new file mode 100644 index 0000000000000..cb5c097df2c2e --- /dev/null +++ b/tests/baselines/reference/YieldExpression1_es6.js @@ -0,0 +1,5 @@ +//// [YieldExpression1_es6.ts] +yield; + +//// [YieldExpression1_es6.js] +yield; diff --git a/tests/baselines/reference/YieldExpression2.errors.txt b/tests/baselines/reference/YieldExpression2.errors.txt deleted file mode 100644 index 4b4e549d7bfeb..0000000000000 --- a/tests/baselines/reference/YieldExpression2.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression2.ts(1,1): error TS1163: 'yield' expression must be contained_within a generator declaration. - - -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression2.ts (1 errors) ==== - yield foo; - ~~~~~ -!!! error TS1163: 'yield' expression must be contained_within a generator declaration. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression2_es6.errors.txt b/tests/baselines/reference/YieldExpression2_es6.errors.txt new file mode 100644 index 0000000000000..553dab51fc20f --- /dev/null +++ b/tests/baselines/reference/YieldExpression2_es6.errors.txt @@ -0,0 +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 errors) ==== + yield foo; + ~~~~~ +!!! error TS1163: 'yield' expression must be contained_within a generator declaration. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression3.js b/tests/baselines/reference/YieldExpression3.js deleted file mode 100644 index 39a1c419e9b1d..0000000000000 --- a/tests/baselines/reference/YieldExpression3.js +++ /dev/null @@ -1,11 +0,0 @@ -//// [YieldExpression3.ts] -function* foo() { - yield - yield -} - -//// [YieldExpression3.js] -function foo() { - ; - ; -} diff --git a/tests/baselines/reference/YieldExpression3_es6.js b/tests/baselines/reference/YieldExpression3_es6.js new file mode 100644 index 0000000000000..cc3716587eae7 --- /dev/null +++ b/tests/baselines/reference/YieldExpression3_es6.js @@ -0,0 +1,11 @@ +//// [YieldExpression3_es6.ts] +function* foo() { + yield + yield +} + +//// [YieldExpression3_es6.js] +function foo() { + ; + ; +} diff --git a/tests/baselines/reference/YieldExpression3.types b/tests/baselines/reference/YieldExpression3_es6.types similarity index 85% rename from tests/baselines/reference/YieldExpression3.types rename to tests/baselines/reference/YieldExpression3_es6.types index 702584b44f866..f9ad4faffdb07 100644 --- a/tests/baselines/reference/YieldExpression3.types +++ b/tests/baselines/reference/YieldExpression3_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/yieldExpressions/YieldExpression3.ts === +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts === function* foo() { >foo : () => void diff --git a/tests/baselines/reference/YieldExpression4.js b/tests/baselines/reference/YieldExpression4_es6.js similarity index 50% rename from tests/baselines/reference/YieldExpression4.js rename to tests/baselines/reference/YieldExpression4_es6.js index e85a41e85814a..84b11a03a2ce9 100644 --- a/tests/baselines/reference/YieldExpression4.js +++ b/tests/baselines/reference/YieldExpression4_es6.js @@ -1,10 +1,10 @@ -//// [YieldExpression4.ts] +//// [YieldExpression4_es6.ts] function* foo() { yield; yield; } -//// [YieldExpression4.js] +//// [YieldExpression4_es6.js] function foo() { ; ; diff --git a/tests/baselines/reference/YieldExpression4.types b/tests/baselines/reference/YieldExpression4_es6.types similarity index 85% rename from tests/baselines/reference/YieldExpression4.types rename to tests/baselines/reference/YieldExpression4_es6.types index cd57f45ba730a..083d145d06f18 100644 --- a/tests/baselines/reference/YieldExpression4.types +++ b/tests/baselines/reference/YieldExpression4_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/yieldExpressions/YieldExpression4.ts === +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts === function* foo() { >foo : () => void diff --git a/tests/baselines/reference/YieldExpression5.errors.txt b/tests/baselines/reference/YieldExpression5_es6.errors.txt similarity index 51% rename from tests/baselines/reference/YieldExpression5.errors.txt rename to tests/baselines/reference/YieldExpression5_es6.errors.txt index 8036304387449..3ce8f20c985d2 100644 --- a/tests/baselines/reference/YieldExpression5.errors.txt +++ b/tests/baselines/reference/YieldExpression5_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression5.ts(3,1): error TS1109: Expression expected. +tests/cases/conformance/es6/yieldExpressions/YieldExpression5_es6.ts(3,1): error TS1109: Expression expected. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression5.ts (1 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression5_es6.ts (1 errors) ==== function* foo() { yield* } diff --git a/tests/baselines/reference/YieldExpression6.js b/tests/baselines/reference/YieldExpression6.js deleted file mode 100644 index 27fda405cd715..0000000000000 --- a/tests/baselines/reference/YieldExpression6.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [YieldExpression6.ts] -function* foo() { - yield*foo -} - -//// [YieldExpression6.js] -function foo() { - ; -} diff --git a/tests/baselines/reference/YieldExpression6_es6.js b/tests/baselines/reference/YieldExpression6_es6.js new file mode 100644 index 0000000000000..5024e9bbd4015 --- /dev/null +++ b/tests/baselines/reference/YieldExpression6_es6.js @@ -0,0 +1,9 @@ +//// [YieldExpression6_es6.ts] +function* foo() { + yield*foo +} + +//// [YieldExpression6_es6.js] +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression6.types b/tests/baselines/reference/YieldExpression6_es6.types similarity index 85% rename from tests/baselines/reference/YieldExpression6.types rename to tests/baselines/reference/YieldExpression6_es6.types index 6df16df5271f4..fd410d2c95919 100644 --- a/tests/baselines/reference/YieldExpression6.types +++ b/tests/baselines/reference/YieldExpression6_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/yieldExpressions/YieldExpression6.ts === +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts === function* foo() { >foo : () => void diff --git a/tests/baselines/reference/YieldExpression7.js b/tests/baselines/reference/YieldExpression7.js deleted file mode 100644 index 152fe36db5031..0000000000000 --- a/tests/baselines/reference/YieldExpression7.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [YieldExpression7.ts] -function* foo() { - yield foo -} - -//// [YieldExpression7.js] -function foo() { - ; -} diff --git a/tests/baselines/reference/YieldExpression7_es6.js b/tests/baselines/reference/YieldExpression7_es6.js new file mode 100644 index 0000000000000..96ef5af107e19 --- /dev/null +++ b/tests/baselines/reference/YieldExpression7_es6.js @@ -0,0 +1,9 @@ +//// [YieldExpression7_es6.ts] +function* foo() { + yield foo +} + +//// [YieldExpression7_es6.js] +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression7.types b/tests/baselines/reference/YieldExpression7_es6.types similarity index 85% rename from tests/baselines/reference/YieldExpression7.types rename to tests/baselines/reference/YieldExpression7_es6.types index 40d4506c86ee2..17e1a3b2bfb0d 100644 --- a/tests/baselines/reference/YieldExpression7.types +++ b/tests/baselines/reference/YieldExpression7_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/yieldExpressions/YieldExpression7.ts === +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts === function* foo() { >foo : () => void diff --git a/tests/baselines/reference/YieldExpression8.errors.txt b/tests/baselines/reference/YieldExpression8_es6.errors.txt similarity index 54% rename from tests/baselines/reference/YieldExpression8.errors.txt rename to tests/baselines/reference/YieldExpression8_es6.errors.txt index ee0e57893135b..f4dd30b1a1947 100644 --- a/tests/baselines/reference/YieldExpression8.errors.txt +++ b/tests/baselines/reference/YieldExpression8_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression8.ts(1,1): error TS2304: Cannot find name 'yield'. +tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8.ts (1 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (1 errors) ==== yield(foo); ~~~~~ !!! error TS2304: Cannot find name 'yield'. diff --git a/tests/baselines/reference/YieldExpression8.js b/tests/baselines/reference/YieldExpression8_es6.js similarity index 54% rename from tests/baselines/reference/YieldExpression8.js rename to tests/baselines/reference/YieldExpression8_es6.js index 07b80cf3e51aa..190c2cc3da569 100644 --- a/tests/baselines/reference/YieldExpression8.js +++ b/tests/baselines/reference/YieldExpression8_es6.js @@ -1,10 +1,10 @@ -//// [YieldExpression8.ts] +//// [YieldExpression8_es6.ts] yield(foo); function* foo() { yield(foo); } -//// [YieldExpression8.js] +//// [YieldExpression8_es6.js] yield(foo); function foo() { ; diff --git a/tests/baselines/reference/YieldExpression9.js b/tests/baselines/reference/YieldExpression9_es6.js similarity index 50% rename from tests/baselines/reference/YieldExpression9.js rename to tests/baselines/reference/YieldExpression9_es6.js index 72365abcd70e8..978e0d455bddc 100644 --- a/tests/baselines/reference/YieldExpression9.js +++ b/tests/baselines/reference/YieldExpression9_es6.js @@ -1,9 +1,9 @@ -//// [YieldExpression9.ts] +//// [YieldExpression9_es6.ts] var v = function*() { yield(foo); } -//// [YieldExpression9.js] +//// [YieldExpression9_es6.js] var v = function () { ; }; diff --git a/tests/baselines/reference/YieldExpression9.types b/tests/baselines/reference/YieldExpression9_es6.types similarity index 88% rename from tests/baselines/reference/YieldExpression9.types rename to tests/baselines/reference/YieldExpression9_es6.types index 4c5242369c000..a570d2f09a0a7 100644 --- a/tests/baselines/reference/YieldExpression9.types +++ b/tests/baselines/reference/YieldExpression9_es6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/yieldExpressions/YieldExpression9.ts === +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts === var v = function*() { >v : () => void >function*() { yield(foo);} : () => void diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8_es6.ts diff --git a/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts b/tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts similarity index 100% rename from tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9.ts rename to tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration12_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration2_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration4_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts diff --git a/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts b/tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9.ts rename to tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts diff --git a/tests/cases/conformance/es6/functionExpressions/FunctionExpression1.ts b/tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionExpressions/FunctionExpression1.ts rename to tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts diff --git a/tests/cases/conformance/es6/functionExpressions/FunctionExpression2.ts b/tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionExpressions/FunctionExpression2.ts rename to tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1.ts rename to tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2.ts rename to tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments2_es6.ts diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3.ts rename to tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments3_es6.ts diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4.ts rename to tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments4_es6.ts diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5.ts rename to tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts diff --git a/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6.ts b/tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6_es6.ts similarity index 100% rename from tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6.ts rename to tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments6_es6.ts diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration1.ts b/tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts similarity index 100% rename from tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration1.ts rename to tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration2.ts b/tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts similarity index 100% rename from tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration2.ts rename to tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts b/tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts similarity index 100% rename from tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration3.ts rename to tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts b/tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration4_es6.ts similarity index 100% rename from tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration4.ts rename to tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration4_es6.ts diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts b/tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration5_es6.ts similarity index 100% rename from tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration5.ts rename to tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration5_es6.ts diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts b/tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts similarity index 100% rename from tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration6.ts rename to tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration7.ts b/tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts similarity index 100% rename from tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration7.ts rename to tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts diff --git a/tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts b/tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts similarity index 100% rename from tests/cases/conformance/es6/fmmberFunctionDeclarations/MemberFunctionDeclaration8.ts rename to tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression10.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression10.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression11.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression11.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression12.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression12.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression13.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression13.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression14.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression14.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression15.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression15.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression16.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression16.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression17.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression17.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression18.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression18.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression19.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression19.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression1.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression1_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression1.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression1_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression2.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression2.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression3.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression3.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression4.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression4.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression5.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression5_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression5.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression5_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression6.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression6.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression7.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression7.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression8.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression8.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts diff --git a/tests/cases/conformance/es6/yieldExpressions/YieldExpression9.ts b/tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts similarity index 100% rename from tests/cases/conformance/es6/yieldExpressions/YieldExpression9.ts rename to tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts From d2aa68822679607b2fd9adea3b73726a847ca6ff Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 00:19:50 -0800 Subject: [PATCH 10/20] Don't store both boolean context flags and a unified flags value. --- src/compiler/parser.ts | 87 +++++++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 88f4a9b4adb44..231120021e999 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -895,42 +895,35 @@ module ts { // // Getting this all correct is tricky and requires careful reading of the grammar to // understand when these values should be changed versus when they should be inherited. - var strictModeContext = false; - var disallowInContext = false; - var yieldContext: boolean = false; - var generatorParameterContext: boolean = false; - var contextFlags: number = 0; + var contextFlags: ParserContextFlags = 0; - function updateContextFlags() { - contextFlags = - (strictModeContext ? ParserContextFlags.ParsedInStrictModeContext : 0) | - (disallowInContext ? ParserContextFlags.ParsedInDisallowInContext : 0) | - (yieldContext ? ParserContextFlags.ParsedInYieldContext : 0) | - (generatorParameterContext ? ParserContextFlags.ParsedInGeneratorParameterContext : 0); + function setContextFlag(val: Boolean, flag: ParserContextFlags) { + if (val) { + contextFlags |= flag; + } + else { + contextFlags &= ~flag; + } } function setStrictModeContext(val: boolean) { - strictModeContext = val; - updateContextFlags(); + setContextFlag(val, ParserContextFlags.ParsedInStrictModeContext); } function setDisallowInContext(val: boolean) { - disallowInContext = val; - updateContextFlags(); + setContextFlag(val, ParserContextFlags.ParsedInDisallowInContext); } function setYieldContext(val: boolean) { - yieldContext = val; - updateContextFlags(); + setContextFlag(val, ParserContextFlags.ParsedInYieldContext); } function setGeneratorParameterContext(val: boolean) { - generatorParameterContext = val; - updateContextFlags(); + setContextFlag(val, ParserContextFlags.ParsedInGeneratorParameterContext); } function allowInAnd(func: () => T): T { - if (disallowInContext) { + if (contextFlags & ParserContextFlags.ParsedInDisallowInContext) { setDisallowInContext(false); var result = func(); setDisallowInContext(true); @@ -942,7 +935,7 @@ module ts { } function disallowInAnd(func: () => T): T { - if (disallowInContext) { + if (contextFlags & ParserContextFlags.ParsedInDisallowInContext) { // no need to do anything special if 'in' is already disallowed. return func(); } @@ -954,7 +947,7 @@ module ts { } function enterYieldContextAnd(func: () => T): T { - if (yieldContext) { + if (contextFlags & ParserContextFlags.ParsedInYieldContext) { // no need to do anything special if we're already in the [Yield] context. return func(); } @@ -966,7 +959,7 @@ module ts { } function exitYieldContextAnd(func: () => T): T { - if (yieldContext) { + if (contextFlags & ParserContextFlags.ParsedInYieldContext) { setYieldContext(false); var result = func(); setYieldContext(true); @@ -977,6 +970,22 @@ module ts { return func(); } + function inYieldContext() { + return (contextFlags & ParserContextFlags.ParsedInYieldContext) !== 0; + } + + function inStrictModeContext() { + return (contextFlags & ParserContextFlags.ParsedInStrictModeContext) !== 0; + } + + function inGeneratorParameterContext() { + return (contextFlags & ParserContextFlags.ParsedInGeneratorParameterContext) !== 0; + } + + function inDisallowInContext() { + return (contextFlags & ParserContextFlags.ParsedInDisallowInContext) !== 0; + } + function getLineStarts(): number[] { return lineStarts || (lineStarts = computeLineStarts(sourceText)); } @@ -1108,11 +1117,11 @@ module ts { // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is // considered a keyword and is not an identifier. - if (token === SyntaxKind.YieldKeyword && yieldContext) { + if (token === SyntaxKind.YieldKeyword && inYieldContext()) { return false; } - return strictModeContext ? token > SyntaxKind.LastFutureReservedWord : token > SyntaxKind.LastReservedWord; + return inStrictModeContext() ? token > SyntaxKind.LastFutureReservedWord : token > SyntaxKind.LastReservedWord; } function parseExpected(t: SyntaxKind): boolean { @@ -1358,13 +1367,13 @@ module ts { parsingContext |= 1 << kind; var result = >[]; result.pos = getNodePos(); - var savedStrictModeContext = strictModeContext; + var savedStrictModeContext = inStrictModeContext(); while (!isListTerminator(kind)) { if (isListElement(kind, /* inErrorRecovery */ false)) { var element = parseElement(); result.push(element); // test elements only if we are not already in strict mode - if (!strictModeContext && checkForStrictMode) { + if (!inStrictModeContext() && checkForStrictMode) { if (isPrologueDirective(element)) { if (isUseStrictPrologueDirective(element)) { setStrictModeContext(true); @@ -1629,7 +1638,7 @@ module ts { // [+GeneratorParameter]BindingIdentifier[Yield]Initializer[In]opt // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt - node.name = generatorParameterContext + node.name = inGeneratorParameterContext() ? enterYieldContextAnd(parseIdentifier) : parseIdentifier(); @@ -1649,7 +1658,7 @@ module ts { node.flags |= NodeFlags.QuestionMark; } node.type = parseParameterType(); - node.initializer = generatorParameterContext + node.initializer = inGeneratorParameterContext() ? exitYieldContextAnd(parseParameterInitializer) : parseParameterInitializer(); @@ -1714,8 +1723,8 @@ module ts { // [+GeneratorParameter]BindingIdentifier[Yield]Initializer[In]opt // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt if (parseExpected(SyntaxKind.OpenParenToken)) { - var savedYieldContext = yieldContext; - var savedGeneratorParameterContext = generatorParameterContext; + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); setYieldContext(_yieldContext); setGeneratorParameterContext(_generatorParameterContext); @@ -1969,8 +1978,8 @@ module ts { function parseType(): TypeNode { // The rules about 'yield' only apply to actual code/expression contexts. They don't // apply to 'type' contexts. So we disable these parameters here before moving on. - var savedYieldContext = yieldContext; - var savedGeneratorParameterContext = generatorParameterContext; + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); setYieldContext(false); setGeneratorParameterContext(false); @@ -2132,11 +2141,11 @@ module ts { if (token === SyntaxKind.YieldKeyword) { // If we have a 'yield' keyword, and htis is a context where yield expressions are // allowed, then definitely parse out a yield expression. - if (yieldContext) { + if (inYieldContext()) { return true; } - if (strictModeContext) { + if (inStrictModeContext()) { // If we're in strict mode, then 'yield' is a keyword, could only ever start // a yield expression. return true; @@ -2390,7 +2399,7 @@ module ts { while (true) { reScanGreaterToken(); var precedence = getOperatorPrecedence(); - if (precedence && precedence > minPrecedence && (!disallowInContext || token !== SyntaxKind.InKeyword)) { + if (precedence && precedence > minPrecedence && (!inDisallowInContext() || token !== SyntaxKind.InKeyword)) { var operator = token; nextToken(); expr = makeBinaryExpression(expr, operator, parseBinaryOperators(parseUnaryExpression(), precedence)); @@ -2824,7 +2833,7 @@ module ts { } function parseFunctionBlock(allowYield: boolean, ignoreMissingOpenBrace: boolean): Block { - var savedYieldContext = yieldContext; + var savedYieldContext = inYieldContext(); setYieldContext(allowYield); var block = parseBlock(ignoreMissingOpenBrace, /*checkForStrictMode*/ true); @@ -3430,7 +3439,7 @@ module ts { // [~GeneratorParameter]ClassHeritage[?Yield]opt { ClassBody[?Yield]opt } // [+GeneratorParameter] ClassHeritageopt { ClassBodyopt } - node.baseType = generatorParameterContext + node.baseType = inGeneratorParameterContext() ? exitYieldContextAnd(parseClassBaseType) : parseClassBaseType(); @@ -3442,7 +3451,7 @@ module ts { // [~GeneratorParameter]ClassHeritage[?Yield]opt { ClassBody[?Yield]opt } // [+GeneratorParameter] ClassHeritageopt { ClassBodyopt } - node.members = generatorParameterContext + node.members = inGeneratorParameterContext() ? exitYieldContextAnd(parseClassMembers) : parseClassMembers(); parseExpected(SyntaxKind.CloseBraceToken); From 1bf3ba85a266384e3bdad8e4fe8d332dcbf090e9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 00:23:03 -0800 Subject: [PATCH 11/20] Initialize enum in a way that makes it clearer that it is a Flags-enum. --- src/compiler/types.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 68d74385c03bd..ea0c8956ce844 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -281,10 +281,10 @@ module ts { export const enum ParserContextFlags { // Set if this node was parsed in strict mode. Used for grammar error checks, as well as // checking if the node can be reused in incremental settings. - ParsedInStrictModeContext = 0x1, - ParsedInDisallowInContext = 0x2, - ParsedInYieldContext = 0x4, - ParsedInGeneratorParameterContext = 0x8, + ParsedInStrictModeContext = 1 << 0, + ParsedInDisallowInContext = 1 << 1, + ParsedInYieldContext = 1 << 2, + ParsedInGeneratorParameterContext = 1 << 3, } export interface Node extends TextRange { From 530917179892bb0dfd34af6f55d4a32c97cc42eb Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 00:27:32 -0800 Subject: [PATCH 12/20] Rename methods as per CR feedback. --- src/compiler/parser.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 231120021e999..9da5d5cb1110d 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -946,7 +946,7 @@ module ts { return result; } - function enterYieldContextAnd(func: () => T): T { + function doInYieldContext(func: () => T): T { if (contextFlags & ParserContextFlags.ParsedInYieldContext) { // no need to do anything special if we're already in the [Yield] context. return func(); @@ -958,7 +958,7 @@ module ts { return result; } - function exitYieldContextAnd(func: () => T): T { + function doOutsideOfYieldContext(func: () => T): T { if (contextFlags & ParserContextFlags.ParsedInYieldContext) { setYieldContext(false); var result = func(); @@ -1639,7 +1639,7 @@ module ts { // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt node.name = inGeneratorParameterContext() - ? enterYieldContextAnd(parseIdentifier) + ? doInYieldContext(parseIdentifier) : parseIdentifier(); if (node.name.kind === SyntaxKind.Missing && node.flags === 0 && isModifier(token)) { @@ -1659,7 +1659,7 @@ module ts { } node.type = parseParameterType(); node.initializer = inGeneratorParameterContext() - ? exitYieldContextAnd(parseParameterInitializer) + ? doOutsideOfYieldContext(parseParameterInitializer) : parseParameterInitializer(); // Do not check for initializers in an ambient context for parameters. This is not @@ -2787,7 +2787,7 @@ module ts { var pos = getNodePos(); parseExpected(SyntaxKind.FunctionKeyword); var isGenerator = parseOptional(SyntaxKind.AsteriskToken); - var name = isGenerator ? enterYieldContextAnd(parseOptionalIdentifier) : parseOptionalIdentifier(); + var name = isGenerator ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator); var body = parseFunctionBlock(/*allowYield:*/ isGenerator, /* ignoreMissingOpenBrace */ false); @@ -3440,7 +3440,7 @@ module ts { // [+GeneratorParameter] ClassHeritageopt { ClassBodyopt } node.baseType = inGeneratorParameterContext() - ? exitYieldContextAnd(parseClassBaseType) + ? doOutsideOfYieldContext(parseClassBaseType) : parseClassBaseType(); if (parseOptional(SyntaxKind.ImplementsKeyword)) { @@ -3452,7 +3452,7 @@ module ts { // [+GeneratorParameter] ClassHeritageopt { ClassBodyopt } node.members = inGeneratorParameterContext() - ? exitYieldContextAnd(parseClassMembers) + ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); parseExpected(SyntaxKind.CloseBraceToken); } From ed2cd997bc8e88210469bdd317e335802132d3c6 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 00:30:41 -0800 Subject: [PATCH 13/20] An asterisk is not a legal start of an enum member. --- src/compiler/parser.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9da5d5cb1110d..fbf98071ff8a1 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1262,6 +1262,7 @@ module ts { case ParsingContext.ClassMembers: return lookAhead(isClassMemberStart); case ParsingContext.EnumMembers: + return isPropertyName(); case ParsingContext.ObjectLiteralMembers: return token === SyntaxKind.AsteriskToken || isPropertyName(); case ParsingContext.BaseTypeReferences: From dac0a910f7d2d87d95109978b4f228137b5cdd0a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 00:35:18 -0800 Subject: [PATCH 14/20] Don't use underscores in names. --- src/compiler/parser.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index fbf98071ff8a1..b4d322537d0d0 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1708,7 +1708,7 @@ module ts { // Because we use this for index signatures as well, we sometimes use // parentheses, and sometimes use brackets. - function parseParameterList(_yieldContext: boolean, _generatorParameterContext: boolean) { + function parseParameterList(yieldContext: boolean, generatorParameterContext: boolean) { // FormalParameters[Yield,GeneratorParameter] : // ... // @@ -1727,8 +1727,8 @@ module ts { var savedYieldContext = inYieldContext(); var savedGeneratorParameterContext = inGeneratorParameterContext(); - setYieldContext(_yieldContext); - setGeneratorParameterContext(_generatorParameterContext); + setYieldContext(yieldContext); + setGeneratorParameterContext(generatorParameterContext); var result = parseDelimitedList(ParsingContext.Parameters, parseParameter); parseExpected(SyntaxKind.CloseParenToken); From bdaccf6f81f5db53dcb7be34749979afcc48c974 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 00:39:15 -0800 Subject: [PATCH 15/20] Rename parser context flags. --- src/compiler/parser.ts | 46 +++++++++++++++++++++--------------------- src/compiler/types.ts | 8 ++++---- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b4d322537d0d0..15e7692e01997 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -907,23 +907,23 @@ module ts { } function setStrictModeContext(val: boolean) { - setContextFlag(val, ParserContextFlags.ParsedInStrictModeContext); + setContextFlag(val, ParserContextFlags.StrictMode); } function setDisallowInContext(val: boolean) { - setContextFlag(val, ParserContextFlags.ParsedInDisallowInContext); + setContextFlag(val, ParserContextFlags.DisallowIn); } function setYieldContext(val: boolean) { - setContextFlag(val, ParserContextFlags.ParsedInYieldContext); + setContextFlag(val, ParserContextFlags.Yield); } function setGeneratorParameterContext(val: boolean) { - setContextFlag(val, ParserContextFlags.ParsedInGeneratorParameterContext); + setContextFlag(val, ParserContextFlags.GeneratorParameter); } function allowInAnd(func: () => T): T { - if (contextFlags & ParserContextFlags.ParsedInDisallowInContext) { + if (contextFlags & ParserContextFlags.DisallowIn) { setDisallowInContext(false); var result = func(); setDisallowInContext(true); @@ -935,7 +935,7 @@ module ts { } function disallowInAnd(func: () => T): T { - if (contextFlags & ParserContextFlags.ParsedInDisallowInContext) { + if (contextFlags & ParserContextFlags.DisallowIn) { // no need to do anything special if 'in' is already disallowed. return func(); } @@ -947,7 +947,7 @@ module ts { } function doInYieldContext(func: () => T): T { - if (contextFlags & ParserContextFlags.ParsedInYieldContext) { + if (contextFlags & ParserContextFlags.Yield) { // no need to do anything special if we're already in the [Yield] context. return func(); } @@ -959,7 +959,7 @@ module ts { } function doOutsideOfYieldContext(func: () => T): T { - if (contextFlags & ParserContextFlags.ParsedInYieldContext) { + if (contextFlags & ParserContextFlags.Yield) { setYieldContext(false); var result = func(); setYieldContext(true); @@ -971,19 +971,19 @@ module ts { } function inYieldContext() { - return (contextFlags & ParserContextFlags.ParsedInYieldContext) !== 0; + return (contextFlags & ParserContextFlags.Yield) !== 0; } function inStrictModeContext() { - return (contextFlags & ParserContextFlags.ParsedInStrictModeContext) !== 0; + return (contextFlags & ParserContextFlags.StrictMode) !== 0; } function inGeneratorParameterContext() { - return (contextFlags & ParserContextFlags.ParsedInGeneratorParameterContext) !== 0; + return (contextFlags & ParserContextFlags.GeneratorParameter) !== 0; } function inDisallowInContext() { - return (contextFlags & ParserContextFlags.ParsedInDisallowInContext) !== 0; + return (contextFlags & ParserContextFlags.DisallowIn) !== 0; } function getLineStarts(): number[] { @@ -4006,7 +4006,7 @@ module ts { } function checkBinaryExpression(node: BinaryExpression) { - if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & ParserContextFlags.StrictMode) { if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { if (isEvalOrArgumentsIdentifier(node.left)) { // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an @@ -4158,7 +4158,7 @@ module ts { var colonStart = skipTrivia(sourceText, node.variable.end); return grammarErrorAtPos(colonStart, ":".length, Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); } - if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.variable)) { + if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.variable)) { // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the // Catch production is eval or arguments return reportInvalidUseInStrictMode(node.variable); @@ -4278,7 +4278,7 @@ module ts { } function checkFunctionName(name: Node) { - if (name && name.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(name)) { + if (name && name.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(name)) { // It is a SyntaxError to use within strict mode code the identifiers eval or arguments as the // Identifier of a FunctionLikeDeclaration or FunctionExpression or as a formal parameter name(13.1) return reportInvalidUseInStrictMode(name); @@ -4399,7 +4399,7 @@ module ts { var GetAccessor = 2; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; - var inStrictMode = (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext) !== 0; + var inStrictMode = (node.parserContextFlags & ParserContextFlags.StrictMode) !== 0; for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; @@ -4463,7 +4463,7 @@ module ts { function checkNumericLiteral(node: LiteralExpression): boolean { if (node.flags & NodeFlags.OctalLiteral) { - if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & ParserContextFlags.StrictMode) { return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); } else if (languageVersion >= ScriptTarget.ES5) { @@ -4607,7 +4607,7 @@ module ts { // or if its FunctionBody is strict code(11.1.5). // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) - if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.name)) { + if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name)) { return reportInvalidUseInStrictMode(node.name); } } @@ -4666,13 +4666,13 @@ module ts { // The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. - if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.operand)) { + if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.operand)) { return reportInvalidUseInStrictMode(node.operand); } } function checkPrefixOperator(node: UnaryExpression) { - if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & ParserContextFlags.StrictMode) { // The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator @@ -4857,7 +4857,7 @@ module ts { if (!inAmbientContext && !node.initializer && isConst(node)) { return grammarErrorOnNode(node, Diagnostics.const_declarations_must_be_initialized); } - if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext && isEvalOrArgumentsIdentifier(node.name)) { + if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name)) { // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code // and its Identifier is eval or arguments return reportInvalidUseInStrictMode(node.name); @@ -4919,7 +4919,7 @@ module ts { } function checkWithStatement(node: WithStatement): boolean { - if (node.parserContextFlags & ParserContextFlags.ParsedInStrictModeContext) { + if (node.parserContextFlags & ParserContextFlags.StrictMode) { // Strict mode code may not include a WithStatement. The occurrence of a WithStatement in such // a context is an return grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); @@ -4927,7 +4927,7 @@ module ts { } function checkYieldExpression(node: YieldExpression): boolean { - if (!(node.parserContextFlags & ParserContextFlags.ParsedInYieldContext)) { + if (!(node.parserContextFlags & ParserContextFlags.Yield)) { return grammarErrorOnFirstToken(node, Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration); } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ea0c8956ce844..328422d9f6e40 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -281,10 +281,10 @@ module ts { export const enum ParserContextFlags { // Set if this node was parsed in strict mode. Used for grammar error checks, as well as // checking if the node can be reused in incremental settings. - ParsedInStrictModeContext = 1 << 0, - ParsedInDisallowInContext = 1 << 1, - ParsedInYieldContext = 1 << 2, - ParsedInGeneratorParameterContext = 1 << 3, + StrictMode = 1 << 0, + DisallowIn = 1 << 1, + Yield = 1 << 2, + GeneratorParameter = 1 << 3, } export interface Node extends TextRange { From 626e90ed3f342c1f268bad7d2936e3841e2f67bd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 00:45:25 -0800 Subject: [PATCH 16/20] Mark generator functions with an appropriate nodeflag. --- src/compiler/parser.ts | 21 ++++++++++++++++++--- src/compiler/types.ts | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 15e7692e01997..8906bde952548 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2721,6 +2721,9 @@ module ts { if (isGenerator || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { node = createNode(SyntaxKind.PropertyAssignment, nodePos); node.name = propertyName; + if (isGenerator) { + node.flags |= NodeFlags.Generator; + } var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator); var body = parseFunctionBlock(isGenerator, /* ignoreMissingOpenBrace */ false); @@ -2792,15 +2795,19 @@ module ts { var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator); var body = parseFunctionBlock(/*allowYield:*/ isGenerator, /* ignoreMissingOpenBrace */ false); - return makeFunctionExpression(SyntaxKind.FunctionExpression, pos, name, sig, body); + return makeFunctionExpression(SyntaxKind.FunctionExpression, pos, name, sig, body, isGenerator ? NodeFlags.Generator : undefined); } function parseOptionalIdentifier() { return isIdentifier() ? parseIdentifier() : undefined; } - function makeFunctionExpression(kind: SyntaxKind, pos: number, name: Identifier, sig: ParsedSignature, body: Node): FunctionExpression { + function makeFunctionExpression(kind: SyntaxKind, pos: number, name: Identifier, sig: ParsedSignature, body: Node, flags?: NodeFlags): FunctionExpression { var node = createNode(kind, pos); + if (flags) { + node.flags = flags; + } + node.name = name; node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; @@ -3268,6 +3275,10 @@ module ts { setModifiers(node, modifiers); parseExpected(SyntaxKind.FunctionKeyword); var isGenerator = parseOptional(SyntaxKind.AsteriskToken); + if (isGenerator) { + node.flags |= NodeFlags.Generator; + } + node.name = parseIdentifier(); fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator, node); node.body = parseFunctionBlockOrSemicolon(isGenerator); @@ -3284,9 +3295,13 @@ module ts { } function parsePropertyMemberDeclaration(fullStart: number, modifiers: ModifiersArray): Declaration { + var flags = modifiers ? modifiers.flags : 0; var isGenerator = parseOptional(SyntaxKind.AsteriskToken); + if (isGenerator) { + flags |= NodeFlags.Generator; + } + var name = parsePropertyName(); - var flags = modifiers ? modifiers.flags : 0; if (parseOptional(SyntaxKind.QuestionToken)) { // Note: this is not legal as per the grammar. But we allow it in the parser and // report an error in the grammar checker. diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 328422d9f6e40..0003317a9ced1 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -270,8 +270,8 @@ module ts { DeclarationFile = 0x00000400, // Node is a .d.ts file Let = 0x00000800, // Variable declaration Const = 0x00001000, // Variable declaration - OctalLiteral = 0x00002000, + Generator = 0x00004000, Modifier = Export | Ambient | Public | Private | Protected | Static, AccessibilityModifier = Public | Private | Protected, From 8bbc4090efe9627eea63506661f5126fcbc45f04 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 01:03:13 -0800 Subject: [PATCH 17/20] Simplify fidelity implementation of context flags. --- src/services/syntax/constants.ts | 31 ++++---- src/services/syntax/parser.ts | 110 ++++++++++++++------------- src/services/syntax/syntaxElement.ts | 31 +++----- 3 files changed, 81 insertions(+), 91 deletions(-) diff --git a/src/services/syntax/constants.ts b/src/services/syntax/constants.ts index 8845af18af63f..87d4a6a2c774c 100644 --- a/src/services/syntax/constants.ts +++ b/src/services/syntax/constants.ts @@ -1,29 +1,24 @@ /// module TypeScript { + export const enum ParserContextFlags { + StrictMode = 1 << 0, + DisallowIn = 1 << 1, + Yield = 1 << 2, + GeneratorParameter = 1 << 3, + + Mask = 0xF + } + export enum SyntaxNodeConstants { None = 0, - // Masks that we use to place information about a node into a single int. The first bit tells - // us if we've computed the data for a node. - // - // The second bit tells us if the node is incrementally reusable if it does not - // containe any skipped tokens, zero width tokens, regex tokens in it ("/", "/=" or "/.../"), - // and contains no tokens that were parser generated. - // - // The next bit lets us know if the nodes was parsed in a strict context or node. A node can - // only be used by the incremental parser if it is parsed in the same strict context as before. - // last masks off the part of the int - // + // The first four bit of the flags are used to store parser context flags. // The width of the node is stored in the remainder of the int. This allows us up to 128MB // for a node by using all 27 bits. However, in the common case, we'll use less than 27 bits // for the width. Thus, the info will be stored in a single int in chakra. - DataComputed = 0x00000001, // 0000 0000 0000 0000 0000 0000 0000 0001 - IncrementallyUnusableMask = 0x00000002, // 0000 0000 0000 0000 0000 0000 0000 0010 - ParsedInStrictModeContext = 0x00000004, // 0000 0000 0000 0000 0000 0000 0000 0100 - ParsedInDisallowInContext = 0x00000008, // 0000 0000 0000 0000 0000 0000 0000 1000 - ParsedInYieldContext = 0x00000010, // 0000 0000 0000 0000 0000 0000 0001 0000 - ParsedInGeneratorParameterContext = 0x00000020, // 0000 0000 0000 0000 0000 0000 0010 0000 - FullWidthShift = 1 << 6, // 1111 1111 1111 1111 1111 1111 1100 0000 + DataComputed = 1 << 4, // 0000 0000 0000 0000 0000 0000 0001 0000 + IncrementallyUnusableMask = 1 << 5, // 0000 0000 0000 0000 0000 0000 0010 0000 + FullWidthShift = 1 << 6, // 1111 1111 1111 1111 1111 1111 1100 0000 } } \ No newline at end of file diff --git a/src/services/syntax/parser.ts b/src/services/syntax/parser.ts index 6b03a4721c1bd..924726649e124 100644 --- a/src/services/syntax/parser.ts +++ b/src/services/syntax/parser.ts @@ -195,11 +195,7 @@ module TypeScript.Parser { // // Getting this all correct is tricky and requires careful reading of the grammar to // understand when these values should be changed versus when they should be inherited. - var strictModeContext: boolean = false; - var disallowInContext: boolean = false; - var yieldContext: boolean = false; - var generatorParameterContext: boolean = false; - var contextFlags: number = 0; + var contextFlags: ParserContextFlags = 0; // Current state of the parser. If we need to rewind we will store and reset these values as // appropriate. @@ -223,7 +219,7 @@ module TypeScript.Parser { // Now, clear out our state so that our singleton parser doesn't keep things alive. diagnostics = []; - contextFlags = SyntaxNodeConstants.None; + contextFlags = 0; fileName = undefined; source.release(); source = undefined; @@ -284,10 +280,7 @@ module TypeScript.Parser { // are unaffected by strict mode. It's just the parser will decide what to do with it // differently depending on what mode it is in. if (node && - parsedInStrictModeContext(node) === strictModeContext && - parsedInDisallowInContext(node) === disallowInContext && - parsedInYieldContext(node) === yieldContext && - parsedInGeneratorParameterContext(node) === generatorParameterContext) { + parserContextFlags(node) === contextFlags) { return node; } @@ -421,7 +414,7 @@ module TypeScript.Parser { // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is // considered a keyword and is not an identifier. - if (tokenKind === SyntaxKind.YieldKeyword && yieldContext) { + if (tokenKind === SyntaxKind.YieldKeyword && inYieldContext()) { return false; } @@ -431,7 +424,7 @@ module TypeScript.Parser { if (tokenKind <= SyntaxKind.LastFutureReservedStrictKeyword) { // Could be a keyword or identifier. It's an identifier if we're not in strict // mode. - return !strictModeContext; + return !inStrictModeContext(); } // If it's typescript keyword, then it's actually a javascript identifier. @@ -633,39 +626,52 @@ module TypeScript.Parser { throw Errors.invalidOperation(); } - function updateContextFlags() { - contextFlags = - (strictModeContext ? SyntaxNodeConstants.ParsedInStrictModeContext : 0) | - (disallowInContext ? SyntaxNodeConstants.ParsedInDisallowInContext : 0) | - (yieldContext ? SyntaxNodeConstants.ParsedInYieldContext : 0) | - (generatorParameterContext ? SyntaxNodeConstants.ParsedInGeneratorParameterContext : 0); + function setContextFlag(val: boolean, flag: ParserContextFlags) { + if (val) { + contextFlags |= flag; + } + else { + contextFlags &= ~flag; + } } function setStrictModeContext(val: boolean) { - strictModeContext = val; - updateContextFlags(); + setContextFlag(val, ParserContextFlags.StrictMode); } function setDisallowInContext(val: boolean) { - disallowInContext = val; - updateContextFlags(); + setContextFlag(val, ParserContextFlags.DisallowIn); } function setYieldContext(val: boolean) { - yieldContext = val; - updateContextFlags(); + setContextFlag(val, ParserContextFlags.Yield); } function setGeneratorParameterContext(val: boolean) { - generatorParameterContext = val; - updateContextFlags(); + setContextFlag(val, ParserContextFlags.GeneratorParameter); + } + + function inStrictModeContext() { + return (contextFlags & ParserContextFlags.StrictMode) !== 0; + } + + function inDisallowInContext() { + return (contextFlags & ParserContextFlags.DisallowIn) !== 0; + } + + function inYieldContext() { + return (contextFlags & ParserContextFlags.Yield) !== 0; + } + + function inGeneratorParameterContext() { + return (contextFlags & ParserContextFlags.GeneratorParameter) !== 0; } function parseSourceUnit(): SourceUnitSyntax { // Note: saving and restoring the 'isInStrictMode' state is not really necessary here // (as it will never be read afterwards). However, for symmetry with the rest of the // parsing code, we do the same here. - var savedIsInStrictMode = strictModeContext + var savedIsInStrictMode = inStrictModeContext() // Note: any skipped tokens produced after the end of all the module elements will be // added as skipped trivia to the start of the EOF token. @@ -692,7 +698,7 @@ module TypeScript.Parser { } function updateStrictModeState(items: any[]): void { - if (!strictModeContext) { + if (!inStrictModeContext()) { // Check if all the items are directive prologue elements. for (var i = 0, n = items.length; i < n; i++) { if (!isDirectivePrologueElement(items[i])) { @@ -972,7 +978,7 @@ module TypeScript.Parser { } function allowInAnd(func: () => T): T { - if (disallowInContext) { + if (inDisallowInContext()) { setDisallowInContext(false); var result = func(); setDisallowInContext(true); @@ -984,7 +990,7 @@ module TypeScript.Parser { } function disallowInAnd(func: () => T): T { - if (disallowInContext) { + if (inDisallowInContext()) { // no need to do anything special if 'in' is already disallowed. return func(); } @@ -996,7 +1002,7 @@ module TypeScript.Parser { } function enterYieldContextAnd(func: () => T): T { - if (yieldContext) { + if (inYieldContext()) { // no need to do anything special if we're already in the [Yield] context. return func(); } @@ -1008,7 +1014,7 @@ module TypeScript.Parser { } function exitYieldContextAnd(func: () => T): T { - if (yieldContext) { + if (inYieldContext()) { setYieldContext(false); var result = func(); setYieldContext(true); @@ -1108,7 +1114,7 @@ module TypeScript.Parser { // [+GeneratorParameter] ClassHeritageopt { ClassBodyopt } if (isHeritageClause()) { - return isClassHeritageClause && generatorParameterContext + return isClassHeritageClause && inGeneratorParameterContext() ? exitYieldContextAnd(parseHeritageClausesWorker) : parseHeritageClausesWorker(); } @@ -1143,7 +1149,7 @@ module TypeScript.Parser { // [+GeneratorParameter] ClassHeritageopt { ClassBodyopt } if (openBraceToken.fullWidth() > 0) { - return generatorParameterContext + return inGeneratorParameterContext() ? exitYieldContextAnd(parseClassElements) : parseClassElements(); } @@ -2446,11 +2452,11 @@ module TypeScript.Parser { if (_currentToken.kind === SyntaxKind.YieldKeyword) { // If we have a 'yield' keyword, and htis is a context where yield expressions are // allowed, then definitely parse out a yield expression. - if (yieldContext) { + if (inYieldContext()) { return true; } - if (strictModeContext) { + if (inStrictModeContext()) { // If we're in strict mode, then 'yield' is a keyword, could only ever start // a yield expression. return true; @@ -2583,7 +2589,7 @@ module TypeScript.Parser { } // also, if it's the 'in' operator, only allow if our caller allows it. - if (tokenKind === SyntaxKind.InKeyword && disallowInContext) { + if (tokenKind === SyntaxKind.InKeyword && inDisallowInContext()) { break; } @@ -3140,7 +3146,7 @@ module TypeScript.Parser { // // [Yield], on the other hand, is available, and is passed through. - var callSignature = parseCallSignature(/*requireCompleteTypeParameterList:*/ true, /*yield:*/ yieldContext, /*generatorParameter:*/ false); + var callSignature = parseCallSignature(/*requireCompleteTypeParameterList:*/ true, /*yield:*/ inYieldContext(), /*generatorParameter:*/ false); if (requireArrow && currentToken().kind !== SyntaxKind.EqualsGreaterThanToken) { return undefined; @@ -3502,7 +3508,7 @@ module TypeScript.Parser { var _currentToken = currentToken(); if (_currentToken.kind === SyntaxKind.OpenBracketToken) { - return generatorParameterContext + return inGeneratorParameterContext() ? exitYieldContextAnd(parseComputedPropertyName) : parseComputedPropertyName(); } @@ -3585,17 +3591,17 @@ module TypeScript.Parser { } function parseFunctionBlockStatements() { - var savedIsInStrictMode = strictModeContext; + var savedIsInStrictMode = inStrictModeContext(); var statements = parseSyntaxList(ListParsingState.Block_Statements, updateStrictModeState); setStrictModeContext(savedIsInStrictMode); return statements; } - function parseCallSignature(requireCompleteTypeParameterList: boolean, _yieldContext: boolean, _generatorParameterContext: boolean): CallSignatureSyntax { + function parseCallSignature(requireCompleteTypeParameterList: boolean, yieldContext: boolean, generatorParameterContext: boolean): CallSignatureSyntax { return new CallSignatureSyntax(contextFlags, tryParseTypeParameterList(requireCompleteTypeParameterList), - parseParameterList(_yieldContext, _generatorParameterContext), + parseParameterList(yieldContext, generatorParameterContext), parseOptionalTypeAnnotation(/*allowStringLiteral:*/ false)); } @@ -3645,7 +3651,7 @@ module TypeScript.Parser { return new ConstraintSyntax(contextFlags, eatToken(SyntaxKind.ExtendsKeyword), parseTypeOrExpression()); } - function parseParameterList(_yieldContext: boolean, _generatorParameterContext: boolean): ParameterListSyntax { + function parseParameterList(yieldContext: boolean, generatorParameterContext: boolean): ParameterListSyntax { // FormalParameters[Yield,GeneratorParameter] : // ... // @@ -3661,11 +3667,11 @@ module TypeScript.Parser { // [+GeneratorParameter]BindingIdentifier[Yield]Initializer[In]opt // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt - var savedYieldContext = yieldContext; - var savedGeneratorParameterContext = generatorParameterContext; + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); - setYieldContext(_yieldContext); - setGeneratorParameterContext(_generatorParameterContext); + setYieldContext(yieldContext); + setGeneratorParameterContext(generatorParameterContext); var openParenToken: ISyntaxToken; var result = new ParameterListSyntax(contextFlags, @@ -3747,8 +3753,8 @@ module TypeScript.Parser { function tryParseType(): ITypeSyntax { // The rules about 'yield' only apply to actual code/expression contexts. They don't // apply to 'type' contexts. So we disable these parameters here before moving on. - var savedYieldContext = yieldContext; - var savedGeneratorParameterContext = generatorParameterContext; + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); setYieldContext(false); setGeneratorParameterContext(false); @@ -3997,7 +4003,7 @@ module TypeScript.Parser { // [+GeneratorParameter]BindingIdentifier[Yield]Initializer[In]opt // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt - var identifier = generatorParameterContext + var identifier = inGeneratorParameterContext() ? enterYieldContextAnd(eatIdentifierToken) : eatIdentifierToken(); @@ -4006,7 +4012,7 @@ module TypeScript.Parser { var equalsValueClause: EqualsValueClauseSyntax = undefined; if (isEqualsValueClause(/*inParameter*/ true)) { - equalsValueClause = generatorParameterContext + equalsValueClause = inGeneratorParameterContext() ? exitYieldContextAnd(parseEqualsValueClause) : parseEqualsValueClause(); } @@ -4388,7 +4394,7 @@ module TypeScript.Parser { } function isExpectedVariableDeclaration_VariableDeclaratorsTerminator(): boolean { - if (disallowInContext) { + if (inDisallowInContext()) { // This is the case when we're parsing variable declarations in a for/for-in statement. var tokenKind = currentToken().kind; diff --git a/src/services/syntax/syntaxElement.ts b/src/services/syntax/syntaxElement.ts index fe10dcb23f956..e14ecf33b69a4 100644 --- a/src/services/syntax/syntaxElement.ts +++ b/src/services/syntax/syntaxElement.ts @@ -17,40 +17,29 @@ module TypeScript { return undefined; } - export function parsedInStrictModeContext(node: ISyntaxNode): boolean { + export function parserContextFlags(node: ISyntaxNode): ParserContextFlags { var info = node.__data; if (info === undefined) { - return false; + return 0; } - return (info & SyntaxNodeConstants.ParsedInStrictModeContext) !== 0; + return info & ParserContextFlags.Mask; } - export function parsedInDisallowInContext(node: ISyntaxNode): boolean { - var info = node.__data; - if (info === undefined) { - return false; - } + export function parsedInStrictModeContext(node: ISyntaxNode): boolean { + return (parserContextFlags(node) & ParserContextFlags.StrictMode) !== 0; + } - return (info & SyntaxNodeConstants.ParsedInDisallowInContext) !== 0; + export function parsedInDisallowInContext(node: ISyntaxNode): boolean { + return (parserContextFlags(node) & ParserContextFlags.DisallowIn) !== 0; } export function parsedInYieldContext(node: ISyntaxNode): boolean { - var info = node.__data; - if (info === undefined) { - return false; - } - - return (info & SyntaxNodeConstants.ParsedInYieldContext) !== 0; + return (parserContextFlags(node) & ParserContextFlags.Yield) !== 0; } export function parsedInGeneratorParameterContext(node: ISyntaxNode): boolean { - var info = node.__data; - if (info === undefined) { - return false; - } - - return (info & SyntaxNodeConstants.ParsedInGeneratorParameterContext) !== 0; + return (parserContextFlags(node) & ParserContextFlags.GeneratorParameter) !== 0; } export function previousToken(token: ISyntaxToken): ISyntaxToken { From ce2e7fc5d5a52ce7fd2efb320e4ad0bfbfc818d9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 01:11:58 -0800 Subject: [PATCH 18/20] Have a node flag to indicate if a yield expression has a *. --- src/compiler/parser.ts | 4 +++- src/compiler/types.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 8906bde952548..dabd00c343264 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2186,7 +2186,9 @@ module ts { if (!scanner.hasPrecedingLineBreak() && (token === SyntaxKind.AsteriskToken || isStartOfExpression())) { - parseOptional(SyntaxKind.AsteriskToken); + if (parseOptional(SyntaxKind.AsteriskToken)) { + node.flags = NodeFlags.YieldStar; + } node.expression = parseAssignmentExpression(); return finishNode(node); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0003317a9ced1..a2fc1f144fe1e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -272,6 +272,7 @@ module ts { Const = 0x00001000, // Variable declaration OctalLiteral = 0x00002000, Generator = 0x00004000, + YieldStar = 0x00008000, Modifier = Export | Ambient | Public | Private | Protected | Static, AccessibilityModifier = Public | Private | Protected, From dc6886c1ca7b08ee7ef6c2bee8713d7d5c33e9fa Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 01:12:21 -0800 Subject: [PATCH 19/20] Add clarifying comments. --- src/services/syntax/parser.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/services/syntax/parser.ts b/src/services/syntax/parser.ts index 924726649e124..b02233544bea3 100644 --- a/src/services/syntax/parser.ts +++ b/src/services/syntax/parser.ts @@ -1371,6 +1371,7 @@ module TypeScript.Parser { } function parseFunctionDeclarationWorker(modifiers: ISyntaxToken[], functionKeyword: ISyntaxToken, asteriskToken: ISyntaxToken): FunctionDeclarationSyntax { + // FunctionDeclaration[Yield, Default] : // function BindingIdentifier[?Yield] ( FormalParameters ) { FunctionBody } // GeneratorDeclaration[Yield, Default] : // function * BindingIdentifier[?Yield](FormalParameters[Yield, GeneratorParameter]) { GeneratorBody[Yield] } @@ -3136,17 +3137,14 @@ module TypeScript.Parser { var _currentToken = currentToken(); // Debug.assert(currentToken.kind === SyntaxKind.OpenParenToken || currentToken.kind === SyntaxKind.LessThanToken); - // Note: ES6 specifies the formal parametes of an arrow function like this: - // - // ArrowFormalParameters[Yield, GeneratorParameter] : - // (StrictFormalParameters[?Yield, ?GeneratorParameter]) - // - // However, the 'GeneratorParameter' portion appears to be a spec bug. There does not - // appear to be any way for that value to be passed in through any grammar constructs. - // - // [Yield], on the other hand, is available, and is passed through. - - var callSignature = parseCallSignature(/*requireCompleteTypeParameterList:*/ true, /*yield:*/ inYieldContext(), /*generatorParameter:*/ false); + // From the static semantic section: + // 1.If the [Yield] grammar parameter is present for CoverParenthesizedExpressionAndArrowParameterList[Yield] + // return the result of parsing the lexical token stream matched by CoverParenthesizedExpressionAndArrowParameterList[Yield] + // using ArrowFormalParameters[Yield, GeneratorParameter] as the goal symbol. + // 2.If the [Yield] grammar parameter is not present for CoverParenthesizedExpressionAndArrowParameterList[Yield] + // return the result of parsing the lexical token stream matched by CoverParenthesizedExpressionAndArrowParameterList + // using ArrowFormalParameters as the goal symbol. + var callSignature = parseCallSignature(/*requireCompleteTypeParameterList:*/ true, /*yield:*/ inYieldContext(), /*generatorParameter:*/ inYieldContext()); if (requireArrow && currentToken().kind !== SyntaxKind.EqualsGreaterThanToken) { return undefined; From 3597f4f4d785481011bd580d73457ab6f82e045a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 25 Nov 2014 01:21:10 -0800 Subject: [PATCH 20/20] Improve comments for both parsers and bring more in sync. --- src/compiler/parser.ts | 42 ++++++++++++++++++----------------- src/services/syntax/parser.ts | 41 +++++++++++++++++++--------------- 2 files changed, 45 insertions(+), 38 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index dabd00c343264..4219ad40ef47d 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1678,9 +1678,9 @@ module ts { return parseInitializer(/*inParameter*/ true); } - function parseSignature(kind: SyntaxKind, returnToken: SyntaxKind, returnTokenRequired: boolean, isGenerator: boolean): ParsedSignature { + function parseSignature(kind: SyntaxKind, returnToken: SyntaxKind, returnTokenRequired: boolean, yieldAndGeneratorParameterContext: boolean): ParsedSignature { var signature = {}; - fillSignature(kind, returnToken, returnTokenRequired, isGenerator, signature); + fillSignature(kind, returnToken, returnTokenRequired, yieldAndGeneratorParameterContext, signature); return signature; } @@ -1688,14 +1688,14 @@ module ts { kind: SyntaxKind, returnToken: SyntaxKind, returnTokenRequired: boolean, - isGenerator: boolean, + yieldAndGeneratorParameterContext: boolean, signature: ParsedSignature): void { if (kind === SyntaxKind.ConstructSignature) { parseExpected(SyntaxKind.NewKeyword); } signature.typeParameters = parseTypeParameters(); - signature.parameters = parseParameterList(/*yieldContext:*/ isGenerator, /*generatorParameterContext:*/ isGenerator); + signature.parameters = parseParameterList(yieldAndGeneratorParameterContext); if (returnTokenRequired) { parseExpected(returnToken); @@ -1706,9 +1706,11 @@ module ts { } } - // Because we use this for index signatures as well, we sometimes use - // parentheses, and sometimes use brackets. - function parseParameterList(yieldContext: boolean, generatorParameterContext: boolean) { + // Note: after careful analysis of the grammar, it does not appear to be possible to + // have 'Yield' And 'GeneratorParameter' not in sync. i.e. any production calling + // this FormalParameters production either always sets both to true, or always sets + // both to false. As such we only have a single parameter to represent both. + function parseParameterList(yieldAndGeneratorParameterContext: boolean) { // FormalParameters[Yield,GeneratorParameter] : // ... // @@ -1727,8 +1729,8 @@ module ts { var savedYieldContext = inYieldContext(); var savedGeneratorParameterContext = inGeneratorParameterContext(); - setYieldContext(yieldContext); - setGeneratorParameterContext(generatorParameterContext); + setYieldContext(yieldAndGeneratorParameterContext); + setGeneratorParameterContext(yieldAndGeneratorParameterContext); var result = parseDelimitedList(ParsingContext.Parameters, parseParameter); parseExpected(SyntaxKind.CloseParenToken); @@ -1744,7 +1746,7 @@ module ts { function parseSignatureMember(kind: SyntaxKind, returnToken: SyntaxKind): SignatureDeclaration { var node = createNode(kind); - fillSignature(kind, returnToken, /* returnTokenRequired */ false, /*isGenerator:*/ false, node); + fillSignature(kind, returnToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ false, node); parseSemicolon(); return finishNode(node); } @@ -1773,7 +1775,7 @@ module ts { // Method signatues don't exist in expression contexts. So they have neither // [Yield] nor [GeneratorParameter] - fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ false, method); + fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ false, method); parseSemicolon(); return finishNode(method); @@ -1857,7 +1859,7 @@ module ts { function parseFunctionType(typeKind: SyntaxKind): SignatureDeclaration { var node = createNode(typeKind); fillSignature(typeKind === SyntaxKind.FunctionType ? SyntaxKind.CallSignature : SyntaxKind.ConstructSignature, - SyntaxKind.EqualsGreaterThanToken, /* returnTokenRequired */ true, /*isGenerator:*/ false, node); + SyntaxKind.EqualsGreaterThanToken, /* returnTokenRequired */ true, /*yieldAndGeneratorParameterContext:*/ false, node); return finishNode(node); } @@ -2230,7 +2232,7 @@ module ts { if (triState === Tristate.True) { // Arrow function are never generators. - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ false); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ false); // 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. @@ -2334,7 +2336,7 @@ module ts { function tryParseSignatureIfArrowOrBraceFollows(): ParsedSignature { return tryParse(() => { // Arrow functions are never generators. - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ false); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ false); // Parsing a signature isn't enough. // Parenthesized arrow signatures often look like other valid expressions. @@ -2726,7 +2728,7 @@ module ts { if (isGenerator) { node.flags |= NodeFlags.Generator; } - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator); var body = parseFunctionBlock(isGenerator, /* ignoreMissingOpenBrace */ false); // do not propagate property name as name for function expression @@ -2794,7 +2796,7 @@ module ts { parseExpected(SyntaxKind.FunctionKeyword); var isGenerator = parseOptional(SyntaxKind.AsteriskToken); var name = isGenerator ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator); var body = parseFunctionBlock(/*allowYield:*/ isGenerator, /* ignoreMissingOpenBrace */ false); return makeFunctionExpression(SyntaxKind.FunctionExpression, pos, name, sig, body, isGenerator ? NodeFlags.Generator : undefined); @@ -3282,7 +3284,7 @@ module ts { } node.name = parseIdentifier(); - fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator, node); + fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator, node); node.body = parseFunctionBlockOrSemicolon(isGenerator); return finishNode(node); } @@ -3291,7 +3293,7 @@ module ts { var node = createNode(SyntaxKind.Constructor, pos); setModifiers(node, modifiers); parseExpected(SyntaxKind.ConstructorKeyword); - fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ false, node); + fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ false, node); node.body = parseFunctionBlockOrSemicolon(/*isGenerator:*/ false); return finishNode(node); } @@ -3317,7 +3319,7 @@ module ts { method.flags = flags; } method.name = name; - fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ isGenerator, method); + fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator, method); method.body = parseFunctionBlockOrSemicolon(isGenerator); return finishNode(method); } @@ -3339,7 +3341,7 @@ module ts { var node = createNode(kind, fullStart); setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*isGenerator:*/ false, node); + fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ false, node); node.body = parseFunctionBlockOrSemicolon(/*isGenerator:*/ false); return finishNode(node); } diff --git a/src/services/syntax/parser.ts b/src/services/syntax/parser.ts index b02233544bea3..53f4608ff57fc 100644 --- a/src/services/syntax/parser.ts +++ b/src/services/syntax/parser.ts @@ -1190,14 +1190,14 @@ module TypeScript.Parser { function parseGetAccessor(modifiers: ISyntaxToken[], getKeyword: ISyntaxToken): GetAccessorSyntax { return new GetAccessorSyntax(contextFlags, modifiers, consumeToken(getKeyword), parsePropertyName(), - parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameter:*/ false), + parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldAndGeneratorParameterContext:*/ false), parseFunctionBody(/*isGenerator:*/ false)); } function parseSetAccessor(modifiers: ISyntaxToken[], setKeyword: ISyntaxToken): SetAccessorSyntax { return new SetAccessorSyntax(contextFlags, modifiers, consumeToken(setKeyword), parsePropertyName(), - parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameterContext:*/ false), + parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldAndGeneratorParameterContext:*/ false), parseFunctionBody(/*isGenerator:*/ false)); } @@ -1326,7 +1326,7 @@ module TypeScript.Parser { return new ConstructorDeclarationSyntax(contextFlags, parseModifiers(), eatToken(SyntaxKind.ConstructorKeyword), - parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameterContext:*/ false), + parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldAndGeneratorParameterContext:*/ false), parseFunctionBody(/*isGenerator:*/ false)); } @@ -1339,7 +1339,7 @@ module TypeScript.Parser { modifiers, asteriskToken, propertyName, - parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ isGenerator, /*generatorParameterContext:*/ isGenerator), + parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldAndGeneratorParameterContext:*/ isGenerator), parseFunctionBody(isGenerator)); } @@ -1381,7 +1381,7 @@ module TypeScript.Parser { functionKeyword, asteriskToken, eatIdentifierToken(), - parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ isGenerator, /*generatorParameterContext:*/ isGenerator), + parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldAndGeneratorParameterContext:*/ isGenerator), parseFunctionBody(isGenerator)); } @@ -1485,7 +1485,7 @@ module TypeScript.Parser { // A call signature for a type member can both use 'yield' as a parameter name, and // does not have parameter initializers. So we can pass 'false' for both [Yield] // and [GeneratorParameter]. - return parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameterContext:*/ false); + return parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldAndGeneratorParameterContext:*/ false); } else if (isConstructSignature()) { return parseConstructSignature(); @@ -1513,7 +1513,7 @@ module TypeScript.Parser { // Construct signatures have no [Yield] or [GeneratorParameter] restrictions. return new ConstructSignatureSyntax(contextFlags, eatToken(SyntaxKind.NewKeyword), - parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameterContext:*/ false)); + parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldAndGeneratorParameterContext:*/ false)); } function parseIndexSignature(): IndexSignatureSyntax { @@ -1529,7 +1529,7 @@ module TypeScript.Parser { return new MethodSignatureSyntax(contextFlags, propertyName, questionToken, - parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldContext:*/ false, /*generatorParameterContext:*/ false)); + parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldAndGeneratorParameterContext:*/ false)); } function parsePropertySignature(propertyName: IPropertyNameSyntax, questionToken: ISyntaxToken): PropertySignatureSyntax { @@ -3022,7 +3022,7 @@ module TypeScript.Parser { functionKeyword, asteriskToken, asteriskToken ? enterYieldContextAnd(eatOptionalIdentifierToken) : eatOptionalIdentifierToken(), - parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yield:*/ isGenerator, /*generatorParameter:*/ isGenerator), + parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldAndGeneratorParameterContext:*/ isGenerator), parseFunctionBody(isGenerator)); } @@ -3144,7 +3144,7 @@ module TypeScript.Parser { // 2.If the [Yield] grammar parameter is not present for CoverParenthesizedExpressionAndArrowParameterList[Yield] // return the result of parsing the lexical token stream matched by CoverParenthesizedExpressionAndArrowParameterList // using ArrowFormalParameters as the goal symbol. - var callSignature = parseCallSignature(/*requireCompleteTypeParameterList:*/ true, /*yield:*/ inYieldContext(), /*generatorParameter:*/ inYieldContext()); + var callSignature = parseCallSignature(/*requireCompleteTypeParameterList:*/ true, /*yieldAndGeneratorParameterContext:*/ inYieldContext()); if (requireArrow && currentToken().kind !== SyntaxKind.EqualsGreaterThanToken) { return undefined; @@ -3538,7 +3538,7 @@ module TypeScript.Parser { return new FunctionPropertyAssignmentSyntax(contextFlags, asteriskToken, propertyName, - parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yield:*/ isGenerator, /*generatorParameter:*/ isGenerator), + parseCallSignature(/*requireCompleteTypeParameterList:*/ false, /*yieldAndGeneratorParameterContext:*/ isGenerator), parseFunctionBody(isGenerator)); } @@ -3596,10 +3596,10 @@ module TypeScript.Parser { return statements; } - function parseCallSignature(requireCompleteTypeParameterList: boolean, yieldContext: boolean, generatorParameterContext: boolean): CallSignatureSyntax { + function parseCallSignature(requireCompleteTypeParameterList: boolean, yieldAndGeneratorParameterContext: boolean): CallSignatureSyntax { return new CallSignatureSyntax(contextFlags, tryParseTypeParameterList(requireCompleteTypeParameterList), - parseParameterList(yieldContext, generatorParameterContext), + parseParameterList(yieldAndGeneratorParameterContext), parseOptionalTypeAnnotation(/*allowStringLiteral:*/ false)); } @@ -3649,7 +3649,11 @@ module TypeScript.Parser { return new ConstraintSyntax(contextFlags, eatToken(SyntaxKind.ExtendsKeyword), parseTypeOrExpression()); } - function parseParameterList(yieldContext: boolean, generatorParameterContext: boolean): ParameterListSyntax { + // Note: after careful analysis of the grammar, it does not appear to be possible to + // have 'Yield' And 'GeneratorParameter' not in sync. i.e. any production calling + // this FormalParameters production either always sets both to true, or always sets + // both to false. As such we only have a single parameter to represent both. + function parseParameterList(yieldAndGeneratorParameterContext: boolean): ParameterListSyntax { // FormalParameters[Yield,GeneratorParameter] : // ... // @@ -3665,11 +3669,12 @@ module TypeScript.Parser { // [+GeneratorParameter]BindingIdentifier[Yield]Initializer[In]opt // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt + var savedYieldContext = inYieldContext(); var savedGeneratorParameterContext = inGeneratorParameterContext(); - setYieldContext(yieldContext); - setGeneratorParameterContext(generatorParameterContext); + setYieldContext(yieldAndGeneratorParameterContext); + setGeneratorParameterContext(yieldAndGeneratorParameterContext); var openParenToken: ISyntaxToken; var result = new ParameterListSyntax(contextFlags, @@ -3936,7 +3941,7 @@ module TypeScript.Parser { // aren't in the [Yield] or [GeneratorParameter] context. return new FunctionTypeSyntax(contextFlags, tryParseTypeParameterList(/*requireCompleteTypeParameterList:*/ false), - parseParameterList(/*yield:*/ false, /*generatorParameter:*/ false), + parseParameterList(/*yieldAndGeneratorParameterContext:*/ false), eatToken(SyntaxKind.EqualsGreaterThanToken), parseType()); } @@ -3946,7 +3951,7 @@ module TypeScript.Parser { return new ConstructorTypeSyntax(contextFlags, eatToken(SyntaxKind.NewKeyword), tryParseTypeParameterList(/*requireCompleteTypeParameterList:*/ false), - parseParameterList(/*yield:*/ false, /*generatorParameter:*/ false), + parseParameterList(/*yieldAndGeneratorParameterContext:*/ false), eatToken(SyntaxKind.EqualsGreaterThanToken), parseType()); }