Version 2.18.0-137.0.dev
Merge commit '254b7882a1fba105eaea05f40a8b24d9244210e3' into 'dev'
diff --git a/DEPS b/DEPS
index 58b79b6..c058eae 100644
--- a/DEPS
+++ b/DEPS
@@ -153,7 +153,7 @@
"term_glyph_rev": "d0f205c67ea70eea47b9f41c8440129a72a9c86e",
"test_descriptor_rev": "ead23c1e7df079ac0f6457a35f7a71432892e527",
"test_process_rev": "3e695bcfeab551473ddc288970f345f30e5e1375",
- "test_reflective_loader_rev": "fcfce37666672edac849d2af6dffc0f8df236a94",
+ "test_reflective_loader_rev": "8d0de01bbe852fea1f8e33aba907abcba50a8a1e",
"test_rev": "d54846bc2b5cfa4e1445fda85c5e48a00940aa68",
"typed_data_rev": "8b19e29bcf4077147de4d67adeabeb48270c65eb",
"usage_rev": "e85d575d6decb921c57a43b9844bba3607479f56",
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index fc99416..35444e1 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -6333,6 +6333,15 @@
problemMessage: r"""Can't use string interpolation in a URI.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeInvalidAugmentSuper = messageInvalidAugmentSuper;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageInvalidAugmentSuper = const MessageCode(
+ "InvalidAugmentSuper",
+ problemMessage:
+ r"""'augment super' is only allowed in member augmentations.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeInvalidAwaitFor = messageInvalidAwaitFor;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
index 437ae8a..a10e793 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
@@ -1748,6 +1748,12 @@
}
@override
+ void handleAugmentSuperExpression(
+ Token augmentToken, Token superToken, IdentifierContext context) {
+ listener?.handleAugmentSuperExpression(augmentToken, superToken, context);
+ }
+
+ @override
void handleSymbolVoid(Token token) {
listener?.handleSymbolVoid(token);
}
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
index f72d10b..107f7da 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
@@ -1770,6 +1770,11 @@
logEvent("SuperExpression");
}
+ void handleAugmentSuperExpression(
+ Token augmentToken, Token superToken, IdentifierContext context) {
+ logEvent("AugmentSuperExpression");
+ }
+
void beginSwitchCase(int labelCount, int expressionCount, Token firstToken) {}
void endSwitchCase(
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/modifier_context.dart b/pkg/_fe_analyzer_shared/lib/src/parser/modifier_context.dart
index 99e4582..3946e24 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/modifier_context.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/modifier_context.dart
@@ -227,6 +227,7 @@
reportExtraneousModifier(externalToken);
reportExtraneousModifier(requiredToken);
reportExtraneousModifier(staticToken);
+ reportExtraneousModifier(augmentToken);
return token;
}
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
index 89a8755..0fd1cc0 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
@@ -5826,6 +5826,9 @@
return parseThisExpression(token, context);
} else if (identical(value, "super")) {
return parseSuperExpression(token, context);
+ } else if (identical(value, "augment") &&
+ optional('super', token.next!.next!)) {
+ return parseAugmentSuperExpression(token, context);
} else if (identical(value, "new")) {
return parseNewExpression(token);
} else if (identical(value, "const")) {
@@ -5965,6 +5968,21 @@
return token;
}
+ Token parseAugmentSuperExpression(Token token, IdentifierContext context) {
+ Token augmentToken = token = token.next!;
+ assert(optional('augment', token));
+ Token superToken = token = token.next!;
+ assert(optional('super', token));
+ listener.handleAugmentSuperExpression(augmentToken, superToken, context);
+ Token next = token.next!;
+ if (optional('(', next)) {
+ listener.handleNoTypeArguments(next);
+ token = parseArguments(token);
+ listener.handleSend(augmentToken, token.next!);
+ }
+ return token;
+ }
+
/// This method parses the portion of a list literal starting with the left
/// square bracket.
///
@@ -6948,7 +6966,9 @@
Token? varFinalOrConst;
if (isModifier(next)) {
- if (optional('var', next) ||
+ if (optional('augment', next) && optional('super', next.next!)) {
+ return parseExpressionStatement(start);
+ } else if (optional('var', next) ||
optional('final', next) ||
optional('const', next)) {
varFinalOrConst = token = token.next!;
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
index e3c0fe5..8c4ec6d 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
@@ -1087,6 +1087,361 @@
String toString() => jsonEncoder.convert(toJson());
}
+class IncomingMessage implements Message, ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ IncomingMessage.canParse,
+ IncomingMessage.fromJson,
+ );
+
+ IncomingMessage({
+ this.clientRequestTime,
+ required this.jsonrpc,
+ required this.method,
+ this.params,
+ });
+ static IncomingMessage fromJson(Map<String, Object?> json) {
+ if (RequestMessage.canParse(json, nullLspJsonReporter)) {
+ return RequestMessage.fromJson(json);
+ }
+ if (NotificationMessage.canParse(json, nullLspJsonReporter)) {
+ return NotificationMessage.fromJson(json);
+ }
+ final clientRequestTimeJson = json['clientRequestTime'];
+ final clientRequestTime = clientRequestTimeJson as int?;
+ final jsonrpcJson = json['jsonrpc'];
+ final jsonrpc = jsonrpcJson as String;
+ final methodJson = json['method'];
+ final method = Method.fromJson(methodJson as String);
+ final paramsJson = json['params'];
+ final params = paramsJson;
+ return IncomingMessage(
+ clientRequestTime: clientRequestTime,
+ jsonrpc: jsonrpc,
+ method: method,
+ params: params,
+ );
+ }
+
+ final int? clientRequestTime;
+ final String jsonrpc;
+ final Method method;
+ final Object? params;
+
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
+ if (clientRequestTime != null) {
+ __result['clientRequestTime'] = clientRequestTime;
+ }
+ __result['jsonrpc'] = jsonrpc;
+ __result['method'] = method.toJson();
+ if (params != null) {
+ __result['params'] = params;
+ }
+ return __result;
+ }
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ reporter.push('clientRequestTime');
+ try {
+ final clientRequestTime = obj['clientRequestTime'];
+ if (clientRequestTime != null && !(clientRequestTime is int)) {
+ reporter.reportError('must be of type int');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('jsonrpc');
+ try {
+ if (!obj.containsKey('jsonrpc')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final jsonrpc = obj['jsonrpc'];
+ if (jsonrpc == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!(jsonrpc is String)) {
+ reporter.reportError('must be of type String');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('method');
+ try {
+ if (!obj.containsKey('method')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final method = obj['method'];
+ if (method == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!(Method.canParse(method, reporter))) {
+ reporter.reportError('must be of type Method');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ return true;
+ } else {
+ reporter.reportError('must be of type IncomingMessage');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is IncomingMessage && other.runtimeType == IncomingMessage) {
+ return clientRequestTime == other.clientRequestTime &&
+ jsonrpc == other.jsonrpc &&
+ method == other.method &&
+ params == other.params &&
+ true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ clientRequestTime,
+ jsonrpc,
+ method,
+ params,
+ );
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
+class Message implements ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ Message.canParse,
+ Message.fromJson,
+ );
+
+ Message({
+ this.clientRequestTime,
+ required this.jsonrpc,
+ });
+ static Message fromJson(Map<String, Object?> json) {
+ if (IncomingMessage.canParse(json, nullLspJsonReporter)) {
+ return IncomingMessage.fromJson(json);
+ }
+ if (ResponseMessage.canParse(json, nullLspJsonReporter)) {
+ return ResponseMessage.fromJson(json);
+ }
+ final clientRequestTimeJson = json['clientRequestTime'];
+ final clientRequestTime = clientRequestTimeJson as int?;
+ final jsonrpcJson = json['jsonrpc'];
+ final jsonrpc = jsonrpcJson as String;
+ return Message(
+ clientRequestTime: clientRequestTime,
+ jsonrpc: jsonrpc,
+ );
+ }
+
+ final int? clientRequestTime;
+ final String jsonrpc;
+
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
+ if (clientRequestTime != null) {
+ __result['clientRequestTime'] = clientRequestTime;
+ }
+ __result['jsonrpc'] = jsonrpc;
+ return __result;
+ }
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ reporter.push('clientRequestTime');
+ try {
+ final clientRequestTime = obj['clientRequestTime'];
+ if (clientRequestTime != null && !(clientRequestTime is int)) {
+ reporter.reportError('must be of type int');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('jsonrpc');
+ try {
+ if (!obj.containsKey('jsonrpc')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final jsonrpc = obj['jsonrpc'];
+ if (jsonrpc == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!(jsonrpc is String)) {
+ reporter.reportError('must be of type String');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ return true;
+ } else {
+ reporter.reportError('must be of type Message');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is Message && other.runtimeType == Message) {
+ return clientRequestTime == other.clientRequestTime &&
+ jsonrpc == other.jsonrpc &&
+ true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ clientRequestTime,
+ jsonrpc,
+ );
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
+class NotificationMessage implements IncomingMessage, ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ NotificationMessage.canParse,
+ NotificationMessage.fromJson,
+ );
+
+ NotificationMessage({
+ this.clientRequestTime,
+ required this.jsonrpc,
+ required this.method,
+ this.params,
+ });
+ static NotificationMessage fromJson(Map<String, Object?> json) {
+ final clientRequestTimeJson = json['clientRequestTime'];
+ final clientRequestTime = clientRequestTimeJson as int?;
+ final jsonrpcJson = json['jsonrpc'];
+ final jsonrpc = jsonrpcJson as String;
+ final methodJson = json['method'];
+ final method = Method.fromJson(methodJson as String);
+ final paramsJson = json['params'];
+ final params = paramsJson;
+ return NotificationMessage(
+ clientRequestTime: clientRequestTime,
+ jsonrpc: jsonrpc,
+ method: method,
+ params: params,
+ );
+ }
+
+ final int? clientRequestTime;
+ final String jsonrpc;
+ final Method method;
+ final Object? params;
+
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
+ if (clientRequestTime != null) {
+ __result['clientRequestTime'] = clientRequestTime;
+ }
+ __result['jsonrpc'] = jsonrpc;
+ __result['method'] = method.toJson();
+ if (params != null) {
+ __result['params'] = params;
+ }
+ return __result;
+ }
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ reporter.push('clientRequestTime');
+ try {
+ final clientRequestTime = obj['clientRequestTime'];
+ if (clientRequestTime != null && !(clientRequestTime is int)) {
+ reporter.reportError('must be of type int');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('jsonrpc');
+ try {
+ if (!obj.containsKey('jsonrpc')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final jsonrpc = obj['jsonrpc'];
+ if (jsonrpc == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!(jsonrpc is String)) {
+ reporter.reportError('must be of type String');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('method');
+ try {
+ if (!obj.containsKey('method')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final method = obj['method'];
+ if (method == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!(Method.canParse(method, reporter))) {
+ reporter.reportError('must be of type Method');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ return true;
+ } else {
+ reporter.reportError('must be of type NotificationMessage');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is NotificationMessage &&
+ other.runtimeType == NotificationMessage) {
+ return clientRequestTime == other.clientRequestTime &&
+ jsonrpc == other.jsonrpc &&
+ method == other.method &&
+ params == other.params &&
+ true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ clientRequestTime,
+ jsonrpc,
+ method,
+ params,
+ );
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
class Outline implements ToJsonable {
static const jsonHandler = LspJsonHandler(
Outline.canParse,
@@ -1598,6 +1953,432 @@
String toString() => jsonEncoder.convert(toJson());
}
+class RequestMessage implements IncomingMessage, ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ RequestMessage.canParse,
+ RequestMessage.fromJson,
+ );
+
+ RequestMessage({
+ this.clientRequestTime,
+ required this.id,
+ required this.jsonrpc,
+ required this.method,
+ this.params,
+ });
+ static RequestMessage fromJson(Map<String, Object?> json) {
+ final clientRequestTimeJson = json['clientRequestTime'];
+ final clientRequestTime = clientRequestTimeJson as int?;
+ final idJson = json['id'];
+ final id = idJson is int
+ ? Either2<int, String>.t1(idJson)
+ : (idJson is String
+ ? Either2<int, String>.t2(idJson)
+ : (throw '''$idJson was not one of (int, String)'''));
+ final jsonrpcJson = json['jsonrpc'];
+ final jsonrpc = jsonrpcJson as String;
+ final methodJson = json['method'];
+ final method = Method.fromJson(methodJson as String);
+ final paramsJson = json['params'];
+ final params = paramsJson;
+ return RequestMessage(
+ clientRequestTime: clientRequestTime,
+ id: id,
+ jsonrpc: jsonrpc,
+ method: method,
+ params: params,
+ );
+ }
+
+ final int? clientRequestTime;
+ final Either2<int, String> id;
+ final String jsonrpc;
+ final Method method;
+ final Object? params;
+
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
+ if (clientRequestTime != null) {
+ __result['clientRequestTime'] = clientRequestTime;
+ }
+ __result['id'] = id;
+ __result['jsonrpc'] = jsonrpc;
+ __result['method'] = method.toJson();
+ if (params != null) {
+ __result['params'] = params;
+ }
+ return __result;
+ }
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ reporter.push('clientRequestTime');
+ try {
+ final clientRequestTime = obj['clientRequestTime'];
+ if (clientRequestTime != null && !(clientRequestTime is int)) {
+ reporter.reportError('must be of type int');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('id');
+ try {
+ if (!obj.containsKey('id')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final id = obj['id'];
+ if (id == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!((id is int || id is String))) {
+ reporter.reportError('must be of type Either2<int, String>');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('jsonrpc');
+ try {
+ if (!obj.containsKey('jsonrpc')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final jsonrpc = obj['jsonrpc'];
+ if (jsonrpc == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!(jsonrpc is String)) {
+ reporter.reportError('must be of type String');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('method');
+ try {
+ if (!obj.containsKey('method')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final method = obj['method'];
+ if (method == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!(Method.canParse(method, reporter))) {
+ reporter.reportError('must be of type Method');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ return true;
+ } else {
+ reporter.reportError('must be of type RequestMessage');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is RequestMessage && other.runtimeType == RequestMessage) {
+ return clientRequestTime == other.clientRequestTime &&
+ id == other.id &&
+ jsonrpc == other.jsonrpc &&
+ method == other.method &&
+ params == other.params &&
+ true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ clientRequestTime,
+ id,
+ jsonrpc,
+ method,
+ params,
+ );
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
+class ResponseError implements ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ ResponseError.canParse,
+ ResponseError.fromJson,
+ );
+
+ ResponseError({
+ required this.code,
+ this.data,
+ required this.message,
+ });
+ static ResponseError fromJson(Map<String, Object?> json) {
+ final codeJson = json['code'];
+ final code = ErrorCodes.fromJson(codeJson as int);
+ final dataJson = json['data'];
+ final data = dataJson as String?;
+ final messageJson = json['message'];
+ final message = messageJson as String;
+ return ResponseError(
+ code: code,
+ data: data,
+ message: message,
+ );
+ }
+
+ final ErrorCodes code;
+
+ /// A string that contains additional information about the error. Can be
+ /// omitted.
+ final String? data;
+ final String message;
+
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
+ __result['code'] = code.toJson();
+ if (data != null) {
+ __result['data'] = data;
+ }
+ __result['message'] = message;
+ return __result;
+ }
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ reporter.push('code');
+ try {
+ if (!obj.containsKey('code')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final code = obj['code'];
+ if (code == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!(ErrorCodes.canParse(code, reporter))) {
+ reporter.reportError('must be of type ErrorCodes');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('data');
+ try {
+ final data = obj['data'];
+ if (data != null && !(data is String)) {
+ reporter.reportError('must be of type String');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('message');
+ try {
+ if (!obj.containsKey('message')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final message = obj['message'];
+ if (message == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!(message is String)) {
+ reporter.reportError('must be of type String');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ return true;
+ } else {
+ reporter.reportError('must be of type ResponseError');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is ResponseError && other.runtimeType == ResponseError) {
+ return code == other.code &&
+ data == other.data &&
+ message == other.message &&
+ true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ code,
+ data,
+ message,
+ );
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
+class ResponseMessage implements Message, ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ ResponseMessage.canParse,
+ ResponseMessage.fromJson,
+ );
+
+ ResponseMessage({
+ this.clientRequestTime,
+ this.error,
+ this.id,
+ required this.jsonrpc,
+ this.result,
+ });
+ static ResponseMessage fromJson(Map<String, Object?> json) {
+ final clientRequestTimeJson = json['clientRequestTime'];
+ final clientRequestTime = clientRequestTimeJson as int?;
+ final errorJson = json['error'];
+ final error = errorJson != null
+ ? ResponseError.fromJson(errorJson as Map<String, Object?>)
+ : null;
+ final idJson = json['id'];
+ final id = idJson == null
+ ? null
+ : (idJson is int
+ ? Either2<int, String>.t1(idJson)
+ : (idJson is String
+ ? Either2<int, String>.t2(idJson)
+ : (throw '''$idJson was not one of (int, String)''')));
+ final jsonrpcJson = json['jsonrpc'];
+ final jsonrpc = jsonrpcJson as String;
+ final resultJson = json['result'];
+ final result = resultJson;
+ return ResponseMessage(
+ clientRequestTime: clientRequestTime,
+ error: error,
+ id: id,
+ jsonrpc: jsonrpc,
+ result: result,
+ );
+ }
+
+ final int? clientRequestTime;
+ final ResponseError? error;
+ final Either2<int, String>? id;
+ final String jsonrpc;
+ final Object? result;
+
+ Map<String, Object?> toJson() {
+ var __result = <String, Object?>{};
+ if (clientRequestTime != null) {
+ __result['clientRequestTime'] = clientRequestTime;
+ }
+ __result['id'] = id;
+ __result['jsonrpc'] = jsonrpc;
+ if (error != null && result != null) {
+ throw 'result and error cannot both be set';
+ } else if (error != null) {
+ __result['error'] = error;
+ } else {
+ __result['result'] = result;
+ }
+ return __result;
+ }
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ reporter.push('clientRequestTime');
+ try {
+ final clientRequestTime = obj['clientRequestTime'];
+ if (clientRequestTime != null && !(clientRequestTime is int)) {
+ reporter.reportError('must be of type int');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('error');
+ try {
+ final error = obj['error'];
+ if (error != null && !(ResponseError.canParse(error, reporter))) {
+ reporter.reportError('must be of type ResponseError');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('id');
+ try {
+ if (!obj.containsKey('id')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final id = obj['id'];
+ if (id != null && !((id is int || id is String))) {
+ reporter.reportError('must be of type Either2<int, String>');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('jsonrpc');
+ try {
+ if (!obj.containsKey('jsonrpc')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final jsonrpc = obj['jsonrpc'];
+ if (jsonrpc == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!(jsonrpc is String)) {
+ reporter.reportError('must be of type String');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ return true;
+ } else {
+ reporter.reportError('must be of type ResponseMessage');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is ResponseMessage && other.runtimeType == ResponseMessage) {
+ return clientRequestTime == other.clientRequestTime &&
+ error == other.error &&
+ id == other.id &&
+ jsonrpc == other.jsonrpc &&
+ result == other.result &&
+ true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ clientRequestTime,
+ error,
+ id,
+ jsonrpc,
+ result,
+ );
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
class SnippetTextEdit implements TextEdit, ToJsonable {
static const jsonHandler = LspJsonHandler(
SnippetTextEdit.canParse,
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
index 4f05563..84ccaac 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
@@ -23783,105 +23783,6 @@
bool operator ==(Object o) => o is MarkupKind && o._value == _value;
}
-class Message implements ToJsonable {
- static const jsonHandler = LspJsonHandler(
- Message.canParse,
- Message.fromJson,
- );
-
- Message({
- this.clientRequestTime,
- required this.jsonrpc,
- });
- static Message fromJson(Map<String, Object?> json) {
- if (RequestMessage.canParse(json, nullLspJsonReporter)) {
- return RequestMessage.fromJson(json);
- }
- if (NotificationMessage.canParse(json, nullLspJsonReporter)) {
- return NotificationMessage.fromJson(json);
- }
- if (ResponseMessage.canParse(json, nullLspJsonReporter)) {
- return ResponseMessage.fromJson(json);
- }
- final clientRequestTimeJson = json['clientRequestTime'];
- final clientRequestTime = clientRequestTimeJson as int?;
- final jsonrpcJson = json['jsonrpc'];
- final jsonrpc = jsonrpcJson as String;
- return Message(
- clientRequestTime: clientRequestTime,
- jsonrpc: jsonrpc,
- );
- }
-
- final int? clientRequestTime;
- final String jsonrpc;
-
- Map<String, Object?> toJson() {
- var __result = <String, Object?>{};
- if (clientRequestTime != null) {
- __result['clientRequestTime'] = clientRequestTime;
- }
- __result['jsonrpc'] = jsonrpc;
- return __result;
- }
-
- static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, Object?>) {
- reporter.push('clientRequestTime');
- try {
- final clientRequestTime = obj['clientRequestTime'];
- if (clientRequestTime != null && !(clientRequestTime is int)) {
- reporter.reportError('must be of type int');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('jsonrpc');
- try {
- if (!obj.containsKey('jsonrpc')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final jsonrpc = obj['jsonrpc'];
- if (jsonrpc == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(jsonrpc is String)) {
- reporter.reportError('must be of type String');
- return false;
- }
- } finally {
- reporter.pop();
- }
- return true;
- } else {
- reporter.reportError('must be of type Message');
- return false;
- }
- }
-
- @override
- bool operator ==(Object other) {
- if (other is Message && other.runtimeType == Message) {
- return clientRequestTime == other.clientRequestTime &&
- jsonrpc == other.jsonrpc &&
- true;
- }
- return false;
- }
-
- @override
- int get hashCode => Object.hash(
- clientRequestTime,
- jsonrpc,
- );
-
- @override
- String toString() => jsonEncoder.convert(toJson());
-}
-
class MessageActionItem implements ToJsonable {
static const jsonHandler = LspJsonHandler(
MessageActionItem.canParse,
@@ -27218,137 +27119,6 @@
String toString() => jsonEncoder.convert(toJson());
}
-class NotificationMessage implements Message, IncomingMessage, ToJsonable {
- static const jsonHandler = LspJsonHandler(
- NotificationMessage.canParse,
- NotificationMessage.fromJson,
- );
-
- NotificationMessage({
- this.clientRequestTime,
- required this.jsonrpc,
- required this.method,
- this.params,
- });
- static NotificationMessage fromJson(Map<String, Object?> json) {
- final clientRequestTimeJson = json['clientRequestTime'];
- final clientRequestTime = clientRequestTimeJson as int?;
- final jsonrpcJson = json['jsonrpc'];
- final jsonrpc = jsonrpcJson as String;
- final methodJson = json['method'];
- final method = Method.fromJson(methodJson as String);
- final paramsJson = json['params'];
- final params = paramsJson;
- return NotificationMessage(
- clientRequestTime: clientRequestTime,
- jsonrpc: jsonrpc,
- method: method,
- params: params,
- );
- }
-
- final int? clientRequestTime;
- final String jsonrpc;
-
- /// The method to be invoked.
- final Method method;
-
- /// The notification's params.
- final Object? params;
-
- Map<String, Object?> toJson() {
- var __result = <String, Object?>{};
- if (clientRequestTime != null) {
- __result['clientRequestTime'] = clientRequestTime;
- }
- __result['jsonrpc'] = jsonrpc;
- __result['method'] = method.toJson();
- if (params != null) {
- __result['params'] = params;
- }
- return __result;
- }
-
- static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, Object?>) {
- reporter.push('clientRequestTime');
- try {
- final clientRequestTime = obj['clientRequestTime'];
- if (clientRequestTime != null && !(clientRequestTime is int)) {
- reporter.reportError('must be of type int');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('jsonrpc');
- try {
- if (!obj.containsKey('jsonrpc')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final jsonrpc = obj['jsonrpc'];
- if (jsonrpc == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(jsonrpc is String)) {
- reporter.reportError('must be of type String');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('method');
- try {
- if (!obj.containsKey('method')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final method = obj['method'];
- if (method == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(Method.canParse(method, reporter))) {
- reporter.reportError('must be of type Method');
- return false;
- }
- } finally {
- reporter.pop();
- }
- return true;
- } else {
- reporter.reportError('must be of type NotificationMessage');
- return false;
- }
- }
-
- @override
- bool operator ==(Object other) {
- if (other is NotificationMessage &&
- other.runtimeType == NotificationMessage) {
- return clientRequestTime == other.clientRequestTime &&
- jsonrpc == other.jsonrpc &&
- method == other.method &&
- params == other.params &&
- true;
- }
- return false;
- }
-
- @override
- int get hashCode => Object.hash(
- clientRequestTime,
- jsonrpc,
- method,
- params,
- );
-
- @override
- String toString() => jsonEncoder.convert(toJson());
-}
-
class OptionalVersionedTextDocumentIdentifier
implements TextDocumentIdentifier, ToJsonable {
static const jsonHandler = LspJsonHandler(
@@ -30843,168 +30613,6 @@
String toString() => jsonEncoder.convert(toJson());
}
-class RequestMessage implements Message, IncomingMessage, ToJsonable {
- static const jsonHandler = LspJsonHandler(
- RequestMessage.canParse,
- RequestMessage.fromJson,
- );
-
- RequestMessage({
- this.clientRequestTime,
- required this.id,
- required this.jsonrpc,
- required this.method,
- this.params,
- });
- static RequestMessage fromJson(Map<String, Object?> json) {
- final clientRequestTimeJson = json['clientRequestTime'];
- final clientRequestTime = clientRequestTimeJson as int?;
- final idJson = json['id'];
- final id = idJson is int
- ? Either2<int, String>.t1(idJson)
- : (idJson is String
- ? Either2<int, String>.t2(idJson)
- : (throw '''$idJson was not one of (int, String)'''));
- final jsonrpcJson = json['jsonrpc'];
- final jsonrpc = jsonrpcJson as String;
- final methodJson = json['method'];
- final method = Method.fromJson(methodJson as String);
- final paramsJson = json['params'];
- final params = paramsJson;
- return RequestMessage(
- clientRequestTime: clientRequestTime,
- id: id,
- jsonrpc: jsonrpc,
- method: method,
- params: params,
- );
- }
-
- final int? clientRequestTime;
-
- /// The request id.
- final Either2<int, String> id;
- final String jsonrpc;
-
- /// The method to be invoked.
- final Method method;
-
- /// The method's params.
- final Object? params;
-
- Map<String, Object?> toJson() {
- var __result = <String, Object?>{};
- if (clientRequestTime != null) {
- __result['clientRequestTime'] = clientRequestTime;
- }
- __result['id'] = id;
- __result['jsonrpc'] = jsonrpc;
- __result['method'] = method.toJson();
- if (params != null) {
- __result['params'] = params;
- }
- return __result;
- }
-
- static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, Object?>) {
- reporter.push('clientRequestTime');
- try {
- final clientRequestTime = obj['clientRequestTime'];
- if (clientRequestTime != null && !(clientRequestTime is int)) {
- reporter.reportError('must be of type int');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('id');
- try {
- if (!obj.containsKey('id')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final id = obj['id'];
- if (id == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!((id is int || id is String))) {
- reporter.reportError('must be of type Either2<int, String>');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('jsonrpc');
- try {
- if (!obj.containsKey('jsonrpc')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final jsonrpc = obj['jsonrpc'];
- if (jsonrpc == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(jsonrpc is String)) {
- reporter.reportError('must be of type String');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('method');
- try {
- if (!obj.containsKey('method')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final method = obj['method'];
- if (method == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(Method.canParse(method, reporter))) {
- reporter.reportError('must be of type Method');
- return false;
- }
- } finally {
- reporter.pop();
- }
- return true;
- } else {
- reporter.reportError('must be of type RequestMessage');
- return false;
- }
- }
-
- @override
- bool operator ==(Object other) {
- if (other is RequestMessage && other.runtimeType == RequestMessage) {
- return clientRequestTime == other.clientRequestTime &&
- id == other.id &&
- jsonrpc == other.jsonrpc &&
- method == other.method &&
- params == other.params &&
- true;
- }
- return false;
- }
-
- @override
- int get hashCode => Object.hash(
- clientRequestTime,
- id,
- jsonrpc,
- method,
- params,
- );
-
- @override
- String toString() => jsonEncoder.convert(toJson());
-}
-
class ResourceOperationKind implements ToJsonable {
const ResourceOperationKind._(this._value);
const ResourceOperationKind.fromJson(this._value);
@@ -31042,286 +30650,6 @@
o is ResourceOperationKind && o._value == _value;
}
-class ResponseError implements ToJsonable {
- static const jsonHandler = LspJsonHandler(
- ResponseError.canParse,
- ResponseError.fromJson,
- );
-
- ResponseError({
- required this.code,
- this.data,
- required this.message,
- });
- static ResponseError fromJson(Map<String, Object?> json) {
- final codeJson = json['code'];
- final code = ErrorCodes.fromJson(codeJson as int);
- final dataJson = json['data'];
- final data = dataJson as String?;
- final messageJson = json['message'];
- final message = messageJson as String;
- return ResponseError(
- code: code,
- data: data,
- message: message,
- );
- }
-
- /// A number indicating the error type that occurred.
- final ErrorCodes code;
-
- /// A string that contains additional information about the error. Can be
- /// omitted.
- final String? data;
-
- /// A string providing a short description of the error.
- final String message;
-
- Map<String, Object?> toJson() {
- var __result = <String, Object?>{};
- __result['code'] = code.toJson();
- if (data != null) {
- __result['data'] = data;
- }
- __result['message'] = message;
- return __result;
- }
-
- static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, Object?>) {
- reporter.push('code');
- try {
- if (!obj.containsKey('code')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final code = obj['code'];
- if (code == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(ErrorCodes.canParse(code, reporter))) {
- reporter.reportError('must be of type ErrorCodes');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('data');
- try {
- final data = obj['data'];
- if (data != null && !(data is String)) {
- reporter.reportError('must be of type String');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('message');
- try {
- if (!obj.containsKey('message')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final message = obj['message'];
- if (message == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(message is String)) {
- reporter.reportError('must be of type String');
- return false;
- }
- } finally {
- reporter.pop();
- }
- return true;
- } else {
- reporter.reportError('must be of type ResponseError');
- return false;
- }
- }
-
- @override
- bool operator ==(Object other) {
- if (other is ResponseError && other.runtimeType == ResponseError) {
- return code == other.code &&
- data == other.data &&
- message == other.message &&
- true;
- }
- return false;
- }
-
- @override
- int get hashCode => Object.hash(
- code,
- data,
- message,
- );
-
- @override
- String toString() => jsonEncoder.convert(toJson());
-}
-
-class ResponseMessage implements Message, ToJsonable {
- static const jsonHandler = LspJsonHandler(
- ResponseMessage.canParse,
- ResponseMessage.fromJson,
- );
-
- ResponseMessage({
- this.clientRequestTime,
- this.error,
- this.id,
- required this.jsonrpc,
- this.result,
- });
- static ResponseMessage fromJson(Map<String, Object?> json) {
- final clientRequestTimeJson = json['clientRequestTime'];
- final clientRequestTime = clientRequestTimeJson as int?;
- final errorJson = json['error'];
- final error = errorJson != null
- ? ResponseError.fromJson(errorJson as Map<String, Object?>)
- : null;
- final idJson = json['id'];
- final id = idJson == null
- ? null
- : (idJson is int
- ? Either2<int, String>.t1(idJson)
- : (idJson is String
- ? Either2<int, String>.t2(idJson)
- : (throw '''$idJson was not one of (int, String)''')));
- final jsonrpcJson = json['jsonrpc'];
- final jsonrpc = jsonrpcJson as String;
- final resultJson = json['result'];
- final result = resultJson;
- return ResponseMessage(
- clientRequestTime: clientRequestTime,
- error: error,
- id: id,
- jsonrpc: jsonrpc,
- result: result,
- );
- }
-
- final int? clientRequestTime;
-
- /// The error object in case a request fails.
- final ResponseError? error;
-
- /// The request id.
- final Either2<int, String>? id;
- final String jsonrpc;
-
- /// The result of a request. This member is REQUIRED on success. This member
- /// MUST NOT exist if there was an error invoking the method.
- final Object? result;
-
- Map<String, Object?> toJson() {
- var __result = <String, Object?>{};
- if (clientRequestTime != null) {
- __result['clientRequestTime'] = clientRequestTime;
- }
- __result['id'] = id;
- __result['jsonrpc'] = jsonrpc;
- if (error != null && result != null) {
- throw 'result and error cannot both be set';
- } else if (error != null) {
- __result['error'] = error;
- } else {
- __result['result'] = result;
- }
- return __result;
- }
-
- static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, Object?>) {
- reporter.push('clientRequestTime');
- try {
- final clientRequestTime = obj['clientRequestTime'];
- if (clientRequestTime != null && !(clientRequestTime is int)) {
- reporter.reportError('must be of type int');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('error');
- try {
- final error = obj['error'];
- if (error != null && !(ResponseError.canParse(error, reporter))) {
- reporter.reportError('must be of type ResponseError');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('id');
- try {
- if (!obj.containsKey('id')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final id = obj['id'];
- if (id != null && !((id is int || id is String))) {
- reporter.reportError('must be of type Either2<int, String>');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('jsonrpc');
- try {
- if (!obj.containsKey('jsonrpc')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final jsonrpc = obj['jsonrpc'];
- if (jsonrpc == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(jsonrpc is String)) {
- reporter.reportError('must be of type String');
- return false;
- }
- } finally {
- reporter.pop();
- }
- return true;
- } else {
- reporter.reportError('must be of type ResponseMessage');
- return false;
- }
- }
-
- @override
- bool operator ==(Object other) {
- if (other is ResponseMessage && other.runtimeType == ResponseMessage) {
- return clientRequestTime == other.clientRequestTime &&
- error == other.error &&
- id == other.id &&
- jsonrpc == other.jsonrpc &&
- result == other.result &&
- true;
- }
- return false;
- }
-
- @override
- int get hashCode => Object.hash(
- clientRequestTime,
- error,
- id,
- jsonrpc,
- result,
- );
-
- @override
- String toString() => jsonEncoder.convert(toJson());
-}
-
class SaveOptions implements ToJsonable {
static const jsonHandler = LspJsonHandler(
SaveOptions.canParse,
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
index 5b4d3b1..57cce17 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
@@ -8,6 +8,8 @@
import 'package:analysis_server/src/lsp/json_parsing.dart';
import 'package:analysis_server/src/protocol/protocol_internal.dart';
+import 'protocol_custom_generated.dart';
+
const jsonRpcVersion = '2.0';
const NullJsonHandler = LspJsonHandler<Null>(_alwaysTrue, _alwaysNull);
@@ -264,14 +266,6 @@
}
}
-/// A base class containing the fields common to RequestMessage and
-/// NotificationMessage to simplify handling.
-abstract class IncomingMessage {
- int? get clientRequestTime;
- Method get method;
- dynamic get params;
-}
-
/// A helper to allow handlers to declare both a JSON validation function and
/// parse function.
class LspJsonHandler<T> {
diff --git a/pkg/analysis_server/lib/src/analytics/percentile_calculator.dart b/pkg/analysis_server/lib/src/analytics/percentile_calculator.dart
index b1a313c..d818ab5 100644
--- a/pkg/analysis_server/lib/src/analytics/percentile_calculator.dart
+++ b/pkg/analysis_server/lib/src/analytics/percentile_calculator.dart
@@ -35,16 +35,17 @@
return 0;
}
var targetIndex = _valueCount * percentile / 100;
- var values = _counts.keys.toList()..sort();
+ var entries = _counts.entries.toList()
+ ..sort((first, second) => first.key.compareTo(second.key));
// The number of values represented by walking the counts.
var accumulation = 0;
- for (var i = 0; i < values.length; i++) {
- var value = values[i];
- accumulation += _counts[value]!;
+ for (var i = 0; i < entries.length; i++) {
+ var entry = entries[i];
+ accumulation += entry.value;
if (accumulation >= targetIndex) {
// We've now accounted for [targetIndex] values, which includes the
// median value.
- return value;
+ return entry.key;
}
}
throw StateError('');
@@ -53,6 +54,7 @@
/// Return a string that is suitable for sending to the analytics service.
String toAnalyticsString() {
var buffer = StringBuffer();
+ buffer.write(_valueCount);
buffer.write('[');
for (var p = 5; p <= 100; p += 5) {
if (p > 5) {
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index bbcd39b..dbc2832 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -350,21 +350,19 @@
if (message is ResponseMessage) {
handleClientResponse(message);
} else if (message is IncomingMessage) {
- final incomingMessage = message as IncomingMessage;
-
// Record performance information for the request.
final performance = OperationPerformanceImpl('<root>');
await performance.runAsync('request', (performance) async {
final requestPerformance = RequestPerformance(
- operation: incomingMessage.method.toString(),
+ operation: message.method.toString(),
performance: performance,
- requestLatency: incomingMessage.timeSinceRequest,
+ requestLatency: message.timeSinceRequest,
);
recentPerformance.requests.add(requestPerformance);
final messageInfo = MessageInfo(
performance: performance,
- timeSinceRequest: incomingMessage.timeSinceRequest,
+ timeSinceRequest: message.timeSinceRequest,
);
if (message is RequestMessage) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
index 439f0f4..769ed53 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
@@ -6,6 +6,7 @@
import 'package:analysis_server/src/services/correction/fix.dart';
import 'package:analysis_server/src/services/correction/util.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
@@ -14,7 +15,7 @@
class CreateConstructor extends CorrectionProducer {
/// The name of the constructor being created.
/// TODO(migration) We set this node when we have the change.
- late ConstructorName _constructorName;
+ late String _constructorName;
@override
List<Object> get fixArguments => [_constructorName];
@@ -24,6 +25,7 @@
@override
Future<void> compute(ChangeBuilder builder) async {
+ var node = this.node;
final argumentList = node.parent is ArgumentList ? node.parent : node;
if (argumentList is ArgumentList) {
var instanceCreation = argumentList.parent;
@@ -31,28 +33,32 @@
await _proposeFromInstanceCreation(builder, instanceCreation);
}
} else {
- await _proposeFromConstructorName(builder);
+ if (node is SimpleIdentifier) {
+ var parent = node.parent;
+ if (parent is ConstructorName) {
+ await _proposeFromConstructorName(builder, node, parent);
+ return;
+ }
+ }
+ var parent = node.thisOrAncestorOfType<EnumConstantDeclaration>();
+ if (parent != null) {
+ await _proposeFromEnumConstantDeclaration(builder, parent.name, parent);
+ }
}
}
- Future<void> _proposeFromConstructorName(ChangeBuilder builder) async {
- var name = node;
- if (name is! SimpleIdentifier) {
- return;
- }
-
+ Future<void> _proposeFromConstructorName(ChangeBuilder builder,
+ SimpleIdentifier name, ConstructorName constructorName) async {
InstanceCreationExpression? instanceCreation;
- if (name.parent is ConstructorName) {
- _constructorName = name.parent as ConstructorName;
- if (_constructorName.name == name) {
- // Type.name
- if (_constructorName.parent is InstanceCreationExpression) {
- instanceCreation =
- _constructorName.parent as InstanceCreationExpression;
- // new Type.name()
- if (instanceCreation.constructorName != _constructorName) {
- return;
- }
+ _constructorName = constructorName.toSource();
+ if (constructorName.name == name) {
+ var grandParent = constructorName.parent;
+ // Type.name
+ if (grandParent is InstanceCreationExpression) {
+ instanceCreation = grandParent;
+ // new Type.name()
+ if (grandParent.constructorName != constructorName) {
+ return;
}
}
}
@@ -63,7 +69,7 @@
}
// prepare target interface type
- var targetType = _constructorName.type.type;
+ var targetType = constructorName.type.type;
if (targetType is! InterfaceType) {
return;
}
@@ -91,28 +97,65 @@
return;
}
- var targetFile = targetElement.source.fullName;
- final instanceCreation_final = instanceCreation;
- await builder.addDartFileEdit(targetFile, (builder) {
- builder.addInsertion(targetLocation.offset, (builder) {
- builder.write(targetLocation.prefix);
- builder.writeConstructorDeclaration(targetElement.name,
- argumentList: instanceCreation_final.argumentList,
- constructorName: name,
- constructorNameGroupName: 'NAME');
- builder.write(targetLocation.suffix);
- });
- if (targetFile == file) {
- builder.addLinkedPosition(range.node(name), 'NAME');
- }
- });
+ await _write(builder, name, targetElement, targetLocation,
+ constructorName: name, argumentList: instanceCreation.argumentList);
+ }
+
+ Future<void> _proposeFromEnumConstantDeclaration(ChangeBuilder builder,
+ SimpleIdentifier name, EnumConstantDeclaration parent) async {
+ var grandParent = parent.parent;
+ if (grandParent is! EnumDeclaration) {
+ return;
+ }
+ var targetElement = grandParent.declaredElement;
+ if (targetElement == null) {
+ return;
+ }
+
+ // prepare target interface type
+ var targetResult = await sessionHelper.getElementDeclaration(targetElement);
+ if (targetResult == null) {
+ return;
+ }
+
+ var targetNode = targetResult.node;
+ if (targetNode is! EnumDeclaration) {
+ return;
+ }
+
+ var targetUnit = targetResult.resolvedUnit;
+ if (targetUnit == null) {
+ return;
+ }
+
+ // prepare location
+ var targetLocation = CorrectionUtils(targetUnit)
+ .prepareEnumNewConstructorLocation(targetNode);
+ if (targetLocation == null) {
+ return;
+ }
+
+ var arguments = parent.arguments;
+ _constructorName =
+ '${targetNode.name}${arguments?.constructorSelector ?? ''}';
+
+ await _write(
+ builder,
+ name,
+ targetElement,
+ targetLocation,
+ isConst: true,
+ constructorName: arguments?.constructorSelector?.name,
+ argumentList: arguments?.argumentList,
+ );
}
Future<void> _proposeFromInstanceCreation(ChangeBuilder builder,
InstanceCreationExpression instanceCreation) async {
- _constructorName = instanceCreation.constructorName;
+ var constructorName = instanceCreation.constructorName;
+ _constructorName = constructorName.toSource();
// should be synthetic default constructor
- var constructorElement = _constructorName.staticElement;
+ var constructorElement = constructorName.staticElement;
if (constructorElement == null ||
!constructorElement.isDefaultConstructor ||
!constructorElement.isSynthetic) {
@@ -153,4 +196,30 @@
});
});
}
+
+ Future<void> _write(
+ ChangeBuilder builder,
+ SimpleIdentifier name,
+ ClassElement targetElement,
+ InsertionLocation targetLocation, {
+ SimpleIdentifier? constructorName,
+ bool isConst = false,
+ ArgumentList? argumentList,
+ }) async {
+ var targetFile = targetElement.source.fullName;
+ await builder.addDartFileEdit(targetFile, (builder) {
+ builder.addInsertion(targetLocation.offset, (builder) {
+ builder.write(targetLocation.prefix);
+ builder.writeConstructorDeclaration(targetElement.name,
+ isConst: isConst,
+ argumentList: argumentList,
+ constructorName: constructorName,
+ constructorNameGroupName: 'NAME');
+ builder.write(targetLocation.suffix);
+ });
+ if (targetFile == file) {
+ builder.addLinkedPosition(range.node(name), 'NAME');
+ }
+ });
+ }
}
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
index 2faa043..5ceef0d 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -327,7 +327,7 @@
status: needsEvaluation
CompileTimeErrorCode.ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING:
status: needsEvaluation
-CompileTimeErrorCode.ENUM_CONSTANT_WITH_NON_CONST_CONSTRUCTOR:
+CompileTimeErrorCode.ENUM_CONSTANT_WITH_NON_CONST_CONSTRUCTOR:
status: noFix
since: 2.17
CompileTimeErrorCode.ENUM_INSTANTIATED_TO_BOUNDS_IS_NOT_WELL_BOUNDED:
@@ -956,15 +956,12 @@
status: hasFix
CompileTimeErrorCode.UNDEFINED_ENUM_CONSTANT:
status: hasFix
- issue: https://github.com/dart-lang/sdk/issues/47643
CompileTimeErrorCode.UNDEFINED_ENUM_CONSTRUCTOR_NAMED:
- status: needsFix
+ status: hasFix
since: 2.17
- issue: https://github.com/dart-lang/sdk/issues/48481
CompileTimeErrorCode.UNDEFINED_ENUM_CONSTRUCTOR_UNNAMED:
- status: needsFix
+ status: hasFix
since: 2.17
- issue: https://github.com/dart-lang/sdk/issues/48481
CompileTimeErrorCode.UNDEFINED_EXTENSION_GETTER:
status: hasFix
CompileTimeErrorCode.UNDEFINED_EXTENSION_METHOD:
@@ -1881,7 +1878,7 @@
LintCode.use_decorated_box:
status: needsEvaluation
LintCode.use_enums:
- status: hasFix
+ status: hasFix
LintCode.use_full_hex_values_for_flutter_colors:
status: hasFix
LintCode.use_function_type_syntax_for_parameters:
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index dcb96bf..69727ef 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -230,6 +230,7 @@
/// Computer for Dart "fix all in file" fixes.
class FixInFileProcessor {
final DartFixContext context;
+
FixInFileProcessor(this.context);
Future<List<Fix>> compute() async {
@@ -1090,6 +1091,12 @@
AddEnumConstant.new,
ChangeTo.getterOrSetter,
],
+ CompileTimeErrorCode.UNDEFINED_ENUM_CONSTRUCTOR_NAMED: [
+ CreateConstructor.new,
+ ],
+ CompileTimeErrorCode.UNDEFINED_ENUM_CONSTRUCTOR_UNNAMED: [
+ CreateConstructor.new,
+ ],
CompileTimeErrorCode.UNDEFINED_EXTENSION_GETTER: [
ChangeTo.getterOrSetter,
CreateGetter.new,
diff --git a/pkg/analysis_server/test/src/analytics/percentile_calculator_test.dart b/pkg/analysis_server/test/src/analytics/percentile_calculator_test.dart
index a6a1047..657961b 100644
--- a/pkg/analysis_server/test/src/analytics/percentile_calculator_test.dart
+++ b/pkg/analysis_server/test/src/analytics/percentile_calculator_test.dart
@@ -8,12 +8,12 @@
void main() {
defineReflectiveSuite(() {
- defineReflectiveTests(PercentileTest);
+ defineReflectiveTests(PercentileCalculatorTest);
});
}
@reflectiveTest
-class PercentileTest {
+class PercentileCalculatorTest {
var calculator = PercentileCalculator();
void test_clear() {
@@ -22,12 +22,12 @@
}
calculator.clear();
expect(calculator.toAnalyticsString(),
- '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]');
+ '0[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]');
}
void test_toAnalyticsString_empty() {
expect(calculator.toAnalyticsString(),
- '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]');
+ '0[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]');
}
void test_toAnalyticsString_evenDistribution() {
@@ -35,6 +35,6 @@
calculator.addValue(i);
}
expect(calculator.toAnalyticsString(),
- '[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]');
+ '100[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]');
}
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart
index 196a197..c00ab29 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart
@@ -168,4 +168,56 @@
''');
assertLinkedGroup(change.linkedEditGroups[0], ['named(int ', 'named(1']);
}
+
+ Future<void> test_undefined_enum_constructor_named() async {
+ await resolveTestCode('''
+enum E {
+ c.x();
+ const E.y();
+}
+''');
+ await assertHasFix('''
+enum E {
+ c.x();
+ const E.y();
+
+ const E.x();
+}
+''', matchFixMessage: "Create constructor 'E.x'");
+ }
+
+ Future<void> test_undefined_enum_constructor_unnamed() async {
+ await resolveTestCode('''
+enum E {
+ c;
+ const E.x();
+}
+''');
+ await assertHasFix('''
+enum E {
+ c;
+ const E.x();
+
+ const E();
+}
+''', matchFixMessage: "Create constructor 'E'");
+ }
+
+ @FailingTest(reason: 'parameter types should be inferred')
+ Future<void> test_undefined_enum_constructor_unnamed_parameters() async {
+ await resolveTestCode('''
+enum E {
+ c(1);
+ const E.x();
+}
+''');
+ await assertHasFix('''
+enum E {
+ c(1);
+ const E.x();
+
+ const E(int i);
+}
+''');
+ }
}
diff --git a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
index d01feea..3ed9228 100644
--- a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
+++ b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
@@ -4,7 +4,6 @@
import 'package:dart_style/dart_style.dart';
-import 'typescript.dart';
import 'typescript_parser.dart';
final formatter = DartFormatter();
@@ -786,7 +785,6 @@
buffer.writeIndented('class ${interface.nameWithTypeArgs} ');
final allBaseTypes =
interface.baseTypes.map((t) => t.dartTypeWithTypeArgs).toList();
- allBaseTypes.addAll(getSpecialBaseTypes(interface));
allBaseTypes.add('ToJsonable');
if (allBaseTypes.isNotEmpty) {
buffer.writeIndented('implements ${allBaseTypes.join(', ')} ');
diff --git a/pkg/analysis_server/tool/lsp_spec/generate_all.dart b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
index 57b545b..92e5880 100644
--- a/pkg/analysis_server/tool/lsp_spec/generate_all.dart
+++ b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
@@ -196,15 +196,23 @@
Field field(
String name, {
+ String? comment,
required String type,
bool array = false,
bool canBeUndefined = false,
}) {
- var fieldType =
+ final fieldType =
array ? ArrayType(Type.identifier(type)) : Type.identifier(type);
+ final commentNode =
+ comment != null ? Comment(Token(TokenType.COMMENT, comment)) : null;
- return Field(null, Token.identifier(name), fieldType,
- allowsNull: false, allowsUndefined: canBeUndefined);
+ return Field(
+ commentNode,
+ Token.identifier(name),
+ fieldType,
+ allowsNull: false,
+ allowsUndefined: canBeUndefined,
+ );
}
final customTypes = <AstNode>[
@@ -218,6 +226,72 @@
Token.identifier('LSPObject'),
Type.Any,
),
+ interface('Message', [
+ field('jsonrpc', type: 'string'),
+ field('clientRequestTime', type: 'int', canBeUndefined: true),
+ ]),
+ interface(
+ 'IncomingMessage',
+ [
+ field('method', type: 'Method'),
+ field('params', type: 'LSPAny', canBeUndefined: true),
+ ],
+ baseType: 'Message',
+ ),
+ interface(
+ 'RequestMessage',
+ [
+ Field(
+ null,
+ Token.identifier('id'),
+ UnionType([Type.identifier('int'), Type.identifier('string')]),
+ allowsNull: false,
+ allowsUndefined: false,
+ )
+ ],
+ baseType: 'IncomingMessage',
+ ),
+ interface(
+ 'NotificationMessage',
+ [],
+ baseType: 'IncomingMessage',
+ ),
+ interface(
+ 'ResponseMessage',
+ [
+ Field(
+ null,
+ Token.identifier('id'),
+ UnionType([Type.identifier('int'), Type.identifier('string')]),
+ allowsNull: true,
+ allowsUndefined: false,
+ ),
+ field('result', type: 'LSPAny', canBeUndefined: true),
+ field('error', type: 'ResponseError', canBeUndefined: true),
+ ],
+ baseType: 'Message',
+ ),
+ interface(
+ 'ResponseError',
+ [
+ field('code', type: 'ErrorCodes'),
+ field('message', type: 'string'),
+ // This is Object? normally, but since this class can be serialised
+ // we will crash if it data is set to something that can't be converted to
+ // JSON (for ex. Uri) so this forces anyone setting this to convert to a
+ // String.
+ field(
+ 'data',
+ type: 'string',
+ canBeUndefined: true,
+ comment:
+ 'A string that contains additional information about the error. '
+ 'Can be omitted.',
+ ),
+ ],
+ ),
+ TypeAlias(null, Token.identifier('DocumentUri'), Type.identifier('string')),
+
interface('DartDiagnosticServer', [field('port', type: 'int')]),
interface('AnalyzerStatusParams', [field('isAnalyzing', type: 'boolean')]),
interface('PublishClosingLabelsParams', [
@@ -326,34 +400,6 @@
return customTypes;
}
-/// Gets additional custom fields to be added to LSP Spec classes.
-///
-/// Non-standard fields should generally be avoided and must always allow
-/// undefined.
-List<Field> getCustomFields(String interfaceName) {
- final additionalFields = <String, List<Field>>{
- // Allow clients to pass a "clientRequestTime" against any incomine message
- // so that we can capture latency information for requests for performance
- // measurements.
- 'Message': [
- Field(
- null,
- Token.identifier('clientRequestTime'),
- Type.identifier('int'),
- allowsNull: false,
- allowsUndefined: true,
- ),
- ],
- };
-
- final fields = additionalFields[interfaceName] ?? [];
- assert(
- fields.every((field) => field.allowsUndefined),
- 'Any additional non-standard LSP field must allow undefined',
- );
- return fields;
-}
-
Future<List<AstNode>> getSpecClasses(ArgResults args) async {
var download = args[argDownload] as bool;
if (download) {
@@ -366,7 +412,6 @@
.map(parseString)
.expand((f) => f)
.where(includeTypeDefinitionInOutput)
- .map(withCustomFields)
.toList();
// Generate an enum for all of the request methods to avoid strings.
@@ -417,26 +462,6 @@
return true;
}
-/// Returns [node] with any additional custom fields.
-AstNode withCustomFields(AstNode node) {
- if (node is! Interface) {
- return node;
- }
-
- final customFields = getCustomFields(node.name);
- if (customFields.isEmpty) {
- return node;
- }
-
- return Interface(
- node.commentNode,
- node.nameToken,
- node.typeArgs,
- node.baseTypes,
- [...node.members, ...customFields],
- );
-}
-
/// Fetches and in-lines any includes that appear in [spec] in the form
/// `{% include_relative types/uri.md %}`.
Future<String> _fetchIncludes(String spec, Uri baseUri) async {
diff --git a/pkg/analysis_server/tool/lsp_spec/typescript.dart b/pkg/analysis_server/tool/lsp_spec/typescript.dart
index 0027724..0ca98c3 100644
--- a/pkg/analysis_server/tool/lsp_spec/typescript.dart
+++ b/pkg/analysis_server/tool/lsp_spec/typescript.dart
@@ -43,21 +43,6 @@
return comment.trim();
}
-/// Improves comments in generated code to support where types may have been
-/// altered (for ex. with [getImprovedType] above).
-String? getImprovedComment(String interfaceName, String fieldName) {
- const improvedComments = <String, Map<String, String>>{
- 'ResponseError': {
- 'data':
- '// A string that contains additional information about the error. Can be omitted.',
- },
- };
-
- final interface = improvedComments[interfaceName];
-
- return interface != null ? interface[fieldName] : null;
-}
-
/// Improves types in generated code, including:
///
/// - Fixes up some enum types that are not as specific as they could be in the
@@ -96,22 +81,6 @@
'FoldingRange': {
'kind': 'FoldingRangeKind',
},
- 'ResponseError': {
- 'code': 'ErrorCodes',
- // This is Object? normally, but since this class can be serialised
- // we will crash if it data is set to something that can't be converted to
- // JSON (for ex. Uri) so this forces anyone setting this to convert to a
- // String.
- 'data': 'String',
- },
- 'NotificationMessage': {
- 'method': 'Method',
- 'params': 'object',
- },
- 'RequestMessage': {
- 'method': 'Method',
- 'params': 'object',
- },
'SymbolInformation': {
'kind': 'SymbolKind',
},
@@ -134,26 +103,30 @@
return interface != null ? interface[fieldName] : null;
}
-List<String> getSpecialBaseTypes(Interface interface) {
- if (interface.name == 'RequestMessage' ||
- interface.name == 'NotificationMessage') {
- return ['IncomingMessage'];
- } else {
- return [];
- }
-}
-
/// Removes types that are in the spec that we don't want to emit.
bool includeTypeDefinitionInOutput(AstNode node) {
- // InitializeError is not used for v3.0 (Feb 2017) and by dropping it we don't
- // have to handle any cases where both a namespace and interfaces are declared
- // with the same name.
- return node.name != 'InitializeError' &&
- // We don't use `InitializeErrorCodes` as it contains only one error code
- // that has been deprecated and we've never used.
- node.name != 'InitializeErrorCodes' &&
- // We don't emit MarkedString because it gets mapped to a simple String
- // when getting the .dartType for it.
- // .startsWith() because there are inline types that will be generated.
- !node.name.startsWith('MarkedString');
+ const ignoredTypes = {
+ // InitializeError is not used for v3.0 (Feb 2017) and by dropping it we don't
+ // have to handle any cases where both a namespace and interfaces are declared
+ // with the same name.
+ 'InitializeError',
+ // We don't use `InitializeErrorCodes` as it contains only one error code
+ // that has been deprecated and we've never used.
+ 'InitializeErrorCodes',
+ // Handled in custom classes now in preperation for JSON meta model which
+ // does not specify them.
+ 'Message',
+ 'RequestMessage',
+ 'NotificationMessage',
+ 'ResponseMessage',
+ 'ResponseError',
+ };
+ const ignoredPrefixes = {
+ // We don't emit MarkedString because it gets mapped to a simple String
+ // when getting the .dartType for it.
+ 'MarkedString'
+ };
+ final shouldIgnore = ignoredTypes.contains(node.name) ||
+ ignoredPrefixes.any((ignore) => node.name.startsWith(ignore));
+ return !shouldIgnore;
}
diff --git a/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart b/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
index d2b2eab..d074460 100644
--- a/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
+++ b/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
@@ -378,12 +378,6 @@
type = _type(containerName, name.lexeme,
includeUndefined: canBeUndefined, improveTypes: true);
- // Overwrite comment if we have an improved one.
- final improvedComment = getImprovedComment(containerName, name.lexeme);
- leadingComment = improvedComment != null
- ? Comment(Token(TokenType.COMMENT, improvedComment))
- : leadingComment;
-
// Some fields have weird comments like this in the spec:
// {@link MessageType}
// These seem to be the correct type of the field, while the field is
diff --git a/pkg/analyzer/analysis_options.yaml b/pkg/analyzer/analysis_options.yaml
index 6a2cacc..2b2890a 100644
--- a/pkg/analyzer/analysis_options.yaml
+++ b/pkg/analyzer/analysis_options.yaml
@@ -39,3 +39,4 @@
- depend_on_referenced_packages
- unawaited_futures
- unnecessary_parenthesis
+ - use_super_parameters
diff --git a/pkg/analyzer/lib/exception/exception.dart b/pkg/analyzer/lib/exception/exception.dart
index d7cf039..34c2cf8 100644
--- a/pkg/analyzer/lib/exception/exception.dart
+++ b/pkg/analyzer/lib/exception/exception.dart
@@ -96,8 +96,8 @@
/// This is still considered an exceptional situation and will be sent to crash
/// reporting.
class SilentException extends CaughtException {
- SilentException(String message, Object exception, StackTrace stackTrace)
- : super.withMessage(message, exception, stackTrace);
+ SilentException(String super.message, super.exception, super.stackTrace)
+ : super.withMessage();
/// Create a [SilentException] to wrap a [CaughtException], adding a
/// [message].
diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart
index b55664e..4f6a36f 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -328,8 +328,7 @@
/// An in-memory implementation of [File].
class _MemoryFile extends _MemoryResource implements File {
- _MemoryFile(MemoryResourceProvider provider, String path)
- : super(provider, path);
+ _MemoryFile(super.provider, super.path);
@override
bool get exists {
@@ -425,8 +424,7 @@
/// An in-memory implementation of [Folder].
class _MemoryFolder extends _MemoryResource implements Folder {
- _MemoryFolder(MemoryResourceProvider provider, String path)
- : super(provider, path);
+ _MemoryFolder(super.provider, super.path);
@override
bool get exists {
diff --git a/pkg/analyzer/lib/file_system/overlay_file_system.dart b/pkg/analyzer/lib/file_system/overlay_file_system.dart
index 710ce97..469de5d 100644
--- a/pkg/analyzer/lib/file_system/overlay_file_system.dart
+++ b/pkg/analyzer/lib/file_system/overlay_file_system.dart
@@ -119,8 +119,7 @@
class _OverlayFile extends _OverlayResource implements File {
/// Initialize a newly created file to have the given [provider] and to
/// correspond to the given [file] from the provider's base resource provider.
- _OverlayFile(OverlayResourceProvider provider, File file)
- : super(provider, file);
+ _OverlayFile(super.provider, File super.file);
@Deprecated('Use watch() instead')
@override
@@ -234,8 +233,7 @@
/// Initialize a newly created folder to have the given [provider] and to
/// correspond to the given [folder] from the provider's base resource
/// provider.
- _OverlayFolder(OverlayResourceProvider provider, Folder folder)
- : super(provider, folder);
+ _OverlayFolder(super.provider, Folder super.folder);
@Deprecated('Use watch() instead')
@override
diff --git a/pkg/analyzer/lib/file_system/physical_file_system.dart b/pkg/analyzer/lib/file_system/physical_file_system.dart
index 6b75c0c..962862f 100644
--- a/pkg/analyzer/lib/file_system/physical_file_system.dart
+++ b/pkg/analyzer/lib/file_system/physical_file_system.dart
@@ -94,7 +94,7 @@
/// A `dart:io` based implementation of [File].
class _PhysicalFile extends _PhysicalResource implements File {
- _PhysicalFile(io.File file) : super(file);
+ _PhysicalFile(io.File super.file);
@Deprecated('Use watch() instead')
@override
@@ -207,7 +207,7 @@
/// A `dart:io` based implementation of [Folder].
class _PhysicalFolder extends _PhysicalResource implements Folder {
- _PhysicalFolder(io.Directory directory) : super(directory);
+ _PhysicalFolder(io.Directory super.directory);
@Deprecated('Use watch() instead')
@override
diff --git a/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart b/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
index c12b308..01d99e3 100644
--- a/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
+++ b/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
@@ -37,14 +37,11 @@
const AnalysisOptionsErrorCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'AnalysisOptionsErrorCode.${uniqueName ?? name}',
@@ -90,14 +87,11 @@
const AnalysisOptionsHintCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'AnalysisOptionsHintCode.${uniqueName ?? name}',
@@ -240,14 +234,11 @@
const AnalysisOptionsWarningCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'AnalysisOptionsWarningCode.${uniqueName ?? name}',
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart b/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart
index 07cad9d..cc59e96 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart
@@ -275,9 +275,9 @@
/// The string at [previousStringIndex] requested the opposite.
final bool requestedValue;
- ConflictingFlags(int stringIndex, this.previousStringIndex, this.feature,
+ ConflictingFlags(super.stringIndex, this.previousStringIndex, this.feature,
this.requestedValue)
- : super._(stringIndex);
+ : super._();
@override
String get flag => feature.stringForValue(requestedValue);
@@ -381,7 +381,7 @@
/// Information about the feature associated with the error.
final ExperimentalFeature feature;
- IllegalUseOfExpiredFlag(int flagIndex, this.feature) : super._(flagIndex);
+ IllegalUseOfExpiredFlag(super.flagIndex, this.feature) : super._();
@override
String get flag => feature.stringForValue(!feature.isEnabledByDefault);
@@ -405,7 +405,7 @@
/// Information about the feature associated with the warning.
final ExperimentalFeature feature;
- UnnecessaryUseOfExpiredFlag(int flagIndex, this.feature) : super._(flagIndex);
+ UnnecessaryUseOfExpiredFlag(super.flagIndex, this.feature) : super._();
@override
String get flag => feature.stringForValue(feature.isEnabledByDefault);
@@ -423,7 +423,7 @@
@override
final String flag;
- UnrecognizedFlag(int flagIndex, this.flag) : super._(flagIndex);
+ UnrecognizedFlag(super.flagIndex, this.flag) : super._();
@override
bool get isError => true;
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_content_cache.dart b/pkg/analyzer/lib/src/dart/analysis/file_content_cache.dart
index f87ee8e..5de8ccb 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_content_cache.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_content_cache.dart
@@ -64,8 +64,7 @@
/// [FileContentCache] that caches never.
class _FileContentCacheEphemeral extends FileContentCache {
- _FileContentCacheEphemeral(ResourceProvider resourceProvider)
- : super._(resourceProvider);
+ _FileContentCacheEphemeral(super.resourceProvider) : super._();
@override
FileContent get(String path) {
@@ -77,8 +76,7 @@
class _FileContentCacheImpl extends FileContentCache {
final Map<String, FileContent> _pathToFile = {};
- _FileContentCacheImpl(ResourceProvider resourceProvider)
- : super._(resourceProvider);
+ _FileContentCacheImpl(super.resourceProvider) : super._();
@override
FileContent get(String path) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index 1bd5c9c..2e35c85 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -126,13 +126,15 @@
UnlinkedUnit? _unlinked2;
+ FileStateKind? _kind;
+
/// Files that reference this file.
final List<FileState> referencingFiles = [];
List<FileState?>? _importedFiles;
List<FileState?>? _exportedFiles;
- List<FileState?>? _partedFiles;
- List<FileState>? _libraryFiles;
+ List<FileState?> _partedFiles = [];
+ List<FileState> _libraryFiles = [];
Set<FileState>? _directReferencedFiles;
Set<FileState>? _directReferencedLibraries;
@@ -242,16 +244,17 @@
_unlinked2!.partOfUriDirective != null;
}
+ FileStateKind get kind => _kind!;
+
/// If the file [isPart], return a currently know library the file is a part
/// of. Return `null` if a library is not known, for example because we have
/// not processed a library file yet.
FileState? get library {
- _fsState.readPartsForLibraries();
- List<FileState>? libraries = _fsState._partToLibraries[this];
- if (libraries == null || libraries.isEmpty) {
- return null;
+ final kind = _kind;
+ if (kind is PartKnownFileStateKind) {
+ return kind.library;
} else {
- return libraries.first;
+ return null;
}
}
@@ -268,10 +271,7 @@
/// The list of files files that this library consists of, i.e. this library
/// file itself and its [partedFiles].
List<FileState> get libraryFiles {
- return _libraryFiles ??= [
- this,
- ...partedFiles.whereNotNull(),
- ];
+ return _libraryFiles;
}
/// Return information about line in the file.
@@ -279,20 +279,7 @@
/// The list of files this library file references as parts.
List<FileState?> get partedFiles {
- return _partedFiles ??= _unlinked2!.parts.map((uri) {
- return _fileForRelativeUri(uri).map(
- (file) {
- if (file != null) {
- file.referencingFiles.add(this);
- _fsState._partToLibraries
- .putIfAbsent(file, () => <FileState>[])
- .add(this);
- }
- return file;
- },
- (_) => null,
- );
- }).toList();
+ return _partedFiles;
}
/// The external names referenced by the file.
@@ -410,21 +397,14 @@
_libraryCycle?.invalidate();
// If this is a part, invalidate the libraries.
- var libraries = _fsState._partToLibraries[this];
- if (libraries != null) {
- for (var library in libraries) {
- library.libraryCycle.invalidate();
+ final kind = _kind;
+ if (kind is PartKnownFileStateKind) {
+ for (final library in kind._libraries) {
+ library._libraryCycle?.invalidate();
}
}
}
- // This file is potentially not a library for its previous parts anymore.
- if (_partedFiles != null) {
- for (var part in _partedFiles!) {
- _fsState._partToLibraries[part]?.remove(this);
- }
- }
-
// It is possible that this file does not reference these files.
_stopReferencingByThisFile();
@@ -434,10 +414,9 @@
_directReferencedFiles = null;
_directReferencedLibraries = null;
- // Read parts on demand.
- _fsState._librariesWithoutPartsRead.add(this);
- _partedFiles = null;
- _libraryFiles = null;
+ // Read parts eagerly to link parts to libraries.
+ _updateKind();
+ _updatePartedFiles();
// Update mapping from subtyped names to files.
for (var name in _driverUnlinkedUnit!.subtypedNames) {
@@ -581,6 +560,114 @@
removeForOne(_partedFiles);
}
+ void _updateKind() {
+ /// This file is a part (was not part, or no kind at all).
+ /// Now we might be able to update its kind to a known part.
+ void updateLibrariesWithThisPart() {
+ for (final maybeLibrary in _fsState._pathToFile.values) {
+ if (maybeLibrary.kind is LibraryFileStateKind) {
+ if (maybeLibrary.partedFiles.contains(this)) {
+ maybeLibrary._updatePartedFiles();
+ maybeLibrary._libraryCycle?.invalidate();
+ }
+ }
+ }
+ }
+
+ final libraryAugmentationDirective = unlinked2.libraryAugmentationDirective;
+ final partOfNameDirective = unlinked2.partOfNameDirective;
+ final partOfUriDirective = unlinked2.partOfUriDirective;
+ if (libraryAugmentationDirective != null) {
+ // TODO(scheglov) This code does not have enough tests.
+ _kind = LibraryAugmentationUnknownFileStateKind(
+ file: this,
+ directive: libraryAugmentationDirective,
+ );
+ _fileForRelativeUri(libraryAugmentationDirective.uri);
+ } else if (unlinked2.libraryDirective != null) {
+ _kind = LibraryFileStateKind(
+ file: this,
+ );
+ } else if (partOfNameDirective != null) {
+ if (_kind is! PartKnownFileStateKind) {
+ _kind = PartUnknownNameFileStateKind(
+ file: this,
+ directive: partOfNameDirective,
+ );
+ updateLibrariesWithThisPart();
+ }
+ } else if (partOfUriDirective != null) {
+ if (_kind is! PartKnownFileStateKind) {
+ _kind = PartUnknownUriFileStateKind(
+ file: this,
+ directive: partOfUriDirective,
+ );
+ _fileForRelativeUri(partOfUriDirective.uri);
+ updateLibrariesWithThisPart();
+ }
+ } else {
+ _kind = LibraryFileStateKind(
+ file: this,
+ );
+ }
+ }
+
+ void _updatePartedFiles() {
+ // Disconnect all parts of this library.
+ for (final part in _partedFiles) {
+ if (part != null) {
+ final partKind = part.kind;
+ if (partKind is PartKnownFileStateKind) {
+ partKind._libraries.remove(this);
+ // If no libraries, switch to unknown.
+ if (partKind._libraries.isEmpty) {
+ final partOfNameDirective = part.unlinked2.partOfNameDirective;
+ final partOfUriDirective = part.unlinked2.partOfUriDirective;
+ if (partOfNameDirective != null) {
+ part._kind = PartUnknownNameFileStateKind(
+ file: part,
+ directive: partOfNameDirective,
+ );
+ } else if (partOfUriDirective != null) {
+ part._kind = PartUnknownUriFileStateKind(
+ file: part,
+ directive: partOfUriDirective,
+ );
+ }
+ }
+ }
+ }
+ }
+
+ _partedFiles = unlinked2.parts.map((uri) {
+ return _fileForRelativeUri(uri).map(
+ (part) {
+ if (part != null) {
+ part.referencingFiles.add(this);
+ // Either add this as a library, or switch from unknown.
+ final kind = part._kind;
+ if (kind is PartKnownFileStateKind) {
+ kind._libraries.add(this);
+ } else if (kind is PartUnknownNameFileStateKind ||
+ kind is PartUnknownUriFileStateKind) {
+ part._kind = PartKnownFileStateKind(
+ file: part,
+ library: this,
+ );
+ }
+ }
+ return part;
+ },
+ (_) => null,
+ );
+ }).toList();
+
+ _libraryFiles = [
+ this,
+ ...partedFiles.whereNotNull(),
+ ];
+ }
+
static UnlinkedUnit serializeAstUnlinked2(CompilationUnit unit) {
UnlinkedLibraryDirective? libraryDirective;
UnlinkedLibraryAugmentationDirective? libraryAugmentationDirective;
@@ -722,6 +809,14 @@
}
}
+abstract class FileStateKind {
+ final FileState file;
+
+ FileStateKind({
+ required this.file,
+ });
+}
+
enum FileStateRefreshResult {
/// No changes to the content, so no changes at all.
nothing,
@@ -780,14 +875,6 @@
/// Mapping from a path to the corresponding [FileState].
final Map<String, FileState> _pathToFile = {};
- /// We don't read parts until requested, but if we need to know the
- /// library for a file, we need to read parts of every file to know
- /// which libraries reference this part.
- final List<FileState> _librariesWithoutPartsRead = [];
-
- /// Mapping from a part to the libraries it is a part of.
- final Map<FileState, List<FileState>> _partToLibraries = {};
-
/// The map of subtyped names to files where these names are subtyped.
final Map<String, Set<FileState>> _subtypedNameToFiles = {};
@@ -905,7 +992,7 @@
final externalSummaries = this.externalSummaries;
if (externalSummaries != null) {
String uriStr = uri.toString();
- if (externalSummaries.hasLinkedLibrary(uriStr)) {
+ if (externalSummaries.uriToSummaryPath.containsKey(uriStr)) {
return Either2.t2(ExternalLibrary._(uri));
}
}
@@ -969,19 +1056,6 @@
_fileContentCache.invalidate(path);
}
- void readPartsForLibraries() {
- // Make a copy, because reading new files will update it.
- var libraryToProcess = _librariesWithoutPartsRead.toList();
-
- // We will process these files, so clear it now.
- // It will be filled with new files during the loop below.
- _librariesWithoutPartsRead.clear();
-
- for (var library in libraryToProcess) {
- library.partedFiles;
- }
- }
-
/// Remove the file with the given [path].
void removeFile(String path) {
markFileForReading(path);
@@ -995,8 +1069,6 @@
knownFiles.clear();
_hasUriForPath.clear();
_pathToFile.clear();
- _librariesWithoutPartsRead.clear();
- _partToLibraries.clear();
_subtypedNameToFiles.clear();
}
@@ -1079,3 +1151,64 @@
bool get isSrc => (_flags & _isSrc) != 0;
}
+
+class LibraryAugmentationKnownFileStateKind extends FileStateKind {
+ final FileState augmented;
+
+ LibraryAugmentationKnownFileStateKind({
+ required super.file,
+ required this.augmented,
+ });
+}
+
+/// A library augmentation when the augmented target is unknown, e.g.
+/// the provided URI cannot be resolved.
+class LibraryAugmentationUnknownFileStateKind extends FileStateKind {
+ final UnlinkedLibraryAugmentationDirective directive;
+
+ LibraryAugmentationUnknownFileStateKind({
+ required super.file,
+ required this.directive,
+ });
+}
+
+class LibraryFileStateKind extends FileStateKind {
+ LibraryFileStateKind({
+ required super.file,
+ });
+}
+
+class PartKnownFileStateKind extends FileStateKind {
+ final List<FileState> _libraries = [];
+
+ PartKnownFileStateKind({
+ required super.file,
+ required FileState library,
+ }) {
+ _libraries.add(library);
+ }
+
+ FileState get library => _libraries.first;
+}
+
+/// The file is a part, but its library is unknown.
+/// We don't know the library with this name.
+class PartUnknownNameFileStateKind extends FileStateKind {
+ final UnlinkedPartOfNameDirective directive;
+
+ PartUnknownNameFileStateKind({
+ required super.file,
+ required this.directive,
+ });
+}
+
+/// The file is a part, but its library is unknown.
+/// When we don't understand the URI.
+class PartUnknownUriFileStateKind extends FileStateKind {
+ final UnlinkedPartOfUriDirective directive;
+
+ PartUnknownUriFileStateKind({
+ required super.file,
+ required this.directive,
+ });
+}
diff --git a/pkg/analyzer/lib/src/dart/analysis/results.dart b/pkg/analyzer/lib/src/dart/analysis/results.dart
index cef3e18..789a751 100644
--- a/pkg/analyzer/lib/src/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/results.dart
@@ -40,9 +40,8 @@
@override
final List<AnalysisError> errors;
- ErrorsResultImpl(AnalysisSession session, String path, Uri uri,
- LineInfo lineInfo, bool isPart, this.errors)
- : super(session, path, uri, lineInfo, isPart);
+ ErrorsResultImpl(super.session, super.path, super.uri, super.lineInfo,
+ super.isPart, this.errors);
}
class FileResultImpl extends AnalysisResultImpl implements FileResult {
@@ -59,8 +58,7 @@
final bool isPart;
FileResultImpl(
- AnalysisSession session, this.path, this.uri, this.lineInfo, this.isPart)
- : super(session);
+ super.session, this.path, this.uri, this.lineInfo, this.isPart);
}
class LibraryElementResultImpl implements LibraryElementResult {
@@ -75,7 +73,7 @@
@override
final List<ParsedUnitResult> units;
- ParsedLibraryResultImpl(AnalysisSession session, this.units) : super(session);
+ ParsedLibraryResultImpl(super.session, this.units);
@override
ElementDeclarationResult? getElementDeclaration(Element element) {
@@ -198,8 +196,7 @@
@override
final List<ResolvedUnitResult> units;
- ResolvedLibraryResultImpl(AnalysisSession session, this.element, this.units)
- : super(session);
+ ResolvedLibraryResultImpl(super.session, this.element, this.units);
@override
TypeProvider get typeProvider => element.typeProvider;
@@ -278,9 +275,8 @@
@override
final CompilationUnitElement element;
- UnitElementResultImpl(AnalysisSession session, String path, Uri uri,
- LineInfo lineInfo, bool isPart, this.element)
- : super(session, path, uri, lineInfo, isPart);
+ UnitElementResultImpl(super.session, super.path, super.uri, super.lineInfo,
+ super.isPart, this.element);
}
/// A visitor which locates the [AstNode] which declares [element].
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index cc15afe..00e49a0 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -1675,8 +1675,7 @@
/// Initialize a newly created member of a class. Either or both of the
/// [comment] and [metadata] can be `null` if the member does not have the
/// corresponding attribute.
- ClassMemberImpl(CommentImpl? comment, List<Annotation>? metadata)
- : super(comment, metadata);
+ ClassMemberImpl(super.comment, super.metadata);
}
abstract class ClassOrMixinDeclarationImpl
@@ -1701,15 +1700,14 @@
Token rightBracket;
ClassOrMixinDeclarationImpl(
- CommentImpl? comment,
- List<Annotation>? metadata,
- SimpleIdentifierImpl name,
+ super.comment,
+ super.metadata,
+ super.name,
this._typeParameters,
this._implementsClause,
this.leftBracket,
List<ClassMember> members,
- this.rightBracket)
- : super(comment, metadata, name) {
+ this.rightBracket) {
_becomeParentOf(_typeParameters);
_becomeParentOf(_implementsClause);
_members._initialize(this, members);
@@ -2285,8 +2283,7 @@
/// Initialize a newly created generic compilation unit member. Either or both
/// of the [comment] and [metadata] can be `null` if the member does not have
/// the corresponding attribute.
- CompilationUnitMemberImpl(CommentImpl? comment, List<Annotation>? metadata)
- : super(comment, metadata);
+ CompilationUnitMemberImpl(super.comment, super.metadata);
}
mixin CompoundAssignmentExpressionImpl implements CompoundAssignmentExpression {
@@ -2580,8 +2577,8 @@
/// does not redirect to a different constructor. The [body] can be `null` if
/// the constructor does not have a body.
ConstructorDeclarationImpl(
- CommentImpl? comment,
- List<Annotation>? metadata,
+ super.comment,
+ super.metadata,
this.externalKeyword,
this.constKeyword,
this.factoryKeyword,
@@ -2592,8 +2589,7 @@
this.separator,
List<ConstructorInitializer>? initializers,
this._redirectedConstructor,
- this._body)
- : super(comment, metadata) {
+ this._body) {
_becomeParentOf(_returnType);
_becomeParentOf(_name);
_becomeParentOf(_parameters);
@@ -2995,8 +2991,7 @@
/// Initialize a newly created declaration. Either or both of the [comment]
/// and [metadata] can be `null` if the declaration does not have the
/// corresponding attribute.
- DeclarationImpl(CommentImpl? comment, List<Annotation>? metadata)
- : super(comment, metadata);
+ DeclarationImpl(super.comment, super.metadata);
}
/// The declaration of a single identifier.
@@ -3021,9 +3016,8 @@
/// [comment] and [metadata] can be `null` if the declaration does not have
/// the corresponding attribute. The [keyword] can be `null` if a type name is
/// given. The [type] must be `null` if the keyword is 'var'.
- DeclaredIdentifierImpl(CommentImpl? comment, List<Annotation>? metadata,
- this.keyword, this._type, this._identifier)
- : super(comment, metadata) {
+ DeclaredIdentifierImpl(super.comment, super.metadata, this.keyword,
+ this._type, this._identifier) {
_becomeParentOf(_type);
_becomeParentOf(_identifier);
}
@@ -3088,7 +3082,7 @@
// different from a use, so using the same node type doesn't seem to buy us
// much.
class DeclaredSimpleIdentifier extends SimpleIdentifierImpl {
- DeclaredSimpleIdentifier(Token token) : super(token);
+ DeclaredSimpleIdentifier(super.token);
@override
bool inDeclarationContext() => true;
@@ -3211,8 +3205,7 @@
/// Initialize a newly create directive. Either or both of the [comment] and
/// [metadata] can be `null` if the directive does not have the corresponding
/// attribute.
- DirectiveImpl(CommentImpl? comment, List<Annotation>? metadata)
- : super(comment, metadata);
+ DirectiveImpl(super.comment, super.metadata);
@override
Element? get element => _element;
@@ -3717,15 +3710,13 @@
/// corresponding attribute. The list of [combinators] can be `null` if there
/// are no combinators.
ExportDirectiveImpl(
- CommentImpl? comment,
- List<Annotation>? metadata,
- Token keyword,
- StringLiteralImpl libraryUri,
- List<Configuration>? configurations,
- List<Combinator>? combinators,
- Token semicolon)
- : super(comment, metadata, keyword, libraryUri, configurations,
- combinators, semicolon);
+ super.comment,
+ super.metadata,
+ super.keyword,
+ super.libraryUri,
+ super.configurations,
+ super.combinators,
+ super.semicolon);
@override
ExportElement? get element => super.element as ExportElement?;
@@ -4101,8 +4092,8 @@
ExtensionElement? _declaredElement;
ExtensionDeclarationImpl(
- CommentImpl? comment,
- List<Annotation>? metadata,
+ super.comment,
+ super.metadata,
this.extensionKeyword,
this.typeKeyword,
this._name,
@@ -4113,8 +4104,7 @@
this._hideClause,
this.leftBracket,
List<ClassMember> members,
- this.rightBracket)
- : super(comment, metadata) {
+ this.rightBracket) {
_becomeParentOf(_name);
_becomeParentOf(_typeParameters);
_becomeParentOf(_extendedType);
@@ -4330,16 +4320,15 @@
/// the corresponding attribute. The [staticKeyword] can be `null` if the
/// field is not a static field.
FieldDeclarationImpl(
- CommentImpl? comment,
- List<Annotation>? metadata,
+ super.comment,
+ super.metadata,
this.abstractKeyword,
this.augmentKeyword,
this.covariantKeyword,
this.externalKeyword,
this.staticKeyword,
this._fieldList,
- this.semicolon)
- : super(comment, metadata) {
+ this.semicolon) {
_becomeParentOf(_fieldList);
}
@@ -5974,8 +5963,7 @@
final NodeListImpl<SimpleIdentifier> _hiddenNames = NodeListImpl._();
/// Initialize a newly created import show combinator.
- HideCombinatorImpl(Token keyword, List<SimpleIdentifier> hiddenNames)
- : super(keyword) {
+ HideCombinatorImpl(super.keyword, List<SimpleIdentifier> hiddenNames) {
_hiddenNames._initialize(this, hiddenNames);
}
@@ -7210,9 +7198,8 @@
/// Initialize a newly created library directive. Either or both of the
/// [comment] and [metadata] can be `null` if the directive does not have the
/// corresponding attribute.
- LibraryDirectiveImpl(CommentImpl? comment, List<Annotation>? metadata,
- this.libraryKeyword, this._name, this.semicolon)
- : super(comment, metadata) {
+ LibraryDirectiveImpl(super.comment, super.metadata, this.libraryKeyword,
+ this._name, this.semicolon) {
_becomeParentOf(_name);
}
@@ -7329,9 +7316,8 @@
/// if the literal is not a constant. The [typeArguments] can be `null` if no
/// type arguments were declared. The list of [elements] can be `null` if the
/// list is empty.
- ListLiteralImpl(Token? constKeyword, TypeArgumentListImpl? typeArguments,
- this.leftBracket, List<Expression> elements, this.rightBracket)
- : super(constKeyword, typeArguments) {
+ ListLiteralImpl(super.constKeyword, super.typeArguments, this.leftBracket,
+ List<Expression> elements, this.rightBracket) {
_elements._initialize(this, elements);
}
@@ -7340,13 +7326,8 @@
/// The [constKeyword] can be `null` if the literal is not a constant. The
/// [typeArguments] can be `null` if no type arguments were declared. The list
/// of [elements] can be `null` if the list is empty.
- ListLiteralImpl.experimental(
- Token? constKeyword,
- TypeArgumentListImpl? typeArguments,
- this.leftBracket,
- List<CollectionElement> elements,
- this.rightBracket)
- : super(constKeyword, typeArguments) {
+ ListLiteralImpl.experimental(super.constKeyword, super.typeArguments,
+ this.leftBracket, List<CollectionElement> elements, this.rightBracket) {
_elements._initialize(this, elements);
}
@@ -7543,8 +7524,8 @@
/// `null` if the method does not implement an operator. The [parameters] must
/// be `null` if this method declares a getter.
MethodDeclarationImpl(
- CommentImpl? comment,
- List<Annotation>? metadata,
+ super.comment,
+ super.metadata,
this.externalKeyword,
this.modifierKeyword,
this._returnType,
@@ -7553,8 +7534,7 @@
this._name,
this._typeParameters,
this._parameters,
- this._body)
- : super(comment, metadata) {
+ this._body) {
_becomeParentOf(_returnType);
_becomeParentOf(_name);
_becomeParentOf(_typeParameters);
@@ -7915,9 +7895,7 @@
/// Initialize a newly created compilation unit member with the given [name].
/// Either or both of the [comment] and [metadata] can be `null` if the member
/// does not have the corresponding attribute.
- NamedCompilationUnitMemberImpl(
- CommentImpl? comment, List<Annotation>? metadata, this._name)
- : super(comment, metadata) {
+ NamedCompilationUnitMemberImpl(super.comment, super.metadata, this._name) {
_becomeParentOf(_name);
}
@@ -8714,15 +8692,8 @@
/// Initialize a newly created part-of directive. Either or both of the
/// [comment] and [metadata] can be `null` if the directive does not have the
/// corresponding attribute.
- PartOfDirectiveImpl(
- CommentImpl? comment,
- List<Annotation>? metadata,
- this.partKeyword,
- this.ofKeyword,
- this._uri,
- this._libraryName,
- this.semicolon)
- : super(comment, metadata) {
+ PartOfDirectiveImpl(super.comment, super.metadata, this.partKeyword,
+ this.ofKeyword, this._uri, this._libraryName, this.semicolon) {
_becomeParentOf(_uri);
_becomeParentOf(_libraryName);
}
@@ -9372,9 +9343,8 @@
/// `null` if the literal is not a constant. The [typeArguments] can be `null`
/// if no type arguments were declared. The [elements] can be `null` if the
/// set is empty.
- SetOrMapLiteralImpl(Token? constKeyword, TypeArgumentListImpl? typeArguments,
- this.leftBracket, List<CollectionElement> elements, this.rightBracket)
- : super(constKeyword, typeArguments) {
+ SetOrMapLiteralImpl(super.constKeyword, super.typeArguments, this.leftBracket,
+ List<CollectionElement> elements, this.rightBracket) {
_elements._initialize(this, elements);
}
@@ -9491,8 +9461,7 @@
final NodeListImpl<SimpleIdentifier> _shownNames = NodeListImpl._();
/// Initialize a newly created import show combinator.
- ShowCombinatorImpl(Token keyword, List<SimpleIdentifier> shownNames)
- : super(keyword) {
+ ShowCombinatorImpl(super.keyword, List<SimpleIdentifier> shownNames) {
_shownNames._initialize(this, shownNames);
}
@@ -10546,9 +10515,7 @@
class SwitchDefaultImpl extends SwitchMemberImpl implements SwitchDefault {
/// Initialize a newly created switch default. The list of [labels] can be
/// `null` if there are no labels.
- SwitchDefaultImpl(List<Label> labels, Token keyword, Token colon,
- List<Statement> statements)
- : super(labels, keyword, colon, statements);
+ SwitchDefaultImpl(super.labels, super.keyword, super.colon, super.statements);
@override
ChildEntities get _childEntities => ChildEntities()
@@ -10855,13 +10822,8 @@
/// Initialize a newly created top-level variable declaration. Either or both
/// of the [comment] and [metadata] can be `null` if the variable does not
/// have the corresponding attribute.
- TopLevelVariableDeclarationImpl(
- CommentImpl? comment,
- List<Annotation>? metadata,
- this.externalKeyword,
- this._variableList,
- this.semicolon)
- : super(comment, metadata) {
+ TopLevelVariableDeclarationImpl(super.comment, super.metadata,
+ this.externalKeyword, this._variableList, this.semicolon) {
_becomeParentOf(_variableList);
}
@@ -11198,9 +11160,8 @@
/// and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
/// the parameter does not have an upper bound.
- TypeParameterImpl(CommentImpl? comment, List<Annotation>? metadata,
- this._name, this.extendsKeyword, this._bound)
- : super(comment, metadata) {
+ TypeParameterImpl(super.comment, super.metadata, this._name,
+ this.extendsKeyword, this._bound) {
_becomeParentOf(_name);
_becomeParentOf(_bound);
}
@@ -11317,9 +11278,7 @@
/// Initialize a newly create URI-based directive. Either or both of the
/// [comment] and [metadata] can be `null` if the directive does not have the
/// corresponding attribute.
- UriBasedDirectiveImpl(
- CommentImpl? comment, List<Annotation>? metadata, this._uri)
- : super(comment, metadata) {
+ UriBasedDirectiveImpl(super.comment, super.metadata, this._uri) {
_becomeParentOf(_uri);
}
@@ -11534,14 +11493,8 @@
/// the [comment] and [metadata] can be `null` if the variable list does not
/// have the corresponding attribute. The [keyword] can be `null` if a type
/// was specified. The [type] must be `null` if the keyword is 'var'.
- VariableDeclarationListImpl(
- CommentImpl? comment,
- List<Annotation>? metadata,
- this.lateKeyword,
- this.keyword,
- this._type,
- List<VariableDeclaration> variables)
- : super(comment, metadata) {
+ VariableDeclarationListImpl(super.comment, super.metadata, this.lateKeyword,
+ this.keyword, this._type, List<VariableDeclaration> variables) {
_becomeParentOf(_type);
_variables._initialize(this, variables);
}
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index 65a3293..f024ba6 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -1384,7 +1384,10 @@
/// A method that can be passed to the `LinterVisitor` constructor to handle
/// exceptions that occur during linting.
- void logException(
+ ///
+ /// Returns `true` if the exception was fully handled, and `false` if the
+ /// exception should be rethrown.
+ bool logException(
AstNode node, Object visitor, dynamic exception, StackTrace stackTrace) {
StringBuffer buffer = StringBuffer();
buffer.write('Exception while using a ${visitor.runtimeType} to visit a ');
@@ -1402,9 +1405,7 @@
// TODO(39284): should this exception be silent?
AnalysisEngine.instance.instrumentationService.logException(
SilentException(buffer.toString(), exception, stackTrace));
- if (propagateExceptions) {
- throw exception;
- }
+ return !propagateExceptions;
}
}
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 370ca14..c83df2c 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -83,7 +83,7 @@
/// Initialize a newly created class element to have the given [name] at the
/// given [offset] in the file that contains the declaration of this element.
- AbstractClassElementImpl(String name, int offset) : super(name, offset);
+ AbstractClassElementImpl(String super.name, super.offset);
/// Set the accessors contained in this class to the given [accessors].
set accessors(List<PropertyAccessorElement> accessors) {
@@ -563,7 +563,7 @@
/// Initialize a newly created class element to have the given [name] at the
/// given [offset] in the file that contains the declaration of this element.
- ClassElementImpl(String name, int offset) : super(name, offset);
+ ClassElementImpl(super.name, super.offset);
@override
List<PropertyAccessorElement> get accessors {
@@ -1278,7 +1278,7 @@
class ConstFieldElementImpl extends FieldElementImpl with ConstVariableElement {
/// Initialize a newly created synthetic field element to have the given
/// [name] and [offset].
- ConstFieldElementImpl(String name, int offset) : super(name, offset);
+ ConstFieldElementImpl(super.name, super.offset);
@override
Expression? get constantInitializer {
@@ -1293,7 +1293,7 @@
with ConstVariableElement {
/// Initialize a newly created local variable element to have the given [name]
/// and [offset].
- ConstLocalVariableElementImpl(String name, int offset) : super(name, offset);
+ ConstLocalVariableElementImpl(super.name, super.offset);
}
/// A concrete implementation of a [ConstructorElement].
@@ -1331,7 +1331,7 @@
/// Initialize a newly created constructor element to have the given [name]
/// and [offset].
- ConstructorElementImpl(String name, int offset) : super(name, offset);
+ ConstructorElementImpl(super.name, super.offset);
/// Return the constant initializers for this element, which will be empty if
/// there are no initializers, or `null` if there was an error in the source.
@@ -1501,8 +1501,7 @@
with ConstVariableElement {
/// Initialize a newly created synthetic top-level variable element to have
/// the given [name] and [offset].
- ConstTopLevelVariableElementImpl(String name, int offset)
- : super(name, offset);
+ ConstTopLevelVariableElementImpl(super.name, super.offset);
@override
Expression? get constantInitializer {
@@ -1568,14 +1567,10 @@
/// Initialize a newly created parameter element to have the given [name] and
/// [nameOffset].
DefaultFieldFormalParameterElementImpl({
- required String name,
- required int nameOffset,
- required ParameterKind parameterKind,
- }) : super(
- name: name,
- nameOffset: nameOffset,
- parameterKind: parameterKind,
- );
+ required super.name,
+ required super.nameOffset,
+ required super.parameterKind,
+ });
@override
String? get defaultValueCode {
@@ -1589,14 +1584,10 @@
/// Initialize a newly created parameter element to have the given [name] and
/// [nameOffset].
DefaultParameterElementImpl({
- required String? name,
- required int nameOffset,
- required ParameterKind parameterKind,
- }) : super(
- name: name,
- nameOffset: nameOffset,
- parameterKind: parameterKind,
- );
+ required super.name,
+ required super.nameOffset,
+ required super.parameterKind,
+ });
@override
String? get defaultValueCode {
@@ -1609,14 +1600,10 @@
/// Initialize a newly created parameter element to have the given [name] and
/// [nameOffset].
DefaultSuperFormalParameterElementImpl({
- required String name,
- required int nameOffset,
- required ParameterKind parameterKind,
- }) : super(
- name: name,
- nameOffset: nameOffset,
- parameterKind: parameterKind,
- );
+ required super.name,
+ required super.nameOffset,
+ required super.parameterKind,
+ });
@override
String? get defaultValueCode {
@@ -2724,7 +2711,7 @@
/// Initialize a newly created class element to have the given [name] at the
/// given [offset] in the file that contains the declaration of this element.
- EnumElementImpl(String name, int offset) : super(name, offset);
+ EnumElementImpl(super.name, super.offset);
@override
List<PropertyAccessorElement> get accessors {
@@ -2860,8 +2847,7 @@
/// Initialize a newly created executable element to have the given [name] and
/// [offset].
- ExecutableElementImpl(String name, int offset, {Reference? reference})
- : super(name, offset, reference: reference);
+ ExecutableElementImpl(String super.name, super.offset, {super.reference});
@override
Element get enclosingElement => super.enclosingElement!;
@@ -3096,7 +3082,7 @@
/// Initialize a newly created extension element to have the given [name] at
/// the given [offset] in the file that contains the declaration of this
/// element.
- ExtensionElementImpl(String? name, int nameOffset) : super(name, nameOffset);
+ ExtensionElementImpl(super.name, super.nameOffset);
@override
List<PropertyAccessorElement> get accessors {
@@ -3268,7 +3254,7 @@
/// Initialize a newly created synthetic field element to have the given
/// [name] at the given [offset].
- FieldElementImpl(String name, int offset) : super(name, offset);
+ FieldElementImpl(super.name, super.offset);
@override
FieldElement get declaration => this;
@@ -3339,14 +3325,10 @@
/// Initialize a newly created parameter element to have the given [name] and
/// [nameOffset].
FieldFormalParameterElementImpl({
- required String name,
- required int nameOffset,
- required ParameterKind parameterKind,
- }) : super(
- name: name,
- nameOffset: nameOffset,
- parameterKind: parameterKind,
- );
+ required String super.name,
+ required super.nameOffset,
+ required super.parameterKind,
+ });
/// Initializing formals are visible only in the "formal parameter
/// initializer scope", which is the current scope of the initializer list
@@ -3370,7 +3352,7 @@
implements FunctionElement, FunctionTypedElementImpl {
/// Initialize a newly created function element to have the given [name] and
/// [offset].
- FunctionElementImpl(String name, int offset) : super(name, offset);
+ FunctionElementImpl(super.name, super.offset);
/// Initialize a newly created function element to have no name and the given
/// [nameOffset]. This is used for function expressions, that have no name.
@@ -3628,9 +3610,8 @@
/// [onSwitchStatement] should be `true` if this label is associated with a
/// `switch` statement and [onSwitchMember] should be `true` if this label is
/// associated with a `switch` member.
- LabelElementImpl(String name, int nameOffset, this._onSwitchStatement,
- this._onSwitchMember)
- : super(name, nameOffset);
+ LabelElementImpl(String super.name, super.nameOffset, this._onSwitchStatement,
+ this._onSwitchMember);
@override
String get displayName => name;
@@ -3663,8 +3644,8 @@
LibraryAugmentationElementImpl({
required this.augmented,
- required int nameOffset,
- }) : super(name: null, nameOffset: nameOffset);
+ required super.nameOffset,
+ }) : super(name: null);
@override
// TODO: implement accessibleExtensions
@@ -4274,7 +4255,7 @@
/// Initialize a newly created method element to have the given [name] and
/// [offset].
- LocalVariableElementImpl(String name, int offset) : super(name, offset);
+ LocalVariableElementImpl(super.name, super.offset);
@override
String get identifier {
@@ -4320,7 +4301,7 @@
/// Initialize a newly created method element to have the given [name] at the
/// given [offset].
- MethodElementImpl(String name, int offset) : super(name, offset);
+ MethodElementImpl(super.name, super.offset);
@override
MethodElement get declaration => prototype ?? this;
@@ -4391,7 +4372,7 @@
/// Initialize a newly created class element to have the given [name] at the
/// given [offset] in the file that contains the declaration of this element.
- MixinElementImpl(String name, int offset) : super(name, offset);
+ MixinElementImpl(super.name, super.offset);
@override
bool get isAbstract => true;
@@ -4816,8 +4797,7 @@
with _HasLibraryMixin {
/// Initialize a newly created variable element to have the given [name] and
/// [offset].
- NonParameterVariableElementImpl(String name, int offset)
- : super(name, offset);
+ NonParameterVariableElementImpl(String super.name, super.offset);
@override
Element get enclosingElement => super.enclosingElement!;
@@ -5087,8 +5067,7 @@
/// Initialize a newly created method element to have the given [name] and
/// [nameOffset].
- PrefixElementImpl(String name, int nameOffset, {Reference? reference})
- : super(name, nameOffset, reference: reference);
+ PrefixElementImpl(String super.name, super.nameOffset, {super.reference});
@override
String get displayName => name;
@@ -5143,7 +5122,7 @@
/// Initialize a newly created property accessor element to have the given
/// [name] and [offset].
- PropertyAccessorElementImpl(String name, int offset) : super(name, offset);
+ PropertyAccessorElementImpl(super.name, super.offset);
/// Initialize a newly created synthetic property accessor element to be
/// associated with the given [variable].
@@ -5394,7 +5373,7 @@
/// Initialize a newly created synthetic element to have the given [name] and
/// [offset].
- PropertyInducingElementImpl(String name, int offset) : super(name, offset);
+ PropertyInducingElementImpl(super.name, super.offset);
bool get hasTypeInferred => hasModifier(Modifier.HAS_TYPE_INFERRED);
@@ -5542,14 +5521,10 @@
/// Initialize a newly created parameter element to have the given [name] and
/// [nameOffset].
SuperFormalParameterElementImpl({
- required String name,
- required int nameOffset,
- required ParameterKind parameterKind,
- }) : super(
- name: name,
- nameOffset: nameOffset,
- parameterKind: parameterKind,
- );
+ required String super.name,
+ required super.nameOffset,
+ required super.parameterKind,
+ });
/// Super parameters are visible only in the initializer list scope,
/// and introduce final variables.
@@ -5601,7 +5576,7 @@
implements TopLevelVariableElement {
/// Initialize a newly created synthetic top-level variable element to have
/// the given [name] and [offset].
- TopLevelVariableElementImpl(String name, int offset) : super(name, offset);
+ TopLevelVariableElementImpl(super.name, super.offset);
@override
TopLevelVariableElement get declaration => this;
@@ -5645,7 +5620,7 @@
ElementImpl? _aliasedElement;
DartType? _aliasedType;
- TypeAliasElementImpl(String name, int nameOffset) : super(name, nameOffset);
+ TypeAliasElementImpl(String super.name, super.nameOffset);
@override
ElementImpl? get aliasedElement {
@@ -5847,7 +5822,7 @@
/// Initialize a newly created method element to have the given [name] and
/// [offset].
- TypeParameterElementImpl(String name, int offset) : super(name, offset);
+ TypeParameterElementImpl(String super.name, super.offset);
/// Initialize a newly created synthetic type parameter element to have the
/// given [name], and with [synthetic] set to true.
@@ -5960,7 +5935,7 @@
/// Initialize a newly created import element to have the given [name] and
/// [offset]. The offset may be `-1` if the element is synthetic.
- UriReferencedElementImpl(String? name, int offset) : super(name, offset);
+ UriReferencedElementImpl(super.name, super.offset);
/// Return the URI that is specified by this directive.
@override
@@ -6001,7 +5976,7 @@
/// Initialize a newly created variable element to have the given [name] and
/// [offset].
- VariableElementImpl(String? name, int offset) : super(name, offset);
+ VariableElementImpl(super.name, super.offset);
/// If this element represents a constant variable, and it has an initializer,
/// a copy of the initializer for the constant. Otherwise `null`.
@@ -6111,8 +6086,7 @@
}
abstract class _ExistingElementImpl extends ElementImpl with _HasLibraryMixin {
- _ExistingElementImpl(String? name, int offset, {Reference? reference})
- : super(name, offset, reference: reference);
+ _ExistingElementImpl(super.name, super.offset, {super.reference});
}
mixin _HasLibraryMixin on ElementImpl {
diff --git a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
index fd60366..4c29923 100644
--- a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
@@ -699,9 +699,7 @@
/// See [toString].
final _TypeConstraintOrigin origin;
- _TypeConstraint(this.origin, this.typeParameter,
- {DartType? upper, DartType? lower})
- : super(upper: upper, lower: lower);
+ _TypeConstraint(this.origin, this.typeParameter, {super.upper, super.lower});
_TypeConstraint.fromExtends(
TypeParameterElement element, DartType boundType, DartType extendsType,
@@ -735,8 +733,7 @@
_TypeConstraintFromArgument(
this.argumentType, this.parameterType, this.parameterName,
- {this.genericClass, required bool isNonNullableByDefault})
- : super(isNonNullableByDefault: isNonNullableByDefault);
+ {this.genericClass, required super.isNonNullableByDefault});
@override
List<String> formatError() {
@@ -782,8 +779,7 @@
_TypeConstraintFromExtendsClause(
this.typeParam, this.boundType, this.extendsType,
- {required bool isNonNullableByDefault})
- : super(isNonNullableByDefault: isNonNullableByDefault);
+ {required super.isNonNullableByDefault});
@override
List<String> formatError() {
@@ -801,8 +797,7 @@
final DartType functionType;
_TypeConstraintFromFunctionContext(this.functionType, this.contextType,
- {required bool isNonNullableByDefault})
- : super(isNonNullableByDefault: isNonNullableByDefault);
+ {required super.isNonNullableByDefault});
@override
List<String> formatError() {
@@ -819,8 +814,7 @@
final DartType declaredType;
_TypeConstraintFromReturnType(this.declaredType, this.contextType,
- {required bool isNonNullableByDefault})
- : super(isNonNullableByDefault: isNonNullableByDefault);
+ {required super.isNonNullableByDefault});
@override
List<String> formatError() {
diff --git a/pkg/analyzer/lib/src/dart/element/member.dart b/pkg/analyzer/lib/src/dart/element/member.dart
index 882ea16..19aa560 100644
--- a/pkg/analyzer/lib/src/dart/element/member.dart
+++ b/pkg/analyzer/lib/src/dart/element/member.dart
@@ -138,12 +138,12 @@
/// their bounds. The [substitution] includes replacing [declaration] type
/// parameters with the provided fresh [typeParameters].
ExecutableMember(
- TypeProviderImpl? typeProvider,
- ExecutableElement declaration,
- MapSubstitution substitution,
- bool isLegacy,
+ super.typeProvider,
+ ExecutableElement super.declaration,
+ super.substitution,
+ super.isLegacy,
this.typeParameters,
- ) : super(typeProvider, declaration, substitution, isLegacy);
+ );
@override
ExecutableElement get declaration => super.declaration as ExecutableElement;
@@ -286,18 +286,12 @@
}
FieldFormalParameterMember._(
- TypeProviderImpl? typeProvider,
- FieldFormalParameterElement declaration,
- MapSubstitution substitution,
- bool isLegacy,
- List<TypeParameterElement> typeParameters,
- ) : super._(
- typeProvider,
- declaration,
- substitution,
- isLegacy,
- typeParameters,
- );
+ super.typeProvider,
+ FieldFormalParameterElement super.declaration,
+ super.substitution,
+ super.isLegacy,
+ super.typeParameters,
+ ) : super._();
@override
FieldElement? get field {
@@ -326,11 +320,11 @@
/// Initialize a newly created element to represent a field, based on the
/// [declaration], with applied [substitution].
FieldMember(
- TypeProviderImpl? typeProvider,
- FieldElement declaration,
- MapSubstitution substitution,
- bool isLegacy,
- ) : super(typeProvider, declaration, substitution, isLegacy);
+ super.typeProvider,
+ FieldElement super.declaration,
+ super.substitution,
+ super.isLegacy,
+ );
@override
FieldElement get declaration => super.declaration as FieldElement;
@@ -752,12 +746,12 @@
}
MethodMember._(
- TypeProviderImpl? typeProvider,
- MethodElement declaration,
- MapSubstitution substitution,
- bool isLegacy,
- List<TypeParameterElement> typeParameters,
- ) : super(typeProvider, declaration, substitution, isLegacy, typeParameters);
+ super.typeProvider,
+ MethodElement super.declaration,
+ super.substitution,
+ super.isLegacy,
+ super.typeParameters,
+ );
@override
MethodElement get declaration => super.declaration as MethodElement;
@@ -833,12 +827,12 @@
/// Initialize a newly created element to represent a parameter, based on the
/// [declaration], with applied [substitution].
ParameterMember._(
- TypeProviderImpl? typeProvider,
- ParameterElement declaration,
- MapSubstitution substitution,
- bool isLegacy,
+ super.typeProvider,
+ ParameterElement super.declaration,
+ super.substitution,
+ super.isLegacy,
this.typeParameters,
- ) : super(typeProvider, declaration, substitution, isLegacy);
+ );
@override
ParameterElement get declaration => super.declaration as ParameterElement;
@@ -953,12 +947,12 @@
}
PropertyAccessorMember._(
- TypeProviderImpl? typeProvider,
- PropertyAccessorElement declaration,
- MapSubstitution substitution,
- bool isLegacy,
- List<TypeParameterElement> typeParameters,
- ) : super(typeProvider, declaration, substitution, isLegacy, typeParameters);
+ super.typeProvider,
+ PropertyAccessorElement super.declaration,
+ super.substitution,
+ super.isLegacy,
+ super.typeParameters,
+ );
@override
PropertyAccessorElement? get correspondingGetter {
@@ -1064,18 +1058,12 @@
}
SuperFormalParameterMember._(
- TypeProviderImpl? typeProvider,
- SuperFormalParameterElement declaration,
- MapSubstitution substitution,
- bool isLegacy,
- List<TypeParameterElement> typeParameters,
- ) : super._(
- typeProvider,
- declaration,
- substitution,
- isLegacy,
- typeParameters,
- );
+ super.typeProvider,
+ SuperFormalParameterElement super.declaration,
+ super.substitution,
+ super.isLegacy,
+ super.typeParameters,
+ ) : super._();
@override
bool get hasDefaultValue => declaration.hasDefaultValue;
@@ -1103,11 +1091,11 @@
class TopLevelVariableMember extends VariableMember
implements TopLevelVariableElement {
TopLevelVariableMember(
- TypeProviderImpl? typeProvider,
- VariableElement declaration,
- MapSubstitution substitution,
- bool isLegacy,
- ) : super(typeProvider, declaration, substitution, isLegacy);
+ super.typeProvider,
+ super.declaration,
+ super.substitution,
+ super.isLegacy,
+ );
@override
TopLevelVariableElement get declaration =>
@@ -1162,11 +1150,11 @@
/// Initialize a newly created element to represent a variable, based on the
/// [declaration], with applied [substitution].
VariableMember(
- TypeProviderImpl? typeProvider,
- VariableElement declaration,
- MapSubstitution substitution,
- bool isLegacy,
- ) : super(typeProvider, declaration, substitution, isLegacy);
+ super.typeProvider,
+ VariableElement super.declaration,
+ super.substitution,
+ super.isLegacy,
+ );
@override
VariableElement get declaration => super.declaration as VariableElement;
diff --git a/pkg/analyzer/lib/src/dart/element/scope.dart b/pkg/analyzer/lib/src/dart/element/scope.dart
index e8c8698..a37d97a 100644
--- a/pkg/analyzer/lib/src/dart/element/scope.dart
+++ b/pkg/analyzer/lib/src/dart/element/scope.dart
@@ -9,7 +9,7 @@
/// The scope defined by a class.
class ClassScope extends EnclosedScope {
- ClassScope(Scope parent, ClassElement element) : super(parent) {
+ ClassScope(super.parent, ClassElement element) {
element.accessors.forEach(_addPropertyAccessor);
element.methods.forEach(_addGetter);
}
@@ -17,8 +17,7 @@
/// The scope for the initializers in a constructor.
class ConstructorInitializerScope extends EnclosedScope {
- ConstructorInitializerScope(Scope parent, ConstructorElement element)
- : super(parent) {
+ ConstructorInitializerScope(super.parent, ConstructorElement element) {
element.parameters.forEach(_addGetter);
}
}
@@ -71,9 +70,9 @@
/// The scope defined by an extension.
class ExtensionScope extends EnclosedScope {
ExtensionScope(
- Scope parent,
+ super.parent,
ExtensionElement element,
- ) : super(parent) {
+ ) {
element.accessors.forEach(_addPropertyAccessor);
element.methods.forEach(_addGetter);
}
@@ -81,9 +80,9 @@
class FormalParameterScope extends EnclosedScope {
FormalParameterScope(
- Scope parent,
+ super.parent,
List<ParameterElement> elements,
- ) : super(parent) {
+ ) {
for (var parameter in elements) {
if (parameter is! FieldFormalParameterElement &&
parameter is! SuperFormalParameterElement) {
@@ -125,7 +124,7 @@
}
class LocalScope extends EnclosedScope {
- LocalScope(Scope parent) : super(parent);
+ LocalScope(super.parent);
void add(Element element) {
_addGetter(element);
@@ -236,9 +235,9 @@
class TypeParameterScope extends EnclosedScope {
TypeParameterScope(
- Scope parent,
+ super.parent,
List<TypeParameterElement> elements,
- ) : super(parent) {
+ ) {
elements.forEach(_addGetter);
}
}
diff --git a/pkg/analyzer/lib/src/dart/element/type_algebra.dart b/pkg/analyzer/lib/src/dart/element/type_algebra.dart
index 5e1389e..621f2c8 100644
--- a/pkg/analyzer/lib/src/dart/element/type_algebra.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_algebra.dart
@@ -249,7 +249,7 @@
class _FreshTypeParametersSubstitutor extends _TypeSubstitutor {
final Map<TypeParameterElement, DartType> substitution = {};
- _FreshTypeParametersSubstitutor(_TypeSubstitutor outer) : super(outer);
+ _FreshTypeParametersSubstitutor(_TypeSubstitutor super.outer);
@override
List<TypeParameterElement> freshTypeParameters(
diff --git a/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart b/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
index 3e49dd7..db31ce6 100644
--- a/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
@@ -461,14 +461,11 @@
const FfiCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'FfiCode.${uniqueName ?? name}',
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
index 8df0d57..81120a1 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
@@ -1374,14 +1374,11 @@
const HintCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'HintCode.${uniqueName ?? name}',
diff --git a/pkg/analyzer/lib/src/dart/error/lint_codes.dart b/pkg/analyzer/lib/src/dart/error/lint_codes.dart
index 32b5cff..901ba48 100644
--- a/pkg/analyzer/lib/src/dart/error/lint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/lint_codes.dart
@@ -13,10 +13,9 @@
const LintCode(
String name,
String problemMessage, {
- String? correctionMessage,
+ super.correctionMessage,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
problemMessage: problemMessage,
name: name,
uniqueName: uniqueName ?? 'LintCode.$name',
@@ -44,11 +43,9 @@
/// The primary difference from [LintCode]s is that these codes cannot be
/// suppressed with `// ignore:` or `// ignore_for_file:` comments.
class SecurityLintCode extends LintCode {
- const SecurityLintCode(String name, String problemMessage,
- {String? uniqueName, String? correctionMessage})
- : super(name, problemMessage,
- uniqueName: uniqueName ?? 'LintCode.$name',
- correctionMessage: correctionMessage);
+ const SecurityLintCode(super.name, super.problemMessage,
+ {String? uniqueName, super.correctionMessage})
+ : super(uniqueName: uniqueName ?? 'LintCode.$name');
@override
bool get isIgnorable => false;
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
index 4834ee8..46a1e2b 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -1593,14 +1593,11 @@
const ParserErrorCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'ParserErrorCode.${uniqueName ?? name}',
diff --git a/pkg/analyzer/lib/src/dart/resolver/applicable_extensions.dart b/pkg/analyzer/lib/src/dart/resolver/applicable_extensions.dart
index 0d09988..bf399a3 100644
--- a/pkg/analyzer/lib/src/dart/resolver/applicable_extensions.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/applicable_extensions.dart
@@ -74,10 +74,9 @@
final ExecutableElement? getter;
final ExecutableElement? setter;
- _NotInstantiatedExtensionWithMember(ExtensionElement extension,
+ _NotInstantiatedExtensionWithMember(super.extension,
{this.getter, this.setter})
- : assert(getter != null || setter != null),
- super(extension);
+ : assert(getter != null || setter != null);
@override
InstantiatedExtensionWithMember instantiate({
@@ -91,8 +90,7 @@
/// [_NotInstantiatedExtension] for any [ExtensionElement].
class _NotInstantiatedExtensionWithoutMember
extends _NotInstantiatedExtension<InstantiatedExtensionWithoutMember> {
- _NotInstantiatedExtensionWithoutMember(ExtensionElement extension)
- : super(extension);
+ _NotInstantiatedExtensionWithoutMember(super.extension);
@override
InstantiatedExtensionWithoutMember instantiate({
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
index e1c48ad..b9fcb2c 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
@@ -58,18 +58,13 @@
final SimpleIdentifierImpl? constructorName;
AnnotationInferrer(
- {required ResolverVisitor resolver,
- required AnnotationImpl node,
- required ArgumentListImpl argumentList,
- required DartType? contextType,
- required List<WhyNotPromotedGetter> whyNotPromotedList,
+ {required super.resolver,
+ required super.node,
+ required super.argumentList,
+ required super.contextType,
+ required super.whyNotPromotedList,
required this.constructorName})
- : super._(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ : super._();
@override
bool get _isConst => true;
@@ -108,17 +103,11 @@
abstract class FullInvocationInferrer<Node extends AstNodeImpl>
extends InvocationInferrer<Node> {
FullInvocationInferrer._(
- {required ResolverVisitor resolver,
- required Node node,
- required ArgumentListImpl argumentList,
- required DartType? contextType,
- required List<WhyNotPromotedGetter> whyNotPromotedList})
- : super(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ {required super.resolver,
+ required super.node,
+ required super.argumentList,
+ required super.contextType,
+ required super.whyNotPromotedList});
AstNode get _errorNode => node;
@@ -310,17 +299,12 @@
class FunctionExpressionInvocationInferrer
extends InvocationExpressionInferrer<FunctionExpressionInvocationImpl> {
FunctionExpressionInvocationInferrer(
- {required ResolverVisitor resolver,
- required FunctionExpressionInvocationImpl node,
- required ArgumentListImpl argumentList,
- required DartType? contextType,
- required List<WhyNotPromotedGetter> whyNotPromotedList})
- : super._(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ {required super.resolver,
+ required super.node,
+ required super.argumentList,
+ required super.contextType,
+ required super.whyNotPromotedList})
+ : super._();
@override
ExpressionImpl get _errorNode => node.function;
@@ -331,17 +315,12 @@
class InstanceCreationInferrer
extends FullInvocationInferrer<InstanceCreationExpressionImpl> {
InstanceCreationInferrer(
- {required ResolverVisitor resolver,
- required InstanceCreationExpressionImpl node,
- required ArgumentListImpl argumentList,
- required DartType? contextType,
- required List<WhyNotPromotedGetter> whyNotPromotedList})
- : super._(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ {required super.resolver,
+ required super.node,
+ required super.argumentList,
+ required super.contextType,
+ required super.whyNotPromotedList})
+ : super._();
@override
ConstructorNameImpl get _errorNode => node.constructorName;
@@ -388,17 +367,12 @@
Node extends InvocationExpressionImpl>
extends FullInvocationInferrer<Node> {
InvocationExpressionInferrer._(
- {required ResolverVisitor resolver,
- required Node node,
- required ArgumentListImpl argumentList,
- required DartType? contextType,
- required List<WhyNotPromotedGetter> whyNotPromotedList})
- : super._(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ {required super.resolver,
+ required super.node,
+ required super.argumentList,
+ required super.contextType,
+ required super.whyNotPromotedList})
+ : super._();
@override
Expression get _errorNode => node.function;
@@ -581,17 +555,12 @@
class MethodInvocationInferrer
extends InvocationExpressionInferrer<MethodInvocationImpl> {
MethodInvocationInferrer(
- {required ResolverVisitor resolver,
- required MethodInvocationImpl node,
- required ArgumentListImpl argumentList,
- required DartType? contextType,
- required List<WhyNotPromotedGetter> whyNotPromotedList})
- : super._(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ {required super.resolver,
+ required super.node,
+ required super.argumentList,
+ required super.contextType,
+ required super.whyNotPromotedList})
+ : super._();
@override
bool get _isIdentical {
@@ -645,8 +614,7 @@
final Object parameterKey;
_DeferredParamInfo(
- ParameterElement? parameter, this.value, this.index, this.parameterKey)
- : super(parameter);
+ super.parameter, this.value, this.index, this.parameterKey);
}
class _FunctionLiteralDependencies extends FunctionLiteralDependencies<
diff --git a/pkg/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart b/pkg/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart
index cfcb732..9beb6d3 100644
--- a/pkg/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart
+++ b/pkg/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart
@@ -197,6 +197,5 @@
class DocumentationWithSummary extends Documentation {
final String summary;
- DocumentationWithSummary({required String full, required this.summary})
- : super(full: full);
+ DocumentationWithSummary({required super.full, required this.summary});
}
diff --git a/pkg/analyzer/lib/src/error/analyzer_error_code.dart b/pkg/analyzer/lib/src/error/analyzer_error_code.dart
index 5d99bf3..9324223 100644
--- a/pkg/analyzer/lib/src/error/analyzer_error_code.dart
+++ b/pkg/analyzer/lib/src/error/analyzer_error_code.dart
@@ -8,18 +8,11 @@
abstract class AnalyzerErrorCode extends ErrorCode {
/// Initialize a newly created error code.
const AnalyzerErrorCode({
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
- required String name,
- required String problemMessage,
- required String uniqueName,
- }) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
- name: name,
- problemMessage: problemMessage,
- uniqueName: uniqueName,
- );
+ super.correctionMessage,
+ super.hasPublishedDocs,
+ super.isUnresolvedIdentifier,
+ required super.name,
+ required super.problemMessage,
+ required super.uniqueName,
+ });
}
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index 6b26d64..0dc4de5 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -4917,14 +4917,11 @@
const CompileTimeErrorCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'CompileTimeErrorCode.${uniqueName ?? name}',
@@ -5022,14 +5019,11 @@
const LanguageCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'LanguageCode.${uniqueName ?? name}',
@@ -5127,14 +5121,11 @@
const StaticWarningCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'StaticWarningCode.${uniqueName ?? name}',
diff --git a/pkg/analyzer/lib/src/exception/exception.dart b/pkg/analyzer/lib/src/exception/exception.dart
index 3033672..f75dd2f 100644
--- a/pkg/analyzer/lib/src/exception/exception.dart
+++ b/pkg/analyzer/lib/src/exception/exception.dart
@@ -11,8 +11,8 @@
final Map<String, String> fileContentMap;
CaughtExceptionWithFiles(
- Object exception,
- StackTrace stackTrace,
+ super.exception,
+ super.stackTrace,
this.fileContentMap,
- ) : super(exception, stackTrace);
+ );
}
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 878abf5..75532ee 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -2675,6 +2675,15 @@
}
@override
+ void handleAugmentSuperExpression(
+ Token augmentKeyword, Token superKeyword, IdentifierContext context) {
+ assert(optional('augment', augmentKeyword));
+ assert(optional('super', superKeyword));
+ debugEvent("AugmentSuperExpression");
+ throw UnimplementedError('AstBuilder.handleAugmentSuperExpression');
+ }
+
+ @override
void handleBreakStatement(
bool hasTarget, Token breakKeyword, Token semicolon) {
assert(optional('break', breakKeyword));
@@ -3937,7 +3946,6 @@
void handleSuperExpression(Token superKeyword, IdentifierContext context) {
assert(optional('super', superKeyword));
debugEvent("SuperExpression");
-
push(ast.superExpression(superKeyword));
}
diff --git a/pkg/analyzer/lib/src/lint/analysis.dart b/pkg/analyzer/lib/src/lint/analysis.dart
index b51a93a..e11bd6e 100644
--- a/pkg/analyzer/lib/src/lint/analysis.dart
+++ b/pkg/analyzer/lib/src/lint/analysis.dart
@@ -5,7 +5,6 @@
import 'dart:io' as io;
import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
import 'package:analyzer/src/analysis_options/analysis_options_provider.dart';
@@ -15,8 +14,6 @@
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/lint/io.dart';
import 'package:analyzer/src/lint/linter.dart';
-import 'package:analyzer/src/lint/project.dart';
-import 'package:analyzer/src/lint/registry.dart';
import 'package:analyzer/src/task/options.dart';
import 'package:yaml/yaml.dart';
@@ -124,18 +121,9 @@
},
);
- AnalysisSession? projectAnalysisSession;
for (io.File file in files) {
var path = _absoluteNormalizedPath(file.path);
_filesAnalyzed.add(path);
- var analysisContext = contextCollection.contextFor(path);
- var analysisSession = analysisContext.currentSession;
- projectAnalysisSession = analysisSession;
- }
-
- if (projectAnalysisSession != null) {
- // ignore: deprecated_member_use_from_same_package
- await _visitProject(projectAnalysisSession);
}
var result = <AnalysisErrorInfo>[];
@@ -161,24 +149,6 @@
path = pathContext.normalize(path);
return path;
}
-
- @Deprecated('DartProject is deprecated. This is slated for removal')
- Future<void> _visitProject(AnalysisSession projectAnalysisSession) async {
- Future<DartProject> createProject() async {
- return await DartProject.create(
- projectAnalysisSession,
- _filesAnalyzed.toList(),
- );
- }
-
- DartProject? project;
- for (var lint in Registry.ruleRegistry) {
- if (lint is ProjectVisitor) {
- project ??= await createProject();
- (lint as ProjectVisitor).visit(project);
- }
- }
- }
}
/// Prints logging information comments to the [outSink] and error messages to
diff --git a/pkg/analyzer/lib/src/lint/linter.dart b/pkg/analyzer/lib/src/lint/linter.dart
index bbbb005..11e023e 100644
--- a/pkg/analyzer/lib/src/lint/linter.dart
+++ b/pkg/analyzer/lib/src/lint/linter.dart
@@ -35,7 +35,6 @@
import 'package:analyzer/src/lint/config.dart';
import 'package:analyzer/src/lint/io.dart';
import 'package:analyzer/src/lint/linter_visitor.dart' show NodeLintRegistry;
-import 'package:analyzer/src/lint/project.dart';
import 'package:analyzer/src/lint/pub.dart';
import 'package:analyzer/src/lint/registry.dart';
import 'package:analyzer/src/services/lint.dart' show Linter;
@@ -627,11 +626,6 @@
return name.compareTo(other.name);
}
- /// Return a visitor to be passed to provide access to Dart project context
- /// and to perform project-level analyses.
- @Deprecated('Use LinterContext instead')
- ProjectVisitor? getProjectVisitor() => null;
-
/// Return a visitor to be passed to pubspecs to perform lint
/// analysis.
/// Lint errors are reported via this [Linter]'s error [reporter].
@@ -875,7 +869,7 @@
return registry[name + message] ??= _LintCode._(name, message);
}
- _LintCode._(String name, String message) : super(name, message);
+ _LintCode._(super.name, super.message);
}
/// The state of a [LinterNameInScopeResolutionResult].
diff --git a/pkg/analyzer/lib/src/lint/linter_visitor.dart b/pkg/analyzer/lib/src/lint/linter_visitor.dart
index b08cc00..3383df0 100644
--- a/pkg/analyzer/lib/src/lint/linter_visitor.dart
+++ b/pkg/analyzer/lib/src/lint/linter_visitor.dart
@@ -9,7 +9,10 @@
import 'package:analyzer/src/services/lint.dart';
/// The type of the function that handles exceptions in lints.
-typedef LintRuleExceptionHandler = void Function(
+///
+/// Returns `true` if the exception was fully handled, or `false` if
+/// the exception should be rethrown.
+typedef LintRuleExceptionHandler = bool Function(
AstNode node, LintRule linter, dynamic exception, StackTrace stackTrace);
/// The AST visitor that runs handlers for nodes from the [registry].
@@ -769,7 +772,10 @@
try {
node.accept(subscription.visitor);
} catch (exception, stackTrace) {
- exceptionHandler(node, subscription.linter, exception, stackTrace);
+ if (!exceptionHandler(
+ node, subscription.linter, exception, stackTrace)) {
+ rethrow;
+ }
}
timer?.stop();
}
diff --git a/pkg/analyzer/lib/src/lint/project.dart b/pkg/analyzer/lib/src/lint/project.dart
deleted file mode 100644
index 17f95be..0000000
--- a/pkg/analyzer/lib/src/lint/project.dart
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) 2015, 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.
-
-import 'dart:io';
-
-import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/dart/analysis/session.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/src/dart/resolver/scope.dart';
-import 'package:analyzer/src/lint/io.dart';
-import 'package:analyzer/src/lint/pub.dart';
-import 'package:collection/collection.dart';
-import 'package:path/path.dart' as p;
-
-Pubspec? _findAndParsePubspec(Directory root) {
- if (root.existsSync()) {
- var pubspec = root
- .listSync(followLinks: false)
- .whereType<File>()
- .firstWhereOrNull((f) => isPubspecFile(f));
- if (pubspec != null) {
- return Pubspec.parse(pubspec.readAsStringSync(),
- sourceUrl: p.toUri(pubspec.path));
- }
- }
- return null;
-}
-
-/// A semantic representation of a Dart project.
-///
-/// Projects provide a semantic model of a Dart project based on the
-/// [pub package layout conventions](https://dart.dev/tools/pub/package-layout).
-/// This model allows clients to traverse project contents in a convenient and
-/// standardized way, access global information (such as whether elements are
-/// in the "public API") and resources that have special meanings in the
-/// context of pub package layout conventions.
-@Deprecated('Use LinterContext instead')
-class DartProject {
- late final _ApiModel _apiModel;
- String? _name;
- Pubspec? _pubspec;
-
- /// Project root.
- final Directory root;
-
- /// Create a Dart project for the corresponding [analysisSession] and [files].
- /// If a [dir] is unspecified the current working directory will be
- /// used.
- ///
- /// Note: clients should call [create] which performs API model initialization.
- DartProject._(AnalysisSession analysisSession, List<String> files,
- {Directory? dir})
- : root = dir ?? Directory.current {
- _pubspec = _findAndParsePubspec(root);
- _apiModel = _ApiModel(analysisSession, files, root);
- }
-
- /// The project's name.
- ///
- /// Project names correspond to the package name as specified in the project's
- /// [pubspec]. The pubspec is found relative to the project [root]. If no
- /// pubspec can be found, the name defaults to the project root basename.
- String get name => _name ??= _calculateName();
-
- /// The project's pubspec.
- Pubspec? get pubspec => _pubspec;
-
- /// Returns `true` if the given element is part of this project's public API.
- ///
- /// Public API elements are defined as all elements that are in the packages's
- /// `lib` directory, *less* those in `lib/src` (which are treated as private
- /// *implementation files*), plus elements having been explicitly exported
- /// via an `export` directive.
- bool isApi(Element element) => _apiModel.contains(element);
-
- String _calculateName() {
- final pubspec = this.pubspec;
- if (pubspec != null) {
- var nameEntry = pubspec.name;
- if (nameEntry != null) {
- return nameEntry.value.text!;
- }
- }
- return p.basename(root.path);
- }
-
- /// Create an initialized Dart project for the corresponding [analysisSession]
- /// and [files].
- /// If a [dir] is unspecified the current working directory will be
- /// used.
- static Future<DartProject> create(
- AnalysisSession analysisSession, List<String> files,
- {Directory? dir}) async {
- DartProject project = DartProject._(analysisSession, files, dir: dir);
- await project._apiModel._calculate();
- return project;
- }
-}
-
-/// An object that can be used to visit Dart project structure.
-@Deprecated('Use LinterContext instead')
-abstract class ProjectVisitor<T> {
- T? visit(DartProject project) => null;
-}
-
-/// Captures the project's API as defined by pub package layout standards.
-class _ApiModel {
- final AnalysisSession analysisSession;
- final List<String> files;
- final Directory root;
- final Set<Element> elements = {};
-
- _ApiModel(this.analysisSession, this.files, this.root) {
- _calculate();
- }
-
- /// Return `true` if this element is part of the public API for this package.
- bool contains(Element? element) {
- while (element != null) {
- if (!element.isPrivate && elements.contains(element)) {
- return true;
- }
- element = element.enclosingElement;
- }
- return false;
- }
-
- Future<void> _calculate() async {
- if (files.isEmpty) {
- return;
- }
-
- String libDir = '${root.path}/lib';
- String libSrcDir = '$libDir/src';
-
- for (var file in files) {
- if (file.startsWith(libDir) && !file.startsWith(libSrcDir)) {
- var result = await analysisSession.getResolvedUnit(file);
- if (result is ResolvedUnitResult) {
- LibraryElement library = result.libraryElement;
-
- NamespaceBuilder namespaceBuilder = NamespaceBuilder();
- Namespace exports =
- namespaceBuilder.createExportNamespaceForLibrary(library);
- Namespace public =
- namespaceBuilder.createPublicNamespaceForLibrary(library);
- elements.addAll(exports.definedNames.values);
- elements.addAll(public.definedNames.values);
- }
- }
- }
- }
-}
diff --git a/pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart b/pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
index 8fc1f98..a33a561 100644
--- a/pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
+++ b/pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
@@ -94,14 +94,11 @@
const ManifestWarningCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'ManifestWarningCode.${uniqueName ?? name}',
diff --git a/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart b/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
index 7ca6652..11726f9 100644
--- a/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
+++ b/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
@@ -146,14 +146,11 @@
const PubspecWarningCode(
String name,
String problemMessage, {
- String? correctionMessage,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
+ super.correctionMessage,
+ super.hasPublishedDocs = false,
+ super.isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correctionMessage: correctionMessage,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
name: name,
problemMessage: problemMessage,
uniqueName: 'PubspecWarningCode.${uniqueName ?? name}',
diff --git a/pkg/analyzer/lib/src/pubspec/validators/dependency_validator.dart b/pkg/analyzer/lib/src/pubspec/validators/dependency_validator.dart
index e091ea27..d778d3b 100644
--- a/pkg/analyzer/lib/src/pubspec/validators/dependency_validator.dart
+++ b/pkg/analyzer/lib/src/pubspec/validators/dependency_validator.dart
@@ -3,8 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/error/listener.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/pubspec/pubspec_validator.dart';
import 'package:analyzer/src/pubspec/pubspec_warning_code.dart';
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
@@ -13,8 +11,7 @@
import 'package:yaml/yaml.dart';
class DependencyValidator extends BasePubspecValidator {
- DependencyValidator(ResourceProvider provider, Source source)
- : super(provider, source);
+ DependencyValidator(super.provider, super.source);
/// Validate the value of the required `name` field.
void validate(ErrorReporter reporter, Map<dynamic, YamlNode> contents) {
diff --git a/pkg/analyzer/lib/src/pubspec/validators/field_validator.dart b/pkg/analyzer/lib/src/pubspec/validators/field_validator.dart
index 1d2ac0e..49bbc30 100644
--- a/pkg/analyzer/lib/src/pubspec/validators/field_validator.dart
+++ b/pkg/analyzer/lib/src/pubspec/validators/field_validator.dart
@@ -3,8 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/error/listener.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/pubspec/pubspec_validator.dart';
import 'package:analyzer/src/pubspec/pubspec_warning_code.dart';
import 'package:yaml/yaml.dart';
@@ -17,8 +15,7 @@
'web',
];
- FieldValidator(ResourceProvider provider, Source source)
- : super(provider, source);
+ FieldValidator(super.provider, super.source);
/// Validate fields.
void validate(ErrorReporter reporter, Map<dynamic, YamlNode> contents) {
diff --git a/pkg/analyzer/lib/src/pubspec/validators/flutter_validator.dart b/pkg/analyzer/lib/src/pubspec/validators/flutter_validator.dart
index 83f9fc7..a3298b8 100644
--- a/pkg/analyzer/lib/src/pubspec/validators/flutter_validator.dart
+++ b/pkg/analyzer/lib/src/pubspec/validators/flutter_validator.dart
@@ -5,15 +5,13 @@
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/pubspec/pubspec_validator.dart';
import 'package:analyzer/src/pubspec/pubspec_warning_code.dart';
import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart';
class FlutterValidator extends BasePubspecValidator {
- FlutterValidator(ResourceProvider provider, Source source)
- : super(provider, source);
+ FlutterValidator(super.provider, super.source);
/// Validate the value of the optional `flutter` field.
void validate(ErrorReporter reporter, Map<dynamic, YamlNode> contents) {
diff --git a/pkg/analyzer/lib/src/pubspec/validators/name_validator.dart b/pkg/analyzer/lib/src/pubspec/validators/name_validator.dart
index 9564ab7..921576e 100644
--- a/pkg/analyzer/lib/src/pubspec/validators/name_validator.dart
+++ b/pkg/analyzer/lib/src/pubspec/validators/name_validator.dart
@@ -3,15 +3,12 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/error/listener.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/pubspec/pubspec_validator.dart';
import 'package:analyzer/src/pubspec/pubspec_warning_code.dart';
import 'package:yaml/yaml.dart';
class NameValidator extends BasePubspecValidator {
- NameValidator(ResourceProvider provider, Source source)
- : super(provider, source);
+ NameValidator(super.provider, super.source);
/// Validate the value of the required `name` field.
void validate(ErrorReporter reporter, Map<dynamic, YamlNode> contents) {
diff --git a/pkg/analyzer/lib/src/summary/flat_buffers.dart b/pkg/analyzer/lib/src/summary/flat_buffers.dart
index 1624f4c..0dfd67c 100644
--- a/pkg/analyzer/lib/src/summary/flat_buffers.dart
+++ b/pkg/analyzer/lib/src/summary/flat_buffers.dart
@@ -719,7 +719,7 @@
/// The list backed by 64-bit values - Uint64 length and Float64.
class _FbFloat64List extends _FbList<double> {
- _FbFloat64List(BufferContext bc, int offset) : super(bc, offset);
+ _FbFloat64List(super.bc, super.offset);
@override
double operator [](int i) {
@@ -771,7 +771,7 @@
/// List backed by 32-bit unsigned integers.
class _FbUint32List extends _FbList<int> {
- _FbUint32List(BufferContext bc, int offset) : super(bc, offset);
+ _FbUint32List(super.bc, super.offset);
@override
int operator [](int i) {
@@ -781,7 +781,7 @@
/// List backed by 8-bit unsigned integers.
class _FbUint8List extends _FbList<int> {
- _FbUint8List(BufferContext bc, int offset) : super(bc, offset);
+ _FbUint8List(super.bc, super.offset);
@override
int operator [](int i) {
diff --git a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
index 490ebef..34780d5 100644
--- a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
@@ -65,7 +65,7 @@
/// The summary file where this source was defined.
final String summaryPath;
- InSummarySource(Uri uri, this.summaryPath) : super(uri);
+ InSummarySource(super.uri, this.summaryPath);
@override
TimestampedData<String> get contents => TimestampedData<String>(0, '');
diff --git a/pkg/analyzer/lib/src/summary2/bundle_writer.dart b/pkg/analyzer/lib/src/summary2/bundle_writer.dart
index 80f6e6b..4b3e6c3 100644
--- a/pkg/analyzer/lib/src/summary2/bundle_writer.dart
+++ b/pkg/analyzer/lib/src/summary2/bundle_writer.dart
@@ -505,14 +505,10 @@
final _LocalElementIndexer localElements = _LocalElementIndexer();
ResolutionSink({
- required ByteSink sink,
- required StringIndexer stringIndexer,
+ required super.sink,
+ required super.stringIndexer,
required _BundleWriterReferences references,
- }) : _references = references,
- super(
- sink: sink,
- stringIndexer: stringIndexer,
- );
+ }) : _references = references;
/// TODO(scheglov) Triage places where we write elements.
/// Some of then cannot be members, e.g. type names.
diff --git a/pkg/analyzer/lib/src/summary2/macro_application_error.dart b/pkg/analyzer/lib/src/summary2/macro_application_error.dart
index de56919..46e7dcd 100644
--- a/pkg/analyzer/lib/src/summary2/macro_application_error.dart
+++ b/pkg/analyzer/lib/src/summary2/macro_application_error.dart
@@ -12,11 +12,10 @@
final String message;
ArgumentMacroApplicationError({
- required int annotationIndex,
+ required super.annotationIndex,
required this.argumentIndex,
required this.message,
}) : super._(
- annotationIndex: annotationIndex,
kind: MacroApplicationErrorKind.argument,
);
@@ -98,11 +97,10 @@
final String stackTrace;
UnknownMacroApplicationError({
- required int annotationIndex,
+ required super.annotationIndex,
required this.message,
required this.stackTrace,
}) : super._(
- annotationIndex: annotationIndex,
kind: MacroApplicationErrorKind.unknown,
);
diff --git a/pkg/analyzer/lib/src/summary2/macro_declarations.dart b/pkg/analyzer/lib/src/summary2/macro_declarations.dart
index f855d8b..2a097a8 100644
--- a/pkg/analyzer/lib/src/summary2/macro_declarations.dart
+++ b/pkg/analyzer/lib/src/summary2/macro_declarations.dart
@@ -15,24 +15,15 @@
late final ClassElement element;
ClassDeclarationImpl._({
- required int id,
- required macro.IdentifierImpl identifier,
- required List<macro.TypeParameterDeclarationImpl> typeParameters,
- required List<macro.TypeAnnotationImpl> interfaces,
- required bool isAbstract,
- required bool isExternal,
- required List<macro.TypeAnnotationImpl> mixins,
- required macro.TypeAnnotationImpl? superclass,
- }) : super(
- id: id,
- identifier: identifier,
- typeParameters: typeParameters,
- interfaces: interfaces,
- isAbstract: isAbstract,
- isExternal: isExternal,
- mixins: mixins,
- superclass: superclass,
- );
+ required super.id,
+ required super.identifier,
+ required super.typeParameters,
+ required super.interfaces,
+ required super.isAbstract,
+ required super.isExternal,
+ required super.mixins,
+ required super.superclass,
+ });
}
class DeclarationBuilder {
@@ -270,7 +261,7 @@
return macro.TypeParameterDeclarationImpl(
id: macro.RemoteInstance.uniqueId,
identifier: _identifier(node.name),
- bound: node.bound?.mapOrNull(_typeAnnotation),
+ bound: node.bound.mapOrNull(_typeAnnotation),
);
}
@@ -287,31 +278,21 @@
class FieldDeclarationImpl extends macro.FieldDeclarationImpl {
FieldDeclarationImpl({
- required int id,
- required macro.IdentifierImpl identifier,
- required bool isExternal,
- required bool isFinal,
- required bool isLate,
- required macro.TypeAnnotationImpl type,
- required macro.IdentifierImpl definingClass,
- required bool isStatic,
- }) : super(
- id: id,
- identifier: identifier,
- isExternal: isExternal,
- isFinal: isFinal,
- isLate: isLate,
- type: type,
- definingClass: definingClass,
- isStatic: isStatic,
- );
+ required super.id,
+ required super.identifier,
+ required super.isExternal,
+ required super.isFinal,
+ required super.isLate,
+ required super.type,
+ required super.definingClass,
+ required super.isStatic,
+ });
}
class IdentifierImpl extends macro.IdentifierImpl {
late final Element? element;
- IdentifierImpl({required int id, required String name})
- : super(id: id, name: name);
+ IdentifierImpl({required super.id, required super.name});
}
extension<T> on T? {
diff --git a/pkg/analyzer/lib/src/summary2/package_bundle_reader.dart b/pkg/analyzer/lib/src/summary2/package_bundle_reader.dart
index ec05912..c0ac1e5 100644
--- a/pkg/analyzer/lib/src/summary2/package_bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary2/package_bundle_reader.dart
@@ -2,10 +2,8 @@
// 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.
-import 'dart:typed_data';
-
import 'package:analyzer/src/summary2/package_bundle_format.dart';
class PackageBundle extends PackageBundleReader {
- PackageBundle.fromBuffer(Uint8List bytes) : super(bytes);
+ PackageBundle.fromBuffer(super.bytes);
}
diff --git a/pkg/analyzer/lib/src/util/performance/operation_performance.dart b/pkg/analyzer/lib/src/util/performance/operation_performance.dart
index b3f6b38..7c510eb 100644
--- a/pkg/analyzer/lib/src/util/performance/operation_performance.dart
+++ b/pkg/analyzer/lib/src/util/performance/operation_performance.dart
@@ -56,7 +56,7 @@
@override
int value = 0;
- OperationPerformanceDataImpl_int(String name) : super(name);
+ OperationPerformanceDataImpl_int(super.name);
void add(int item) {
value += item;
diff --git a/pkg/analyzer/test/generated/parser_fasta_listener.dart b/pkg/analyzer/test/generated/parser_fasta_listener.dart
index 1b59a3a..a9606e7 100644
--- a/pkg/analyzer/test/generated/parser_fasta_listener.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_listener.dart
@@ -30,7 +30,7 @@
class ForwardingTestListener extends ForwardingListener {
final _stack = <String>[];
- ForwardingTestListener([Listener? listener]) : super(listener);
+ ForwardingTestListener([super.listener]);
void begin(String event) {
expect(event, isNotNull);
diff --git a/pkg/analyzer/test/id_tests/assigned_variables_test.dart b/pkg/analyzer/test/id_tests/assigned_variables_test.dart
index bc1eab7..5107df9 100644
--- a/pkg/analyzer/test/id_tests/assigned_variables_test.dart
+++ b/pkg/analyzer/test/id_tests/assigned_variables_test.dart
@@ -53,9 +53,7 @@
AssignedVariablesForTesting<AstNode, PromotableElement>?
_currentAssignedVariables;
- _AssignedVariablesDataExtractor(
- Uri uri, Map<Id, ActualData<_Data>> actualMap, this._flowResult)
- : super(uri, actualMap);
+ _AssignedVariablesDataExtractor(super.uri, super.actualMap, this._flowResult);
@override
_Data? computeNodeValue(Id id, AstNode node) {
diff --git a/pkg/analyzer/test/id_tests/constant_test.dart b/pkg/analyzer/test/id_tests/constant_test.dart
index 10a1825..703d860 100644
--- a/pkg/analyzer/test/id_tests/constant_test.dart
+++ b/pkg/analyzer/test/id_tests/constant_test.dart
@@ -55,8 +55,7 @@
}
class ConstantsDataExtractor extends AstDataExtractor<String> {
- ConstantsDataExtractor(Uri uri, Map<Id, ActualData<String>> actualMap)
- : super(uri, actualMap);
+ ConstantsDataExtractor(super.uri, super.actualMap);
@override
String? computeNodeValue(Id id, AstNode node) {
diff --git a/pkg/analyzer/test/id_tests/definite_assignment_test.dart b/pkg/analyzer/test/id_tests/definite_assignment_test.dart
index 7d920ab..42a17e3 100644
--- a/pkg/analyzer/test/id_tests/definite_assignment_test.dart
+++ b/pkg/analyzer/test/id_tests/definite_assignment_test.dart
@@ -62,8 +62,7 @@
final FlowAnalysisDataForTesting _flowResult;
_DefiniteAssignmentDataExtractor(
- Uri uri, Map<Id, ActualData<String>> actualMap, this._flowResult)
- : super(uri, actualMap);
+ super.uri, super.actualMap, this._flowResult);
@override
String? computeNodeValue(Id id, AstNode node) {
diff --git a/pkg/analyzer/test/id_tests/definite_unassignment_test.dart b/pkg/analyzer/test/id_tests/definite_unassignment_test.dart
index f17d8e2..a6dae8f 100644
--- a/pkg/analyzer/test/id_tests/definite_unassignment_test.dart
+++ b/pkg/analyzer/test/id_tests/definite_unassignment_test.dart
@@ -62,8 +62,7 @@
final FlowAnalysisDataForTesting _flowResult;
_DefiniteUnassignmentDataExtractor(
- Uri uri, Map<Id, ActualData<String>> actualMap, this._flowResult)
- : super(uri, actualMap);
+ super.uri, super.actualMap, this._flowResult);
@override
String? computeNodeValue(Id id, AstNode node) {
diff --git a/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart b/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart
index 2ba48a6..ad1e1fc 100644
--- a/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart
+++ b/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart
@@ -46,9 +46,7 @@
class _InferredTypeArgumentsDataExtractor
extends AstDataExtractor<List<DartType>> {
- _InferredTypeArgumentsDataExtractor(
- Uri uri, Map<Id, ActualData<List<DartType>>> actualMap)
- : super(uri, actualMap);
+ _InferredTypeArgumentsDataExtractor(super.uri, super.actualMap);
@override
List<DartType>? computeNodeValue(Id id, AstNode node) {
diff --git a/pkg/analyzer/test/id_tests/inferred_variable_types_test.dart b/pkg/analyzer/test/id_tests/inferred_variable_types_test.dart
index 94b3771..e4a4ed6 100644
--- a/pkg/analyzer/test/id_tests/inferred_variable_types_test.dart
+++ b/pkg/analyzer/test/id_tests/inferred_variable_types_test.dart
@@ -45,9 +45,7 @@
}
class _InferredVariableTypesDataExtractor extends AstDataExtractor<DartType> {
- _InferredVariableTypesDataExtractor(
- Uri uri, Map<Id, ActualData<DartType>> actualMap)
- : super(uri, actualMap);
+ _InferredVariableTypesDataExtractor(super.uri, super.actualMap);
@override
DartType? computeNodeValue(Id id, AstNode node) {
diff --git a/pkg/analyzer/test/id_tests/inheritance_test.dart b/pkg/analyzer/test/id_tests/inheritance_test.dart
index 08756c3..8e08527 100644
--- a/pkg/analyzer/test/id_tests/inheritance_test.dart
+++ b/pkg/analyzer/test/id_tests/inheritance_test.dart
@@ -76,8 +76,7 @@
class _InheritanceDataExtractor extends AstDataExtractor<String> {
final inheritance = InheritanceManager3();
- _InheritanceDataExtractor(Uri uri, Map<Id, ActualData<String>> actualMap)
- : super(uri, actualMap);
+ _InheritanceDataExtractor(super.uri, super.actualMap);
@override
String? computeElementValue(Id id, Element element) {
diff --git a/pkg/analyzer/test/id_tests/nullability_test.dart b/pkg/analyzer/test/id_tests/nullability_test.dart
index 659e605..0b70277 100644
--- a/pkg/analyzer/test/id_tests/nullability_test.dart
+++ b/pkg/analyzer/test/id_tests/nullability_test.dart
@@ -47,9 +47,7 @@
class _NullabilityDataExtractor extends AstDataExtractor<String> {
final TypeSystem _typeSystem;
- _NullabilityDataExtractor(
- Uri uri, Map<Id, ActualData<String>> actualMap, this._typeSystem)
- : super(uri, actualMap);
+ _NullabilityDataExtractor(super.uri, super.actualMap, this._typeSystem);
@override
String? computeNodeValue(Id id, AstNode node) {
diff --git a/pkg/analyzer/test/id_tests/reachability_test.dart b/pkg/analyzer/test/id_tests/reachability_test.dart
index 6997d16..829faf8 100644
--- a/pkg/analyzer/test/id_tests/reachability_test.dart
+++ b/pkg/analyzer/test/id_tests/reachability_test.dart
@@ -51,11 +51,7 @@
extends AstDataExtractor<Set<_ReachabilityAssertion>> {
final FlowAnalysisDataForTesting _flowResult;
- _ReachabilityDataExtractor(
- Uri uri,
- Map<Id, ActualData<Set<_ReachabilityAssertion>>> actualMap,
- this._flowResult)
- : super(uri, actualMap);
+ _ReachabilityDataExtractor(super.uri, super.actualMap, this._flowResult);
@override
Set<_ReachabilityAssertion>? computeNodeValue(Id id, AstNode node) {
diff --git a/pkg/analyzer/test/id_tests/type_promotion_test.dart b/pkg/analyzer/test/id_tests/type_promotion_test.dart
index 0f7f189..d7cfb0d 100644
--- a/pkg/analyzer/test/id_tests/type_promotion_test.dart
+++ b/pkg/analyzer/test/id_tests/type_promotion_test.dart
@@ -42,8 +42,7 @@
}
class _TypePromotionDataExtractor extends AstDataExtractor<DartType> {
- _TypePromotionDataExtractor(Uri uri, Map<Id, ActualData<DartType>> actualMap)
- : super(uri, actualMap);
+ _TypePromotionDataExtractor(super.uri, super.actualMap);
@override
DartType? computeNodeValue(Id id, AstNode node) {
diff --git a/pkg/analyzer/test/id_tests/why_not_promoted_test.dart b/pkg/analyzer/test/id_tests/why_not_promoted_test.dart
index 2f8e046..f5a83c7 100644
--- a/pkg/analyzer/test/id_tests/why_not_promoted_test.dart
+++ b/pkg/analyzer/test/id_tests/why_not_promoted_test.dart
@@ -49,9 +49,7 @@
class _WhyNotPromotedDataExtractor extends AstDataExtractor<String?> {
final FlowAnalysisDataForTesting _flowResult;
- _WhyNotPromotedDataExtractor(
- Uri uri, Map<Id, ActualData<String?>> actualMap, this._flowResult)
- : super(uri, actualMap);
+ _WhyNotPromotedDataExtractor(super.uri, super.actualMap, this._flowResult);
@override
String? computeNodeValue(Id id, AstNode node) {
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 5a963a6..5ceb724 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -2509,29 +2509,6 @@
expect(driver.fsState.knownFilePaths, unorderedEquals([b]));
}
- test_parseFileSync_doesNotReadPartedFiles() async {
- var a = convertPath('/test/lib/a.dart');
- var b = convertPath('/test/lib/b.dart');
-
- newFile(a, r'''
-part of my;
-''');
- newFile(b, r'''
-library my;
-part 'a.dart';
-''');
-
- expect(driver.fsState.knownFilePaths, isEmpty);
-
- // Don't read `a.dart` when parse.
- driver.parseFileSync(b);
- expect(driver.fsState.knownFilePaths, unorderedEquals([b]));
-
- // Still don't read `a.dart` when parse the second time.
- driver.parseFileSync(b);
- expect(driver.fsState.knownFilePaths, unorderedEquals([b]));
- }
-
test_parseFileSync_languageVersion() async {
var path = convertPath('/test/lib/test.dart');
diff --git a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
index 2ec38e5..0070cbe 100644
--- a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
@@ -36,6 +36,7 @@
defineReflectiveSuite(() {
defineReflectiveTests(FileSystemStateTest);
defineReflectiveTests(FileSystemState_BazelWorkspaceTest);
+ defineReflectiveTests(FileSystemState_PubPackageTest);
});
}
@@ -119,6 +120,585 @@
}
@reflectiveTest
+class FileSystemState_PubPackageTest extends PubPackageResolutionTest {
+ FileState fileStateFor(File file) {
+ return fsStateFor(file).getFileForPath(file.path);
+ }
+
+ FileSystemState fsStateFor(File file) {
+ return driverFor(file.path).fsState;
+ }
+
+ test_newFile_library_includePart_withoutPartOf() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+// no part of
+''');
+
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+
+ // Library `a.dart` includes `b.dart` as a part.
+ _assertPartedFiles(aState, [b]);
+
+ // But `b.dart` thinks that it is a library itself.
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+
+ // Refreshing the library does not change this.
+ aState.refresh();
+ _assertPartedFiles(aState, [b]);
+ bState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+ }
+
+ test_newFile_libraryAugmentation_invalid() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+library augment 'da:';
+''');
+
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryAugmentationUnknownFileStateKind;
+ });
+ }
+
+ /// TODO(scheglov) implement
+ @FailingTest(reason: 'No import augment directive')
+ test_newFile_libraryAugmentation_valid() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+import augment 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/a.dart', r'''
+library augment 'a.dart';
+''');
+
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as LibraryAugmentationKnownFileStateKind;
+ final aState = fileStateFor(a);
+ expect(kind.augmented, same(aState));
+ });
+ }
+
+ test_newFile_libraryDirective() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+library my;
+''');
+
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+ }
+
+ test_newFile_noDirectives() async {
+ final a = newFile('$testPackageLibPath/a.dart', '');
+
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+ }
+
+ test_newFile_partOfName() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+library my.lib;
+part 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part of my.lib;
+''');
+
+ final bState = fileStateFor(b);
+
+ // We don't know the library initially.
+ // Even though the library file exists, we have not seen it yet.
+ bState.assertKind((kind) {
+ kind as PartUnknownNameFileStateKind;
+ expect(kind.directive.name, 'my.lib');
+ });
+
+ // Read the library file.
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+ _assertPartedFiles(aState, [b]);
+
+ // Now the part knows its library.
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, same(aState));
+ });
+ }
+
+ test_newFile_partOfName_differentName() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+library my.lib;
+part 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part of other.lib;
+''');
+
+ final bState = fileStateFor(b);
+
+ // We don't know the library initially.
+ // Even though the library file exists, we have not seen it yet.
+ bState.assertKind((kind) {
+ kind as PartUnknownNameFileStateKind;
+ expect(kind.directive.name, 'other.lib');
+ });
+
+ // Read the library file.
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+ _assertPartedFiles(aState, [b]);
+
+ // Now the part knows its library.
+ // The name of the library in the part file does not matter.
+ // What counts is that the library includes it.
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, same(aState));
+ });
+ }
+
+ test_newFile_partOfName_twoLibraries() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part 'c.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part 'c.dart';
+''');
+
+ final c = newFile('$testPackageLibPath/c.dart', r'''
+part of 'doesNotMatter.dart';
+''');
+
+ final aState = fileStateFor(a);
+ _assertPartedFiles(aState, [c]);
+
+ // We set the library while reading `a.dart` file.
+ final cState = fileStateFor(c);
+ cState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, aState);
+ });
+
+ // Reading `b.dart` does not update the part.
+ final bState = fileStateFor(b);
+ _assertPartedFiles(bState, [c]);
+ cState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, aState);
+ });
+
+ // Refreshing `b.dart` does not update the part.
+ bState.refresh();
+ cState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, aState);
+ });
+
+ // Exclude the part from `a.dart` - switches to `b.dart` as its library.
+ newFile(a.path, '');
+ aState.refresh();
+ cState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, bState);
+ });
+
+ // Exclude the part from `b.dart` as well - switches to unknown.
+ newFile(b.path, '');
+ bState.refresh();
+ cState.assertKind((kind) {
+ kind as PartUnknownUriFileStateKind;
+ });
+ }
+
+ test_newFile_partOfUri_doesNotExist() async {
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part of 'a.dart';
+''');
+
+ final bState = fileStateFor(b);
+
+ // If the library does not part the file, it does not matter what the
+ // part file says - the part file will not be analyzed during the library
+ // analysis.
+ bState.assertKind((kind) {
+ kind as PartUnknownUriFileStateKind;
+ });
+
+ // Create the library that includes the part file.
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part 'b.dart';
+''');
+
+ // The library file has already been read because of `part of uri`.
+ // So, we explicitly refresh it.
+ final aState = fileStateFor(a);
+ aState.refresh();
+ _assertPartedFiles(aState, [b]);
+
+ // Now the part file knows its library.
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, same(aState));
+ });
+
+ // Refreshing the part file does not break the kind.
+ bState.refresh();
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, same(aState));
+ });
+ }
+
+ test_newFile_partOfUri_exists_hasPart() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part of 'a.dart';
+''');
+
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ // We have not read the library file explicitly yet.
+ // But it was read because of the `part of` directive.
+ final aState = fileStateFor(a);
+ _assertPartedFiles(aState, [b]);
+ expect(kind.library, same(aState));
+ });
+
+ // Refreshing the part file does not break the kind.
+ bState.refresh();
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ final aState = fileStateFor(a);
+ expect(kind.library, same(aState));
+ });
+ }
+
+ test_newFile_partOfUri_exists_noPart() async {
+ newFile('$testPackageLibPath/a.dart', '');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part of 'a.dart';
+''');
+
+ final bState = fileStateFor(b);
+
+ // If the library does not part the file, it does not matter what the
+ // part file says - the part file will not be analyzed during the library
+ // analysis.
+ bState.assertKind((kind) {
+ kind as PartUnknownUriFileStateKind;
+ });
+ }
+
+ test_newFile_partOfUri_invalid() async {
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part of 'da:';
+''');
+
+ final bState = fileStateFor(b);
+
+ // The URI is invalid, so there is no way to discover the library.
+ bState.assertKind((kind) {
+ kind as PartUnknownUriFileStateKind;
+ expect(kind.directive.uri, 'da:');
+ });
+
+ // But reading a library that includes this part will update it.
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part 'b.dart';
+''');
+ final aState = fileStateFor(a);
+ _assertPartedFiles(aState, [b]);
+
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, same(aState));
+ });
+ }
+
+ test_refresh_library_removePart_partOfName() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part of my;
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part of my;
+''');
+
+ final c = newFile('$testPackageLibPath/c.dart', r'''
+library my;
+part 'a.dart';
+part 'b.dart';
+''');
+
+ final cState = fileStateFor(c);
+ cState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+ _assertPartedFiles(cState, [a, b]);
+
+ final aState = fileStateFor(a);
+ final bState = fileStateFor(b);
+
+ // Both part files know the library.
+ aState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, cState);
+ });
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, cState);
+ });
+
+ newFile(c.path, r'''
+library my;
+part 'b.dart';
+''');
+
+ // Stop referencing `a.dart` part file.
+ cState.refresh();
+ _assertPartedFiles(cState, [b]);
+
+ // So, the `a.dart` does not know its library anymore.
+ // But `b.dart` still knows it.
+ aState.assertKind((kind) {
+ kind as PartUnknownNameFileStateKind;
+ });
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, cState);
+ });
+ }
+
+ test_refresh_library_removePart_partOfUri() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part of 'test.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part of 'test.dart';
+''');
+
+ final c = newFile('$testPackageLibPath/c.dart', r'''
+library my;
+part 'a.dart';
+part 'b.dart';
+''');
+
+ final cState = fileStateFor(c);
+ cState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+ _assertPartedFiles(cState, [a, b]);
+
+ final aState = fileStateFor(a);
+ final bState = fileStateFor(b);
+
+ // Both part files know the library.
+ aState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, cState);
+ });
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, cState);
+ });
+
+ newFile(c.path, r'''
+library my;
+part 'b.dart';
+''');
+
+ // Stop referencing `a.dart` part file.
+ cState.refresh();
+ _assertPartedFiles(cState, [b]);
+
+ // So, the `a.dart` does not know its library anymore.
+ // But `b.dart` still knows it.
+ aState.assertKind((kind) {
+ kind as PartUnknownUriFileStateKind;
+ });
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, cState);
+ });
+ }
+
+ test_refresh_library_to_partOfName() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part 'b.dart';
+''');
+
+ // No `part of`, so it is a library.
+ final b = newFile('$testPackageLibPath/b.dart', '');
+
+ final aState = fileStateFor(a);
+ _assertPartedFiles(aState, [b]);
+
+ final aCycle_1 = aState.libraryCycle;
+
+ // No `part of`, so it is a library.
+ // It does not matter, that `a.dart` tried to use it as part.
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+
+ // Make it a part.
+ newFile(b.path, r'''
+part of my.lib;
+''');
+
+ // We will discover the library, by asking each of them.
+ bState.refresh();
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, same(aState));
+ });
+
+ // The file `b.dart` was something else, but now it is a known part.
+ // This affects libraries that include it.
+ final aCycle_2 = aState.libraryCycle;
+ expect(aCycle_2.apiSignature, isNot(aCycle_1.apiSignature));
+ }
+
+ test_refresh_library_to_partOfName_noLibrary() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+library my;
+''');
+
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+
+ newFile(a.path, r'''
+part of my;
+''');
+
+ aState.refresh();
+
+ // No library that includes it, so it stays unknown.
+ aState.assertKind((kind) {
+ kind as PartUnknownNameFileStateKind;
+ expect(kind.directive.name, 'my');
+ });
+ }
+
+ test_refresh_library_to_partOfUri() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library b;
+''');
+
+ final aState = fileStateFor(a);
+ _assertPartedFiles(aState, [b]);
+
+ final aCycle_1 = aState.libraryCycle;
+
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+
+ newFile(b.path, r'''
+part of 'a.dart';
+''');
+
+ // We will discover the library, by asking each of them.
+ bState.refresh();
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, same(aState));
+ });
+
+ // The file `b.dart` was something else, but now it is a known part.
+ // This affects libraries that include it.
+ final aCycle_2 = aState.libraryCycle;
+ expect(aCycle_2.apiSignature, isNot(aCycle_1.apiSignature));
+ }
+
+ test_refresh_partOfUri_to_library() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part of 'a.dart';
+''');
+
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+ _assertPartedFiles(aState, [b]);
+
+ final aCycle_1 = aState.libraryCycle;
+
+ // There is `part of` in `b.dart`, so it is a part.
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as PartKnownFileStateKind;
+ expect(kind.library, aState);
+ });
+
+ // There are no directives in `b.dart`, so it is a library.
+ newFile(b.path, r'''
+// no part of
+''');
+ bState.refresh();
+ bState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+
+ // Library `a.dart` still considers `b.dart` its part.
+ _assertPartedFiles(aState, [b]);
+
+ // The library cycle for `a.dart` is different now.
+ final aCycle_2 = aState.libraryCycle;
+ expect(aCycle_2.apiSignature, isNot(aCycle_1.apiSignature));
+ }
+
+ void _assertPartedFiles(FileState fileState, List<File> expected) {
+ final actualFiles = fileState.partedFiles.map((part) {
+ if (part != null) {
+ return getFile(part.path);
+ }
+ }).toList();
+ expect(actualFiles, expected);
+ }
+}
+
+@reflectiveTest
class FileSystemStateTest with ResourceProviderMixin {
final ByteStore byteStore = MemoryByteStore();
final FileContentOverlay contentOverlay = FileContentOverlay();
@@ -958,6 +1538,13 @@
}
}
+extension on FileState {
+ void assertKind(void Function(FileStateKind kind) f) {
+ expect(kind.file, same(this));
+ f(kind);
+ }
+}
+
extension _Either2Extension<T1, T2> on Either2<T1, T2> {
T1 get t1 {
late T1 result;
diff --git a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
index 40822da..f638f17 100644
--- a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
@@ -282,6 +282,8 @@
/// The path that is not in [workspaceRootPath], contains external packages.
String get packagesRootPath => '/packages';
+ File get testFile => getFile(testFilePath);
+
@override
String get testFilePath => '$testPackageLibPath/test.dart';
diff --git a/pkg/analyzer/test/src/lint/lint_rule_test.dart b/pkg/analyzer/test/src/lint/lint_rule_test.dart
index e87f18a..4bfee29 100644
--- a/pkg/analyzer/test/src/lint/lint_rule_test.dart
+++ b/pkg/analyzer/test/src/lint/lint_rule_test.dart
@@ -70,8 +70,8 @@
class CollectingReporter extends ErrorReporter {
ErrorCode? code;
- CollectingReporter(AnalysisErrorListener listener, Source source)
- : super(listener, source, isNonNullableByDefault: false);
+ CollectingReporter(super.listener, super.source)
+ : super(isNonNullableByDefault: false);
@override
void reportErrorForElement(ErrorCode errorCode, Element element,
diff --git a/pkg/analyzer/test/src/lint/project_test.dart b/pkg/analyzer/test/src/lint/project_test.dart
deleted file mode 100644
index 8b6d01a..0000000
--- a/pkg/analyzer/test/src/lint/project_test.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2015, 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.
-
-import 'dart:io';
-
-import 'package:analyzer/dart/analysis/session.dart';
-import 'package:analyzer/src/lint/project.dart';
-import 'package:test/test.dart';
-
-main() {
-// defineTests();
-}
-
-defineTests() {
- group('project', () {
- group('basic', () {
- // TODO(brianwilkerson) These tests fail on the bots because the cwd is
- // not the same there as when we run tests locally.
- group('cwd', () async {
- // ignore: deprecated_member_use_from_same_package
- var project = await DartProject.create(_AnalysisSessionMock(), []);
- test('name', () {
- expect(project.name, 'analyzer');
- });
- test('spec', () {
- expect(project.pubspec, isNotNull);
- });
- test('root', () {
- expect(project.root.path, Directory.current.path);
- });
- });
- // TODO(brianwilkerson) Rewrite these to use a memory resource provider.
-// group('p1', () {
-// var project =
-// new DartProject(null, null, dir: new Directory('test/_data/p1'));
-// test('name', () {
-// expect(project.name, 'p1');
-// });
-// test('spec', () {
-// expect(project.pubspec, isNotNull);
-// expect(project.pubspec.name.value.text, 'p1');
-// });
-// test('root', () {
-// expect(project.root.path, 'test/_data/p1');
-// });
-// });
-// group('no pubspec', () {
-// var project = new DartProject(null, null,
-// dir: new Directory('test/_data/p1/src'));
-// test('name', () {
-// expect(project.name, 'src');
-// });
-// test('spec', () {
-// expect(project.pubspec, isNull);
-// });
-// test('root', () {
-// expect(project.root.path, 'test/_data/p1/src');
-// });
-// });
- });
- });
-}
-
-class _AnalysisSessionMock implements AnalysisSession {
- @override
- noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
-}
diff --git a/pkg/analyzer/test/src/lint/test_all.dart b/pkg/analyzer/test/src/lint/test_all.dart
index 6b1afdc..801f080 100644
--- a/pkg/analyzer/test/src/lint/test_all.dart
+++ b/pkg/analyzer/test/src/lint/test_all.dart
@@ -8,7 +8,6 @@
import 'io_test.dart' as io;
import 'lint_rule_test.dart' as lint_rule;
import 'linter/test_all.dart' as linter;
-import 'project_test.dart' as project;
import 'pub_test.dart' as pub;
main() {
@@ -17,7 +16,6 @@
io.main();
lint_rule.main();
linter.main();
- project.main();
pub.main();
}, name: 'lint');
}
diff --git a/pkg/analyzer/test/verify_tests_test.dart b/pkg/analyzer/test/verify_tests_test.dart
index cd6a480..4a0e714 100644
--- a/pkg/analyzer/test/verify_tests_test.dart
+++ b/pkg/analyzer/test/verify_tests_test.dart
@@ -17,7 +17,7 @@
}
class _VerifyTests extends VerifyTests {
- _VerifyTests(String testDirPath) : super(testDirPath);
+ _VerifyTests(super.testDirPath);
@override
bool isExpensive(Resource resource) =>
diff --git a/pkg/analyzer/tool/messages/error_code_info.dart b/pkg/analyzer/tool/messages/error_code_info.dart
index f643590a..3ba935a 100644
--- a/pkg/analyzer/tool/messages/error_code_info.dart
+++ b/pkg/analyzer/tool/messages/error_code_info.dart
@@ -236,24 +236,15 @@
/// analyzer's `messages.yaml` file.
class AnalyzerErrorCodeInfo extends ErrorCodeInfo {
AnalyzerErrorCodeInfo(
- {String? comment,
- String? correctionMessage,
- String? documentation,
- bool hasPublishedDocs = false,
- bool isUnresolvedIdentifier = false,
- required String problemMessage,
- String? sharedName})
- : super(
- comment: comment,
- correctionMessage: correctionMessage,
- documentation: documentation,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier,
- problemMessage: problemMessage,
- sharedName: sharedName);
+ {super.comment,
+ super.correctionMessage,
+ super.documentation,
+ super.hasPublishedDocs,
+ super.isUnresolvedIdentifier,
+ required super.problemMessage,
+ super.sharedName});
- AnalyzerErrorCodeInfo.fromYaml(Map<Object?, Object?> yaml)
- : super.fromYaml(yaml);
+ AnalyzerErrorCodeInfo.fromYaml(super.yaml) : super.fromYaml();
}
/// Data tables mapping between CFE errors and their corresponding automatically
@@ -531,10 +522,10 @@
/// The index of the error in the analyzer's `fastaAnalyzerErrorCodes` table.
final int? index;
- FrontEndErrorCodeInfo.fromYaml(Map<Object?, Object?> yaml)
+ FrontEndErrorCodeInfo.fromYaml(super.yaml)
: analyzerCode = _decodeAnalyzerCode(yaml['analyzerCode']),
index = yaml['index'] as int?,
- super.fromYaml(yaml);
+ super.fromYaml();
@override
Map<Object?, Object?> toYaml() => {
diff --git a/pkg/analyzer/tool/messages/generate.dart b/pkg/analyzer/tool/messages/generate.dart
index 6773a78..9026a44 100644
--- a/pkg/analyzer/tool/messages/generate.dart
+++ b/pkg/analyzer/tool/messages/generate.dart
@@ -55,7 +55,7 @@
/// Code generator for analyzer error classes.
class _AnalyzerErrorGenerator {
final List<ErrorClassInfo> errorClasses;
- final out = StringBuffer('''
+ final StringBuffer out = StringBuffer('''
// Copyright (c) 2021, 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.
@@ -107,14 +107,11 @@
'[name].');
out.writeln(
'const ${errorClass.name}(String name, String problemMessage, {');
- out.writeln('String? correctionMessage,');
- out.writeln('bool hasPublishedDocs = false,');
- out.writeln('bool isUnresolvedIdentifier = false,');
+ out.writeln('super.correctionMessage,');
+ out.writeln('super.hasPublishedDocs = false,');
+ out.writeln('super.isUnresolvedIdentifier = false,');
out.writeln('String? uniqueName,');
out.writeln('}) : super(');
- out.writeln('correctionMessage: correctionMessage,');
- out.writeln('hasPublishedDocs: hasPublishedDocs,');
- out.writeln('isUnresolvedIdentifier: isUnresolvedIdentifier,');
out.writeln('name: name,');
out.writeln('problemMessage: problemMessage,');
out.writeln("uniqueName: '${errorClass.name}.\${uniqueName ?? name}',");
diff --git a/pkg/analyzer/tool/summary/generate.dart b/pkg/analyzer/tool/summary/generate.dart
index 46ace57..1428a2b 100644
--- a/pkg/analyzer/tool/summary/generate.dart
+++ b/pkg/analyzer/tool/summary/generate.dart
@@ -183,8 +183,7 @@
final idl_model.ClassDeclaration cls;
List<String> constructorParams = <String>[];
- _BuilderGenerator(idl_model.Idl idl, StringBuffer outBuffer, this.cls)
- : super(idl, outBuffer);
+ _BuilderGenerator(super.idl, super.outBuffer, this.cls);
String get builderName => '${name}Builder';
@@ -807,8 +806,7 @@
class _EnumReaderGenerator extends _BaseGenerator {
final idl_model.EnumDeclaration enum_;
- _EnumReaderGenerator(idl_model.Idl idl, StringBuffer outBuffer, this.enum_)
- : super(idl, outBuffer);
+ _EnumReaderGenerator(super.idl, super.outBuffer, this.enum_);
void generate() {
String name = enum_.name;
@@ -835,8 +833,7 @@
}
class _FlatBufferSchemaGenerator extends _BaseGenerator {
- _FlatBufferSchemaGenerator(idl_model.Idl idl, StringBuffer outBuffer)
- : super(idl, outBuffer);
+ _FlatBufferSchemaGenerator(super.idl, super.outBuffer);
void generate() {
for (idl_model.EnumDeclaration enm in _idl.enums.values) {
@@ -928,8 +925,7 @@
class _ImplGenerator extends _BaseGenerator {
final idl_model.ClassDeclaration cls;
- _ImplGenerator(idl_model.Idl idl, StringBuffer outBuffer, this.cls)
- : super(idl, outBuffer);
+ _ImplGenerator(super.idl, super.outBuffer, this.cls);
void generate() {
String name = cls.name;
@@ -1036,8 +1032,7 @@
class _MixinGenerator extends _BaseGenerator {
final idl_model.ClassDeclaration cls;
- _MixinGenerator(idl_model.Idl idl, StringBuffer outBuffer, this.cls)
- : super(idl, outBuffer);
+ _MixinGenerator(super.idl, super.outBuffer, this.cls);
void generate() {
String name = cls.name;
@@ -1126,8 +1121,7 @@
class _ReaderGenerator extends _BaseGenerator {
final idl_model.ClassDeclaration cls;
- _ReaderGenerator(idl_model.Idl idl, StringBuffer outBuffer, this.cls)
- : super(idl, outBuffer);
+ _ReaderGenerator(super.idl, super.outBuffer, this.cls);
void generateReader() {
String name = cls.name;
diff --git a/pkg/analyzer/tool/summary/idl_model.dart b/pkg/analyzer/tool/summary/idl_model.dart
index 6da5456..14dec0e 100644
--- a/pkg/analyzer/tool/summary/idl_model.dart
+++ b/pkg/analyzer/tool/summary/idl_model.dart
@@ -50,14 +50,12 @@
/// List of enumerated values.
final List<EnumValueDeclaration> values = <EnumValueDeclaration>[];
- EnumDeclaration(String? documentation, String name)
- : super(documentation, name);
+ EnumDeclaration(super.documentation, super.name);
}
/// Information about a single enum value defined in the IDL.
class EnumValueDeclaration extends Declaration {
- EnumValueDeclaration(String? documentation, String name)
- : super(documentation, name);
+ EnumValueDeclaration(super.documentation, super.name);
}
/// Information about a single class field defined in the IDL.
diff --git a/pkg/analyzer/tool/summary/mini_ast.dart b/pkg/analyzer/tool/summary/mini_ast.dart
index 20c7dd4..01e413d 100644
--- a/pkg/analyzer/tool/summary/mini_ast.dart
+++ b/pkg/analyzer/tool/summary/mini_ast.dart
@@ -44,15 +44,13 @@
final List<ClassMember> members;
- ClassDeclaration(Comment? documentationComment, List<Annotation>? metadata,
- this.name, this.superclass, this.members)
- : super(documentationComment, metadata);
+ ClassDeclaration(super.documentationComment, super.metadata, this.name,
+ this.superclass, this.members);
}
/// "Mini AST" representation of a class member.
class ClassMember extends AnnotatedNode {
- ClassMember(Comment? documentationComment, List<Annotation>? metadata)
- : super(documentationComment, metadata);
+ ClassMember(super.documentationComment, super.metadata);
}
/// "Mini AST" representation of a comment.
@@ -86,18 +84,14 @@
/// "Mini AST" representation of a top level member of a compilation unit.
class CompilationUnitMember extends AnnotatedNode {
- CompilationUnitMember(
- Comment? documentationComment, List<Annotation>? metadata)
- : super(documentationComment, metadata);
+ CompilationUnitMember(super.documentationComment, super.metadata);
}
/// "Mini AST" representation of a constructor declaration.
class ConstructorDeclaration extends ClassMember {
final String name;
- ConstructorDeclaration(
- Comment? documentationComment, List<Annotation>? metadata, this.name)
- : super(documentationComment, metadata);
+ ConstructorDeclaration(super.documentationComment, super.metadata, this.name);
}
/// "Mini AST" representation of an individual enum constant in an enum
@@ -106,8 +100,7 @@
final String name;
EnumConstantDeclaration(
- Comment? documentationComment, List<Annotation>? metadata, this.name)
- : super(documentationComment, metadata);
+ super.documentationComment, super.metadata, this.name);
}
/// "Mini AST" representation of an enum declaration.
@@ -116,9 +109,8 @@
final List<EnumConstantDeclaration> constants;
- EnumDeclaration(Comment? documentationComment, List<Annotation>? metadata,
- this.name, this.constants)
- : super(documentationComment, metadata);
+ EnumDeclaration(
+ super.documentationComment, super.metadata, this.name, this.constants);
}
/// "Mini AST" representation of an expression.
@@ -157,9 +149,8 @@
final TypeName? returnType;
- MethodDeclaration(Comment? documentationComment, List<Annotation>? metadata,
- this.isGetter, this.name, this.returnType)
- : super(documentationComment, metadata);
+ MethodDeclaration(super.documentationComment, super.metadata, this.isGetter,
+ this.name, this.returnType);
}
/// Parser listener which generates a "mini AST" representation of the source
@@ -665,7 +656,7 @@
/// Parser intended for use with [MiniAstBuilder].
class MiniAstParser extends Parser {
- MiniAstParser(MiniAstBuilder listener) : super(listener);
+ MiniAstParser(MiniAstBuilder super.listener);
@override
Token parseArgumentsOpt(Token token) {
diff --git a/pkg/compiler/lib/src/common/ram_usage.dart b/pkg/compiler/lib/src/common/ram_usage.dart
new file mode 100644
index 0000000..76c5c2d
--- /dev/null
+++ b/pkg/compiler/lib/src/common/ram_usage.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2022, 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.
+
+/// This library contains logic to fetch RAM utilization information.
+/// It is implemented as an RPC that connects to the VM's vm_service isolate and
+/// all necessary details.
+///
+/// This is similar to the information that the VM prints when provided the
+/// `--print_metrics` flag. However, this API allows us to obtain the data
+/// directly while the process is running and embedded in the compiler output
+/// (and in the future in dump-info).
+///
+/// Note that one could alternatively use Process.maxRss instead, however that
+/// number may have a lot more variability depending on system conditions.
+/// Our goal with this number is not so much to be exact, but to have a good
+/// metric we can track overtime and use to detect improvements and regressions.
+import 'dart:developer';
+import 'package:vm_service/vm_service_io.dart' as vm_service_io;
+
+Future<int> _currentHeapCapacity() async {
+ final info =
+ await Service.controlWebServer(enable: true, silenceOutput: true);
+ final observatoryUri = info.serverUri!;
+ final wsUri = 'ws://${observatoryUri.authority}${observatoryUri.path}ws';
+ final vmService = await vm_service_io.vmServiceConnectUri(wsUri);
+ int sum = 0;
+ for (final group in (await vmService.getVM()).isolateGroups!) {
+ final usage = await vmService.getIsolateGroupMemoryUsage(group.id!);
+ sum += usage.heapCapacity!;
+ }
+ vmService.dispose();
+ return sum;
+}
+
+Future<String> currentHeapCapacityInMb() async {
+ final capacity = await _currentHeapCapacity();
+ return "${(capacity / (1024 * 1024)).toStringAsFixed(3)} MB";
+}
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index 26b15e7..bb3680f 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -16,6 +16,7 @@
import '../compiler_api.dart' as api;
import '../compiler_api_unmigrated.dart' as api_unmigrated;
import 'commandline_options.dart';
+import 'common/ram_usage.dart';
import 'options.dart' show CompilerOptions, FeatureOptions;
import 'source_file_provider.dart';
import 'util/command_line.dart';
@@ -933,7 +934,8 @@
RandomAccessFileOutputProvider(out, sourceMapOut,
onInfo: diagnosticHandler.info, onFailure: fail);
- api.CompilationResult compilationDone(api.CompilationResult result) {
+ Future<api.CompilationResult> compilationDone(
+ api.CompilationResult result) async {
if (!result.isSuccess) {
fail('Compilation failed.');
}
@@ -1060,7 +1062,8 @@
print('$processName '
'${_formatCharacterCount(inputSize)} $inputName to '
'${_formatCharacterCount(outputSize)} $outputName in '
- '${_formatDurationAsSeconds(wallclock.elapsed)} seconds');
+ '${_formatDurationAsSeconds(wallclock.elapsed)} seconds using '
+ '${await currentHeapCapacityInMb()} of memory');
if (primaryOutputSize != null) {
diagnosticHandler
.info('${_formatCharacterCount(primaryOutputSize)} $outputName '
diff --git a/pkg/compiler/pubspec.yaml b/pkg/compiler/pubspec.yaml
index f3dfd26..071e5e1 100644
--- a/pkg/compiler/pubspec.yaml
+++ b/pkg/compiler/pubspec.yaml
@@ -19,6 +19,7 @@
js_runtime: any
js_shared: any
kernel: any
+ vm_service: any
dev_dependencies:
args: any
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index e95a0af..506b32d 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -4780,8 +4780,17 @@
}
@override
+ js_ast.Expression visitAbstractSuperPropertyGet(
+ AbstractSuperPropertyGet node) {
+ return _emitSuperPropertyGet(node.interfaceTarget);
+ }
+
+ @override
js_ast.Expression visitSuperPropertyGet(SuperPropertyGet node) {
- var target = node.interfaceTarget;
+ return _emitSuperPropertyGet(node.interfaceTarget);
+ }
+
+ js_ast.Expression _emitSuperPropertyGet(Member target) {
if (_reifyTearoff(target)) {
if (_superAllowed) {
var jsTarget = _emitSuperTarget(target);
@@ -4794,10 +4803,19 @@
}
@override
+ js_ast.Expression visitAbstractSuperPropertySet(
+ AbstractSuperPropertySet node) {
+ return _emitSuperPropertySet(node.interfaceTarget, node.value);
+ }
+
+ @override
js_ast.Expression visitSuperPropertySet(SuperPropertySet node) {
- var target = node.interfaceTarget;
+ return _emitSuperPropertySet(node.interfaceTarget, node.value);
+ }
+
+ js_ast.Expression _emitSuperPropertySet(Member target, Expression value) {
var jsTarget = _emitSuperTarget(target, setter: true);
- return _visitExpression(node.value).toAssignExpression(jsTarget);
+ return _visitExpression(value).toAssignExpression(jsTarget);
}
@override
@@ -5404,10 +5422,20 @@
// TODO(jmesserly): optimize super operators for kernel
@override
+ js_ast.Expression visitAbstractSuperMethodInvocation(
+ AbstractSuperMethodInvocation node) {
+ return _emitSuperMethodInvocation(node.interfaceTarget, node.arguments);
+ }
+
+ @override
js_ast.Expression visitSuperMethodInvocation(SuperMethodInvocation node) {
- var target = node.interfaceTarget;
- return js_ast.Call(_emitSuperTarget(target),
- _emitArgumentList(node.arguments, target: target));
+ return _emitSuperMethodInvocation(node.interfaceTarget, node.arguments);
+ }
+
+ js_ast.Expression _emitSuperMethodInvocation(
+ Member target, Arguments arguments) {
+ return js_ast.Call(
+ _emitSuperTarget(target), _emitArgumentList(arguments, target: target));
}
/// Emits the [js_ast.PropertyAccess] for accessors or method calls to
diff --git a/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart b/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
index 2832049..57e4d89 100644
--- a/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
@@ -142,12 +142,11 @@
@override
String get fullNameForErrors => name;
- VariableDeclaration build(
- SourceLibraryBuilder library, int functionNestingLevel) {
+ VariableDeclaration build(SourceLibraryBuilder library) {
if (variable == null) {
DartType? builtType = type?.build(library, TypeUse.parameterType);
variable = new VariableDeclarationImpl(
- name == noNameSentinel ? null : name, functionNestingLevel,
+ name == noNameSentinel ? null : name,
type: builtType,
isFinal: isFinal,
isConst: false,
diff --git a/pkg/front_end/lib/src/fasta/builder/type_builder.dart b/pkg/front_end/lib/src/fasta/builder/type_builder.dart
index 0090e6f..4582b5c 100644
--- a/pkg/front_end/lib/src/fasta/builder/type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/type_builder.dart
@@ -131,12 +131,9 @@
///
typedefAlias,
- /// An internally created function type used when build local functions.
- functionSignature,
-
/// The this type of an enum.
- // TODO(johnniwinther): This is doesn't currently have the correct value
- // and/or well-boundedness checking.
+ // TODO(johnniwinther): This doesn't currently have the correct value and/or
+ // well-boundedness checking.
enumSelfType,
/// A type used as a type literal.
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index ef54d70..58d6b73 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -1978,7 +1978,7 @@
typeParameters: typeDefinitions,
positionalParameters: definitions.keys
.map<VariableDeclaration>((name) =>
- new VariableDeclarationImpl(name, 0, type: definitions[name])
+ new VariableDeclarationImpl(name, type: definitions[name])
..fileOffset = cls?.fileOffset ??
extension?.fileOffset ??
libraryBuilder.library.fileOffset)
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 6f25365..392e727 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -86,6 +86,7 @@
import '../source/source_field_builder.dart';
import '../source/source_function_builder.dart';
import '../source/source_library_builder.dart';
+import '../source/source_member_builder.dart';
import '../source/source_procedure_builder.dart';
import '../source/stack_listener_impl.dart'
show StackListenerImpl, offsetForToken;
@@ -3265,8 +3266,7 @@
bool isLate = (currentLocalVariableModifiers & lateMask) != 0;
bool isRequired = (currentLocalVariableModifiers & requiredMask) != 0;
assert(isConst == (constantContext == ConstantContext.inferred));
- VariableDeclaration variable = new VariableDeclarationImpl(
- identifier.name, functionNestingLevel,
+ VariableDeclaration variable = new VariableDeclarationImpl(identifier.name,
forSyntheticToken: identifier.token.isSynthetic,
initializer: initializer,
type: currentLocalVariableType,
@@ -4383,8 +4383,7 @@
fileUri: uri)
..hasDeclaredInitializer = (initializerStart != null);
}
- VariableDeclaration variable =
- parameter.build(libraryBuilder, functionNestingLevel);
+ VariableDeclaration variable = parameter.build(libraryBuilder);
Expression? initializer = name?.initializer;
if (initializer != null) {
if (member is RedirectingFactoryBuilder) {
@@ -4568,11 +4567,10 @@
int parameterCount = catchParameters!.parameters!.length;
if (parameterCount > 0) {
exception = catchParameters.parameters![0];
- exception.build(libraryBuilder, functionNestingLevel).type =
- exceptionType;
+ exception.build(libraryBuilder).type = exceptionType;
if (parameterCount > 1) {
stackTrace = catchParameters.parameters![1];
- stackTrace.build(libraryBuilder, functionNestingLevel).type =
+ stackTrace.build(libraryBuilder).type =
coreTypes.stackTraceRawType(libraryBuilder.nonNullable);
}
}
@@ -5772,6 +5770,25 @@
}
@override
+ void handleAugmentSuperExpression(
+ Token augmentToken, Token superToken, IdentifierContext context) {
+ debugEvent("AugmentSuperExpression");
+ if (member is SourceMemberBuilder) {
+ SourceMemberBuilder sourceMemberBuilder = member as SourceMemberBuilder;
+ if (sourceMemberBuilder.isAugmentation) {
+ // TODO(johnniwinther): Implement augment super handling.
+ int fileOffset = augmentToken.charOffset;
+ push(forest.createAsExpression(fileOffset,
+ forest.createNullLiteral(fileOffset), const DynamicType(),
+ forNonNullableByDefault: libraryBuilder.isNonNullableByDefault));
+ return;
+ }
+ }
+ push(new IncompleteErrorGenerator(
+ this, augmentToken, fasta.messageInvalidAugmentSuper));
+ }
+
+ @override
void handleNamedArgument(Token colon) {
debugEvent("NamedArgument");
assert(checkState(colon, [
@@ -5803,8 +5820,7 @@
debugEvent("FunctionName");
Identifier name = pop() as Identifier;
Token nameToken = name.token;
- VariableDeclaration variable = new VariableDeclarationImpl(
- name.name, functionNestingLevel,
+ VariableDeclaration variable = new VariableDeclarationImpl(name.name,
forSyntheticToken: nameToken.isSynthetic,
isFinal: true,
isLocalFunction: true)
@@ -6171,8 +6187,7 @@
}
} else {
VariableDeclaration variable = elements.syntheticVariableDeclaration =
- forest.createVariableDeclaration(
- offsetForToken(forToken), null, functionNestingLevel,
+ forest.createVariableDeclaration(offsetForToken(forToken), null,
isFinal: true);
if (lvalue is Generator) {
/// We are in this case, where `lvalue` isn't a [VariableDeclaration]:
@@ -7644,37 +7659,49 @@
FunctionNode buildFunctionNode(
SourceLibraryBuilder library,
- TypeBuilder? returnType,
- List<TypeVariableBuilder>? typeParameters,
+ TypeBuilder? returnTypeBuilder,
+ List<TypeVariableBuilder>? typeVariableBuilders,
AsyncMarker asyncModifier,
Statement body,
int fileEndOffset) {
- // TODO(johnniwinther): Avoid creating a FunctionTypeBuilder to create
- // the function. The function type is not written as a type by the user
- // and shouldn't be checked as such.
- FunctionType type = toFunctionType(
- returnType, const NullabilityBuilder.omitted(), typeParameters)
- .build(library, TypeUse.functionSignature) as FunctionType;
+ DartType returnType =
+ returnTypeBuilder?.build(library, TypeUse.returnType) ??
+ const DynamicType();
+ int requiredParameterCount = 0;
List<VariableDeclaration> positionalParameters = <VariableDeclaration>[];
List<VariableDeclaration> namedParameters = <VariableDeclaration>[];
if (parameters != null) {
- for (FormalParameterBuilder parameter in parameters!) {
- if (parameter.isNamed) {
- namedParameters.add(parameter.variable!);
- } else {
- positionalParameters.add(parameter.variable!);
+ for (FormalParameterBuilder formal in parameters!) {
+ VariableDeclaration parameter = formal.build(
+ library,
+ );
+ if (formal.isPositional) {
+ positionalParameters.add(parameter);
+ if (formal.isRequiredPositional) requiredParameterCount++;
+ } else if (formal.isNamed) {
+ namedParameters.add(parameter);
}
}
namedParameters.sort((VariableDeclaration a, VariableDeclaration b) {
return a.name!.compareTo(b.name!);
});
}
+
+ List<TypeParameter>? typeParameters;
+ if (typeVariableBuilders != null) {
+ typeParameters = <TypeParameter>[];
+ for (TypeVariableBuilder t in typeVariableBuilders) {
+ typeParameters.add(t.parameter);
+ // Build the bound to detect cycles in typedefs.
+ t.bound?.build(library, TypeUse.typeParameterBound);
+ }
+ }
return new FunctionNode(body,
- typeParameters: type.typeParameters,
+ typeParameters: typeParameters,
positionalParameters: positionalParameters,
namedParameters: namedParameters,
- requiredParameterCount: type.requiredParameterCount,
- returnType: type.returnType,
+ requiredParameterCount: requiredParameterCount,
+ returnType: returnType,
asyncMarker: asyncModifier)
..fileOffset = charOffset
..fileEndOffset = fileEndOffset;
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index bd6983c..320a50c 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -3772,10 +3772,23 @@
Constant visitStaticSet(StaticSet node) => defaultExpression(node);
@override
+ Constant visitAbstractSuperMethodInvocation(
+ AbstractSuperMethodInvocation node) =>
+ defaultExpression(node);
+
+ @override
Constant visitSuperMethodInvocation(SuperMethodInvocation node) =>
defaultExpression(node);
@override
+ Constant visitAbstractSuperPropertyGet(AbstractSuperPropertyGet node) =>
+ defaultExpression(node);
+
+ @override
+ Constant visitAbstractSuperPropertySet(AbstractSuperPropertySet node) =>
+ defaultExpression(node);
+
+ @override
Constant visitSuperPropertyGet(SuperPropertyGet node) =>
defaultExpression(node);
diff --git a/pkg/front_end/lib/src/fasta/kernel/forest.dart b/pkg/front_end/lib/src/fasta/kernel/forest.dart
index 73decad..8593b65 100644
--- a/pkg/front_end/lib/src/fasta/kernel/forest.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/forest.dart
@@ -646,8 +646,7 @@
/// Creates [VariableDeclaration] for a variable named [name] at the given
/// [functionNestingLevel].
- VariableDeclaration createVariableDeclaration(
- int fileOffset, String? name, int functionNestingLevel,
+ VariableDeclaration createVariableDeclaration(int fileOffset, String? name,
{Expression? initializer,
DartType? type,
bool isFinal: false,
@@ -657,7 +656,7 @@
bool isLocalFunction: false}) {
// ignore: unnecessary_null_comparison
assert(fileOffset != null);
- return new VariableDeclarationImpl(name, functionNestingLevel,
+ return new VariableDeclarationImpl(name,
type: type,
initializer: initializer,
isFinal: isFinal,
diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
index dd68ba0..71ba7f6 100644
--- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
@@ -1196,6 +1196,8 @@
return new LocalForInVariable(syntheticAssignment);
} else if (syntheticAssignment is PropertySet) {
return new PropertyForInVariable(syntheticAssignment);
+ } else if (syntheticAssignment is AbstractSuperPropertySet) {
+ return new AbstractSuperPropertyForInVariable(syntheticAssignment);
} else if (syntheticAssignment is SuperPropertySet) {
return new SuperPropertyForInVariable(syntheticAssignment);
} else if (syntheticAssignment is StaticSet) {
@@ -6149,6 +6151,21 @@
}
@override
+ ExpressionInferenceResult visitAbstractSuperMethodInvocation(
+ AbstractSuperMethodInvocation node, DartType typeContext) {
+ if (node.interfaceTarget != null) {
+ inferrer.instrumentation?.record(
+ inferrer.uriForInstrumentation,
+ node.fileOffset,
+ 'target',
+ new InstrumentationValueForMember(node.interfaceTarget!));
+ }
+ assert(node.interfaceTarget == null || node.interfaceTarget is Procedure);
+ return inferrer.inferSuperMethodInvocation(node, node.name,
+ node.arguments as ArgumentsImpl, typeContext, node.interfaceTarget);
+ }
+
+ @override
ExpressionInferenceResult visitSuperMethodInvocation(
SuperMethodInvocation node, DartType typeContext) {
if (node.interfaceTarget != null) {
@@ -6159,8 +6176,22 @@
new InstrumentationValueForMember(node.interfaceTarget!));
}
assert(node.interfaceTarget == null || node.interfaceTarget is Procedure);
- return inferrer.inferSuperMethodInvocation(
- node, typeContext, node.interfaceTarget);
+ return inferrer.inferSuperMethodInvocation(node, node.name,
+ node.arguments as ArgumentsImpl, typeContext, node.interfaceTarget);
+ }
+
+ @override
+ ExpressionInferenceResult visitAbstractSuperPropertyGet(
+ AbstractSuperPropertyGet node, DartType typeContext) {
+ if (node.interfaceTarget != null) {
+ inferrer.instrumentation?.record(
+ inferrer.uriForInstrumentation,
+ node.fileOffset,
+ 'target',
+ new InstrumentationValueForMember(node.interfaceTarget!));
+ }
+ return inferrer.inferSuperPropertyGet(
+ node, node.name, typeContext, node.interfaceTarget);
}
@override
@@ -6174,7 +6205,33 @@
new InstrumentationValueForMember(node.interfaceTarget!));
}
return inferrer.inferSuperPropertyGet(
- node, typeContext, node.interfaceTarget);
+ node, node.name, typeContext, node.interfaceTarget);
+ }
+
+ @override
+ ExpressionInferenceResult visitAbstractSuperPropertySet(
+ AbstractSuperPropertySet node, DartType typeContext) {
+ DartType receiverType = inferrer.classHierarchy.getTypeAsInstanceOf(
+ inferrer.thisType!,
+ inferrer.thisType!.classNode.supertype!.classNode,
+ inferrer.libraryBuilder.library)!;
+
+ ObjectAccessTarget writeTarget = node.interfaceTarget != null
+ ? new ObjectAccessTarget.interfaceMember(node.interfaceTarget!,
+ isPotentiallyNullable: false)
+ : const ObjectAccessTarget.missing();
+ DartType writeContext = inferrer.getSetterType(writeTarget, receiverType);
+ if (node.interfaceTarget != null) {
+ writeContext = inferrer.computeTypeFromSuperClass(
+ node.interfaceTarget!.enclosingClass!, writeContext);
+ }
+ ExpressionInferenceResult rhsResult = inferrer
+ .inferExpression(node.value, writeContext, true, isVoidAllowed: true);
+ rhsResult = inferrer.ensureAssignableResult(writeContext, rhsResult,
+ fileOffset: node.fileOffset, isVoidAllowed: writeContext is VoidType);
+ Expression rhs = rhsResult.expression;
+ node.value = rhs..parent = node;
+ return new ExpressionInferenceResult(rhsResult.inferredType, node);
}
@override
@@ -7158,6 +7215,46 @@
}
}
+class AbstractSuperPropertyForInVariable implements ForInVariable {
+ final AbstractSuperPropertySet superPropertySet;
+
+ DartType? _writeType;
+
+ AbstractSuperPropertyForInVariable(this.superPropertySet);
+
+ @override
+ DartType computeElementType(TypeInferrerImpl inferrer) {
+ DartType receiverType = inferrer.thisType!;
+ ObjectAccessTarget writeTarget = inferrer.findInterfaceMember(
+ receiverType, superPropertySet.name, superPropertySet.fileOffset,
+ callSiteAccessKind: CallSiteAccessKind.setterInvocation,
+ instrumented: true);
+ if (writeTarget.isInstanceMember || writeTarget.isObjectMember) {
+ superPropertySet.interfaceTarget = writeTarget.member;
+ }
+ return _writeType = inferrer.getSetterType(writeTarget, receiverType);
+ }
+
+ @override
+ Expression inferAssignment(TypeInferrerImpl inferrer, DartType rhsType) {
+ Expression rhs = inferrer.ensureAssignable(
+ inferrer.computeGreatestClosure(_writeType!),
+ rhsType,
+ superPropertySet.value,
+ errorTemplate: templateForInLoopElementTypeNotAssignable,
+ nullabilityErrorTemplate:
+ templateForInLoopElementTypeNotAssignableNullability,
+ nullabilityPartErrorTemplate:
+ templateForInLoopElementTypeNotAssignablePartNullability,
+ isVoidAllowed: true);
+ superPropertySet.value = rhs..parent = superPropertySet;
+ ExpressionInferenceResult result = inferrer.inferExpression(
+ superPropertySet, const UnknownType(), !inferrer.isTopLevel,
+ isVoidAllowed: true);
+ return result.expression;
+ }
+}
+
class SuperPropertyForInVariable implements ForInVariable {
final SuperPropertySet superPropertySet;
diff --git a/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart b/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
index 0fd1abd..01e408e 100644
--- a/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
@@ -1589,10 +1589,6 @@
/// the kernel.
final bool isImplicitlyTyped;
- // TODO(ahe): Remove this field. We can get rid of it by recording closure
- // mutation in [BodyBuilder].
- final int functionNestingLevel;
-
// TODO(ahe): Remove this field. It's only used locally when compiling a
// method, and this can thus be tracked in a [Set] (actually, tracking this
// information in a [List] is probably even faster as the average size will
@@ -1615,7 +1611,7 @@
/// used.
bool isStaticLate;
- VariableDeclarationImpl(String? name, this.functionNestingLevel,
+ VariableDeclarationImpl(String? name,
{this.forSyntheticToken: false,
bool hasDeclaredInitializer: false,
Expression? initializer,
@@ -1645,7 +1641,6 @@
VariableDeclarationImpl.forEffect(Expression initializer)
: forSyntheticToken = false,
- functionNestingLevel = 0,
isImplicitlyTyped = false,
isLocalFunction = false,
isStaticLate = false,
@@ -1653,7 +1648,6 @@
VariableDeclarationImpl.forValue(Expression initializer)
: forSyntheticToken = false,
- functionNestingLevel = 0,
isImplicitlyTyped = true,
isLocalFunction = false,
isStaticLate = false,
diff --git a/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart b/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart
index d75672e..4984f92 100644
--- a/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart
@@ -1968,6 +1968,12 @@
}
@override
+ void handleAugmentSuperExpression(
+ Token augmentToken, Token superToken, IdentifierContext context) {
+ _unsupported();
+ }
+
+ @override
void handleSymbolVoid(Token token) {
_unhandled();
}
diff --git a/pkg/front_end/lib/src/fasta/source/source_function_builder.dart b/pkg/front_end/lib/src/fasta/source/source_function_builder.dart
index e52c631..fa2a828 100644
--- a/pkg/front_end/lib/src/fasta/source/source_function_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_function_builder.dart
@@ -119,7 +119,7 @@
void becomeNative(SourceLoader loader);
- bool checkPatch(FunctionBuilder patch);
+ bool checkPatch(SourceFunctionBuilder patch);
void reportPatchMismatch(Builder patch);
}
@@ -343,7 +343,7 @@
}
if (formals != null) {
for (FormalParameterBuilder formal in formals!) {
- VariableDeclaration parameter = formal.build(libraryBuilder, 0);
+ VariableDeclaration parameter = formal.build(libraryBuilder);
if (needsCheckVisitor != null) {
if (parameter.type.accept(needsCheckVisitor)) {
parameter.isCovariantByClass = true;
@@ -378,8 +378,7 @@
// Replace illegal parameters by single dummy parameter.
// Do this after building the parameters, since the diet listener
// assumes that parameters are built, even if illegal in number.
- VariableDeclaration parameter =
- new VariableDeclarationImpl("#synthetic", 0);
+ VariableDeclaration parameter = new VariableDeclarationImpl("#synthetic");
function.positionalParameters.clear();
function.positionalParameters.add(parameter);
parameter.parent = function;
@@ -493,8 +492,8 @@
}
@override
- bool checkPatch(FunctionBuilder patch) {
- if (!isExternal) {
+ bool checkPatch(SourceFunctionBuilder patch) {
+ if (!isExternal && !patch.libraryBuilder.isAugmentation) {
patch.libraryBuilder.addProblem(
messagePatchNonExternal, patch.charOffset, noLength, patch.fileUri!,
context: [
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 963b623..ffad317 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -4791,7 +4791,6 @@
case TypeUse.typeParameterDefaultType:
case TypeUse.defaultTypeAsTypeArgument:
case TypeUse.deferredTypeError:
- case TypeUse.functionSignature:
break;
}
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 979bf9d..bb6d2ee 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -4132,16 +4132,16 @@
/// Performs the core type inference algorithm for super method invocations.
ExpressionInferenceResult inferSuperMethodInvocation(
- SuperMethodInvocation expression,
+ Expression expression,
+ Name methodName,
+ ArgumentsImpl arguments,
DartType typeContext,
Procedure? procedure) {
+ int fileOffset = expression.fileOffset;
ObjectAccessTarget target = procedure != null
? new ObjectAccessTarget.interfaceMember(procedure,
isPotentiallyNullable: false)
: const ObjectAccessTarget.missing();
- int fileOffset = expression.fileOffset;
- Name methodName = expression.name;
- ArgumentsImpl arguments = expression.arguments as ArgumentsImpl;
DartType receiverType = thisType!;
bool isSpecialCasedBinaryOperator =
isSpecialCasedBinaryOperatorForReceiverType(target, receiverType);
@@ -4155,7 +4155,7 @@
as FunctionType;
}
if (isNonNullableByDefault &&
- expression.name == equalsName &&
+ methodName == equalsName &&
functionType.positionalParameters.length == 1) {
// operator == always allows nullable arguments.
functionType = new FunctionType([
@@ -4200,7 +4200,7 @@
/// Performs the core type inference algorithm for super property get.
ExpressionInferenceResult inferSuperPropertyGet(
- SuperPropertyGet expression, DartType typeContext, Member? member) {
+ Expression expression, Name name, DartType typeContext, Member? member) {
ObjectAccessTarget readTarget = member != null
? new ObjectAccessTarget.interfaceMember(member,
isPotentiallyNullable: false)
@@ -4215,7 +4215,7 @@
return instantiateTearOff(inferredType, typeContext, expression);
}
flowAnalysis.thisOrSuperPropertyGet(
- expression, expression.name.text, member, inferredType);
+ expression, name.text, member, inferredType);
return new ExpressionInferenceResult(inferredType, expression);
}
diff --git a/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart b/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart
index 5137b17..7006708 100644
--- a/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart
+++ b/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart
@@ -2411,6 +2411,17 @@
}
@override
+ void handleAugmentSuperExpression(
+ Token augmentToken, Token superToken, IdentifierContext context) {
+ AugmentSuperExpressionHandle data = new AugmentSuperExpressionHandle(
+ ParserAstType.HANDLE,
+ augmentToken: augmentToken,
+ superToken: superToken,
+ context: context);
+ seen(data);
+ }
+
+ @override
void beginSwitchCase(int labelCount, int expressionCount, Token firstToken) {
SwitchCaseBegin data = new SwitchCaseBegin(ParserAstType.BEGIN,
labelCount: labelCount,
@@ -6926,6 +6937,25 @@
};
}
+class AugmentSuperExpressionHandle extends ParserAstNode {
+ final Token augmentToken;
+ final Token superToken;
+ final IdentifierContext context;
+
+ AugmentSuperExpressionHandle(ParserAstType type,
+ {required this.augmentToken,
+ required this.superToken,
+ required this.context})
+ : super("AugmentSuperExpression", type);
+
+ @override
+ Map<String, Object?> get deprecatedArguments => {
+ "augmentToken": augmentToken,
+ "superToken": superToken,
+ "context": context,
+ };
+}
+
class SwitchCaseBegin extends ParserAstNode {
final int labelCount;
final int expressionCount;
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 125a09d..d7c85b5 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -490,6 +490,8 @@
InterpolationInUri/example: Fail
InvalidAssignmentWarning/analyzerCode: Fail
InvalidAssignmentWarning/example: Fail
+InvalidAugmentSuper/analyzerCode: Fail
+InvalidAugmentSuper/example: Fail
InvalidBreakTarget/analyzerCode: Fail
InvalidBreakTarget/example: Fail
InvalidCastFunctionExpr/example: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 745eead..7691707 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -3309,6 +3309,9 @@
problemMessage: "Expected identifier, but got 'super'."
analyzerCode: SUPER_AS_EXPRESSION
+InvalidAugmentSuper:
+ problemMessage: "'augment super' is only allowed in member augmentations."
+
SuperAsExpression:
problemMessage: "Can't use 'super' as an expression."
correctionMessage: "To delegate a constructor to a super constructor, put the super call as an initializer."
diff --git a/pkg/front_end/parser_testcases/augmentation/augment_super.dart b/pkg/front_end/parser_testcases/augmentation/augment_super.dart
new file mode 100644
index 0000000..ef21ddf
--- /dev/null
+++ b/pkg/front_end/parser_testcases/augmentation/augment_super.dart
@@ -0,0 +1,53 @@
+augment void topLevelMethod() {
+ augment super();
+}
+
+augment void topLevelMethodError() {
+ augment int local;
+ augment;
+}
+
+
+augment List<int> get topLevelProperty {
+ return [... augment super, augment super[0]];
+}
+
+augment void set topLevelProperty(List<int> value) {
+ augment super[0] = value[1];
+ augment super = value;
+}
+
+void injectedTopLevelMethod() {
+ augment super();
+ augment super;
+ augment int local;
+ augment;
+}
+
+augment class Class {
+ augment void instanceMethod() {
+ augment super();
+ }
+
+ augment void instanceMethodErrors() {
+ augment int local;
+ augment;
+ }
+
+ augment int get instanceProperty {
+ augment super++;
+ --augment super;
+ return -augment super;
+ }
+
+ augment void set instanceProperty(int value) {
+ augment super = value;
+ }
+
+ void injectedInstanceMethod() {
+ augment super();
+ augment super;
+ augment int local;
+ augment;
+ }
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/augmentation/augment_super.dart.expect b/pkg/front_end/parser_testcases/augmentation/augment_super.dart.expect
new file mode 100644
index 0000000..19a8a3c
--- /dev/null
+++ b/pkg/front_end/parser_testcases/augmentation/augment_super.dart.expect
@@ -0,0 +1,348 @@
+Problems reported:
+
+parser/augmentation/augment_super:6:3: Can't have modifier 'augment' here.
+ augment int local;
+ ^^^^^^^
+
+parser/augmentation/augment_super:23:3: Can't have modifier 'augment' here.
+ augment int local;
+ ^^^^^^^
+
+parser/augmentation/augment_super:33:5: Can't have modifier 'augment' here.
+ augment int local;
+ ^^^^^^^
+
+parser/augmentation/augment_super:50:5: Can't have modifier 'augment' here.
+ augment int local;
+ ^^^^^^^
+
+beginCompilationUnit(augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginTopLevelMember(augment)
+ beginTopLevelMethod(, augment, null)
+ handleVoidKeyword(void)
+ handleIdentifier(topLevelMethod, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ endArguments(0, (, ))
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(1, {, })
+ endTopLevelMethod(augment, null, })
+ endTopLevelDeclaration(augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginTopLevelMember(augment)
+ beginTopLevelMethod(}, augment, null)
+ handleVoidKeyword(void)
+ handleIdentifier(topLevelMethodError, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'augment' here., Try removing 'augment'., {lexeme: augment}], augment, augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(local)
+ handleType(int, null)
+ beginVariablesDeclaration(local, null, null)
+ handleIdentifier(local, localVariableDeclaration)
+ beginInitializedIdentifier(local)
+ handleNoVariableInitializer(local)
+ endInitializedIdentifier(local)
+ endVariablesDeclaration(1, ;)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(2, {, })
+ endTopLevelMethod(augment, null, })
+ endTopLevelDeclaration(augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginTopLevelMember(augment)
+ beginTopLevelMethod(}, augment, null)
+ handleIdentifier(List, typeReference)
+ beginTypeArguments(<)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(>)
+ handleType(int, null)
+ endTypeArguments(1, <, >)
+ handleType(List, null)
+ handleIdentifier(topLevelProperty, topLevelFunctionDeclaration)
+ handleNoTypeVariables({)
+ handleNoFormalParameters({, MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginReturnStatement(return)
+ handleNoTypeArguments([)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleSpreadExpression(...)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleLiteralInt(0)
+ handleIndexedExpression(null, [, ])
+ handleLiteralList(2, [, null, ])
+ endReturnStatement(true, return, ;)
+ endBlockFunctionBody(1, {, })
+ endTopLevelMethod(augment, get, })
+ endTopLevelDeclaration(augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginTopLevelMember(augment)
+ beginTopLevelMethod(}, augment, null)
+ handleVoidKeyword(void)
+ handleIdentifier(topLevelProperty, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ beginMetadataStar(List)
+ endMetadataStar(0)
+ beginFormalParameter(List, MemberKind.TopLevelMethod, null, null, null)
+ handleIdentifier(List, typeReference)
+ beginTypeArguments(<)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(>)
+ handleType(int, null)
+ endTypeArguments(1, <, >)
+ handleType(List, null)
+ handleIdentifier(value, formalParameterDeclaration)
+ handleFormalParameterWithoutValue())
+ endFormalParameter(null, null, null, value, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
+ endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleLiteralInt(0)
+ handleIndexedExpression(null, [, ])
+ handleIdentifier(value, expression)
+ handleNoTypeArguments([)
+ handleNoArguments([)
+ handleSend(value, [)
+ handleLiteralInt(1)
+ handleIndexedExpression(null, [, ])
+ handleAssignmentExpression(=)
+ handleExpressionStatement(;)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleIdentifier(value, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(value, ;)
+ handleAssignmentExpression(=)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(2, {, })
+ endTopLevelMethod(augment, set, })
+ endTopLevelDeclaration(void)
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginTopLevelMember(void)
+ beginTopLevelMethod(}, null, null)
+ handleVoidKeyword(void)
+ handleIdentifier(injectedTopLevelMethod, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ endArguments(0, (, ))
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleExpressionStatement(;)
+ handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'augment' here., Try removing 'augment'., {lexeme: augment}], augment, augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(local)
+ handleType(int, null)
+ beginVariablesDeclaration(local, null, null)
+ handleIdentifier(local, localVariableDeclaration)
+ beginInitializedIdentifier(local)
+ handleNoVariableInitializer(local)
+ endInitializedIdentifier(local)
+ endVariablesDeclaration(1, ;)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(4, {, })
+ endTopLevelMethod(void, null, })
+ endTopLevelDeclaration(augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginClassOrMixinOrNamedMixinApplicationPrelude(class)
+ handleIdentifier(Class, classOrMixinDeclaration)
+ handleNoTypeVariables({)
+ beginClassDeclaration(class, null, null, augment, Class)
+ handleNoType(Class)
+ handleClassExtends(null, 1)
+ handleClassNoWithClause()
+ handleImplements(null, 0)
+ handleClassHeader(class, class, null)
+ beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(DeclarationKind.Class, augment, null, null, null, null, null, instanceMethod)
+ handleVoidKeyword(void)
+ handleIdentifier(instanceMethod, methodDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.NonStaticMethod)
+ endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ endArguments(0, (, ))
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(1, {, })
+ endClassMethod(null, augment, (, null, })
+ endMember()
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(DeclarationKind.Class, augment, null, null, null, null, null, instanceMethodErrors)
+ handleVoidKeyword(void)
+ handleIdentifier(instanceMethodErrors, methodDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.NonStaticMethod)
+ endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'augment' here., Try removing 'augment'., {lexeme: augment}], augment, augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(local)
+ handleType(int, null)
+ beginVariablesDeclaration(local, null, null)
+ handleIdentifier(local, localVariableDeclaration)
+ beginInitializedIdentifier(local)
+ handleNoVariableInitializer(local)
+ endInitializedIdentifier(local)
+ endVariablesDeclaration(1, ;)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(2, {, })
+ endClassMethod(null, augment, (, null, })
+ endMember()
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(DeclarationKind.Class, augment, null, null, null, null, get, instanceProperty)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(get)
+ handleType(int, null)
+ handleIdentifier(instanceProperty, methodDeclaration)
+ handleNoTypeVariables({)
+ handleNoFormalParameters({, MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleUnaryPostfixAssignmentExpression(++)
+ handleExpressionStatement(;)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleUnaryPrefixAssignmentExpression(--)
+ handleExpressionStatement(;)
+ beginReturnStatement(return)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleUnaryPrefixExpression(-)
+ endReturnStatement(true, return, ;)
+ endBlockFunctionBody(3, {, })
+ endClassMethod(get, augment, {, null, })
+ endMember()
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(DeclarationKind.Class, augment, null, null, null, null, set, instanceProperty)
+ handleVoidKeyword(void)
+ handleIdentifier(instanceProperty, methodDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.NonStaticMethod)
+ beginMetadataStar(int)
+ endMetadataStar(0)
+ beginFormalParameter(int, MemberKind.NonStaticMethod, null, null, null)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(value)
+ handleType(int, null)
+ handleIdentifier(value, formalParameterDeclaration)
+ handleFormalParameterWithoutValue())
+ endFormalParameter(null, null, null, value, null, null, FormalParameterKind.requiredPositional, MemberKind.NonStaticMethod)
+ endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleIdentifier(value, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(value, ;)
+ handleAssignmentExpression(=)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(1, {, })
+ endClassMethod(set, augment, (, null, })
+ endMember()
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(DeclarationKind.Class, null, null, null, null, null, null, injectedInstanceMethod)
+ handleVoidKeyword(void)
+ handleIdentifier(injectedInstanceMethod, methodDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.NonStaticMethod)
+ endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ endArguments(0, (, ))
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ handleAugmentSuperExpression(augment, super, expression)
+ handleExpressionStatement(;)
+ handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'augment' here., Try removing 'augment'., {lexeme: augment}], augment, augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(local)
+ handleType(int, null)
+ beginVariablesDeclaration(local, null, null)
+ handleIdentifier(local, localVariableDeclaration)
+ beginInitializedIdentifier(local)
+ handleNoVariableInitializer(local)
+ endInitializedIdentifier(local)
+ endVariablesDeclaration(1, ;)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(4, {, })
+ endClassMethod(null, void, (, null, })
+ endMember()
+ endClassOrMixinOrExtensionBody(DeclarationKind.Class, 5, {, })
+ endClassDeclaration(class, })
+ endTopLevelDeclaration()
+endCompilationUnit(6, )
diff --git a/pkg/front_end/parser_testcases/augmentation/augment_super.dart.intertwined.expect b/pkg/front_end/parser_testcases/augmentation/augment_super.dart.intertwined.expect
new file mode 100644
index 0000000..eb29931
--- /dev/null
+++ b/pkg/front_end/parser_testcases/augmentation/augment_super.dart.intertwined.expect
@@ -0,0 +1,826 @@
+parseUnit(augment)
+ skipErrorTokens(augment)
+ listener: beginCompilationUnit(augment)
+ syntheticPreviousToken(augment)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(augment)
+ parseTopLevelMethod(, augment, null, augment, Instance of 'VoidType', null, topLevelMethod, false)
+ listener: beginTopLevelMethod(, augment, null)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(topLevelMethod, topLevelFunctionDeclaration)
+ parseMethodTypeVar(topLevelMethod)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(topLevelMethod, topLevelMethod, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(topLevelMethod, 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(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatement({)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseAugmentSuperExpression({, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ listener: handleNoTypeArguments(()
+ parseArguments(super)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ listener: endArguments(0, (, ))
+ listener: handleSend(augment, ;)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endTopLevelMethod(augment, null, })
+ listener: endTopLevelDeclaration(augment)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(augment)
+ parseTopLevelMethod(}, augment, null, augment, Instance of 'VoidType', null, topLevelMethodError, false)
+ listener: beginTopLevelMethod(}, augment, null)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(topLevelMethodError, topLevelFunctionDeclaration)
+ parseMethodTypeVar(topLevelMethodError)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(topLevelMethodError, topLevelMethodError, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(topLevelMethodError, 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(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ reportRecoverableErrorWithToken(augment, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'augment' here., Try removing 'augment'., {lexeme: augment}], augment, augment)
+ parseExpressionStatementOrDeclarationAfterModifiers(augment, {, null, null, null, false)
+ looksLikeLocalFunction(local)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(local)
+ listener: handleType(int, null)
+ listener: beginVariablesDeclaration(local, null, null)
+ parseVariablesDeclarationRest(int, true)
+ parseOptionallyInitializedIdentifier(int)
+ ensureIdentifier(int, localVariableDeclaration)
+ listener: handleIdentifier(local, localVariableDeclaration)
+ listener: beginInitializedIdentifier(local)
+ parseVariableInitializerOpt(local)
+ listener: handleNoVariableInitializer(local)
+ listener: endInitializedIdentifier(local)
+ ensureSemicolon(local)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(augment)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ inPlainSync()
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ inPlainSync()
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(;)
+ listener: handleSend(augment, ;)
+ ensureSemicolon(augment)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(2, {, })
+ listener: endTopLevelMethod(augment, null, })
+ listener: endTopLevelDeclaration(augment)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(augment)
+ parseTopLevelMethod(}, augment, null, augment, Instance of 'SimpleTypeWith1Argument', get, topLevelProperty, false)
+ listener: beginTopLevelMethod(}, augment, null)
+ listener: handleIdentifier(List, typeReference)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(int, null)
+ listener: endTypeArguments(1, <, >)
+ listener: handleType(List, null)
+ ensureIdentifierPotentiallyRecovered(get, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(topLevelProperty, topLevelFunctionDeclaration)
+ listener: handleNoTypeVariables({)
+ parseGetterOrFormalParameters(topLevelProperty, topLevelProperty, true, MemberKind.TopLevelMethod)
+ listener: handleNoFormalParameters({, MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt(topLevelProperty)
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(topLevelProperty, false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, return)
+ parseStatement({)
+ parseStatementX({)
+ parseReturnStatement({)
+ listener: beginReturnStatement(return)
+ parseExpression(return)
+ parsePrecedenceExpression(return, 1, true)
+ parseUnaryExpression(return, true)
+ parsePrimary(return, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(return, null)
+ parseExpression(...)
+ parsePrecedenceExpression(..., 1, true)
+ parseUnaryExpression(..., true)
+ parsePrimary(..., expression)
+ parseAugmentSuperExpression(..., expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ listener: handleSpreadExpression(...)
+ parseExpression(,)
+ parsePrecedenceExpression(,, 1, true)
+ parseUnaryExpression(,, true)
+ parsePrimary(,, expression)
+ parseAugmentSuperExpression(,, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ parseArgumentOrIndexStar(super, Instance of 'NoTypeParamOrArg', false)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ listener: handleLiteralInt(0)
+ listener: handleIndexedExpression(null, [, ])
+ listener: handleLiteralList(2, [, null, ])
+ ensureSemicolon(])
+ listener: endReturnStatement(true, return, ;)
+ inGenerator()
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endTopLevelMethod(augment, get, })
+ listener: endTopLevelDeclaration(augment)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(augment)
+ parseTopLevelMethod(}, augment, null, augment, Instance of 'VoidType', set, topLevelProperty, false)
+ listener: beginTopLevelMethod(}, augment, null)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(set, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(topLevelProperty, topLevelFunctionDeclaration)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(topLevelProperty, topLevelProperty, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(topLevelProperty, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
+ parseMetadataStar(()
+ listener: beginMetadataStar(List)
+ listener: endMetadataStar(0)
+ listener: beginFormalParameter(List, MemberKind.TopLevelMethod, null, null, null)
+ listener: handleIdentifier(List, typeReference)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(int, null)
+ listener: endTypeArguments(1, <, >)
+ listener: handleType(List, null)
+ ensureIdentifier(>, formalParameterDeclaration)
+ listener: handleIdentifier(value, formalParameterDeclaration)
+ listener: handleFormalParameterWithoutValue())
+ listener: endFormalParameter(null, null, null, value, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatement({)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseAugmentSuperExpression({, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ parseArgumentOrIndexStar(super, Instance of 'NoTypeParamOrArg', false)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ listener: handleLiteralInt(0)
+ listener: handleIndexedExpression(null, [, ])
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ isNextIdentifier(=)
+ ensureIdentifier(=, expression)
+ listener: handleIdentifier(value, expression)
+ listener: handleNoTypeArguments([)
+ parseArgumentsOpt(value)
+ listener: handleNoArguments([)
+ listener: handleSend(value, [)
+ parseArgumentOrIndexStar(value, Instance of 'NoTypeParamOrArg', false)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ listener: handleLiteralInt(1)
+ listener: handleIndexedExpression(null, [, ])
+ listener: handleAssignmentExpression(=)
+ ensureSemicolon(])
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseAugmentSuperExpression(;, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ isNextIdentifier(=)
+ ensureIdentifier(=, expression)
+ listener: handleIdentifier(value, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(value)
+ listener: handleNoArguments(;)
+ listener: handleSend(value, ;)
+ listener: handleAssignmentExpression(=)
+ ensureSemicolon(value)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(2, {, })
+ listener: endTopLevelMethod(augment, set, })
+ listener: endTopLevelDeclaration(void)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(void)
+ parseTopLevelMethod(}, null, null, }, Instance of 'VoidType', null, injectedTopLevelMethod, false)
+ listener: beginTopLevelMethod(}, null, null)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(injectedTopLevelMethod, topLevelFunctionDeclaration)
+ parseMethodTypeVar(injectedTopLevelMethod)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(injectedTopLevelMethod, injectedTopLevelMethod, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(injectedTopLevelMethod, 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(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatement({)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseAugmentSuperExpression({, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ listener: handleNoTypeArguments(()
+ parseArguments(super)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ listener: endArguments(0, (, ))
+ listener: handleSend(augment, ;)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseAugmentSuperExpression(;, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ ensureSemicolon(super)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ reportRecoverableErrorWithToken(augment, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'augment' here., Try removing 'augment'., {lexeme: augment}], augment, augment)
+ parseExpressionStatementOrDeclarationAfterModifiers(augment, ;, null, null, null, false)
+ looksLikeLocalFunction(local)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(local)
+ listener: handleType(int, null)
+ listener: beginVariablesDeclaration(local, null, null)
+ parseVariablesDeclarationRest(int, true)
+ parseOptionallyInitializedIdentifier(int)
+ ensureIdentifier(int, localVariableDeclaration)
+ listener: handleIdentifier(local, localVariableDeclaration)
+ listener: beginInitializedIdentifier(local)
+ parseVariableInitializerOpt(local)
+ listener: handleNoVariableInitializer(local)
+ listener: endInitializedIdentifier(local)
+ ensureSemicolon(local)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(augment)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ inPlainSync()
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ inPlainSync()
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(;)
+ listener: handleSend(augment, ;)
+ ensureSemicolon(augment)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(4, {, })
+ listener: endTopLevelMethod(void, null, })
+ listener: endTopLevelDeclaration(augment)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ parseTopLevelKeywordDeclaration(}, class, null, Instance of 'DirectiveContext')
+ parseClassOrNamedMixinApplication(null, null, augment, class)
+ listener: beginClassOrMixinOrNamedMixinApplicationPrelude(class)
+ ensureIdentifier(class, classOrMixinDeclaration)
+ listener: handleIdentifier(Class, classOrMixinDeclaration)
+ listener: handleNoTypeVariables({)
+ listener: beginClassDeclaration(class, null, null, augment, Class)
+ parseClass(Class, class, class, Class)
+ parseClassHeaderOpt(Class, class, class)
+ parseClassExtendsOpt(Class)
+ listener: handleNoType(Class)
+ listener: handleClassExtends(null, 1)
+ parseClassWithClauseOpt(Class)
+ listener: handleClassNoWithClause()
+ parseClassOrMixinOrEnumImplementsOpt(Class)
+ listener: handleImplements(null, 0)
+ listener: handleClassHeader(class, class, null)
+ parseClassOrMixinOrExtensionBody(Class, DeclarationKind.Class, Class)
+ listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
+ notEofOrValue(}, augment)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Class, Class)
+ parseMetadataStar({)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod({, null, augment, null, null, null, null, null, augment, Instance of 'VoidType', null, instanceMethod, DeclarationKind.Class, Class, false)
+ listener: beginMethod(DeclarationKind.Class, augment, null, null, null, null, null, instanceMethod)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, methodDeclaration, false)
+ listener: handleIdentifier(instanceMethod, methodDeclaration)
+ parseQualifiedRestOpt(instanceMethod, methodDeclarationContinuation)
+ parseMethodTypeVar(instanceMethod)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(instanceMethod, instanceMethod, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(instanceMethod, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatement({)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseAugmentSuperExpression({, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ listener: handleNoTypeArguments(()
+ parseArguments(super)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ listener: endArguments(0, (, ))
+ listener: handleSend(augment, ;)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endClassMethod(null, augment, (, null, })
+ listener: endMember()
+ notEofOrValue(}, augment)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Class, Class)
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(}, null, augment, null, null, null, null, null, augment, Instance of 'VoidType', null, instanceMethodErrors, DeclarationKind.Class, Class, false)
+ listener: beginMethod(DeclarationKind.Class, augment, null, null, null, null, null, instanceMethodErrors)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, methodDeclaration, false)
+ listener: handleIdentifier(instanceMethodErrors, methodDeclaration)
+ parseQualifiedRestOpt(instanceMethodErrors, methodDeclarationContinuation)
+ parseMethodTypeVar(instanceMethodErrors)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(instanceMethodErrors, instanceMethodErrors, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(instanceMethodErrors, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ reportRecoverableErrorWithToken(augment, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'augment' here., Try removing 'augment'., {lexeme: augment}], augment, augment)
+ parseExpressionStatementOrDeclarationAfterModifiers(augment, {, null, null, null, false)
+ looksLikeLocalFunction(local)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(local)
+ listener: handleType(int, null)
+ listener: beginVariablesDeclaration(local, null, null)
+ parseVariablesDeclarationRest(int, true)
+ parseOptionallyInitializedIdentifier(int)
+ ensureIdentifier(int, localVariableDeclaration)
+ listener: handleIdentifier(local, localVariableDeclaration)
+ listener: beginInitializedIdentifier(local)
+ parseVariableInitializerOpt(local)
+ listener: handleNoVariableInitializer(local)
+ listener: endInitializedIdentifier(local)
+ ensureSemicolon(local)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(augment)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ inPlainSync()
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ inPlainSync()
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(;)
+ listener: handleSend(augment, ;)
+ ensureSemicolon(augment)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(2, {, })
+ listener: endClassMethod(null, augment, (, null, })
+ listener: endMember()
+ notEofOrValue(}, augment)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Class, Class)
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(}, null, augment, null, null, null, null, null, augment, Instance of 'SimpleType', get, instanceProperty, DeclarationKind.Class, Class, false)
+ listener: beginMethod(DeclarationKind.Class, augment, null, null, null, null, get, instanceProperty)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(get)
+ listener: handleType(int, null)
+ ensureIdentifierPotentiallyRecovered(get, methodDeclaration, false)
+ listener: handleIdentifier(instanceProperty, methodDeclaration)
+ parseQualifiedRestOpt(instanceProperty, methodDeclarationContinuation)
+ listener: handleNoTypeVariables({)
+ parseGetterOrFormalParameters(instanceProperty, instanceProperty, true, MemberKind.NonStaticMethod)
+ listener: handleNoFormalParameters({, MemberKind.NonStaticMethod)
+ parseInitializersOpt(instanceProperty)
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt(instanceProperty)
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(instanceProperty, false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatement({)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseAugmentSuperExpression({, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ listener: handleUnaryPostfixAssignmentExpression(++)
+ ensureSemicolon(++)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, --)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(--)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrecedenceExpression(--, 16, true)
+ parseUnaryExpression(--, true)
+ parsePrimary(--, expression)
+ parseAugmentSuperExpression(--, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ listener: handleUnaryPrefixAssignmentExpression(--)
+ ensureSemicolon(super)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, return)
+ parseStatement(;)
+ parseStatementX(;)
+ parseReturnStatement(;)
+ listener: beginReturnStatement(return)
+ parseExpression(return)
+ parsePrecedenceExpression(return, 1, true)
+ parseUnaryExpression(return, true)
+ parsePrecedenceExpression(-, 16, true)
+ parseUnaryExpression(-, true)
+ parsePrimary(-, expression)
+ parseAugmentSuperExpression(-, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ listener: handleUnaryPrefixExpression(-)
+ ensureSemicolon(super)
+ listener: endReturnStatement(true, return, ;)
+ inGenerator()
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(3, {, })
+ listener: endClassMethod(get, augment, {, null, })
+ listener: endMember()
+ notEofOrValue(}, augment)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Class, Class)
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(}, null, augment, null, null, null, null, null, augment, Instance of 'VoidType', set, instanceProperty, DeclarationKind.Class, Class, false)
+ listener: beginMethod(DeclarationKind.Class, augment, null, null, null, null, set, instanceProperty)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(set, methodDeclaration, false)
+ listener: handleIdentifier(instanceProperty, methodDeclaration)
+ parseQualifiedRestOpt(instanceProperty, methodDeclarationContinuation)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(instanceProperty, instanceProperty, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(instanceProperty, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.NonStaticMethod)
+ parseMetadataStar(()
+ listener: beginMetadataStar(int)
+ listener: endMetadataStar(0)
+ listener: beginFormalParameter(int, MemberKind.NonStaticMethod, null, null, null)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(value)
+ listener: handleType(int, null)
+ ensureIdentifier(int, formalParameterDeclaration)
+ listener: handleIdentifier(value, formalParameterDeclaration)
+ listener: handleFormalParameterWithoutValue())
+ listener: endFormalParameter(null, null, null, value, null, null, FormalParameterKind.requiredPositional, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatement({)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseAugmentSuperExpression({, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ isNextIdentifier(=)
+ ensureIdentifier(=, expression)
+ listener: handleIdentifier(value, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(value)
+ listener: handleNoArguments(;)
+ listener: handleSend(value, ;)
+ listener: handleAssignmentExpression(=)
+ ensureSemicolon(value)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endClassMethod(set, augment, (, null, })
+ listener: endMember()
+ notEofOrValue(}, void)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Class, Class)
+ parseMetadataStar(})
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'VoidType', null, injectedInstanceMethod, DeclarationKind.Class, Class, false)
+ listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, null, injectedInstanceMethod)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, methodDeclaration, false)
+ listener: handleIdentifier(injectedInstanceMethod, methodDeclaration)
+ parseQualifiedRestOpt(injectedInstanceMethod, methodDeclarationContinuation)
+ parseMethodTypeVar(injectedInstanceMethod)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(injectedInstanceMethod, injectedInstanceMethod, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(injectedInstanceMethod, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatement({)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseAugmentSuperExpression({, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ listener: handleNoTypeArguments(()
+ parseArguments(super)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ listener: endArguments(0, (, ))
+ listener: handleSend(augment, ;)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseAugmentSuperExpression(;, expression)
+ listener: handleAugmentSuperExpression(augment, super, expression)
+ ensureSemicolon(super)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ reportRecoverableErrorWithToken(augment, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'augment' here., Try removing 'augment'., {lexeme: augment}], augment, augment)
+ parseExpressionStatementOrDeclarationAfterModifiers(augment, ;, null, null, null, false)
+ looksLikeLocalFunction(local)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(local)
+ listener: handleType(int, null)
+ listener: beginVariablesDeclaration(local, null, null)
+ parseVariablesDeclarationRest(int, true)
+ parseOptionallyInitializedIdentifier(int)
+ ensureIdentifier(int, localVariableDeclaration)
+ listener: handleIdentifier(local, localVariableDeclaration)
+ listener: beginInitializedIdentifier(local)
+ parseVariableInitializerOpt(local)
+ listener: handleNoVariableInitializer(local)
+ listener: endInitializedIdentifier(local)
+ ensureSemicolon(local)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(augment)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ inPlainSync()
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ inPlainSync()
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(;)
+ listener: handleSend(augment, ;)
+ ensureSemicolon(augment)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(4, {, })
+ listener: endClassMethod(null, void, (, null, })
+ listener: endMember()
+ notEofOrValue(}, })
+ listener: endClassOrMixinOrExtensionBody(DeclarationKind.Class, 5, {, })
+ listener: endClassDeclaration(class, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(augment)
+ listener: endCompilationUnit(6, )
diff --git a/pkg/front_end/parser_testcases/augmentation/augment_super.dart.parser.expect b/pkg/front_end/parser_testcases/augmentation/augment_super.dart.parser.expect
new file mode 100644
index 0000000..a85b796
--- /dev/null
+++ b/pkg/front_end/parser_testcases/augmentation/augment_super.dart.parser.expect
@@ -0,0 +1,107 @@
+augment void topLevelMethod() {
+augment super();
+}
+
+augment void topLevelMethodError() {
+augment int local;
+augment;
+}
+
+
+augment List<int> get topLevelProperty {
+return [... augment super, augment super[0]];
+}
+
+augment void set topLevelProperty(List<int> value) {
+augment super[0] = value[1];
+augment super = value;
+}
+
+void injectedTopLevelMethod() {
+augment super();
+augment super;
+augment int local;
+augment;
+}
+
+augment class Class {
+augment void instanceMethod() {
+augment super();
+}
+
+augment void instanceMethodErrors() {
+augment int local;
+augment;
+}
+
+augment int get instanceProperty {
+augment super++;
+--augment super;
+return -augment super;
+}
+
+augment void set instanceProperty(int value) {
+augment super = value;
+}
+
+void injectedInstanceMethod() {
+augment super();
+augment super;
+augment int local;
+augment;
+}
+}
+
+augment[KeywordToken] void[KeywordToken] topLevelMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] void[KeywordToken] topLevelMethodError[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+
+augment[KeywordToken] List[StringToken]<[BeginToken]int[StringToken]>[SimpleToken] get[KeywordToken] topLevelProperty[StringToken] {[BeginToken]
+return[KeywordToken] [[BeginToken]...[SimpleToken] augment[KeywordToken] super[KeywordToken],[SimpleToken] augment[KeywordToken] super[KeywordToken][[BeginToken]0[StringToken]][SimpleToken]][SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] void[KeywordToken] set[KeywordToken] topLevelProperty[StringToken]([BeginToken]List[StringToken]<[BeginToken]int[StringToken]>[SimpleToken] value[StringToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken][[BeginToken]0[StringToken]][SimpleToken] =[SimpleToken] value[StringToken][[BeginToken]1[StringToken]][SimpleToken];[SimpleToken]
+augment[KeywordToken] super[KeywordToken] =[SimpleToken] value[StringToken];[SimpleToken]
+}[SimpleToken]
+
+void[KeywordToken] injectedTopLevelMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+augment[KeywordToken] super[KeywordToken];[SimpleToken]
+augment[KeywordToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] class[KeywordToken] Class[StringToken] {[BeginToken]
+augment[KeywordToken] void[KeywordToken] instanceMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] void[KeywordToken] instanceMethodErrors[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] int[StringToken] get[KeywordToken] instanceProperty[StringToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken]++[SimpleToken];[SimpleToken]
+--[SimpleToken]augment[KeywordToken] super[KeywordToken];[SimpleToken]
+return[KeywordToken] -[SimpleToken]augment[KeywordToken] super[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] void[KeywordToken] set[KeywordToken] instanceProperty[StringToken]([BeginToken]int[StringToken] value[StringToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken] =[SimpleToken] value[StringToken];[SimpleToken]
+}[SimpleToken]
+
+void[KeywordToken] injectedInstanceMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+augment[KeywordToken] super[KeywordToken];[SimpleToken]
+augment[KeywordToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[KeywordToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/augmentation/augment_super.dart.scanner.expect b/pkg/front_end/parser_testcases/augmentation/augment_super.dart.scanner.expect
new file mode 100644
index 0000000..a85b796
--- /dev/null
+++ b/pkg/front_end/parser_testcases/augmentation/augment_super.dart.scanner.expect
@@ -0,0 +1,107 @@
+augment void topLevelMethod() {
+augment super();
+}
+
+augment void topLevelMethodError() {
+augment int local;
+augment;
+}
+
+
+augment List<int> get topLevelProperty {
+return [... augment super, augment super[0]];
+}
+
+augment void set topLevelProperty(List<int> value) {
+augment super[0] = value[1];
+augment super = value;
+}
+
+void injectedTopLevelMethod() {
+augment super();
+augment super;
+augment int local;
+augment;
+}
+
+augment class Class {
+augment void instanceMethod() {
+augment super();
+}
+
+augment void instanceMethodErrors() {
+augment int local;
+augment;
+}
+
+augment int get instanceProperty {
+augment super++;
+--augment super;
+return -augment super;
+}
+
+augment void set instanceProperty(int value) {
+augment super = value;
+}
+
+void injectedInstanceMethod() {
+augment super();
+augment super;
+augment int local;
+augment;
+}
+}
+
+augment[KeywordToken] void[KeywordToken] topLevelMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] void[KeywordToken] topLevelMethodError[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+
+augment[KeywordToken] List[StringToken]<[BeginToken]int[StringToken]>[SimpleToken] get[KeywordToken] topLevelProperty[StringToken] {[BeginToken]
+return[KeywordToken] [[BeginToken]...[SimpleToken] augment[KeywordToken] super[KeywordToken],[SimpleToken] augment[KeywordToken] super[KeywordToken][[BeginToken]0[StringToken]][SimpleToken]][SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] void[KeywordToken] set[KeywordToken] topLevelProperty[StringToken]([BeginToken]List[StringToken]<[BeginToken]int[StringToken]>[SimpleToken] value[StringToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken][[BeginToken]0[StringToken]][SimpleToken] =[SimpleToken] value[StringToken][[BeginToken]1[StringToken]][SimpleToken];[SimpleToken]
+augment[KeywordToken] super[KeywordToken] =[SimpleToken] value[StringToken];[SimpleToken]
+}[SimpleToken]
+
+void[KeywordToken] injectedTopLevelMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+augment[KeywordToken] super[KeywordToken];[SimpleToken]
+augment[KeywordToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] class[KeywordToken] Class[StringToken] {[BeginToken]
+augment[KeywordToken] void[KeywordToken] instanceMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] void[KeywordToken] instanceMethodErrors[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] int[StringToken] get[KeywordToken] instanceProperty[StringToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken]++[SimpleToken];[SimpleToken]
+--[SimpleToken]augment[KeywordToken] super[KeywordToken];[SimpleToken]
+return[KeywordToken] -[SimpleToken]augment[KeywordToken] super[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+augment[KeywordToken] void[KeywordToken] set[KeywordToken] instanceProperty[StringToken]([BeginToken]int[StringToken] value[StringToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken] =[SimpleToken] value[StringToken];[SimpleToken]
+}[SimpleToken]
+
+void[KeywordToken] injectedInstanceMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[KeywordToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+augment[KeywordToken] super[KeywordToken];[SimpleToken]
+augment[KeywordToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[KeywordToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/general/augment_super.dart b/pkg/front_end/parser_testcases/general/augment_super.dart
new file mode 100644
index 0000000..ef21ddf
--- /dev/null
+++ b/pkg/front_end/parser_testcases/general/augment_super.dart
@@ -0,0 +1,53 @@
+augment void topLevelMethod() {
+ augment super();
+}
+
+augment void topLevelMethodError() {
+ augment int local;
+ augment;
+}
+
+
+augment List<int> get topLevelProperty {
+ return [... augment super, augment super[0]];
+}
+
+augment void set topLevelProperty(List<int> value) {
+ augment super[0] = value[1];
+ augment super = value;
+}
+
+void injectedTopLevelMethod() {
+ augment super();
+ augment super;
+ augment int local;
+ augment;
+}
+
+augment class Class {
+ augment void instanceMethod() {
+ augment super();
+ }
+
+ augment void instanceMethodErrors() {
+ augment int local;
+ augment;
+ }
+
+ augment int get instanceProperty {
+ augment super++;
+ --augment super;
+ return -augment super;
+ }
+
+ augment void set instanceProperty(int value) {
+ augment super = value;
+ }
+
+ void injectedInstanceMethod() {
+ augment super();
+ augment super;
+ augment int local;
+ augment;
+ }
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/general/augment_super.dart.expect b/pkg/front_end/parser_testcases/general/augment_super.dart.expect
new file mode 100644
index 0000000..6eeeb58
--- /dev/null
+++ b/pkg/front_end/parser_testcases/general/augment_super.dart.expect
@@ -0,0 +1,790 @@
+Problems reported:
+
+parser/general/augment_super:1:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+augment void topLevelMethod() {
+^^^^^^^
+
+parser/general/augment_super:1:1: Expected ';' after this.
+augment void topLevelMethod() {
+^^^^^^^
+
+parser/general/augment_super:2:11: 'super' can't be used as an identifier because it's a keyword.
+ augment super();
+ ^^^^^
+
+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() {
+^^^^^^^
+
+parser/general/augment_super:5:1: Expected ';' after this.
+augment void topLevelMethodError() {
+^^^^^^^
+
+parser/general/augment_super:6:11: Expected ';' after this.
+ augment int local;
+ ^^^
+
+parser/general/augment_super:11:9: A function declaration needs an explicit list of parameters.
+augment List<int> get topLevelProperty {
+ ^^^^
+
+parser/general/augment_super:11:19: Expected a function body, but got 'get'.
+augment List<int> get topLevelProperty {
+ ^^^
+
+parser/general/augment_super:12:23: Expected ',' before this.
+ return [... augment super, augment super[0]];
+ ^^^^^
+
+parser/general/augment_super:12:38: Expected ',' before this.
+ return [... augment super, augment super[0]];
+ ^^^^^
+
+parser/general/augment_super:15:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+augment void set topLevelProperty(List<int> value) {
+^^^^^^^
+
+parser/general/augment_super:15:1: Expected ';' after this.
+augment void set topLevelProperty(List<int> value) {
+^^^^^^^
+
+parser/general/augment_super:16:11: 'super' can't be used as an identifier because it's a keyword.
+ augment super[0] = value[1];
+ ^^^^^
+
+parser/general/augment_super:16:11: Expected ';' after this.
+ augment super[0] = value[1];
+ ^^^^^
+
+parser/general/augment_super:17:11: 'super' can't be used as an identifier because it's a keyword.
+ augment super = value;
+ ^^^^^
+
+parser/general/augment_super:21:11: 'super' can't be used as an identifier because it's a keyword.
+ augment super();
+ ^^^^^
+
+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;
+ ^^^^^
+
+parser/general/augment_super:23:11: Expected ';' after this.
+ augment int local;
+ ^^^
+
+parser/general/augment_super:27:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+augment class Class {
+^^^^^^^
+
+parser/general/augment_super:27:1: Expected ';' after this.
+augment class Class {
+^^^^^^^
+
+parser/general/augment_super:28:3: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+ augment void instanceMethod() {
+ ^^^^^^^
+
+parser/general/augment_super:28:3: Expected ';' after this.
+ augment void instanceMethod() {
+ ^^^^^^^
+
+parser/general/augment_super:29:13: 'super' can't be used as an identifier because it's a keyword.
+ augment super();
+ ^^^^^
+
+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() {
+ ^^^^^^^
+
+parser/general/augment_super:32:3: Expected ';' after this.
+ augment void instanceMethodErrors() {
+ ^^^^^^^
+
+parser/general/augment_super:33:13: Expected ';' after this.
+ augment int local;
+ ^^^
+
+parser/general/augment_super:37:11: Expected ';' after this.
+ augment int get instanceProperty {
+ ^^^
+
+parser/general/augment_super:38:13: 'super' can't be used as an identifier because it's a keyword.
+ augment super++;
+ ^^^^^
+
+parser/general/augment_super:38:13: Expected ';' after this.
+ augment super++;
+ ^^^^^
+
+parser/general/augment_super:38:20: Expected an identifier, but got ';'.
+ augment super++;
+ ^
+
+parser/general/augment_super:39:7: Expected ';' after this.
+ --augment super;
+ ^^^^^^^
+
+parser/general/augment_super:40:13: Expected ';' after this.
+ return -augment super;
+ ^^^^^^^
+
+parser/general/augment_super:43:3: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+ augment void set instanceProperty(int value) {
+ ^^^^^^^
+
+parser/general/augment_super:43:3: Expected ';' after this.
+ augment void set instanceProperty(int value) {
+ ^^^^^^^
+
+parser/general/augment_super:44:13: 'super' can't be used as an identifier because it's a keyword.
+ augment super = value;
+ ^^^^^
+
+parser/general/augment_super:48:13: 'super' can't be used as an identifier because it's a keyword.
+ augment super();
+ ^^^^^
+
+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;
+ ^^^^^
+
+parser/general/augment_super:50:13: Expected ';' after this.
+ augment int local;
+ ^^^
+
+beginCompilationUnit(augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginTopLevelMember(augment)
+ beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, )
+ handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ handleNoType()
+ handleIdentifier(augment, topLevelVariableDeclaration)
+ handleNoFieldInitializer(void)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ endTopLevelFields(null, null, null, null, null, 1, augment, ;)
+ endTopLevelDeclaration(void)
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginTopLevelMember(void)
+ beginTopLevelMethod(;, null, null)
+ handleVoidKeyword(void)
+ handleIdentifier(topLevelMethod, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(super)
+ handleType(augment, null)
+ beginVariablesDeclaration(super, null, null)
+ handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ handleIdentifier(super, localVariableDeclaration)
+ beginInitializedIdentifier(super)
+ handleNoVariableInitializer(super)
+ endInitializedIdentifier(super)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ endVariablesDeclaration(1, ;)
+ handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
+ handleIdentifier(, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(, ))
+ handleParenthesizedExpression(()
+ handleExpressionStatement(;)
+ endBlockFunctionBody(2, {, })
+ endTopLevelMethod(void, null, })
+ endTopLevelDeclaration(augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginTopLevelMember(augment)
+ beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
+ handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ handleNoType(})
+ handleIdentifier(augment, topLevelVariableDeclaration)
+ handleNoFieldInitializer(void)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ endTopLevelFields(null, null, null, null, null, 1, augment, ;)
+ endTopLevelDeclaration(void)
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginTopLevelMember(void)
+ beginTopLevelMethod(;, null, null)
+ handleVoidKeyword(void)
+ handleIdentifier(topLevelMethodError, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(int)
+ handleType(augment, null)
+ beginVariablesDeclaration(int, null, null)
+ handleIdentifier(int, localVariableDeclaration)
+ beginInitializedIdentifier(int)
+ handleNoVariableInitializer(int)
+ endInitializedIdentifier(int)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], int, int)
+ endVariablesDeclaration(1, ;)
+ handleIdentifier(local, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(local, ;)
+ handleExpressionStatement(;)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(3, {, })
+ endTopLevelMethod(void, null, })
+ endTopLevelDeclaration(augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginTopLevelMember(augment)
+ beginTopLevelMethod(}, null, null)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(List)
+ handleType(augment, null)
+ handleIdentifier(List, topLevelFunctionDeclaration)
+ beginTypeVariables(<)
+ beginMetadataStar(int)
+ endMetadataStar(0)
+ handleIdentifier(int, typeVariableDeclaration)
+ beginTypeVariable(int)
+ handleTypeVariablesDefined(int, 1)
+ handleNoType(int)
+ endTypeVariable(>, 0, null, null)
+ endTypeVariables(<, >)
+ handleRecoverableError(MissingFunctionParameters, List, List)
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ handleRecoverableError(Message[ExpectedFunctionBody, Expected a function body, but got 'get'., null, {lexeme: get}], get, get)
+ handleInvalidFunctionBody({)
+ endTopLevelMethod(augment, null, })
+ endTopLevelDeclaration(get)
+ beginMetadataStar(get)
+ endMetadataStar(0)
+ beginTopLevelMember(get)
+ beginTopLevelMethod(}, null, null)
+ handleNoType(})
+ handleIdentifier(topLevelProperty, topLevelFunctionDeclaration)
+ handleNoTypeVariables({)
+ handleNoFormalParameters({, MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginReturnStatement(return)
+ handleNoTypeArguments([)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(super)
+ handleNoArguments(super)
+ handleSend(augment, super)
+ handleSpreadExpression(...)
+ handleRecoverableError(Message[ExpectedButGot, Expected ',' before this., null, {string: ,}], super, super)
+ handleSuperExpression(super, expression)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(super)
+ handleNoArguments(super)
+ handleSend(augment, super)
+ handleRecoverableError(Message[ExpectedButGot, Expected ',' before this., null, {string: ,}], super, super)
+ handleSuperExpression(super, expression)
+ handleLiteralInt(0)
+ handleIndexedExpression(null, [, ])
+ handleLiteralList(4, [, null, ])
+ endReturnStatement(true, return, ;)
+ endBlockFunctionBody(1, {, })
+ endTopLevelMethod(get, get, })
+ endTopLevelDeclaration(augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginTopLevelMember(augment)
+ beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
+ handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ handleNoType(})
+ handleIdentifier(augment, topLevelVariableDeclaration)
+ handleNoFieldInitializer(void)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ endTopLevelFields(null, null, null, null, null, 1, augment, ;)
+ endTopLevelDeclaration(void)
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginTopLevelMember(void)
+ beginTopLevelMethod(;, null, null)
+ handleVoidKeyword(void)
+ handleIdentifier(topLevelProperty, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ beginMetadataStar(List)
+ endMetadataStar(0)
+ beginFormalParameter(List, MemberKind.TopLevelMethod, null, null, null)
+ handleIdentifier(List, typeReference)
+ beginTypeArguments(<)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(>)
+ handleType(int, null)
+ endTypeArguments(1, <, >)
+ handleType(List, null)
+ handleIdentifier(value, formalParameterDeclaration)
+ handleFormalParameterWithoutValue())
+ endFormalParameter(null, null, null, value, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
+ endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(super)
+ handleType(augment, null)
+ beginVariablesDeclaration(super, null, null)
+ handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ handleIdentifier(super, localVariableDeclaration)
+ beginInitializedIdentifier(super)
+ handleNoVariableInitializer(super)
+ endInitializedIdentifier(super)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ endVariablesDeclaration(1, ;)
+ handleNoTypeArguments([)
+ handleLiteralInt(0)
+ handleLiteralList(1, [, null, ])
+ handleIdentifier(value, expression)
+ handleNoTypeArguments([)
+ handleNoArguments([)
+ handleSend(value, [)
+ handleLiteralInt(1)
+ handleIndexedExpression(null, [, ])
+ handleAssignmentExpression(=)
+ handleExpressionStatement(;)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(super)
+ handleType(augment, null)
+ beginVariablesDeclaration(super, null, null)
+ handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ handleIdentifier(super, localVariableDeclaration)
+ beginInitializedIdentifier(super)
+ beginVariableInitializer(=)
+ handleIdentifier(value, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(value, ;)
+ endVariableInitializer(=)
+ endInitializedIdentifier(super)
+ endVariablesDeclaration(1, ;)
+ endBlockFunctionBody(3, {, })
+ endTopLevelMethod(void, set, })
+ endTopLevelDeclaration(void)
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginTopLevelMember(void)
+ beginTopLevelMethod(}, null, null)
+ handleVoidKeyword(void)
+ handleIdentifier(injectedTopLevelMethod, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(super)
+ handleType(augment, null)
+ beginVariablesDeclaration(super, null, null)
+ handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ handleIdentifier(super, localVariableDeclaration)
+ beginInitializedIdentifier(super)
+ handleNoVariableInitializer(super)
+ endInitializedIdentifier(super)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ endVariablesDeclaration(1, ;)
+ handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
+ handleIdentifier(, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(, ))
+ handleParenthesizedExpression(()
+ handleExpressionStatement(;)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(super)
+ handleType(augment, null)
+ beginVariablesDeclaration(super, null, null)
+ handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ handleIdentifier(super, localVariableDeclaration)
+ beginInitializedIdentifier(super)
+ handleNoVariableInitializer(super)
+ endInitializedIdentifier(super)
+ endVariablesDeclaration(1, ;)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(int)
+ handleType(augment, null)
+ beginVariablesDeclaration(int, null, null)
+ handleIdentifier(int, localVariableDeclaration)
+ beginInitializedIdentifier(int)
+ handleNoVariableInitializer(int)
+ endInitializedIdentifier(int)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], int, int)
+ endVariablesDeclaration(1, ;)
+ handleIdentifier(local, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(local, ;)
+ handleExpressionStatement(;)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(6, {, })
+ endTopLevelMethod(void, null, })
+ endTopLevelDeclaration(augment)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginTopLevelMember(augment)
+ beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
+ handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ handleNoType(})
+ handleIdentifier(augment, topLevelVariableDeclaration)
+ handleNoFieldInitializer(class)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ endTopLevelFields(null, null, null, null, null, 1, augment, ;)
+ endTopLevelDeclaration(class)
+ beginMetadataStar(class)
+ endMetadataStar(0)
+ beginClassOrMixinOrNamedMixinApplicationPrelude(class)
+ handleIdentifier(Class, classOrMixinDeclaration)
+ handleNoTypeVariables({)
+ beginClassDeclaration(class, null, null, null, Class)
+ handleNoType(Class)
+ handleClassExtends(null, 1)
+ handleClassNoWithClause()
+ handleImplements(null, 0)
+ handleClassHeader(class, class, null)
+ beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginMember()
+ beginFields(DeclarationKind.Class, null, null, null, null, null, null, null, {)
+ handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ handleNoType({)
+ handleIdentifier(augment, fieldDeclaration)
+ handleNoFieldInitializer(void)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ endClassFields(null, null, null, null, null, null, null, 1, augment, ;)
+ endMember()
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(DeclarationKind.Class, null, null, null, null, null, null, instanceMethod)
+ handleVoidKeyword(void)
+ handleIdentifier(instanceMethod, methodDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.NonStaticMethod)
+ endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(super)
+ handleType(augment, null)
+ beginVariablesDeclaration(super, null, null)
+ handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ handleIdentifier(super, localVariableDeclaration)
+ beginInitializedIdentifier(super)
+ handleNoVariableInitializer(super)
+ endInitializedIdentifier(super)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ endVariablesDeclaration(1, ;)
+ handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
+ handleIdentifier(, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(, ))
+ handleParenthesizedExpression(()
+ handleExpressionStatement(;)
+ endBlockFunctionBody(2, {, })
+ endClassMethod(null, void, (, null, })
+ endMember()
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginMember()
+ beginFields(DeclarationKind.Class, null, null, null, null, null, null, null, })
+ handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ handleNoType(})
+ handleIdentifier(augment, fieldDeclaration)
+ handleNoFieldInitializer(void)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ endClassFields(null, null, null, null, null, null, null, 1, augment, ;)
+ endMember()
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(DeclarationKind.Class, null, null, null, null, null, null, instanceMethodErrors)
+ handleVoidKeyword(void)
+ handleIdentifier(instanceMethodErrors, methodDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.NonStaticMethod)
+ endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(int)
+ handleType(augment, null)
+ beginVariablesDeclaration(int, null, null)
+ handleIdentifier(int, localVariableDeclaration)
+ beginInitializedIdentifier(int)
+ handleNoVariableInitializer(int)
+ endInitializedIdentifier(int)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], int, int)
+ endVariablesDeclaration(1, ;)
+ handleIdentifier(local, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(local, ;)
+ handleExpressionStatement(;)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(3, {, })
+ endClassMethod(null, void, (, null, })
+ endMember()
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginMember()
+ beginFields(DeclarationKind.Class, null, null, null, null, null, null, null, })
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(int)
+ handleType(augment, null)
+ handleIdentifier(int, fieldDeclaration)
+ handleNoFieldInitializer(get)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], int, int)
+ endClassFields(null, null, null, null, null, null, null, 1, augment, ;)
+ endMember()
+ beginMetadataStar(get)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(DeclarationKind.Class, null, null, null, null, null, get, instanceProperty)
+ handleNoType(;)
+ handleIdentifier(instanceProperty, methodDeclaration)
+ handleNoTypeVariables({)
+ handleNoFormalParameters({, MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(super)
+ handleType(augment, null)
+ beginVariablesDeclaration(super, null, null)
+ handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ handleIdentifier(super, localVariableDeclaration)
+ beginInitializedIdentifier(super)
+ handleNoVariableInitializer(super)
+ endInitializedIdentifier(super)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ endVariablesDeclaration(1, ;)
+ handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ';'., Try inserting an identifier before ';'., {lexeme: ;}], ;, ;)
+ handleIdentifier(, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(, ;)
+ handleUnaryPrefixAssignmentExpression(++)
+ handleExpressionStatement(;)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(super)
+ handleNoArguments(super)
+ handleSend(augment, super)
+ handleUnaryPrefixAssignmentExpression(--)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ handleExpressionStatement(;)
+ handleSuperExpression(super, expression)
+ handleExpressionStatement(;)
+ beginReturnStatement(return)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(super)
+ handleNoArguments(super)
+ handleSend(augment, super)
+ handleUnaryPrefixExpression(-)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ endReturnStatement(true, return, ;)
+ handleSuperExpression(super, expression)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(6, {, })
+ endClassMethod(get, get, {, null, })
+ endMember()
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ beginMember()
+ beginFields(DeclarationKind.Class, null, null, null, null, null, null, null, })
+ handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ handleNoType(})
+ handleIdentifier(augment, fieldDeclaration)
+ handleNoFieldInitializer(void)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ endClassFields(null, null, null, null, null, null, null, 1, augment, ;)
+ endMember()
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(DeclarationKind.Class, null, null, null, null, null, set, instanceProperty)
+ handleVoidKeyword(void)
+ handleIdentifier(instanceProperty, methodDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.NonStaticMethod)
+ beginMetadataStar(int)
+ endMetadataStar(0)
+ beginFormalParameter(int, MemberKind.NonStaticMethod, null, null, null)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(value)
+ handleType(int, null)
+ handleIdentifier(value, formalParameterDeclaration)
+ handleFormalParameterWithoutValue())
+ endFormalParameter(null, null, null, value, null, null, FormalParameterKind.requiredPositional, MemberKind.NonStaticMethod)
+ endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(super)
+ handleType(augment, null)
+ beginVariablesDeclaration(super, null, null)
+ handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ handleIdentifier(super, localVariableDeclaration)
+ beginInitializedIdentifier(super)
+ beginVariableInitializer(=)
+ handleIdentifier(value, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(value, ;)
+ endVariableInitializer(=)
+ endInitializedIdentifier(super)
+ endVariablesDeclaration(1, ;)
+ endBlockFunctionBody(1, {, })
+ endClassMethod(set, void, (, null, })
+ endMember()
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(DeclarationKind.Class, null, null, null, null, null, null, injectedInstanceMethod)
+ handleVoidKeyword(void)
+ handleIdentifier(injectedInstanceMethod, methodDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.NonStaticMethod)
+ endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(super)
+ handleType(augment, null)
+ beginVariablesDeclaration(super, null, null)
+ handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ handleIdentifier(super, localVariableDeclaration)
+ beginInitializedIdentifier(super)
+ handleNoVariableInitializer(super)
+ endInitializedIdentifier(super)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ endVariablesDeclaration(1, ;)
+ handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
+ handleIdentifier(, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(, ))
+ handleParenthesizedExpression(()
+ handleExpressionStatement(;)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(super)
+ handleType(augment, null)
+ beginVariablesDeclaration(super, null, null)
+ handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ handleIdentifier(super, localVariableDeclaration)
+ beginInitializedIdentifier(super)
+ handleNoVariableInitializer(super)
+ endInitializedIdentifier(super)
+ endVariablesDeclaration(1, ;)
+ beginMetadataStar(augment)
+ endMetadataStar(0)
+ handleIdentifier(augment, typeReference)
+ handleNoTypeArguments(int)
+ handleType(augment, null)
+ beginVariablesDeclaration(int, null, null)
+ handleIdentifier(int, localVariableDeclaration)
+ beginInitializedIdentifier(int)
+ handleNoVariableInitializer(int)
+ endInitializedIdentifier(int)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], int, int)
+ endVariablesDeclaration(1, ;)
+ handleIdentifier(local, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(local, ;)
+ handleExpressionStatement(;)
+ handleIdentifier(augment, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(augment, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(6, {, })
+ endClassMethod(null, void, (, null, })
+ endMember()
+ endClassOrMixinOrExtensionBody(DeclarationKind.Class, 9, {, })
+ endClassDeclaration(class, })
+ endTopLevelDeclaration()
+endCompilationUnit(11, )
diff --git a/pkg/front_end/parser_testcases/general/augment_super.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/augment_super.dart.intertwined.expect
new file mode 100644
index 0000000..4cb40bd
--- /dev/null
+++ b/pkg/front_end/parser_testcases/general/augment_super.dart.intertwined.expect
@@ -0,0 +1,1473 @@
+parseUnit(augment)
+ skipErrorTokens(augment)
+ listener: beginCompilationUnit(augment)
+ syntheticPreviousToken(augment)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(augment)
+ isReservedKeyword(void)
+ indicatesMethodOrField(topLevelMethod)
+ parseFields(, null, null, null, null, null, null, null, , Instance of 'NoType', augment, DeclarationKind.TopLevel, null, false)
+ listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, )
+ reportRecoverableError(augment, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ listener: handleNoType()
+ ensureIdentifierPotentiallyRecovered(, topLevelVariableDeclaration, false)
+ listener: handleIdentifier(augment, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(augment, augment, null, null, null, null, null, DeclarationKind.TopLevel, null)
+ listener: handleNoFieldInitializer(void)
+ ensureSemicolon(augment)
+ reportRecoverableError(augment, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ rewriter()
+ listener: endTopLevelFields(null, null, null, null, null, 1, augment, ;)
+ listener: endTopLevelDeclaration(void)
+ parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+ parseMetadataStar(;)
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(;)
+ listener: beginTopLevelMember(void)
+ parseTopLevelMethod(;, null, null, ;, Instance of 'VoidType', null, topLevelMethod, false)
+ listener: beginTopLevelMethod(;, null, null)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(topLevelMethod, topLevelFunctionDeclaration)
+ parseMethodTypeVar(topLevelMethod)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(topLevelMethod, topLevelMethod, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(topLevelMethod, 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(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(super)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(super, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, localVariableDeclaration)
+ listener: beginInitializedIdentifier(super)
+ parseVariableInitializerOpt(super)
+ listener: handleNoVariableInitializer(super)
+ listener: endInitializedIdentifier(super)
+ ensureSemicolon(super)
+ reportRecoverableError(super, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ rewriter()
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, ()
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(()
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseParenthesizedExpressionOrFunctionLiteral(;)
+ parseParenthesizedExpression(;)
+ parseExpressionInParenthesis(;)
+ parseExpressionInParenthesisRest(()
+ 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: handleParenthesizedExpression(()
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(2, {, })
+ listener: endTopLevelMethod(void, null, })
+ listener: endTopLevelDeclaration(augment)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(augment)
+ isReservedKeyword(void)
+ indicatesMethodOrField(topLevelMethodError)
+ parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', augment, DeclarationKind.TopLevel, null, false)
+ listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
+ reportRecoverableError(augment, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ listener: handleNoType(})
+ ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
+ listener: handleIdentifier(augment, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(augment, augment, null, null, null, null, null, DeclarationKind.TopLevel, null)
+ listener: handleNoFieldInitializer(void)
+ ensureSemicolon(augment)
+ reportRecoverableError(augment, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ rewriter()
+ listener: endTopLevelFields(null, null, null, null, null, 1, augment, ;)
+ listener: endTopLevelDeclaration(void)
+ parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+ parseMetadataStar(;)
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(;)
+ listener: beginTopLevelMember(void)
+ parseTopLevelMethod(;, null, null, ;, Instance of 'VoidType', null, topLevelMethodError, false)
+ listener: beginTopLevelMethod(;, null, null)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(topLevelMethodError, topLevelFunctionDeclaration)
+ parseMethodTypeVar(topLevelMethodError)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(topLevelMethodError, topLevelMethodError, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(topLevelMethodError, 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(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(int)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(int)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(int, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ listener: handleIdentifier(int, localVariableDeclaration)
+ listener: beginInitializedIdentifier(int)
+ parseVariableInitializerOpt(int)
+ listener: handleNoVariableInitializer(int)
+ listener: endInitializedIdentifier(int)
+ ensureSemicolon(int)
+ reportRecoverableError(int, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], int, int)
+ rewriter()
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, local)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(local)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(local, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(local)
+ listener: handleNoArguments(;)
+ listener: handleSend(local, ;)
+ ensureSemicolon(local)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(augment)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(;)
+ listener: handleSend(augment, ;)
+ ensureSemicolon(augment)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(3, {, })
+ listener: endTopLevelMethod(void, null, })
+ listener: endTopLevelDeclaration(augment)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(augment)
+ parseTopLevelMethod(}, null, null, }, Instance of 'SimpleType', null, List, false)
+ listener: beginTopLevelMethod(}, null, null)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(List)
+ listener: handleType(augment, null)
+ ensureIdentifierPotentiallyRecovered(augment, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(List, topLevelFunctionDeclaration)
+ parseMethodTypeVar(List)
+ listener: beginTypeVariables(<)
+ listener: beginMetadataStar(int)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(int, typeVariableDeclaration)
+ listener: beginTypeVariable(int)
+ listener: handleTypeVariablesDefined(int, 1)
+ listener: handleNoType(int)
+ listener: endTypeVariable(>, 0, null, null)
+ listener: endTypeVariables(<, >)
+ parseGetterOrFormalParameters(>, List, false, MemberKind.TopLevelMethod)
+ missingParameterMessage(MemberKind.TopLevelMethod)
+ reportRecoverableError(List, MissingFunctionParameters)
+ listener: handleRecoverableError(MissingFunctionParameters, List, List)
+ rewriter()
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ ensureBlock(), Instance of 'Template<(Token) => Message>', null)
+ reportRecoverableError(get, Message[ExpectedFunctionBody, Expected a function body, but got 'get'., null, {lexeme: get}])
+ listener: handleRecoverableError(Message[ExpectedFunctionBody, Expected a function body, but got 'get'., null, {lexeme: get}], get, get)
+ insertBlock())
+ rewriter()
+ rewriter()
+ listener: handleInvalidFunctionBody({)
+ listener: endTopLevelMethod(augment, null, })
+ listener: endTopLevelDeclaration(get)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(get)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(get)
+ isReservedKeyword({)
+ parseTopLevelMethod(}, null, null, }, Instance of 'NoType', get, topLevelProperty, false)
+ listener: beginTopLevelMethod(}, null, null)
+ listener: handleNoType(})
+ ensureIdentifierPotentiallyRecovered(get, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(topLevelProperty, topLevelFunctionDeclaration)
+ listener: handleNoTypeVariables({)
+ parseGetterOrFormalParameters(topLevelProperty, topLevelProperty, true, MemberKind.TopLevelMethod)
+ listener: handleNoFormalParameters({, MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt(topLevelProperty)
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(topLevelProperty, false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, return)
+ parseStatement({)
+ parseStatementX({)
+ parseReturnStatement({)
+ listener: beginReturnStatement(return)
+ parseExpression(return)
+ parsePrecedenceExpression(return, 1, true)
+ parseUnaryExpression(return, true)
+ parsePrimary(return, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(return, null)
+ parseExpression(...)
+ parsePrecedenceExpression(..., 1, true)
+ parseUnaryExpression(..., true)
+ parsePrimary(..., expression)
+ parseSendOrFunctionLiteral(..., expression)
+ parseSend(..., expression)
+ isNextIdentifier(...)
+ ensureIdentifier(..., expression)
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(super)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(super)
+ listener: handleSend(augment, super)
+ listener: handleSpreadExpression(...)
+ rewriteAndRecover(augment, Message[ExpectedButGot, Expected ',' before this., null, {string: ,}], ,)
+ reportRecoverableError(super, Message[ExpectedButGot, Expected ',' before this., null, {string: ,}])
+ listener: handleRecoverableError(Message[ExpectedButGot, Expected ',' before this., null, {string: ,}], super, super)
+ rewriter()
+ parseExpression(,)
+ parsePrecedenceExpression(,, 1, true)
+ parseUnaryExpression(,, true)
+ parsePrimary(,, expression)
+ parseSuperExpression(,, expression)
+ listener: handleSuperExpression(super, expression)
+ parseExpression(,)
+ parsePrecedenceExpression(,, 1, true)
+ parseUnaryExpression(,, true)
+ parsePrimary(,, expression)
+ parseSendOrFunctionLiteral(,, expression)
+ parseSend(,, expression)
+ isNextIdentifier(,)
+ ensureIdentifier(,, expression)
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(super)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(super)
+ listener: handleSend(augment, super)
+ rewriteAndRecover(augment, Message[ExpectedButGot, Expected ',' before this., null, {string: ,}], ,)
+ reportRecoverableError(super, Message[ExpectedButGot, Expected ',' before this., null, {string: ,}])
+ listener: handleRecoverableError(Message[ExpectedButGot, Expected ',' before this., null, {string: ,}], super, super)
+ rewriter()
+ parseExpression(,)
+ parsePrecedenceExpression(,, 1, true)
+ parseUnaryExpression(,, true)
+ parsePrimary(,, expression)
+ parseSuperExpression(,, expression)
+ listener: handleSuperExpression(super, expression)
+ parseArgumentOrIndexStar(super, Instance of 'NoTypeParamOrArg', false)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ listener: handleLiteralInt(0)
+ listener: handleIndexedExpression(null, [, ])
+ listener: handleLiteralList(4, [, null, ])
+ ensureSemicolon(])
+ listener: endReturnStatement(true, return, ;)
+ inGenerator()
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endTopLevelMethod(get, get, })
+ listener: endTopLevelDeclaration(augment)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(augment)
+ isReservedKeyword(void)
+ indicatesMethodOrField(set)
+ parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', augment, DeclarationKind.TopLevel, null, false)
+ listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
+ reportRecoverableError(augment, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ listener: handleNoType(})
+ ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
+ listener: handleIdentifier(augment, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(augment, augment, null, null, null, null, null, DeclarationKind.TopLevel, null)
+ listener: handleNoFieldInitializer(void)
+ ensureSemicolon(augment)
+ reportRecoverableError(augment, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ rewriter()
+ listener: endTopLevelFields(null, null, null, null, null, 1, augment, ;)
+ listener: endTopLevelDeclaration(void)
+ parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+ parseMetadataStar(;)
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(;)
+ listener: beginTopLevelMember(void)
+ parseTopLevelMethod(;, null, null, ;, Instance of 'VoidType', set, topLevelProperty, false)
+ listener: beginTopLevelMethod(;, null, null)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(set, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(topLevelProperty, topLevelFunctionDeclaration)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(topLevelProperty, topLevelProperty, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(topLevelProperty, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
+ parseMetadataStar(()
+ listener: beginMetadataStar(List)
+ listener: endMetadataStar(0)
+ listener: beginFormalParameter(List, MemberKind.TopLevelMethod, null, null, null)
+ listener: handleIdentifier(List, typeReference)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(int, null)
+ listener: endTypeArguments(1, <, >)
+ listener: handleType(List, null)
+ ensureIdentifier(>, formalParameterDeclaration)
+ listener: handleIdentifier(value, formalParameterDeclaration)
+ listener: handleFormalParameterWithoutValue())
+ listener: endFormalParameter(null, null, null, value, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(super)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(super, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, localVariableDeclaration)
+ listener: beginInitializedIdentifier(super)
+ parseVariableInitializerOpt(super)
+ listener: handleNoVariableInitializer(super)
+ listener: endInitializedIdentifier(super)
+ ensureSemicolon(super)
+ reportRecoverableError(super, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ rewriter()
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, [)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction([)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(;, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ listener: handleLiteralInt(0)
+ listener: handleLiteralList(1, [, null, ])
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ isNextIdentifier(=)
+ ensureIdentifier(=, expression)
+ listener: handleIdentifier(value, expression)
+ listener: handleNoTypeArguments([)
+ parseArgumentsOpt(value)
+ listener: handleNoArguments([)
+ listener: handleSend(value, [)
+ parseArgumentOrIndexStar(value, Instance of 'NoTypeParamOrArg', false)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ listener: handleLiteralInt(1)
+ listener: handleIndexedExpression(null, [, ])
+ listener: handleAssignmentExpression(=)
+ ensureSemicolon(])
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(super)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(super, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, localVariableDeclaration)
+ listener: beginInitializedIdentifier(super)
+ parseVariableInitializerOpt(super)
+ listener: beginVariableInitializer(=)
+ parseExpression(=)
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ isNextIdentifier(=)
+ ensureIdentifier(=, expression)
+ listener: handleIdentifier(value, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(value)
+ listener: handleNoArguments(;)
+ listener: handleSend(value, ;)
+ listener: endVariableInitializer(=)
+ listener: endInitializedIdentifier(super)
+ ensureSemicolon(value)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(3, {, })
+ listener: endTopLevelMethod(void, set, })
+ listener: endTopLevelDeclaration(void)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(void)
+ parseTopLevelMethod(}, null, null, }, Instance of 'VoidType', null, injectedTopLevelMethod, false)
+ listener: beginTopLevelMethod(}, null, null)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(injectedTopLevelMethod, topLevelFunctionDeclaration)
+ parseMethodTypeVar(injectedTopLevelMethod)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(injectedTopLevelMethod, injectedTopLevelMethod, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(injectedTopLevelMethod, 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(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(super)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(super, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, localVariableDeclaration)
+ listener: beginInitializedIdentifier(super)
+ parseVariableInitializerOpt(super)
+ listener: handleNoVariableInitializer(super)
+ listener: endInitializedIdentifier(super)
+ ensureSemicolon(super)
+ reportRecoverableError(super, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ rewriter()
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, ()
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(()
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseParenthesizedExpressionOrFunctionLiteral(;)
+ parseParenthesizedExpression(;)
+ parseExpressionInParenthesis(;)
+ parseExpressionInParenthesisRest(()
+ 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: handleParenthesizedExpression(()
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(super)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(super, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, localVariableDeclaration)
+ listener: beginInitializedIdentifier(super)
+ parseVariableInitializerOpt(super)
+ listener: handleNoVariableInitializer(super)
+ listener: endInitializedIdentifier(super)
+ ensureSemicolon(super)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(int)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(int)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(int, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ listener: handleIdentifier(int, localVariableDeclaration)
+ listener: beginInitializedIdentifier(int)
+ parseVariableInitializerOpt(int)
+ listener: handleNoVariableInitializer(int)
+ listener: endInitializedIdentifier(int)
+ ensureSemicolon(int)
+ reportRecoverableError(int, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], int, int)
+ rewriter()
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, local)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(local)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(local, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(local)
+ listener: handleNoArguments(;)
+ listener: handleSend(local, ;)
+ ensureSemicolon(local)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(augment)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(;)
+ listener: handleSend(augment, ;)
+ ensureSemicolon(augment)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(6, {, })
+ listener: endTopLevelMethod(void, null, })
+ listener: endTopLevelDeclaration(augment)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(augment)
+ isReservedKeyword(class)
+ indicatesMethodOrField(Class)
+ parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', augment, DeclarationKind.TopLevel, null, false)
+ listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
+ reportRecoverableError(augment, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ listener: handleNoType(})
+ ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
+ listener: handleIdentifier(augment, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(augment, augment, null, null, null, null, null, DeclarationKind.TopLevel, null)
+ listener: handleNoFieldInitializer(class)
+ ensureSemicolon(augment)
+ reportRecoverableError(augment, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ rewriter()
+ listener: endTopLevelFields(null, null, null, null, null, 1, augment, ;)
+ listener: endTopLevelDeclaration(class)
+ parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+ parseMetadataStar(;)
+ listener: beginMetadataStar(class)
+ listener: endMetadataStar(0)
+ parseTopLevelKeywordDeclaration(;, class, null, Instance of 'DirectiveContext')
+ parseClassOrNamedMixinApplication(null, null, null, class)
+ listener: beginClassOrMixinOrNamedMixinApplicationPrelude(class)
+ ensureIdentifier(class, classOrMixinDeclaration)
+ listener: handleIdentifier(Class, classOrMixinDeclaration)
+ listener: handleNoTypeVariables({)
+ listener: beginClassDeclaration(class, null, null, null, Class)
+ parseClass(Class, class, class, Class)
+ parseClassHeaderOpt(Class, class, class)
+ parseClassExtendsOpt(Class)
+ listener: handleNoType(Class)
+ listener: handleClassExtends(null, 1)
+ parseClassWithClauseOpt(Class)
+ listener: handleClassNoWithClause()
+ parseClassOrMixinOrEnumImplementsOpt(Class)
+ listener: handleImplements(null, 0)
+ listener: handleClassHeader(class, class, null)
+ parseClassOrMixinOrExtensionBody(Class, DeclarationKind.Class, Class)
+ listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
+ notEofOrValue(}, augment)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Class, Class)
+ parseMetadataStar({)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ isReservedKeyword(void)
+ indicatesMethodOrField(instanceMethod)
+ parseFields({, null, null, null, null, null, null, null, {, Instance of 'NoType', augment, DeclarationKind.Class, Class, false)
+ listener: beginFields(DeclarationKind.Class, null, null, null, null, null, null, null, {)
+ reportRecoverableError(augment, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ listener: handleNoType({)
+ ensureIdentifierPotentiallyRecovered({, fieldDeclaration, false)
+ listener: handleIdentifier(augment, fieldDeclaration)
+ parseFieldInitializerOpt(augment, augment, null, null, null, null, null, DeclarationKind.Class, Class)
+ listener: handleNoFieldInitializer(void)
+ ensureSemicolon(augment)
+ reportRecoverableError(augment, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ rewriter()
+ listener: endClassFields(null, null, null, null, null, null, null, 1, augment, ;)
+ listener: endMember()
+ notEofOrValue(}, void)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(;, DeclarationKind.Class, Class)
+ parseMetadataStar(;)
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'VoidType', null, instanceMethod, DeclarationKind.Class, Class, false)
+ listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, null, instanceMethod)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, methodDeclaration, false)
+ listener: handleIdentifier(instanceMethod, methodDeclaration)
+ parseQualifiedRestOpt(instanceMethod, methodDeclarationContinuation)
+ parseMethodTypeVar(instanceMethod)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(instanceMethod, instanceMethod, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(instanceMethod, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(super)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(super, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, localVariableDeclaration)
+ listener: beginInitializedIdentifier(super)
+ parseVariableInitializerOpt(super)
+ listener: handleNoVariableInitializer(super)
+ listener: endInitializedIdentifier(super)
+ ensureSemicolon(super)
+ reportRecoverableError(super, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ rewriter()
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, ()
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(()
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseParenthesizedExpressionOrFunctionLiteral(;)
+ parseParenthesizedExpression(;)
+ parseExpressionInParenthesis(;)
+ parseExpressionInParenthesisRest(()
+ 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: handleParenthesizedExpression(()
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(2, {, })
+ listener: endClassMethod(null, void, (, null, })
+ listener: endMember()
+ notEofOrValue(}, augment)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Class, Class)
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ isReservedKeyword(void)
+ indicatesMethodOrField(instanceMethodErrors)
+ parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', augment, DeclarationKind.Class, Class, false)
+ listener: beginFields(DeclarationKind.Class, null, null, null, null, null, null, null, })
+ reportRecoverableError(augment, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ listener: handleNoType(})
+ ensureIdentifierPotentiallyRecovered(}, fieldDeclaration, false)
+ listener: handleIdentifier(augment, fieldDeclaration)
+ parseFieldInitializerOpt(augment, augment, null, null, null, null, null, DeclarationKind.Class, Class)
+ listener: handleNoFieldInitializer(void)
+ ensureSemicolon(augment)
+ reportRecoverableError(augment, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ rewriter()
+ listener: endClassFields(null, null, null, null, null, null, null, 1, augment, ;)
+ listener: endMember()
+ notEofOrValue(}, void)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(;, DeclarationKind.Class, Class)
+ parseMetadataStar(;)
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'VoidType', null, instanceMethodErrors, DeclarationKind.Class, Class, false)
+ listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, null, instanceMethodErrors)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, methodDeclaration, false)
+ listener: handleIdentifier(instanceMethodErrors, methodDeclaration)
+ parseQualifiedRestOpt(instanceMethodErrors, methodDeclarationContinuation)
+ parseMethodTypeVar(instanceMethodErrors)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(instanceMethodErrors, instanceMethodErrors, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(instanceMethodErrors, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(int)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(int)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(int, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ listener: handleIdentifier(int, localVariableDeclaration)
+ listener: beginInitializedIdentifier(int)
+ parseVariableInitializerOpt(int)
+ listener: handleNoVariableInitializer(int)
+ listener: endInitializedIdentifier(int)
+ ensureSemicolon(int)
+ reportRecoverableError(int, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], int, int)
+ rewriter()
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, local)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(local)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(local, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(local)
+ listener: handleNoArguments(;)
+ listener: handleSend(local, ;)
+ ensureSemicolon(local)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(augment)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(;)
+ listener: handleSend(augment, ;)
+ ensureSemicolon(augment)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(3, {, })
+ listener: endClassMethod(null, void, (, null, })
+ listener: endMember()
+ notEofOrValue(}, augment)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Class, Class)
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseFields(}, null, null, null, null, null, null, null, }, Instance of 'SimpleType', int, DeclarationKind.Class, Class, false)
+ listener: beginFields(DeclarationKind.Class, null, null, null, null, null, null, null, })
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(int)
+ listener: handleType(augment, null)
+ ensureIdentifierPotentiallyRecovered(augment, fieldDeclaration, false)
+ listener: handleIdentifier(int, fieldDeclaration)
+ parseFieldInitializerOpt(int, int, null, null, null, null, null, DeclarationKind.Class, Class)
+ listener: handleNoFieldInitializer(get)
+ ensureSemicolon(int)
+ reportRecoverableError(int, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], int, int)
+ rewriter()
+ listener: endClassFields(null, null, null, null, null, null, null, 1, augment, ;)
+ listener: endMember()
+ notEofOrValue(}, get)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(;, DeclarationKind.Class, Class)
+ parseMetadataStar(;)
+ listener: beginMetadataStar(get)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', get, instanceProperty, DeclarationKind.Class, Class, false)
+ listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, get, instanceProperty)
+ listener: handleNoType(;)
+ ensureIdentifierPotentiallyRecovered(get, methodDeclaration, false)
+ listener: handleIdentifier(instanceProperty, methodDeclaration)
+ parseQualifiedRestOpt(instanceProperty, methodDeclarationContinuation)
+ listener: handleNoTypeVariables({)
+ parseGetterOrFormalParameters(instanceProperty, instanceProperty, true, MemberKind.NonStaticMethod)
+ listener: handleNoFormalParameters({, MemberKind.NonStaticMethod)
+ parseInitializersOpt(instanceProperty)
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt(instanceProperty)
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(instanceProperty, false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(super)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(super, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, localVariableDeclaration)
+ listener: beginInitializedIdentifier(super)
+ parseVariableInitializerOpt(super)
+ listener: handleNoVariableInitializer(super)
+ listener: endInitializedIdentifier(super)
+ ensureSemicolon(super)
+ reportRecoverableError(super, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ rewriter()
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, ++)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(++)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrecedenceExpression(++, 16, 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(, ;)
+ listener: handleUnaryPrefixAssignmentExpression(++)
+ ensureSemicolon()
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, --)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(--)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrecedenceExpression(--, 16, true)
+ parseUnaryExpression(--, true)
+ parsePrimary(--, expression)
+ parseSendOrFunctionLiteral(--, expression)
+ parseSend(--, expression)
+ isNextIdentifier(--)
+ ensureIdentifier(--, expression)
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(super)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(super)
+ listener: handleSend(augment, super)
+ listener: handleUnaryPrefixAssignmentExpression(--)
+ ensureSemicolon(augment)
+ reportRecoverableError(augment, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ rewriter()
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, super)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(super)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSuperExpression(;, expression)
+ listener: handleSuperExpression(super, expression)
+ ensureSemicolon(super)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, return)
+ parseStatement(;)
+ parseStatementX(;)
+ parseReturnStatement(;)
+ listener: beginReturnStatement(return)
+ parseExpression(return)
+ parsePrecedenceExpression(return, 1, true)
+ parseUnaryExpression(return, true)
+ parsePrecedenceExpression(-, 16, true)
+ parseUnaryExpression(-, true)
+ parsePrimary(-, expression)
+ parseSendOrFunctionLiteral(-, expression)
+ parseSend(-, expression)
+ isNextIdentifier(-)
+ ensureIdentifier(-, expression)
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(super)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(super)
+ listener: handleSend(augment, super)
+ listener: handleUnaryPrefixExpression(-)
+ ensureSemicolon(augment)
+ reportRecoverableError(augment, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ rewriter()
+ listener: endReturnStatement(true, return, ;)
+ inGenerator()
+ notEofOrValue(}, super)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(super)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSuperExpression(;, expression)
+ listener: handleSuperExpression(super, expression)
+ ensureSemicolon(super)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(6, {, })
+ listener: endClassMethod(get, get, {, null, })
+ listener: endMember()
+ notEofOrValue(}, augment)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Class, Class)
+ parseMetadataStar(})
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ isReservedKeyword(void)
+ indicatesMethodOrField(set)
+ parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', augment, DeclarationKind.Class, Class, false)
+ listener: beginFields(DeclarationKind.Class, null, null, null, null, null, null, null, })
+ reportRecoverableError(augment, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
+ listener: handleNoType(})
+ ensureIdentifierPotentiallyRecovered(}, fieldDeclaration, false)
+ listener: handleIdentifier(augment, fieldDeclaration)
+ parseFieldInitializerOpt(augment, augment, null, null, null, null, null, DeclarationKind.Class, Class)
+ listener: handleNoFieldInitializer(void)
+ ensureSemicolon(augment)
+ reportRecoverableError(augment, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
+ rewriter()
+ listener: endClassFields(null, null, null, null, null, null, null, 1, augment, ;)
+ listener: endMember()
+ notEofOrValue(}, void)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(;, DeclarationKind.Class, Class)
+ parseMetadataStar(;)
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'VoidType', set, instanceProperty, DeclarationKind.Class, Class, false)
+ listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, set, instanceProperty)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(set, methodDeclaration, false)
+ listener: handleIdentifier(instanceProperty, methodDeclaration)
+ parseQualifiedRestOpt(instanceProperty, methodDeclarationContinuation)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(instanceProperty, instanceProperty, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(instanceProperty, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.NonStaticMethod)
+ parseMetadataStar(()
+ listener: beginMetadataStar(int)
+ listener: endMetadataStar(0)
+ listener: beginFormalParameter(int, MemberKind.NonStaticMethod, null, null, null)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(value)
+ listener: handleType(int, null)
+ ensureIdentifier(int, formalParameterDeclaration)
+ listener: handleIdentifier(value, formalParameterDeclaration)
+ listener: handleFormalParameterWithoutValue())
+ listener: endFormalParameter(null, null, null, value, null, null, FormalParameterKind.requiredPositional, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(super)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(super, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, localVariableDeclaration)
+ listener: beginInitializedIdentifier(super)
+ parseVariableInitializerOpt(super)
+ listener: beginVariableInitializer(=)
+ parseExpression(=)
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ isNextIdentifier(=)
+ ensureIdentifier(=, expression)
+ listener: handleIdentifier(value, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(value)
+ listener: handleNoArguments(;)
+ listener: handleSend(value, ;)
+ listener: endVariableInitializer(=)
+ listener: endInitializedIdentifier(super)
+ ensureSemicolon(value)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endClassMethod(set, void, (, null, })
+ listener: endMember()
+ notEofOrValue(}, void)
+ parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Class, Class)
+ parseMetadataStar(})
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'VoidType', null, injectedInstanceMethod, DeclarationKind.Class, Class, false)
+ listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, null, injectedInstanceMethod)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, methodDeclaration, false)
+ listener: handleIdentifier(injectedInstanceMethod, methodDeclaration)
+ parseQualifiedRestOpt(injectedInstanceMethod, methodDeclarationContinuation)
+ parseMethodTypeVar(injectedInstanceMethod)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(injectedInstanceMethod, injectedInstanceMethod, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(injectedInstanceMethod, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, augment)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(super)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(super, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, localVariableDeclaration)
+ listener: beginInitializedIdentifier(super)
+ parseVariableInitializerOpt(super)
+ listener: handleNoVariableInitializer(super)
+ listener: endInitializedIdentifier(super)
+ ensureSemicolon(super)
+ reportRecoverableError(super, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
+ rewriter()
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, ()
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclaration(;, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(()
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseParenthesizedExpressionOrFunctionLiteral(;)
+ parseParenthesizedExpression(;)
+ parseExpressionInParenthesis(;)
+ parseExpressionInParenthesisRest(()
+ 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: handleParenthesizedExpression(()
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(super)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(super, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, localVariableDeclaration)
+ listener: beginInitializedIdentifier(super)
+ parseVariableInitializerOpt(super)
+ listener: handleNoVariableInitializer(super)
+ listener: endInitializedIdentifier(super)
+ ensureSemicolon(super)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(int)
+ listener: beginMetadataStar(augment)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(augment, typeReference)
+ listener: handleNoTypeArguments(int)
+ listener: handleType(augment, null)
+ listener: beginVariablesDeclaration(int, null, null)
+ parseVariablesDeclarationRest(augment, true)
+ parseOptionallyInitializedIdentifier(augment)
+ ensureIdentifier(augment, localVariableDeclaration)
+ listener: handleIdentifier(int, localVariableDeclaration)
+ listener: beginInitializedIdentifier(int)
+ parseVariableInitializerOpt(int)
+ listener: handleNoVariableInitializer(int)
+ listener: endInitializedIdentifier(int)
+ ensureSemicolon(int)
+ reportRecoverableError(int, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], int, int)
+ rewriter()
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, local)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(local)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(local, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(local)
+ listener: handleNoArguments(;)
+ listener: handleSend(local, ;)
+ ensureSemicolon(local)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, augment)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(augment)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(augment, expression)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(augment)
+ listener: handleNoArguments(;)
+ listener: handleSend(augment, ;)
+ ensureSemicolon(augment)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(6, {, })
+ listener: endClassMethod(null, void, (, null, })
+ listener: endMember()
+ notEofOrValue(}, })
+ listener: endClassOrMixinOrExtensionBody(DeclarationKind.Class, 9, {, })
+ listener: endClassDeclaration(class, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(augment)
+ listener: endCompilationUnit(11, )
diff --git a/pkg/front_end/parser_testcases/general/augment_super.dart.parser.expect b/pkg/front_end/parser_testcases/general/augment_super.dart.parser.expect
new file mode 100644
index 0000000..0e2e061
--- /dev/null
+++ b/pkg/front_end/parser_testcases/general/augment_super.dart.parser.expect
@@ -0,0 +1,109 @@
+NOTICE: Stream was rewritten by parser!
+
+augment ;void topLevelMethod() {
+augment super;(*synthetic*);
+}
+
+augment ;void topLevelMethodError() {
+augment int ;local;
+augment;
+}
+
+
+augment List<int> (){}get topLevelProperty {
+return [... augment ,super, augment ,super[0]];
+}
+
+augment ;void set topLevelProperty(List<int> value) {
+augment super;[0] = value[1];
+augment super = value;
+}
+
+void injectedTopLevelMethod() {
+augment super;(*synthetic*);
+augment super;
+augment int ;local;
+augment;
+}
+
+augment ;class Class {
+augment ;void instanceMethod() {
+augment super;(*synthetic*);
+}
+
+augment ;void instanceMethodErrors() {
+augment int ;local;
+augment;
+}
+
+augment int ;get instanceProperty {
+augment super;++*synthetic*;
+--augment ;super;
+return -augment ;super;
+}
+
+augment ;void set instanceProperty(int value) {
+augment super = value;
+}
+
+void injectedInstanceMethod() {
+augment super;(*synthetic*);
+augment super;
+augment int ;local;
+augment;
+}
+}
+
+augment[StringToken] ;[SyntheticToken]void[KeywordToken] topLevelMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken][SyntheticStringToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[StringToken] ;[SyntheticToken]void[KeywordToken] topLevelMethodError[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] int[StringToken] ;[SyntheticToken]local[StringToken];[SimpleToken]
+augment[StringToken];[SimpleToken]
+}[SimpleToken]
+
+
+augment[StringToken] List[StringToken]<[BeginToken]int[StringToken]>[SimpleToken] ([SyntheticBeginToken])[SyntheticToken]{[SyntheticBeginToken]}[SyntheticToken]get[KeywordToken] topLevelProperty[StringToken] {[BeginToken]
+return[KeywordToken] [[BeginToken]...[SimpleToken] augment[StringToken] ,[SyntheticToken]super[KeywordToken],[SimpleToken] augment[StringToken] ,[SyntheticToken]super[KeywordToken][[BeginToken]0[StringToken]][SimpleToken]][SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[StringToken] ;[SyntheticToken]void[KeywordToken] set[KeywordToken] topLevelProperty[StringToken]([BeginToken]List[StringToken]<[BeginToken]int[StringToken]>[SimpleToken] value[StringToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken];[SyntheticToken][[BeginToken]0[StringToken]][SimpleToken] =[SimpleToken] value[StringToken][[BeginToken]1[StringToken]][SimpleToken];[SimpleToken]
+augment[StringToken] super[KeywordToken] =[SimpleToken] value[StringToken];[SimpleToken]
+}[SimpleToken]
+
+void[KeywordToken] injectedTopLevelMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken][SyntheticStringToken])[SimpleToken];[SimpleToken]
+augment[StringToken] super[KeywordToken];[SimpleToken]
+augment[StringToken] int[StringToken] ;[SyntheticToken]local[StringToken];[SimpleToken]
+augment[StringToken];[SimpleToken]
+}[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]
+}[SimpleToken]
+
+augment[StringToken] ;[SyntheticToken]void[KeywordToken] instanceMethodErrors[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] int[StringToken] ;[SyntheticToken]local[StringToken];[SimpleToken]
+augment[StringToken];[SimpleToken]
+}[SimpleToken]
+
+augment[StringToken] int[StringToken] ;[SyntheticToken]get[KeywordToken] instanceProperty[StringToken] {[BeginToken]
+augment[StringToken] super[KeywordToken];[SyntheticToken]++[SimpleToken][SyntheticStringToken];[SimpleToken]
+--[SimpleToken]augment[StringToken] ;[SyntheticToken]super[KeywordToken];[SimpleToken]
+return[KeywordToken] -[SimpleToken]augment[StringToken] ;[SyntheticToken]super[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+augment[StringToken] ;[SyntheticToken]void[KeywordToken] set[KeywordToken] instanceProperty[StringToken]([BeginToken]int[StringToken] value[StringToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken] =[SimpleToken] value[StringToken];[SimpleToken]
+}[SimpleToken]
+
+void[KeywordToken] injectedInstanceMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken];[SyntheticToken]([BeginToken][SyntheticStringToken])[SimpleToken];[SimpleToken]
+augment[StringToken] super[KeywordToken];[SimpleToken]
+augment[StringToken] int[StringToken] ;[SyntheticToken]local[StringToken];[SimpleToken]
+augment[StringToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/general/augment_super.dart.scanner.expect b/pkg/front_end/parser_testcases/general/augment_super.dart.scanner.expect
new file mode 100644
index 0000000..b6d4e43
--- /dev/null
+++ b/pkg/front_end/parser_testcases/general/augment_super.dart.scanner.expect
@@ -0,0 +1,107 @@
+augment void topLevelMethod() {
+augment super();
+}
+
+augment void topLevelMethodError() {
+augment int local;
+augment;
+}
+
+
+augment List<int> get topLevelProperty {
+return [... augment super, augment super[0]];
+}
+
+augment void set topLevelProperty(List<int> value) {
+augment super[0] = value[1];
+augment super = value;
+}
+
+void injectedTopLevelMethod() {
+augment super();
+augment super;
+augment int local;
+augment;
+}
+
+augment class Class {
+augment void instanceMethod() {
+augment super();
+}
+
+augment void instanceMethodErrors() {
+augment int local;
+augment;
+}
+
+augment int get instanceProperty {
+augment super++;
+--augment super;
+return -augment super;
+}
+
+augment void set instanceProperty(int value) {
+augment super = value;
+}
+
+void injectedInstanceMethod() {
+augment super();
+augment super;
+augment int local;
+augment;
+}
+}
+
+augment[StringToken] void[KeywordToken] topLevelMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[StringToken] void[KeywordToken] topLevelMethodError[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[StringToken];[SimpleToken]
+}[SimpleToken]
+
+
+augment[StringToken] List[StringToken]<[BeginToken]int[StringToken]>[SimpleToken] get[KeywordToken] topLevelProperty[StringToken] {[BeginToken]
+return[KeywordToken] [[BeginToken]...[SimpleToken] augment[StringToken] super[KeywordToken],[SimpleToken] augment[StringToken] super[KeywordToken][[BeginToken]0[StringToken]][SimpleToken]][SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[StringToken] void[KeywordToken] set[KeywordToken] topLevelProperty[StringToken]([BeginToken]List[StringToken]<[BeginToken]int[StringToken]>[SimpleToken] value[StringToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken][[BeginToken]0[StringToken]][SimpleToken] =[SimpleToken] value[StringToken][[BeginToken]1[StringToken]][SimpleToken];[SimpleToken]
+augment[StringToken] super[KeywordToken] =[SimpleToken] value[StringToken];[SimpleToken]
+}[SimpleToken]
+
+void[KeywordToken] injectedTopLevelMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+augment[StringToken] super[KeywordToken];[SimpleToken]
+augment[StringToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[StringToken];[SimpleToken]
+}[SimpleToken]
+
+augment[StringToken] class[KeywordToken] Class[StringToken] {[BeginToken]
+augment[StringToken] void[KeywordToken] instanceMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+
+augment[StringToken] void[KeywordToken] instanceMethodErrors[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[StringToken];[SimpleToken]
+}[SimpleToken]
+
+augment[StringToken] int[StringToken] get[KeywordToken] instanceProperty[StringToken] {[BeginToken]
+augment[StringToken] super[KeywordToken]++[SimpleToken];[SimpleToken]
+--[SimpleToken]augment[StringToken] super[KeywordToken];[SimpleToken]
+return[KeywordToken] -[SimpleToken]augment[StringToken] super[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+augment[StringToken] void[KeywordToken] set[KeywordToken] instanceProperty[StringToken]([BeginToken]int[StringToken] value[StringToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken] =[SimpleToken] value[StringToken];[SimpleToken]
+}[SimpleToken]
+
+void[KeywordToken] injectedInstanceMethod[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+augment[StringToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+augment[StringToken] super[KeywordToken];[SimpleToken]
+augment[StringToken] int[StringToken] local[StringToken];[SimpleToken]
+augment[StringToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/test/parser_test_listener.dart b/pkg/front_end/test/parser_test_listener.dart
index 0e1788a..70eba07 100644
--- a/pkg/front_end/test/parser_test_listener.dart
+++ b/pkg/front_end/test/parser_test_listener.dart
@@ -2553,6 +2553,17 @@
}
@override
+ void handleAugmentSuperExpression(
+ Token augmentToken, Token superToken, IdentifierContext context) {
+ seen(augmentToken);
+ seen(superToken);
+ doPrint('handleAugmentSuperExpression('
+ '$augmentToken, '
+ '$superToken, '
+ '$context)');
+ }
+
+ @override
void beginSwitchCase(int labelCount, int expressionCount, Token firstToken) {
seen(firstToken);
doPrint(
diff --git a/pkg/front_end/test/parser_test_parser.dart b/pkg/front_end/test/parser_test_parser.dart
index c270e56..d29de47 100644
--- a/pkg/front_end/test/parser_test_parser.dart
+++ b/pkg/front_end/test/parser_test_parser.dart
@@ -1619,6 +1619,15 @@
}
@override
+ Token parseAugmentSuperExpression(Token token, IdentifierContext context) {
+ doPrint('parseAugmentSuperExpression(' '$token, ' '$context)');
+ indent++;
+ var result = super.parseAugmentSuperExpression(token, context);
+ indent--;
+ return result;
+ }
+
+ @override
Token parseLiteralListSuffix(Token token, Token? constKeyword) {
doPrint('parseLiteralListSuffix(' '$token, ' '$constKeyword)');
indent++;
diff --git a/pkg/front_end/test/spell_checking_list_messages.txt b/pkg/front_end/test/spell_checking_list_messages.txt
index 00b69d3..bfbafd0 100644
--- a/pkg/front_end/test/spell_checking_list_messages.txt
+++ b/pkg/front_end/test/spell_checking_list_messages.txt
@@ -18,6 +18,7 @@
assigning
augment
augmentation
+augmentations
augmented
b
c
diff --git a/pkg/front_end/test/text_representation/internal_ast_text_representation_test.dart b/pkg/front_end/test/text_representation/internal_ast_text_representation_test.dart
index b5fffb7..a1d7543 100644
--- a/pkg/front_end/test/text_representation/internal_ast_text_representation_test.dart
+++ b/pkg/front_end/test/text_representation/internal_ast_text_representation_test.dart
@@ -516,8 +516,8 @@
void _testFunctionDeclarationImpl() {
testStatement(
- new FunctionDeclarationImpl(new VariableDeclarationImpl('foo', 0),
- new FunctionNode(new Block([]))),
+ new FunctionDeclarationImpl(
+ new VariableDeclarationImpl('foo'), new FunctionNode(new Block([]))),
'''
dynamic foo() {}''');
}
@@ -591,7 +591,7 @@
void _testNamedFunctionExpressionJudgment() {
testExpression(
- new NamedFunctionExpressionJudgment(new VariableDeclarationImpl('foo', 0,
+ new NamedFunctionExpressionJudgment(new VariableDeclarationImpl('foo',
initializer:
new FunctionExpression(new FunctionNode(new Block([]))))),
'''
@@ -687,13 +687,13 @@
}
void _testVariableDeclarationImpl() {
- testStatement(new VariableDeclarationImpl('foo', 0), '''
+ testStatement(new VariableDeclarationImpl('foo'), '''
dynamic foo;''');
testStatement(
- new VariableDeclarationImpl('foo', 0, initializer: new IntLiteral(0)), '''
+ new VariableDeclarationImpl('foo', initializer: new IntLiteral(0)), '''
dynamic foo = 0;''');
testStatement(
- new VariableDeclarationImpl('foo', 0,
+ new VariableDeclarationImpl('foo',
type: const VoidType(),
initializer: new IntLiteral(0),
isFinal: true,
@@ -701,20 +701,20 @@
'''
required final void foo;''');
testStatement(
- new VariableDeclarationImpl('foo', 0,
+ new VariableDeclarationImpl('foo',
type: const VoidType(), initializer: new IntLiteral(0), isLate: true),
'''
late void foo = 0;''');
testStatement(
- new VariableDeclarationImpl('foo', 0,
+ new VariableDeclarationImpl('foo',
type: const VoidType(), initializer: new IntLiteral(0))
- ..lateGetter = new VariableDeclarationImpl('foo#getter', 0),
+ ..lateGetter = new VariableDeclarationImpl('foo#getter'),
'''
late void foo = 0;''');
testStatement(
- new VariableDeclarationImpl('foo', 0,
+ new VariableDeclarationImpl('foo',
type: const VoidType(), initializer: new IntLiteral(0))
- ..lateGetter = new VariableDeclarationImpl('foo#getter', 0)
+ ..lateGetter = new VariableDeclarationImpl('foo#getter')
..lateType = const DynamicType(),
'''
late dynamic foo = 0;''');
diff --git a/pkg/front_end/testcases/macros/augment_super.dart b/pkg/front_end/testcases/macros/augment_super.dart
new file mode 100644
index 0000000..ff7d4a8
--- /dev/null
+++ b/pkg/front_end/testcases/macros/augment_super.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2022, 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.
+
+import augment 'augment_super_lib.dart';
+
+void topLevelMethod() {}
+void topLevelMethodErrors() {}
+List<int> get topLevelProperty => [42];
+void set topLevelProperty(List<int> value) {}
+
+class Class {
+ void instanceMethod() {}
+ void instanceMethodErrors() {}
+ int get instanceProperty => 42;
+ void set instanceProperty(int value) {}
+}
+
+main() {}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.strong.expect b/pkg/front_end/testcases/macros/augment_super.dart.strong.expect
new file mode 100644
index 0000000..d309789
--- /dev/null
+++ b/pkg/front_end/testcases/macros/augment_super.dart.strong.expect
@@ -0,0 +1,164 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:10:3: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
+// augment super = value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+// augment super(); // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+// augment super; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:27:3: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:37:5: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
+// augment super++;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
+// --augment super;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
+// augment super = value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+// augment super(); // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+// augment super; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:54:5: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///augment_super.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethod() → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ }
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethodErrors() → void {
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+ augment; // Error
+ ^^^^^^^" in this{<unresolved>}.augment;
+ }
+ get /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty() → core::int {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
+ augment super++;
+ ^" in null as{ForNonNullableByDefault} dynamic;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
+ --augment super;
+ ^" in null as{ForNonNullableByDefault} dynamic;
+ return (null as{ForNonNullableByDefault} dynamic){dynamic}.unary-() as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+ }
+ set /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty(core::int value) → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
+ augment super = value;
+ ^";
+ }
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+ augment super(); // Error
+ ^^^^^^^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+ augment super; // Error
+ ^^^^^^^";
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+ augment; // Error
+ ^^^^^^^" in this{<unresolved>}.augment;
+ }
+}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethod() → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+}
+static method topLevelMethodErrors() → void {}
+static get /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty() → core::List<core::int> {
+ return block {
+ final core::List<core::int> #t1 = <core::int>[];
+ for (final has-declared-initializer dynamic #t2 in (null as{ForNonNullableByDefault} dynamic) as{TypeError,ForDynamic,ForNonNullableByDefault} core::Iterable<dynamic>) {
+ final core::int #t3 = #t2 as{TypeError,ForNonNullableByDefault} core::int;
+ #t1.{core::List::add}{Invariant}(#t3){(core::int) → void};
+ }
+ #t1.{core::List::add}{Invariant}((null as{ForNonNullableByDefault} dynamic){dynamic}.[](0) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int){(core::int) → void};
+ } =>#t1;
+}
+static set /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty(core::List<core::int> value) → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.[]=(0, value.{core::List::[]}(1){(core::int) → core::int});
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
+ augment super = value;
+ ^";
+}
+static method main() → dynamic {}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void {
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+ augment; // Error
+ ^^^^^^^";
+}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+ augment super(); // Error
+ ^^^^^^^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+ augment super; // Error
+ ^^^^^^^";
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+ augment; // Error
+ ^^^^^^^";
+}
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.strong.transformed.expect b/pkg/front_end/testcases/macros/augment_super.dart.strong.transformed.expect
new file mode 100644
index 0000000..e1236aa
--- /dev/null
+++ b/pkg/front_end/testcases/macros/augment_super.dart.strong.transformed.expect
@@ -0,0 +1,180 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:10:3: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
+// augment super = value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+// augment super(); // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+// augment super; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:27:3: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:37:5: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
+// augment super++;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
+// --augment super;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
+// augment super = value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+// augment super(); // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+// augment super; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:54:5: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///augment_super.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethod() → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ }
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethodErrors() → void {
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+ augment; // Error
+ ^^^^^^^" in this{<unresolved>}.augment;
+ }
+ get /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty() → core::int {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
+ augment super++;
+ ^" in null as{ForNonNullableByDefault} dynamic;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
+ --augment super;
+ ^" in null as{ForNonNullableByDefault} dynamic;
+ return (null as{ForNonNullableByDefault} dynamic){dynamic}.unary-() as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+ }
+ set /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty(core::int value) → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
+ augment super = value;
+ ^";
+ }
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+ augment super(); // Error
+ ^^^^^^^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+ augment super; // Error
+ ^^^^^^^";
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+ augment; // Error
+ ^^^^^^^" in this{<unresolved>}.augment;
+ }
+}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethod() → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+}
+static method topLevelMethodErrors() → void {}
+static get /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty() → core::List<core::int> {
+ return block {
+ final core::List<core::int> #t1 = core::_GrowableList::•<core::int>(0);
+ {
+ core::Iterator<dynamic> :sync-for-iterator = ((null as{ForNonNullableByDefault} dynamic) as{TypeError,ForDynamic,ForNonNullableByDefault} core::Iterable<dynamic>).{core::Iterable::iterator}{core::Iterator<dynamic>};
+ for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
+ final dynamic #t2 = :sync-for-iterator.{core::Iterator::current}{dynamic};
+ {
+ final core::int #t3 = #t2 as{TypeError,ForNonNullableByDefault} core::int;
+ #t1.{core::List::add}{Invariant}(#t3){(core::int) → void};
+ }
+ }
+ }
+ #t1.{core::List::add}{Invariant}((null as{ForNonNullableByDefault} dynamic){dynamic}.[](0) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int){(core::int) → void};
+ } =>#t1;
+}
+static set /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty(core::List<core::int> value) → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.[]=(0, value.{core::List::[]}(1){(core::int) → core::int});
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
+ augment super = value;
+ ^";
+}
+static method main() → dynamic {}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void {
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+ augment; // Error
+ ^^^^^^^";
+}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+ augment super(); // Error
+ ^^^^^^^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+ augment super; // Error
+ ^^^^^^^";
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+ augment; // Error
+ ^^^^^^^";
+}
+
+
+Extra constant evaluation status:
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:33:5 -> NullConstant(null)
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:44:13 -> NullConstant(null)
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:6:3 -> NullConstant(null)
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:16:15 -> NullConstant(null)
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:16:30 -> NullConstant(null)
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:20:3 -> NullConstant(null)
+Extra constant evaluation: evaluated: 31, effectively constant: 6
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.textual_outline.expect b/pkg/front_end/testcases/macros/augment_super.dart.textual_outline.expect
new file mode 100644
index 0000000..ba14962
--- /dev/null
+++ b/pkg/front_end/testcases/macros/augment_super.dart.textual_outline.expect
@@ -0,0 +1,12 @@
+import augment 'augment_super_lib.dart';
+void topLevelMethod() {}
+void topLevelMethodErrors() {}
+List<int> get topLevelProperty => [42];
+void set topLevelProperty(List<int> value) {}
+class Class {
+ void instanceMethod() {}
+ void instanceMethodErrors() {}
+ int get instanceProperty => 42;
+ void set instanceProperty(int value) {}
+}
+main() {}
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.weak.expect b/pkg/front_end/testcases/macros/augment_super.dart.weak.expect
new file mode 100644
index 0000000..d309789
--- /dev/null
+++ b/pkg/front_end/testcases/macros/augment_super.dart.weak.expect
@@ -0,0 +1,164 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:10:3: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
+// augment super = value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+// augment super(); // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+// augment super; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:27:3: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:37:5: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
+// augment super++;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
+// --augment super;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
+// augment super = value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+// augment super(); // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+// augment super; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:54:5: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///augment_super.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethod() → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ }
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethodErrors() → void {
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+ augment; // Error
+ ^^^^^^^" in this{<unresolved>}.augment;
+ }
+ get /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty() → core::int {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
+ augment super++;
+ ^" in null as{ForNonNullableByDefault} dynamic;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
+ --augment super;
+ ^" in null as{ForNonNullableByDefault} dynamic;
+ return (null as{ForNonNullableByDefault} dynamic){dynamic}.unary-() as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+ }
+ set /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty(core::int value) → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
+ augment super = value;
+ ^";
+ }
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+ augment super(); // Error
+ ^^^^^^^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+ augment super; // Error
+ ^^^^^^^";
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+ augment; // Error
+ ^^^^^^^" in this{<unresolved>}.augment;
+ }
+}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethod() → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+}
+static method topLevelMethodErrors() → void {}
+static get /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty() → core::List<core::int> {
+ return block {
+ final core::List<core::int> #t1 = <core::int>[];
+ for (final has-declared-initializer dynamic #t2 in (null as{ForNonNullableByDefault} dynamic) as{TypeError,ForDynamic,ForNonNullableByDefault} core::Iterable<dynamic>) {
+ final core::int #t3 = #t2 as{TypeError,ForNonNullableByDefault} core::int;
+ #t1.{core::List::add}{Invariant}(#t3){(core::int) → void};
+ }
+ #t1.{core::List::add}{Invariant}((null as{ForNonNullableByDefault} dynamic){dynamic}.[](0) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int){(core::int) → void};
+ } =>#t1;
+}
+static set /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty(core::List<core::int> value) → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.[]=(0, value.{core::List::[]}(1){(core::int) → core::int});
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
+ augment super = value;
+ ^";
+}
+static method main() → dynamic {}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void {
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+ augment; // Error
+ ^^^^^^^";
+}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+ augment super(); // Error
+ ^^^^^^^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+ augment super; // Error
+ ^^^^^^^";
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+ augment; // Error
+ ^^^^^^^";
+}
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.weak.modular.expect b/pkg/front_end/testcases/macros/augment_super.dart.weak.modular.expect
new file mode 100644
index 0000000..d309789
--- /dev/null
+++ b/pkg/front_end/testcases/macros/augment_super.dart.weak.modular.expect
@@ -0,0 +1,164 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:10:3: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
+// augment super = value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+// augment super(); // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+// augment super; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:27:3: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:37:5: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
+// augment super++;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
+// --augment super;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
+// augment super = value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+// augment super(); // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+// augment super; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:54:5: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///augment_super.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethod() → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ }
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethodErrors() → void {
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+ augment; // Error
+ ^^^^^^^" in this{<unresolved>}.augment;
+ }
+ get /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty() → core::int {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
+ augment super++;
+ ^" in null as{ForNonNullableByDefault} dynamic;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
+ --augment super;
+ ^" in null as{ForNonNullableByDefault} dynamic;
+ return (null as{ForNonNullableByDefault} dynamic){dynamic}.unary-() as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+ }
+ set /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty(core::int value) → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
+ augment super = value;
+ ^";
+ }
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+ augment super(); // Error
+ ^^^^^^^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+ augment super; // Error
+ ^^^^^^^";
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+ augment; // Error
+ ^^^^^^^" in this{<unresolved>}.augment;
+ }
+}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethod() → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+}
+static method topLevelMethodErrors() → void {}
+static get /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty() → core::List<core::int> {
+ return block {
+ final core::List<core::int> #t1 = <core::int>[];
+ for (final has-declared-initializer dynamic #t2 in (null as{ForNonNullableByDefault} dynamic) as{TypeError,ForDynamic,ForNonNullableByDefault} core::Iterable<dynamic>) {
+ final core::int #t3 = #t2 as{TypeError,ForNonNullableByDefault} core::int;
+ #t1.{core::List::add}{Invariant}(#t3){(core::int) → void};
+ }
+ #t1.{core::List::add}{Invariant}((null as{ForNonNullableByDefault} dynamic){dynamic}.[](0) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int){(core::int) → void};
+ } =>#t1;
+}
+static set /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty(core::List<core::int> value) → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.[]=(0, value.{core::List::[]}(1){(core::int) → core::int});
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
+ augment super = value;
+ ^";
+}
+static method main() → dynamic {}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void {
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+ augment; // Error
+ ^^^^^^^";
+}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+ augment super(); // Error
+ ^^^^^^^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+ augment super; // Error
+ ^^^^^^^";
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+ augment; // Error
+ ^^^^^^^";
+}
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.weak.outline.expect b/pkg/front_end/testcases/macros/augment_super.dart.weak.outline.expect
new file mode 100644
index 0000000..ac6c7af
--- /dev/null
+++ b/pkg/front_end/testcases/macros/augment_super.dart.weak.outline.expect
@@ -0,0 +1,34 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///augment_super.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ ;
+ method instanceMethod() → void
+ ;
+ method instanceMethodErrors() → void
+ ;
+ get instanceProperty() → core::int
+ ;
+ set instanceProperty(core::int value) → void
+ ;
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void
+ ;
+}
+static method topLevelMethod() → void
+ ;
+static method topLevelMethodErrors() → void
+ ;
+static get topLevelProperty() → core::List<core::int>
+ ;
+static set topLevelProperty(core::List<core::int> value) → void
+ ;
+static method main() → dynamic
+ ;
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void
+ ;
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void
+ ;
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.weak.transformed.expect b/pkg/front_end/testcases/macros/augment_super.dart.weak.transformed.expect
new file mode 100644
index 0000000..6d9c5f8
--- /dev/null
+++ b/pkg/front_end/testcases/macros/augment_super.dart.weak.transformed.expect
@@ -0,0 +1,180 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:10:3: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
+// augment super = value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+// augment super(); // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+// augment super; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:27:3: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:37:5: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
+// augment super++;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
+// --augment super;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
+// augment super = value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+// augment super(); // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+// augment super; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:54:5: Error: Can't have modifier 'augment' here.
+// Try removing 'augment'.
+// augment int local; // Error
+// ^^^^^^^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+// augment; // Error
+// ^^^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///augment_super.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethod() → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ }
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethodErrors() → void {
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+ augment; // Error
+ ^^^^^^^" in this{<unresolved>}.augment;
+ }
+ get /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty() → core::int {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
+ augment super++;
+ ^" in null as{ForNonNullableByDefault} dynamic;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
+ --augment super;
+ ^" in null as{ForNonNullableByDefault} dynamic;
+ return (null as{ForNonNullableByDefault} dynamic){dynamic}.unary-() as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+ }
+ set /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty(core::int value) → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
+ augment super = value;
+ ^";
+ }
+ method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+ augment super(); // Error
+ ^^^^^^^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+ augment super; // Error
+ ^^^^^^^";
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
+ augment; // Error
+ ^^^^^^^" in this{<unresolved>}.augment;
+ }
+}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethod() → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+}
+static method topLevelMethodErrors() → void {}
+static get /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty() → core::List<core::int> {
+ return block {
+ final core::List<core::int> #t1 = core::_GrowableList::•<core::int>(0);
+ {
+ core::Iterator<dynamic> :sync-for-iterator = ((null as{ForNonNullableByDefault} dynamic) as{TypeError,ForDynamic,ForNonNullableByDefault} core::Iterable<dynamic>).{core::Iterable::iterator}{core::Iterator<dynamic>};
+ for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
+ final dynamic #t2 = :sync-for-iterator.{core::Iterator::current}{dynamic};
+ {
+ final core::int #t3 = #t2 as{TypeError,ForNonNullableByDefault} core::int;
+ #t1.{core::List::add}{Invariant}(#t3){(core::int) → void};
+ }
+ }
+ }
+ #t1.{core::List::add}{Invariant}((null as{ForNonNullableByDefault} dynamic){dynamic}.[](0) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int){(core::int) → void};
+ } =>#t1;
+}
+static set /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty(core::List<core::int> value) → void {
+ (null as{ForNonNullableByDefault} dynamic){dynamic}.[]=(0, value.{core::List::[]}(1){(core::int) → core::int});
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
+ augment super = value;
+ ^";
+}
+static method main() → dynamic {}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void {
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+ augment; // Error
+ ^^^^^^^";
+}
+static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+ augment super(); // Error
+ ^^^^^^^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+ augment super; // Error
+ ^^^^^^^";
+ core::int local;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+ augment; // Error
+ ^^^^^^^";
+}
+
+
+Extra constant evaluation status:
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:33:5 -> NullConstant(null)
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:44:13 -> NullConstant(null)
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:6:3 -> NullConstant(null)
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:16:15 -> NullConstant(null)
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:16:30 -> NullConstant(null)
+Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:20:3 -> NullConstant(null)
+Extra constant evaluation: evaluated: 30, effectively constant: 6
diff --git a/pkg/front_end/testcases/macros/augment_super_lib.dart b/pkg/front_end/testcases/macros/augment_super_lib.dart
new file mode 100644
index 0000000..4922d49
--- /dev/null
+++ b/pkg/front_end/testcases/macros/augment_super_lib.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2022, 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.
+
+augment void topLevelMethod() {
+ augment super();
+}
+
+augment void topLevelMethodError() {
+ augment int local; // Error
+ augment; // Error
+}
+
+
+augment List<int> get topLevelProperty {
+ return [... augment super, augment super[0]];
+}
+
+augment void set topLevelProperty(List<int> value) {
+ augment super[0] = value[1];
+ augment super = value;
+}
+
+void injectedTopLevelMethod() {
+ augment super(); // Error
+ augment super; // Error
+ augment int local; // Error
+ augment; // Error
+}
+
+augment class Class {
+ augment void instanceMethod() {
+ augment super();
+ }
+
+ augment void instanceMethodErrors() {
+ augment int local; // Error
+ augment; // Error
+ }
+
+ augment int get instanceProperty {
+ augment super++;
+ --augment super;
+ return -augment super;
+ }
+
+ augment void set instanceProperty(int value) {
+ augment super = value;
+ }
+
+ void injectedInstanceMethod() {
+ augment super(); // Error
+ augment super; // Error
+ augment int local; // Error
+ augment; // Error
+ }
+}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/nnbd/issue49044.dart b/pkg/front_end/testcases/nnbd/issue49044.dart
new file mode 100644
index 0000000..48ca34c
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue49044.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2021, 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.
+
+X bar<X>(Function(X) f) => throw 0;
+
+foo(Function(Function(int, int, [int])) f, Function(Function(int, [int])) g) {
+ var x = [f, g];
+ var h = x.first;
+ var u = bar(h);
+ Function(int, [int, int]) v = u;
+ return v;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue49044.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue49044.dart.strong.expect
new file mode 100644
index 0000000..f8ab478ab
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue49044.dart.strong.expect
@@ -0,0 +1,14 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static method bar<X extends core::Object? = dynamic>((self::bar::X%) → dynamic f) → self::bar::X%
+ return throw 0;
+static method foo(((core::int, core::int, [core::int]) → dynamic) → dynamic f, ((core::int, [core::int]) → dynamic) → dynamic g) → dynamic {
+ core::List<((core::int, [core::int, core::int]) → dynamic) → dynamic> x = <((core::int, [core::int, core::int]) → dynamic) → dynamic>[f, g];
+ ((core::int, [core::int, core::int]) → dynamic) → dynamic h = x.{core::Iterable::first}{((core::int, [core::int, core::int]) → dynamic) → dynamic};
+ (core::int, [core::int, core::int]) → dynamic u = self::bar<(core::int, [core::int, core::int]) → dynamic>(h);
+ (core::int, [core::int, core::int]) → dynamic v = u;
+ return v;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue49044.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue49044.dart.strong.transformed.expect
new file mode 100644
index 0000000..af6207a
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue49044.dart.strong.transformed.expect
@@ -0,0 +1,14 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static method bar<X extends core::Object? = dynamic>((self::bar::X%) → dynamic f) → self::bar::X%
+ return throw 0;
+static method foo(((core::int, core::int, [core::int]) → dynamic) → dynamic f, ((core::int, [core::int]) → dynamic) → dynamic g) → dynamic {
+ core::List<((core::int, [core::int, core::int]) → dynamic) → dynamic> x = core::_GrowableList::_literal2<((core::int, [core::int, core::int]) → dynamic) → dynamic>(f, g);
+ ((core::int, [core::int, core::int]) → dynamic) → dynamic h = x.{core::Iterable::first}{((core::int, [core::int, core::int]) → dynamic) → dynamic};
+ (core::int, [core::int, core::int]) → dynamic u = self::bar<(core::int, [core::int, core::int]) → dynamic>(h);
+ (core::int, [core::int, core::int]) → dynamic v = u;
+ return v;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue49044.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/issue49044.dart.textual_outline.expect
new file mode 100644
index 0000000..9824f66
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue49044.dart.textual_outline.expect
@@ -0,0 +1,3 @@
+X bar<X>(Function(X) f) => throw 0;
+foo(Function(Function(int, int, [int])) f, Function(Function(int, [int])) g) {}
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue49044.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/issue49044.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..9824f66
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue49044.dart.textual_outline_modelled.expect
@@ -0,0 +1,3 @@
+X bar<X>(Function(X) f) => throw 0;
+foo(Function(Function(int, int, [int])) f, Function(Function(int, [int])) g) {}
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue49044.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue49044.dart.weak.expect
new file mode 100644
index 0000000..f8ab478ab
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue49044.dart.weak.expect
@@ -0,0 +1,14 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static method bar<X extends core::Object? = dynamic>((self::bar::X%) → dynamic f) → self::bar::X%
+ return throw 0;
+static method foo(((core::int, core::int, [core::int]) → dynamic) → dynamic f, ((core::int, [core::int]) → dynamic) → dynamic g) → dynamic {
+ core::List<((core::int, [core::int, core::int]) → dynamic) → dynamic> x = <((core::int, [core::int, core::int]) → dynamic) → dynamic>[f, g];
+ ((core::int, [core::int, core::int]) → dynamic) → dynamic h = x.{core::Iterable::first}{((core::int, [core::int, core::int]) → dynamic) → dynamic};
+ (core::int, [core::int, core::int]) → dynamic u = self::bar<(core::int, [core::int, core::int]) → dynamic>(h);
+ (core::int, [core::int, core::int]) → dynamic v = u;
+ return v;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue49044.dart.weak.modular.expect b/pkg/front_end/testcases/nnbd/issue49044.dart.weak.modular.expect
new file mode 100644
index 0000000..f8ab478ab
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue49044.dart.weak.modular.expect
@@ -0,0 +1,14 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static method bar<X extends core::Object? = dynamic>((self::bar::X%) → dynamic f) → self::bar::X%
+ return throw 0;
+static method foo(((core::int, core::int, [core::int]) → dynamic) → dynamic f, ((core::int, [core::int]) → dynamic) → dynamic g) → dynamic {
+ core::List<((core::int, [core::int, core::int]) → dynamic) → dynamic> x = <((core::int, [core::int, core::int]) → dynamic) → dynamic>[f, g];
+ ((core::int, [core::int, core::int]) → dynamic) → dynamic h = x.{core::Iterable::first}{((core::int, [core::int, core::int]) → dynamic) → dynamic};
+ (core::int, [core::int, core::int]) → dynamic u = self::bar<(core::int, [core::int, core::int]) → dynamic>(h);
+ (core::int, [core::int, core::int]) → dynamic v = u;
+ return v;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue49044.dart.weak.outline.expect b/pkg/front_end/testcases/nnbd/issue49044.dart.weak.outline.expect
new file mode 100644
index 0000000..562f3d9
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue49044.dart.weak.outline.expect
@@ -0,0 +1,10 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static method bar<X extends core::Object? = dynamic>((self::bar::X%) → dynamic f) → self::bar::X%
+ ;
+static method foo(((core::int, core::int, [core::int]) → dynamic) → dynamic f, ((core::int, [core::int]) → dynamic) → dynamic g) → dynamic
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/nnbd/issue49044.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue49044.dart.weak.transformed.expect
new file mode 100644
index 0000000..af6207a
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue49044.dart.weak.transformed.expect
@@ -0,0 +1,14 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static method bar<X extends core::Object? = dynamic>((self::bar::X%) → dynamic f) → self::bar::X%
+ return throw 0;
+static method foo(((core::int, core::int, [core::int]) → dynamic) → dynamic f, ((core::int, [core::int]) → dynamic) → dynamic g) → dynamic {
+ core::List<((core::int, [core::int, core::int]) → dynamic) → dynamic> x = core::_GrowableList::_literal2<((core::int, [core::int, core::int]) → dynamic) → dynamic>(f, g);
+ ((core::int, [core::int, core::int]) → dynamic) → dynamic h = x.{core::Iterable::first}{((core::int, [core::int, core::int]) → dynamic) → dynamic};
+ (core::int, [core::int, core::int]) → dynamic u = self::bar<(core::int, [core::int, core::int]) → dynamic>(h);
+ (core::int, [core::int, core::int]) → dynamic v = u;
+ return v;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index 7f8673a..24f427a 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -153,6 +153,7 @@
late_lowering/skip_late_final_uninitialized_instance_fields/main: FormatterCrash
late_lowering/uninitialized_non_nullable_late_fields: FormatterCrash
macros/augment_class: FormatterCrash
+macros/augment_super: FormatterCrash
macros/class_members: FormatterCrash
macros/inject_constructor: FormatterCrash
macros/macro_class: FormatterCrash
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index 63f765a..25388c5 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -147,7 +147,7 @@
type ComponentFile {
UInt32 magic = 0x90ABCDEF;
- UInt32 formatVersion = 80;
+ UInt32 formatVersion = 81;
Byte[10] shortSdkHash;
List<String> problemsAsJson; // Described in problems.md.
Library[] libraries;
@@ -598,6 +598,23 @@
// Equivalent to VariableSet with index N.
}
+type AbstractSuperPropertyGet extends Expression {
+ Byte tag = 22;
+ FileOffset fileOffset;
+ Name name;
+ MemberReference interfaceTarget; // May be NullReference.
+ MemberReference interfaceTargetOrigin; // May be NullReference.
+}
+
+type AbstractSuperPropertySet extends Expression {
+ Byte tag = 23;
+ FileOffset fileOffset;
+ Name name;
+ Expression value;
+ MemberReference interfaceTarget; // May be NullReference.
+ MemberReference interfaceTargetOrigin; // May be NullReference.
+}
+
type SuperPropertyGet extends Expression {
Byte tag = 24;
FileOffset fileOffset;
@@ -820,6 +837,15 @@
MemberReference interfaceTargetOrigin; // May be NullReference.
}
+type AbstractSuperMethodInvocation extends Expression {
+ Byte tag = 28;
+ FileOffset fileOffset;
+ Name name;
+ Arguments arguments;
+ MemberReference interfaceTarget; // May be NullReference.
+ MemberReference interfaceTargetOrigin; // May be NullReference.
+}
+
type SuperMethodInvocation extends Expression {
Byte tag = 29;
FileOffset fileOffset;
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 78972bc..5f049a0 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -4772,6 +4772,99 @@
}
}
+/// Expression of form `super.foo` occurring in a mixin declaration.
+///
+/// In this setting, the target is looked up on the types in the mixin 'on'
+/// clause and are therefore not necessary the runtime targets of the read. An
+/// [AbstractSuperPropertyGet] must be converted into a [SuperPropertyGet] to
+/// statically bind the target.
+///
+/// For instance
+///
+/// abstract class Interface {
+/// get getter;
+/// }
+/// mixin Mixin on Interface {
+/// get getter {
+/// // This is an [AbstractSuperPropertyGet] with interface target
+/// // `Interface.getter`.
+/// return super.getter;
+/// }
+/// }
+/// class Super implements Interface {
+/// // This is the target when `Mixin` is applied to `Class`.
+/// get getter => 42;
+/// }
+/// class Class extends Super with Mixin {}
+///
+/// This may invoke a getter, read a field, or tear off a method.
+class AbstractSuperPropertyGet extends Expression {
+ Name name;
+
+ Reference? interfaceTargetReference;
+
+ AbstractSuperPropertyGet(Name name, [Member? interfaceTarget])
+ : this.byReference(name, getMemberReferenceGetter(interfaceTarget));
+
+ AbstractSuperPropertyGet.byReference(
+ this.name, this.interfaceTargetReference);
+
+ Member? get interfaceTarget => interfaceTargetReference?.asMember;
+
+ void set interfaceTarget(Member? member) {
+ interfaceTargetReference = getMemberReferenceGetter(member);
+ }
+
+ @override
+ DartType getStaticTypeInternal(StaticTypeContext context) {
+ Member? interfaceTarget = this.interfaceTarget;
+ if (interfaceTarget == null) {
+ // TODO(johnniwinther): SuperPropertyGet without a target should be
+ // replaced by invalid expressions.
+ return const DynamicType();
+ }
+ Class declaringClass = interfaceTarget.enclosingClass!;
+ if (declaringClass.typeParameters.isEmpty) {
+ return interfaceTarget.getterType;
+ }
+ List<DartType>? receiverArguments = context.typeEnvironment
+ .getTypeArgumentsAsInstanceOf(context.thisType!, declaringClass);
+ return Substitution.fromPairs(
+ declaringClass.typeParameters, receiverArguments!)
+ .substituteType(interfaceTarget.getterType);
+ }
+
+ @override
+ R accept<R>(ExpressionVisitor<R> v) => v.visitAbstractSuperPropertyGet(this);
+
+ @override
+ R accept1<R, A>(ExpressionVisitor1<R, A> v, A arg) =>
+ v.visitAbstractSuperPropertyGet(this, arg);
+
+ @override
+ void visitChildren(Visitor v) {
+ interfaceTarget?.acceptReference(v);
+ name.accept(v);
+ }
+
+ @override
+ void transformChildren(Transformer v) {}
+
+ @override
+ void transformOrRemoveChildren(RemovingTransformer v) {}
+
+ @override
+ String toString() {
+ return "AbstractSuperPropertyGet(${toStringInternal()})";
+ }
+
+ @override
+ void toTextInternal(AstPrinter printer) {
+ printer.write('super.{abstract}');
+ printer.writeInterfaceMemberName(interfaceTargetReference, name);
+ }
+}
+
/// Expression of form `super.field`.
///
/// This may invoke a getter, read a field, or tear off a method.
@@ -4841,6 +4934,103 @@
}
}
+/// Expression of form `super.foo = x` occurring in a mixin declaration.
+///
+/// In this setting, the target is looked up on the types in the mixin 'on'
+/// clause and are therefore not necessary the runtime targets of the
+/// assignment. An [AbstractSuperPropertySet] must be converted into a
+/// [SuperPropertySet] to statically bind the target.
+///
+/// For instance
+///
+/// abstract class Interface {
+/// void set setter(value);
+/// }
+/// mixin Mixin on Interface {
+/// void set setter(value) {
+/// // This is an [AbstractSuperPropertySet] with interface target
+/// // `Interface.setter`.
+/// super.setter = value;
+/// }
+/// }
+/// class Super implements Interface {
+/// // This is the target when `Mixin` is applied to `Class`.
+/// void set setter(value) {}
+/// }
+/// class Class extends Super with Mixin {}
+///
+/// This may invoke a setter or assign a field.
+class AbstractSuperPropertySet extends Expression {
+ Name name;
+ Expression value;
+
+ Reference? interfaceTargetReference;
+
+ AbstractSuperPropertySet(Name name, Expression value, Member? interfaceTarget)
+ : this.byReference(
+ name, value, getMemberReferenceSetter(interfaceTarget));
+
+ AbstractSuperPropertySet.byReference(
+ this.name, this.value, this.interfaceTargetReference) {
+ value.parent = this;
+ }
+
+ Member? get interfaceTarget => interfaceTargetReference?.asMember;
+
+ void set interfaceTarget(Member? member) {
+ interfaceTargetReference = getMemberReferenceSetter(member);
+ }
+
+ @override
+ DartType getStaticTypeInternal(StaticTypeContext context) =>
+ value.getStaticType(context);
+
+ @override
+ R accept<R>(ExpressionVisitor<R> v) => v.visitAbstractSuperPropertySet(this);
+
+ @override
+ R accept1<R, A>(ExpressionVisitor1<R, A> v, A arg) =>
+ v.visitAbstractSuperPropertySet(this, arg);
+
+ @override
+ void visitChildren(Visitor v) {
+ interfaceTarget?.acceptReference(v);
+ name.accept(v);
+ value.accept(v);
+ }
+
+ @override
+ void transformChildren(Transformer v) {
+ // ignore: unnecessary_null_comparison
+ if (value != null) {
+ value = v.transform(value);
+ value.parent = this;
+ }
+ }
+
+ @override
+ void transformOrRemoveChildren(RemovingTransformer v) {
+ // ignore: unnecessary_null_comparison
+ if (value != null) {
+ value = v.transform(value);
+ value.parent = this;
+ }
+ }
+
+ @override
+ String toString() {
+ return "AbstractSuperPropertySet(${toStringInternal()})";
+ }
+
+ @override
+ void toTextInternal(AstPrinter printer) {
+ printer.write('super.{abstract}');
+ printer.writeInterfaceMemberName(interfaceTargetReference, name);
+ printer.write(' = ');
+ printer.writeExpression(value);
+ }
+}
+
/// Expression of form `super.field = value`.
///
/// This may invoke a setter or assign a field.
@@ -6158,6 +6348,121 @@
}
}
+/// Expression of form `super.foo(x)` occurring in a mixin declaration.
+///
+/// In this setting, the target is looked up on the types in the mixin 'on'
+/// clause and are therefore not necessary the runtime targets of the
+/// invocation. An [AbstractSuperMethodInvocation] must be converted into
+/// a [SuperMethodInvocation] to statically bind the target.
+///
+/// For instance
+///
+/// abstract class Interface {
+/// void method();
+/// }
+/// mixin Mixin on Interface {
+/// void method() {
+/// // This is an [AbstractSuperMethodInvocation] with interface target
+/// // `Interface.method`.
+/// super.method(); // This targets Super.method.
+/// }
+/// }
+/// class Super implements Interface {
+/// // This is the target when `Mixin` is applied to `Class`.
+/// void method() {}
+/// }
+/// class Class extends Super with Mixin {}
+///
+class AbstractSuperMethodInvocation extends InvocationExpression {
+ @override
+ Name name;
+
+ @override
+ Arguments arguments;
+
+ Reference? interfaceTargetReference;
+
+ AbstractSuperMethodInvocation(Name name, Arguments arguments,
+ [Procedure? interfaceTarget])
+ : this.byReference(
+ name,
+ arguments,
+ // An invocation doesn't refer to the setter.
+ getMemberReferenceGetter(interfaceTarget));
+
+ AbstractSuperMethodInvocation.byReference(
+ this.name, this.arguments, this.interfaceTargetReference) {
+ arguments.parent = this;
+ }
+
+ Procedure? get interfaceTarget => interfaceTargetReference?.asProcedure;
+
+ void set interfaceTarget(Procedure? target) {
+ // An invocation doesn't refer to the setter.
+ interfaceTargetReference = getMemberReferenceGetter(target);
+ }
+
+ @override
+ DartType getStaticTypeInternal(StaticTypeContext context) {
+ Procedure? interfaceTarget = this.interfaceTarget;
+ if (interfaceTarget == null) return const DynamicType();
+ Class superclass = interfaceTarget.enclosingClass!;
+ List<DartType>? receiverTypeArguments = context.typeEnvironment
+ .getTypeArgumentsAsInstanceOf(context.thisType!, superclass);
+ DartType returnType = Substitution.fromPairs(
+ superclass.typeParameters, receiverTypeArguments!)
+ .substituteType(interfaceTarget.function.returnType);
+ return Substitution.fromPairs(
+ interfaceTarget.function.typeParameters, arguments.types)
+ .substituteType(returnType);
+ }
+
+ @override
+ R accept<R>(ExpressionVisitor<R> v) =>
+ v.visitAbstractSuperMethodInvocation(this);
+
+ @override
+ R accept1<R, A>(ExpressionVisitor1<R, A> v, A arg) =>
+ v.visitAbstractSuperMethodInvocation(this, arg);
+
+ @override
+ void visitChildren(Visitor v) {
+ interfaceTarget?.acceptReference(v);
+ name.accept(v);
+ arguments.accept(v);
+ }
+
+ @override
+ void transformChildren(Transformer v) {
+ // ignore: unnecessary_null_comparison
+ if (arguments != null) {
+ arguments = v.transform(arguments);
+ arguments.parent = this;
+ }
+ }
+
+ @override
+ void transformOrRemoveChildren(RemovingTransformer v) {
+ // ignore: unnecessary_null_comparison
+ if (arguments != null) {
+ arguments = v.transform(arguments);
+ arguments.parent = this;
+ }
+ }
+
+ @override
+ String toString() {
+ return "AbstractSuperMethodInvocation(${toStringInternal()})";
+ }
+
+ @override
+ void toTextInternal(AstPrinter printer) {
+ printer.write('super.{abstract}');
+ printer.writeInterfaceMemberName(interfaceTargetReference, name);
+ printer.writeArguments(arguments);
+ }
+}
+
/// Expression of form `super.foo(x)`.
///
/// The provided arguments might not match the parameters of the target.
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index 9df6792..d2a39f1 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -2001,6 +2001,10 @@
return _readInstanceSet();
case Tag.DynamicSet:
return _readDynamicSet();
+ case Tag.AbstractSuperPropertyGet:
+ return _readAbstractSuperPropertyGet();
+ case Tag.AbstractSuperPropertySet:
+ return _readAbstractSuperPropertySet();
case Tag.SuperPropertyGet:
return _readSuperPropertyGet();
case Tag.SuperPropertySet:
@@ -2033,6 +2037,8 @@
return _readEqualsNull();
case Tag.EqualsCall:
return _readEqualsCall();
+ case Tag.AbstractSuperMethodInvocation:
+ return _readAbstractSuperMethodInvocation();
case Tag.SuperMethodInvocation:
return _readSuperMethodInvocation();
case Tag.StaticInvocation:
@@ -2209,6 +2215,22 @@
..fileOffset = offset;
}
+ Expression _readAbstractSuperPropertyGet() {
+ int offset = readOffset();
+ addTransformerFlag(TransformerFlag.superCalls);
+ return new AbstractSuperPropertyGet.byReference(
+ readName(), readNullableInstanceMemberReference())
+ ..fileOffset = offset;
+ }
+
+ Expression _readAbstractSuperPropertySet() {
+ int offset = readOffset();
+ addTransformerFlag(TransformerFlag.superCalls);
+ return new AbstractSuperPropertySet.byReference(
+ readName(), readExpression(), readNullableInstanceMemberReference())
+ ..fileOffset = offset;
+ }
+
Expression _readSuperPropertyGet() {
int offset = readOffset();
addTransformerFlag(TransformerFlag.superCalls);
@@ -2347,6 +2369,14 @@
..fileOffset = offset;
}
+ Expression _readAbstractSuperMethodInvocation() {
+ int offset = readOffset();
+ addTransformerFlag(TransformerFlag.superCalls);
+ return new AbstractSuperMethodInvocation.byReference(
+ readName(), readArguments(), readNullableInstanceMemberReference())
+ ..fileOffset = offset;
+ }
+
Expression _readSuperMethodInvocation() {
int offset = readOffset();
addTransformerFlag(TransformerFlag.superCalls);
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index 1f678e9..dab017c 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -1579,6 +1579,23 @@
}
@override
+ void visitAbstractSuperPropertyGet(AbstractSuperPropertyGet node) {
+ writeByte(Tag.AbstractSuperPropertyGet);
+ writeOffset(node.fileOffset);
+ writeName(node.name);
+ writeNullAllowedInstanceMemberReference(node.interfaceTargetReference);
+ }
+
+ @override
+ void visitAbstractSuperPropertySet(AbstractSuperPropertySet node) {
+ writeByte(Tag.AbstractSuperPropertySet);
+ writeOffset(node.fileOffset);
+ writeName(node.name);
+ writeNode(node.value);
+ writeNullAllowedInstanceMemberReference(node.interfaceTargetReference);
+ }
+
+ @override
void visitSuperPropertyGet(SuperPropertyGet node) {
writeByte(Tag.SuperPropertyGet);
writeOffset(node.fileOffset);
@@ -1718,6 +1735,15 @@
}
@override
+ void visitAbstractSuperMethodInvocation(AbstractSuperMethodInvocation node) {
+ writeByte(Tag.AbstractSuperMethodInvocation);
+ writeOffset(node.fileOffset);
+ writeName(node.name);
+ writeArgumentsNode(node.arguments);
+ writeNullAllowedInstanceMemberReference(node.interfaceTargetReference);
+ }
+
+ @override
void visitSuperMethodInvocation(SuperMethodInvocation node) {
writeByte(Tag.SuperMethodInvocation);
writeOffset(node.fileOffset);
diff --git a/pkg/kernel/lib/binary/tag.dart b/pkg/kernel/lib/binary/tag.dart
index aed4155..b0a13a0 100644
--- a/pkg/kernel/lib/binary/tag.dart
+++ b/pkg/kernel/lib/binary/tag.dart
@@ -37,10 +37,13 @@
static const int InvalidExpression = 19;
static const int VariableGet = 20;
static const int VariableSet = 21;
+ static const int AbstractSuperPropertyGet = 22;
+ static const int AbstractSuperPropertySet = 23;
static const int SuperPropertyGet = 24;
static const int SuperPropertySet = 25;
static const int StaticGet = 26;
static const int StaticSet = 27;
+ static const int AbstractSuperMethodInvocation = 28;
static const int SuperMethodInvocation = 29;
static const int StaticInvocation = 30;
static const int ConstructorInvocation = 31;
@@ -176,7 +179,7 @@
/// Internal version of kernel binary format.
/// Bump it when making incompatible changes in kernel binaries.
/// Keep in sync with runtime/vm/kernel_binary.h, pkg/kernel/binary.md.
- static const int BinaryFormatVersion = 80;
+ static const int BinaryFormatVersion = 81;
}
abstract class ConstantTag {
diff --git a/pkg/kernel/lib/clone.dart b/pkg/kernel/lib/clone.dart
index c69fe09..348ff65 100644
--- a/pkg/kernel/lib/clone.dart
+++ b/pkg/kernel/lib/clone.dart
@@ -176,6 +176,18 @@
}
@override
+ TreeNode visitAbstractSuperPropertyGet(AbstractSuperPropertyGet node) {
+ return new AbstractSuperPropertyGet.byReference(
+ node.name, node.interfaceTargetReference);
+ }
+
+ @override
+ TreeNode visitAbstractSuperPropertySet(AbstractSuperPropertySet node) {
+ return new AbstractSuperPropertySet.byReference(
+ node.name, clone(node.value), node.interfaceTargetReference);
+ }
+
+ @override
TreeNode visitSuperPropertyGet(SuperPropertyGet node) {
return new SuperPropertyGet.byReference(
node.name, node.interfaceTargetReference);
@@ -198,6 +210,13 @@
}
@override
+ TreeNode visitAbstractSuperMethodInvocation(
+ AbstractSuperMethodInvocation node) {
+ return new AbstractSuperMethodInvocation.byReference(
+ node.name, clone(node.arguments), node.interfaceTargetReference);
+ }
+
+ @override
TreeNode visitSuperMethodInvocation(SuperMethodInvocation node) {
return new SuperMethodInvocation.byReference(
node.name, clone(node.arguments), node.interfaceTargetReference);
diff --git a/pkg/kernel/lib/src/coverage.dart b/pkg/kernel/lib/src/coverage.dart
index 35a5692..553e22f 100644
--- a/pkg/kernel/lib/src/coverage.dart
+++ b/pkg/kernel/lib/src/coverage.dart
@@ -186,12 +186,24 @@
}
@override
+ void visitAbstractSuperPropertyGet(AbstractSuperPropertyGet node) {
+ visited.add(ExpressionKind.AbstractSuperPropertyGet);
+ node.visitChildren(this);
+ }
+
+ @override
void visitSuperPropertyGet(SuperPropertyGet node) {
visited.add(ExpressionKind.SuperPropertyGet);
node.visitChildren(this);
}
@override
+ void visitAbstractSuperPropertySet(AbstractSuperPropertySet node) {
+ visited.add(ExpressionKind.AbstractSuperPropertySet);
+ node.visitChildren(this);
+ }
+
+ @override
void visitSuperPropertySet(SuperPropertySet node) {
visited.add(ExpressionKind.SuperPropertySet);
node.visitChildren(this);
@@ -246,6 +258,12 @@
}
@override
+ void visitAbstractSuperMethodInvocation(AbstractSuperMethodInvocation node) {
+ visited.add(ExpressionKind.AbstractSuperMethodInvocation);
+ node.visitChildren(this);
+ }
+
+ @override
void visitSuperMethodInvocation(SuperMethodInvocation node) {
visited.add(ExpressionKind.SuperMethodInvocation);
node.visitChildren(this);
@@ -1009,6 +1027,9 @@
}
enum ExpressionKind {
+ AbstractSuperMethodInvocation,
+ AbstractSuperPropertyGet,
+ AbstractSuperPropertySet,
AsExpression,
AwaitExpression,
BlockExpression,
diff --git a/pkg/kernel/lib/src/equivalence.dart b/pkg/kernel/lib/src/equivalence.dart
index 840f85b..015d021 100644
--- a/pkg/kernel/lib/src/equivalence.dart
+++ b/pkg/kernel/lib/src/equivalence.dart
@@ -186,11 +186,23 @@
}
@override
+ bool visitAbstractSuperPropertyGet(
+ AbstractSuperPropertyGet node, Node other) {
+ return strategy.checkAbstractSuperPropertyGet(this, node, other);
+ }
+
+ @override
bool visitSuperPropertyGet(SuperPropertyGet node, Node other) {
return strategy.checkSuperPropertyGet(this, node, other);
}
@override
+ bool visitAbstractSuperPropertySet(
+ AbstractSuperPropertySet node, Node other) {
+ return strategy.checkAbstractSuperPropertySet(this, node, other);
+ }
+
+ @override
bool visitSuperPropertySet(SuperPropertySet node, Node other) {
return strategy.checkSuperPropertySet(this, node, other);
}
@@ -237,6 +249,12 @@
}
@override
+ bool visitAbstractSuperMethodInvocation(
+ AbstractSuperMethodInvocation node, Node other) {
+ return strategy.checkAbstractSuperMethodInvocation(this, node, other);
+ }
+
+ @override
bool visitSuperMethodInvocation(SuperMethodInvocation node, Node other) {
return strategy.checkSuperMethodInvocation(this, node, other);
}
@@ -2270,6 +2288,27 @@
return result;
}
+ bool checkAbstractSuperPropertyGet(EquivalenceVisitor visitor,
+ AbstractSuperPropertyGet? node, Object? other) {
+ if (identical(node, other)) return true;
+ if (node is! AbstractSuperPropertyGet) return false;
+ if (other is! AbstractSuperPropertyGet) return false;
+ visitor.pushNodeState(node, other);
+ bool result = true;
+ if (!checkAbstractSuperPropertyGet_name(visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ if (!checkAbstractSuperPropertyGet_interfaceTargetReference(
+ visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ if (!checkAbstractSuperPropertyGet_fileOffset(visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ visitor.popState();
+ return result;
+ }
+
bool checkSuperPropertyGet(
EquivalenceVisitor visitor, SuperPropertyGet? node, Object? other) {
if (identical(node, other)) return true;
@@ -2290,6 +2329,30 @@
return result;
}
+ bool checkAbstractSuperPropertySet(EquivalenceVisitor visitor,
+ AbstractSuperPropertySet? node, Object? other) {
+ if (identical(node, other)) return true;
+ if (node is! AbstractSuperPropertySet) return false;
+ if (other is! AbstractSuperPropertySet) return false;
+ visitor.pushNodeState(node, other);
+ bool result = true;
+ if (!checkAbstractSuperPropertySet_name(visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ if (!checkAbstractSuperPropertySet_value(visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ if (!checkAbstractSuperPropertySet_interfaceTargetReference(
+ visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ if (!checkAbstractSuperPropertySet_fileOffset(visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ visitor.popState();
+ return result;
+ }
+
bool checkSuperPropertySet(
EquivalenceVisitor visitor, SuperPropertySet? node, Object? other) {
if (identical(node, other)) return true;
@@ -2514,6 +2577,30 @@
return result;
}
+ bool checkAbstractSuperMethodInvocation(EquivalenceVisitor visitor,
+ AbstractSuperMethodInvocation? node, Object? other) {
+ if (identical(node, other)) return true;
+ if (node is! AbstractSuperMethodInvocation) return false;
+ if (other is! AbstractSuperMethodInvocation) return false;
+ visitor.pushNodeState(node, other);
+ bool result = true;
+ if (!checkAbstractSuperMethodInvocation_name(visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ if (!checkAbstractSuperMethodInvocation_arguments(visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ if (!checkAbstractSuperMethodInvocation_interfaceTargetReference(
+ visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ if (!checkAbstractSuperMethodInvocation_fileOffset(visitor, node, other)) {
+ result = visitor.resultOnInequivalence;
+ }
+ visitor.popState();
+ return result;
+ }
+
bool checkSuperMethodInvocation(
EquivalenceVisitor visitor, SuperMethodInvocation? node, Object? other) {
if (identical(node, other)) return true;
@@ -5604,6 +5691,24 @@
return checkExpression_fileOffset(visitor, node, other);
}
+ bool checkAbstractSuperPropertyGet_name(EquivalenceVisitor visitor,
+ AbstractSuperPropertyGet node, AbstractSuperPropertyGet other) {
+ return visitor.checkNodes(node.name, other.name, 'name');
+ }
+
+ bool checkAbstractSuperPropertyGet_interfaceTargetReference(
+ EquivalenceVisitor visitor,
+ AbstractSuperPropertyGet node,
+ AbstractSuperPropertyGet other) {
+ return visitor.checkReferences(node.interfaceTargetReference,
+ other.interfaceTargetReference, 'interfaceTargetReference');
+ }
+
+ bool checkAbstractSuperPropertyGet_fileOffset(EquivalenceVisitor visitor,
+ AbstractSuperPropertyGet node, AbstractSuperPropertyGet other) {
+ return checkExpression_fileOffset(visitor, node, other);
+ }
+
bool checkSuperPropertyGet_name(EquivalenceVisitor visitor,
SuperPropertyGet node, SuperPropertyGet other) {
return visitor.checkNodes(node.name, other.name, 'name');
@@ -5622,6 +5727,29 @@
return checkExpression_fileOffset(visitor, node, other);
}
+ bool checkAbstractSuperPropertySet_name(EquivalenceVisitor visitor,
+ AbstractSuperPropertySet node, AbstractSuperPropertySet other) {
+ return visitor.checkNodes(node.name, other.name, 'name');
+ }
+
+ bool checkAbstractSuperPropertySet_value(EquivalenceVisitor visitor,
+ AbstractSuperPropertySet node, AbstractSuperPropertySet other) {
+ return visitor.checkNodes(node.value, other.value, 'value');
+ }
+
+ bool checkAbstractSuperPropertySet_interfaceTargetReference(
+ EquivalenceVisitor visitor,
+ AbstractSuperPropertySet node,
+ AbstractSuperPropertySet other) {
+ return visitor.checkReferences(node.interfaceTargetReference,
+ other.interfaceTargetReference, 'interfaceTargetReference');
+ }
+
+ bool checkAbstractSuperPropertySet_fileOffset(EquivalenceVisitor visitor,
+ AbstractSuperPropertySet node, AbstractSuperPropertySet other) {
+ return checkExpression_fileOffset(visitor, node, other);
+ }
+
bool checkSuperPropertySet_name(EquivalenceVisitor visitor,
SuperPropertySet node, SuperPropertySet other) {
return visitor.checkNodes(node.name, other.name, 'name');
@@ -5853,6 +5981,29 @@
return checkInvocationExpression_fileOffset(visitor, node, other);
}
+ bool checkAbstractSuperMethodInvocation_name(EquivalenceVisitor visitor,
+ AbstractSuperMethodInvocation node, AbstractSuperMethodInvocation other) {
+ return visitor.checkNodes(node.name, other.name, 'name');
+ }
+
+ bool checkAbstractSuperMethodInvocation_arguments(EquivalenceVisitor visitor,
+ AbstractSuperMethodInvocation node, AbstractSuperMethodInvocation other) {
+ return visitor.checkNodes(node.arguments, other.arguments, 'arguments');
+ }
+
+ bool checkAbstractSuperMethodInvocation_interfaceTargetReference(
+ EquivalenceVisitor visitor,
+ AbstractSuperMethodInvocation node,
+ AbstractSuperMethodInvocation other) {
+ return visitor.checkReferences(node.interfaceTargetReference,
+ other.interfaceTargetReference, 'interfaceTargetReference');
+ }
+
+ bool checkAbstractSuperMethodInvocation_fileOffset(EquivalenceVisitor visitor,
+ AbstractSuperMethodInvocation node, AbstractSuperMethodInvocation other) {
+ return checkInvocationExpression_fileOffset(visitor, node, other);
+ }
+
bool checkSuperMethodInvocation_name(EquivalenceVisitor visitor,
SuperMethodInvocation node, SuperMethodInvocation other) {
return visitor.checkNodes(node.name, other.name, 'name');
diff --git a/pkg/kernel/lib/src/node_creator.dart b/pkg/kernel/lib/src/node_creator.dart
index 8c0337d..d51a1bb 100644
--- a/pkg/kernel/lib/src/node_creator.dart
+++ b/pkg/kernel/lib/src/node_creator.dart
@@ -859,6 +859,14 @@
]);
case ExpressionKind.StringLiteral:
return StringLiteral('foo');
+ case ExpressionKind.AbstractSuperMethodInvocation:
+ return _createOneOf(_pendingExpressions, kind, index, [
+ () => AbstractSuperMethodInvocation(_createName(), _createArguments())
+ ..fileOffset = _needFileOffset(),
+ () => AbstractSuperMethodInvocation(
+ _createName(), _createArguments(), _needProcedure())
+ ..fileOffset = _needFileOffset(),
+ ]);
case ExpressionKind.SuperMethodInvocation:
return _createOneOf(_pendingExpressions, kind, index, [
() => SuperMethodInvocation(_createName(), _createArguments())
@@ -867,6 +875,22 @@
_createName(), _createArguments(), _needProcedure())
..fileOffset = _needFileOffset(),
]);
+ case ExpressionKind.AbstractSuperPropertyGet:
+ return _createOneOf(_pendingExpressions, kind, index, [
+ () => AbstractSuperPropertyGet(_createName())
+ ..fileOffset = _needFileOffset(),
+ () => AbstractSuperPropertyGet(_createName(), _needField())
+ ..fileOffset = _needFileOffset(),
+ ]);
+ case ExpressionKind.AbstractSuperPropertySet:
+ return _createOneOf(_pendingExpressions, kind, index, [
+ () =>
+ AbstractSuperPropertySet(_createName(), _createExpression(), null)
+ ..fileOffset = _needFileOffset(),
+ () => AbstractSuperPropertySet(
+ _createName(), _createExpression(), _needField())
+ ..fileOffset = _needFileOffset(),
+ ]);
case ExpressionKind.SuperPropertyGet:
return _createOneOf(_pendingExpressions, kind, index, [
() => SuperPropertyGet(_createName())..fileOffset = _needFileOffset(),
diff --git a/pkg/kernel/lib/src/standard_bounds.dart b/pkg/kernel/lib/src/standard_bounds.dart
index 452fcc2..4263359 100644
--- a/pkg/kernel/lib/src/standard_bounds.dart
+++ b/pkg/kernel/lib/src/standard_bounds.dart
@@ -1042,7 +1042,8 @@
intersectNullabilities(f.declaredNullability, g.declaredNullability),
namedParameters: namedParameters,
typeParameters: typeParameters,
- requiredParameterCount: minPos);
+ requiredParameterCount:
+ math.min(f.requiredParameterCount, g.requiredParameterCount));
}
/// Computes the nullability-aware lower bound of two function types.
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart
index 542324e..722da3d 100644
--- a/pkg/kernel/lib/text/ast_to_text.dart
+++ b/pkg/kernel/lib/text/ast_to_text.dart
@@ -3010,6 +3010,10 @@
int visitEqualsNull(EqualsNull node) => EQUALITY;
@override
+ int visitAbstractSuperMethodInvocation(AbstractSuperMethodInvocation node) =>
+ CALLEE;
+
+ @override
int visitSuperMethodInvocation(SuperMethodInvocation node) => CALLEE;
@override
@@ -3104,6 +3108,13 @@
int visitFunctionTearOff(FunctionTearOff node) => PRIMARY;
@override
+ int visitAbstractSuperPropertyGet(AbstractSuperPropertyGet node) => PRIMARY;
+
+ @override
+ int visitAbstractSuperPropertySet(AbstractSuperPropertySet node) =>
+ EXPRESSION;
+
+ @override
int visitSuperPropertyGet(SuperPropertyGet node) => PRIMARY;
@override
diff --git a/pkg/kernel/lib/type_checker.dart b/pkg/kernel/lib/type_checker.dart
index 293015d..6e44499 100644
--- a/pkg/kernel/lib/type_checker.dart
+++ b/pkg/kernel/lib/type_checker.dart
@@ -753,6 +753,19 @@
}
@override
+ DartType visitAbstractSuperMethodInvocation(
+ AbstractSuperMethodInvocation node) {
+ Member? target = node.interfaceTarget;
+ if (target == null) {
+ checkUnresolvedInvocation(currentThisType!, node);
+ return handleDynamicCall(currentThisType!, node.arguments);
+ } else {
+ return handleCall(node.arguments, target.superGetterType,
+ receiver: getSuperReceiverType(target));
+ }
+ }
+
+ @override
DartType visitSuperMethodInvocation(SuperMethodInvocation node) {
Member? target = node.interfaceTarget;
if (target == null) {
@@ -765,6 +778,32 @@
}
@override
+ DartType visitAbstractSuperPropertyGet(AbstractSuperPropertyGet node) {
+ Member? target = node.interfaceTarget;
+ if (target == null) {
+ checkUnresolvedInvocation(currentThisType!, node);
+ return const DynamicType();
+ } else {
+ Substitution receiver = getSuperReceiverType(target);
+ return receiver.substituteType(target.superGetterType);
+ }
+ }
+
+ @override
+ DartType visitAbstractSuperPropertySet(AbstractSuperPropertySet node) {
+ Member? target = node.interfaceTarget;
+ DartType value = visitExpression(node.value);
+ if (target != null) {
+ Substitution receiver = getSuperReceiverType(target);
+ checkAssignable(node.value, value,
+ receiver.substituteType(target.superSetterType, contravariant: true));
+ } else {
+ checkUnresolvedInvocation(currentThisType!, node);
+ }
+ return value;
+ }
+
+ @override
DartType visitSuperPropertyGet(SuperPropertyGet node) {
Member? target = node.interfaceTarget;
if (target == null) {
diff --git a/pkg/kernel/lib/visitor.dart b/pkg/kernel/lib/visitor.dart
index d88c2a9..64f3acc 100644
--- a/pkg/kernel/lib/visitor.dart
+++ b/pkg/kernel/lib/visitor.dart
@@ -23,6 +23,10 @@
R visitInstanceGet(InstanceGet node) => defaultExpression(node);
R visitInstanceSet(InstanceSet node) => defaultExpression(node);
R visitInstanceTearOff(InstanceTearOff node) => defaultExpression(node);
+ R visitAbstractSuperPropertyGet(AbstractSuperPropertyGet node) =>
+ defaultExpression(node);
+ R visitAbstractSuperPropertySet(AbstractSuperPropertySet node) =>
+ defaultExpression(node);
R visitSuperPropertyGet(SuperPropertyGet node) => defaultExpression(node);
R visitSuperPropertySet(SuperPropertySet node) => defaultExpression(node);
R visitStaticGet(StaticGet node) => defaultExpression(node);
@@ -37,6 +41,8 @@
defaultExpression(node);
R visitEqualsNull(EqualsNull node) => defaultExpression(node);
R visitEqualsCall(EqualsCall node) => defaultExpression(node);
+ R visitAbstractSuperMethodInvocation(AbstractSuperMethodInvocation node) =>
+ defaultExpression(node);
R visitSuperMethodInvocation(SuperMethodInvocation node) =>
defaultExpression(node);
R visitStaticInvocation(StaticInvocation node) => defaultExpression(node);
@@ -209,6 +215,12 @@
@override
R visitInstanceTearOff(InstanceTearOff node) => defaultExpression(node);
@override
+ R visitAbstractSuperPropertyGet(AbstractSuperPropertyGet node) =>
+ defaultExpression(node);
+ @override
+ R visitAbstractSuperPropertySet(AbstractSuperPropertySet node) =>
+ defaultExpression(node);
+ @override
R visitSuperPropertyGet(SuperPropertyGet node) => defaultExpression(node);
@override
R visitSuperPropertySet(SuperPropertySet node) => defaultExpression(node);
@@ -235,6 +247,9 @@
@override
R visitEqualsCall(EqualsCall node) => defaultExpression(node);
@override
+ R visitAbstractSuperMethodInvocation(AbstractSuperMethodInvocation node) =>
+ defaultExpression(node);
+ @override
R visitSuperMethodInvocation(SuperMethodInvocation node) =>
defaultExpression(node);
@override
@@ -457,6 +472,12 @@
R visitInstanceTearOff(InstanceTearOff node, A arg) =>
defaultExpression(node, arg);
@override
+ R visitAbstractSuperPropertyGet(AbstractSuperPropertyGet node, A arg) =>
+ defaultExpression(node, arg);
+ @override
+ R visitAbstractSuperPropertySet(AbstractSuperPropertySet node, A arg) =>
+ defaultExpression(node, arg);
+ @override
R visitSuperPropertyGet(SuperPropertyGet node, A arg) =>
defaultExpression(node, arg);
@override
@@ -489,6 +510,10 @@
@override
R visitEqualsCall(EqualsCall node, A arg) => defaultExpression(node, arg);
@override
+ R visitAbstractSuperMethodInvocation(
+ AbstractSuperMethodInvocation node, A arg) =>
+ defaultExpression(node, arg);
+ @override
R visitSuperMethodInvocation(SuperMethodInvocation node, A arg) =>
defaultExpression(node, arg);
@override
@@ -1976,6 +2001,10 @@
R visitInstanceSet(InstanceSet node, T arg) => defaultExpression(node, arg);
R visitInstanceTearOff(InstanceTearOff node, T arg) =>
defaultExpression(node, arg);
+ R visitAbstractSuperPropertyGet(AbstractSuperPropertyGet node, T arg) =>
+ defaultExpression(node, arg);
+ R visitAbstractSuperPropertySet(AbstractSuperPropertySet node, T arg) =>
+ defaultExpression(node, arg);
R visitSuperPropertyGet(SuperPropertyGet node, T arg) =>
defaultExpression(node, arg);
R visitSuperPropertySet(SuperPropertySet node, T arg) =>
@@ -1996,6 +2025,9 @@
defaultExpression(node, arg);
R visitEqualsNull(EqualsNull node, T arg) => defaultExpression(node, arg);
R visitEqualsCall(EqualsCall node, T arg) => defaultExpression(node, arg);
+ R visitAbstractSuperMethodInvocation(
+ AbstractSuperMethodInvocation node, T arg) =>
+ defaultExpression(node, arg);
R visitSuperMethodInvocation(SuperMethodInvocation node, T arg) =>
defaultExpression(node, arg);
R visitStaticInvocation(StaticInvocation node, T arg) =>
diff --git a/runtime/tests/vm/dart/isolates/fast_object_copy_timeline_test.dart b/runtime/tests/vm/dart/isolates/fast_object_copy_timeline_test.dart
new file mode 100644
index 0000000..72b4932
--- /dev/null
+++ b/runtime/tests/vm/dart/isolates/fast_object_copy_timeline_test.dart
@@ -0,0 +1,120 @@
+// Copyright (c) 2022, 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.
+
+// VMOptions=--no-enable-fast-object-copy
+// VMOptions=--enable-fast-object-copy
+
+import 'dart:io';
+import 'dart:isolate';
+import 'dart:ffi';
+import 'dart:typed_data';
+
+import 'package:expect/expect.dart';
+
+import '../timeline_utils.dart';
+
+final int wordSize = sizeOf<IntPtr>();
+final bool useCompressedPointers =
+ wordSize == 8 && (Platform.isAndroid || Platform.isIOS);
+
+final int kAllocationSize = 2 * wordSize;
+final int headerSize = wordSize;
+final int slotSize = useCompressedPointers ? 4 : wordSize;
+
+final int objectBaseSize = headerSize;
+final int arrayBaseSize = headerSize + 2 * slotSize;
+final int typedDataBaseSize = headerSize + 2 * wordSize;
+
+int objectSize(int slots) => toAllocationSize(headerSize + slots * slotSize);
+int arraySize(int elements) =>
+ toAllocationSize(headerSize + 2 * slotSize + elements * slotSize);
+int typedDataSize(int length) =>
+ toAllocationSize(headerSize + 2 * wordSize + length);
+
+int toAllocationSize(int value) =>
+ (value + kAllocationSize - 1) & ~(kAllocationSize - 1);
+
+Future main(List<String> args) async {
+ if (const bool.fromEnvironment('dart.vm.product')) {
+ return; // No timeline support
+ }
+
+ if (args.contains('--child')) {
+ final rp = ReceivePort();
+ final sendPort = rp.sendPort;
+
+ sendPort.send(Object());
+ sendPort.send(List<dynamic>.filled(2, null)
+ ..[0] = Object()
+ ..[1] = Object());
+ sendPort.send(Uint8List(11));
+
+ rp.close();
+ return;
+ }
+
+ final timelineEvents = await runAndCollectTimeline('Isolate', ['--child']);
+ final mainIsolateId = findMainIsolateId(timelineEvents);
+ final copyOperations = getCopyOperations(timelineEvents, mainIsolateId);
+
+ // We're only interested in the last 3 operations (which are done by the
+ // application).
+ copyOperations.removeRange(0, copyOperations.length - 3);
+
+ Expect.equals(1, copyOperations[0].objectsCopied);
+ Expect.equals(3, copyOperations[1].objectsCopied);
+ Expect.equals(1, copyOperations[2].objectsCopied);
+
+ Expect.equals(objectSize(0), copyOperations[0].bytesCopied);
+ Expect.equals(
+ arraySize(2) + 2 * objectSize(0), copyOperations[1].bytesCopied);
+ Expect.equals(typedDataSize(11), copyOperations[2].bytesCopied);
+}
+
+List<ObjectCopyOperation> getCopyOperations(
+ List<TimelineEvent> events, String isolateId) {
+ final copyOperations = <ObjectCopyOperation>[];
+
+ int? startTs = null;
+ int? startTts = null;
+
+ for (final e in events) {
+ if (e.isolateId != isolateId) continue;
+ if (e.name != 'CopyMutableObjectGraph') continue;
+
+ if (startTts != null) {
+ if (!e.isEnd) throw 'Missing end of copy event';
+
+ final us = e.ts - startTs!;
+ final threadUs = e.tts! - startTts;
+ copyOperations.add(ObjectCopyOperation(
+ us,
+ threadUs,
+ int.parse(e.args['AllocatedBytes']!),
+ int.parse(e.args['CopiedObjects']!)));
+
+ startTs = null;
+ startTts = null;
+ continue;
+ }
+
+ if (!e.isStart) throw 'Expected end of copy event';
+ startTs = e.ts;
+ startTts = e.tts;
+ }
+ return copyOperations;
+}
+
+class ObjectCopyOperation {
+ final int us;
+ final int threadUs;
+ final int bytesCopied;
+ final int objectsCopied;
+
+ ObjectCopyOperation(
+ this.us, this.threadUs, this.bytesCopied, this.objectsCopied);
+
+ String toString() =>
+ 'ObjectCopyOperation($us, $threadUs, $bytesCopied, $objectsCopied)';
+}
diff --git a/runtime/tests/vm/dart/snapshot_test_helper.dart b/runtime/tests/vm/dart/snapshot_test_helper.dart
index 80d3344..a6890dd 100644
--- a/runtime/tests/vm/dart/snapshot_test_helper.dart
+++ b/runtime/tests/vm/dart/snapshot_test_helper.dart
@@ -124,7 +124,7 @@
withTempDir(Future fun(String dir)) async {
final Directory tempDir = Directory.systemTemp.createTempSync();
try {
- await fun(tempDir.path);
+ return await fun(tempDir.path);
} finally {
tempDir.deleteSync(recursive: true);
}
diff --git a/runtime/tests/vm/dart/timeline_recorder_file_test.dart b/runtime/tests/vm/dart/timeline_recorder_file_test.dart
index 851a68a..7310754 100644
--- a/runtime/tests/vm/dart/timeline_recorder_file_test.dart
+++ b/runtime/tests/vm/dart/timeline_recorder_file_test.dart
@@ -2,13 +2,9 @@
// 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.
-import "dart:io";
-import "dart:convert";
import "dart:developer";
-import "package:path/path.dart" as path;
-
-import "snapshot_test_helper.dart";
+import "timeline_utils.dart";
main(List<String> args) async {
if (const bool.fromEnvironment("dart.vm.product")) {
@@ -21,48 +17,20 @@
return;
}
- await withTempDir((String tmp) async {
- final String timelinePath = path.join(tmp, "timeline.json");
- final p = await Process.run(Platform.executable, [
- ...Platform.executableArguments,
- "--trace_timeline",
- "--timeline_recorder=file:$timelinePath",
- "--timeline_streams=VM,Isolate,GC,Compiler",
- Platform.script.toFilePath(),
- "--child"
- ]);
- print(p.stdout);
- print(p.stderr);
- if (p.exitCode != 0) {
- throw "Child process failed: ${p.exitCode}";
- }
- // On Android, --trace_timeline goes to syslog instead of stderr.
- if (!Platform.isAndroid) {
- if (!p.stderr.contains("Using the File timeline recorder")) {
- throw "Failed to select file recorder";
- }
- }
+ final timelineEvents =
+ await runAndCollectTimeline('VM,Isolate,GC,Compiler', ['--child']);
- final timeline = jsonDecode(await new File(timelinePath).readAsString());
- if (timeline is! List) throw "Timeline should be a JSON list";
- print("${timeline.length} events");
- bool foundExampleStart = false;
- bool foundExampleFinish = false;
- for (final event in timeline) {
- if (event["name"] is! String) throw "Event missing name";
- if (event["cat"] is! String) throw "Event missing category";
- if (event["tid"] is! int) throw "Event missing thread";
- if (event["pid"] is! int) throw "Event missing process";
- if (event["ph"] is! String) throw "Event missing type";
- if ((event["name"] == "TestEvent") && (event["ph"] == "B")) {
- foundExampleStart = true;
- }
- if ((event["name"] == "TestEvent") && (event["ph"] == "E")) {
- foundExampleFinish = true;
- }
+ bool foundExampleStart = false;
+ bool foundExampleFinish = false;
+ for (final event in timelineEvents) {
+ if (event.name == "TestEvent" && event.ph == "B") {
+ foundExampleStart = true;
}
+ if (event.name == "TestEvent" && event.ph == "E") {
+ foundExampleFinish = true;
+ }
+ }
- if (foundExampleStart) throw "Missing test start event";
- if (foundExampleFinish) throw "Missing test finish event";
- });
+ if (foundExampleStart) throw "Missing test start event";
+ if (foundExampleFinish) throw "Missing test finish event";
}
diff --git a/runtime/tests/vm/dart/timeline_utils.dart b/runtime/tests/vm/dart/timeline_utils.dart
new file mode 100644
index 0000000..cf0cddc
--- /dev/null
+++ b/runtime/tests/vm/dart/timeline_utils.dart
@@ -0,0 +1,92 @@
+// Copyright (c) 2022, 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.
+
+import 'dart:io';
+import 'dart:convert';
+
+import 'package:path/path.dart' as path;
+
+import 'snapshot_test_helper.dart';
+
+Future<List<TimelineEvent>> runAndCollectTimeline(
+ String streams, List<String> args) async {
+ return await withTempDir((String tmp) async {
+ final String timelinePath = path.join(tmp, 'timeline.json');
+ final p = await Process.run(Platform.executable, [
+ ...Platform.executableArguments,
+ '--trace_timeline',
+ '--timeline_recorder=file:$timelinePath',
+ '--timeline_streams=$streams',
+ Platform.script.toFilePath(),
+ ...args,
+ ]);
+ print(p.stdout);
+ print(p.stderr);
+ if (p.exitCode != 0) {
+ throw 'Child process failed: ${p.exitCode}';
+ }
+ // On Android, --trace_timeline goes to syslog instead of stderr.
+ if (!Platform.isAndroid) {
+ if (!p.stderr.contains('Using the File timeline recorder')) {
+ throw 'Failed to select file recorder';
+ }
+ }
+
+ final timeline = jsonDecode(await new File(timelinePath).readAsString());
+ if (timeline is! List) throw 'Timeline should be a JSON list';
+
+ return parseTimeline(timeline);
+ });
+}
+
+List<TimelineEvent> parseTimeline(List l) {
+ final events = <TimelineEvent>[];
+
+ for (final event in l) {
+ events.add(TimelineEvent.from(event));
+ }
+ return events;
+}
+
+String findMainIsolateId(List<TimelineEvent> events) {
+ return events
+ .firstWhere((e) =>
+ e.name == 'InitializeIsolate' && e.args['isolateName'] == 'main')
+ .isolateId!;
+}
+
+class TimelineEvent {
+ final String name;
+ final String cat;
+ final int tid;
+ final int pid;
+ final int ts;
+ final int? tts;
+ final String ph;
+ final Map<String, String> args;
+
+ TimelineEvent._(this.name, this.cat, this.tid, this.pid, this.ts, this.tts,
+ this.ph, this.args);
+
+ factory TimelineEvent.from(Map m) {
+ return TimelineEvent._(
+ m['name'] as String,
+ m['cat'] as String,
+ m['tid'] as int,
+ m['pid'] as int,
+ m['ts'] as int,
+ m['tts'] as int?,
+ m['ph'] as String,
+ m['args'].cast<String, String>(),
+ );
+ }
+
+ bool get isStart => ph == 'B';
+ bool get isEnd => ph == 'E';
+
+ String? get isolateId => args['isolateId'];
+
+ String toString() =>
+ 'TimelineEvent($name, $cat, $tid, $pid, $ts, $tts, $ph, $args)';
+}
diff --git a/runtime/tests/vm/dart_2/isolates/fast_object_copy_timeline_test.dart b/runtime/tests/vm/dart_2/isolates/fast_object_copy_timeline_test.dart
new file mode 100644
index 0000000..9030c78
--- /dev/null
+++ b/runtime/tests/vm/dart_2/isolates/fast_object_copy_timeline_test.dart
@@ -0,0 +1,122 @@
+// Copyright (c) 2022, 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.
+
+// @dart = 2.9
+
+// VMOptions=--no-enable-fast-object-copy
+// VMOptions=--enable-fast-object-copy
+
+import 'dart:io';
+import 'dart:isolate';
+import 'dart:ffi';
+import 'dart:typed_data';
+
+import 'package:expect/expect.dart';
+
+import '../timeline_utils.dart';
+
+final int wordSize = sizeOf<IntPtr>();
+final bool useCompressedPointers =
+ wordSize == 8 && (Platform.isAndroid || Platform.isIOS);
+
+final int kAllocationSize = 2 * wordSize;
+final int headerSize = wordSize;
+final int slotSize = useCompressedPointers ? 4 : wordSize;
+
+final int objectBaseSize = headerSize;
+final int arrayBaseSize = headerSize + 2 * slotSize;
+final int typedDataBaseSize = headerSize + 2 * wordSize;
+
+int objectSize(int slots) => toAllocationSize(headerSize + slots * slotSize);
+int arraySize(int elements) =>
+ toAllocationSize(headerSize + 2 * slotSize + elements * slotSize);
+int typedDataSize(int length) =>
+ toAllocationSize(headerSize + 2 * wordSize + length);
+
+int toAllocationSize(int value) =>
+ (value + kAllocationSize - 1) & ~(kAllocationSize - 1);
+
+Future main(List<String> args) async {
+ if (const bool.fromEnvironment('dart.vm.product')) {
+ return; // No timeline support
+ }
+
+ if (args.contains('--child')) {
+ final rp = ReceivePort();
+ final sendPort = rp.sendPort;
+
+ sendPort.send(Object());
+ sendPort.send(List<dynamic>.filled(2, null)
+ ..[0] = Object()
+ ..[1] = Object());
+ sendPort.send(Uint8List(11));
+
+ rp.close();
+ return;
+ }
+
+ final timelineEvents = await runAndCollectTimeline('Isolate', ['--child']);
+ final mainIsolateId = findMainIsolateId(timelineEvents);
+ final copyOperations = getCopyOperations(timelineEvents, mainIsolateId);
+
+ // We're only interested in the last 3 operations (which are done by the
+ // application).
+ copyOperations.removeRange(0, copyOperations.length - 3);
+
+ Expect.equals(1, copyOperations[0].objectsCopied);
+ Expect.equals(3, copyOperations[1].objectsCopied);
+ Expect.equals(1, copyOperations[2].objectsCopied);
+
+ Expect.equals(objectSize(0), copyOperations[0].bytesCopied);
+ Expect.equals(
+ arraySize(2) + 2 * objectSize(0), copyOperations[1].bytesCopied);
+ Expect.equals(typedDataSize(11), copyOperations[2].bytesCopied);
+}
+
+List<ObjectCopyOperation> getCopyOperations(
+ List<TimelineEvent> events, String isolateId) {
+ final copyOperations = <ObjectCopyOperation>[];
+
+ int startTs = null;
+ int startTts = null;
+
+ for (final e in events) {
+ if (e.isolateId != isolateId) continue;
+ if (e.name != 'CopyMutableObjectGraph') continue;
+
+ if (startTts != null) {
+ if (!e.isEnd) throw 'Missing end of copy event';
+
+ final us = e.ts - startTs;
+ final threadUs = e.tts - startTts;
+ copyOperations.add(ObjectCopyOperation(
+ us,
+ threadUs,
+ int.parse(e.args['AllocatedBytes']),
+ int.parse(e.args['CopiedObjects'])));
+
+ startTs = null;
+ startTts = null;
+ continue;
+ }
+
+ if (!e.isStart) throw 'Expected end of copy event';
+ startTs = e.ts;
+ startTts = e.tts;
+ }
+ return copyOperations;
+}
+
+class ObjectCopyOperation {
+ final int us;
+ final int threadUs;
+ final int bytesCopied;
+ final int objectsCopied;
+
+ ObjectCopyOperation(
+ this.us, this.threadUs, this.bytesCopied, this.objectsCopied);
+
+ String toString() =>
+ 'ObjectCopyOperation($us, $threadUs, $bytesCopied, $objectsCopied)';
+}
diff --git a/runtime/tests/vm/dart_2/snapshot_test_helper.dart b/runtime/tests/vm/dart_2/snapshot_test_helper.dart
index b57d04d..d790c4a 100644
--- a/runtime/tests/vm/dart_2/snapshot_test_helper.dart
+++ b/runtime/tests/vm/dart_2/snapshot_test_helper.dart
@@ -126,7 +126,7 @@
withTempDir(Future fun(String dir)) async {
final Directory tempDir = Directory.systemTemp.createTempSync();
try {
- await fun(tempDir.path);
+ return await fun(tempDir.path);
} finally {
tempDir.deleteSync(recursive: true);
}
diff --git a/runtime/tests/vm/dart_2/timeline_recorder_file_test.dart b/runtime/tests/vm/dart_2/timeline_recorder_file_test.dart
index e49877c..e308ebd 100644
--- a/runtime/tests/vm/dart_2/timeline_recorder_file_test.dart
+++ b/runtime/tests/vm/dart_2/timeline_recorder_file_test.dart
@@ -4,13 +4,9 @@
// @dart = 2.9
-import "dart:io";
-import "dart:convert";
import "dart:developer";
-import "package:path/path.dart" as path;
-
-import "snapshot_test_helper.dart";
+import "timeline_utils.dart";
main(List<String> args) async {
if (const bool.fromEnvironment("dart.vm.product")) {
@@ -23,48 +19,25 @@
return;
}
- await withTempDir((String tmp) async {
- final String timelinePath = path.join(tmp, "timeline.json");
- final p = await Process.run(Platform.executable, [
- ...Platform.executableArguments,
- "--trace_timeline",
- "--timeline_recorder=file:$timelinePath",
- "--timeline_streams=VM,Isolate,GC,Compiler",
- Platform.script.toFilePath(),
- "--child"
- ]);
- print(p.stdout);
- print(p.stderr);
- if (p.exitCode != 0) {
- throw "Child process failed: ${p.exitCode}";
- }
- // On Android, --trace_timeline goes to syslog instead of stderr.
- if (!Platform.isAndroid) {
- if (!p.stderr.contains("Using the File timeline recorder")) {
- throw "Failed to select file recorder";
- }
- }
+ final timelineEvents =
+ await runAndCollectTimeline('VM,Isolate,GC,Compiler', ['--child']);
- final timeline = jsonDecode(await new File(timelinePath).readAsString());
- if (timeline is! List) throw "Timeline should be a JSON list";
- print("${timeline.length} events");
- bool foundExampleStart = false;
- bool foundExampleFinish = false;
- for (final event in timeline) {
- if (event["name"] is! String) throw "Event missing name";
- if (event["cat"] is! String) throw "Event missing category";
- if (event["tid"] is! int) throw "Event missing thread";
- if (event["pid"] is! int) throw "Event missing process";
- if (event["ph"] is! String) throw "Event missing type";
- if ((event["name"] == "TestEvent") && (event["ph"] == "B")) {
- foundExampleStart = true;
- }
- if ((event["name"] == "TestEvent") && (event["ph"] == "E")) {
- foundExampleFinish = true;
- }
+ bool foundExampleStart = false;
+ bool foundExampleFinish = false;
+ for (final event in timelineEvents) {
+ if (event.name is! String) throw "Event missing name";
+ if (event.cat is! String) throw "Event missing category";
+ if (event.tid is! int) throw "Event missing thread";
+ if (event.pid is! int) throw "Event missing process";
+ if (event.ph is! String) throw "Event missing type";
+ if (event.name == "TestEvent" && event.ph == "B") {
+ foundExampleStart = true;
}
+ if (event.name == "TestEvent" && event.ph == "E") {
+ foundExampleFinish = true;
+ }
+ }
- if (foundExampleStart) throw "Missing test start event";
- if (foundExampleFinish) throw "Missing test finish event";
- });
+ if (foundExampleStart) throw "Missing test start event";
+ if (foundExampleFinish) throw "Missing test finish event";
}
diff --git a/runtime/tests/vm/dart_2/timeline_utils.dart b/runtime/tests/vm/dart_2/timeline_utils.dart
new file mode 100644
index 0000000..3041293
--- /dev/null
+++ b/runtime/tests/vm/dart_2/timeline_utils.dart
@@ -0,0 +1,94 @@
+// Copyright (c) 2022, 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.
+
+// @dart = 2.9
+
+import 'dart:io';
+import 'dart:convert';
+
+import 'package:path/path.dart' as path;
+
+import 'snapshot_test_helper.dart';
+
+Future<List<TimelineEvent>> runAndCollectTimeline(
+ String streams, List<String> args) async {
+ return await withTempDir((String tmp) async {
+ final String timelinePath = path.join(tmp, 'timeline.json');
+ final p = await Process.run(Platform.executable, [
+ ...Platform.executableArguments,
+ '--trace_timeline',
+ '--timeline_recorder=file:$timelinePath',
+ '--timeline_streams=$streams',
+ Platform.script.toFilePath(),
+ ...args,
+ ]);
+ print(p.stdout);
+ print(p.stderr);
+ if (p.exitCode != 0) {
+ throw 'Child process failed: ${p.exitCode}';
+ }
+ // On Android, --trace_timeline goes to syslog instead of stderr.
+ if (!Platform.isAndroid) {
+ if (!p.stderr.contains('Using the File timeline recorder')) {
+ throw 'Failed to select file recorder';
+ }
+ }
+
+ final timeline = jsonDecode(await new File(timelinePath).readAsString());
+ if (timeline is! List) throw 'Timeline should be a JSON list';
+
+ return parseTimeline(timeline);
+ });
+}
+
+List<TimelineEvent> parseTimeline(List l) {
+ final events = <TimelineEvent>[];
+
+ for (final event in l) {
+ events.add(TimelineEvent.from(event));
+ }
+ return events;
+}
+
+String findMainIsolateId(List<TimelineEvent> events) {
+ return events
+ .firstWhere((e) =>
+ e.name == 'InitializeIsolate' && e.args['isolateName'] == 'main')
+ .args['isolateId'];
+}
+
+class TimelineEvent {
+ final String name;
+ final String cat;
+ final int tid;
+ final int pid;
+ final int ts;
+ final int tts;
+ final String ph;
+ final Map<String, String> args;
+
+ TimelineEvent._(this.name, this.cat, this.tid, this.pid, this.ts, this.tts,
+ this.ph, this.args);
+
+ factory TimelineEvent.from(Map m) {
+ return TimelineEvent._(
+ m['name'] as String,
+ m['cat'] as String,
+ m['tid'] as int,
+ m['pid'] as int,
+ m['ts'] as int,
+ m['tts'] as int,
+ m['ph'] as String,
+ m['args'].cast<String, String>(),
+ );
+ }
+
+ bool get isStart => ph == 'B';
+ bool get isEnd => ph == 'E';
+
+ String get isolateId => args['isolateId'];
+
+ String toString() =>
+ 'TimelineEvent($name, $cat, $tid, $pid, $ts, $tts, $ph, $args)';
+}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 2496daf..c61949e 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -299,7 +299,9 @@
[ $compiler == dartkp && ($arch == simarm || $arch == simarm64 || $arch == simarm64c || $arch == simriscv32 || $arch == simriscv64) ]
dart/causal_stacks/async_throws_stack_lazy_non_symbolic_test: Pass, Slow
+dart/isolates/fast_object_copy_test*: SkipSlow
dart_2/causal_stacks/async_throws_stack_lazy_non_symbolic_test: Pass, Slow
+dart_2/isolates/fast_object_copy_test*: SkipSlow
[ $compiler == dartkp && ($arch == simarm || $arch == simarm64 || $arch == simarm64c || $arch == simriscv32 || $arch == simriscv64 || $builder_tag == tsan) ]
dart/regress_45898_test: Pass, Slow
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index abfc8a7..a1f6765 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -1172,6 +1172,16 @@
return BuildInstanceSet(position);
case kDynamicSet:
return BuildDynamicSet(position);
+ case kAbstractSuperPropertyGet:
+ // Abstract super property getters must be converted into super property
+ // getters during mixin transformation.
+ UNREACHABLE();
+ break;
+ case kAbstractSuperPropertySet:
+ // Abstract super property setters must be converted into super property
+ // setters during mixin transformation.
+ UNREACHABLE();
+ break;
case kSuperPropertyGet:
return BuildSuperPropertyGet(position);
case kSuperPropertySet:
@@ -1192,6 +1202,11 @@
return BuildEqualsCall(position);
case kEqualsNull:
return BuildEqualsNull(position);
+ case kAbstractSuperMethodInvocation:
+ // Abstract super method invocations must be converted into super
+ // method invocations during mixin transformation.
+ UNREACHABLE();
+ break;
case kSuperMethodInvocation:
return BuildSuperMethodInvocation(position);
case kStaticInvocation:
diff --git a/runtime/vm/compiler/frontend/kernel_fingerprints.cc b/runtime/vm/compiler/frontend/kernel_fingerprints.cc
index 3a888c4..7347029 100644
--- a/runtime/vm/compiler/frontend/kernel_fingerprints.cc
+++ b/runtime/vm/compiler/frontend/kernel_fingerprints.cc
@@ -412,6 +412,16 @@
BuildHash(ReadNameAsSetterName().Hash()); // read name.
CalculateExpressionFingerprint(); // read value.
return;
+ case kAbstractSuperPropertyGet:
+ // Abstract super property getters must be converted into super property
+ // getters during mixin transformation.
+ UNREACHABLE();
+ break;
+ case kAbstractSuperPropertySet:
+ // Abstract super property setters must be converted into super property
+ // setters during mixin transformation.
+ UNREACHABLE();
+ break;
case kSuperPropertyGet:
ReadPosition(); // read position.
BuildHash(ReadNameAsGetterName().Hash()); // read name.
@@ -474,6 +484,11 @@
ReadPosition(); // read position.
CalculateExpressionFingerprint(); // read expression.
return;
+ case kAbstractSuperMethodInvocation:
+ // Abstract super method invocations must be converted into super
+ // method invocations during mixin transformation.
+ UNREACHABLE();
+ break;
case kSuperMethodInvocation:
ReadPosition(); // read position.
BuildHash(ReadNameAsMethodName().Hash()); // read name.
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index e300802..d52cc58 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -2420,6 +2420,16 @@
SkipName(); // read name.
SkipExpression(); // read value.
return;
+ case kAbstractSuperPropertyGet:
+ // Abstract super property getters must be converted into super property
+ // getters during mixin transformation.
+ UNREACHABLE();
+ break;
+ case kAbstractSuperPropertySet:
+ // Abstract super property setters must be converted into super property
+ // setters during mixin transformation.
+ UNREACHABLE();
+ break;
case kSuperPropertyGet:
ReadPosition(); // read position.
SkipName(); // read name.
@@ -2482,6 +2492,11 @@
ReadPosition(); // read position.
SkipExpression(); // read expression.
return;
+ case kAbstractSuperMethodInvocation:
+ // Abstract super method invocations must be converted into super
+ // method invocations during mixin transformation.
+ UNREACHABLE();
+ break;
case kSuperMethodInvocation:
ReadPosition(); // read position.
SkipName(); // read name.
diff --git a/runtime/vm/compiler/frontend/scope_builder.cc b/runtime/vm/compiler/frontend/scope_builder.cc
index 89d7660..3282161 100644
--- a/runtime/vm/compiler/frontend/scope_builder.cc
+++ b/runtime/vm/compiler/frontend/scope_builder.cc
@@ -748,6 +748,16 @@
helper_.SkipName(); // read name.
VisitExpression(); // read value.
return;
+ case kAbstractSuperPropertyGet:
+ // Abstract super property getters must be converted into super property
+ // getters during mixin transformation.
+ UNREACHABLE();
+ break;
+ case kAbstractSuperPropertySet:
+ // Abstract super property setters must be converted into super property
+ // setters during mixin transformation.
+ UNREACHABLE();
+ break;
case kSuperPropertyGet:
HandleLoadReceiver();
helper_.ReadPosition(); // read position.
@@ -817,6 +827,11 @@
helper_.ReadPosition(); // read position.
VisitExpression(); // read expression.
return;
+ case kAbstractSuperMethodInvocation:
+ // Abstract super method invocations must be converted into super
+ // method invocations during mixin transformation.
+ UNREACHABLE();
+ break;
case kSuperMethodInvocation:
HandleLoadReceiver();
helper_.ReadPosition(); // read position.
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index 6e6972f..96c196d 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -20,8 +20,8 @@
static const uint32_t kMagicProgramFile = 0x90ABCDEFu;
// Both version numbers are inclusive.
-static const uint32_t kMinSupportedKernelFormatVersion = 80;
-static const uint32_t kMaxSupportedKernelFormatVersion = 80;
+static const uint32_t kMinSupportedKernelFormatVersion = 81;
+static const uint32_t kMaxSupportedKernelFormatVersion = 81;
// Keep in sync with package:kernel/lib/binary/tag.dart
#define KERNEL_TAG_LIST(V) \
@@ -49,10 +49,13 @@
V(InvalidExpression, 19) \
V(VariableGet, 20) \
V(VariableSet, 21) \
+ V(AbstractSuperPropertyGet, 22) \
+ V(AbstractSuperPropertySet, 23) \
V(SuperPropertyGet, 24) \
V(SuperPropertySet, 25) \
V(StaticGet, 26) \
V(StaticSet, 27) \
+ V(AbstractSuperMethodInvocation, 28) \
V(SuperMethodInvocation, 29) \
V(StaticInvocation, 30) \
V(ConstructorInvocation, 31) \
diff --git a/runtime/vm/object_graph_copy.cc b/runtime/vm/object_graph_copy.cc
index 86d3c8e..43c35b3 100644
--- a/runtime/vm/object_graph_copy.cc
+++ b/runtime/vm/object_graph_copy.cc
@@ -12,6 +12,7 @@
#include "vm/object_store.h"
#include "vm/snapshot.h"
#include "vm/symbols.h"
+#include "vm/timeline.h"
#define Z zone_
@@ -422,7 +423,7 @@
return raw_from_to_[id + 1];
}
- void Insert(ObjectPtr from, ObjectPtr to) {
+ void Insert(ObjectPtr from, ObjectPtr to, intptr_t size) {
ASSERT(ForwardedObject(from) == Marker());
ASSERT(raw_from_to_.length() == raw_from_to_.length());
const auto id = raw_from_to_.length();
@@ -430,6 +431,7 @@
raw_from_to_.Resize(id + 2);
raw_from_to_[id] = from;
raw_from_to_[id + 1] = to;
+ allocated_bytes += size;
}
void AddTransferable(TransferableTypedDataPtr from,
@@ -460,6 +462,7 @@
GrowableArray<WeakPropertyPtr> raw_weak_properties_;
GrowableArray<WeakReferencePtr> raw_weak_references_;
intptr_t fill_cursor_ = 0;
+ intptr_t allocated_bytes = 0;
DISALLOW_COPY_AND_ASSIGN(FastForwardMap);
};
@@ -482,13 +485,14 @@
return from_to_[id + 1]->ptr();
}
- void Insert(ObjectPtr from, ObjectPtr to) {
+ void Insert(ObjectPtr from, ObjectPtr to, intptr_t size) {
ASSERT(ForwardedObject(from) == Marker());
const auto id = from_to_.length();
SetObjectId(from, id);
from_to_.Resize(id + 2);
from_to_[id] = &Object::Handle(Z, from);
from_to_[id + 1] = &Object::Handle(Z, to);
+ allocated_bytes += size;
}
void AddTransferable(const TransferableTypedData& from,
@@ -541,6 +545,7 @@
GrowableArray<const WeakProperty*> weak_properties_;
GrowableArray<const WeakReference*> weak_references_;
intptr_t fill_cursor_ = 0;
+ intptr_t allocated_bytes = 0;
DISALLOW_COPY_AND_ASSIGN(SlowForwardMap);
};
@@ -780,7 +785,7 @@
const uword alloc = new_space_->TryAllocate(thread_, size);
if (alloc != 0) {
ObjectPtr to(reinterpret_cast<UntaggedObject*>(alloc));
- fast_forward_map_.Insert(from, to);
+ fast_forward_map_.Insert(from, to, size);
if (IsExternalTypedDataClassId(cid)) {
SetNewSpaceTaggingWord(to, cid, header_size);
@@ -986,7 +991,7 @@
size = from.ptr().untag()->HeapSize();
}
ObjectPtr to = AllocateObject(cid, size);
- slow_forward_map_.Insert(from.ptr(), to);
+ slow_forward_map_.Insert(from.ptr(), to, size);
UpdateLengthField(cid, from.ptr(), to);
if (cid == kArrayCid && !Heap::IsAllocatableInNewSpace(size)) {
to.untag()->SetCardRememberedBitUnsynchronized();
@@ -1847,6 +1852,10 @@
return result.ptr();
}
+ intptr_t allocated_bytes() { return allocated_bytes_; }
+
+ intptr_t copied_objects() { return copied_objects_; }
+
private:
ObjectPtr CopyObjectGraphInternal(const Object& root,
const char* volatile* exception_msg) {
@@ -1885,6 +1894,11 @@
result_array.SetAt(2, fast_object_copy_.tmp_);
HandlifyExternalTypedData();
HandlifyTransferables();
+ allocated_bytes_ =
+ fast_object_copy_.fast_forward_map_.allocated_bytes;
+ copied_objects_ =
+ fast_object_copy_.fast_forward_map_.fill_cursor_ / 2 -
+ /*null_entry=*/1;
return result_array.ptr();
}
@@ -1924,6 +1938,9 @@
result_array.SetAt(0, result);
result_array.SetAt(1, slow_object_copy_.objects_to_rehash_);
result_array.SetAt(2, slow_object_copy_.expandos_to_rehash_);
+ allocated_bytes_ = slow_object_copy_.slow_forward_map_.allocated_bytes;
+ copied_objects_ =
+ slow_object_copy_.slow_forward_map_.fill_cursor_ / 2 - /*null_entry=*/1;
return result_array.ptr();
}
@@ -1940,6 +1957,7 @@
HandlifyExpandosToReHash();
HandlifyFromToObjects();
slow_forward_map.fill_cursor_ = fast_forward_map.fill_cursor_;
+ slow_forward_map.allocated_bytes = fast_forward_map.allocated_bytes;
}
void MakeUninitializedNewSpaceObjectsGCSafe() {
@@ -2029,12 +2047,23 @@
Zone* zone_;
FastObjectCopy fast_object_copy_;
SlowObjectCopy slow_object_copy_;
+ intptr_t copied_objects_ = 0;
+ intptr_t allocated_bytes_ = 0;
};
ObjectPtr CopyMutableObjectGraph(const Object& object) {
auto thread = Thread::Current();
+ TIMELINE_DURATION(thread, Isolate, "CopyMutableObjectGraph");
ObjectGraphCopier copier(thread);
- return copier.CopyObjectGraph(object);
+ ObjectPtr result = copier.CopyObjectGraph(object);
+#if defined(SUPPORT_TIMELINE)
+ if (tbes.enabled()) {
+ tbes.SetNumArguments(2);
+ tbes.FormatArgument(0, "CopiedObjects", "%" Pd, copier.copied_objects());
+ tbes.FormatArgument(1, "AllocatedBytes", "%" Pd, copier.allocated_bytes());
+ }
+#endif
+ return result;
}
} // namespace dart
diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
index 1332aef..aa98b42 100644
--- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
@@ -2174,8 +2174,24 @@
/// ```
int get bitLength {
if (_used == 0) return 0;
- if (_isNegative) return (~this).bitLength;
- return _digitBits * (_used - 1) + _digits[_used - 1].bitLength;
+ final highBits = _digits[_used - 1];
+ assert(highBits != 0);
+ int length = _digitBits * (_used - 1) + highBits.bitLength;
+ if (!_isNegative) return length;
+
+ // `this` is negative, i.e. `-x` for the magnitude `x`. We want to find the
+ // bit length of `~this` or equivalently `-this-1`.
+ //
+ // -this-1 == -(-x)-1 == x-1
+ //
+ // `x-1` will have the same bit length as `x` unless `x` is power of two
+ // (e.g. 0x1000-1 = 0x0FFF). The magnitude is a power of two if the high
+ // digit is a power of two and all the other digits are zero.
+ if (highBits & (highBits - 1) != 0) return length;
+ for (int i = _used - 2; i >= 0; i--) {
+ if (_digits[i] != 0) return length;
+ }
+ return length - 1;
}
/// Truncating division operator.
diff --git a/sdk/lib/_internal/vm/lib/bigint_patch.dart b/sdk/lib/_internal/vm/lib/bigint_patch.dart
index 9ab2e2f..affdfeb 100644
--- a/sdk/lib/_internal/vm/lib/bigint_patch.dart
+++ b/sdk/lib/_internal/vm/lib/bigint_patch.dart
@@ -1657,9 +1657,24 @@
*/
int get bitLength {
if (_used == 0) return 0;
- var highBits = _digits[_used - 1];
- if (_isNegative) highBits -= 1;
- return _digitBits * (_used - 1) + highBits.bitLength;
+ final highBits = _digits[_used - 1];
+ assert(highBits != 0);
+ int length = _digitBits * (_used - 1) + highBits.bitLength;
+ if (!_isNegative) return length;
+
+ // `this` is negative, i.e. `-x` for the magnitude `x`. We want to find the
+ // bit length of `~this` or equivalently `-this-1`.
+ //
+ // -this-1 == -(-x)-1 == x-1
+ //
+ // `x-1` will have the same bit length as `x` unless `x` is power of two
+ // (e.g. 0x1000-1 = 0x0FFF). The magnitude is a power of two if the high
+ // digit is a power of two and all the other digits are zero.
+ if (highBits & (highBits - 1) != 0) return length;
+ for (int i = _used - 2; i >= 0; i--) {
+ if (_digits[i] != 0) return length;
+ }
+ return length - 1;
}
/**
diff --git a/tests/corelib/bigint_bitlength_test.dart b/tests/corelib/bigint_bitlength_test.dart
new file mode 100644
index 0000000..ff7c87a
--- /dev/null
+++ b/tests/corelib/bigint_bitlength_test.dart
@@ -0,0 +1,83 @@
+// Copyright (c) 2022, 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.
+
+// Testing Bigints with and without intrinsics.
+// VMOptions=--intrinsify --no-enable-asserts
+// VMOptions=--intrinsify --enable-asserts
+// VMOptions=--no-intrinsify --enable-asserts
+// VMOptions=--no-intrinsify --no-enable-asserts
+
+import "package:expect/expect.dart";
+
+const debugPrint = bool.fromEnvironment('debugPrint');
+
+void check(int length, BigInt base) {
+ assert(length >= 5);
+ assert(base > BigInt.zero);
+
+ // Check with slight adjustments. We choose -3..+3 so that the lowest bit in
+ // the 2's-complement representation is both zero and one for both the postive
+ // [n] and its negative complement [m] below.
+ for (int delta = -3; delta <= 3; delta++) {
+ BigInt n = base + BigInt.from(delta);
+ assert(n >= BigInt.zero);
+
+ // Compute the bitLength by shifting the value into a small integer range
+ // and adjust the `int.bitLength` value by the shift count.
+ int shiftCount = length - 5;
+ int shiftedN = (n >> shiftCount).toInt();
+ int expectedLength = shiftCount + shiftedN.bitLength;
+
+ int nLength = n.bitLength;
+ Expect.equals(expectedLength, nLength);
+
+ // Use identity `x.bitLength == (-x-1).bitLength` to check negative values.
+ BigInt m = -n - BigInt.one;
+ int mLength = m.bitLength;
+
+ if (debugPrint) {
+ final printLength = length + 4;
+ final nDigits =
+ n.toUnsigned(printLength).toRadixString(2).padLeft(printLength);
+ final mDigits = m.toUnsigned(printLength).toRadixString(2);
+ print('$nDigits: $nLength');
+ print('$mDigits: $mLength');
+ }
+
+ Expect.equals(nLength, mLength);
+ }
+}
+
+void main() {
+ // For small values, [BigInt.bitLength] should be the same as [int.bitLength].
+ for (int i = 0; i <= 64; i++) {
+ Expect.equals(i.bitLength, BigInt.from(i).bitLength);
+ // Note: This is not quite redundant for `i==0` since on the web platform
+ // `-i` is negative zero and not the same as `0-i`.
+ Expect.equals((-i).bitLength, BigInt.from(-i).bitLength);
+ }
+
+ // Test x.bitLength for a large variety of lengths.
+ for (int length = 5; length <= 512; length++) {
+ BigInt base = BigInt.one << (length - 1);
+ Expect.equals(length, base.bitLength);
+
+ // Power of two.
+ check(length, base);
+
+ // Two high bits set.
+ check(length, base | base >> 1);
+
+ // Check for values with an additional bit set near a potential internal
+ // digit boundary.
+ for (int i1 = 16; i1 < length; i1 += 16) {
+ for (int i2 = -1; i2 <= 1; i2++) {
+ int i = i1 + i2;
+ if (i < length - 1) {
+ check(length, base | BigInt.one << (i - 1));
+ }
+ }
+ }
+ }
+}
diff --git a/tests/corelib_2/bigint_bitlength_test.dart b/tests/corelib_2/bigint_bitlength_test.dart
new file mode 100644
index 0000000..ff7c87a
--- /dev/null
+++ b/tests/corelib_2/bigint_bitlength_test.dart
@@ -0,0 +1,83 @@
+// Copyright (c) 2022, 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.
+
+// Testing Bigints with and without intrinsics.
+// VMOptions=--intrinsify --no-enable-asserts
+// VMOptions=--intrinsify --enable-asserts
+// VMOptions=--no-intrinsify --enable-asserts
+// VMOptions=--no-intrinsify --no-enable-asserts
+
+import "package:expect/expect.dart";
+
+const debugPrint = bool.fromEnvironment('debugPrint');
+
+void check(int length, BigInt base) {
+ assert(length >= 5);
+ assert(base > BigInt.zero);
+
+ // Check with slight adjustments. We choose -3..+3 so that the lowest bit in
+ // the 2's-complement representation is both zero and one for both the postive
+ // [n] and its negative complement [m] below.
+ for (int delta = -3; delta <= 3; delta++) {
+ BigInt n = base + BigInt.from(delta);
+ assert(n >= BigInt.zero);
+
+ // Compute the bitLength by shifting the value into a small integer range
+ // and adjust the `int.bitLength` value by the shift count.
+ int shiftCount = length - 5;
+ int shiftedN = (n >> shiftCount).toInt();
+ int expectedLength = shiftCount + shiftedN.bitLength;
+
+ int nLength = n.bitLength;
+ Expect.equals(expectedLength, nLength);
+
+ // Use identity `x.bitLength == (-x-1).bitLength` to check negative values.
+ BigInt m = -n - BigInt.one;
+ int mLength = m.bitLength;
+
+ if (debugPrint) {
+ final printLength = length + 4;
+ final nDigits =
+ n.toUnsigned(printLength).toRadixString(2).padLeft(printLength);
+ final mDigits = m.toUnsigned(printLength).toRadixString(2);
+ print('$nDigits: $nLength');
+ print('$mDigits: $mLength');
+ }
+
+ Expect.equals(nLength, mLength);
+ }
+}
+
+void main() {
+ // For small values, [BigInt.bitLength] should be the same as [int.bitLength].
+ for (int i = 0; i <= 64; i++) {
+ Expect.equals(i.bitLength, BigInt.from(i).bitLength);
+ // Note: This is not quite redundant for `i==0` since on the web platform
+ // `-i` is negative zero and not the same as `0-i`.
+ Expect.equals((-i).bitLength, BigInt.from(-i).bitLength);
+ }
+
+ // Test x.bitLength for a large variety of lengths.
+ for (int length = 5; length <= 512; length++) {
+ BigInt base = BigInt.one << (length - 1);
+ Expect.equals(length, base.bitLength);
+
+ // Power of two.
+ check(length, base);
+
+ // Two high bits set.
+ check(length, base | base >> 1);
+
+ // Check for values with an additional bit set near a potential internal
+ // digit boundary.
+ for (int i1 = 16; i1 < length; i1 += 16) {
+ for (int i2 = -1; i2 <= 1; i2++) {
+ int i = i1 + i2;
+ if (i < length - 1) {
+ check(length, base | BigInt.one << (i - 1));
+ }
+ }
+ }
+ }
+}
diff --git a/tools/VERSION b/tools/VERSION
index 16a594e..b393a78 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 136
+PRERELEASE 137
PRERELEASE_PATCH 0
\ No newline at end of file