diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart index 4f28b6f4aa0..37d440f154b 100644 --- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart +++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart @@ -1413,7 +1413,8 @@ class Parser { /// recordTypeNamedFields ::= '{' recordTypeNamedField /// ( ',' recordTypeNamedField )* ','? '}' /// recordTypeNamedField ::= metadata type identifier - Token parseRecordType(final Token start, Token token) { + Token parseRecordType( + final Token start, Token token, bool questionMarkPartOfType) { token = token.next!; assert(optional('(', token)); @@ -1491,8 +1492,9 @@ class Parser { token, codes.messageRecordTypeOnePositionalFieldNoTrailingComma); } + // Only consume the `?` if it is part of the type. Token? questionMark = token.next!; - if (optional('?', questionMark)) { + if (optional('?', questionMark) && questionMarkPartOfType) { token = questionMark; } else { questionMark = null; diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart index b22dfdfebf5..1409400f24b 100644 --- a/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart +++ b/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart @@ -526,8 +526,15 @@ class ComplexTypeInfo implements TypeInfo { assert(typeArguments != null); } - ComplexTypeInfo._nonNullable(this.start, this.typeArguments, this.end, - this.typeVariableStarters, this.gftHasReturnType, this.recovered); + ComplexTypeInfo._nonNullable( + this.start, + this.typeArguments, + this.end, + this.typeVariableStarters, + this.gftHasReturnType, + this.recordType, + this.gftReturnTypeHasRecordType, + this.recovered); @override TypeInfo get asNonNullable { @@ -539,6 +546,8 @@ class ComplexTypeInfo implements TypeInfo { beforeQuestionMark, typeVariableStarters, gftHasReturnType, + recordType, + gftReturnTypeHasRecordType, recovered); } @@ -590,8 +599,10 @@ class ComplexTypeInfo implements TypeInfo { // Push the non-existing return type first. The loop below will // generate the full type. noType.parseType(token, parser); - } else if (recordType || gftReturnTypeHasRecordType) { - token = parser.parseRecordType(start, token); + } else if (recordType) { + token = parser.parseRecordType(start, token, beforeQuestionMark != null); + } else if (gftReturnTypeHasRecordType) { + token = parser.parseRecordType(start, token, true); } else { Token typeRefOrPrefix = token.next!; if (optional('void', typeRefOrPrefix)) { diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_26073.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_26073.dart.intertwined.expect index 97bcffec7cd..6c9fc63dbc7 100644 --- a/pkg/front_end/parser_testcases/error_recovery/issue_26073.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/error_recovery/issue_26073.dart.intertwined.expect @@ -124,7 +124,7 @@ parseUnit(typedef) ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true) listener: handleIdentifier(d, typedefDeclaration) listener: handleNoTypeVariables(=) - parseRecordType((, =) + parseRecordType((, =, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect index cd997d00109..cf490551f94 100644 --- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect @@ -5726,7 +5726,7 @@ parseUnit(class) parseIsOperatorRest() listener: beginIsOperatorType(is) computeTypeAfterIsOrAs(is) - parseRecordType((, is) + parseRecordType((, is, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_methods.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_methods.dart.intertwined.expect index 68556680537..fabe77ccb60 100644 --- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_methods.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_methods.dart.intertwined.expect @@ -5554,7 +5554,7 @@ parseUnit(int) parseIsOperatorRest() listener: beginIsOperatorType(is) computeTypeAfterIsOrAs(is) - parseRecordType((, is) + parseRecordType((, is, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/general/issue_45848_06.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/issue_45848_06.dart.intertwined.expect index 62b0cc1988b..af8b90936ae 100644 --- a/pkg/front_end/parser_testcases/general/issue_45848_06.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/general/issue_45848_06.dart.intertwined.expect @@ -216,7 +216,7 @@ parseUnit(void) listener: handleIdentifier(y, typeReference) listener: handleNoTypeArguments(,) listener: handleType(y, null) - parseRecordType((, ,) + parseRecordType((, ,, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/general/issue_45848_07.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/issue_45848_07.dart.intertwined.expect index f2c3baaac3e..98b901466e9 100644 --- a/pkg/front_end/parser_testcases/general/issue_45848_07.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/general/issue_45848_07.dart.intertwined.expect @@ -241,7 +241,7 @@ parseUnit(void) listener: handleIdentifier(y, typeReference) listener: handleNoTypeArguments(,) listener: handleType(y, null) - parseRecordType((, ,) + parseRecordType((, ,, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/general/not_call_on_after_try_block.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/not_call_on_after_try_block.dart.intertwined.expect index 6b2e881f58d..4590ebf3286 100644 --- a/pkg/front_end/parser_testcases/general/not_call_on_after_try_block.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/general/not_call_on_after_try_block.dart.intertwined.expect @@ -84,7 +84,7 @@ parseUnit(void) listener: endBlock(1, {, }, BlockKind(catch clause)) listener: handleCatchBlock(on, null, null) listener: beginCatchClause(on) - parseRecordType((, on) + parseRecordType((, on, false) listener: beginRecordType(() listener: endRecordType((, null, 0, false) listener: endCatchClause({) @@ -100,7 +100,7 @@ parseUnit(void) listener: endBlock(1, {, }, BlockKind(catch clause)) listener: handleCatchBlock(on, null, null) listener: beginCatchClause(on) - parseRecordType((, on) + parseRecordType((, on, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -136,7 +136,7 @@ parseUnit(void) listener: endBlock(1, {, }, BlockKind(catch clause)) listener: handleCatchBlock(on, null, null) listener: beginCatchClause(on) - parseRecordType((, on) + parseRecordType((, on, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/field_formal_parameter_with_explicit_record_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/field_formal_parameter_with_explicit_record_type.dart.intertwined.expect index 35298e6b2da..6e52bfaf73e 100644 --- a/pkg/front_end/parser_testcases/record/field_formal_parameter_with_explicit_record_type.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/field_formal_parameter_with_explicit_record_type.dart.intertwined.expect @@ -33,7 +33,7 @@ parseUnit(class) listener: beginMember() parseFields({, null, null, null, null, null, null, null, {, Instance of 'ComplexTypeInfo', x, DeclarationKind.Class, C, false) listener: beginFields(DeclarationKind.Class, null, null, null, null, null, null, null, {) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeNamedFields(() listener: beginRecordTypeNamedFields({) @@ -92,7 +92,7 @@ parseUnit(class) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.NonStaticMethod, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeNamedFields(() listener: beginRecordTypeNamedFields({) diff --git a/pkg/front_end/parser_testcases/record/is_and_as.dart b/pkg/front_end/parser_testcases/record/is_and_as.dart new file mode 100644 index 00000000000..80a565b3524 --- /dev/null +++ b/pkg/front_end/parser_testcases/record/is_and_as.dart @@ -0,0 +1,7 @@ +foo(dynamic a) { + final b = a; + if (a is (int, int)) { + print("a is (int, int)"); + } + final c = b as (int, int); +} diff --git a/pkg/front_end/parser_testcases/record/is_and_as.dart.expect b/pkg/front_end/parser_testcases/record/is_and_as.dart.expect new file mode 100644 index 00000000000..0151ca3b1cd --- /dev/null +++ b/pkg/front_end/parser_testcases/record/is_and_as.dart.expect @@ -0,0 +1,114 @@ +beginCompilationUnit(foo) + beginMetadataStar(foo) + endMetadataStar(0) + beginTopLevelMember(foo) + beginTopLevelMethod(, null, null) + handleNoType() + handleIdentifier(foo, topLevelFunctionDeclaration) + handleNoTypeVariables(() + beginFormalParameters((, MemberKind.TopLevelMethod) + beginMetadataStar(dynamic) + endMetadataStar(0) + beginFormalParameter(dynamic, MemberKind.TopLevelMethod, null, null, null) + handleIdentifier(dynamic, typeReference) + handleNoTypeArguments(a) + handleType(dynamic, null) + handleIdentifier(a, formalParameterDeclaration) + handleFormalParameterWithoutValue()) + endFormalParameter(null, null, null, a, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod) + endFormalParameters(1, (, ), MemberKind.TopLevelMethod) + handleAsyncModifier(null, null) + beginBlockFunctionBody({) + beginMetadataStar(final) + endMetadataStar(0) + handleNoType(final) + beginVariablesDeclaration(b, null, final) + handleIdentifier(b, localVariableDeclaration) + beginInitializedIdentifier(b) + beginVariableInitializer(=) + handleIdentifier(a, expression) + handleNoTypeArguments(;) + handleNoArguments(;) + handleSend(a, ;) + endVariableInitializer(=) + endInitializedIdentifier(b) + endVariablesDeclaration(1, ;) + beginIfStatement(if) + handleIdentifier(a, expression) + handleNoTypeArguments(is) + handleNoArguments(is) + handleSend(a, is) + beginIsOperatorType(is) + beginRecordType(() + beginRecordTypeEntry() + beginMetadataStar(int) + endMetadataStar(0) + handleIdentifier(int, typeReference) + handleNoTypeArguments(,) + handleType(int, null) + handleNoName(,) + endRecordTypeEntry() + beginRecordTypeEntry() + beginMetadataStar(int) + endMetadataStar(0) + handleIdentifier(int, typeReference) + handleNoTypeArguments()) + handleType(int, null) + handleNoName()) + endRecordTypeEntry() + endRecordType((, null, 2, false) + endIsOperatorType(is) + handleIsOperator(is, null) + handleParenthesizedCondition((, null) + beginThenStatement({) + beginBlock({, BlockKind(statement)) + handleIdentifier(print, expression) + handleNoTypeArguments(() + beginArguments(() + beginLiteralString("a is (int, int)") + endLiteralString(0, )) + endArguments(1, (, )) + handleSend(print, ;) + handleExpressionStatement(;) + endBlock(1, {, }, BlockKind(statement)) + endThenStatement(}) + endIfStatement(if, null) + beginMetadataStar(final) + endMetadataStar(0) + handleNoType(final) + beginVariablesDeclaration(c, null, final) + handleIdentifier(c, localVariableDeclaration) + beginInitializedIdentifier(c) + beginVariableInitializer(=) + handleIdentifier(b, expression) + handleNoTypeArguments(as) + handleNoArguments(as) + handleSend(b, as) + beginAsOperatorType(as) + beginRecordType(() + beginRecordTypeEntry() + beginMetadataStar(int) + endMetadataStar(0) + handleIdentifier(int, typeReference) + handleNoTypeArguments(,) + handleType(int, null) + handleNoName(,) + endRecordTypeEntry() + beginRecordTypeEntry() + beginMetadataStar(int) + endMetadataStar(0) + handleIdentifier(int, typeReference) + handleNoTypeArguments()) + handleType(int, null) + handleNoName()) + endRecordTypeEntry() + endRecordType((, null, 2, false) + endAsOperatorType(as) + handleAsOperator(as) + endVariableInitializer(=) + endInitializedIdentifier(c) + endVariablesDeclaration(1, ;) + endBlockFunctionBody(3, {, }) + endTopLevelMethod(foo, null, }) + endTopLevelDeclaration() +endCompilationUnit(1, ) diff --git a/pkg/front_end/parser_testcases/record/is_and_as.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/is_and_as.dart.intertwined.expect new file mode 100644 index 00000000000..1232a46b225 --- /dev/null +++ b/pkg/front_end/parser_testcases/record/is_and_as.dart.intertwined.expect @@ -0,0 +1,236 @@ +parseUnit(foo) + skipErrorTokens(foo) + listener: beginCompilationUnit(foo) + syntheticPreviousToken(foo) + parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext') + parseMetadataStar() + listener: beginMetadataStar(foo) + listener: endMetadataStar(0) + parseTopLevelMemberImpl() + listener: beginTopLevelMember(foo) + isReservedKeyword(() + parseTopLevelMethod(, null, null, , Instance of 'NoType', null, foo, false) + listener: beginTopLevelMethod(, null, null) + listener: handleNoType() + ensureIdentifierPotentiallyRecovered(, topLevelFunctionDeclaration, false) + listener: handleIdentifier(foo, topLevelFunctionDeclaration) + parseMethodTypeVar(foo) + listener: handleNoTypeVariables(() + parseGetterOrFormalParameters(foo, foo, false, MemberKind.TopLevelMethod) + parseFormalParameters(foo, MemberKind.TopLevelMethod) + parseFormalParametersRest((, MemberKind.TopLevelMethod) + listener: beginFormalParameters((, MemberKind.TopLevelMethod) + parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod) + parseMetadataStar(() + listener: beginMetadataStar(dynamic) + listener: endMetadataStar(0) + listener: beginFormalParameter(dynamic, MemberKind.TopLevelMethod, null, null, null) + listener: handleIdentifier(dynamic, typeReference) + listener: handleNoTypeArguments(a) + listener: handleType(dynamic, null) + ensureIdentifier(dynamic, formalParameterDeclaration) + listener: handleIdentifier(a, formalParameterDeclaration) + listener: handleFormalParameterWithoutValue()) + listener: endFormalParameter(null, null, null, a, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod) + listener: endFormalParameters(1, (, ), MemberKind.TopLevelMethod) + parseAsyncModifierOpt()) + listener: handleAsyncModifier(null, null) + inPlainSync() + parseFunctionBody(), false, false) + listener: beginBlockFunctionBody({) + notEofOrValue(}, final) + parseStatement({) + parseStatementX({) + parseExpressionStatementOrDeclarationAfterModifiers(final, {, null, final, null, false) + looksLikeLocalFunction(b) + listener: beginMetadataStar(final) + listener: endMetadataStar(0) + listener: handleNoType(final) + listener: beginVariablesDeclaration(b, null, final) + parseVariablesDeclarationRest(final, true) + parseOptionallyInitializedIdentifier(final) + ensureIdentifier(final, localVariableDeclaration) + listener: handleIdentifier(b, localVariableDeclaration) + listener: beginInitializedIdentifier(b) + parseVariableInitializerOpt(b) + listener: beginVariableInitializer(=) + parseExpression(=) + parsePrecedenceExpression(=, 1, true) + parseUnaryExpression(=, true) + parsePrimary(=, expression) + parseSendOrFunctionLiteral(=, expression) + parseSend(=, expression) + isNextIdentifier(=) + ensureIdentifier(=, expression) + listener: handleIdentifier(a, expression) + listener: handleNoTypeArguments(;) + parseArgumentsOpt(a) + listener: handleNoArguments(;) + listener: handleSend(a, ;) + listener: endVariableInitializer(=) + listener: endInitializedIdentifier(b) + ensureSemicolon(a) + listener: endVariablesDeclaration(1, ;) + notEofOrValue(}, if) + parseStatement(;) + parseStatementX(;) + parseIfStatement(;) + listener: beginIfStatement(if) + ensureParenthesizedCondition(if, allowCase: false) + parseExpressionInParenthesisRest((, allowCase: false) + parseExpression(() + parsePrecedenceExpression((, 1, true) + parseUnaryExpression((, true) + parsePrimary((, expression) + parseSendOrFunctionLiteral((, expression) + parseSend((, expression) + isNextIdentifier(() + ensureIdentifier((, expression) + listener: handleIdentifier(a, expression) + listener: handleNoTypeArguments(is) + parseArgumentsOpt(a) + listener: handleNoArguments(is) + listener: handleSend(a, is) + parseIsOperatorRest(a) + listener: beginIsOperatorType(is) + computeTypeAfterIsOrAs(is) + parseRecordType((, is, false) + listener: beginRecordType(() + parseRecordTypeField((, identifierIsOptional: true) + listener: beginRecordTypeEntry() + parseMetadataStar(() + listener: beginMetadataStar(int) + listener: endMetadataStar(0) + listener: handleIdentifier(int, typeReference) + listener: handleNoTypeArguments(,) + listener: handleType(int, null) + listener: handleNoName(,) + listener: endRecordTypeEntry() + parseRecordTypeField(,, identifierIsOptional: true) + listener: beginRecordTypeEntry() + parseMetadataStar(,) + listener: beginMetadataStar(int) + listener: endMetadataStar(0) + listener: handleIdentifier(int, typeReference) + listener: handleNoTypeArguments()) + listener: handleType(int, null) + listener: handleNoName()) + listener: endRecordTypeEntry() + listener: endRecordType((, null, 2, false) + listener: endIsOperatorType(is) + listener: handleIsOperator(is, null) + skipChainedAsIsOperators()) + ensureCloseParen(), () + listener: handleParenthesizedCondition((, null) + listener: beginThenStatement({) + parseStatement()) + parseStatementX()) + parseBlock(), BlockKind(statement)) + ensureBlock(), null, null) + listener: beginBlock({, BlockKind(statement)) + notEofOrValue(}, print) + parseStatement({) + parseStatementX({) + parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false) + looksLikeLocalFunction(print) + parseExpressionStatement({) + parseExpression({) + parsePrecedenceExpression({, 1, true) + parseUnaryExpression({, true) + parsePrimary({, expression) + parseSendOrFunctionLiteral({, expression) + looksLikeFunctionBody(;) + parseSend({, expression) + isNextIdentifier({) + ensureIdentifier({, expression) + listener: handleIdentifier(print, expression) + listener: handleNoTypeArguments(() + parseArgumentsOpt(print) + parseArguments(print) + parseArgumentsRest(() + listener: beginArguments(() + parseExpression(() + parsePrecedenceExpression((, 1, true) + parseUnaryExpression((, true) + parsePrimary((, expression) + parseLiteralString(() + parseSingleLiteralString(() + listener: beginLiteralString("a is (int, int)") + listener: endLiteralString(0, )) + listener: endArguments(1, (, )) + listener: handleSend(print, ;) + ensureSemicolon()) + listener: handleExpressionStatement(;) + notEofOrValue(}, }) + listener: endBlock(1, {, }, BlockKind(statement)) + listener: endThenStatement(}) + listener: endIfStatement(if, null) + notEofOrValue(}, final) + parseStatement(}) + parseStatementX(}) + parseExpressionStatementOrDeclarationAfterModifiers(final, }, null, final, null, false) + looksLikeLocalFunction(c) + listener: beginMetadataStar(final) + listener: endMetadataStar(0) + listener: handleNoType(final) + listener: beginVariablesDeclaration(c, null, final) + parseVariablesDeclarationRest(final, true) + parseOptionallyInitializedIdentifier(final) + ensureIdentifier(final, localVariableDeclaration) + listener: handleIdentifier(c, localVariableDeclaration) + listener: beginInitializedIdentifier(c) + parseVariableInitializerOpt(c) + listener: beginVariableInitializer(=) + parseExpression(=) + parsePrecedenceExpression(=, 1, true) + parseUnaryExpression(=, true) + parsePrimary(=, expression) + parseSendOrFunctionLiteral(=, expression) + looksLikeFunctionBody(;) + parseSend(=, expression) + isNextIdentifier(=) + ensureIdentifier(=, expression) + listener: handleIdentifier(b, expression) + listener: handleNoTypeArguments(as) + parseArgumentsOpt(b) + listener: handleNoArguments(as) + listener: handleSend(b, as) + parseAsOperatorRest(b) + listener: beginAsOperatorType(as) + computeTypeAfterIsOrAs(as) + parseRecordType((, as, false) + listener: beginRecordType(() + parseRecordTypeField((, identifierIsOptional: true) + listener: beginRecordTypeEntry() + parseMetadataStar(() + listener: beginMetadataStar(int) + listener: endMetadataStar(0) + listener: handleIdentifier(int, typeReference) + listener: handleNoTypeArguments(,) + listener: handleType(int, null) + listener: handleNoName(,) + listener: endRecordTypeEntry() + parseRecordTypeField(,, identifierIsOptional: true) + listener: beginRecordTypeEntry() + parseMetadataStar(,) + listener: beginMetadataStar(int) + listener: endMetadataStar(0) + listener: handleIdentifier(int, typeReference) + listener: handleNoTypeArguments()) + listener: handleType(int, null) + listener: handleNoName()) + listener: endRecordTypeEntry() + listener: endRecordType((, null, 2, false) + listener: endAsOperatorType(as) + listener: handleAsOperator(as) + skipChainedAsIsOperators()) + listener: endVariableInitializer(=) + listener: endInitializedIdentifier(c) + ensureSemicolon()) + listener: endVariablesDeclaration(1, ;) + notEofOrValue(}, }) + listener: endBlockFunctionBody(3, {, }) + listener: endTopLevelMethod(foo, null, }) + listener: endTopLevelDeclaration() + reportAllErrorTokens(foo) + listener: endCompilationUnit(1, ) diff --git a/pkg/front_end/parser_testcases/record/is_and_as.dart.parser.expect b/pkg/front_end/parser_testcases/record/is_and_as.dart.parser.expect new file mode 100644 index 00000000000..481c8d21917 --- /dev/null +++ b/pkg/front_end/parser_testcases/record/is_and_as.dart.parser.expect @@ -0,0 +1,17 @@ +foo(dynamic a) { +final b = a; +if (a is (int, int)) { +print("a is (int, int)"); +} +final c = b as (int, int); +} + + +foo[StringToken]([BeginToken]dynamic[KeywordToken] a[StringToken])[SimpleToken] {[BeginToken] +final[KeywordToken] b[StringToken] =[SimpleToken] a[StringToken];[SimpleToken] +if[KeywordToken] ([BeginToken]a[StringToken] is[KeywordToken] ([BeginToken]int[StringToken],[SimpleToken] int[StringToken])[SimpleToken])[SimpleToken] {[BeginToken] +print[StringToken]([BeginToken]"a is (int, int)"[StringToken])[SimpleToken];[SimpleToken] +}[SimpleToken] +final[KeywordToken] c[StringToken] =[SimpleToken] b[StringToken] as[KeywordToken] ([BeginToken]int[StringToken],[SimpleToken] int[StringToken])[SimpleToken];[SimpleToken] +}[SimpleToken] +[SimpleToken] diff --git a/pkg/front_end/parser_testcases/record/is_and_as.dart.scanner.expect b/pkg/front_end/parser_testcases/record/is_and_as.dart.scanner.expect new file mode 100644 index 00000000000..481c8d21917 --- /dev/null +++ b/pkg/front_end/parser_testcases/record/is_and_as.dart.scanner.expect @@ -0,0 +1,17 @@ +foo(dynamic a) { +final b = a; +if (a is (int, int)) { +print("a is (int, int)"); +} +final c = b as (int, int); +} + + +foo[StringToken]([BeginToken]dynamic[KeywordToken] a[StringToken])[SimpleToken] {[BeginToken] +final[KeywordToken] b[StringToken] =[SimpleToken] a[StringToken];[SimpleToken] +if[KeywordToken] ([BeginToken]a[StringToken] is[KeywordToken] ([BeginToken]int[StringToken],[SimpleToken] int[StringToken])[SimpleToken])[SimpleToken] {[BeginToken] +print[StringToken]([BeginToken]"a is (int, int)"[StringToken])[SimpleToken];[SimpleToken] +}[SimpleToken] +final[KeywordToken] c[StringToken] =[SimpleToken] b[StringToken] as[KeywordToken] ([BeginToken]int[StringToken],[SimpleToken] int[StringToken])[SimpleToken];[SimpleToken] +}[SimpleToken] +[SimpleToken] diff --git a/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart b/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart new file mode 100644 index 00000000000..43c2c643851 --- /dev/null +++ b/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart @@ -0,0 +1,3 @@ +foo(dynamic a) { + final b = a is (int, int) ? 42 : 43; +} diff --git a/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.expect b/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.expect new file mode 100644 index 00000000000..dbab4be22dc --- /dev/null +++ b/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.expect @@ -0,0 +1,65 @@ +beginCompilationUnit(foo) + beginMetadataStar(foo) + endMetadataStar(0) + beginTopLevelMember(foo) + beginTopLevelMethod(, null, null) + handleNoType() + handleIdentifier(foo, topLevelFunctionDeclaration) + handleNoTypeVariables(() + beginFormalParameters((, MemberKind.TopLevelMethod) + beginMetadataStar(dynamic) + endMetadataStar(0) + beginFormalParameter(dynamic, MemberKind.TopLevelMethod, null, null, null) + handleIdentifier(dynamic, typeReference) + handleNoTypeArguments(a) + handleType(dynamic, null) + handleIdentifier(a, formalParameterDeclaration) + handleFormalParameterWithoutValue()) + endFormalParameter(null, null, null, a, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod) + endFormalParameters(1, (, ), MemberKind.TopLevelMethod) + handleAsyncModifier(null, null) + beginBlockFunctionBody({) + beginMetadataStar(final) + endMetadataStar(0) + handleNoType(final) + beginVariablesDeclaration(b, null, final) + handleIdentifier(b, localVariableDeclaration) + beginInitializedIdentifier(b) + beginVariableInitializer(=) + handleIdentifier(a, expression) + handleNoTypeArguments(is) + handleNoArguments(is) + handleSend(a, is) + beginIsOperatorType(is) + beginRecordType(() + beginRecordTypeEntry() + beginMetadataStar(int) + endMetadataStar(0) + handleIdentifier(int, typeReference) + handleNoTypeArguments(,) + handleType(int, null) + handleNoName(,) + endRecordTypeEntry() + beginRecordTypeEntry() + beginMetadataStar(int) + endMetadataStar(0) + handleIdentifier(int, typeReference) + handleNoTypeArguments()) + handleType(int, null) + handleNoName()) + endRecordTypeEntry() + endRecordType((, null, 2, false) + endIsOperatorType(is) + handleIsOperator(is, null) + beginConditionalExpression(?) + handleLiteralInt(42) + handleConditionalExpressionColon() + handleLiteralInt(43) + endConditionalExpression(?, :) + endVariableInitializer(=) + endInitializedIdentifier(b) + endVariablesDeclaration(1, ;) + endBlockFunctionBody(1, {, }) + endTopLevelMethod(foo, null, }) + endTopLevelDeclaration() +endCompilationUnit(1, ) diff --git a/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.intertwined.expect new file mode 100644 index 00000000000..bf5043eb879 --- /dev/null +++ b/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.intertwined.expect @@ -0,0 +1,125 @@ +parseUnit(foo) + skipErrorTokens(foo) + listener: beginCompilationUnit(foo) + syntheticPreviousToken(foo) + parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext') + parseMetadataStar() + listener: beginMetadataStar(foo) + listener: endMetadataStar(0) + parseTopLevelMemberImpl() + listener: beginTopLevelMember(foo) + isReservedKeyword(() + parseTopLevelMethod(, null, null, , Instance of 'NoType', null, foo, false) + listener: beginTopLevelMethod(, null, null) + listener: handleNoType() + ensureIdentifierPotentiallyRecovered(, topLevelFunctionDeclaration, false) + listener: handleIdentifier(foo, topLevelFunctionDeclaration) + parseMethodTypeVar(foo) + listener: handleNoTypeVariables(() + parseGetterOrFormalParameters(foo, foo, false, MemberKind.TopLevelMethod) + parseFormalParameters(foo, MemberKind.TopLevelMethod) + parseFormalParametersRest((, MemberKind.TopLevelMethod) + listener: beginFormalParameters((, MemberKind.TopLevelMethod) + parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod) + parseMetadataStar(() + listener: beginMetadataStar(dynamic) + listener: endMetadataStar(0) + listener: beginFormalParameter(dynamic, MemberKind.TopLevelMethod, null, null, null) + listener: handleIdentifier(dynamic, typeReference) + listener: handleNoTypeArguments(a) + listener: handleType(dynamic, null) + ensureIdentifier(dynamic, formalParameterDeclaration) + listener: handleIdentifier(a, formalParameterDeclaration) + listener: handleFormalParameterWithoutValue()) + listener: endFormalParameter(null, null, null, a, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod) + listener: endFormalParameters(1, (, ), MemberKind.TopLevelMethod) + parseAsyncModifierOpt()) + listener: handleAsyncModifier(null, null) + inPlainSync() + parseFunctionBody(), false, false) + listener: beginBlockFunctionBody({) + notEofOrValue(}, final) + parseStatement({) + parseStatementX({) + parseExpressionStatementOrDeclarationAfterModifiers(final, {, null, final, null, false) + looksLikeLocalFunction(b) + listener: beginMetadataStar(final) + listener: endMetadataStar(0) + listener: handleNoType(final) + listener: beginVariablesDeclaration(b, null, final) + parseVariablesDeclarationRest(final, true) + parseOptionallyInitializedIdentifier(final) + ensureIdentifier(final, localVariableDeclaration) + listener: handleIdentifier(b, localVariableDeclaration) + listener: beginInitializedIdentifier(b) + parseVariableInitializerOpt(b) + listener: beginVariableInitializer(=) + parseExpression(=) + parsePrecedenceExpression(=, 1, true) + parseUnaryExpression(=, true) + parsePrimary(=, expression) + parseSendOrFunctionLiteral(=, expression) + parseSend(=, expression) + isNextIdentifier(=) + ensureIdentifier(=, expression) + listener: handleIdentifier(a, expression) + listener: handleNoTypeArguments(is) + parseArgumentsOpt(a) + listener: handleNoArguments(is) + listener: handleSend(a, is) + parseIsOperatorRest(a) + listener: beginIsOperatorType(is) + computeTypeAfterIsOrAs(is) + parseRecordType((, is, false) + listener: beginRecordType(() + parseRecordTypeField((, identifierIsOptional: true) + listener: beginRecordTypeEntry() + parseMetadataStar(() + listener: beginMetadataStar(int) + listener: endMetadataStar(0) + listener: handleIdentifier(int, typeReference) + listener: handleNoTypeArguments(,) + listener: handleType(int, null) + listener: handleNoName(,) + listener: endRecordTypeEntry() + parseRecordTypeField(,, identifierIsOptional: true) + listener: beginRecordTypeEntry() + parseMetadataStar(,) + listener: beginMetadataStar(int) + listener: endMetadataStar(0) + listener: handleIdentifier(int, typeReference) + listener: handleNoTypeArguments()) + listener: handleType(int, null) + listener: handleNoName()) + listener: endRecordTypeEntry() + listener: endRecordType((, null, 2, false) + listener: endIsOperatorType(is) + listener: handleIsOperator(is, null) + skipChainedAsIsOperators()) + parseConditionalExpressionRest()) + listener: beginConditionalExpression(?) + parseExpressionWithoutCascade(?) + parsePrecedenceExpression(?, 1, false) + parseUnaryExpression(?, false) + parsePrimary(?, expression) + parseLiteralInt(?) + listener: handleLiteralInt(42) + ensureColon(42) + listener: handleConditionalExpressionColon() + parseExpressionWithoutCascade(:) + parsePrecedenceExpression(:, 1, false) + parseUnaryExpression(:, false) + parsePrimary(:, expression) + parseLiteralInt(:) + listener: handleLiteralInt(43) + listener: endConditionalExpression(?, :) + listener: endVariableInitializer(=) + listener: endInitializedIdentifier(b) + ensureSemicolon(43) + listener: endVariablesDeclaration(1, ;) + notEofOrValue(}, }) + listener: endBlockFunctionBody(1, {, }) + listener: endTopLevelMethod(foo, null, }) + listener: endTopLevelDeclaration() + reportAllErrorTokens(foo) + listener: endCompilationUnit(1, ) diff --git a/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.parser.expect b/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.parser.expect new file mode 100644 index 00000000000..91ccfa9e3de --- /dev/null +++ b/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.parser.expect @@ -0,0 +1,9 @@ +foo(dynamic a) { +final b = a is (int, int) ? 42 : 43; +} + + +foo[StringToken]([BeginToken]dynamic[KeywordToken] a[StringToken])[SimpleToken] {[BeginToken] +final[KeywordToken] b[StringToken] =[SimpleToken] a[StringToken] is[KeywordToken] ([BeginToken]int[StringToken],[SimpleToken] int[StringToken])[SimpleToken] ?[SimpleToken] 42[StringToken] :[SimpleToken] 43[StringToken];[SimpleToken] +}[SimpleToken] +[SimpleToken] diff --git a/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.scanner.expect b/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.scanner.expect new file mode 100644 index 00000000000..91ccfa9e3de --- /dev/null +++ b/pkg/front_end/parser_testcases/record/is_record_conditional_expression.dart.scanner.expect @@ -0,0 +1,9 @@ +foo(dynamic a) { +final b = a is (int, int) ? 42 : 43; +} + + +foo[StringToken]([BeginToken]dynamic[KeywordToken] a[StringToken])[SimpleToken] {[BeginToken] +final[KeywordToken] b[StringToken] =[SimpleToken] a[StringToken] is[KeywordToken] ([BeginToken]int[StringToken],[SimpleToken] int[StringToken])[SimpleToken] ?[SimpleToken] 42[StringToken] :[SimpleToken] 43[StringToken];[SimpleToken] +}[SimpleToken] +[SimpleToken] diff --git a/pkg/front_end/parser_testcases/record/modifier_before_type_question.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/modifier_before_type_question.dart.intertwined.expect index eee3e0a0d8c..541df499b0a 100644 --- a/pkg/front_end/parser_testcases/record/modifier_before_type_question.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/modifier_before_type_question.dart.intertwined.expect @@ -67,7 +67,7 @@ parseUnit(abstract) listener: beginMember() parseFields(;, abstract, null, null, null, null, null, null, abstract, Instance of 'ComplexTypeInfo', foo3, DeclarationKind.Class, Foo, false) listener: beginFields(DeclarationKind.Class, abstract, null, null, null, null, null, null, ;) - parseRecordType((, abstract) + parseRecordType((, abstract, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -104,7 +104,7 @@ parseUnit(abstract) listener: beginMember() parseFields(;, abstract, null, null, null, null, null, null, abstract, Instance of 'ComplexTypeInfo', foo4, DeclarationKind.Class, Foo, false) listener: beginFields(DeclarationKind.Class, abstract, null, null, null, null, null, null, ;) - parseRecordType((, abstract) + parseRecordType((, abstract, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -281,7 +281,7 @@ parseUnit(abstract) listener: beginFields(DeclarationKind.Class, abstract, null, null, null, null, null, null, ;) listener: beginFunctionType(() listener: handleNoTypeVariables(() - parseRecordType((, abstract) + parseRecordType((, abstract, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -336,7 +336,7 @@ parseUnit(abstract) listener: beginFields(DeclarationKind.Class, abstract, null, null, null, null, null, null, ;) listener: beginFunctionType(() listener: handleNoTypeVariables(() - parseRecordType((, abstract) + parseRecordType((, abstract, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -391,7 +391,7 @@ parseUnit(abstract) listener: beginFields(DeclarationKind.Class, abstract, null, null, null, null, null, null, ;) listener: beginFunctionType(() listener: handleNoTypeVariables(() - parseRecordType((, abstract) + parseRecordType((, abstract, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -446,7 +446,7 @@ parseUnit(abstract) listener: beginFields(DeclarationKind.Class, abstract, null, null, null, null, null, null, ;) listener: beginFunctionType(() listener: handleNoTypeVariables(() - parseRecordType((, abstract) + parseRecordType((, abstract, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/nested_generics_with_records.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/nested_generics_with_records.dart.intertwined.expect index dfe2f6349fe..ba460c7b10c 100644 --- a/pkg/front_end/parser_testcases/record/nested_generics_with_records.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/nested_generics_with_records.dart.intertwined.expect @@ -13,7 +13,7 @@ parseUnit(List) ensureIdentifier(, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -58,7 +58,7 @@ parseUnit(List) ensureIdentifier(<, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -108,7 +108,7 @@ parseUnit(List) ensureIdentifier(<, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -163,7 +163,7 @@ parseUnit(List) ensureIdentifier(<, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -223,7 +223,7 @@ parseUnit(List) ensureIdentifier(<, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -288,7 +288,7 @@ parseUnit(List) ensureIdentifier(<, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -358,7 +358,7 @@ parseUnit(List) ensureIdentifier(<, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -433,7 +433,7 @@ parseUnit(List) ensureIdentifier(<, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -513,7 +513,7 @@ parseUnit(List) ensureIdentifier(<, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -598,7 +598,7 @@ parseUnit(List) ensureIdentifier(<, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/operator_returning_record.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/operator_returning_record.dart.intertwined.expect index 64decc67729..709c47f7920 100644 --- a/pkg/front_end/parser_testcases/record/operator_returning_record.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/operator_returning_record.dart.intertwined.expect @@ -33,7 +33,7 @@ parseUnit(class) listener: beginMember() parseMethod({, null, null, null, null, null, null, null, {, Instance of 'ComplexTypeInfo', null, operator, DeclarationKind.Class, Foo, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, null, operator) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -153,7 +153,7 @@ parseUnit(class) listener: beginMember() parseMethod({, null, null, null, null, null, null, null, {, Instance of 'ComplexTypeInfo', null, operator, DeclarationKind.Class, Bar, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, null, operator) - parseRecordType((, {) + parseRecordType((, {, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_and_commas.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_and_commas.dart.intertwined.expect index f0d8b69729b..db5b2853314 100644 --- a/pkg/front_end/parser_testcases/record/record_and_commas.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_and_commas.dart.intertwined.expect @@ -34,7 +34,7 @@ parseUnit(main) looksLikeLocalFunction(emptyRecord1) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() listener: endRecordType((, null, 0, false) listener: beginVariablesDeclaration(emptyRecord1, null, null) @@ -66,7 +66,7 @@ parseUnit(main) looksLikeLocalFunction(emptyRecord2) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() reportRecoverableError(,, RecordTypeZeroFieldsButTrailingComma) listener: handleRecoverableError(RecordTypeZeroFieldsButTrailingComma, ,, ,) @@ -100,7 +100,7 @@ parseUnit(main) looksLikeLocalFunction(emptyRecord3) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() listener: endRecordType((, null, 0, false) listener: beginVariablesDeclaration(emptyRecord3, null, null) @@ -134,7 +134,7 @@ parseUnit(main) looksLikeLocalFunction(emptyRecord4) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() reportRecoverableError(,, RecordTypeZeroFieldsButTrailingComma) listener: handleRecoverableError(RecordTypeZeroFieldsButTrailingComma, ,, ,) @@ -170,7 +170,7 @@ parseUnit(main) looksLikeLocalFunction(emptyRecord5) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -252,7 +252,7 @@ parseUnit(main) looksLikeLocalFunction(emptyRecord6) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -344,7 +344,7 @@ parseUnit(main) looksLikeLocalFunction(emptyRecord7) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -454,7 +454,7 @@ parseUnit(main) looksLikeLocalFunction(emptyRecord8) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_01.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_01.dart.intertwined.expect index ecf632fd4cd..a787c7693a4 100644 --- a/pkg/front_end/parser_testcases/record/record_type_01.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_01.dart.intertwined.expect @@ -33,7 +33,7 @@ parseUnit(void) looksLikeLocalFunction(record1) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -97,7 +97,7 @@ parseUnit(void) looksLikeLocalFunction(record1Named) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -163,7 +163,7 @@ parseUnit(void) looksLikeLocalFunction(record2) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -227,7 +227,7 @@ parseUnit(void) looksLikeLocalFunction(record2Named) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -293,7 +293,7 @@ parseUnit(void) looksLikeLocalFunction(record3) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -401,7 +401,7 @@ parseUnit(void) looksLikeLocalFunction(record3Named) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -511,7 +511,7 @@ parseUnit(void) looksLikeLocalFunction(record4) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -619,7 +619,7 @@ parseUnit(void) looksLikeLocalFunction(record4Named) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -778,14 +778,14 @@ parseUnit(void) looksLikeLocalFunction(record5) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() parseMetadataStar(() listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -969,7 +969,7 @@ parseUnit(void) listener: endMetadataStar(0) listener: handleNoTypeVariables(() listener: beginLocalFunctionDeclaration(() - parseRecordType((, }) + parseRecordType((, }, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -1082,7 +1082,7 @@ parseUnit(void) listener: endMetadataStar(0) listener: handleNoTypeVariables(() listener: beginLocalFunctionDeclaration(() - parseRecordType((, }) + parseRecordType((, }, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_02.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_02.dart.intertwined.expect index 8d7bed42949..765d01dc324 100644 --- a/pkg/front_end/parser_testcases/record/record_type_02.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_02.dart.intertwined.expect @@ -33,7 +33,7 @@ parseUnit(void) looksLikeLocalFunction(record1) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -103,7 +103,7 @@ parseUnit(void) looksLikeLocalFunction(record2) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -180,7 +180,7 @@ parseUnit(void) looksLikeLocalFunction(record1) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -228,7 +228,7 @@ parseUnit(void) looksLikeLocalFunction(record2) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeNamedFields(() listener: beginRecordTypeNamedFields({) @@ -284,7 +284,7 @@ parseUnit(void) looksLikeLocalFunction(record3) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() listener: endRecordType((, null, 0, false) listener: beginVariablesDeclaration(record3, null, null) diff --git a/pkg/front_end/parser_testcases/record/record_type_03.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_03.dart.intertwined.expect index be5497e916e..c1d75af2ddd 100644 --- a/pkg/front_end/parser_testcases/record/record_type_03.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_03.dart.intertwined.expect @@ -10,7 +10,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(, null, null, , Instance of 'ComplexTypeInfo', null, foo, false) listener: beginTopLevelMethod(, null, null) - parseRecordType((, ) + parseRecordType((, , false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -46,7 +46,7 @@ parseUnit(() listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -201,7 +201,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(}, null, null, }, Instance of 'ComplexTypeInfo', null, bar, false) listener: beginTopLevelMethod(}, null, null) - parseRecordType((, }) + parseRecordType((, }, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -237,7 +237,7 @@ parseUnit(() listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -403,7 +403,7 @@ parseUnit(() listener: beginMember() parseMethod({, null, null, null, null, null, null, null, {, Instance of 'ComplexTypeInfo', null, foo, DeclarationKind.Class, Baz, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, null, foo) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_04.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_04.dart.intertwined.expect index 5b449daf372..4f83653122d 100644 --- a/pkg/front_end/parser_testcases/record/record_type_04.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_04.dart.intertwined.expect @@ -44,7 +44,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.GeneralizedFunctionType, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -76,7 +76,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.GeneralizedFunctionType, null, null, null) - parseRecordType((, ,) + parseRecordType((, ,, false) listener: beginRecordType(() parseRecordTypeNamedFields(() listener: beginRecordTypeNamedFields({) @@ -132,7 +132,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.GeneralizedFunctionType, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -193,7 +193,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.GeneralizedFunctionType, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -243,7 +243,7 @@ parseUnit(void) listener: endMetadataStar(0) listener: beginFunctionType(() listener: handleNoTypeVariables(() - parseRecordType((, ;) + parseRecordType((, ;, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -274,7 +274,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.GeneralizedFunctionType, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -324,7 +324,7 @@ parseUnit(void) listener: endMetadataStar(0) listener: beginFunctionType(() listener: handleNoTypeVariables(() - parseRecordType((, ;) + parseRecordType((, ;, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -355,7 +355,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.GeneralizedFunctionType, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -407,7 +407,7 @@ parseUnit(void) listener: handleNoTypeVariables(() listener: beginFunctionType(() listener: handleNoTypeVariables(() - parseRecordType((, ;) + parseRecordType((, ;, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -454,7 +454,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.GeneralizedFunctionType, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -506,7 +506,7 @@ parseUnit(void) listener: handleNoTypeVariables(() listener: beginFunctionType(() listener: handleNoTypeVariables(() - parseRecordType((, ;) + parseRecordType((, ;, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -553,7 +553,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.GeneralizedFunctionType, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_as_named_parameter.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_as_named_parameter.dart.intertwined.expect index 5416861549f..7e585e08021 100644 --- a/pkg/front_end/parser_testcases/record/record_type_as_named_parameter.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_as_named_parameter.dart.intertwined.expect @@ -26,7 +26,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -58,7 +58,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, ,) + parseRecordType((, ,, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -121,7 +121,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -176,7 +176,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, ,) + parseRecordType((, ,, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -262,7 +262,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -317,7 +317,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, ,) + parseRecordType((, ,, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -403,7 +403,7 @@ parseUnit(void) listener: beginMetadataStar(required) listener: endMetadataStar(0) listener: beginFormalParameter(required, MemberKind.TopLevelMethod, required, null, null) - parseRecordType((, required) + parseRecordType((, required, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -435,7 +435,7 @@ parseUnit(void) listener: beginMetadataStar(required) listener: endMetadataStar(0) listener: beginFormalParameter(required, MemberKind.TopLevelMethod, required, null, null) - parseRecordType((, required) + parseRecordType((, required, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -498,7 +498,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, {) + parseRecordType((, {, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -530,7 +530,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, ,) + parseRecordType((, ,, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_as_optional_parameter.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_as_optional_parameter.dart.intertwined.expect index 386f239acfa..35eb14fc42a 100644 --- a/pkg/front_end/parser_testcases/record/record_type_as_optional_parameter.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_as_optional_parameter.dart.intertwined.expect @@ -26,7 +26,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, [) + parseRecordType((, [, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -58,7 +58,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, ,) + parseRecordType((, ,, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -121,7 +121,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, [) + parseRecordType((, [, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -176,7 +176,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, ,) + parseRecordType((, ,, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -262,7 +262,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, [) + parseRecordType((, [, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -294,7 +294,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, ,) + parseRecordType((, ,, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_as_type_arguments.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_as_type_arguments.dart.intertwined.expect index 48bd4b3e564..1cffcd6d54c 100644 --- a/pkg/front_end/parser_testcases/record/record_type_as_type_arguments.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_as_type_arguments.dart.intertwined.expect @@ -47,7 +47,7 @@ parseUnit(void) parsePrimary(=, expression) parseLiteralListSetMapOrFunction(=, null) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -90,7 +90,7 @@ parseUnit(void) ensureIdentifier(;, typeReference) listener: handleIdentifier(List, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -147,7 +147,7 @@ parseUnit(void) ensureIdentifier(;, typeReference) listener: handleIdentifier(Map, typeReference) listener: beginTypeArguments(<) - parseRecordType((, <) + parseRecordType((, <, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -170,7 +170,7 @@ parseUnit(void) listener: handleNoName()) listener: endRecordTypeEntry() listener: endRecordType((, null, 2, false) - parseRecordType((, ,) + parseRecordType((, ,, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -228,7 +228,7 @@ parseUnit(void) listener: handleNoTypeVariables(() listener: beginFunctionType(() listener: handleNoTypeVariables(() - parseRecordType((, <) + parseRecordType((, <, true) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -275,7 +275,7 @@ parseUnit(void) listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.GeneralizedFunctionType, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_getter.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_getter.dart.intertwined.expect index 0db2a361a54..7d6c87bc6d6 100644 --- a/pkg/front_end/parser_testcases/record/record_type_getter.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_getter.dart.intertwined.expect @@ -10,7 +10,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(, null, null, , Instance of 'ComplexTypeInfo', null, get, false) listener: beginTopLevelMethod(, null, null) - parseRecordType((, ) + parseRecordType((, , false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -97,7 +97,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(;, null, null, ;, Instance of 'ComplexTypeInfo', null, get, false) listener: beginTopLevelMethod(;, null, null) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -191,7 +191,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(}, null, null, }, Instance of 'ComplexTypeInfo', get, get, false) listener: beginTopLevelMethod(}, null, null) - parseRecordType((, }) + parseRecordType((, }, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -263,7 +263,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(;, null, null, ;, Instance of 'ComplexTypeInfo', get, get, false) listener: beginTopLevelMethod(;, null, null) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -342,7 +342,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(}, null, null, }, Instance of 'ComplexTypeInfo', get, topLevelGetter, false) listener: beginTopLevelMethod(}, null, null) - parseRecordType((, }) + parseRecordType((, }, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -414,7 +414,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(;, null, null, ;, Instance of 'ComplexTypeInfo', get, topLevelGetter, false) listener: beginTopLevelMethod(;, null, null) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -517,7 +517,7 @@ parseUnit(() isReservedKeyword(() parseMethod({, null, null, null, null, null, null, null, {, Instance of 'ComplexTypeInfo', null, get, DeclarationKind.Class, Foo, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, null, get) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -609,7 +609,7 @@ parseUnit(() isReservedKeyword(() parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'ComplexTypeInfo', null, get, DeclarationKind.Class, Foo, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, null, get) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -707,7 +707,7 @@ parseUnit(() listener: beginMember() parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'ComplexTypeInfo', get, get, DeclarationKind.Class, Foo, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, get, get) - parseRecordType((, }) + parseRecordType((, }, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -783,7 +783,7 @@ parseUnit(() listener: beginMember() parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'ComplexTypeInfo', get, get, DeclarationKind.Class, Foo, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, get, get) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -866,7 +866,7 @@ parseUnit(() listener: beginMember() parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'ComplexTypeInfo', get, instanceGetter, DeclarationKind.Class, Foo, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, get, instanceGetter) - parseRecordType((, }) + parseRecordType((, }, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -942,7 +942,7 @@ parseUnit(() listener: beginMember() parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'ComplexTypeInfo', get, instanceGetter, DeclarationKind.Class, Foo, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, get, instanceGetter) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -1053,7 +1053,7 @@ parseUnit(() isReservedKeyword(() parseMethod({, null, null, null, static, null, null, null, static, Instance of 'ComplexTypeInfo', null, get, DeclarationKind.Class, Bar, false) listener: beginMethod(DeclarationKind.Class, null, null, static, null, null, null, get) - parseRecordType((, static) + parseRecordType((, static, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -1144,7 +1144,7 @@ parseUnit(() isReservedKeyword(() parseMethod(;, null, null, null, static, null, null, null, static, Instance of 'ComplexTypeInfo', null, get, DeclarationKind.Class, Bar, false) listener: beginMethod(DeclarationKind.Class, null, null, static, null, null, null, get) - parseRecordType((, static) + parseRecordType((, static, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -1241,7 +1241,7 @@ parseUnit(() listener: beginMember() parseMethod(}, null, null, null, static, null, null, null, static, Instance of 'ComplexTypeInfo', get, get, DeclarationKind.Class, Bar, false) listener: beginMethod(DeclarationKind.Class, null, null, static, null, null, get, get) - parseRecordType((, static) + parseRecordType((, static, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -1316,7 +1316,7 @@ parseUnit(() listener: beginMember() parseMethod(;, null, null, null, static, null, null, null, static, Instance of 'ComplexTypeInfo', get, get, DeclarationKind.Class, Bar, false) listener: beginMethod(DeclarationKind.Class, null, null, static, null, null, get, get) - parseRecordType((, static) + parseRecordType((, static, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -1398,7 +1398,7 @@ parseUnit(() listener: beginMember() parseMethod(}, null, null, null, static, null, null, null, static, Instance of 'ComplexTypeInfo', get, staticGetter, DeclarationKind.Class, Bar, false) listener: beginMethod(DeclarationKind.Class, null, null, static, null, null, get, staticGetter) - parseRecordType((, static) + parseRecordType((, static, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -1473,7 +1473,7 @@ parseUnit(() listener: beginMember() parseMethod(;, null, null, null, static, null, null, null, static, Instance of 'ComplexTypeInfo', get, staticGetter, DeclarationKind.Class, Bar, false) listener: beginMethod(DeclarationKind.Class, null, null, static, null, null, get, staticGetter) - parseRecordType((, static) + parseRecordType((, static, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_in_for_loop.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_in_for_loop.dart.intertwined.expect index 7a4e997ef2c..3bb36af010b 100644 --- a/pkg/front_end/parser_testcases/record/record_type_in_for_loop.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_in_for_loop.dart.intertwined.expect @@ -36,7 +36,7 @@ parseUnit(main) parseExpressionStatementOrDeclarationAfterModifiers((, (, null, null, null, true) listener: beginMetadataStar(() listener: endMetadataStar(0) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_return_on_function_with_type_paremeter.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_return_on_function_with_type_paremeter.dart.intertwined.expect index bdc9346f430..6ad0a730ef7 100644 --- a/pkg/front_end/parser_testcases/record/record_type_return_on_function_with_type_paremeter.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_return_on_function_with_type_paremeter.dart.intertwined.expect @@ -10,7 +10,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(, null, null, , Instance of 'ComplexTypeInfo', null, f1, false) listener: beginTopLevelMethod(, null, null) - parseRecordType((, ) + parseRecordType((, , false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -115,7 +115,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(}, null, null, }, Instance of 'ComplexTypeInfo', null, f2, false) listener: beginTopLevelMethod(}, null, null) - parseRecordType((, }) + parseRecordType((, }, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_setter.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_setter.dart.intertwined.expect index aa67a32881d..8457e6aff94 100644 --- a/pkg/front_end/parser_testcases/record/record_type_setter.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_setter.dart.intertwined.expect @@ -10,7 +10,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(, null, null, , Instance of 'ComplexTypeInfo', null, set, false) listener: beginTopLevelMethod(, null, null) - parseRecordType((, ) + parseRecordType((, , false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -110,7 +110,7 @@ parseUnit(() listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -182,7 +182,7 @@ parseUnit(() listener: beginTopLevelMember(() parseTopLevelMethod(;, null, null, ;, Instance of 'ComplexTypeInfo', get, set, false) listener: beginTopLevelMethod(;, null, null) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -267,7 +267,7 @@ parseUnit(() listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.TopLevelMethod, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -363,7 +363,7 @@ parseUnit(() isReservedKeyword(() parseMethod({, null, null, null, null, null, null, null, {, Instance of 'ComplexTypeInfo', null, set, DeclarationKind.Class, Foo, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, null, set) - parseRecordType((, {) + parseRecordType((, {, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -468,7 +468,7 @@ parseUnit(() listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.NonStaticMethod, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -543,7 +543,7 @@ parseUnit(() listener: beginMember() parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'ComplexTypeInfo', get, set, DeclarationKind.Class, Foo, false) listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, get, set) - parseRecordType((, ;) + parseRecordType((, ;, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -633,7 +633,7 @@ parseUnit(() listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.NonStaticMethod, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -736,7 +736,7 @@ parseUnit(() isReservedKeyword(() parseMethod({, null, null, null, static, null, null, null, static, Instance of 'ComplexTypeInfo', null, set, DeclarationKind.Class, Bar, false) listener: beginMethod(DeclarationKind.Class, null, null, static, null, null, null, set) - parseRecordType((, static) + parseRecordType((, static, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -840,7 +840,7 @@ parseUnit(() listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.StaticMethod, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -914,7 +914,7 @@ parseUnit(() listener: beginMember() parseMethod(;, null, null, null, static, null, null, null, static, Instance of 'ComplexTypeInfo', get, set, DeclarationKind.Class, Bar, false) listener: beginMethod(DeclarationKind.Class, null, null, static, null, null, get, set) - parseRecordType((, static) + parseRecordType((, static, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -1003,7 +1003,7 @@ parseUnit(() listener: beginMetadataStar(() listener: endMetadataStar(0) listener: beginFormalParameter((, MemberKind.StaticMethod, null, null, null) - parseRecordType((, () + parseRecordType((, (, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_type_with_modifiers.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_with_modifiers.dart.intertwined.expect index 700209c6275..19ea69cc409 100644 --- a/pkg/front_end/parser_testcases/record/record_type_with_modifiers.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_type_with_modifiers.dart.intertwined.expect @@ -33,7 +33,7 @@ parseUnit(class) listener: beginMember() parseFields({, null, null, null, null, null, null, final, final, Instance of 'ComplexTypeInfo', x, DeclarationKind.Class, Foo, false) listener: beginFields(DeclarationKind.Class, null, null, null, null, null, null, final, {) - parseRecordType((, final) + parseRecordType((, final, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -94,7 +94,7 @@ parseUnit(class) listener: beginMember() parseFields(;, null, null, null, static, null, null, null, static, Instance of 'ComplexTypeInfo', y, DeclarationKind.Class, Foo, false) listener: beginFields(DeclarationKind.Class, null, null, null, static, null, null, null, ;) - parseRecordType((, static) + parseRecordType((, static, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -155,7 +155,7 @@ parseUnit(class) listener: beginMember() parseFields(;, null, null, null, static, null, null, final, final, Instance of 'ComplexTypeInfo', z, DeclarationKind.Class, Foo, false) listener: beginFields(DeclarationKind.Class, null, null, null, static, null, null, final, ;) - parseRecordType((, final) + parseRecordType((, final, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -216,7 +216,7 @@ parseUnit(class) listener: beginMember() parseFields(;, null, null, null, static, null, null, const, const, Instance of 'ComplexTypeInfo', b, DeclarationKind.Class, Foo, false) listener: beginFields(DeclarationKind.Class, null, null, null, static, null, null, const, ;) - parseRecordType((, const) + parseRecordType((, const, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -277,7 +277,7 @@ parseUnit(class) listener: beginMember() parseFields(;, null, null, null, null, null, late, null, late, Instance of 'ComplexTypeInfo', c, DeclarationKind.Class, Foo, false) listener: beginFields(DeclarationKind.Class, null, null, null, null, null, late, null, ;) - parseRecordType((, late) + parseRecordType((, late, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() @@ -316,7 +316,7 @@ parseUnit(class) listener: beginMember() parseFields(;, null, null, null, null, null, late, final, final, Instance of 'ComplexTypeInfo', d, DeclarationKind.Class, Foo, false) listener: beginFields(DeclarationKind.Class, null, null, null, null, null, late, final, ;) - parseRecordType((, final) + parseRecordType((, final, false) listener: beginRecordType(() parseRecordTypeField((, identifierIsOptional: true) listener: beginRecordTypeEntry() diff --git a/pkg/front_end/parser_testcases/record/record_typedef.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_typedef.dart.intertwined.expect index db34d163d0e..17d0e754ec5 100644 --- a/pkg/front_end/parser_testcases/record/record_typedef.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/record/record_typedef.dart.intertwined.expect @@ -10,7 +10,7 @@ parseUnit(typedef) parseTypedef(typedef) listener: beginUncategorizedTopLevelDeclaration(typedef) listener: beginTypedef(typedef) - parseRecordType((, typedef) + parseRecordType((, typedef, false) listener: beginRecordType(() parseRecordTypeNamedFields(() listener: beginRecordTypeNamedFields({) diff --git a/pkg/front_end/test/parser_test_parser.dart b/pkg/front_end/test/parser_test_parser.dart index 80965a34280..b1667512d6c 100644 --- a/pkg/front_end/test/parser_test_parser.dart +++ b/pkg/front_end/test/parser_test_parser.dart @@ -438,10 +438,12 @@ class TestParser extends Parser { } @override - Token parseRecordType(final Token start, Token token) { - doPrint('parseRecordType(' '$start, ' '$token)'); + Token parseRecordType( + final Token start, Token token, bool questionMarkPartOfType) { + doPrint( + 'parseRecordType(' '$start, ' '$token, ' '$questionMarkPartOfType)'); indent++; - var result = super.parseRecordType(start, token); + var result = super.parseRecordType(start, token, questionMarkPartOfType); indent--; return result; }