When entering a type context, 'yield' should be allowed (as long as you're not in strict mode).

This commit is contained in:
Cyrus Najmabadi 2014-11-12 19:07:35 -08:00
parent 9e273ddb78
commit f7890d4ddb

View file

@ -3778,6 +3778,23 @@ 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;
setYieldContext(false);
setGeneratorParameterContext(false);
var result = tryParseTypeWorker();
setYieldContext(savedYieldContext);
setGeneratorParameterContext(savedGeneratorParameterContext);
return result;
}
function tryParseTypeWorker(): ITypeSyntax {
if (isFunctionType()) {
return parseFunctionType();
}