Changeset 281429 in webkit for trunk/Source/JavaScriptCore/parser/Parser.cpp
- Timestamp:
- Aug 22, 2021, 6:06:11 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Parser.cpp
r279448 r281429 297 297 return makeUnexpected(hasError() ? m_errorMessage : "Parser error"_s); 298 298 299 if ( Options::usePrivateClassFields() &&!m_lexer->isReparsingFunction() && m_seenPrivateNameUseInNonReparsingFunctionMode) {299 if (!m_lexer->isReparsingFunction() && m_seenPrivateNameUseInNonReparsingFunctionMode) { 300 300 String errorMessage; 301 301 scope->forEachUsedVariable([&] (UniquedStringImpl* impl) { … … 1386 1386 1387 1387 if (match(AWAIT)) { 1388 semanticFailIfFalse(currentScope()->isAsyncFunction() || (isModuleParseMode(sourceParseMode()) && Options::useTopLevelAwait()), "for-await-of can only be used in an async function or async generator");1388 semanticFailIfFalse(currentScope()->isAsyncFunction() || isModuleParseMode(sourceParseMode()), "for-await-of can only be used in an async function or async generator"); 1389 1389 isAwaitFor = true; 1390 1390 next(); … … 3016 3016 ASSERT(ident); 3017 3017 next(); 3018 if (parseMode == SourceParseMode::MethodMode && !escaped && (matchIdentifierOrKeyword() || match(STRING) || match(DOUBLE) || match(INTEGER) || match(BIGINT) || match(OPENBRACKET) || (Options::usePrivateMethods() && match(PRIVATENAME)))) {3018 if (parseMode == SourceParseMode::MethodMode && !escaped && (matchIdentifierOrKeyword() || match(STRING) || match(DOUBLE) || match(INTEGER) || match(BIGINT) || match(OPENBRACKET) || match(PRIVATENAME))) { 3019 3019 isGetter = *ident == propertyNames.get; 3020 3020 isSetter = *ident == propertyNames.set; … … 3036 3036 break; 3037 3037 case PRIVATENAME: { 3038 ASSERT(Options::usePrivateClassFields());3039 3038 ident = m_token.m_data.ident; 3040 if (!Options::usePrivateStaticClassFields())3041 failIfTrue(tag == ClassElementTag::Static, "Static class element cannot be private");3042 3039 failIfTrue(isGetter || isSetter, "Cannot parse class method with private name"); 3043 3040 ASSERT(ident); 3044 3041 next(); 3045 if ( Options::usePrivateMethods() &&match(OPENPAREN)) {3042 if (match(OPENPAREN)) { 3046 3043 semanticFailIfTrue(classScope->declarePrivateMethod(*ident, tag) & DeclarationResult::InvalidDuplicateDeclaration, "Cannot declare private method twice"); 3047 3044 semanticFailIfTrue(*ident == propertyNames.constructorPrivateField, "Cannot declare a private method named '#constructor'"); … … 3069 3066 TreeProperty property; 3070 3067 if (isGetter || isSetter) { 3071 if ( Options::usePrivateMethods() &&match(PRIVATENAME)) {3068 if (match(PRIVATENAME)) { 3072 3069 ident = m_token.m_data.ident; 3073 3070 … … 3092 3089 property = parseGetterSetter(context, type, methodStart, ConstructorKind::None, tag); 3093 3090 failIfFalse(property, "Cannot parse this method"); 3094 } else if (!match(OPENPAREN) && (tag == ClassElementTag::Instance || Options::usePublicStaticClassFields()) &&parseMode == SourceParseMode::MethodMode) {3091 } else if (!match(OPENPAREN) && parseMode == SourceParseMode::MethodMode) { 3095 3092 ASSERT(!isGetter && !isSetter); 3096 3093 if (ident) { … … 4248 4245 4249 4246 TreeExpression current = 0; 4250 if ( Options::usePrivateIn() &&match(PRIVATENAME)) {4247 if (match(PRIVATENAME)) { 4251 4248 const Identifier* ident = m_token.m_data.ident; 4252 4249 ASSERT(ident); … … 4515 4512 4516 4513 bool matchesPrivateName = match(PRIVATENAME); 4517 if (matchSpecIdentifier() || match(STRING) || (Options::usePrivateMethods() && matchesPrivateName)|| m_token.m_type & KeywordTokenFlag) {4514 if (matchSpecIdentifier() || match(STRING) || matchesPrivateName || m_token.m_type & KeywordTokenFlag) { 4518 4515 stringPropertyName = m_token.m_data.ident; 4519 4516 semanticFailIfTrue(tag == ClassElementTag::Static && *stringPropertyName == m_vm.propertyNames->prototype, … … 4860 4857 if (m_parserState.functionParsePhase == FunctionParsePhase::Parameters) 4861 4858 semanticFailIfFalse(m_parserState.allowAwait, "Cannot use 'await' within a parameter default expression"); 4862 else if (currentFunctionScope()->isAsyncFunctionBoundary() || (isModuleParseMode(sourceParseMode()) && Options::useTopLevelAwait()))4859 else if (currentFunctionScope()->isAsyncFunctionBoundary() || isModuleParseMode(sourceParseMode())) 4863 4860 return parseAwaitExpression(context); 4864 4861 … … 5366 5363 unsigned lastOperator = 0; 5367 5364 5368 if (UNLIKELY(match(AWAIT) && (currentFunctionScope()->isAsyncFunctionBoundary() || (isModuleParseMode(sourceParseMode()) && Options::useTopLevelAwait()))))5365 if (UNLIKELY(match(AWAIT) && (currentFunctionScope()->isAsyncFunctionBoundary() || isModuleParseMode(sourceParseMode())))) 5369 5366 return parseAwaitExpression(context); 5370 5367
Note:
See TracChangeset
for help on using the changeset viewer.