[analyzer][cfe] Introduce parsing for null-aware elements

Part of https://github.com/dart-lang/sdk/issues/55949
Closes https://github.com/dart-lang/sdk/issues/55954

Change-Id: I885772f292f6d70425d6eba15bad8b0c6dc86a1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370240
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Chloe Stefantsova 2024-06-28 09:49:30 +00:00 committed by Commit Queue
parent 4a8b3c74f2
commit a4c94716ba
61 changed files with 2561 additions and 86 deletions

View file

@ -1649,8 +1649,11 @@ class ForwardingListener implements Listener {
}
@override
void handleLiteralMapEntry(Token colon, Token endToken) {
listener?.handleLiteralMapEntry(colon, endToken);
void handleLiteralMapEntry(Token colon, Token endToken,
{Token? nullAwareKeyToken, Token? nullAwareValueToken}) {
listener?.handleLiteralMapEntry(colon, endToken,
nullAwareKeyToken: nullAwareKeyToken,
nullAwareValueToken: nullAwareValueToken);
}
@override
@ -1909,6 +1912,11 @@ class ForwardingListener implements Listener {
listener?.endConstantPattern(constKeyword);
}
@override
void handleNullAwareElement(Token nullAwareToken) {
listener?.handleNullAwareElement(nullAwareToken);
}
@override
void handleObjectPattern(
Token firstIdentifier, Token? dot, Token? secondIdentifier) {

View file

@ -1113,8 +1113,14 @@ class Listener implements UnescapeErrorListener {
logEvent("LibraryName");
}
/// Called after parsing a map entry. Either the key or the value or both can
/// start with the null-aware token `?`. In that case, [nullAwareKeyToken] and
/// [nullAwareValueToken] are set appropriately. Substructures:
/// - expression
/// - expression
// TODO(jensj): Should this have a `beginToken`?
void handleLiteralMapEntry(Token colon, Token endToken) {
void handleLiteralMapEntry(Token colon, Token endToken,
{Token? nullAwareKeyToken, Token? nullAwareValueToken}) {
logEvent("LiteralMapEntry");
}
@ -1882,6 +1888,13 @@ class Listener implements UnescapeErrorListener {
logEvent("SpreadExpression");
}
/// Called after parsing a list or set element that starts with the null-aware
/// token `?`. Substructures:
/// - expression
void handleNullAwareElement(Token nullAwareToken) {
logEvent("NullAwareElement");
}
/// Called after parsing an element of a list or map pattern that starts with
/// `...`. Substructures:
/// - pattern (if hasSubPattern is `true`)

View file

@ -63,6 +63,8 @@ LiteralEntryInfo computeLiteralEntry(Token token) {
return new ForCondition();
} else if (optional('...', next) || optional('...?', next)) {
return spreadOperator;
} else if (optional('?', next)) {
return nullAwareEntry;
}
return simpleEntry;
}

View file

@ -15,6 +15,12 @@ const LiteralEntryInfo ifCondition = const IfCondition();
/// preceded by a '...' spread operator.
const LiteralEntryInfo spreadOperator = const SpreadOperator();
/// [nullAwareEntry] is for parsing a null-aware element in a literal list or
/// set, preceded by the `?` null-aware marker, or a null-aware map entry in a
/// map literal, where either the key or the value is preceded by the `?`
/// null-aware marker.
const NullAwareEntry nullAwareEntry = const NullAwareEntry();
/// The first step when processing a `for` control flow collection entry.
class ForCondition extends LiteralEntryInfo {
bool _inStyle = false;
@ -86,6 +92,9 @@ class ForCondition extends LiteralEntryInfo {
);
} else if (optional('...', next) || optional('...?', next)) {
return _inStyle ? const ForInSpread() : const ForSpread();
} else if (optional('?', next)) {
return new Nested(nullAwareEntry,
_inStyle ? const ForInComplete() : const ForComplete());
}
return _inStyle ? const ForInEntry() : const ForEntry();
}
@ -180,6 +189,8 @@ class IfCondition extends LiteralEntryInfo {
return new Nested(ifCondition, const IfComplete());
} else if (optional('...', next) || optional('...?', next)) {
return const IfSpread();
} else if (optional('?', next)) {
return new Nested(nullAwareEntry, const IfComplete());
}
return const IfEntry();
}
@ -308,3 +319,30 @@ class Nested extends LiteralEntryInfo {
return nestedStep != null ? this : lastStep;
}
}
class NullAwareEntry extends LiteralEntryInfo {
const NullAwareEntry() : super(false, 0);
@override
Token parse(Token token, Parser parser) {
final Token entryNullAwareToken = token.next!;
assert(optional('?', entryNullAwareToken));
token = parser.parseExpression(entryNullAwareToken);
if (optional(':', token.next!)) {
Token colon = token.next!;
Token next = colon.next!;
if (optional('?', next)) {
token = parser.parseExpression(next);
parser.listener.handleLiteralMapEntry(colon, token,
nullAwareKeyToken: entryNullAwareToken, nullAwareValueToken: next);
} else {
token = parser.parseExpression(colon);
parser.listener.handleLiteralMapEntry(colon, token,
nullAwareKeyToken: entryNullAwareToken, nullAwareValueToken: null);
}
} else {
parser.listener.handleNullAwareElement(entryNullAwareToken);
}
return token;
}
}

View file

