Skip to content

Commit dc6886c

Browse files
Add clarifying comments.
1 parent ce2e7fc commit dc6886c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/services/syntax/parser.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,7 @@ module TypeScript.Parser {
13711371
}
13721372

13731373
function parseFunctionDeclarationWorker(modifiers: ISyntaxToken[], functionKeyword: ISyntaxToken, asteriskToken: ISyntaxToken): FunctionDeclarationSyntax {
1374+
// FunctionDeclaration[Yield, Default] : // function BindingIdentifier[?Yield] ( FormalParameters ) { FunctionBody }
13741375
// GeneratorDeclaration[Yield, Default] :
13751376
// function * BindingIdentifier[?Yield](FormalParameters[Yield, GeneratorParameter]) { GeneratorBody[Yield] }
13761377

@@ -3136,17 +3137,14 @@ module TypeScript.Parser {
31363137
var _currentToken = currentToken();
31373138
// Debug.assert(currentToken.kind === SyntaxKind.OpenParenToken || currentToken.kind === SyntaxKind.LessThanToken);
31383139

3139-
// Note: ES6 specifies the formal parametes of an arrow function like this:
3140-
//
3141-
// ArrowFormalParameters[Yield, GeneratorParameter] :
3142-
// (StrictFormalParameters[?Yield, ?GeneratorParameter])
3143-
//
3144-
// However, the 'GeneratorParameter' portion appears to be a spec bug. There does not
3145-
// appear to be any way for that value to be passed in through any grammar constructs.
3146-
//
3147-
// [Yield], on the other hand, is available, and is passed through.
3148-
3149-
var callSignature = parseCallSignature(/*requireCompleteTypeParameterList:*/ true, /*yield:*/ inYieldContext(), /*generatorParameter:*/ false);
3140+
// From the static semantic section:
3141+
// 1.If the [Yield] grammar parameter is present for CoverParenthesizedExpressionAndArrowParameterList[Yield]
3142+
// return the result of parsing the lexical token stream matched by CoverParenthesizedExpressionAndArrowParameterList[Yield]
3143+
// using ArrowFormalParameters[Yield, GeneratorParameter] as the goal symbol.
3144+
// 2.If the [Yield] grammar parameter is not present for CoverParenthesizedExpressionAndArrowParameterList[Yield]
3145+
// return the result of parsing the lexical token stream matched by CoverParenthesizedExpressionAndArrowParameterList
3146+
// using ArrowFormalParameters as the goal symbol.
3147+
var callSignature = parseCallSignature(/*requireCompleteTypeParameterList:*/ true, /*yield:*/ inYieldContext(), /*generatorParameter:*/ inYieldContext());
31503148

31513149
if (requireArrow && currentToken().kind !== SyntaxKind.EqualsGreaterThanToken) {
31523150
return undefined;

0 commit comments

Comments
 (0)