[parser] Empty record

https://github.com/dart-lang/language/pull/2535

Change-Id: I8241119ee858ce39673472056b88c9393799e1a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262600
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Jens Johansen 2022-10-06 06:34:58 +00:00 committed by Commit Queue
parent 4d9bbde5ce
commit e860cf241b
48 changed files with 1172 additions and 343 deletions

View file

@ -9961,17 +9961,6 @@ const MessageCode messagePrivateNamedParameter = const MessageCode(
analyzerCodes: <String>["PRIVATE_OPTIONAL_PARAMETER"],
problemMessage: r"""An optional named parameter can't start with '_'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeRecordLiteralEmpty = messageRecordLiteralEmpty;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageRecordLiteralEmpty = const MessageCode(
"RecordLiteralEmpty",
index: 128,
problemMessage: r"""Record literal can't be empty.""",
correctionMessage:
r"""Try adding elements or use 'Record.empty()' instead.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeRecordLiteralOnePositionalFieldNoTrailingComma =
messageRecordLiteralOnePositionalFieldNoTrailingComma;
@ -9984,6 +9973,18 @@ const MessageCode messageRecordLiteralOnePositionalFieldNoTrailingComma =
r"""Record literal with one field requires a trailing comma.""",
correctionMessage: r"""Try adding a trailing comma.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeRecordLiteralZeroFieldsWithTrailingComma =
messageRecordLiteralZeroFieldsWithTrailingComma;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageRecordLiteralZeroFieldsWithTrailingComma =
const MessageCode("RecordLiteralZeroFieldsWithTrailingComma",
index: 128,
problemMessage:
r"""Record literal without fields can't have a trailing comma.""",
correctionMessage: r"""Try removing the trailing comma.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeRecordTypeOnePositionalFieldNoTrailingComma =
messageRecordTypeOnePositionalFieldNoTrailingComma;
@ -9991,11 +9992,23 @@ const Code<Null> codeRecordTypeOnePositionalFieldNoTrailingComma =
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageRecordTypeOnePositionalFieldNoTrailingComma =
const MessageCode("RecordTypeOnePositionalFieldNoTrailingComma",
index: 130,
index: 131,
problemMessage:
r"""Record type with one entry requires a trailing comma.""",
correctionMessage: r"""Try adding a trailing comma.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeRecordTypeZeroFieldsButTrailingComma =
messageRecordTypeZeroFieldsButTrailingComma;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageRecordTypeZeroFieldsButTrailingComma =
const MessageCode("RecordTypeZeroFieldsButTrailingComma",
index: 130,
problemMessage:
r"""Record type without fields can't have a trailing comma.""",
correctionMessage: r"""Try removing the trailing comma.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeRedirectingConstructorWithAnotherInitializer =
messageRedirectingConstructorWithAnotherInitializer;

View file

@ -1403,20 +1403,16 @@ class Parser {
/// Parse a record type similarly as a formal parameter list of a function.
///
/// TODO(jensj): Update this to fit any new updates to the spec.
/// E.g. having two recordTypeNamedField entries doesn't make sense.
///
/// recordType ::= '(' recordTypeFields ',' recordTypeNamedFields ')'
/// | '(' recordTypeFields ','? ')'
/// | '(' recordTypeNamedFields ')'
/// | '(' recordTypeNamedFields? ')'
///
/// recordTypeFields ::= recordTypeField ( ',' recordTypeField )*
/// recordTypeField ::= metadata type identifier?
///
/// recordTypeNamedFields ::= '{' recordTypeNamedField
/// ( ',' recordTypeNamedField )* ','? '}'
/// recordTypeNamedField ::= type identifier
/// recordTypeNamedField ::= metadata typedIdentifier
/// recordTypeNamedField ::= metadata type identifier
Token parseRecordType(final Token start, Token token) {
token = token.next!;
assert(optional('(', token));
@ -1429,11 +1425,18 @@ class Parser {
int parameterCount = 0;
bool hasNamedFields = false;
bool sawComma = false;
Token? illegalTrailingComma;
while (true) {
Token next = token.next!;
if (optional(')', next)) {
token = next;
break;
} else if (parameterCount == 0 &&
optional(',', next) &&
optional(')', next.next!)) {
illegalTrailingComma = next;
token = next.next!;
break;
}
++parameterCount;
String? value = next.stringValue;
@ -1478,7 +1481,11 @@ class Parser {
}
assert(optional(')', token));
if (parameterCount == 1 && !hasNamedFields && !sawComma) {
if (parameterCount == 0 && illegalTrailingComma != null) {
// Empty record type with a comma `(,)`.
reportRecoverableError(illegalTrailingComma,
codes.messageRecordTypeZeroFieldsButTrailingComma);
} else if (parameterCount == 1 && !hasNamedFields && !sawComma) {
// Single non-named element without trailing comma.
reportRecoverableError(
token, codes.messageRecordTypeOnePositionalFieldNoTrailingComma);
@ -6143,9 +6150,20 @@ class Parser {
int count = 0;
bool wasRecord = constKeywordForRecord != null;
bool wasValidRecord = false;
Token? illegalTrailingComma;
while (true) {
Token next = token.next!;
if ((count > 0 || wasRecord) && optional(')', next)) {
if (optional(')', next)) {
if (count == 0) {
wasRecord = true;
}
break;
} else if (count == 0 &&
optional(',', next) &&
optional(')', next.next!)) {
illegalTrailingComma = next;
wasRecord = true;
token = next;
break;
}
Token? colon = null;
@ -6179,8 +6197,10 @@ class Parser {
assert(wasRecord || count <= 1);
if (wasRecord) {
if (count == 0) {
reportRecoverableError(token, codes.messageRecordLiteralEmpty);
if (count == 0 && illegalTrailingComma != null) {
// Empty record literal with a comma `(,)`.
reportRecoverableError(illegalTrailingComma,
codes.messageRecordLiteralZeroFieldsWithTrailingComma);
} else if (count == 1 && !wasValidRecord) {
reportRecoverableError(
token, codes.messageRecordLiteralOnePositionalFieldNoTrailingComma);
@ -9484,9 +9504,7 @@ class Parser {
assert(wasRecord || count <= 1);
if (wasRecord) {
if (count == 0) {
reportRecoverableError(token, codes.messageRecordLiteralEmpty);
} else if (count == 1 && !wasValidRecord) {
if (count == 1 && !wasValidRecord) {
reportRecoverableError(
token, codes.messageRecordLiteralOnePositionalFieldNoTrailingComma);
}

View file

@ -2180,8 +2180,12 @@ ParserErrorCode.EMPTY_ENUM_BODY:
notes: |-
We can't guess at the names or number of the enum constants that should be
added.
ParserErrorCode.EMPTY_RECORD_LITERAL_WITH_COMMA:
status: needsEvaluation
ParserErrorCode.EMPTY_RECORD_TYPE_NAMED_FIELDS_LIST:
status: needsEvaluation
ParserErrorCode.EMPTY_RECORD_TYPE_WITH_COMMA:
status: needsEvaluation
ParserErrorCode.ENUM_IN_CLASS:
status: needsEvaluation
ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND:
@ -2464,8 +2468,6 @@ ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP:
status: needsEvaluation
ParserErrorCode.PREFIX_AFTER_COMBINATOR:
status: needsEvaluation
ParserErrorCode.RECORD_LITERAL_EMPTY:
status: needsEvaluation
ParserErrorCode.RECORD_LITERAL_ONE_POSITIONAL_NO_TRAILING_COMMA:
status: needsEvaluation
ParserErrorCode.RECORD_TYPE_ONE_POSITIONAL_NO_TRAILING_COMMA:

View file

@ -1451,13 +1451,14 @@ void f() {
''',
atEnd: true);
_assertHasChange(
'Insert a newline at the end of the current line',
'Add a semicolon and newline',
'''
void f() {
int g()
int g();
}
''',
(s) => _afterLast(s, '()'));
(s) => _afterLast(s, '();\n '));
}
@failingTest

View file

@ -749,7 +749,9 @@ const List<ErrorCode> errorCodeValues = [
ParserErrorCode.DUPLICATE_PREFIX,
ParserErrorCode.DUPLICATED_MODIFIER,
ParserErrorCode.EMPTY_ENUM_BODY,
ParserErrorCode.EMPTY_RECORD_LITERAL_WITH_COMMA,
ParserErrorCode.EMPTY_RECORD_TYPE_NAMED_FIELDS_LIST,
ParserErrorCode.EMPTY_RECORD_TYPE_WITH_COMMA,
ParserErrorCode.ENUM_IN_CLASS,
ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND,
ParserErrorCode.EXPECTED_BODY,
@ -891,7 +893,6 @@ const List<ErrorCode> errorCodeValues = [
ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT,
ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP,
ParserErrorCode.PREFIX_AFTER_COMBINATOR,
ParserErrorCode.RECORD_LITERAL_EMPTY,
ParserErrorCode.RECORD_LITERAL_ONE_POSITIONAL_NO_TRAILING_COMMA,
ParserErrorCode.RECORD_TYPE_ONE_POSITIONAL_NO_TRAILING_COMMA,
ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY,

View file

@ -142,8 +142,9 @@ final fastaAnalyzerErrorCodes = <ErrorCode?>[
ParserErrorCode.INVALID_UNICODE_ESCAPE_U_BRACKET,
ParserErrorCode.INVALID_UNICODE_ESCAPE_STARTED,
ParserErrorCode.RECORD_LITERAL_ONE_POSITIONAL_NO_TRAILING_COMMA,
ParserErrorCode.RECORD_LITERAL_EMPTY,
ParserErrorCode.EMPTY_RECORD_LITERAL_WITH_COMMA,
ParserErrorCode.EMPTY_RECORD_TYPE_NAMED_FIELDS_LIST,
ParserErrorCode.EMPTY_RECORD_TYPE_WITH_COMMA,
ParserErrorCode.RECORD_TYPE_ONE_POSITIONAL_NO_TRAILING_COMMA,
];
@ -435,6 +436,13 @@ class ParserErrorCode extends ErrorCode {
correctionMessage: "Try declaring a constant.",
);
static const ParserErrorCode EMPTY_RECORD_LITERAL_WITH_COMMA =
ParserErrorCode(
'EMPTY_RECORD_LITERAL_WITH_COMMA',
"Record literal without fields can't have a trailing comma.",
correctionMessage: "Try removing the trailing comma.",
);
static const ParserErrorCode EMPTY_RECORD_TYPE_NAMED_FIELDS_LIST =
ParserErrorCode(
'EMPTY_RECORD_TYPE_NAMED_FIELDS_LIST',
@ -442,6 +450,12 @@ class ParserErrorCode extends ErrorCode {
correctionMessage: "Try adding a record type named field to the list.",
);
static const ParserErrorCode EMPTY_RECORD_TYPE_WITH_COMMA = ParserErrorCode(
'EMPTY_RECORD_TYPE_WITH_COMMA',
"Record type without fields can't have a trailing comma.",
correctionMessage: "Try removing the trailing comma.",
);
static const ParserErrorCode ENUM_IN_CLASS = ParserErrorCode(
'ENUM_IN_CLASS',
"Enums can't be declared inside classes.",
@ -1422,12 +1436,6 @@ class ParserErrorCode extends ErrorCode {
correctionMessage: "Try moving the prefix before the combinators.",
);
static const ParserErrorCode RECORD_LITERAL_EMPTY = ParserErrorCode(
'RECORD_LITERAL_EMPTY',
"Record literal can't be empty.",
correctionMessage: "Try adding elements or use 'Record.empty()' instead.",
);
static const ParserErrorCode RECORD_LITERAL_ONE_POSITIONAL_NO_TRAILING_COMMA =
ParserErrorCode(
'RECORD_LITERAL_ONE_POSITIONAL_NO_TRAILING_COMMA',

View file

@ -1540,7 +1540,7 @@ void Function<A>(core.List<core.int> x) m() => null;
// https://github.com/dart-lang/sdk/issues/37693
parseCompilationUnit('class C{ C() : super() * (); }', errors: [
expectedError(ParserErrorCode.INVALID_INITIALIZER, 15, 12),
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 26, 1),
expectedError(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 25, 1),
]);
}

View file

@ -1445,7 +1445,7 @@ class Wrong<T> {
expectNotNullIfNoErrors(statement);
listener.assertErrors([
expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1),
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 9, 1),
expectedError(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 8, 1),
expectedError(ParserErrorCode.EXPECTED_TOKEN, 9, 1),
]);
}

View file

@ -490,7 +490,7 @@ class B = Object with A {}''', codes:
CompilationUnit unit =
parseCompilationUnit("class A { A() : a = (){}; var v; }", codes: [
ParserErrorCode.EXPECTED_CLASS_MEMBER,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPERIMENT_NOT_ENABLED,
]);
// Make sure we recovered and parsed "var v" correctly
ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;

View file

@ -127,7 +127,6 @@ class C {
expectedError(ParserErrorCode.EXPECTED_IDENTIFIER_BUT_GOT_KEYWORD, 24, 5),
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 24, 5),
expectedError(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 29, 1),
expectedError(ParserErrorCode.RECORD_LITERAL_EMPTY, 30, 1),
]);
}

View file

@ -24,7 +24,6 @@ class C {
error(ParserErrorCode.INVALID_SUPER_IN_INITIALIZER, 18, 5),
error(ParserErrorCode.EXPECTED_IDENTIFIER_BUT_GOT_KEYWORD, 24, 5),
error(ParserErrorCode.MISSING_IDENTIFIER, 24, 5),
error(ParserErrorCode.RECORD_LITERAL_EMPTY, 30, 1)
]);
}
}

View file

@ -423,9 +423,10 @@ void f(int p) {
p.();
}
''', [
if (!isNullSafetyEnabled)
error(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 32, 1),
error(ParserErrorCode.MISSING_IDENTIFIER, 32, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 32, 1),
error(ParserErrorCode.MISSING_IDENTIFIER, 33, 1),
]);
}
}

View file

@ -334,15 +334,15 @@ RecordLiteralOnePositionalFieldNoTrailingComma:
var record = const (1);
}
RecordLiteralEmpty:
problemMessage: "Record literal can't be empty."
correctionMessage: "Try adding elements or use 'Record.empty()' instead."
analyzerCode: ParserErrorCode.RECORD_LITERAL_EMPTY
RecordLiteralZeroFieldsWithTrailingComma:
problemMessage: "Record literal without fields can't have a trailing comma."
correctionMessage: "Try removing the trailing comma."
analyzerCode: ParserErrorCode.EMPTY_RECORD_LITERAL_WITH_COMMA
index: 128
experiments: records
script: >
main() {
var record = const ();
var record = (,);
}
EmptyRecordTypeNamedFieldsList:
@ -356,11 +356,22 @@ EmptyRecordTypeNamedFieldsList:
(int, int, {/*missing*/}) record = (1, 2,);
}
RecordTypeZeroFieldsButTrailingComma:
problemMessage: "Record type without fields can't have a trailing comma."
correctionMessage: "Try removing the trailing comma."
analyzerCode: ParserErrorCode.EMPTY_RECORD_TYPE_WITH_COMMA
index: 130
experiments: records
script: >
main() {
(,) record = ();
}
RecordTypeOnePositionalFieldNoTrailingComma:
problemMessage: "Record type with one entry requires a trailing comma."
correctionMessage: "Try adding a trailing comma."
analyzerCode: ParserErrorCode.RECORD_TYPE_ONE_POSITIONAL_NO_TRAILING_COMMA
index: 130
index: 131
experiments: records
script: >
main() {

View file

@ -16,10 +16,6 @@ parser/general/augment_super:2:11: Expected ';' after this.
augment super();
^^^^^
parser/general/augment_super:2:17: Expected an identifier, but got ')'.
augment super();
^
parser/general/augment_super:5:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
augment void topLevelMethodError() {
^^^^^^^
@ -76,10 +72,6 @@ parser/general/augment_super:21:11: Expected ';' after this.
augment super();
^^^^^
parser/general/augment_super:21:17: Expected an identifier, but got ')'.
augment super();
^
parser/general/augment_super:22:11: 'super' can't be used as an identifier because it's a keyword.
augment super;
^^^^^
@ -112,10 +104,6 @@ parser/general/augment_super:29:13: Expected ';' after this.
augment super();
^^^^^
parser/general/augment_super:29:19: Expected an identifier, but got ')'.
augment super();
^
parser/general/augment_super:32:3: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
augment void instanceMethodErrors() {
^^^^^^^
@ -172,10 +160,6 @@ parser/general/augment_super:48:13: Expected ';' after this.
augment super();
^^^^^
parser/general/augment_super:48:19: Expected an identifier, but got ')'.
augment super();
^
parser/general/augment_super:49:13: 'super' can't be used as an identifier because it's a keyword.
augment super;
^^^^^
@ -221,12 +205,7 @@ beginCompilationUnit(augment)
handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
endVariablesDeclaration(1, ;)
beginParenthesizedExpressionOrRecordLiteral(()
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
handleIdentifier(, expression)
handleNoTypeArguments())
handleNoArguments())
handleSend(, ))
endParenthesizedExpression(()
endRecordLiteral((, 0, null)
handleExpressionStatement(;)
endBlockFunctionBody(2, {, })
endTopLevelMethod(void, null, })
@ -439,12 +418,7 @@ beginCompilationUnit(augment)
handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
endVariablesDeclaration(1, ;)
beginParenthesizedExpressionOrRecordLiteral(()
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
handleIdentifier(, expression)
handleNoTypeArguments())
handleNoArguments())
handleSend(, ))
endParenthesizedExpression(()
endRecordLiteral((, 0, null)
handleExpressionStatement(;)
beginMetadataStar(augment)
endMetadataStar(0)
@ -543,12 +517,7 @@ beginCompilationUnit(augment)
handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
endVariablesDeclaration(1, ;)
beginParenthesizedExpressionOrRecordLiteral(()
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
handleIdentifier(, expression)
handleNoTypeArguments())
handleNoArguments())
handleSend(, ))
endParenthesizedExpression(()
endRecordLiteral((, 0, null)
handleExpressionStatement(;)
endBlockFunctionBody(2, {, })
endClassMethod(null, void, (, null, })
@ -744,12 +713,7 @@ beginCompilationUnit(augment)
handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
endVariablesDeclaration(1, ;)
beginParenthesizedExpressionOrRecordLiteral(()
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
handleIdentifier(, expression)
handleNoTypeArguments())
handleNoArguments())
handleSend(, ))
endParenthesizedExpression(()
endRecordLiteral((, 0, null)
handleExpressionStatement(;)
beginMetadataStar(augment)
endMetadataStar(0)

View file

@ -88,23 +88,8 @@ parseUnit(augment)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(;)
parseParenthesizedExpressionOrRecordLiteral(;, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
parseExpression(()
parsePrecedenceExpression((, 1, true)
parseUnaryExpression((, true)
parsePrimary((, expression)
parseSend((, expression)
isNextIdentifier(()
ensureIdentifier((, expression)
reportRecoverableErrorWithToken(), Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
rewriter()
listener: handleIdentifier(, expression)
listener: handleNoTypeArguments())
parseArgumentsOpt()
listener: handleNoArguments())
listener: handleSend(, ))
ensureCloseParen(, ()
listener: endParenthesizedExpression(()
ensureCloseParen((, ()
listener: endRecordLiteral((, 0, null)
ensureSemicolon())
listener: handleExpressionStatement(;)
notEofOrValue(}, })
@ -601,23 +586,8 @@ parseUnit(augment)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(;)
parseParenthesizedExpressionOrRecordLiteral(;, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
parseExpression(()
parsePrecedenceExpression((, 1, true)
parseUnaryExpression((, true)
parsePrimary((, expression)
parseSend((, expression)
isNextIdentifier(()
ensureIdentifier((, expression)
reportRecoverableErrorWithToken(), Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
rewriter()
listener: handleIdentifier(, expression)
listener: handleNoTypeArguments())
parseArgumentsOpt()
listener: handleNoArguments())
listener: handleSend(, ))
ensureCloseParen(, ()
listener: endParenthesizedExpression(()
ensureCloseParen((, ()
listener: endRecordLiteral((, 0, null)
ensureSemicolon())
listener: handleExpressionStatement(;)
notEofOrValue(}, augment)
@ -849,23 +819,8 @@ parseUnit(augment)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(;)
parseParenthesizedExpressionOrRecordLiteral(;, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
parseExpression(()
parsePrecedenceExpression((, 1, true)
parseUnaryExpression((, true)
parsePrimary((, expression)
parseSend((, expression)
isNextIdentifier(()
ensureIdentifier((, expression)
reportRecoverableErrorWithToken(), Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
rewriter()
listener: handleIdentifier(, expression)
listener: handleNoTypeArguments())
parseArgumentsOpt()
listener: handleNoArguments())
listener: handleSend(, ))
ensureCloseParen(, ()
listener: endParenthesizedExpression(()
ensureCloseParen((, ()
listener: endRecordLiteral((, 0, null)
ensureSemicolon())
listener: handleExpressionStatement(;)
notEofOrValue(}, })
@ -1349,23 +1304,8 @@ parseUnit(augment)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(;)
parseParenthesizedExpressionOrRecordLiteral(;, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
parseExpression(()
parsePrecedenceExpression((, 1, true)
parseUnaryExpression((, true)
parsePrimary((, expression)
parseSend((, expression)
isNextIdentifier(()
ensureIdentifier((, expression)
reportRecoverableErrorWithToken(), Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
rewriter()
listener: handleIdentifier(, expression)
listener: handleNoTypeArguments())
parseArgumentsOpt()
listener: handleNoArguments())
listener: handleSend(, ))
ensureCloseParen(, ()
listener: endParenthesizedExpression(()
ensureCloseParen((, ()
listener: endRecordLiteral((, 0, null)
ensureSemicolon())
listener: handleExpressionStatement(;)
notEofOrValue(}, augment)

View file

@ -1,7 +1,7 @@
NOTICE: Stream was rewritten by parser!
augment ;void topLevelMethod() {
augment super;(*synthetic*);
augment super;();
}
augment ;void topLevelMethodError() {
@ -20,7 +20,7 @@ augment super = value;
}
void injectedTopLevelMethod() {
augment super;(*synthetic*);
augment super;();
augment super;
augment int ;local;
augment;
@ -28,7 +28,7 @@ augment;
augment ;class Class {
augment ;void instanceMethod() {
augment super;(*synthetic*);
augment super;();
}
augment ;void instanceMethodErrors() {
@ -47,7 +47,7 @@ augment super = value;
}
void injectedInstanceMethod() {
augment super;(*synthetic*);
augment super;();
augment super;
augment int ;local;
augment;
@ -55,7 +55,7 @@ augment;
}
augment[StringToken] ;[SyntheticToken]void[KeywordToken] topLevelMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken][SyntheticStringToken])[SimpleToken];[SimpleToken]
augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken])[SimpleToken];[SimpleToken]
}[SimpleToken]
augment[StringToken] ;[SyntheticToken]void[KeywordToken] topLevelMethodError[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
@ -74,7 +74,7 @@ augment[StringToken] super[KeywordToken] =[SimpleToken] value[StringToken];[Simp
}[SimpleToken]
void[KeywordToken] injectedTopLevelMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken][SyntheticStringToken])[SimpleToken];[SimpleToken]
augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken])[SimpleToken];[SimpleToken]
augment[StringToken] super[KeywordToken];[SimpleToken]
augment[StringToken] int[StringToken] ;[SyntheticToken]local[StringToken];[SimpleToken]
augment[StringToken];[SimpleToken]
@ -82,7 +82,7 @@ augment[StringToken];[SimpleToken]
augment[StringToken] ;[SyntheticToken]class[KeywordToken] Class[StringToken] {[BeginToken]
augment[StringToken] ;[SyntheticToken]void[KeywordToken] instanceMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken][SyntheticStringToken])[SimpleToken];[SimpleToken]
augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken])[SimpleToken];[SimpleToken]
}[SimpleToken]
augment[StringToken] ;[SyntheticToken]void[KeywordToken] instanceMethodErrors[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
@ -101,7 +101,7 @@ augment[StringToken] super[KeywordToken] =[SimpleToken] value[StringToken];[Simp
}[SimpleToken]
void[KeywordToken] injectedInstanceMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken][SyntheticStringToken])[SimpleToken];[SimpleToken]
augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken])[SimpleToken];[SimpleToken]
augment[StringToken] super[KeywordToken];[SimpleToken]
augment[StringToken] int[StringToken] ;[SyntheticToken]local[StringToken];[SimpleToken]
augment[StringToken];[SimpleToken]

View file

@ -0,0 +1,15 @@
main() {
// OK.
() emptyRecord1 = ();
// Error: Empty with comma.
(,) emptyRecord2 = ();
() emptyRecord3 = (,);
(,) emptyRecord4 = (,);
// Error: More than one trailing comma.
(int, ,) emptyRecord5 = (42, 42, ,);
(int, int, ,) emptyRecord6 = (42, 42, ,);
(int, , ,) emptyRecord7 = (42, 42, , ,);
(int, int, , ,) emptyRecord8 = (42, 42, , ,);
}

View file

@ -0,0 +1,330 @@
Problems reported:
parser/record/record_and_commas:6:4: Record type without fields can't have a trailing comma.
(,) emptyRecord2 = ();
^
parser/record/record_and_commas:7:22: Record literal without fields can't have a trailing comma.
() emptyRecord3 = (,);
^
parser/record/record_and_commas:8:4: Record type without fields can't have a trailing comma.
(,) emptyRecord4 = (,);
^
parser/record/record_and_commas:8:23: Record literal without fields can't have a trailing comma.
(,) emptyRecord4 = (,);
^
parser/record/record_and_commas:11:9: Expected a type, but got ','.
(int, ,) emptyRecord5 = (42, 42, ,);
^
parser/record/record_and_commas:11:36: Expected an identifier, but got ','.
(int, ,) emptyRecord5 = (42, 42, ,);
^
parser/record/record_and_commas:12:14: Expected a type, but got ','.
(int, int, ,) emptyRecord6 = (42, 42, ,);
^
parser/record/record_and_commas:12:41: Expected an identifier, but got ','.
(int, int, ,) emptyRecord6 = (42, 42, ,);
^
parser/record/record_and_commas:13:9: Expected a type, but got ','.
(int, , ,) emptyRecord7 = (42, 42, , ,);
^
parser/record/record_and_commas:13:11: Expected a type, but got ','.
(int, , ,) emptyRecord7 = (42, 42, , ,);
^
parser/record/record_and_commas:13:38: Expected an identifier, but got ','.
(int, , ,) emptyRecord7 = (42, 42, , ,);
^
parser/record/record_and_commas:13:40: Expected an identifier, but got ','.
(int, , ,) emptyRecord7 = (42, 42, , ,);
^
parser/record/record_and_commas:14:14: Expected a type, but got ','.
(int, int, , ,) emptyRecord8 = (42, 42, , ,);
^
parser/record/record_and_commas:14:16: Expected a type, but got ','.
(int, int, , ,) emptyRecord8 = (42, 42, , ,);
^
parser/record/record_and_commas:14:43: Expected an identifier, but got ','.
(int, int, , ,) emptyRecord8 = (42, 42, , ,);
^
parser/record/record_and_commas:14:45: Expected an identifier, but got ','.
(int, int, , ,) emptyRecord8 = (42, 42, , ,);
^
beginCompilationUnit(main)
beginMetadataStar(main)
endMetadataStar(0)
beginTopLevelMember(main)
beginTopLevelMethod(, null, null)
handleNoType()
handleIdentifier(main, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginBlockFunctionBody({)
beginMetadataStar(()
endMetadataStar(0)
beginRecordType(()
endRecordType((, null, 0, false)
beginVariablesDeclaration(emptyRecord1, null, null)
handleIdentifier(emptyRecord1, localVariableDeclaration)
beginInitializedIdentifier(emptyRecord1)
beginVariableInitializer(=)
beginParenthesizedExpressionOrRecordLiteral(()
endRecordLiteral((, 0, null)
endVariableInitializer(=)
endInitializedIdentifier(emptyRecord1)
endVariablesDeclaration(1, ;)
beginMetadataStar(()
endMetadataStar(0)
beginRecordType(()
handleRecoverableError(RecordTypeZeroFieldsButTrailingComma, ,, ,)
endRecordType((, null, 0, false)
beginVariablesDeclaration(emptyRecord2, null, null)
handleIdentifier(emptyRecord2, localVariableDeclaration)
beginInitializedIdentifier(emptyRecord2)
beginVariableInitializer(=)
beginParenthesizedExpressionOrRecordLiteral(()
endRecordLiteral((, 0, null)
endVariableInitializer(=)
endInitializedIdentifier(emptyRecord2)
endVariablesDeclaration(1, ;)
beginMetadataStar(()
endMetadataStar(0)
beginRecordType(()
endRecordType((, null, 0, false)
beginVariablesDeclaration(emptyRecord3, null, null)
handleIdentifier(emptyRecord3, localVariableDeclaration)
beginInitializedIdentifier(emptyRecord3)
beginVariableInitializer(=)
beginParenthesizedExpressionOrRecordLiteral(()
handleRecoverableError(RecordLiteralZeroFieldsWithTrailingComma, ,, ,)
endRecordLiteral((, 0, null)
endVariableInitializer(=)
endInitializedIdentifier(emptyRecord3)
endVariablesDeclaration(1, ;)
beginMetadataStar(()
endMetadataStar(0)
beginRecordType(()
handleRecoverableError(RecordTypeZeroFieldsButTrailingComma, ,, ,)
endRecordType((, null, 0, false)
beginVariablesDeclaration(emptyRecord4, null, null)
handleIdentifier(emptyRecord4, localVariableDeclaration)
beginInitializedIdentifier(emptyRecord4)
beginVariableInitializer(=)
beginParenthesizedExpressionOrRecordLiteral(()
handleRecoverableError(RecordLiteralZeroFieldsWithTrailingComma, ,, ,)
endRecordLiteral((, 0, null)
endVariableInitializer(=)
endInitializedIdentifier(emptyRecord4)
endVariablesDeclaration(1, ;)
beginMetadataStar(()
endMetadataStar(0)
beginRecordType(()
beginRecordTypeEntry()
beginMetadataStar(int)
endMetadataStar(0)
handleIdentifier(int, typeReference)
handleNoTypeArguments(,)
handleType(int, null)
handleNoName(,)
endRecordTypeEntry()
beginRecordTypeEntry()
beginMetadataStar(,)
endMetadataStar(0)
handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
handleIdentifier(, typeReference)
handleNoTypeArguments(,)
handleType(, null)
handleNoName(,)
endRecordTypeEntry()
endRecordType((, null, 2, false)
beginVariablesDeclaration(emptyRecord5, null, null)
handleIdentifier(emptyRecord5, localVariableDeclaration)
beginInitializedIdentifier(emptyRecord5)
beginVariableInitializer(=)
beginParenthesizedExpressionOrRecordLiteral(()
handleLiteralInt(42)
handleLiteralInt(42)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
handleIdentifier(, expression)
handleNoTypeArguments(,)
handleNoArguments(,)
handleSend(, ,)
endRecordLiteral((, 3, null)
endVariableInitializer(=)
endInitializedIdentifier(emptyRecord5)
endVariablesDeclaration(1, ;)
beginMetadataStar(()
endMetadataStar(0)
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()
beginRecordTypeEntry()
beginMetadataStar(,)
endMetadataStar(0)
handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
handleIdentifier(, typeReference)
handleNoTypeArguments(,)
handleType(, null)
handleNoName(,)
endRecordTypeEntry()
endRecordType((, null, 3, false)
beginVariablesDeclaration(emptyRecord6, null, null)
handleIdentifier(emptyRecord6, localVariableDeclaration)
beginInitializedIdentifier(emptyRecord6)
beginVariableInitializer(=)
beginParenthesizedExpressionOrRecordLiteral(()
handleLiteralInt(42)
handleLiteralInt(42)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
handleIdentifier(, expression)
handleNoTypeArguments(,)
handleNoArguments(,)
handleSend(, ,)
endRecordLiteral((, 3, null)
endVariableInitializer(=)
endInitializedIdentifier(emptyRecord6)
endVariablesDeclaration(1, ;)
beginMetadataStar(()
endMetadataStar(0)
beginRecordType(()
beginRecordTypeEntry()
beginMetadataStar(int)
endMetadataStar(0)
handleIdentifier(int, typeReference)
handleNoTypeArguments(,)
handleType(int, null)
handleNoName(,)
endRecordTypeEntry()
beginRecordTypeEntry()
beginMetadataStar(,)
endMetadataStar(0)
handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
handleIdentifier(, typeReference)
handleNoTypeArguments(,)
handleType(, null)
handleNoName(,)
endRecordTypeEntry()
beginRecordTypeEntry()
beginMetadataStar(,)
endMetadataStar(0)
handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
handleIdentifier(, typeReference)
handleNoTypeArguments(,)
handleType(, null)
handleNoName(,)
endRecordTypeEntry()
endRecordType((, null, 3, false)
beginVariablesDeclaration(emptyRecord7, null, null)
handleIdentifier(emptyRecord7, localVariableDeclaration)
beginInitializedIdentifier(emptyRecord7)
beginVariableInitializer(=)
beginParenthesizedExpressionOrRecordLiteral(()
handleLiteralInt(42)
handleLiteralInt(42)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
handleIdentifier(, expression)
handleNoTypeArguments(,)
handleNoArguments(,)
handleSend(, ,)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
handleIdentifier(, expression)
handleNoTypeArguments(,)
handleNoArguments(,)
handleSend(, ,)
endRecordLiteral((, 4, null)
endVariableInitializer(=)
endInitializedIdentifier(emptyRecord7)
endVariablesDeclaration(1, ;)
beginMetadataStar(()
endMetadataStar(0)
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()
beginRecordTypeEntry()
beginMetadataStar(,)
endMetadataStar(0)
handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
handleIdentifier(, typeReference)
handleNoTypeArguments(,)
handleType(, null)
handleNoName(,)
endRecordTypeEntry()
beginRecordTypeEntry()
beginMetadataStar(,)
endMetadataStar(0)
handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
handleIdentifier(, typeReference)
handleNoTypeArguments(,)
handleType(, null)
handleNoName(,)
endRecordTypeEntry()
endRecordType((, null, 4, false)
beginVariablesDeclaration(emptyRecord8, null, null)
handleIdentifier(emptyRecord8, localVariableDeclaration)
beginInitializedIdentifier(emptyRecord8)
beginVariableInitializer(=)
beginParenthesizedExpressionOrRecordLiteral(()
handleLiteralInt(42)
handleLiteralInt(42)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
handleIdentifier(, expression)
handleNoTypeArguments(,)
handleNoArguments(,)
handleSend(, ,)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
handleIdentifier(, expression)
handleNoTypeArguments(,)
handleNoArguments(,)
handleSend(, ,)
endRecordLiteral((, 4, null)
endVariableInitializer(=)
endInitializedIdentifier(emptyRecord8)
endVariablesDeclaration(1, ;)
endBlockFunctionBody(8, {, })
endTopLevelMethod(main, null, })
endTopLevelDeclaration()
endCompilationUnit(1, )

View file

@ -0,0 +1,574 @@
parseUnit(main)
skipErrorTokens(main)
listener: beginCompilationUnit(main)
syntheticPreviousToken(main)
parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
parseMetadataStar()
listener: beginMetadataStar(main)
listener: endMetadataStar(0)
parseTopLevelMemberImpl()
listener: beginTopLevelMember(main)
isReservedKeyword(()
parseTopLevelMethod(, null, null, , Instance of 'NoType', null, main, false)
listener: beginTopLevelMethod(, null, null)
listener: handleNoType()
ensureIdentifierPotentiallyRecovered(, topLevelFunctionDeclaration, false)
listener: handleIdentifier(main, topLevelFunctionDeclaration)
parseMethodTypeVar(main)
listener: handleNoTypeVariables(()
parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
parseFormalParameters(main, MemberKind.TopLevelMethod)
parseFormalParametersRest((, MemberKind.TopLevelMethod)
listener: beginFormalParameters((, MemberKind.TopLevelMethod)
listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
parseAsyncModifierOpt())
listener: handleAsyncModifier(null, null)
inPlainSync()
parseFunctionBody(), false, false)
listener: beginBlockFunctionBody({)
notEofOrValue(}, ()
parseStatement({)
parseStatementX({)
parseExpressionStatementOrDeclaration({, false)
parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
looksLikeLocalFunction(emptyRecord1)
listener: beginMetadataStar(()
listener: endMetadataStar(0)
parseRecordType((, {)
listener: beginRecordType(()
listener: endRecordType((, null, 0, false)
listener: beginVariablesDeclaration(emptyRecord1, null, null)
parseVariablesDeclarationRest(), true)
parseOptionallyInitializedIdentifier())
ensureIdentifier(), localVariableDeclaration)
listener: handleIdentifier(emptyRecord1, localVariableDeclaration)
listener: beginInitializedIdentifier(emptyRecord1)
parseVariableInitializerOpt(emptyRecord1)
listener: beginVariableInitializer(=)
parseExpression(=)
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(=)
parseParenthesizedExpressionOrRecordLiteral(=, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
ensureCloseParen((, ()
listener: endRecordLiteral((, 0, null)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(emptyRecord1)
ensureSemicolon())
listener: endVariablesDeclaration(1, ;)
notEofOrValue(}, ()
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclaration(;, false)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(emptyRecord2)
listener: beginMetadataStar(()
listener: endMetadataStar(0)
parseRecordType((, ;)
listener: beginRecordType(()
reportRecoverableError(,, RecordTypeZeroFieldsButTrailingComma)
listener: handleRecoverableError(RecordTypeZeroFieldsButTrailingComma, ,, ,)
listener: endRecordType((, null, 0, false)
listener: beginVariablesDeclaration(emptyRecord2, null, null)
parseVariablesDeclarationRest(), true)
parseOptionallyInitializedIdentifier())
ensureIdentifier(), localVariableDeclaration)
listener: handleIdentifier(emptyRecord2, localVariableDeclaration)
listener: beginInitializedIdentifier(emptyRecord2)
parseVariableInitializerOpt(emptyRecord2)
listener: beginVariableInitializer(=)
parseExpression(=)
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(=)
parseParenthesizedExpressionOrRecordLiteral(=, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
ensureCloseParen((, ()
listener: endRecordLiteral((, 0, null)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(emptyRecord2)
ensureSemicolon())
listener: endVariablesDeclaration(1, ;)
notEofOrValue(}, ()
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclaration(;, false)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(emptyRecord3)
listener: beginMetadataStar(()
listener: endMetadataStar(0)
parseRecordType((, ;)
listener: beginRecordType(()
listener: endRecordType((, null, 0, false)
listener: beginVariablesDeclaration(emptyRecord3, null, null)
parseVariablesDeclarationRest(), true)
parseOptionallyInitializedIdentifier())
ensureIdentifier(), localVariableDeclaration)
listener: handleIdentifier(emptyRecord3, localVariableDeclaration)
listener: beginInitializedIdentifier(emptyRecord3)
parseVariableInitializerOpt(emptyRecord3)
listener: beginVariableInitializer(=)
parseExpression(=)
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(=)
parseParenthesizedExpressionOrRecordLiteral(=, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
ensureCloseParen(,, ()
reportRecoverableError(,, RecordLiteralZeroFieldsWithTrailingComma)
listener: handleRecoverableError(RecordLiteralZeroFieldsWithTrailingComma, ,, ,)
listener: endRecordLiteral((, 0, null)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(emptyRecord3)
ensureSemicolon())
listener: endVariablesDeclaration(1, ;)
notEofOrValue(}, ()
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclaration(;, false)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(emptyRecord4)
listener: beginMetadataStar(()
listener: endMetadataStar(0)
parseRecordType((, ;)
listener: beginRecordType(()
reportRecoverableError(,, RecordTypeZeroFieldsButTrailingComma)
listener: handleRecoverableError(RecordTypeZeroFieldsButTrailingComma, ,, ,)
listener: endRecordType((, null, 0, false)
listener: beginVariablesDeclaration(emptyRecord4, null, null)
parseVariablesDeclarationRest(), true)
parseOptionallyInitializedIdentifier())
ensureIdentifier(), localVariableDeclaration)
listener: handleIdentifier(emptyRecord4, localVariableDeclaration)
listener: beginInitializedIdentifier(emptyRecord4)
parseVariableInitializerOpt(emptyRecord4)
listener: beginVariableInitializer(=)
parseExpression(=)
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(=)
parseParenthesizedExpressionOrRecordLiteral(=, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
ensureCloseParen(,, ()
reportRecoverableError(,, RecordLiteralZeroFieldsWithTrailingComma)
listener: handleRecoverableError(RecordLiteralZeroFieldsWithTrailingComma, ,, ,)
listener: endRecordLiteral((, 0, null)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(emptyRecord4)
ensureSemicolon())
listener: endVariablesDeclaration(1, ;)
notEofOrValue(}, ()
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclaration(;, false)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(emptyRecord5)
listener: beginMetadataStar(()
listener: endMetadataStar(0)
parseRecordType((, ;)
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(,)
listener: endMetadataStar(0)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, typeReference)
listener: handleNoTypeArguments(,)
listener: handleType(, null)
listener: handleNoName(,)
listener: endRecordTypeEntry()
listener: endRecordType((, null, 2, false)
listener: beginVariablesDeclaration(emptyRecord5, null, null)
parseVariablesDeclarationRest(), true)
parseOptionallyInitializedIdentifier())
ensureIdentifier(), localVariableDeclaration)
listener: handleIdentifier(emptyRecord5, localVariableDeclaration)
listener: beginInitializedIdentifier(emptyRecord5)
parseVariableInitializerOpt(emptyRecord5)
listener: beginVariableInitializer(=)
parseExpression(=)
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(=)
parseParenthesizedExpressionOrRecordLiteral(=, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
parseExpression(()
parsePrecedenceExpression((, 1, true)
parseUnaryExpression((, true)
parsePrimary((, expression)
parseLiteralInt(()
listener: handleLiteralInt(42)
parseExpression(,)
parsePrecedenceExpression(,, 1, true)
parseUnaryExpression(,, true)
parsePrimary(,, expression)
parseLiteralInt(,)
listener: handleLiteralInt(42)
parseExpression(,)
parsePrecedenceExpression(,, 1, true)
parseUnaryExpression(,, true)
parsePrimary(,, expression)
parseSend(,, expression)
isNextIdentifier(,)
ensureIdentifier(,, expression)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, expression)
listener: handleNoTypeArguments(,)
parseArgumentsOpt()
listener: handleNoArguments(,)
listener: handleSend(, ,)
ensureCloseParen(,, ()
listener: endRecordLiteral((, 3, null)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(emptyRecord5)
ensureSemicolon())
listener: endVariablesDeclaration(1, ;)
notEofOrValue(}, ()
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclaration(;, false)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(emptyRecord6)
listener: beginMetadataStar(()
listener: endMetadataStar(0)
parseRecordType((, ;)
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()
parseRecordTypeField(,, identifierIsOptional: true)
listener: beginRecordTypeEntry()
parseMetadataStar(,)
listener: beginMetadataStar(,)
listener: endMetadataStar(0)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, typeReference)
listener: handleNoTypeArguments(,)
listener: handleType(, null)
listener: handleNoName(,)
listener: endRecordTypeEntry()
listener: endRecordType((, null, 3, false)
listener: beginVariablesDeclaration(emptyRecord6, null, null)
parseVariablesDeclarationRest(), true)
parseOptionallyInitializedIdentifier())
ensureIdentifier(), localVariableDeclaration)
listener: handleIdentifier(emptyRecord6, localVariableDeclaration)
listener: beginInitializedIdentifier(emptyRecord6)
parseVariableInitializerOpt(emptyRecord6)
listener: beginVariableInitializer(=)
parseExpression(=)
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(=)
parseParenthesizedExpressionOrRecordLiteral(=, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
parseExpression(()
parsePrecedenceExpression((, 1, true)
parseUnaryExpression((, true)
parsePrimary((, expression)
parseLiteralInt(()
listener: handleLiteralInt(42)
parseExpression(,)
parsePrecedenceExpression(,, 1, true)
parseUnaryExpression(,, true)
parsePrimary(,, expression)
parseLiteralInt(,)
listener: handleLiteralInt(42)
parseExpression(,)
parsePrecedenceExpression(,, 1, true)
parseUnaryExpression(,, true)
parsePrimary(,, expression)
parseSend(,, expression)
isNextIdentifier(,)
ensureIdentifier(,, expression)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, expression)
listener: handleNoTypeArguments(,)
parseArgumentsOpt()
listener: handleNoArguments(,)
listener: handleSend(, ,)
ensureCloseParen(,, ()
listener: endRecordLiteral((, 3, null)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(emptyRecord6)
ensureSemicolon())
listener: endVariablesDeclaration(1, ;)
notEofOrValue(}, ()
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclaration(;, false)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(emptyRecord7)
listener: beginMetadataStar(()
listener: endMetadataStar(0)
parseRecordType((, ;)
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(,)
listener: endMetadataStar(0)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, typeReference)
listener: handleNoTypeArguments(,)
listener: handleType(, null)
listener: handleNoName(,)
listener: endRecordTypeEntry()
parseRecordTypeField(,, identifierIsOptional: true)
listener: beginRecordTypeEntry()
parseMetadataStar(,)
listener: beginMetadataStar(,)
listener: endMetadataStar(0)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, typeReference)
listener: handleNoTypeArguments(,)
listener: handleType(, null)
listener: handleNoName(,)
listener: endRecordTypeEntry()
listener: endRecordType((, null, 3, false)
listener: beginVariablesDeclaration(emptyRecord7, null, null)
parseVariablesDeclarationRest(), true)
parseOptionallyInitializedIdentifier())
ensureIdentifier(), localVariableDeclaration)
listener: handleIdentifier(emptyRecord7, localVariableDeclaration)
listener: beginInitializedIdentifier(emptyRecord7)
parseVariableInitializerOpt(emptyRecord7)
listener: beginVariableInitializer(=)
parseExpression(=)
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(=)
parseParenthesizedExpressionOrRecordLiteral(=, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
parseExpression(()
parsePrecedenceExpression((, 1, true)
parseUnaryExpression((, true)
parsePrimary((, expression)
parseLiteralInt(()
listener: handleLiteralInt(42)
parseExpression(,)
parsePrecedenceExpression(,, 1, true)
parseUnaryExpression(,, true)
parsePrimary(,, expression)
parseLiteralInt(,)
listener: handleLiteralInt(42)
parseExpression(,)
parsePrecedenceExpression(,, 1, true)
parseUnaryExpression(,, true)
parsePrimary(,, expression)
parseSend(,, expression)
isNextIdentifier(,)
ensureIdentifier(,, expression)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, expression)
listener: handleNoTypeArguments(,)
parseArgumentsOpt()
listener: handleNoArguments(,)
listener: handleSend(, ,)
parseExpression(,)
parsePrecedenceExpression(,, 1, true)
parseUnaryExpression(,, true)
parsePrimary(,, expression)
parseSend(,, expression)
isNextIdentifier(,)
ensureIdentifier(,, expression)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, expression)
listener: handleNoTypeArguments(,)
parseArgumentsOpt()
listener: handleNoArguments(,)
listener: handleSend(, ,)
ensureCloseParen(,, ()
listener: endRecordLiteral((, 4, null)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(emptyRecord7)
ensureSemicolon())
listener: endVariablesDeclaration(1, ;)
notEofOrValue(}, ()
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclaration(;, false)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(emptyRecord8)
listener: beginMetadataStar(()
listener: endMetadataStar(0)
parseRecordType((, ;)
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()
parseRecordTypeField(,, identifierIsOptional: true)
listener: beginRecordTypeEntry()
parseMetadataStar(,)
listener: beginMetadataStar(,)
listener: endMetadataStar(0)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, typeReference)
listener: handleNoTypeArguments(,)
listener: handleType(, null)
listener: handleNoName(,)
listener: endRecordTypeEntry()
parseRecordTypeField(,, identifierIsOptional: true)
listener: beginRecordTypeEntry()
parseMetadataStar(,)
listener: beginMetadataStar(,)
listener: endMetadataStar(0)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedType, Expected a type, but got ','., null, {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, typeReference)
listener: handleNoTypeArguments(,)
listener: handleType(, null)
listener: handleNoName(,)
listener: endRecordTypeEntry()
listener: endRecordType((, null, 4, false)
listener: beginVariablesDeclaration(emptyRecord8, null, null)
parseVariablesDeclarationRest(), true)
parseOptionallyInitializedIdentifier())
ensureIdentifier(), localVariableDeclaration)
listener: handleIdentifier(emptyRecord8, localVariableDeclaration)
listener: beginInitializedIdentifier(emptyRecord8)
parseVariableInitializerOpt(emptyRecord8)
listener: beginVariableInitializer(=)
parseExpression(=)
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(=)
parseParenthesizedExpressionOrRecordLiteral(=, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
parseExpression(()
parsePrecedenceExpression((, 1, true)
parseUnaryExpression((, true)
parsePrimary((, expression)
parseLiteralInt(()
listener: handleLiteralInt(42)
parseExpression(,)
parsePrecedenceExpression(,, 1, true)
parseUnaryExpression(,, true)
parsePrimary(,, expression)
parseLiteralInt(,)
listener: handleLiteralInt(42)
parseExpression(,)
parsePrecedenceExpression(,, 1, true)
parseUnaryExpression(,, true)
parsePrimary(,, expression)
parseSend(,, expression)
isNextIdentifier(,)
ensureIdentifier(,, expression)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, expression)
listener: handleNoTypeArguments(,)
parseArgumentsOpt()
listener: handleNoArguments(,)
listener: handleSend(, ,)
parseExpression(,)
parsePrecedenceExpression(,, 1, true)
parseUnaryExpression(,, true)
parsePrimary(,, expression)
parseSend(,, expression)
isNextIdentifier(,)
ensureIdentifier(,, expression)
reportRecoverableErrorWithToken(,, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ','., Try inserting an identifier before ','., {lexeme: ,}], ,, ,)
rewriter()
listener: handleIdentifier(, expression)
listener: handleNoTypeArguments(,)
parseArgumentsOpt()
listener: handleNoArguments(,)
listener: handleSend(, ,)
ensureCloseParen(,, ()
listener: endRecordLiteral((, 4, null)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(emptyRecord8)
ensureSemicolon())
listener: endVariablesDeclaration(1, ;)
notEofOrValue(}, })
listener: endBlockFunctionBody(8, {, })
listener: endTopLevelMethod(main, null, })
listener: endTopLevelDeclaration()
reportAllErrorTokens(main)
listener: endCompilationUnit(1, )

View file

@ -0,0 +1,33 @@
NOTICE: Stream was rewritten by parser!
main() {
() emptyRecord1 = ();
(,) emptyRecord2 = ();
() emptyRecord3 = (,);
(,) emptyRecord4 = (,);
(int, *synthetic*,) emptyRecord5 = (42, 42, *synthetic*,);
(int, int, *synthetic*,) emptyRecord6 = (42, 42, *synthetic*,);
(int, *synthetic*, *synthetic*,) emptyRecord7 = (42, 42, *synthetic*, *synthetic*,);
(int, int, *synthetic*, *synthetic*,) emptyRecord8 = (42, 42, *synthetic*, *synthetic*,);
}
main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
([BeginToken])[SimpleToken] emptyRecord1[StringToken] =[SimpleToken] ([BeginToken])[SimpleToken];[SimpleToken]
([BeginToken],[SimpleToken])[SimpleToken] emptyRecord2[StringToken] =[SimpleToken] ([BeginToken])[SimpleToken];[SimpleToken]
([BeginToken])[SimpleToken] emptyRecord3[StringToken] =[SimpleToken] ([BeginToken],[SimpleToken])[SimpleToken];[SimpleToken]
([BeginToken],[SimpleToken])[SimpleToken] emptyRecord4[StringToken] =[SimpleToken] ([BeginToken],[SimpleToken])[SimpleToken];[SimpleToken]
([BeginToken]int[StringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken])[SimpleToken] emptyRecord5[StringToken] =[SimpleToken] ([BeginToken]42[StringToken],[SimpleToken] 42[StringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken])[SimpleToken];[SimpleToken]
([BeginToken]int[StringToken],[SimpleToken] int[StringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken])[SimpleToken] emptyRecord6[StringToken] =[SimpleToken] ([BeginToken]42[StringToken],[SimpleToken] 42[StringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken])[SimpleToken];[SimpleToken]
([BeginToken]int[StringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken])[SimpleToken] emptyRecord7[StringToken] =[SimpleToken] ([BeginToken]42[StringToken],[SimpleToken] 42[StringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken])[SimpleToken];[SimpleToken]
([BeginToken]int[StringToken],[SimpleToken] int[StringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken])[SimpleToken] emptyRecord8[StringToken] =[SimpleToken] ([BeginToken]42[StringToken],[SimpleToken] 42[StringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken] [SyntheticStringToken],[SimpleToken])[SimpleToken];[SimpleToken]
}[SimpleToken][SimpleToken]

View file

@ -0,0 +1,31 @@
main() {
() emptyRecord1 = ();
(,) emptyRecord2 = ();
() emptyRecord3 = (,);
(,) emptyRecord4 = (,);
(int, ,) emptyRecord5 = (42, 42, ,);
(int, int, ,) emptyRecord6 = (42, 42, ,);
(int, , ,) emptyRecord7 = (42, 42, , ,);
(int, int, , ,) emptyRecord8 = (42, 42, , ,);
}
main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
([BeginToken])[SimpleToken] emptyRecord1[StringToken] =[SimpleToken] ([BeginToken])[SimpleToken];[SimpleToken]
([BeginToken],[SimpleToken])[SimpleToken] emptyRecord2[StringToken] =[SimpleToken] ([BeginToken])[SimpleToken];[SimpleToken]
([BeginToken])[SimpleToken] emptyRecord3[StringToken] =[SimpleToken] ([BeginToken],[SimpleToken])[SimpleToken];[SimpleToken]
([BeginToken],[SimpleToken])[SimpleToken] emptyRecord4[StringToken] =[SimpleToken] ([BeginToken],[SimpleToken])[SimpleToken];[SimpleToken]
([BeginToken]int[StringToken],[SimpleToken] ,[SimpleToken])[SimpleToken] emptyRecord5[StringToken] =[SimpleToken] ([BeginToken]42[StringToken],[SimpleToken] 42[StringToken],[SimpleToken] ,[SimpleToken])[SimpleToken];[SimpleToken]
([BeginToken]int[StringToken],[SimpleToken] int[StringToken],[SimpleToken] ,[SimpleToken])[SimpleToken] emptyRecord6[StringToken] =[SimpleToken] ([BeginToken]42[StringToken],[SimpleToken] 42[StringToken],[SimpleToken] ,[SimpleToken])[SimpleToken];[SimpleToken]
([BeginToken]int[StringToken],[SimpleToken] ,[SimpleToken] ,[SimpleToken])[SimpleToken] emptyRecord7[StringToken] =[SimpleToken] ([BeginToken]42[StringToken],[SimpleToken] 42[StringToken],[SimpleToken] ,[SimpleToken] ,[SimpleToken])[SimpleToken];[SimpleToken]
([BeginToken]int[StringToken],[SimpleToken] int[StringToken],[SimpleToken] ,[SimpleToken] ,[SimpleToken])[SimpleToken] emptyRecord8[StringToken] =[SimpleToken] ([BeginToken]42[StringToken],[SimpleToken] 42[StringToken],[SimpleToken] ,[SimpleToken] ,[SimpleToken])[SimpleToken];[SimpleToken]
}[SimpleToken][SimpleToken]

View file

@ -8,7 +8,7 @@ void foo() {
// Error: Const makes it a record (I guess), but there's no trailing comma.
var r5 = const (42);
// Error: A record needs at least one element.
// OK: A record can have 0 elements.
var r6 = const ();
}

View file

@ -4,10 +4,6 @@ parser/record/record_literal_04:9:21: Record literal with one field requires a t
var r5 = const (42);
^
parser/record/record_literal_04:12:19: Record literal can't be empty.
var r6 = const ();
^
beginCompilationUnit(void)
beginMetadataStar(void)
endMetadataStar(0)
@ -121,7 +117,6 @@ beginCompilationUnit(void)
beginVariableInitializer(=)
beginConstLiteral(()
beginParenthesizedExpressionOrRecordLiteral(()
handleRecoverableError(RecordLiteralEmpty, ), ))
endRecordLiteral((, 0, const)
endConstLiteral(;)
endVariableInitializer(=)

View file

@ -288,8 +288,6 @@ parseUnit(void)
parseParenthesizedExpressionOrRecordLiteral(const, const)
listener: beginParenthesizedExpressionOrRecordLiteral(()
ensureCloseParen((, ()
reportRecoverableError(), RecordLiteralEmpty)
listener: handleRecoverableError(RecordLiteralEmpty, ), ))
listener: endRecordLiteral((, 0, const)
listener: endConstLiteral(;)
listener: endVariableInitializer(=)

View file

@ -6,5 +6,5 @@ void errors() {
void ok() {
(int, ) record1 = (1, );
({int ok}) record2 = (ok: 1);
() record3 = Record.empty;
() record3 = ();
}

View file

@ -147,15 +147,8 @@ beginCompilationUnit(void)
handleIdentifier(record3, localVariableDeclaration)
beginInitializedIdentifier(record3)
beginVariableInitializer(=)
handleIdentifier(Record, expression)
handleNoTypeArguments(.)
handleNoArguments(.)
handleSend(Record, .)
handleIdentifier(empty, expressionContinuation)
handleNoTypeArguments(;)
handleNoArguments(;)
handleSend(empty, ;)
handleEndingBinaryExpression(.)
beginParenthesizedExpressionOrRecordLiteral(()
endRecordLiteral((, 0, null)
endVariableInitializer(=)
endInitializedIdentifier(record3)
endVariablesDeclaration(1, ;)

View file

@ -299,29 +299,14 @@ parseUnit(void)
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
isNextIdentifier(=)
ensureIdentifier(=, expression)
listener: handleIdentifier(Record, expression)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(Record)
listener: handleNoArguments(.)
listener: handleSend(Record, .)
parsePrimary(., expressionContinuation)
parseSendOrFunctionLiteral(., expressionContinuation)
parseSend(., expressionContinuation)
isNextIdentifier(.)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(empty, expressionContinuation)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(empty)
listener: handleNoArguments(;)
listener: handleSend(empty, ;)
listener: handleEndingBinaryExpression(.)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(=)
parseParenthesizedExpressionOrRecordLiteral(=, null)
listener: beginParenthesizedExpressionOrRecordLiteral(()
ensureCloseParen((, ()
listener: endRecordLiteral((, 0, null)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(record3)
ensureSemicolon(empty)
ensureSemicolon())
listener: endVariablesDeclaration(1, ;)
notEofOrValue(}, })
listener: endBlockFunctionBody(3, {, })

View file

@ -6,7 +6,7 @@ void errors() {
void ok() {
(int, ) record1 = (1, );
({int ok}) record2 = (ok: 1);
() record3 = Record.empty;
() record3 = ();
}
@ -18,6 +18,6 @@ void[KeywordToken] errors[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
void[KeywordToken] ok[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
([BeginToken]int[StringToken],[SimpleToken] )[SimpleToken] record1[StringToken] =[SimpleToken] ([BeginToken]1[StringToken],[SimpleToken] )[SimpleToken];[SimpleToken]
([BeginToken]{[BeginToken]int[StringToken] ok[StringToken]}[SimpleToken])[SimpleToken] record2[StringToken] =[SimpleToken] ([BeginToken]ok[StringToken]:[SimpleToken] 1[StringToken])[SimpleToken];[SimpleToken]
([BeginToken])[SimpleToken] record3[StringToken] =[SimpleToken] Record[StringToken].[SimpleToken]empty[StringToken];[SimpleToken]
([BeginToken])[SimpleToken] record3[StringToken] =[SimpleToken] ([BeginToken])[SimpleToken];[SimpleToken]
}[SimpleToken]
[SimpleToken]

View file

@ -6,7 +6,7 @@ void errors() {
void ok() {
(int, ) record1 = (1, );
({int ok}) record2 = (ok: 1);
() record3 = Record.empty;
() record3 = ();
}
@ -18,6 +18,6 @@ void[KeywordToken] errors[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
void[KeywordToken] ok[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
([BeginToken]int[StringToken],[SimpleToken] )[SimpleToken] record1[StringToken] =[SimpleToken] ([BeginToken]1[StringToken],[SimpleToken] )[SimpleToken];[SimpleToken]
([BeginToken]{[BeginToken]int[StringToken] ok[StringToken]}[SimpleToken])[SimpleToken] record2[StringToken] =[SimpleToken] ([BeginToken]ok[StringToken]:[SimpleToken] 1[StringToken])[SimpleToken];[SimpleToken]
([BeginToken])[SimpleToken] record3[StringToken] =[SimpleToken] Record[StringToken].[SimpleToken]empty[StringToken];[SimpleToken]
([BeginToken])[SimpleToken] record3[StringToken] =[SimpleToken] ([BeginToken])[SimpleToken];[SimpleToken]
}[SimpleToken]
[SimpleToken]

View file

@ -73,7 +73,6 @@ placing
pubspec.yaml
r
re
record.empty
sdksummary
size
solutions

View file

@ -315,10 +315,13 @@ library /*isNonNullableByDefault*/;
// C.this();
// ^^^^
//
// pkg/front_end/testcases/general/duplicated_declarations.dart:40:6: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// pkg/front_end/testcases/general/duplicated_declarations.dart:40:5: Error: The 'records' language feature is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.19 or higher.
// C.();
// ^
// ^
// pkg/front_end/testcases/general/duplicated_declarations.dart:5:1: Context: This is the annotation that opts out this library from the 'records' language feature.
// // @dart=2.16
// ^^^^^^^^^^^^^
//
// pkg/front_end/testcases/general/duplicated_declarations.dart:40:5: Error: Expected an identifier, but got '('.
// Try inserting an identifier before '('.

View file

@ -315,10 +315,13 @@ library /*isNonNullableByDefault*/;
// C.this();
// ^^^^
//
// pkg/front_end/testcases/general/duplicated_declarations.dart:40:6: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// pkg/front_end/testcases/general/duplicated_declarations.dart:40:5: Error: The 'records' language feature is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.19 or higher.
// C.();
// ^
// ^
// pkg/front_end/testcases/general/duplicated_declarations.dart:5:1: Context: This is the annotation that opts out this library from the 'records' language feature.
// // @dart=2.16
// ^^^^^^^^^^^^^
//
// pkg/front_end/testcases/general/duplicated_declarations.dart:40:5: Error: Expected an identifier, but got '('.
// Try inserting an identifier before '('.

View file

@ -315,10 +315,13 @@ library /*isNonNullableByDefault*/;
// C.this();
// ^^^^
//
// pkg/front_end/testcases/general/duplicated_declarations.dart:40:6: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// pkg/front_end/testcases/general/duplicated_declarations.dart:40:5: Error: The 'records' language feature is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.19 or higher.
// C.();
// ^
// ^
// pkg/front_end/testcases/general/duplicated_declarations.dart:5:1: Context: This is the annotation that opts out this library from the 'records' language feature.
// // @dart=2.16
// ^^^^^^^^^^^^^
//
// pkg/front_end/testcases/general/duplicated_declarations.dart:40:5: Error: Expected an identifier, but got '('.
// Try inserting an identifier before '('.

View file

@ -2,11 +2,6 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/issue44347.dart:6:13: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// Set<int>.();
// ^
//
// pkg/front_end/testcases/general/issue44347.dart:6:12: Error: Expected an identifier, but got '('.
// Try inserting an identifier before '('.
// Set<int>.();

View file

@ -2,11 +2,6 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/issue44347.dart:6:13: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// Set<int>.();
// ^
//
// pkg/front_end/testcases/general/issue44347.dart:6:12: Error: Expected an identifier, but got '('.
// Try inserting an identifier before '('.
// Set<int>.();

View file

@ -2,11 +2,6 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/issue44347.dart:6:13: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// Set<int>.();
// ^
//
// pkg/front_end/testcases/general/issue44347.dart:6:12: Error: Expected an identifier, but got '('.
// Try inserting an identifier before '('.
// Set<int>.();

View file

@ -1,12 +1,4 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/records/record_literal.dart:6:4: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// ();
// ^
//
import self as self;
import "dart:core" as core;
@ -19,14 +11,12 @@ class Class extends core::Object {
}
}
static method method() → dynamic {
invalid-expression "pkg/front_end/testcases/records/record_literal.dart:6:4: Error: This couldn't be parsed.
();
^";
#C1;
(0, 1);
(0, {b: 1});
({a: 0, b: 1});
let final core::int #t1 = 0 in (1, {a: #t1});
#C3;
#C4;
}
static method sorting() → dynamic {
({a: 0, b: 1, c: 2, d: 3});
@ -42,7 +32,8 @@ static method sorting() → dynamic {
}
constants {
#C1 = TypeLiteralConstant(core::int)
#C2 = TypeLiteralConstant(core::String)
#C3 = (#C1, #C2)
#C1 = ()
#C2 = TypeLiteralConstant(core::int)
#C3 = TypeLiteralConstant(core::String)
#C4 = (#C2, #C3)
}

View file

@ -1,12 +1,4 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/records/record_literal.dart:6:4: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// ();
// ^
//
import self as self;
import "dart:core" as core;
@ -19,14 +11,12 @@ class Class extends core::Object {
}
}
static method method() → dynamic {
invalid-expression "pkg/front_end/testcases/records/record_literal.dart:6:4: Error: This couldn't be parsed.
();
^";
#C1;
(0, 1);
(0, {b: 1});
({a: 0, b: 1});
let final core::int #t1 = 0 in (1, {a: #t1});
#C3;
#C4;
}
static method sorting() → dynamic {
({a: 0, b: 1, c: 2, d: 3});
@ -42,9 +32,10 @@ static method sorting() → dynamic {
}
constants {
#C1 = TypeLiteralConstant(core::int)
#C2 = TypeLiteralConstant(core::String)
#C3 = (#C1, #C2)
#C1 = ()
#C2 = TypeLiteralConstant(core::int)
#C3 = TypeLiteralConstant(core::String)
#C4 = (#C2, #C3)
}
Extra constant evaluation status:

View file

@ -1,12 +1,4 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/records/record_literal.dart:6:4: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// ();
// ^
//
import self as self;
import "dart:core" as core;
@ -19,14 +11,12 @@ class Class extends core::Object {
}
}
static method method() → dynamic {
invalid-expression "pkg/front_end/testcases/records/record_literal.dart:6:4: Error: This couldn't be parsed.
();
^";
#C1;
(0, 1);
(0, {b: 1});
({a: 0, b: 1});
let final core::int #t1 = 0 in (1, {a: #t1});
#C3;
#C4;
}
static method sorting() → dynamic {
({a: 0, b: 1, c: 2, d: 3});
@ -42,7 +32,8 @@ static method sorting() → dynamic {
}
constants {
#C1 = TypeLiteralConstant(core::int*)
#C2 = TypeLiteralConstant(core::String*)
#C3 = (#C1, #C2)
#C1 = ()
#C2 = TypeLiteralConstant(core::int*)
#C3 = TypeLiteralConstant(core::String*)
#C4 = (#C2, #C3)
}

View file

@ -1,12 +1,4 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/records/record_literal.dart:6:4: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// ();
// ^
//
import self as self;
import "dart:core" as core;
@ -19,14 +11,12 @@ class Class extends core::Object {
}
}
static method method() → dynamic {
invalid-expression "pkg/front_end/testcases/records/record_literal.dart:6:4: Error: This couldn't be parsed.
();
^";
#C1;
(0, 1);
(0, {b: 1});
({a: 0, b: 1});
let final core::int #t1 = 0 in (1, {a: #t1});
#C3;
#C4;
}
static method sorting() → dynamic {
({a: 0, b: 1, c: 2, d: 3});
@ -42,7 +32,8 @@ static method sorting() → dynamic {
}
constants {
#C1 = TypeLiteralConstant(core::int*)
#C2 = TypeLiteralConstant(core::String*)
#C3 = (#C1, #C2)
#C1 = ()
#C2 = TypeLiteralConstant(core::int*)
#C3 = TypeLiteralConstant(core::String*)
#C4 = (#C2, #C3)
}

View file

@ -1,12 +1,4 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/records/record_literal.dart:6:4: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// ();
// ^
//
import self as self;
import "dart:core" as core;
@ -19,14 +11,12 @@ class Class extends core::Object {
}
}
static method method() → dynamic {
invalid-expression "pkg/front_end/testcases/records/record_literal.dart:6:4: Error: This couldn't be parsed.
();
^";
#C1;
(0, 1);
(0, {b: 1});
({a: 0, b: 1});
let final core::int #t1 = 0 in (1, {a: #t1});
#C3;
#C4;
}
static method sorting() → dynamic {
({a: 0, b: 1, c: 2, d: 3});
@ -42,9 +32,10 @@ static method sorting() → dynamic {
}
constants {
#C1 = TypeLiteralConstant(core::int*)
#C2 = TypeLiteralConstant(core::String*)
#C3 = (#C1, #C2)
#C1 = ()
#C2 = TypeLiteralConstant(core::int*)
#C3 = TypeLiteralConstant(core::String*)
#C4 = (#C2, #C3)
}
Extra constant evaluation status:

View file

@ -2,11 +2,6 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/regress/issue_31198.dart:10:24: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// B.named2(): super().() {}
// ^
//
// pkg/front_end/testcases/regress/issue_31198.dart:8:8: Error: Can't use 'super' as an expression.
// To delegate a constructor to a super constructor, put the super call as an initializer.
// B(): super().foo() {}

View file

@ -2,11 +2,6 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/regress/issue_31198.dart:10:24: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// B.named2(): super().() {}
// ^
//
// pkg/front_end/testcases/regress/issue_31198.dart:8:8: Error: Can't use 'super' as an expression.
// To delegate a constructor to a super constructor, put the super call as an initializer.
// B(): super().foo() {}

View file

@ -1,12 +1,4 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/regress/issue_31198.dart:10:24: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// B.named2(): super().() {}
// ^
//
import self as self;
import "dart:core" as core;

View file

@ -2,11 +2,6 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/regress/issue_31198.dart:10:24: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// B.named2(): super().() {}
// ^
//
// pkg/front_end/testcases/regress/issue_31198.dart:8:8: Error: Can't use 'super' as an expression.
// To delegate a constructor to a super constructor, put the super call as an initializer.
// B(): super().foo() {}

View file

@ -11,7 +11,4 @@ main() {
// [cfe] Record literal with one field requires a trailing comma.
var r2 = const ();
// ^
// [analyzer] SYNTACTIC_ERROR.RECORD_LITERAL_EMPTY
// [cfe] Record literal can't be empty.
}

View file

@ -19,7 +19,4 @@ main() {
// ^
// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] The 'records' language feature is disabled for this library.
// ^
// [analyzer] SYNTACTIC_ERROR.RECORD_LITERAL_EMPTY
// [cfe] Record literal can't be empty.
}

View file

@ -29,13 +29,12 @@ main() {
// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] The 'records' language feature is disabled for this library.
() emptyRecord = Record.empty;
() emptyRecord = ();
//^
// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] This requires the experimental 'records' language feature to be enabled.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER
// ^
// [cfe] Member not found: 'empty'.
// ^
// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] The 'records' language feature is disabled for this library.
print(emptyRecord);
}