@ -6991,8 +6991,19 @@ class Parser {
hasSetEntry ??= !isMapEntry;
if (isMapEntry) {
Token colon = token.next!;
token = parseExpression(colon);
listener.handleLiteralMapEntry(colon, token.next!);
Token next = colon.next!;
if (optional('?', next)) {
// Null-aware value. For example:
// <int, String>{ x: ?y }
token = parseExpression(next);
listener.handleLiteralMapEntry(colon, token,
nullAwareKeyToken: null, nullAwareValueToken: next);
} else {
// Non null-aware entry. For example:
// <bool, num>{ x: y }
token = parseExpression(colon);
listener.handleLiteralMapEntry(colon, token.next!);
}
}
} else {
while (info != null) {
@ -7000,8 +7011,19 @@ class Parser {
token = parseExpression(token);
if (optional(':', token.next!)) {
Token colon = token.next!;
token = parseExpression(colon);
listener.handleLiteralMapEntry(colon, token.next!);
Token next = colon.next!;
if (optional('?', next)) {
token = parseExpression(next);
// Null-aware value. For example:
// <double, Symbol>{ if (b) x: ?y }
listener.handleLiteralMapEntry(colon, token,
nullAwareKeyToken: null, nullAwareValueToken: next);
} else {
// Non null-aware entry. For example:
// <String, int>{ if (b) x : y }
token = parseExpression(colon);
listener.handleLiteralMapEntry(colon, token.next!);
}
}
} else {
token = info.parse(token, this);

View file

@ -147,6 +147,9 @@ class AstBuilder extends StackListener {
/// `true` if class-modifiers is enabled
final bool enableClassModifiers;
/// `true` if null-aware elements is enabled
final bool enableNullAwareElements;
final FeatureSet _featureSet;
final LineInfo _lineInfo;
@ -174,6 +177,8 @@ class AstBuilder extends StackListener {
enableInlineClass = _featureSet.isEnabled(Feature.inline_class),
enableSealedClass = _featureSet.isEnabled(Feature.sealed_class),
enableClassModifiers = _featureSet.isEnabled(Feature.class_modifiers),
enableNullAwareElements =
_featureSet.isEnabled(Feature.null_aware_elements),
uri = uri ?? fileUri;
@override
@ -4746,10 +4751,20 @@ class AstBuilder extends StackListener {
}
@override
void handleLiteralMapEntry(Token colon, Token endToken) {
void handleLiteralMapEntry(Token colon, Token endToken,
{Token? nullAwareKeyToken, Token? nullAwareValueToken}) {
assert(optional(':', colon));
debugEvent("LiteralMapEntry");
// TODO(cstefantsova): Handle null-aware map entries.
if (!enableNullAwareElements &&
(nullAwareKeyToken != null || nullAwareValueToken != null)) {
_reportFeatureNotEnabled(
feature: ExperimentalFeatures.null_aware_elements,
startToken: nullAwareKeyToken ?? nullAwareValueToken!,
);
}
var value = pop() as ExpressionImpl;
var key = pop() as ExpressionImpl;
push(
@ -5036,6 +5051,18 @@ class AstBuilder extends StackListener {
);
}
@override
void handleNullAwareElement(Token nullAwareElement) {
debugEvent('NullAwareElement');
// TODO(cstefantsova): Handle null-aware elements.
if (!enableNullAwareElements) {
_reportFeatureNotEnabled(
feature: ExperimentalFeatures.null_aware_elements,
startToken: nullAwareElement,
);
}
}
@override
void handleNullCheckPattern(Token question) {
debugEvent('NullCheckPattern');

View file

@ -4995,11 +4995,29 @@ class BodyBuilder extends StackListenerImpl
}
@override
void handleLiteralMapEntry(Token colon, Token endToken) {
void handleLiteralMapEntry(Token colon, Token endToken,
{Token? nullAwareKeyToken, Token? nullAwareValueToken}) {
debugEvent("LiteralMapEntry");
Expression value = popForValue();
Expression key = popForValue();
push(forest.createMapEntry(offsetForToken(colon), key, value));
if (nullAwareKeyToken == null && nullAwareValueToken == null) {
push(forest.createMapEntry(offsetForToken(colon), key, value));
} else {
if (!libraryFeatures.nullAwareElements.isEnabled) {
addProblem(
templateExperimentNotEnabledOffByDefault
.withArguments(ExperimentalFlag.nullAwareElements.name),
(nullAwareKeyToken ?? nullAwareValueToken!).offset,
noLength);
}
// TODO(cstefantsova): Replace the following no-op with the node for
// handling null-aware elements.
push(forest.createSpreadElement(
offsetForToken(nullAwareKeyToken ?? nullAwareValueToken!),
forest.createNullLiteral(
offsetForToken(nullAwareKeyToken ?? nullAwareValueToken!)),
isNullAware: true));
}
}
String symbolPartToString(name) {
@ -7129,6 +7147,24 @@ class BodyBuilder extends StackListenerImpl
typeInferrer.assignedVariables.storeInfo(node, assignedVariablesInfo);
}
@override
void handleNullAwareElement(Token nullAwareElement) {
debugEvent("NullAwareElement");
// TODO(cstefantsova): Replace the following no-op with the node for
// handling null-aware elements.
if (!libraryFeatures.nullAwareElements.isEnabled) {
addProblem(
templateExperimentNotEnabledOffByDefault
.withArguments(ExperimentalFlag.nullAwareElements.name),
nullAwareElement.offset,
noLength);
}
pop(); // Expression.
push(forest.createSpreadElement(offsetForToken(nullAwareElement),
forest.createNullLiteral(offsetForToken(nullAwareElement)),
isNullAware: true));
}
@override
void handleSpreadExpression(Token spreadToken) {
debugEvent("SpreadExpression");

View file

@ -1967,7 +1967,8 @@ class _MacroListener implements Listener {
}
@override
void handleLiteralMapEntry(Token colon, Token endToken) {
void handleLiteralMapEntry(Token colon, Token endToken,
{Token? nullAwareKeyToken, Token? nullAwareValueToken}) {
_unhandled('map entry');
}
@ -2188,6 +2189,11 @@ class _MacroListener implements Listener {
_unsupported();
}
@override
void handleNullAwareElement(Token spreadToken) {
_unsupported();
}
@override
void handleObjectPattern(
Token firstIdentifier, Token? dot, Token? secondIdentifier) {

View file

@ -1449,9 +1449,13 @@ abstract class AbstractParserAstListener implements Listener {
}
@override
void handleLiteralMapEntry(Token colon, Token endToken) {
void handleLiteralMapEntry(Token colon, Token endToken,
{Token? nullAwareKeyToken, Token? nullAwareValueToken}) {
LiteralMapEntryHandle data = new LiteralMapEntryHandle(ParserAstType.HANDLE,
colon: colon, endToken: endToken);
colon: colon,
endToken: endToken,
nullAwareKeyToken: nullAwareKeyToken,
nullAwareValueToken: nullAwareValueToken);
seen(data);
}
@ -2453,6 +2457,14 @@ abstract class AbstractParserAstListener implements Listener {
seen(data);
}
@override
void handleNullAwareElement(Token nullAwareToken) {
NullAwareElementHandle data = new NullAwareElementHandle(
ParserAstType.HANDLE,
nullAwareToken: nullAwareToken);
seen(data);
}
@override
void handleRestPattern(Token dots, {required bool hasSubPattern}) {
RestPatternHandle data = new RestPatternHandle(ParserAstType.HANDLE,
@ -6234,15 +6246,22 @@ class LibraryNameEnd extends ParserAstNode {
class LiteralMapEntryHandle extends ParserAstNode {
final Token colon;
final Token endToken;
final Token? nullAwareKeyToken;
final Token? nullAwareValueToken;
LiteralMapEntryHandle(ParserAstType type,
{required this.colon, required this.endToken})
{required this.colon,
required this.endToken,
this.nullAwareKeyToken,
this.nullAwareValueToken})
: super("LiteralMapEntry", type);
@override
Map<String, Object?> get deprecatedArguments => {
"colon": colon,
"endToken": endToken,
"nullAwareKeyToken": nullAwareKeyToken,
"nullAwareValueToken": nullAwareValueToken,
};
@override
@ -8481,6 +8500,21 @@ class SpreadExpressionHandle extends ParserAstNode {
R accept<R>(ParserAstVisitor<R> v) => v.visitSpreadExpressionHandle(this);
}
class NullAwareElementHandle extends ParserAstNode {
final Token nullAwareToken;
NullAwareElementHandle(ParserAstType type, {required this.nullAwareToken})
: super("NullAwareElement", type);
@override
Map<String, Object?> get deprecatedArguments => {
"nullAwareToken": nullAwareToken,
};
@override
R accept<R>(ParserAstVisitor<R> v) => v.visitNullAwareElementHandle(this);
}
class RestPatternHandle extends ParserAstNode {
final Token dots;
final bool hasSubPattern;
@ -10281,6 +10315,7 @@ abstract class ParserAstVisitor<R> {
R visitIfControlFlowEnd(IfControlFlowEnd node);
R visitIfElseControlFlowEnd(IfElseControlFlowEnd node);
R visitSpreadExpressionHandle(SpreadExpressionHandle node);
R visitNullAwareElementHandle(NullAwareElementHandle node);
R visitRestPatternHandle(RestPatternHandle node);
R visitFunctionTypedFormalParameterBegin(
FunctionTypedFormalParameterBegin node);
@ -11442,6 +11477,10 @@ class RecursiveParserAstVisitor implements ParserAstVisitor<void> {
void visitSpreadExpressionHandle(SpreadExpressionHandle node) =>
node.visitChildren(this);
@override
void visitNullAwareElementHandle(NullAwareElementHandle node) =>
node.visitChildren(this);
@override
void visitRestPatternHandle(RestPatternHandle node) =>
node.visitChildren(this);

View file

@ -207,7 +207,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endFieldInitializer(=, })
endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -233,7 +233,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endFieldInitializer(=, })
endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -269,7 +269,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endFieldInitializer(=, })
endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -294,7 +294,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endFieldInitializer(=, })
endClassFields(null, null, null, null, null, null, final, 1, final, ;)

View file

@ -330,7 +330,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endFieldInitializer(=, })
listener: endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -386,7 +386,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endFieldInitializer(=, })
listener: endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -448,7 +448,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endFieldInitializer(=, })
listener: endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -498,7 +498,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endFieldInitializer(=, })
listener: endClassFields(null, null, null, null, null, null, final, 1, final, ;)

View file

@ -222,7 +222,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, const, }, false)
endConstLiteral(})
endFieldInitializer(=, })
@ -250,7 +250,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, const, }, false)
endConstLiteral(})
endFieldInitializer(=, })
@ -288,7 +288,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, const, }, false)
endConstLiteral(})
endFieldInitializer(=, })
@ -315,7 +315,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, const, }, false)
endConstLiteral(})
endFieldInitializer(=, })

View file

@ -333,7 +333,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, const, }, false)
listener: endConstLiteral(})
listener: endFieldInitializer(=, })
@ -388,7 +388,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, const, }, false)
listener: endConstLiteral(})
listener: endFieldInitializer(=, })
@ -453,7 +453,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, const, }, false)
listener: endConstLiteral(})
listener: endFieldInitializer(=, })
@ -506,7 +506,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, const, }, false)
listener: endConstLiteral(})
listener: endFieldInitializer(=, })

View file

@ -228,7 +228,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endFieldInitializer(=, })
endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -254,7 +254,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endFieldInitializer(=, })
endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -291,7 +291,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endFieldInitializer(=, })
endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -317,7 +317,7 @@ beginCompilationUnit(class)
beginLiteralString("a")
endLiteralString(0, :)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endFieldInitializer(=, })
endClassFields(null, null, null, null, null, null, final, 1, final, ;)

View file

@ -338,7 +338,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endFieldInitializer(=, })
listener: endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -393,7 +393,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endFieldInitializer(=, })
listener: endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -460,7 +460,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endFieldInitializer(=, })
listener: endClassFields(null, null, null, null, null, null, final, 1, final, ;)
@ -515,7 +515,7 @@ parseUnit(class)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endFieldInitializer(=, })
listener: endClassFields(null, null, null, null, null, null, final, 1, final, ;)

View file

@ -181,7 +181,7 @@ beginCompilationUnit(var)
endTypeArguments(2, <, >)
handleTypeArgumentApplication(<)
handleLiteralNull(null)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endFieldInitializer(=, })
endTopLevelFields(null, null, null, null, null, var, 1, var, ;)

View file

@ -202,7 +202,7 @@ parseUnit(var)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralNull(:)
listener: handleLiteralNull(null)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endFieldInitializer(=, })
listener: endTopLevelFields(null, null, null, null, null, var, 1, var, ;)

View file

@ -115,7 +115,7 @@ beginCompilationUnit(class)
endLiteralString(0, :)
beginLiteralString("b")
endLiteralString(0, })
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
handleConditionalExpressionColon()
handleNoTypeArguments([)
@ -226,7 +226,7 @@ beginCompilationUnit(class)
endLiteralString(0, :)
beginLiteralString("b")
endLiteralString(0, })
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
handleConditionalExpressionColon()
handleNoTypeArguments([)

View file

@ -302,7 +302,7 @@ parseUnit(class)
parseSingleLiteralString(:)
listener: beginLiteralString("b")
listener: endLiteralString(0, })
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
ensureColon(})
listener: handleConditionalExpressionColon()
@ -603,7 +603,7 @@ parseUnit(class)
parseSingleLiteralString(:)
listener: beginLiteralString("b")
listener: endLiteralString(0, })
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
ensureColon(})
listener: handleConditionalExpressionColon()

View file

