mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Remove generatorParameter and asyncParameter contexts.
This commit is contained in:
+28
-4
@@ -6083,6 +6083,18 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function isInParameterInitializerBeforeContainingFunction(node: Node) {
|
||||
while (node.parent && !isFunctionLike(node.parent)) {
|
||||
if (node.parent.kind === SyntaxKind.Parameter && (<ParameterDeclaration>node.parent).initializer === node) {
|
||||
return true;
|
||||
}
|
||||
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getContextualReturnType(functionDecl: FunctionLikeDeclaration): Type {
|
||||
// If the containing function has a return type annotation, is a constructor, or is a get accessor whose
|
||||
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
|
||||
@@ -8031,8 +8043,14 @@ namespace ts {
|
||||
|
||||
function checkAwaitExpression(node: AwaitExpression): Type {
|
||||
// Grammar checking
|
||||
if (!(node.parserContextFlags & ParserContextFlags.Await)) {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.await_expression_is_only_allowed_within_an_async_function);
|
||||
if (produceDiagnostics) {
|
||||
if (!(node.parserContextFlags & ParserContextFlags.Await)) {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.await_expression_is_only_allowed_within_an_async_function);
|
||||
}
|
||||
|
||||
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
||||
error(node, Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
|
||||
}
|
||||
}
|
||||
|
||||
let operandType = checkExpression(node.expression);
|
||||
@@ -8465,8 +8483,14 @@ namespace ts {
|
||||
|
||||
function checkYieldExpression(node: YieldExpression): Type {
|
||||
// Grammar checking
|
||||
if (!(node.parserContextFlags & ParserContextFlags.Yield) || isYieldExpressionInClass(node)) {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
|
||||
if (produceDiagnostics) {
|
||||
if (!(node.parserContextFlags & ParserContextFlags.Yield) || isYieldExpressionInClass(node)) {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
|
||||
}
|
||||
|
||||
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
||||
error(node, Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
|
||||
}
|
||||
}
|
||||
|
||||
if (node.expression) {
|
||||
|
||||
@@ -398,6 +398,8 @@ namespace ts {
|
||||
Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." },
|
||||
Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." },
|
||||
The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." },
|
||||
yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." },
|
||||
await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
|
||||
@@ -1570,7 +1570,6 @@
|
||||
"category": "Error",
|
||||
"code": 2505
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": {
|
||||
"category": "Error",
|
||||
"code": 2520
|
||||
@@ -1583,6 +1582,14 @@
|
||||
"category": "Error",
|
||||
"code": 2522
|
||||
},
|
||||
"'yield' expressions cannot be used in a parameter initializer.": {
|
||||
"category": "Error",
|
||||
"code": 2523
|
||||
},
|
||||
"'await' expressions cannot be used in a parameter initializer.": {
|
||||
"category": "Error",
|
||||
"code": 2524
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
|
||||
+42
-92
@@ -661,10 +661,6 @@ namespace ts {
|
||||
setContextFlag(val, ParserContextFlags.Yield);
|
||||
}
|
||||
|
||||
function setGeneratorParameterContext(val: boolean) {
|
||||
setContextFlag(val, ParserContextFlags.GeneratorParameter);
|
||||
}
|
||||
|
||||
function setDecoratorContext(val: boolean) {
|
||||
setContextFlag(val, ParserContextFlags.Decorator);
|
||||
}
|
||||
@@ -672,11 +668,7 @@ namespace ts {
|
||||
function setAwaitContext(val: boolean) {
|
||||
setContextFlag(val, ParserContextFlags.Await);
|
||||
}
|
||||
|
||||
function setAsyncParameterContext(val: boolean) {
|
||||
setContextFlag(val, ParserContextFlags.AsyncParameter);
|
||||
}
|
||||
|
||||
|
||||
function doOutsideOfContext<T>(context: ParserContextFlags, func: () => T): T {
|
||||
// contextFlagsToClear will contain only the context flags that are
|
||||
// currently set that we need to temporarily clear
|
||||
@@ -767,10 +759,6 @@ namespace ts {
|
||||
return inContext(ParserContextFlags.StrictMode);
|
||||
}
|
||||
|
||||
function inGeneratorParameterContext() {
|
||||
return inContext(ParserContextFlags.GeneratorParameter);
|
||||
}
|
||||
|
||||
function inDisallowInContext() {
|
||||
return inContext(ParserContextFlags.DisallowIn);
|
||||
}
|
||||
@@ -782,15 +770,7 @@ namespace ts {
|
||||
function inAwaitContext() {
|
||||
return inContext(ParserContextFlags.Await);
|
||||
}
|
||||
|
||||
function inAsyncParameterContext() {
|
||||
return inContext(ParserContextFlags.AsyncParameter);
|
||||
}
|
||||
|
||||
function inGeneratorParameterOrAsyncParameterContext() {
|
||||
return inContext(ParserContextFlags.GeneratorParameter | ParserContextFlags.AsyncParameter);
|
||||
}
|
||||
|
||||
function parseErrorAtCurrentToken(message: DiagnosticMessage, arg0?: any): void {
|
||||
let start = scanner.getTokenPos();
|
||||
let length = scanner.getTextPos() - start;
|
||||
@@ -1083,24 +1063,16 @@ namespace ts {
|
||||
}
|
||||
|
||||
function parseComputedPropertyName(): ComputedPropertyName {
|
||||
// PropertyName[Yield,GeneratorParameter] :
|
||||
// LiteralPropertyName
|
||||
// [+GeneratorParameter] ComputedPropertyName
|
||||
// [+AsyncParameter] ComputedPropertyName
|
||||
// [~GeneratorParameter,~AsyncParameter] ComputedPropertyName[?Yield,?Await]
|
||||
//
|
||||
// ComputedPropertyName[Yield] :
|
||||
// [ AssignmentExpression[In, ?Yield] ]
|
||||
//
|
||||
// PropertyName [Yield]:
|
||||
// LiteralPropertyName
|
||||
// ComputedPropertyName[?Yield]
|
||||
let node = <ComputedPropertyName>createNode(SyntaxKind.ComputedPropertyName);
|
||||
parseExpected(SyntaxKind.OpenBracketToken);
|
||||
|
||||
// We parse any expression (including a comma expression). But the grammar
|
||||
// says that only an assignment expression is allowed, so the grammar checker
|
||||
// will error if it sees a comma expression.
|
||||
node.expression = inGeneratorParameterOrAsyncParameterContext()
|
||||
? doOutsideOfYieldAndAwaitContext(allowInAndParseExpression)
|
||||
: allowInAnd(parseExpression);
|
||||
node.expression = allowInAnd(parseExpression);
|
||||
|
||||
parseExpected(SyntaxKind.CloseBracketToken);
|
||||
return finishNode(node);
|
||||
@@ -1991,8 +1963,8 @@ namespace ts {
|
||||
node.dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken);
|
||||
setModifiers(node, parseModifiers());
|
||||
|
||||
// FormalParameter[Yield,GeneratorParameter,Await,AsyncParameter] : (Modified) See 14.1
|
||||
// BindingElement[?Yield,?GeneratorParameter,?Await,?AsyncParameter]
|
||||
// FormalParameter [Yield,Await]:
|
||||
// BindingElement[?Yield,?Await]
|
||||
|
||||
node.name = parseIdentifierOrPattern();
|
||||
|
||||
@@ -2024,18 +1996,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function parseBindingElementInitializer(inParameter: boolean) {
|
||||
// BindingElement[Yield,GeneratorParameter,Await,AsyncParameter] :
|
||||
// [+GeneratorParameter] BindingPattern[?Yield,?Await,?AsyncParameter,GeneratorParameter] Initializer[In]opt
|
||||
// [+AsyncParameter] BindingPattern[?Yield,?GeneratorParameter,?Await,AsyncParameter] Initializer[In]opt
|
||||
// [~GeneratorParameter,~AsyncParameter] BindingPattern[?Yield,?Await] Initializer[In,?Yield,?Await]opt
|
||||
// SingleNameBinding[Yield,GeneratorParameter,Await,AsyncParameter] :
|
||||
// [+GeneratorParameter] BindingIdentifier[Yield, ?Await] Initializer[In]opt
|
||||
// [+AsyncParameter] BindingIdentifier[Await, ?Yield] Initializer[In]opt
|
||||
// [~GeneratorParameter,~AsyncParameter] BindingIdentifier[?Yield,?Await] Initializer[In,?Yield,?Await]opt
|
||||
let parseInitializer = inParameter ? parseParameterInitializer : parseNonParameterInitializer;
|
||||
return inGeneratorParameterOrAsyncParameterContext()
|
||||
? doOutsideOfYieldAndAwaitContext(parseInitializer)
|
||||
: parseInitializer();
|
||||
return inParameter ? parseParameterInitializer() : parseNonParameterInitializer();
|
||||
}
|
||||
|
||||
function parseParameterInitializer() {
|
||||
@@ -2043,14 +2004,15 @@ namespace ts {
|
||||
}
|
||||
|
||||
function fillSignature(
|
||||
returnToken: SyntaxKind,
|
||||
yieldAndGeneratorParameterContext: boolean,
|
||||
awaitAndAsyncParameterContext: boolean,
|
||||
requireCompleteParameterList: boolean,
|
||||
signature: SignatureDeclaration): void {
|
||||
returnToken: SyntaxKind,
|
||||
yieldContext: boolean,
|
||||
awaitContext: boolean,
|
||||
requireCompleteParameterList: boolean,
|
||||
signature: SignatureDeclaration): void {
|
||||
|
||||
let returnTokenRequired = returnToken === SyntaxKind.EqualsGreaterThanToken;
|
||||
signature.typeParameters = parseTypeParameters();
|
||||
signature.parameters = parseParameterList(yieldAndGeneratorParameterContext, awaitAndAsyncParameterContext, requireCompleteParameterList);
|
||||
signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList);
|
||||
|
||||
if (returnTokenRequired) {
|
||||
parseExpected(returnToken);
|
||||
@@ -2061,44 +2023,31 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
// 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, awaitAndAsyncParameterContext: boolean, requireCompleteParameterList: boolean) {
|
||||
// FormalParameters[Yield,GeneratorParameter,Await,AsyncParameter] : (Modified)
|
||||
// ...
|
||||
function parseParameterList(yieldContext: boolean, awaitContext: boolean, requireCompleteParameterList: boolean) {
|
||||
// FormalParameters [Yield,Await]: (modified)
|
||||
// [empty]
|
||||
// FormalParameterList[?Yield,Await]
|
||||
//
|
||||
// FormalParameter[Yield,GeneratorParameter,Await,AsyncParameter] : (Modified)
|
||||
// BindingElement[?Yield,?GeneratorParameter,?Await,?AsyncParameter]
|
||||
// FormalParameter[Yield,Await]: (modified)
|
||||
// BindingElement[?Yield,Await]
|
||||
//
|
||||
// BindingElement[Yield,GeneratorParameter,Await,AsyncParameter] : (Modified) See 13.2.3
|
||||
// SingleNameBinding[?Yield,?GeneratorParameter,?Await,?AsyncParameter]
|
||||
// [+GeneratorParameter]BindingPattern[?Yield,?Await,?AsyncParameter,GeneratorParameter] Initializer[In]opt
|
||||
// [+AsyncParameter]BindingPattern[?Yield,?Await,?GeneratorParameter,AsyncParameter] Initializer[In]opt
|
||||
// [~GeneratorParameter,~AsyncParameter]BindingPattern[?Yield,?Await]Initializer[In,?Yield,?Await]opt
|
||||
// BindingElement [Yield,Await]: (modified)
|
||||
// SingleNameBinding[?Yield,?Await]
|
||||
// BindingPattern[?Yield,?Await]Initializer [In, ?Yield,?Await] opt
|
||||
//
|
||||
// SingleNameBinding[Yield,GeneratorParameter,Await,AsyncParameter] : (Modified) See 13.2.3
|
||||
// [+GeneratorParameter]BindingIdentifier[Yield]Initializer[In]opt
|
||||
// [+AsyncParameter]BindingIdentifier[Await]Initializer[In]opt
|
||||
// [~GeneratorParameter,~AsyncParameter]BindingIdentifier[?Yield,?Await]Initializer[In,?Yield,?Await]opt
|
||||
// SingleNameBinding [Yield,Await]:
|
||||
// BindingIdentifier[?Yield,?Await]Initializer [In, ?Yield,?Await] opt
|
||||
if (parseExpected(SyntaxKind.OpenParenToken)) {
|
||||
let savedYieldContext = inYieldContext();
|
||||
let savedGeneratorParameterContext = inGeneratorParameterContext();
|
||||
let savedAwaitContext = inAwaitContext();
|
||||
let savedAsyncParameterContext = inAsyncParameterContext();
|
||||
|
||||
setYieldContext(yieldAndGeneratorParameterContext);
|
||||
setGeneratorParameterContext(yieldAndGeneratorParameterContext);
|
||||
setAwaitContext(awaitAndAsyncParameterContext);
|
||||
setAsyncParameterContext(awaitAndAsyncParameterContext);
|
||||
setYieldContext(yieldContext);
|
||||
setAwaitContext(awaitContext);
|
||||
|
||||
let result = parseDelimitedList(ParsingContext.Parameters, parseParameter);
|
||||
|
||||
setYieldContext(savedYieldContext);
|
||||
setGeneratorParameterContext(savedGeneratorParameterContext);
|
||||
setAwaitContext(savedAwaitContext);
|
||||
setAsyncParameterContext(savedAsyncParameterContext);
|
||||
|
||||
if (!parseExpected(SyntaxKind.CloseParenToken) && requireCompleteParameterList) {
|
||||
// Caller insisted that we had to end with a ) We didn't. So just return
|
||||
@@ -2131,7 +2080,7 @@ namespace ts {
|
||||
if (kind === SyntaxKind.ConstructSignature) {
|
||||
parseExpected(SyntaxKind.NewKeyword);
|
||||
}
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*awaitAndAsyncParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);
|
||||
parseTypeMemberSemicolon();
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -2220,8 +2169,8 @@ namespace ts {
|
||||
method.questionToken = questionToken;
|
||||
|
||||
// Method signatues don't exist in expression contexts. So they have neither
|
||||
// [Yield] nor [GeneratorParameter]
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*awaitAndAsyncParameterContext*/ false, /*requireCompleteParameterList*/ false, method);
|
||||
// [Yield] nor [Await]
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method);
|
||||
parseTypeMemberSemicolon();
|
||||
return finishNode(method);
|
||||
}
|
||||
@@ -2360,7 +2309,7 @@ namespace ts {
|
||||
if (kind === SyntaxKind.ConstructorType) {
|
||||
parseExpected(SyntaxKind.NewKeyword);
|
||||
}
|
||||
fillSignature(SyntaxKind.EqualsGreaterThanToken, /*yieldAndGeneratorParameterContext*/ false, /*awaitAndAsyncParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
|
||||
fillSignature(SyntaxKind.EqualsGreaterThanToken, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -2912,7 +2861,7 @@ namespace ts {
|
||||
// a => (b => c)
|
||||
// And think that "(b =>" was actually a parenthesized arrow function with a missing
|
||||
// close paren.
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*awaitAndAsyncParameterContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ false, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node);
|
||||
|
||||
// If we couldn't get parameters, we definitely could not parse out an arrow function.
|
||||
if (!node.parameters) {
|
||||
@@ -3566,11 +3515,12 @@ namespace ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
// GeneratorExpression :
|
||||
function parseFunctionExpression(): FunctionExpression {
|
||||
// function * BindingIdentifier[Yield]opt (FormalParameters[Yield, GeneratorParameter]) { GeneratorBody[Yield] }
|
||||
// GeneratorExpression:
|
||||
// function* BindingIdentifier [Yield][opt](FormalParameters[Yield]){ GeneratorBody }
|
||||
//
|
||||
// FunctionExpression:
|
||||
// function BindingIdentifieropt(FormalParameters) { FunctionBody }
|
||||
// function BindingIdentifier[opt](FormalParameters){ FunctionBody }
|
||||
let saveDecoratorContext = inDecoratorContext();
|
||||
if (saveDecoratorContext) {
|
||||
setDecoratorContext(false);
|
||||
@@ -3589,7 +3539,7 @@ namespace ts {
|
||||
isAsync ? doInAwaitContext(parseOptionalIdentifier) :
|
||||
parseOptionalIdentifier();
|
||||
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ isGenerator, /*awaitAndAsyncParameterContext*/ isAsync, /*requireCompleteParameterList*/ false, node);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node);
|
||||
node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false);
|
||||
|
||||
if (saveDecoratorContext) {
|
||||
@@ -4303,7 +4253,7 @@ namespace ts {
|
||||
node.name = node.flags & NodeFlags.Default ? parseOptionalIdentifier() : parseIdentifier();
|
||||
let isGenerator = !!node.asteriskToken;
|
||||
let isAsync = isAsyncFunctionLike(node);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ isGenerator, /*awaitAndAsyncParameterContext*/ isAsync, /*requireCompleteParameterList*/ false, node);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node);
|
||||
node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, Diagnostics.or_expected);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -4313,7 +4263,7 @@ namespace ts {
|
||||
node.decorators = decorators;
|
||||
setModifiers(node, modifiers);
|
||||
parseExpected(SyntaxKind.ConstructorKeyword);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*awaitAndAsyncParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);
|
||||
node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, Diagnostics.or_expected);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -4327,7 +4277,7 @@ namespace ts {
|
||||
method.questionToken = questionToken;
|
||||
let isGenerator = !!asteriskToken;
|
||||
let isAsync = isAsyncFunctionLike(method);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ isGenerator, /*awaitAndAsyncParameterContext*/ isAsync, /*requireCompleteParameterList*/ false, method);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method);
|
||||
method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage);
|
||||
return finishNode(method);
|
||||
}
|
||||
@@ -4381,7 +4331,7 @@ namespace ts {
|
||||
node.decorators = decorators;
|
||||
setModifiers(node, modifiers);
|
||||
node.name = parsePropertyName();
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*awaitAndAsyncParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);
|
||||
node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
+2
-12
@@ -376,18 +376,12 @@ namespace ts {
|
||||
// If this node was parsed in the 'yield' context created when parsing a generator.
|
||||
Yield = 1 << 2,
|
||||
|
||||
// If this node was parsed in the parameters of a generator.
|
||||
GeneratorParameter = 1 << 3,
|
||||
|
||||
// If this node was parsed as part of a decorator
|
||||
Decorator = 1 << 4,
|
||||
|
||||
// If this node was parsed in the 'await' context created when parsing an async function.
|
||||
Await = 1 << 5,
|
||||
|
||||
// If this node was parsed in the parameters of an async function.
|
||||
AsyncParameter = 1 << 6,
|
||||
|
||||
// If the parser encountered an error when parsing the code that created this node. Note
|
||||
// the parser only sets this directly on the node it creates right after encountering the
|
||||
// error.
|
||||
@@ -398,14 +392,10 @@ namespace ts {
|
||||
JavaScriptFile = 1 << 8,
|
||||
|
||||
// Context flags set directly by the parser.
|
||||
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | Decorator | ThisNodeHasError | Await | AsyncParameter,
|
||||
|
||||
// Context flags passed as part of the modified ES6 grammar.
|
||||
YieldAndGeneratorParameterFlags = Yield | GeneratorParameter,
|
||||
AwaitAndAsyncParameterFlags = Await | AsyncParameter,
|
||||
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | Decorator | ThisNodeHasError | Await,
|
||||
|
||||
// Exclude these flags when parsing a Type
|
||||
TypeExcludesFlags = YieldAndGeneratorParameterFlags | AwaitAndAsyncParameterFlags,
|
||||
TypeExcludesFlags = Yield | Await,
|
||||
|
||||
// Context flags computed by aggregating child flags upwards.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user