: SetForScope<bool>(scope->m_isGenerator, shouldParseAsGenerator) { }
};
+struct DepthManager : private SetForScope<int> {
+public:
+ DepthManager(int* depth)
+ : SetForScope<int>(*depth, *depth)
+ {
+ }
+};
+
template <typename LexerType>
Parser<LexerType>::~Parser()
{
result = parseClassDeclaration(context, ExportType::Exported);
break;
- case ASYNC:
+ case ASYNC: {
next();
semanticFailIfFalse(match(FUNCTION) && !m_lexer->prevTerminator(), "Expected 'function' keyword following 'async' keyword with no preceding line terminator");
+ DepthManager statementDepth(&m_statementDepth);
+ m_statementDepth = 1;
result = parseAsyncFunctionDeclaration(context, ExportType::Exported);
break;
+ }
default:
failWithMessage("Expected either a declaration or a variable statement");