@ -40,7 +40,7 @@ beginCompilationUnit(dynamic)
handleNoTypeArguments({)
handleLiteralInt(0)
handleLiteralInt(1)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endVariableInitializer(=)
endInitializedIdentifier(m)

View file

@ -83,7 +83,7 @@ parseUnit(dynamic)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(1)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(m)

View file

@ -40,7 +40,7 @@ beginCompilationUnit(dynamic)
handleNoTypeArguments({)
handleLiteralInt(0)
handleLiteralInt(1)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endVariableInitializer(=)
endInitializedIdentifier(m)

View file

@ -83,7 +83,7 @@ parseUnit(dynamic)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(1)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endVariableInitializer(=)
listener: endInitializedIdentifier(m)

View file

@ -0,0 +1,11 @@
foo1(int? x) => <int>[?x];
foo2(String? x) => <String>{?x};
foo3(bool? x, num y) => <bool, num>{?x: y};
bar1(int? x) => <int>[?x];
bar2(int? x, bool b) => <int>{ if (b) ?x };
bar3(int? x) => <int>{ for (var _ in []) ?x };
bar4(String x, bool? y) => <String, bool>{x: ?y};
bar5(int? x, num y) => <int, num>{?x: y};
bar6(double? x, Symbol? y) => <double, Symbol>{?x: ?y};
bar7(num? x, double? y, bool b) => <num, double>{ if (b) ?x: ?y };
bar8(num? x, double? y) => <num, double>{ for (var _ in []) ?x: ?y };

View file

@ -0,0 +1,529 @@
beginCompilationUnit(foo1)
beginMetadataStar(foo1)
endMetadataStar(0)
beginTopLevelMember(foo1)
beginTopLevelMethod(, null, null)
handleNoType()
handleIdentifier(foo1, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(int)
endMetadataStar(0)
beginFormalParameter(int, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(int, typeReference)
handleNoTypeArguments(?)
handleType(int, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(int, typeReference)
handleNoTypeArguments(>)
handleType(int, null)
endTypeArguments(1, <, >)
handleIdentifier(x, expression)
handleNoTypeArguments(])
handleNoArguments(])
handleSend(x, ])
handleNullAwareElement(?)
handleLiteralList(1, [, null, ])
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(foo1, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(foo2)
endMetadataStar(0)
beginTopLevelMember(foo2)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(foo2, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(String)
endMetadataStar(0)
beginFormalParameter(String, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(String, typeReference)
handleNoTypeArguments(?)
handleType(String, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(String, typeReference)
handleNoTypeArguments(>)
handleType(String, null)
endTypeArguments(1, <, >)
handleIdentifier(x, expression)
handleNoTypeArguments(})
handleNoArguments(})
handleSend(x, })
handleNullAwareElement(?)
handleLiteralSetOrMap(1, {, null, }, false)
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(foo2, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(foo3)
endMetadataStar(0)
beginTopLevelMember(foo3)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(foo3, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(bool)
endMetadataStar(0)
beginFormalParameter(bool, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(bool, typeReference)
handleNoTypeArguments(?)
handleType(bool, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue(,)
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
beginMetadataStar(num)
endMetadataStar(0)
beginFormalParameter(num, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(num, typeReference)
handleNoTypeArguments(y)
handleType(num, null)
handleIdentifier(y, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, y, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(2, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(bool, typeReference)
handleNoTypeArguments(,)
handleType(bool, null)
handleIdentifier(num, typeReference)
handleNoTypeArguments(>)
handleType(num, null)
endTypeArguments(2, <, >)
handleIdentifier(x, expression)
handleNoTypeArguments(:)
handleNoArguments(:)
handleSend(x, :)
handleIdentifier(y, expression)
handleNoTypeArguments(})
handleNoArguments(})
handleSend(y, })
handleLiteralMapEntry(:, y, ?, null)
handleLiteralSetOrMap(1, {, null, }, false)
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(foo3, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(bar1)
endMetadataStar(0)
beginTopLevelMember(bar1)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(bar1, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(int)
endMetadataStar(0)
beginFormalParameter(int, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(int, typeReference)
handleNoTypeArguments(?)
handleType(int, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(int, typeReference)
handleNoTypeArguments(>)
handleType(int, null)
endTypeArguments(1, <, >)
handleIdentifier(x, expression)
handleNoTypeArguments(])
handleNoArguments(])
handleSend(x, ])
handleNullAwareElement(?)
handleLiteralList(1, [, null, ])
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(bar1, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(bar2)
endMetadataStar(0)
beginTopLevelMember(bar2)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(bar2, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(int)
endMetadataStar(0)
beginFormalParameter(int, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(int, typeReference)
handleNoTypeArguments(?)
handleType(int, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue(,)
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
beginMetadataStar(bool)
endMetadataStar(0)
beginFormalParameter(bool, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(bool, typeReference)
handleNoTypeArguments(b)
handleType(bool, null)
handleIdentifier(b, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, b, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(2, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(int, typeReference)
handleNoTypeArguments(>)
handleType(int, null)
endTypeArguments(1, <, >)
beginIfControlFlow(if)
handleIdentifier(b, expression)
handleNoTypeArguments())
handleNoArguments())
handleSend(b, ))
handleParenthesizedCondition((, null, null)
handleThenControlFlow())
handleIdentifier(x, expression)
handleNoTypeArguments(})
handleNoArguments(})
handleSend(x, })
handleNullAwareElement(?)
endIfControlFlow(x)
handleLiteralSetOrMap(1, {, null, }, false)
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(bar2, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(bar3)
endMetadataStar(0)
beginTopLevelMember(bar3)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(bar3, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(int)
endMetadataStar(0)
beginFormalParameter(int, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(int, typeReference)
handleNoTypeArguments(?)
handleType(int, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(int, typeReference)
handleNoTypeArguments(>)
handleType(int, null)
endTypeArguments(1, <, >)
beginForControlFlow(null, for)
beginMetadataStar(var)
endMetadataStar(0)
handleNoType(var)
beginVariablesDeclaration(_, null, var)
handleIdentifier(_, localVariableDeclaration)
beginInitializedIdentifier(_)
handleNoVariableInitializer(_)
endInitializedIdentifier(_)
endVariablesDeclaration(1, null)
handleForInitializerLocalVariableDeclaration(_, true)
beginForInExpression([])
handleNoTypeArguments([])
handleLiteralList(0, [, null, ])
endForInExpression())
handleForInLoopParts(null, for, (, null, in)
handleIdentifier(x, expression)
handleNoTypeArguments(})
handleNoArguments(})
handleSend(x, })
handleNullAwareElement(?)
endForInControlFlow(x)
handleLiteralSetOrMap(1, {, null, }, false)
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(bar3, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(bar4)
endMetadataStar(0)
beginTopLevelMember(bar4)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(bar4, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(String)
endMetadataStar(0)
beginFormalParameter(String, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(String, typeReference)
handleNoTypeArguments(x)
handleType(String, null)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue(,)
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
beginMetadataStar(bool)
endMetadataStar(0)
beginFormalParameter(bool, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(bool, typeReference)
handleNoTypeArguments(?)
handleType(bool, ?)
handleIdentifier(y, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, y, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(2, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(String, typeReference)
handleNoTypeArguments(,)
handleType(String, null)
handleIdentifier(bool, typeReference)
handleNoTypeArguments(>)
handleType(bool, null)
endTypeArguments(2, <, >)
handleIdentifier(x, expression)
handleNoTypeArguments(:)
handleNoArguments(:)
handleSend(x, :)
handleIdentifier(y, expression)
handleNoTypeArguments(})
handleNoArguments(})
handleSend(y, })
handleLiteralMapEntry(:, y, null, ?)
handleLiteralSetOrMap(1, {, null, }, false)
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(bar4, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(bar5)
endMetadataStar(0)
beginTopLevelMember(bar5)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(bar5, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(int)
endMetadataStar(0)
beginFormalParameter(int, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(int, typeReference)
handleNoTypeArguments(?)
handleType(int, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue(,)
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
beginMetadataStar(num)
endMetadataStar(0)
beginFormalParameter(num, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(num, typeReference)
handleNoTypeArguments(y)
handleType(num, null)
handleIdentifier(y, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, y, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(2, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(int, typeReference)
handleNoTypeArguments(,)
handleType(int, null)
handleIdentifier(num, typeReference)
handleNoTypeArguments(>)
handleType(num, null)
endTypeArguments(2, <, >)
handleIdentifier(x, expression)
handleNoTypeArguments(:)
handleNoArguments(:)
handleSend(x, :)
handleIdentifier(y, expression)
handleNoTypeArguments(})
handleNoArguments(})
handleSend(y, })
handleLiteralMapEntry(:, y, ?, null)
handleLiteralSetOrMap(1, {, null, }, false)
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(bar5, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(bar6)
endMetadataStar(0)
beginTopLevelMember(bar6)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(bar6, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(double)
endMetadataStar(0)
beginFormalParameter(double, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(double, typeReference)
handleNoTypeArguments(?)
handleType(double, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue(,)
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
beginMetadataStar(Symbol)
endMetadataStar(0)
beginFormalParameter(Symbol, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(Symbol, typeReference)
handleNoTypeArguments(?)
handleType(Symbol, ?)
handleIdentifier(y, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, y, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(2, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(double, typeReference)
handleNoTypeArguments(,)
handleType(double, null)
handleIdentifier(Symbol, typeReference)
handleNoTypeArguments(>)
handleType(Symbol, null)
endTypeArguments(2, <, >)
handleIdentifier(x, expression)
handleNoTypeArguments(:)
handleNoArguments(:)
handleSend(x, :)
handleIdentifier(y, expression)
handleNoTypeArguments(})
handleNoArguments(})
handleSend(y, })
handleLiteralMapEntry(:, y, ?, ?)
handleLiteralSetOrMap(1, {, null, }, false)
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(bar6, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(bar7)
endMetadataStar(0)
beginTopLevelMember(bar7)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(bar7, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(num)
endMetadataStar(0)
beginFormalParameter(num, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(num, typeReference)
handleNoTypeArguments(?)
handleType(num, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue(,)
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
beginMetadataStar(double)
endMetadataStar(0)
beginFormalParameter(double, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(double, typeReference)
handleNoTypeArguments(?)
handleType(double, ?)
handleIdentifier(y, formalParameterDeclaration)
handleFormalParameterWithoutValue(,)
endFormalParameter(null, null, null, y, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
beginMetadataStar(bool)
endMetadataStar(0)
beginFormalParameter(bool, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(bool, typeReference)
handleNoTypeArguments(b)
handleType(bool, null)
handleIdentifier(b, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, b, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(3, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(num, typeReference)
handleNoTypeArguments(,)
handleType(num, null)
handleIdentifier(double, typeReference)
handleNoTypeArguments(>)
handleType(double, null)
endTypeArguments(2, <, >)
beginIfControlFlow(if)
handleIdentifier(b, expression)
handleNoTypeArguments())
handleNoArguments())
handleSend(b, ))
handleParenthesizedCondition((, null, null)
handleThenControlFlow())
handleIdentifier(x, expression)
handleNoTypeArguments(:)
handleNoArguments(:)
handleSend(x, :)
handleIdentifier(y, expression)
handleNoTypeArguments(})
handleNoArguments(})
handleSend(y, })
handleLiteralMapEntry(:, y, ?, ?)
endIfControlFlow(y)
handleLiteralSetOrMap(1, {, null, }, false)
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(bar7, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(bar8)
endMetadataStar(0)
beginTopLevelMember(bar8)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(bar8, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(num)
endMetadataStar(0)
beginFormalParameter(num, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(num, typeReference)
handleNoTypeArguments(?)
handleType(num, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue(,)
endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
beginMetadataStar(double)
endMetadataStar(0)
beginFormalParameter(double, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(double, typeReference)
handleNoTypeArguments(?)
handleType(double, ?)
handleIdentifier(y, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, y, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(2, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginTypeArguments(<)
handleIdentifier(num, typeReference)
handleNoTypeArguments(,)
handleType(num, null)
handleIdentifier(double, typeReference)
handleNoTypeArguments(>)
handleType(double, null)
endTypeArguments(2, <, >)
beginForControlFlow(null, for)
beginMetadataStar(var)
endMetadataStar(0)
handleNoType(var)
beginVariablesDeclaration(_, null, var)
handleIdentifier(_, localVariableDeclaration)
beginInitializedIdentifier(_)
handleNoVariableInitializer(_)
endInitializedIdentifier(_)
endVariablesDeclaration(1, null)
handleForInitializerLocalVariableDeclaration(_, true)
beginForInExpression([])
handleNoTypeArguments([])
handleLiteralList(0, [, null, ])
endForInExpression())
handleForInLoopParts(null, for, (, null, in)
handleIdentifier(x, expression)
handleNoTypeArguments(:)
handleNoArguments(:)
handleSend(x, :)
handleIdentifier(y, expression)
handleNoTypeArguments(})
handleNoArguments(})
handleSend(y, })
handleLiteralMapEntry(:, y, ?, ?)
endForInControlFlow(y)
handleLiteralSetOrMap(1, {, null, }, false)
handleExpressionFunctionBody(=>, ;)
endTopLevelMethod(bar8, null, ;)
endTopLevelDeclaration(;)
endCompilationUnit(11, )

View file

@ -0,0 +1,27 @@
NOTICE: Stream was rewritten by parser!
foo1(int? x) => <int>[?x];
foo2(String? x) => <String>{?x};
foo3(bool? x, num y) => <bool, num>{?x: y};
bar1(int? x) => <int>[?x];
bar2(int? x, bool b) => <int>{ if (b) ?x };
bar3(int? x) => <int>{ for (var _ in []) ?x };
bar4(String x, bool? y) => <String, bool>{x: ?y};
bar5(int? x, num y) => <int, num>{?x: y};
bar6(double? x, Symbol? y) => <double, Symbol>{?x: ?y};
bar7(num? x, double? y, bool b) => <num, double>{ if (b) ?x: ?y };
bar8(num? x, double? y) => <num, double>{ for (var _ in []) ?x: ?y };
foo1[StringToken]([BeginToken]int[StringToken]?[SimpleToken] x[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]int[StringToken]>[SimpleToken][[BeginToken]?[SimpleToken]x[StringToken]][SimpleToken];[SimpleToken]
foo2[StringToken]([BeginToken]String[StringToken]?[SimpleToken] x[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]String[StringToken]>[SimpleToken]{[BeginToken]?[SimpleToken]x[StringToken]}[SimpleToken];[SimpleToken]
foo3[StringToken]([BeginToken]bool[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] num[StringToken] y[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]bool[StringToken],[SimpleToken] num[StringToken]>[SimpleToken]{[BeginToken]?[SimpleToken]x[StringToken]:[SimpleToken] y[StringToken]}[SimpleToken];[SimpleToken]
bar1[StringToken]([BeginToken]int[StringToken]?[SimpleToken] x[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]int[StringToken]>[SimpleToken][[BeginToken]?[SimpleToken]x[StringToken]][SimpleToken];[SimpleToken]
bar2[StringToken]([BeginToken]int[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] bool[StringToken] b[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]int[StringToken]>[SimpleToken]{[BeginToken] if[KeywordToken] ([BeginToken]b[StringToken])[SimpleToken] ?[SimpleToken]x[StringToken] }[SimpleToken];[SimpleToken]
bar3[StringToken]([BeginToken]int[StringToken]?[SimpleToken] x[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]int[StringToken]>[SimpleToken]{[BeginToken] for[KeywordToken] ([BeginToken]var[KeywordToken] _[StringToken] in[KeywordToken] [[BeginToken]][SimpleToken])[SimpleToken] ?[SimpleToken]x[StringToken] }[SimpleToken];[SimpleToken]
bar4[StringToken]([BeginToken]String[StringToken] x[StringToken],[SimpleToken] bool[StringToken]?[SimpleToken] y[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]String[StringToken],[SimpleToken] bool[StringToken]>[SimpleToken]{[BeginToken]x[StringToken]:[SimpleToken] ?[SimpleToken]y[StringToken]}[SimpleToken];[SimpleToken]
bar5[StringToken]([BeginToken]int[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] num[StringToken] y[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]int[StringToken],[SimpleToken] num[StringToken]>[SimpleToken]{[BeginToken]?[SimpleToken]x[StringToken]:[SimpleToken] y[StringToken]}[SimpleToken];[SimpleToken]
bar6[StringToken]([BeginToken]double[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] Symbol[StringToken]?[SimpleToken] y[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]double[StringToken],[SimpleToken] Symbol[StringToken]>[SimpleToken]{[BeginToken]?[SimpleToken]x[StringToken]:[SimpleToken] ?[SimpleToken]y[StringToken]}[SimpleToken];[SimpleToken]
bar7[StringToken]([BeginToken]num[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] double[StringToken]?[SimpleToken] y[StringToken],[SimpleToken] bool[StringToken] b[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]num[StringToken],[SimpleToken] double[StringToken]>[SimpleToken]{[BeginToken] if[KeywordToken] ([BeginToken]b[StringToken])[SimpleToken] ?[SimpleToken]x[StringToken]:[SimpleToken] ?[SimpleToken]y[StringToken] }[SimpleToken];[SimpleToken]
bar8[StringToken]([BeginToken]num[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] double[StringToken]?[SimpleToken] y[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]num[StringToken],[SimpleToken] double[StringToken]>[SimpleToken]{[BeginToken] for[KeywordToken] ([BeginToken]var[KeywordToken] _[StringToken] in[KeywordToken] [[BeginToken]][SimpleToken])[SimpleToken] ?[SimpleToken]x[StringToken]:[SimpleToken] ?[SimpleToken]y[StringToken] }[SimpleToken];[SimpleToken]
[SimpleToken]

View file

@ -0,0 +1,25 @@
foo1(int? x) => <int>[?x];
foo2(String? x) => <String>{?x};
foo3(bool? x, num y) => <bool, num>{?x: y};
bar1(int? x) => <int>[?x];
bar2(int? x, bool b) => <int>{ if (b) ?x };
bar3(int? x) => <int>{ for (var _ in []) ?x };
bar4(String x, bool? y) => <String, bool>{x: ?y};
bar5(int? x, num y) => <int, num>{?x: y};
bar6(double? x, Symbol? y) => <double, Symbol>{?x: ?y};
bar7(num? x, double? y, bool b) => <num, double>{ if (b) ?x: ?y };
bar8(num? x, double? y) => <num, double>{ for (var _ in []) ?x: ?y };
foo1[StringToken]([BeginToken]int[StringToken]?[SimpleToken] x[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]int[StringToken]>[SimpleToken][[BeginToken]?[SimpleToken]x[StringToken]][SimpleToken];[SimpleToken]
foo2[StringToken]([BeginToken]String[StringToken]?[SimpleToken] x[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]String[StringToken]>[SimpleToken]{[BeginToken]?[SimpleToken]x[StringToken]}[SimpleToken];[SimpleToken]
foo3[StringToken]([BeginToken]bool[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] num[StringToken] y[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]bool[StringToken],[SimpleToken] num[StringToken]>[SimpleToken]{[BeginToken]?[SimpleToken]x[StringToken]:[SimpleToken] y[StringToken]}[SimpleToken];[SimpleToken]
bar1[StringToken]([BeginToken]int[StringToken]?[SimpleToken] x[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]int[StringToken]>[SimpleToken][[BeginToken]?[SimpleToken]x[StringToken]][SimpleToken];[SimpleToken]
bar2[StringToken]([BeginToken]int[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] bool[StringToken] b[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]int[StringToken]>[SimpleToken]{[BeginToken] if[KeywordToken] ([BeginToken]b[StringToken])[SimpleToken] ?[SimpleToken]x[StringToken] }[SimpleToken];[SimpleToken]
bar3[StringToken]([BeginToken]int[StringToken]?[SimpleToken] x[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]int[StringToken]>[SimpleToken]{[BeginToken] for[KeywordToken] ([BeginToken]var[KeywordToken] _[StringToken] in[KeywordToken] [][SimpleToken])[SimpleToken] ?[SimpleToken]x[StringToken] }[SimpleToken];[SimpleToken]
bar4[StringToken]([BeginToken]String[StringToken] x[StringToken],[SimpleToken] bool[StringToken]?[SimpleToken] y[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]String[StringToken],[SimpleToken] bool[StringToken]>[SimpleToken]{[BeginToken]x[StringToken]:[SimpleToken] ?[SimpleToken]y[StringToken]}[SimpleToken];[SimpleToken]
bar5[StringToken]([BeginToken]int[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] num[StringToken] y[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]int[StringToken],[SimpleToken] num[StringToken]>[SimpleToken]{[BeginToken]?[SimpleToken]x[StringToken]:[SimpleToken] y[StringToken]}[SimpleToken];[SimpleToken]
bar6[StringToken]([BeginToken]double[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] Symbol[StringToken]?[SimpleToken] y[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]double[StringToken],[SimpleToken] Symbol[StringToken]>[SimpleToken]{[BeginToken]?[SimpleToken]x[StringToken]:[SimpleToken] ?[SimpleToken]y[StringToken]}[SimpleToken];[SimpleToken]
bar7[StringToken]([BeginToken]num[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] double[StringToken]?[SimpleToken] y[StringToken],[SimpleToken] bool[StringToken] b[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]num[StringToken],[SimpleToken] double[StringToken]>[SimpleToken]{[BeginToken] if[KeywordToken] ([BeginToken]b[StringToken])[SimpleToken] ?[SimpleToken]x[StringToken]:[SimpleToken] ?[SimpleToken]y[StringToken] }[SimpleToken];[SimpleToken]
bar8[StringToken]([BeginToken]num[StringToken]?[SimpleToken] x[StringToken],[SimpleToken] double[StringToken]?[SimpleToken] y[StringToken])[SimpleToken] =>[SimpleToken] <[BeginToken]num[StringToken],[SimpleToken] double[StringToken]>[SimpleToken]{[BeginToken] for[KeywordToken] ([BeginToken]var[KeywordToken] _[StringToken] in[KeywordToken] [][SimpleToken])[SimpleToken] ?[SimpleToken]x[StringToken]:[SimpleToken] ?[SimpleToken]y[StringToken] }[SimpleToken];[SimpleToken]
[SimpleToken]

View file

@ -39,7 +39,7 @@ beginCompilationUnit(test)
endTypeArguments(2, <, >)
handleLiteralInt(1)
handleLiteralInt(2)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endConstantPattern(const)
endPattern(})

View file

@ -102,7 +102,7 @@ parseUnit(test)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(2)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endConstantPattern(const)
listener: endPattern(})

View file

@ -39,7 +39,7 @@ beginCompilationUnit(test)
endTypeArguments(2, <, >)
handleLiteralInt(1)
handleLiteralInt(2)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endConstantPattern(const)
beginAsOperatorType(as)

View file

@ -102,7 +102,7 @@ parseUnit(test)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(2)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endConstantPattern(const)
listener: beginAsOperatorType(as)

View file

@ -36,7 +36,7 @@ beginCompilationUnit(test)
endTypeArguments(2, <, >)
handleLiteralInt(1)
handleLiteralInt(2)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endConstantPattern(const)
endPattern(})

View file

@ -94,7 +94,7 @@ parseUnit(test)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(2)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endConstantPattern(const)
listener: endPattern(})

View file

@ -39,7 +39,7 @@ beginCompilationUnit(test)
endTypeArguments(2, <, >)
handleLiteralInt(1)
handleLiteralInt(2)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endConstantPattern(const)
handleNullAssertPattern(!)

View file

@ -102,7 +102,7 @@ parseUnit(test)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(2)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endConstantPattern(const)
listener: handleNullAssertPattern(!)

View file

@ -39,7 +39,7 @@ beginCompilationUnit(test)
endTypeArguments(2, <, >)
handleLiteralInt(1)
handleLiteralInt(2)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endConstantPattern(const)
handleNullCheckPattern(?)

View file

@ -102,7 +102,7 @@ parseUnit(test)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(2)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endConstantPattern(const)
listener: handleNullCheckPattern(?)

View file

@ -32,7 +32,7 @@ beginCompilationUnit(test)
handleNoTypeArguments({)
handleLiteralInt(1)
handleLiteralInt(2)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endConstantPattern(const)
endPattern(})

View file

@ -94,7 +94,7 @@ parseUnit(test)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(2)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endConstantPattern(const)
listener: endPattern(})

View file

@ -32,7 +32,7 @@ beginCompilationUnit(test)
handleNoTypeArguments({)
handleLiteralInt(1)
handleLiteralInt(2)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endConstantPattern(const)
beginAsOperatorType(as)

View file

@ -94,7 +94,7 @@ parseUnit(test)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(2)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endConstantPattern(const)
listener: beginAsOperatorType(as)

View file

@ -29,7 +29,7 @@ beginCompilationUnit(test)
handleNoTypeArguments({)
handleLiteralInt(1)
handleLiteralInt(2)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endConstantPattern(const)
endPattern(})

View file

@ -86,7 +86,7 @@ parseUnit(test)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(2)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endConstantPattern(const)
listener: endPattern(})

View file

@ -32,7 +32,7 @@ beginCompilationUnit(test)
handleNoTypeArguments({)
handleLiteralInt(1)
handleLiteralInt(2)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endConstantPattern(const)
handleNullAssertPattern(!)

View file

@ -94,7 +94,7 @@ parseUnit(test)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(2)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endConstantPattern(const)
listener: handleNullAssertPattern(!)

View file

@ -32,7 +32,7 @@ beginCompilationUnit(test)
handleNoTypeArguments({)
handleLiteralInt(1)
handleLiteralInt(2)
handleLiteralMapEntry(:, })
handleLiteralMapEntry(:, }, null, null)
handleLiteralSetOrMap(1, {, null, }, false)
endConstantPattern(const)
handleNullCheckPattern(?)

View file

@ -94,7 +94,7 @@ parseUnit(test)
parsePrimary(:, expression, ConstantPatternContext.none)
parseLiteralInt(:)
listener: handleLiteralInt(2)
listener: handleLiteralMapEntry(:, })
listener: handleLiteralMapEntry(:, }, null, null)
listener: handleLiteralSetOrMap(1, {, null, }, false)
listener: endConstantPattern(const)
listener: handleNullCheckPattern(?)

View file

@ -458,10 +458,10 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 0,
missCount: 128,
),
// 92.1639300493926%.
// 92.06539074960128%.
"package:front_end/src/kernel/body_builder.dart": (
hitCount: 6904,
missCount: 587,
hitCount: 6927,
missCount: 597,
),
// 91.26984126984127%.
"package:front_end/src/kernel/body_builder_context.dart": (
@ -488,10 +488,10 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 205,
missCount: 89,
),
// 85.85694379934975%.
// 85.16024152345565%.
"package:front_end/src/kernel/constant_evaluator.dart": (
hitCount: 3697,
missCount: 609,
hitCount: 3667,
missCount: 639,
),
// 97.59036144578313%.
"package:front_end/src/kernel/constant_int_folder.dart": (
@ -618,10 +618,10 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 43,
missCount: 5,
),
// 0.1984126984126984%.
// 0.19801980198019803%.
"package:front_end/src/kernel/macro/annotation_parser.dart": (
hitCount: 2,
missCount: 1006,
missCount: 1008,
),
// 0.0%.
"package:front_end/src/kernel/macro/identifiers.dart": (
@ -799,14 +799,14 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 295,
missCount: 35,
),
// 85.1680467608378%.
// 85.15720204728248%.
"package:front_end/src/source/source_library_builder.dart": (
hitCount: 3497,
hitCount: 3494,
missCount: 609,
),
// 81.87472234562416%.
// 81.82628062360801%.
"package:front_end/src/source/source_loader.dart": (
hitCount: 1843,
hitCount: 1837,
missCount: 408,
),
// 50.0%.
@ -949,9 +949,9 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 78,
missCount: 1312,
),
// 86.54205607476636%.
// 85.79439252336448%.
"package:front_end/src/util/textual_outline.dart": (
hitCount: 463,
missCount: 72,
hitCount: 459,
missCount: 76,
),
};

View file

@ -1046,7 +1046,8 @@ class TestInfoListener implements Listener {
}
@override
void handleLiteralMapEntry(Token colon, Token endToken) {
void handleLiteralMapEntry(Token colon, Token endToken,
{Token? nullAwareKeyToken, Token? nullAwareValueToken}) {
calls.add('handleLiteralMapEntry $colon, $endToken');
}

View file

@ -1587,10 +1587,17 @@ class ParserTestListener implements Listener {
}
@override
void handleLiteralMapEntry(Token colon, Token endToken) {
void handleLiteralMapEntry(Token colon, Token endToken,
{Token? nullAwareKeyToken, Token? nullAwareValueToken}) {
seen(colon);
seen(endToken);
doPrint('handleLiteralMapEntry(' '$colon, ' '$endToken)');
seen(nullAwareKeyToken);
seen(nullAwareValueToken);
doPrint('handleLiteralMapEntry('
'$colon, '
'$endToken, '
'$nullAwareKeyToken, '
'$nullAwareValueToken)');
}
@override
@ -2646,6 +2653,12 @@ class ParserTestListener implements Listener {
doPrint('handleSpreadExpression(' '$spreadToken)');
}
@override
void handleNullAwareElement(Token nullAwareToken) {
seen(nullAwareToken);
doPrint('handleNullAwareElement(' '$nullAwareToken)');
}
@override
void handleRestPattern(Token dots, {required bool hasSubPattern}) {
seen(dots);

View file

@ -0,0 +1 @@
--enable-experiment=null-aware-elements

View file

@ -0,0 +1,16 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
foo1(int? x) => <int>[?x];
foo2(String? x) => <String>{?x};
foo3(bool? x, num y) => <bool, num>{?x: y};
bar1(int? x) => <int>[?x];
bar2(int? x, bool b) => <int>{ if (b) ?x };
bar3(int? x) => <int>{ for (var _ in []) ?x };
bar4(String x, bool? y) => <String, bool>{x: ?y};
bar5(int? x, num y) => <int, num>{?x: y};
bar6(double? x, Symbol? y) => <double, Symbol>{?x: ?y};
bar7(num? x, double? y, bool b) => <num, double>{ if (b) ?x: ?y };
bar8(num? x, double? y) => <num, double>{ for (var _ in []) ?x: ?y };

View file

@ -0,0 +1,90 @@
library;
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
static method foo1(core::int? x) → dynamic
return block {
final core::List<core::int> #t1 = <core::int>[];
final has-declared-initializer core::Iterable<core::int>? #t2 = null;
if(!(#t2 == null))
#t1.{core::List::addAll}{Invariant}(#t2{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
} =>#t1;
static method foo2(core::String? x) → dynamic
return block {
final core::Set<core::String> #t3 = col::LinkedHashSet::•<core::String>();
final has-declared-initializer core::Iterable<core::String>? #t4 = null;
if(!(#t4 == null))
#t3.{core::Set::addAll}{Invariant}(#t4{core::Iterable<core::String>}){(core::Iterable<core::String>) → void};
} =>#t3;
static method foo3(core::bool? x, core::num y) → dynamic
return block {
final core::Map<core::bool, core::num> #t5 = <core::bool, core::num>{};
final has-declared-initializer core::Map<core::bool, core::num>? #t6 = null;
if(!(#t6 == null))
#t5.{core::Map::addAll}{Invariant}(#t6{core::Map<core::bool, core::num>}){(core::Map<core::bool, core::num>) → void};
} =>#t5;
static method bar1(core::int? x) → dynamic
return block {
final core::List<core::int> #t7 = <core::int>[];
final has-declared-initializer core::Iterable<core::int>? #t8 = null;
if(!(#t8 == null))
#t7.{core::List::addAll}{Invariant}(#t8{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
} =>#t7;
static method bar2(core::int? x, core::bool b) → dynamic
return block {
final core::Set<core::int> #t9 = col::LinkedHashSet::•<core::int>();
if(b) {
final has-declared-initializer core::Iterable<core::int>? #t10 = null;
if(!(#t10 == null))
#t9.{core::Set::addAll}{Invariant}(#t10{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
}
} =>#t9;
static method bar3(core::int? x) → dynamic
return block {
final core::Set<core::int> #t11 = col::LinkedHashSet::•<core::int>();
for (dynamic _ in <dynamic>[]) {
final has-declared-initializer core::Iterable<core::int>? #t12 = null;
if(!(#t12 == null))
#t11.{core::Set::addAll}{Invariant}(#t12{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
}
} =>#t11;
static method bar4(core::String x, core::bool? y) → dynamic
return block {
final core::Map<core::String, core::bool> #t13 = <core::String, core::bool>{};
final has-declared-initializer core::Map<core::String, core::bool>? #t14 = null;
if(!(#t14 == null))
#t13.{core::Map::addAll}{Invariant}(#t14{core::Map<core::String, core::bool>}){(core::Map<core::String, core::bool>) → void};
} =>#t13;
static method bar5(core::int? x, core::num y) → dynamic
return block {
final core::Map<core::int, core::num> #t15 = <core::int, core::num>{};
final has-declared-initializer core::Map<core::int, core::num>? #t16 = null;
if(!(#t16 == null))
#t15.{core::Map::addAll}{Invariant}(#t16{core::Map<core::int, core::num>}){(core::Map<core::int, core::num>) → void};
} =>#t15;
static method bar6(core::double? x, core::Symbol? y) → dynamic
return block {
final core::Map<core::double, core::Symbol> #t17 = <core::double, core::Symbol>{};
final has-declared-initializer core::Map<core::double, core::Symbol>? #t18 = null;
if(!(#t18 == null))
#t17.{core::Map::addAll}{Invariant}(#t18{core::Map<core::double, core::Symbol>}){(core::Map<core::double, core::Symbol>) → void};
} =>#t17;
static method bar7(core::num? x, core::double? y, core::bool b) → dynamic
return block {
final core::Map<core::num, core::double> #t19 = <core::num, core::double>{};
if(b) {
final has-declared-initializer core::Map<core::num, core::double>? #t20 = null;
if(!(#t20 == null))
#t19.{core::Map::addAll}{Invariant}(#t20{core::Map<core::num, core::double>}){(core::Map<core::num, core::double>) → void};
}
} =>#t19;
static method bar8(core::num? x, core::double? y) → dynamic
return block {
final core::Map<core::num, core::double> #t21 = <core::num, core::double>{};
for (dynamic _ in <dynamic>[]) {
final has-declared-initializer core::Map<core::num, core::double>? #t22 = null;
if(!(#t22 == null))
#t21.{core::Map::addAll}{Invariant}(#t22{core::Map<core::num, core::double>}){(core::Map<core::num, core::double>) → void};
}
} =>#t21;

View file

@ -0,0 +1,90 @@
library;
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
static method foo1(core::int? x) → dynamic
return block {
final core::List<core::int> #t1 = <core::int>[];
final has-declared-initializer core::Iterable<core::int>? #t2 = null;
if(!(#t2 == null))
#t1.{core::List::addAll}{Invariant}(#t2{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
} =>#t1;
static method foo2(core::String? x) → dynamic
return block {
final core::Set<core::String> #t3 = col::LinkedHashSet::•<core::String>();
final has-declared-initializer core::Iterable<core::String>? #t4 = null;
if(!(#t4 == null))
#t3.{core::Set::addAll}{Invariant}(#t4{core::Iterable<core::String>}){(core::Iterable<core::String>) → void};
} =>#t3;
static method foo3(core::bool? x, core::num y) → dynamic
return block {
final core::Map<core::bool, core::num> #t5 = <core::bool, core::num>{};
final has-declared-initializer core::Map<core::bool, core::num>? #t6 = null;
if(!(#t6 == null))
#t5.{core::Map::addAll}{Invariant}(#t6{core::Map<core::bool, core::num>}){(core::Map<core::bool, core::num>) → void};
} =>#t5;
static method bar1(core::int? x) → dynamic
return block {
final core::List<core::int> #t7 = <core::int>[];
final has-declared-initializer core::Iterable<core::int>? #t8 = null;
if(!(#t8 == null))
#t7.{core::List::addAll}{Invariant}(#t8{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
} =>#t7;
static method bar2(core::int? x, core::bool b) → dynamic
return block {
final core::Set<core::int> #t9 = col::LinkedHashSet::•<core::int>();
if(b) {
final has-declared-initializer core::Iterable<core::int>? #t10 = null;
if(!(#t10 == null))
#t9.{core::Set::addAll}{Invariant}(#t10{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
}
} =>#t9;
static method bar3(core::int? x) → dynamic
return block {
final core::Set<core::int> #t11 = col::LinkedHashSet::•<core::int>();
for (dynamic _ in <dynamic>[]) {
final has-declared-initializer core::Iterable<core::int>? #t12 = null;
if(!(#t12 == null))
#t11.{core::Set::addAll}{Invariant}(#t12{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
}
} =>#t11;
static method bar4(core::String x, core::bool? y) → dynamic
return block {
final core::Map<core::String, core::bool> #t13 = <core::String, core::bool>{};
final has-declared-initializer core::Map<core::String, core::bool>? #t14 = null;
if(!(#t14 == null))
#t13.{core::Map::addAll}{Invariant}(#t14{core::Map<core::String, core::bool>}){(core::Map<core::String, core::bool>) → void};
} =>#t13;
static method bar5(core::int? x, core::num y) → dynamic
return block {
final core::Map<core::int, core::num> #t15 = <core::int, core::num>{};
final has-declared-initializer core::Map<core::int, core::num>? #t16 = null;
if(!(#t16 == null))
#t15.{core::Map::addAll}{Invariant}(#t16{core::Map<core::int, core::num>}){(core::Map<core::int, core::num>) → void};
} =>#t15;
static method bar6(core::double? x, core::Symbol? y) → dynamic
return block {
final core::Map<core::double, core::Symbol> #t17 = <core::double, core::Symbol>{};
final has-declared-initializer core::Map<core::double, core::Symbol>? #t18 = null;
if(!(#t18 == null))
#t17.{core::Map::addAll}{Invariant}(#t18{core::Map<core::double, core::Symbol>}){(core::Map<core::double, core::Symbol>) → void};
} =>#t17;
static method bar7(core::num? x, core::double? y, core::bool b) → dynamic
return block {
final core::Map<core::num, core::double> #t19 = <core::num, core::double>{};
if(b) {
final has-declared-initializer core::Map<core::num, core::double>? #t20 = null;
if(!(#t20 == null))
#t19.{core::Map::addAll}{Invariant}(#t20{core::Map<core::num, core::double>}){(core::Map<core::num, core::double>) → void};
}
} =>#t19;
static method bar8(core::num? x, core::double? y) → dynamic
return block {
final core::Map<core::num, core::double> #t21 = <core::num, core::double>{};
for (dynamic _ in <dynamic>[]) {
final has-declared-initializer core::Map<core::num, core::double>? #t22 = null;
if(!(#t22 == null))
#t21.{core::Map::addAll}{Invariant}(#t22{core::Map<core::num, core::double>}){(core::Map<core::num, core::double>) → void};
}
} =>#t21;

View file

@ -0,0 +1,26 @@
library;
import self as self;
import "dart:core" as core;
static method foo1(core::int? x) → dynamic
;
static method foo2(core::String? x) → dynamic
;
static method foo3(core::bool? x, core::num y) → dynamic
;
static method bar1(core::int? x) → dynamic
;
static method bar2(core::int? x, core::bool b) → dynamic
;
static method bar3(core::int? x) → dynamic
;
static method bar4(core::String x, core::bool? y) → dynamic
;
static method bar5(core::int? x, core::num y) → dynamic
;
static method bar6(core::double? x, core::Symbol? y) → dynamic
;
static method bar7(core::num? x, core::double? y, core::bool b) → dynamic
;
static method bar8(core::num? x, core::double? y) → dynamic
;

View file

@ -0,0 +1,102 @@
library;
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
static method foo1(core::int? x) → dynamic
return block {
final core::List<core::int> #t1 = core::_GrowableList::•<core::int>(0);
final has-declared-initializer core::Iterable<core::int>? #t2 = null;
if(!(#t2 == null))
#t1.{core::List::addAll}{Invariant}(#t2{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
} =>#t1;
static method foo2(core::String? x) → dynamic
return block {
final core::Set<core::String> #t3 = new col::_Set::•<core::String>();
final has-declared-initializer core::Iterable<core::String>? #t4 = null;
if(!(#t4 == null))
#t3.{core::Set::addAll}{Invariant}(#t4{core::Iterable<core::String>}){(core::Iterable<core::String>) → void};
} =>#t3;
static method foo3(core::bool? x, core::num y) → dynamic
return block {
final core::Map<core::bool, core::num> #t5 = <core::bool, core::num>{};
final has-declared-initializer core::Map<core::bool, core::num>? #t6 = null;
if(!(#t6 == null))
#t5.{core::Map::addAll}{Invariant}(#t6{core::Map<core::bool, core::num>}){(core::Map<core::bool, core::num>) → void};
} =>#t5;
static method bar1(core::int? x) → dynamic
return block {
final core::List<core::int> #t7 = core::_GrowableList::•<core::int>(0);
final has-declared-initializer core::Iterable<core::int>? #t8 = null;
if(!(#t8 == null))
#t7.{core::List::addAll}{Invariant}(#t8{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
} =>#t7;
static method bar2(core::int? x, core::bool b) → dynamic
return block {
final core::Set<core::int> #t9 = new col::_Set::•<core::int>();
if(b) {
final has-declared-initializer core::Iterable<core::int>? #t10 = null;
if(!(#t10 == null))
#t9.{core::Set::addAll}{Invariant}(#t10{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
}
} =>#t9;
static method bar3(core::int? x) → dynamic
return block {
final core::Set<core::int> #t11 = new col::_Set::•<core::int>();
{
synthesized core::Iterator<dynamic> :sync-for-iterator = core::_GrowableList::•<dynamic>(0).{core::Iterable::iterator}{core::Iterator<dynamic>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
dynamic _ = :sync-for-iterator.{core::Iterator::current}{dynamic};
{
final has-declared-initializer core::Iterable<core::int>? #t12 = null;
if(!(#t12 == null))
#t11.{core::Set::addAll}{Invariant}(#t12{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
}
}
}
} =>#t11;
static method bar4(core::String x, core::bool? y) → dynamic
return block {
final core::Map<core::String, core::bool> #t13 = <core::String, core::bool>{};
final has-declared-initializer core::Map<core::String, core::bool>? #t14 = null;
if(!(#t14 == null))
#t13.{core::Map::addAll}{Invariant}(#t14{core::Map<core::String, core::bool>}){(core::Map<core::String, core::bool>) → void};
} =>#t13;
static method bar5(core::int? x, core::num y) → dynamic
return block {
final core::Map<core::int, core::num> #t15 = <core::int, core::num>{};
final has-declared-initializer core::Map<core::int, core::num>? #t16 = null;
if(!(#t16 == null))
#t15.{core::Map::addAll}{Invariant}(#t16{core::Map<core::int, core::num>}){(core::Map<core::int, core::num>) → void};
} =>#t15;
static method bar6(core::double? x, core::Symbol? y) → dynamic
return block {
final core::Map<core::double, core::Symbol> #t17 = <core::double, core::Symbol>{};
final has-declared-initializer core::Map<core::double, core::Symbol>? #t18 = null;
if(!(#t18 == null))
#t17.{core::Map::addAll}{Invariant}(#t18{core::Map<core::double, core::Symbol>}){(core::Map<core::double, core::Symbol>) → void};
} =>#t17;
static method bar7(core::num? x, core::double? y, core::bool b) → dynamic
return block {
final core::Map<core::num, core::double> #t19 = <core::num, core::double>{};
if(b) {
final has-declared-initializer core::Map<core::num, core::double>? #t20 = null;
if(!(#t20 == null))
#t19.{core::Map::addAll}{Invariant}(#t20{core::Map<core::num, core::double>}){(core::Map<core::num, core::double>) → void};
}
} =>#t19;
static method bar8(core::num? x, core::double? y) → dynamic
return block {
final core::Map<core::num, core::double> #t21 = <core::num, core::double>{};
{
synthesized core::Iterator<dynamic> :sync-for-iterator = core::_GrowableList::•<dynamic>(0).{core::Iterable::iterator}{core::Iterator<dynamic>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
dynamic _ = :sync-for-iterator.{core::Iterator::current}{dynamic};
{
final has-declared-initializer core::Map<core::num, core::double>? #t22 = null;
if(!(#t22 == null))
#t21.{core::Map::addAll}{Invariant}(#t22{core::Map<core::num, core::double>}){(core::Map<core::num, core::double>) → void};
}
}
}
} =>#t21;

View file

@ -0,0 +1,21 @@
foo1(int? x) => <int>[?x];
foo2(String? x) => <String>{?x};
foo3(bool? x, num y) => <bool, num>{?x: y};
bar1(int? x) => <int>[?x];
bar2(int? x, bool b) => <int>{ if (b) ?x };
bar3(int? x) => <int>{ for (var _ in []) ?x };
bar4(String x, bool? y) => <String, bool>{x: ?y};
bar5(int? x, num y) => <int, num>{?x: y};
bar6(double? x, Symbol? y) => <double, Symbol>{?x: ?y};
bar7(num? x, double? y, bool b) => <num, double>{ if (b) ?x: ?y };
bar8(num? x, double? y) => <num, double>{ for (var _ in []) ?x: ?y };

View file

@ -0,0 +1,21 @@
bar1(int? x) => <int>[?x];
bar2(int? x, bool b) => <int>{ if (b) ?x };
bar3(int? x) => <int>{ for (var _ in []) ?x };
bar4(String x, bool? y) => <String, bool>{x: ?y};
bar5(int? x, num y) => <int, num>{?x: y};
bar6(double? x, Symbol? y) => <double, Symbol>{?x: ?y};
bar7(num? x, double? y, bool b) => <num, double>{ if (b) ?x: ?y };
bar8(num? x, double? y) => <num, double>{ for (var _ in []) ?x: ?y };
foo1(int? x) => <int>[?x];
foo2(String? x) => <String>{?x};
foo3(bool? x, num y) => <bool, num>{?x: y};

View file

@ -0,0 +1,127 @@
//
// Problems in component:
//
// sdk/lib/core/core.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/async/async.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/collection/collection.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/convert/convert.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/developer/developer.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/ffi/ffi.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/internal/internal.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/isolate/isolate.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/math/math.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/mirrors/mirrors.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/typed_data/typed_data.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/_internal/vm/bin/vmservice_io.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/vmservice/vmservice.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/_internal/vm/bin/builtin.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/html/dartium/nativewrappers.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/io/io.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/cli/cli.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
library;
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
static method foo1(core::int? x) → dynamic
return block {
final core::List<core::int> #t1 = <core::int>[];
final has-declared-initializer core::Iterable<core::int>? #t2 = null;
if(!(#t2 == null))
#t1.{core::List::addAll}{Invariant}(#t2{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
} =>#t1;
static method foo2(core::String? x) → dynamic
return block {
final core::Set<core::String> #t3 = col::LinkedHashSet::•<core::String>();
final has-declared-initializer core::Iterable<core::String>? #t4 = null;
if(!(#t4 == null))
#t3.{core::Set::addAll}{Invariant}(#t4{core::Iterable<core::String>}){(core::Iterable<core::String>) → void};
} =>#t3;
static method foo3(core::bool? x, core::num y) → dynamic
return block {
final core::Map<core::bool, core::num> #t5 = <core::bool, core::num>{};
final has-declared-initializer core::Map<core::bool, core::num>? #t6 = null;
if(!(#t6 == null))
#t5.{core::Map::addAll}{Invariant}(#t6{core::Map<core::bool, core::num>}){(core::Map<core::bool, core::num>) → void};
} =>#t5;
static method bar1(core::int? x) → dynamic
return block {
final core::List<core::int> #t7 = <core::int>[];
final has-declared-initializer core::Iterable<core::int>? #t8 = null;
if(!(#t8 == null))
#t7.{core::List::addAll}{Invariant}(#t8{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
} =>#t7;
static method bar2(core::int? x, core::bool b) → dynamic
return block {
final core::Set<core::int> #t9 = col::LinkedHashSet::•<core::int>();
if(b) {
final has-declared-initializer core::Iterable<core::int>? #t10 = null;
if(!(#t10 == null))
#t9.{core::Set::addAll}{Invariant}(#t10{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
}
} =>#t9;
static method bar3(core::int? x) → dynamic
return block {
final core::Set<core::int> #t11 = col::LinkedHashSet::•<core::int>();
for (dynamic _ in <dynamic>[]) {
final has-declared-initializer core::Iterable<core::int>? #t12 = null;
if(!(#t12 == null))
#t11.{core::Set::addAll}{Invariant}(#t12{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
}
} =>#t11;
static method bar4(core::String x, core::bool? y) → dynamic
return block {
final core::Map<core::String, core::bool> #t13 = <core::String, core::bool>{};
final has-declared-initializer core::Map<core::String, core::bool>? #t14 = null;
if(!(#t14 == null))
#t13.{core::Map::addAll}{Invariant}(#t14{core::Map<core::String, core::bool>}){(core::Map<core::String, core::bool>) → void};
} =>#t13;
static method bar5(core::int? x, core::num y) → dynamic
return block {
final core::Map<core::int, core::num> #t15 = <core::int, core::num>{};
final has-declared-initializer core::Map<core::int, core::num>? #t16 = null;
if(!(#t16 == null))
#t15.{core::Map::addAll}{Invariant}(#t16{core::Map<core::int, core::num>}){(core::Map<core::int, core::num>) → void};
} =>#t15;
static method bar6(core::double? x, core::Symbol? y) → dynamic
return block {
final core::Map<core::double, core::Symbol> #t17 = <core::double, core::Symbol>{};
final has-declared-initializer core::Map<core::double, core::Symbol>? #t18 = null;
if(!(#t18 == null))
#t17.{core::Map::addAll}{Invariant}(#t18{core::Map<core::double, core::Symbol>}){(core::Map<core::double, core::Symbol>) → void};
} =>#t17;
static method bar7(core::num? x, core::double? y, core::bool b) → dynamic
return block {
final core::Map<core::num, core::double> #t19 = <core::num, core::double>{};
if(b) {
final has-declared-initializer core::Map<core::num, core::double>? #t20 = null;
if(!(#t20 == null))
#t19.{core::Map::addAll}{Invariant}(#t20{core::Map<core::num, core::double>}){(core::Map<core::num, core::double>) → void};
}
} =>#t19;
static method bar8(core::num? x, core::double? y) → dynamic
return block {
final core::Map<core::num, core::double> #t21 = <core::num, core::double>{};
for (dynamic _ in <dynamic>[]) {
final has-declared-initializer core::Map<core::num, core::double>? #t22 = null;
if(!(#t22 == null))
#t21.{core::Map::addAll}{Invariant}(#t22{core::Map<core::num, core::double>}){(core::Map<core::num, core::double>) → void};
}
} =>#t21;

View file

@ -0,0 +1,139 @@
//
// Problems in component:
//
// sdk/lib/core/core.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/async/async.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/collection/collection.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/convert/convert.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/developer/developer.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/ffi/ffi.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/internal/internal.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/isolate/isolate.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/math/math.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/mirrors/mirrors.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/typed_data/typed_data.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/_internal/vm/bin/vmservice_io.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/vmservice/vmservice.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/_internal/vm/bin/builtin.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/html/dartium/nativewrappers.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/io/io.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
// sdk/lib/cli/cli.dart: Error: Loaded library is compiled with sound null safety and cannot be used in compilation for unsound null safety.
//
library;
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
static method foo1(core::int? x) → dynamic
return block {
final core::List<core::int> #t1 = core::_GrowableList::•<core::int>(0);
final has-declared-initializer core::Iterable<core::int>? #t2 = null;
if(!(#t2 == null))
#t1.{core::List::addAll}{Invariant}(#t2{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
} =>#t1;
static method foo2(core::String? x) → dynamic
return block {
final core::Set<core::String> #t3 = new col::_Set::•<core::String>();
final has-declared-initializer core::Iterable<core::String>? #t4 = null;
if(!(#t4 == null))
#t3.{core::Set::addAll}{Invariant}(#t4{core::Iterable<core::String>}){(core::Iterable<core::String>) → void};
} =>#t3;
static method foo3(core::bool? x, core::num y) → dynamic
return block {
final core::Map<core::bool, core::num> #t5 = <core::bool, core::num>{};
final has-declared-initializer core::Map<core::bool, core::num>? #t6 = null;
if(!(#t6 == null))
#t5.{core::Map::addAll}{Invariant}(#t6{core::Map<core::bool, core::num>}){(core::Map<core::bool, core::num>) → void};
} =>#t5;
static method bar1(core::int? x) → dynamic
return block {
final core::List<core::int> #t7 = core::_GrowableList::•<core::int>(0);
final has-declared-initializer core::Iterable<core::int>? #t8 = null;
if(!(#t8 == null))
#t7.{core::List::addAll}{Invariant}(#t8{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
} =>#t7;
static method bar2(core::int? x, core::bool b) → dynamic
return block {
final core::Set<core::int> #t9 = new col::_Set::•<core::int>();
if(b) {
final has-declared-initializer core::Iterable<core::int>? #t10 = null;
if(!(#t10 == null))
#t9.{core::Set::addAll}{Invariant}(#t10{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
}
} =>#t9;
static method bar3(core::int? x) → dynamic
return block {
final core::Set<core::int> #t11 = new col::_Set::•<core::int>();
{
synthesized core::Iterator<dynamic> :sync-for-iterator = core::_GrowableList::•<dynamic>(0).{core::Iterable::iterator}{core::Iterator<dynamic>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
dynamic _ = :sync-for-iterator.{core::Iterator::current}{dynamic};
{
final has-declared-initializer core::Iterable<core::int>? #t12 = null;
if(!(#t12 == null))
#t11.{core::Set::addAll}{Invariant}(#t12{core::Iterable<core::int>}){(core::Iterable<core::int>) → void};
}
}
}
} =>#t11;
static method bar4(core::String x, core::bool? y) → dynamic
return block {
final core::Map<core::String, core::bool> #t13 = <core::String, core::bool>{};
final has-declared-initializer core::Map<core::String, core::bool>? #t14 = null;
if(!(#t14 == null))
#t13.{core::Map::addAll}{Invariant}(#t14{core::Map<core::String, core::bool>}){(core::Map<core::String, core::bool>) → void};
} =>#t13;
static method bar5(core::int? x, core::num y) → dynamic
return block {
final core::Map<core::int, core::num> #t15 = <core::int, core::num>{};
final has-declared-initializer core::Map<core::int, core::num>? #t16 = null;
if(!(#t16 == null))
#t15.{core::Map::addAll}{Invariant}(#t16{core::Map<core::int, core::num>}){(core::Map<core::int, core::num>) → void};
} =>#t15;
static method bar6(core::double? x, core::Symbol? y) → dynamic
return block {
final core::Map<core::double, core::Symbol> #t17 = <core::double, core::Symbol>{};
final has-declared-initializer core::Map<core::double, core::Symbol>? #t18 = null;
if(!(#t18 == null))
#t17.{core::Map::addAll}{Invariant}(#t18{core::Map<core::double, core::Symbol>}){(core::Map<core::double, core::Symbol>) → void};
} =>#t17;
static method bar7(core::num? x, core::double? y, core::bool b) → dynamic
return block {
final core::Map<core::num, core::double> #t19 = <core::num, core::double>{};
if(b) {
final has-declared-initializer core::Map<core::num, core::double>? #t20 = null;
if(!(#t20 == null))
#t19.{core::Map::addAll}{Invariant}(#t20{core::Map<core::num, core::double>}){(core::Map<core::num, core::double>) → void};
}
} =>#t19;
static method bar8(core::num? x, core::double? y) → dynamic
return block {
final core::Map<core::num, core::double> #t21 = <core::num, core::double>{};
{
synthesized core::Iterator<dynamic> :sync-for-iterator = core::_GrowableList::•<dynamic>(0).{core::Iterable::iterator}{core::Iterator<dynamic>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
dynamic _ = :sync-for-iterator.{core::Iterator::current}{dynamic};
{
final has-declared-initializer core::Map<core::num, core::double>? #t22 = null;
if(!(#t22 == null))
#t21.{core::Map::addAll}{Invariant}(#t22{core::Map<core::num, core::double>}){(core::Map<core::num, core::double>) → void};
}
}
}
} =>#t21;