Version 2.18.0-150.0.dev
Merge commit 'f7c46f145c259806f162fc9652923b7493a44c6f' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab41e51..46f2467 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,52 @@
## 2.18.0
+### Language
+
+The following features are new in the Dart 2.18 [language version][]. To use
+them, you must set the lower bound on the SDK constraint for your package to
+2.18 or greater (`sdk: '>=2.18.0 <3.0.0'`).
+
+[language version]: https://dart.dev/guides/language/evolution
+
+- **[Enhanced type inference for generic invocations with function
+ literals][]**: Invocations of generic methods/constructors that supply
+ function literal arguments now have improved type inference. This primarily
+ affects the `Iterable.fold` method. For example, in previous versions of
+ Dart, the compiler would fail to infer an appropriate type for the parameter
+ `a`:
+
+ ```dart
+ void main() {
+ List<int> ints = [1, 2, 3];
+ var maximum = ints.fold(0, (a, b) => a < b ? b : a);
+ }
+ ```
+
+ With this improvement, `a` receives its type from the initial value, `0`.
+
+ On rare occasions, the wrong type will be inferred, leading to a compile-time
+ error, for example in this code, type inference will infer that `a` has a
+ type of `Null`:
+
+ ```dart
+ void main() {
+ List<int> ints = [1, 2, 3];
+ var maximumOrNull = ints.fold(null,
+ (a, b) => a == null || a < b ? b : a);
+ }
+ ```
+
+ This can be worked around by supplying the appropriate type as an explicit
+ type argument to `fold`:
+
+ ```dart
+ void main() {
+ List<int> ints = [1, 2, 3];
+ var maximumOrNull = ints.fold<int?>(null,
+ (a, b) => a == null || a < b ? b : a);
+ }
+ ```
+
### Core libraries
#### `dart:html`
diff --git a/DEPS b/DEPS
index 4db49ee..41f4b08 100644
--- a/DEPS
+++ b/DEPS
@@ -83,7 +83,7 @@
"boringssl_gen_rev": "ced85ef0a00bbca77ce5a91261a5f2ae61b1e62f",
"boringssl_rev": "87f316d7748268eb56f2dc147bd593254ae93198",
"browser-compat-data_tag": "ac8cae697014da1ff7124fba33b0b4245cc6cd1b", # v1.0.22
- "browser_launcher_rev": "c6cc1025d6901926cf022e144ba109677e3548f1",
+ "browser_launcher_rev": "f841375ad337381e23d333b6eaaebde3d8266c68",
"characters_rev": "4b1d4b7737ad47cd2b8105c47e2159174010f29f",
"charcode_rev": "84ea427711e24abf3b832923959caa7dd9a8514b",
"chrome_rev": "19997",
@@ -114,7 +114,7 @@
"glob_rev": "e10eb2407c58427144004458ef85c9bbf7286e56",
"html_rev": "f108bce59d136c584969fd24a5006914796cf213",
"http_io_rev": "405fc79233b4a3d4bb079ebf438bb2caf2f49355",
- "http_multi_server_rev": "34bf7f04b61cce561f47f7f275c2cc811534a05a",
+ "http_multi_server_rev": "35a3b947256768426090e3b1f5132e4fc23c175d",
"http_parser_rev": "9126ee04e77fd8e4e2e6435b503ee4dd708d7ddc",
"http_rev": "2c9b418f5086f999c150d18172d2eec1f963de7b",
"icu_rev": "81d656878ec611cb0b42d52c82e9dae93920d9ba",
@@ -123,16 +123,15 @@
"json_rpc_2_rev": "7e00f893440a72de0637970325e4ea44bd1e8c8e",
"linter_rev": "a8529c6692922b45bc287543b355c90d7b1286d3", # 1.24.0
"lints_rev": "8294e5648ab49474541527e2911e72e4c5aefe55",
- "logging_rev": "dfbe88b890c3b4f7bc06da5a7b3b43e9e263b688",
+ "logging_rev": "f6979e3bc3b6e1847a08335b7eb6304e18986195",
"markdown_rev": "5699cafa9ef004875fd7de8ae9ea00e5295e87a4", # 5.0.0
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
- "matcher_rev": "07595a7739d47a8315caba5a8e58fb9ae3d81261",
+ "matcher_rev": "12cdc5fbafd666ed908359ae215d5d0306087969",
"mime_rev": "c2c5ffd594674f32dc277521369da1557a1622d3",
"mockito_rev": "1e977a727e82a2e1bdb49b79ef1dce0f23aa1faa",
- "oauth2_rev": "7cd3284049fe5badbec9f2bea2afc41d14c01057",
- "package_config_rev": "8731bf10b5375542792a32a0f7c8a6f370583d96",
+ "oauth2_rev": "199ebf15cbd5b07958438184f32e41c4447a57bf",
+ "package_config_rev": "cff98c90acc457a3b0750f0a7da0e351a35e5d0c",
"path_rev": "3d41ea582f5b0b18de3d90008809b877ff3f69bc",
- "platform_rev": "1ffad63428bbd1b3ecaa15926bacfb724023648c",
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
"pool_rev": "c40cc32eabecb9d60f1045d1403108d968805f9a",
"protobuf_rev": "b149f801cf7a5e959cf1dbf72d61068ac275f24b",
@@ -140,7 +139,7 @@
"pub_semver_rev": "ea6c54019948dc03042c595ce9413e17aaf7aa38",
"root_certificates_rev": "692f6d6488af68e0121317a9c2c9eb393eb0ee50",
"rust_revision": "b7856f695d65a8ebc846754f97d15814bcb1c244",
- "shelf_rev": "fadca320b04689be9ec960013843a0d9ee6c4fc4",
+ "shelf_rev": "05f42601d22c9bfe490ceda50e812f83b7d1de77",
"source_map_stack_trace_rev": "8eabd96b1811e30a11d3c54c9b4afae4fb72e98f",
"source_maps_rev": "c07a01b8d5547ce3a47ee7a7a2b938a2bc09afe3",
"source_span_rev": "8ae724c3e67f5afaacead44e93ff145bfb8775c7",
@@ -373,8 +372,6 @@
"@" + Var("package_config_rev"),
Var("dart_root") + "/third_party/pkg/path":
Var("dart_git") + "path.git" + "@" + Var("path_rev"),
- Var("dart_root") + "/third_party/pkg/platform":
- Var("dart_git") + "platform.dart.git" + "@" + Var("platform_rev"),
Var("dart_root") + "/third_party/pkg/pool":
Var("dart_git") + "pool.git" + "@" + Var("pool_rev"),
Var("dart_root") + "/third_party/pkg/protobuf":
diff --git a/pkg/_fe_analyzer_shared/pubspec.yaml b/pkg/_fe_analyzer_shared/pubspec.yaml
index 5f4c879..ad5468c 100644
--- a/pkg/_fe_analyzer_shared/pubspec.yaml
+++ b/pkg/_fe_analyzer_shared/pubspec.yaml
@@ -9,5 +9,9 @@
dependencies:
meta: ^1.0.2
+# We use 'any' version constraints here as we get our package versions from
+# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
+# best practice for packages is to specify their compatible version ranges.
+# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
- test: ^1.3.4
+ test: any
diff --git a/pkg/_js_interop_checks/pubspec.yaml b/pkg/_js_interop_checks/pubspec.yaml
index 776dab8..9be1352 100644
--- a/pkg/_js_interop_checks/pubspec.yaml
+++ b/pkg/_js_interop_checks/pubspec.yaml
@@ -5,6 +5,7 @@
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
_fe_analyzer_shared: any
kernel: any
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index d610cb4..8571ef7 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -109,7 +109,7 @@
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version
- 1.33.0
+ 1.33.1
</h1>
<p>
This document contains a specification of the API provided by the
@@ -236,6 +236,11 @@
ignoring the item or treating it with some default/fallback handling.
</p>
<h3>Changelog</h3>
+<h4>1.33.1</h4>
+<ul>
+ <li><tt>SourceChange</tt> now has an optional <tt>selectionLength</tt> that may be
+ provided when <tt>selection</tt> is.</li>
+</ul>
<h4>1.33.0</h4>
<ul>
<li>Requests <tt>getSuggestions2</tt> and <tt>getSuggestionDetails2</tt>
@@ -5875,6 +5880,12 @@
The position that should be selected after the edits have been
applied.
</p>
+ </dd><dt class="field"><b>selectionLength: int<span style="color:#999999"> (optional)</span></b></dt><dd>
+
+ <p>
+ The length of the selection (starting at Position) that should be selected after
+ the edits have been applied.
+ </p>
</dd><dt class="field"><b>id: String<span style="color:#999999"> (optional)</span></b></dt><dd>
<p>
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 f8096bd..de4aa97 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
@@ -6,10 +6,6 @@
// To regenerate the file, use the script
// "pkg/analysis_server/tool/lsp_spec/generate_all.dart".
-// ignore_for_file: annotate_overrides
-// ignore_for_file: prefer_is_not_operator
-// ignore_for_file: unnecessary_parenthesis
-
import 'dart:core' hide deprecated;
import 'dart:core' as core show deprecated;
import 'dart:convert' show JsonEncoder;
@@ -39,6 +35,7 @@
final bool isAnalyzing;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['isAnalyzing'] = isAnalyzing;
@@ -58,7 +55,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(isAnalyzing is bool)) {
+ if (isAnalyzing is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -112,6 +109,7 @@
final String label;
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['label'] = label;
@@ -132,7 +130,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(label is String)) {
+ if (label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -150,7 +148,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -200,10 +198,8 @@
return CompletionItemResolutionInfo();
}
- Map<String, Object?> toJson() {
- var result = <String, Object?>{};
- return result;
- }
+ @override
+ Map<String, Object?> toJson() => {};
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
@@ -249,6 +245,7 @@
final int port;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['port'] = port;
@@ -268,7 +265,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(port is int)) {
+ if (port is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -349,6 +346,7 @@
final int rLength;
final int rOffset;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['displayUri'] = displayUri;
@@ -374,7 +372,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(displayUri is String)) {
+ if (displayUri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -392,7 +390,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(file is String)) {
+ if (file is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -410,7 +408,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(iLength is int)) {
+ if (iLength is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -428,7 +426,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(libId is int)) {
+ if (libId is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -446,7 +444,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(offset is int)) {
+ if (offset is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -464,7 +462,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(rLength is int)) {
+ if (rLength is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -482,7 +480,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(rOffset is int)) {
+ if (rOffset is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -574,6 +572,7 @@
final String? returnType;
final String? typeParameters;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['kind'] = kind;
@@ -606,7 +605,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind is String)) {
+ if (kind is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -624,7 +623,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(name is String)) {
+ if (name is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -634,7 +633,7 @@
reporter.push('parameters');
try {
final parameters = obj['parameters'];
- if (parameters != null && !(parameters is String)) {
+ if (parameters != null && parameters is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -644,7 +643,7 @@
reporter.push('range');
try {
final range = obj['range'];
- if (range != null && !(Range.canParse(range, reporter))) {
+ if (range != null && !Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -654,7 +653,7 @@
reporter.push('returnType');
try {
final returnType = obj['returnType'];
- if (returnType != null && !(returnType is String)) {
+ if (returnType != null && returnType is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -664,7 +663,7 @@
reporter.push('typeParameters');
try {
final typeParameters = obj['typeParameters'];
- if (typeParameters != null && !(typeParameters is String)) {
+ if (typeParameters != null && typeParameters is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -772,6 +771,7 @@
final Range range;
final String? variableName;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (attributes != null) {
@@ -804,9 +804,9 @@
try {
final attributes = obj['attributes'];
if (attributes != null &&
- !((attributes is List<Object?> &&
- (attributes.every((item) =>
- FlutterOutlineAttribute.canParse(item, reporter)))))) {
+ (attributes is! List<Object?> ||
+ attributes.any((item) =>
+ !FlutterOutlineAttribute.canParse(item, reporter)))) {
reporter.reportError('must be of type List<FlutterOutlineAttribute>');
return false;
}
@@ -817,9 +817,9 @@
try {
final children = obj['children'];
if (children != null &&
- !((children is List<Object?> &&
- (children.every(
- (item) => FlutterOutline.canParse(item, reporter)))))) {
+ (children is! List<Object?> ||
+ children
+ .any((item) => !FlutterOutline.canParse(item, reporter)))) {
reporter.reportError('must be of type List<FlutterOutline>');
return false;
}
@@ -829,7 +829,7 @@
reporter.push('className');
try {
final className = obj['className'];
- if (className != null && !(className is String)) {
+ if (className != null && className is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -847,7 +847,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(codeRange, reporter))) {
+ if (!Range.canParse(codeRange, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -857,7 +857,7 @@
reporter.push('dartElement');
try {
final dartElement = obj['dartElement'];
- if (dartElement != null && !(Element.canParse(dartElement, reporter))) {
+ if (dartElement != null && !Element.canParse(dartElement, reporter)) {
reporter.reportError('must be of type Element');
return false;
}
@@ -875,7 +875,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind is String)) {
+ if (kind is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -885,7 +885,7 @@
reporter.push('label');
try {
final label = obj['label'];
- if (label != null && !(label is String)) {
+ if (label != null && label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -903,7 +903,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -913,7 +913,7 @@
reporter.push('variableName');
try {
final variableName = obj['variableName'];
- if (variableName != null && !(variableName is String)) {
+ if (variableName != null && variableName is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -997,6 +997,7 @@
final String name;
final Range? valueRange;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['label'] = label;
@@ -1020,7 +1021,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(label is String)) {
+ if (label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1038,7 +1039,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(name is String)) {
+ if (name is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1048,7 +1049,7 @@
reporter.push('valueRange');
try {
final valueRange = obj['valueRange'];
- if (valueRange != null && !(Range.canParse(valueRange, reporter))) {
+ if (valueRange != null && !Range.canParse(valueRange, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -1120,11 +1121,14 @@
);
}
+ @override
final int? clientRequestTime;
+ @override
final String jsonrpc;
final Method method;
final Object? params;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (clientRequestTime != null) {
@@ -1143,7 +1147,7 @@
reporter.push('clientRequestTime');
try {
final clientRequestTime = obj['clientRequestTime'];
- if (clientRequestTime != null && !(clientRequestTime is int)) {
+ if (clientRequestTime != null && clientRequestTime is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -1161,7 +1165,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(jsonrpc is String)) {
+ if (jsonrpc is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1179,7 +1183,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Method.canParse(method, reporter))) {
+ if (!Method.canParse(method, reporter)) {
reporter.reportError('must be of type Method');
return false;
}
@@ -1247,6 +1251,7 @@
final int? clientRequestTime;
final String jsonrpc;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (clientRequestTime != null) {
@@ -1261,7 +1266,7 @@
reporter.push('clientRequestTime');
try {
final clientRequestTime = obj['clientRequestTime'];
- if (clientRequestTime != null && !(clientRequestTime is int)) {
+ if (clientRequestTime != null && clientRequestTime is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -1279,7 +1284,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(jsonrpc is String)) {
+ if (jsonrpc is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1342,11 +1347,16 @@
);
}
+ @override
final int? clientRequestTime;
+ @override
final String jsonrpc;
+ @override
final Method method;
+ @override
final Object? params;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (clientRequestTime != null) {
@@ -1365,7 +1375,7 @@
reporter.push('clientRequestTime');
try {
final clientRequestTime = obj['clientRequestTime'];
- if (clientRequestTime != null && !(clientRequestTime is int)) {
+ if (clientRequestTime != null && clientRequestTime is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -1383,7 +1393,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(jsonrpc is String)) {
+ if (jsonrpc is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1401,7 +1411,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Method.canParse(method, reporter))) {
+ if (!Method.canParse(method, reporter)) {
reporter.reportError('must be of type Method');
return false;
}
@@ -1476,6 +1486,7 @@
final Element element;
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (children != null) {
@@ -1493,9 +1504,8 @@
try {
final children = obj['children'];
if (children != null &&
- !((children is List<Object?> &&
- (children
- .every((item) => Outline.canParse(item, reporter)))))) {
+ (children is! List<Object?> ||
+ children.any((item) => !Outline.canParse(item, reporter)))) {
reporter.reportError('must be of type List<Outline>');
return false;
}
@@ -1513,7 +1523,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(codeRange, reporter))) {
+ if (!Range.canParse(codeRange, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -1531,7 +1541,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Element.canParse(element, reporter))) {
+ if (!Element.canParse(element, reporter)) {
reporter.reportError('must be of type Element');
return false;
}
@@ -1549,7 +1559,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -1609,6 +1619,7 @@
final String packageName;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['packageName'] = packageName;
@@ -1628,7 +1639,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(packageName is String)) {
+ if (packageName is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1685,6 +1696,7 @@
final List<ClosingLabel> labels;
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['labels'] = labels.map((item) => item.toJson()).toList();
@@ -1705,8 +1717,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((labels is List<Object?> &&
- (labels.every((item) => ClosingLabel.canParse(item, reporter)))))) {
+ if (labels is! List<Object?> ||
+ labels.any((item) => !ClosingLabel.canParse(item, reporter))) {
reporter.reportError('must be of type List<ClosingLabel>');
return false;
}
@@ -1724,7 +1736,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1785,6 +1797,7 @@
final FlutterOutline outline;
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['outline'] = outline.toJson();
@@ -1805,7 +1818,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(FlutterOutline.canParse(outline, reporter))) {
+ if (!FlutterOutline.canParse(outline, reporter)) {
reporter.reportError('must be of type FlutterOutline');
return false;
}
@@ -1823,7 +1836,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1880,6 +1893,7 @@
final Outline outline;
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['outline'] = outline.toJson();
@@ -1900,7 +1914,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Outline.canParse(outline, reporter))) {
+ if (!Outline.canParse(outline, reporter)) {
reporter.reportError('must be of type Outline');
return false;
}
@@ -1918,7 +1932,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1988,12 +2002,17 @@
);
}
+ @override
final int? clientRequestTime;
final Either2<int, String> id;
+ @override
final String jsonrpc;
+ @override
final Method method;
+ @override
final Object? params;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (clientRequestTime != null) {
@@ -2013,7 +2032,7 @@
reporter.push('clientRequestTime');
try {
final clientRequestTime = obj['clientRequestTime'];
- if (clientRequestTime != null && !(clientRequestTime is int)) {
+ if (clientRequestTime != null && clientRequestTime is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -2031,7 +2050,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((id is int || id is String))) {
+ if (id is! int && id is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -2049,7 +2068,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(jsonrpc is String)) {
+ if (jsonrpc is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -2067,7 +2086,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Method.canParse(method, reporter))) {
+ if (!Method.canParse(method, reporter)) {
reporter.reportError('must be of type Method');
return false;
}
@@ -2139,6 +2158,7 @@
final String? data;
final String message;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['code'] = code.toJson();
@@ -2162,7 +2182,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(ErrorCodes.canParse(code, reporter))) {
+ if (!ErrorCodes.canParse(code, reporter)) {
reporter.reportError('must be of type ErrorCodes');
return false;
}
@@ -2172,7 +2192,7 @@
reporter.push('data');
try {
final data = obj['data'];
- if (data != null && !(data is String)) {
+ if (data != null && data is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -2190,7 +2210,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(message is String)) {
+ if (message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -2267,12 +2287,15 @@
);
}
+ @override
final int? clientRequestTime;
final ResponseError? error;
final Either2<int, String>? id;
+ @override
final String jsonrpc;
final Object? result;
+ @override
Map<String, Object?> toJson() {
var map = <String, Object?>{};
if (clientRequestTime != null) {
@@ -2295,7 +2318,7 @@
reporter.push('clientRequestTime');
try {
final clientRequestTime = obj['clientRequestTime'];
- if (clientRequestTime != null && !(clientRequestTime is int)) {
+ if (clientRequestTime != null && clientRequestTime is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -2305,7 +2328,7 @@
reporter.push('error');
try {
final error = obj['error'];
- if (error != null && !(ResponseError.canParse(error, reporter))) {
+ if (error != null && !ResponseError.canParse(error, reporter)) {
reporter.reportError('must be of type ResponseError');
return false;
}
@@ -2319,7 +2342,7 @@
return false;
}
final id = obj['id'];
- if (id != null && !((id is int || id is String))) {
+ if (id != null && id is! int && id is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -2337,7 +2360,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(jsonrpc is String)) {
+ if (jsonrpc is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -2406,12 +2429,15 @@
final InsertTextFormat insertTextFormat;
/// The string to be inserted. For delete operations use an empty string.
+ @override
final String newText;
/// The range of the text document to be manipulated. To insert text into a
/// document create a range where start === end.
+ @override
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['insertTextFormat'] = insertTextFormat.toJson();
@@ -2433,7 +2459,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(InsertTextFormat.canParse(insertTextFormat, reporter))) {
+ if (!InsertTextFormat.canParse(insertTextFormat, reporter)) {
reporter.reportError('must be of type InsertTextFormat');
return false;
}
@@ -2451,7 +2477,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(newText is String)) {
+ if (newText is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -2469,7 +2495,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -2529,6 +2555,7 @@
final String? message;
final bool valid;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (message != null) {
@@ -2543,7 +2570,7 @@
reporter.push('message');
try {
final message = obj['message'];
- if (message != null && !(message is String)) {
+ if (message != null && message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -2561,7 +2588,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(valid is bool)) {
+ if (valid is! bool) {
reporter.reportError('must be of type bool');
return false;
}
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
index 736dda0..9c7edcb 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
@@ -6,10 +6,6 @@
// To regenerate the file, use the script
// "pkg/analysis_server/tool/lsp_spec/generate_all.dart".
-// ignore_for_file: annotate_overrides
-// ignore_for_file: prefer_is_not_operator
-// ignore_for_file: unnecessary_parenthesis
-
import 'dart:core' hide deprecated;
import 'dart:core' as core show deprecated;
import 'dart:convert' show JsonEncoder;
@@ -51,12 +47,15 @@
final String annotationId;
/// The string to be inserted. For delete operations use an empty string.
+ @override
final String newText;
/// The range of the text document to be manipulated. To insert text into a
/// document create a range where start === end.
+ @override
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['annotationId'] = annotationId;
@@ -78,7 +77,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(annotationId is String)) {
+ if (annotationId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -96,7 +95,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(newText is String)) {
+ if (newText is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -114,7 +113,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -178,6 +177,7 @@
/// user interface for example on an undo stack to undo the workspace edit.
final String? label;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['edit'] = edit.toJson();
@@ -200,7 +200,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(WorkspaceEdit.canParse(edit, reporter))) {
+ if (!WorkspaceEdit.canParse(edit, reporter)) {
reporter.reportError('must be of type WorkspaceEdit');
return false;
}
@@ -210,7 +210,7 @@
reporter.push('label');
try {
final label = obj['label'];
- if (label != null && !(label is String)) {
+ if (label != null && label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -282,6 +282,7 @@
/// error for a request that triggered the edit.
final String? failureReason;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['applied'] = applied;
@@ -307,7 +308,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(applied is bool)) {
+ if (applied is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -317,7 +318,7 @@
reporter.push('failedChange');
try {
final failedChange = obj['failedChange'];
- if (failedChange != null && !(failedChange is int)) {
+ if (failedChange != null && failedChange is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -327,7 +328,7 @@
reporter.push('failureReason');
try {
final failureReason = obj['failureReason'];
- if (failureReason != null && !(failureReason is String)) {
+ if (failureReason != null && failureReason is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -387,6 +388,7 @@
/// capability as well.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -400,7 +402,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -460,6 +462,7 @@
/// denoted by [`this.from`](#CallHierarchyIncomingCall.from).
final List<Range> fromRanges;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['from'] = from.toJson();
@@ -480,7 +483,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(CallHierarchyItem.canParse(from, reporter))) {
+ if (!CallHierarchyItem.canParse(from, reporter)) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
@@ -498,8 +501,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((fromRanges is List<Object?> &&
- (fromRanges.every((item) => Range.canParse(item, reporter)))))) {
+ if (fromRanges is! List<Object?> ||
+ fromRanges.any((item) => !Range.canParse(item, reporter))) {
reporter.reportError('must be of type List<Range>');
return false;
}
@@ -577,11 +580,14 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['item'] = item.toJson();
@@ -607,7 +613,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(CallHierarchyItem.canParse(item, reporter))) {
+ if (!CallHierarchyItem.canParse(item, reporter)) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
@@ -618,7 +624,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -629,7 +636,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -742,6 +750,7 @@
/// The resource identifier of this item.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (data != null) {
@@ -766,7 +775,7 @@
reporter.push('detail');
try {
final detail = obj['detail'];
- if (detail != null && !(detail is String)) {
+ if (detail != null && detail is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -784,7 +793,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(SymbolKind.canParse(kind, reporter))) {
+ if (!SymbolKind.canParse(kind, reporter)) {
reporter.reportError('must be of type SymbolKind');
return false;
}
@@ -802,7 +811,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(name is String)) {
+ if (name is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -820,7 +829,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -838,7 +847,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(selectionRange, reporter))) {
+ if (!Range.canParse(selectionRange, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -849,8 +858,8 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List<Object?> &&
- (tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
+ (tags is! List<Object?> ||
+ tags.any((item) => !SymbolTag.canParse(item, reporter)))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
@@ -868,7 +877,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -934,8 +943,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -949,7 +960,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1009,6 +1020,7 @@
/// The item that is called.
final CallHierarchyItem to;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['fromRanges'] = fromRanges.map((item) => item.toJson()).toList();
@@ -1029,8 +1041,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((fromRanges is List<Object?> &&
- (fromRanges.every((item) => Range.canParse(item, reporter)))))) {
+ if (fromRanges is! List<Object?> ||
+ fromRanges.any((item) => !Range.canParse(item, reporter))) {
reporter.reportError('must be of type List<Range>');
return false;
}
@@ -1048,7 +1060,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(CallHierarchyItem.canParse(to, reporter))) {
+ if (!CallHierarchyItem.canParse(to, reporter)) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
@@ -1126,11 +1138,14 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['item'] = item.toJson();
@@ -1156,7 +1171,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(CallHierarchyItem.canParse(item, reporter))) {
+ if (!CallHierarchyItem.canParse(item, reporter)) {
reporter.reportError('must be of type CallHierarchyItem');
return false;
}
@@ -1167,7 +1182,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -1178,7 +1194,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -1249,14 +1266,18 @@
}
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['position'] = position.toJson();
@@ -1280,7 +1301,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -1298,7 +1319,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -1309,7 +1330,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -1365,8 +1387,8 @@
static CallHierarchyRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -1381,13 +1403,17 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -1410,10 +1436,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -1422,7 +1449,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1432,7 +1459,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1450,8 +1477,12 @@
bool operator ==(Object other) {
if (other is CallHierarchyRegistrationOptions &&
other.runtimeType == CallHierarchyRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -1494,6 +1525,7 @@
/// The request id to cancel.
final Either2<int, String> id;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['id'] = id;
@@ -1513,7 +1545,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((id is int || id is String))) {
+ if (id is! int && id is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -1581,6 +1613,7 @@
/// the change.
final bool? needsConfirmation;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (description != null) {
@@ -1598,7 +1631,7 @@
reporter.push('description');
try {
final description = obj['description'];
- if (description != null && !(description is String)) {
+ if (description != null && description is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1616,7 +1649,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(label is String)) {
+ if (label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -1626,7 +1659,7 @@
reporter.push('needsConfirmation');
try {
final needsConfirmation = obj['needsConfirmation'];
- if (needsConfirmation != null && !(needsConfirmation is bool)) {
+ if (needsConfirmation != null && needsConfirmation is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -1733,6 +1766,7 @@
/// Workspace specific client capabilities.
final WorkspaceClientCapabilities? workspace;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (experimental != null) {
@@ -1762,7 +1796,7 @@
try {
final general = obj['general'];
if (general != null &&
- !(GeneralClientCapabilities.canParse(general, reporter))) {
+ !GeneralClientCapabilities.canParse(general, reporter)) {
reporter.reportError('must be of type GeneralClientCapabilities');
return false;
}
@@ -1773,8 +1807,8 @@
try {
final notebookDocument = obj['notebookDocument'];
if (notebookDocument != null &&
- !(NotebookDocumentClientCapabilities.canParse(
- notebookDocument, reporter))) {
+ !NotebookDocumentClientCapabilities.canParse(
+ notebookDocument, reporter)) {
reporter.reportError(
'must be of type NotebookDocumentClientCapabilities');
return false;
@@ -1786,8 +1820,7 @@
try {
final textDocument = obj['textDocument'];
if (textDocument != null &&
- !(TextDocumentClientCapabilities.canParse(
- textDocument, reporter))) {
+ !TextDocumentClientCapabilities.canParse(textDocument, reporter)) {
reporter
.reportError('must be of type TextDocumentClientCapabilities');
return false;
@@ -1799,7 +1832,7 @@
try {
final window = obj['window'];
if (window != null &&
- !(WindowClientCapabilities.canParse(window, reporter))) {
+ !WindowClientCapabilities.canParse(window, reporter)) {
reporter.reportError('must be of type WindowClientCapabilities');
return false;
}
@@ -1810,7 +1843,7 @@
try {
final workspace = obj['workspace'];
if (workspace != null &&
- !(WorkspaceClientCapabilities.canParse(workspace, reporter))) {
+ !WorkspaceClientCapabilities.canParse(workspace, reporter)) {
reporter.reportError('must be of type WorkspaceClientCapabilities');
return false;
}
@@ -1962,6 +1995,7 @@
/// A short, human-readable, title for this code action.
final String title;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (command != null) {
@@ -1995,7 +2029,7 @@
reporter.push('command');
try {
final command = obj['command'];
- if (command != null && !(Command.canParse(command, reporter))) {
+ if (command != null && !Command.canParse(command, reporter)) {
reporter.reportError('must be of type Command');
return false;
}
@@ -2006,9 +2040,9 @@
try {
final diagnostics = obj['diagnostics'];
if (diagnostics != null &&
- !((diagnostics is List<Object?> &&
- (diagnostics
- .every((item) => Diagnostic.canParse(item, reporter)))))) {
+ (diagnostics is! List<Object?> ||
+ diagnostics
+ .any((item) => !Diagnostic.canParse(item, reporter)))) {
reporter.reportError('must be of type List<Diagnostic>');
return false;
}
@@ -2019,7 +2053,7 @@
try {
final disabled = obj['disabled'];
if (disabled != null &&
- !(CodeActionDisabled.canParse(disabled, reporter))) {
+ !CodeActionDisabled.canParse(disabled, reporter)) {
reporter.reportError('must be of type CodeActionDisabled');
return false;
}
@@ -2029,7 +2063,7 @@
reporter.push('edit');
try {
final edit = obj['edit'];
- if (edit != null && !(WorkspaceEdit.canParse(edit, reporter))) {
+ if (edit != null && !WorkspaceEdit.canParse(edit, reporter)) {
reporter.reportError('must be of type WorkspaceEdit');
return false;
}
@@ -2039,7 +2073,7 @@
reporter.push('isPreferred');
try {
final isPreferred = obj['isPreferred'];
- if (isPreferred != null && !(isPreferred is bool)) {
+ if (isPreferred != null && isPreferred is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2049,7 +2083,7 @@
reporter.push('kind');
try {
final kind = obj['kind'];
- if (kind != null && !(CodeActionKind.canParse(kind, reporter))) {
+ if (kind != null && !CodeActionKind.canParse(kind, reporter)) {
reporter.reportError('must be of type CodeActionKind');
return false;
}
@@ -2067,7 +2101,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(title is String)) {
+ if (title is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -2195,6 +2229,7 @@
/// @since 3.16.0
final CodeActionClientCapabilitiesResolveSupport? resolveSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (codeActionLiteralSupport != null) {
@@ -2227,8 +2262,8 @@
try {
final codeActionLiteralSupport = obj['codeActionLiteralSupport'];
if (codeActionLiteralSupport != null &&
- !(CodeActionClientCapabilitiesCodeActionLiteralSupport.canParse(
- codeActionLiteralSupport, reporter))) {
+ !CodeActionClientCapabilitiesCodeActionLiteralSupport.canParse(
+ codeActionLiteralSupport, reporter)) {
reporter.reportError(
'must be of type CodeActionClientCapabilitiesCodeActionLiteralSupport');
return false;
@@ -2239,7 +2274,7 @@
reporter.push('dataSupport');
try {
final dataSupport = obj['dataSupport'];
- if (dataSupport != null && !(dataSupport is bool)) {
+ if (dataSupport != null && dataSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2249,7 +2284,7 @@
reporter.push('disabledSupport');
try {
final disabledSupport = obj['disabledSupport'];
- if (disabledSupport != null && !(disabledSupport is bool)) {
+ if (disabledSupport != null && disabledSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2259,7 +2294,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2270,7 +2305,7 @@
try {
final honorsChangeAnnotations = obj['honorsChangeAnnotations'];
if (honorsChangeAnnotations != null &&
- !(honorsChangeAnnotations is bool)) {
+ honorsChangeAnnotations is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2280,7 +2315,7 @@
reporter.push('isPreferredSupport');
try {
final isPreferredSupport = obj['isPreferredSupport'];
- if (isPreferredSupport != null && !(isPreferredSupport is bool)) {
+ if (isPreferredSupport != null && isPreferredSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2291,8 +2326,8 @@
try {
final resolveSupport = obj['resolveSupport'];
if (resolveSupport != null &&
- !(CodeActionClientCapabilitiesResolveSupport.canParse(
- resolveSupport, reporter))) {
+ !CodeActionClientCapabilitiesResolveSupport.canParse(
+ resolveSupport, reporter)) {
reporter.reportError(
'must be of type CodeActionClientCapabilitiesResolveSupport');
return false;
@@ -2361,6 +2396,7 @@
/// The code action kind is supported with the following value set.
final CodeActionLiteralSupportCodeActionKind codeActionKind;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['codeActionKind'] = codeActionKind.toJson();
@@ -2380,8 +2416,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!(CodeActionLiteralSupportCodeActionKind.canParse(
- codeActionKind, reporter))) {
+ if (!CodeActionLiteralSupportCodeActionKind.canParse(
+ codeActionKind, reporter)) {
reporter.reportError(
'must be of type CodeActionLiteralSupportCodeActionKind');
return false;
@@ -2437,6 +2473,7 @@
/// The properties that a client can resolve lazily.
final List<String> properties;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['properties'] = properties;
@@ -2456,8 +2493,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((properties is List<Object?> &&
- (properties.every((item) => item is String))))) {
+ if (properties is! List<Object?> ||
+ properties.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -2541,6 +2578,7 @@
/// @since 3.17.0
final CodeActionTriggerKind? triggerKind;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['diagnostics'] = diagnostics.map((item) => item.toJson()).toList();
@@ -2566,9 +2604,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((diagnostics is List<Object?> &&
- (diagnostics
- .every((item) => Diagnostic.canParse(item, reporter)))))) {
+ if (diagnostics is! List<Object?> ||
+ diagnostics.any((item) => !Diagnostic.canParse(item, reporter))) {
reporter.reportError('must be of type List<Diagnostic>');
return false;
}
@@ -2579,9 +2616,8 @@
try {
final only = obj['only'];
if (only != null &&
- !((only is List<Object?> &&
- (only.every(
- (item) => CodeActionKind.canParse(item, reporter)))))) {
+ (only is! List<Object?> ||
+ only.any((item) => !CodeActionKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<CodeActionKind>');
return false;
}
@@ -2592,7 +2628,7 @@
try {
final triggerKind = obj['triggerKind'];
if (triggerKind != null &&
- !(CodeActionTriggerKind.canParse(triggerKind, reporter))) {
+ !CodeActionTriggerKind.canParse(triggerKind, reporter)) {
reporter.reportError('must be of type CodeActionTriggerKind');
return false;
}
@@ -2652,6 +2688,7 @@
/// This is displayed in the code actions UI.
final String reason;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['reason'] = reason;
@@ -2671,7 +2708,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(reason is String)) {
+ if (reason is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -2769,6 +2806,7 @@
/// Base kind for an organize imports source action: `source.organizeImports`.
static const SourceOrganizeImports = CodeActionKind('source.organizeImports');
+ @override
Object toJson() => _value;
@override
@@ -2777,6 +2815,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is CodeActionKind && other._value == _value;
}
@@ -2806,6 +2845,7 @@
/// gracefully and falls back to a default value when unknown.
final List<CodeActionKind> valueSet;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
@@ -2825,9 +2865,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List<Object?> &&
- (valueSet
- .every((item) => CodeActionKind.canParse(item, reporter)))))) {
+ if (valueSet is! List<Object?> ||
+ valueSet.any((item) => !CodeActionKind.canParse(item, reporter))) {
reporter.reportError('must be of type List<CodeActionKind>');
return false;
}
@@ -2900,8 +2939,10 @@
/// action.
/// @since 3.16.0
final bool? resolveProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (codeActionKinds != null) {
@@ -2923,9 +2964,9 @@
try {
final codeActionKinds = obj['codeActionKinds'];
if (codeActionKinds != null &&
- !((codeActionKinds is List<Object?> &&
- (codeActionKinds.every(
- (item) => CodeActionKind.canParse(item, reporter)))))) {
+ (codeActionKinds is! List<Object?> ||
+ codeActionKinds
+ .any((item) => !CodeActionKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<CodeActionKind>');
return false;
}
@@ -2935,7 +2976,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -2945,7 +2986,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3036,6 +3077,7 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The range for which the command was invoked.
@@ -3045,8 +3087,10 @@
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['context'] = context.toJson();
@@ -3074,7 +3118,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(CodeActionContext.canParse(context, reporter))) {
+ if (!CodeActionContext.canParse(context, reporter)) {
reporter.reportError('must be of type CodeActionContext');
return false;
}
@@ -3085,7 +3129,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -3103,7 +3148,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -3121,7 +3166,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -3132,7 +3177,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -3192,8 +3238,8 @@
.toList();
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final resolveProviderJson = json['resolveProvider'];
final resolveProvider = resolveProviderJson as bool?;
@@ -3211,18 +3257,23 @@
///
/// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or
/// the server may list out every specific kind they provide.
+ @override
final List<CodeActionKind>? codeActionKinds;
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The server provides support to resolve additional information for a code
/// action.
/// @since 3.16.0
+ @override
final bool? resolveProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (codeActionKinds != null) {
@@ -3245,9 +3296,9 @@
try {
final codeActionKinds = obj['codeActionKinds'];
if (codeActionKinds != null &&
- !((codeActionKinds is List<Object?> &&
- (codeActionKinds.every(
- (item) => CodeActionKind.canParse(item, reporter)))))) {
+ (codeActionKinds is! List<Object?> ||
+ codeActionKinds
+ .any((item) => !CodeActionKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<CodeActionKind>');
return false;
}
@@ -3262,10 +3313,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -3274,7 +3326,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3284,7 +3336,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3304,8 +3356,12 @@
other.runtimeType == CodeActionRegistrationOptions) {
return listEqual(codeActionKinds, other.codeActionKinds,
(CodeActionKind a, CodeActionKind b) => a == b) &&
- listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
resolveProvider == other.resolveProvider &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -3346,6 +3402,7 @@
/// Code actions were explicitly requested by the user or by an extension.
static const Invoked = CodeActionTriggerKind(1);
+ @override
Object toJson() => _value;
@override
@@ -3354,6 +3411,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is CodeActionTriggerKind && other._value == _value;
}
@@ -3380,6 +3438,7 @@
/// An URI to open with more information about the diagnostic error.
final String href;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['href'] = href;
@@ -3399,7 +3458,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(href is String)) {
+ if (href is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -3472,6 +3531,7 @@
/// line.
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (command != null) {
@@ -3489,7 +3549,7 @@
reporter.push('command');
try {
final command = obj['command'];
- if (command != null && !(Command.canParse(command, reporter))) {
+ if (command != null && !Command.canParse(command, reporter)) {
reporter.reportError('must be of type Command');
return false;
}
@@ -3507,7 +3567,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -3563,6 +3623,7 @@
/// Whether code lens supports dynamic registration.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -3576,7 +3637,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3632,8 +3693,10 @@
/// Code lens has a resolve provider as well.
final bool? resolveProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (resolveProvider != null) {
@@ -3650,7 +3713,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3660,7 +3723,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3735,14 +3798,17 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The document to request code lens for.
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -3761,7 +3827,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -3779,7 +3846,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -3790,7 +3857,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -3841,8 +3909,8 @@
static CodeLensRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final resolveProviderJson = json['resolveProvider'];
final resolveProvider = resolveProviderJson as bool?;
@@ -3857,12 +3925,16 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// Code lens has a resolve provider as well.
+ @override
final bool? resolveProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -3885,10 +3957,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -3897,7 +3970,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3907,7 +3980,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -3925,8 +3998,12 @@
bool operator ==(Object other) {
if (other is CodeLensRegistrationOptions &&
other.runtimeType == CodeLensRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
resolveProvider == other.resolveProvider &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -3972,6 +4049,7 @@
/// change that requires such a calculation.
final bool? refreshSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (refreshSupport != null) {
@@ -3985,7 +4063,7 @@
reporter.push('refreshSupport');
try {
final refreshSupport = obj['refreshSupport'];
- if (refreshSupport != null && !(refreshSupport is bool)) {
+ if (refreshSupport != null && refreshSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -4058,6 +4136,7 @@
/// The red component of this color in the range [0-1].
final num red;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['alpha'] = alpha;
@@ -4080,7 +4159,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(alpha is num)) {
+ if (alpha is! num) {
reporter.reportError('must be of type num');
return false;
}
@@ -4098,7 +4177,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(blue is num)) {
+ if (blue is! num) {
reporter.reportError('must be of type num');
return false;
}
@@ -4116,7 +4195,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(green is num)) {
+ if (green is! num) {
reporter.reportError('must be of type num');
return false;
}
@@ -4134,7 +4213,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(red is num)) {
+ if (red is! num) {
reporter.reportError('must be of type num');
return false;
}
@@ -4199,6 +4278,7 @@
/// The range in the document where this color appears.
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['color'] = color.toJson();
@@ -4219,7 +4299,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Color.canParse(color, reporter))) {
+ if (!Color.canParse(color, reporter)) {
reporter.reportError('must be of type Color');
return false;
}
@@ -4237,7 +4317,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -4313,6 +4393,7 @@
/// [label](#ColorPresentation.label) is used.
final TextEdit? textEdit;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (additionalTextEdits != null) {
@@ -4332,9 +4413,9 @@
try {
final additionalTextEdits = obj['additionalTextEdits'];
if (additionalTextEdits != null &&
- !((additionalTextEdits is List<Object?> &&
- (additionalTextEdits
- .every((item) => TextEdit.canParse(item, reporter)))))) {
+ (additionalTextEdits is! List<Object?> ||
+ additionalTextEdits
+ .any((item) => !TextEdit.canParse(item, reporter)))) {
reporter.reportError('must be of type List<TextEdit>');
return false;
}
@@ -4352,7 +4433,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(label is String)) {
+ if (label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -4362,7 +4443,7 @@
reporter.push('textEdit');
try {
final textEdit = obj['textEdit'];
- if (textEdit != null && !(TextEdit.canParse(textEdit, reporter))) {
+ if (textEdit != null && !TextEdit.canParse(textEdit, reporter)) {
reporter.reportError('must be of type TextEdit');
return false;
}
@@ -4451,6 +4532,7 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The range where the color would be inserted. Serves as a context.
@@ -4460,8 +4542,10 @@
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['color'] = color.toJson();
@@ -4489,7 +4573,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Color.canParse(color, reporter))) {
+ if (!Color.canParse(color, reporter)) {
reporter.reportError('must be of type Color');
return false;
}
@@ -4500,7 +4584,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -4518,7 +4603,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -4536,7 +4621,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -4547,7 +4632,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -4623,6 +4709,7 @@
/// Title of the command, like `save`.
final String title;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (arguments != null) {
@@ -4639,8 +4726,7 @@
try {
final arguments = obj['arguments'];
if (arguments != null &&
- !((arguments is List<Object?> &&
- (arguments.every((item) => true))))) {
+ (arguments is! List<Object?> || arguments.any((item) => false))) {
reporter.reportError('must be of type List<Object?>');
return false;
}
@@ -4658,7 +4744,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(command is String)) {
+ if (command is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -4676,7 +4762,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(title is String)) {
+ if (title is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -4781,6 +4867,7 @@
/// @since 3.17.0
final InsertTextMode? insertTextMode;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (completionItem != null) {
@@ -4810,8 +4897,8 @@
try {
final completionItem = obj['completionItem'];
if (completionItem != null &&
- !(CompletionClientCapabilitiesCompletionItem.canParse(
- completionItem, reporter))) {
+ !CompletionClientCapabilitiesCompletionItem.canParse(
+ completionItem, reporter)) {
reporter.reportError(
'must be of type CompletionClientCapabilitiesCompletionItem');
return false;
@@ -4823,8 +4910,8 @@
try {
final completionItemKind = obj['completionItemKind'];
if (completionItemKind != null &&
- !(CompletionClientCapabilitiesCompletionItemKind.canParse(
- completionItemKind, reporter))) {
+ !CompletionClientCapabilitiesCompletionItemKind.canParse(
+ completionItemKind, reporter)) {
reporter.reportError(
'must be of type CompletionClientCapabilitiesCompletionItemKind');
return false;
@@ -4836,8 +4923,8 @@
try {
final completionList = obj['completionList'];
if (completionList != null &&
- !(CompletionClientCapabilitiesCompletionList.canParse(
- completionList, reporter))) {
+ !CompletionClientCapabilitiesCompletionList.canParse(
+ completionList, reporter)) {
reporter.reportError(
'must be of type CompletionClientCapabilitiesCompletionList');
return false;
@@ -4848,7 +4935,7 @@
reporter.push('contextSupport');
try {
final contextSupport = obj['contextSupport'];
- if (contextSupport != null && !(contextSupport is bool)) {
+ if (contextSupport != null && contextSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -4858,7 +4945,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -4869,7 +4956,7 @@
try {
final insertTextMode = obj['insertTextMode'];
if (insertTextMode != null &&
- !(InsertTextMode.canParse(insertTextMode, reporter))) {
+ !InsertTextMode.canParse(insertTextMode, reporter)) {
reporter.reportError('must be of type InsertTextMode');
return false;
}
@@ -5027,6 +5114,7 @@
/// @since 3.15.0
final CompletionItemTagSupport? tagSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (commitCharactersSupport != null) {
@@ -5069,7 +5157,7 @@
try {
final commitCharactersSupport = obj['commitCharactersSupport'];
if (commitCharactersSupport != null &&
- !(commitCharactersSupport is bool)) {
+ commitCharactersSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5079,7 +5167,7 @@
reporter.push('deprecatedSupport');
try {
final deprecatedSupport = obj['deprecatedSupport'];
- if (deprecatedSupport != null && !(deprecatedSupport is bool)) {
+ if (deprecatedSupport != null && deprecatedSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5090,9 +5178,9 @@
try {
final documentationFormat = obj['documentationFormat'];
if (documentationFormat != null &&
- !((documentationFormat is List<Object?> &&
- (documentationFormat
- .every((item) => MarkupKind.canParse(item, reporter)))))) {
+ (documentationFormat is! List<Object?> ||
+ documentationFormat
+ .any((item) => !MarkupKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<MarkupKind>');
return false;
}
@@ -5102,7 +5190,7 @@
reporter.push('insertReplaceSupport');
try {
final insertReplaceSupport = obj['insertReplaceSupport'];
- if (insertReplaceSupport != null && !(insertReplaceSupport is bool)) {
+ if (insertReplaceSupport != null && insertReplaceSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5113,8 +5201,8 @@
try {
final insertTextModeSupport = obj['insertTextModeSupport'];
if (insertTextModeSupport != null &&
- !(CompletionItemInsertTextModeSupport.canParse(
- insertTextModeSupport, reporter))) {
+ !CompletionItemInsertTextModeSupport.canParse(
+ insertTextModeSupport, reporter)) {
reporter.reportError(
'must be of type CompletionItemInsertTextModeSupport');
return false;
@@ -5125,7 +5213,7 @@
reporter.push('labelDetailsSupport');
try {
final labelDetailsSupport = obj['labelDetailsSupport'];
- if (labelDetailsSupport != null && !(labelDetailsSupport is bool)) {
+ if (labelDetailsSupport != null && labelDetailsSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5135,7 +5223,7 @@
reporter.push('preselectSupport');
try {
final preselectSupport = obj['preselectSupport'];
- if (preselectSupport != null && !(preselectSupport is bool)) {
+ if (preselectSupport != null && preselectSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5146,8 +5234,7 @@
try {
final resolveSupport = obj['resolveSupport'];
if (resolveSupport != null &&
- !(CompletionItemResolveSupport.canParse(
- resolveSupport, reporter))) {
+ !CompletionItemResolveSupport.canParse(resolveSupport, reporter)) {
reporter.reportError('must be of type CompletionItemResolveSupport');
return false;
}
@@ -5157,7 +5244,7 @@
reporter.push('snippetSupport');
try {
final snippetSupport = obj['snippetSupport'];
- if (snippetSupport != null && !(snippetSupport is bool)) {
+ if (snippetSupport != null && snippetSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5168,7 +5255,7 @@
try {
final tagSupport = obj['tagSupport'];
if (tagSupport != null &&
- !(CompletionItemTagSupport.canParse(tagSupport, reporter))) {
+ !CompletionItemTagSupport.canParse(tagSupport, reporter)) {
reporter.reportError('must be of type CompletionItemTagSupport');
return false;
}
@@ -5250,6 +5337,7 @@
/// of the protocol.
final List<CompletionItemKind>? valueSet;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (valueSet != null) {
@@ -5264,9 +5352,9 @@
try {
final valueSet = obj['valueSet'];
if (valueSet != null &&
- !((valueSet is List<Object?> &&
- (valueSet.every(
- (item) => CompletionItemKind.canParse(item, reporter)))))) {
+ (valueSet is! List<Object?> ||
+ valueSet.any(
+ (item) => !CompletionItemKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<CompletionItemKind>');
return false;
}
@@ -5327,6 +5415,7 @@
/// @since 3.17.0
final List<String>? itemDefaults;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (itemDefaults != null) {
@@ -5341,8 +5430,8 @@
try {
final itemDefaults = obj['itemDefaults'];
if (itemDefaults != null &&
- !((itemDefaults is List<Object?> &&
- (itemDefaults.every((item) => item is String))))) {
+ (itemDefaults is! List<Object?> ||
+ itemDefaults.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -5405,6 +5494,7 @@
/// How the completion was triggered.
final CompletionTriggerKind triggerKind;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (triggerCharacter != null) {
@@ -5419,7 +5509,7 @@
reporter.push('triggerCharacter');
try {
final triggerCharacter = obj['triggerCharacter'];
- if (triggerCharacter != null && !(triggerCharacter is String)) {
+ if (triggerCharacter != null && triggerCharacter is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -5437,7 +5527,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(CompletionTriggerKind.canParse(triggerKind, reporter))) {
+ if (!CompletionTriggerKind.canParse(triggerKind, reporter)) {
reporter.reportError('must be of type CompletionTriggerKind');
return false;
}
@@ -5728,6 +5818,7 @@
/// @since 3.17.0
final String? textEditText;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (additionalTextEdits != null) {
@@ -5795,9 +5886,9 @@
try {
final additionalTextEdits = obj['additionalTextEdits'];
if (additionalTextEdits != null &&
- !((additionalTextEdits is List<Object?> &&
- (additionalTextEdits
- .every((item) => TextEdit.canParse(item, reporter)))))) {
+ (additionalTextEdits is! List<Object?> ||
+ additionalTextEdits
+ .any((item) => !TextEdit.canParse(item, reporter)))) {
reporter.reportError('must be of type List<TextEdit>');
return false;
}
@@ -5807,7 +5898,7 @@
reporter.push('command');
try {
final command = obj['command'];
- if (command != null && !(Command.canParse(command, reporter))) {
+ if (command != null && !Command.canParse(command, reporter)) {
reporter.reportError('must be of type Command');
return false;
}
@@ -5818,8 +5909,8 @@
try {
final commitCharacters = obj['commitCharacters'];
if (commitCharacters != null &&
- !((commitCharacters is List<Object?> &&
- (commitCharacters.every((item) => item is String))))) {
+ (commitCharacters is! List<Object?> ||
+ commitCharacters.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -5830,7 +5921,7 @@
try {
final data = obj['data'];
if (data != null &&
- !(CompletionItemResolutionInfo.canParse(data, reporter))) {
+ !CompletionItemResolutionInfo.canParse(data, reporter)) {
reporter.reportError('must be of type CompletionItemResolutionInfo');
return false;
}
@@ -5840,7 +5931,7 @@
reporter.push('deprecated');
try {
final deprecated = obj['deprecated'];
- if (deprecated != null && !(deprecated is bool)) {
+ if (deprecated != null && deprecated is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5850,7 +5941,7 @@
reporter.push('detail');
try {
final detail = obj['detail'];
- if (detail != null && !(detail is String)) {
+ if (detail != null && detail is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -5861,8 +5952,8 @@
try {
final documentation = obj['documentation'];
if (documentation != null &&
- !((MarkupContent.canParse(documentation, reporter) ||
- documentation is String))) {
+ !MarkupContent.canParse(documentation, reporter) &&
+ documentation is! String) {
reporter
.reportError('must be of type Either2<MarkupContent, String>');
return false;
@@ -5873,7 +5964,7 @@
reporter.push('filterText');
try {
final filterText = obj['filterText'];
- if (filterText != null && !(filterText is String)) {
+ if (filterText != null && filterText is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -5883,7 +5974,7 @@
reporter.push('insertText');
try {
final insertText = obj['insertText'];
- if (insertText != null && !(insertText is String)) {
+ if (insertText != null && insertText is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -5894,7 +5985,7 @@
try {
final insertTextFormat = obj['insertTextFormat'];
if (insertTextFormat != null &&
- !(InsertTextFormat.canParse(insertTextFormat, reporter))) {
+ !InsertTextFormat.canParse(insertTextFormat, reporter)) {
reporter.reportError('must be of type InsertTextFormat');
return false;
}
@@ -5905,7 +5996,7 @@
try {
final insertTextMode = obj['insertTextMode'];
if (insertTextMode != null &&
- !(InsertTextMode.canParse(insertTextMode, reporter))) {
+ !InsertTextMode.canParse(insertTextMode, reporter)) {
reporter.reportError('must be of type InsertTextMode');
return false;
}
@@ -5915,7 +6006,7 @@
reporter.push('kind');
try {
final kind = obj['kind'];
- if (kind != null && !(CompletionItemKind.canParse(kind, reporter))) {
+ if (kind != null && !CompletionItemKind.canParse(kind, reporter)) {
reporter.reportError('must be of type CompletionItemKind');
return false;
}
@@ -5933,7 +6024,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(label is String)) {
+ if (label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -5944,7 +6035,7 @@
try {
final labelDetails = obj['labelDetails'];
if (labelDetails != null &&
- !(CompletionItemLabelDetails.canParse(labelDetails, reporter))) {
+ !CompletionItemLabelDetails.canParse(labelDetails, reporter)) {
reporter.reportError('must be of type CompletionItemLabelDetails');
return false;
}
@@ -5954,7 +6045,7 @@
reporter.push('preselect');
try {
final preselect = obj['preselect'];
- if (preselect != null && !(preselect is bool)) {
+ if (preselect != null && preselect is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -5964,7 +6055,7 @@
reporter.push('sortText');
try {
final sortText = obj['sortText'];
- if (sortText != null && !(sortText is String)) {
+ if (sortText != null && sortText is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -5975,9 +6066,9 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List<Object?> &&
- (tags.every(
- (item) => CompletionItemTag.canParse(item, reporter)))))) {
+ (tags is! List<Object?> ||
+ tags.any(
+ (item) => !CompletionItemTag.canParse(item, reporter)))) {
reporter.reportError('must be of type List<CompletionItemTag>');
return false;
}
@@ -5988,8 +6079,8 @@
try {
final textEdit = obj['textEdit'];
if (textEdit != null &&
- !((InsertReplaceEdit.canParse(textEdit, reporter) ||
- TextEdit.canParse(textEdit, reporter)))) {
+ !InsertReplaceEdit.canParse(textEdit, reporter) &&
+ !TextEdit.canParse(textEdit, reporter)) {
reporter.reportError(
'must be of type Either2<InsertReplaceEdit, TextEdit>');
return false;
@@ -6000,7 +6091,7 @@
reporter.push('textEditText');
try {
final textEditText = obj['textEditText'];
- if (textEditText != null && !(textEditText is String)) {
+ if (textEditText != null && textEditText is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -6071,6 +6162,102 @@
String toString() => jsonEncoder.convert(toJson());
}
+class CompletionItemEditRange implements ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ CompletionItemEditRange.canParse,
+ CompletionItemEditRange.fromJson,
+ );
+
+ CompletionItemEditRange({
+ required this.insert,
+ required this.replace,
+ });
+ static CompletionItemEditRange fromJson(Map<String, Object?> json) {
+ final insertJson = json['insert'];
+ final insert = Range.fromJson(insertJson as Map<String, Object?>);
+ final replaceJson = json['replace'];
+ final replace = Range.fromJson(replaceJson as Map<String, Object?>);
+ return CompletionItemEditRange(
+ insert: insert,
+ replace: replace,
+ );
+ }
+
+ final Range insert;
+ final Range replace;
+
+ @override
+ Map<String, Object?> toJson() {
+ var result = <String, Object?>{};
+ result['insert'] = insert.toJson();
+ result['replace'] = replace.toJson();
+ return result;
+ }
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ reporter.push('insert');
+ try {
+ if (!obj.containsKey('insert')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final insert = obj['insert'];
+ if (insert == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!Range.canParse(insert, reporter)) {
+ reporter.reportError('must be of type Range');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('replace');
+ try {
+ if (!obj.containsKey('replace')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final replace = obj['replace'];
+ if (replace == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (!Range.canParse(replace, reporter)) {
+ reporter.reportError('must be of type Range');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ return true;
+ } else {
+ reporter.reportError('must be of type CompletionItemEditRange');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is CompletionItemEditRange &&
+ other.runtimeType == CompletionItemEditRange) {
+ return insert == other.insert && replace == other.replace && true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => Object.hash(
+ insert,
+ replace,
+ );
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
class CompletionItemInsertTextModeSupport implements ToJsonable {
static const jsonHandler = LspJsonHandler(
CompletionItemInsertTextModeSupport.canParse,
@@ -6093,6 +6280,7 @@
final List<InsertTextMode> valueSet;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
@@ -6112,9 +6300,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List<Object?> &&
- (valueSet
- .every((item) => InsertTextMode.canParse(item, reporter)))))) {
+ if (valueSet is! List<Object?> ||
+ valueSet.any((item) => !InsertTextMode.canParse(item, reporter))) {
reporter.reportError('must be of type List<InsertTextMode>');
return false;
}
@@ -6184,6 +6371,7 @@
static const Value = CompletionItemKind(12);
static const Variable = CompletionItemKind(6);
+ @override
Object toJson() => _value;
@override
@@ -6192,6 +6380,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is CompletionItemKind && other._value == _value;
}
@@ -6229,6 +6418,7 @@
/// for function signatures or type annotations.
final String? detail;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (description != null) {
@@ -6245,7 +6435,7 @@
reporter.push('description');
try {
final description = obj['description'];
- if (description != null && !(description is String)) {
+ if (description != null && description is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -6255,7 +6445,7 @@
reporter.push('detail');
try {
final detail = obj['detail'];
- if (detail != null && !(detail is String)) {
+ if (detail != null && detail is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -6310,6 +6500,7 @@
/// The properties that a client can resolve lazily.
final List<String> properties;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['properties'] = properties;
@@ -6329,8 +6520,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((properties is List<Object?> &&
- (properties.every((item) => item is String))))) {
+ if (properties is! List<Object?> ||
+ properties.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -6378,6 +6569,7 @@
/// Render a completion as obsolete, usually using a strike-out.
static const Deprecated = CompletionItemTag(1);
+ @override
Object toJson() => _value;
@override
@@ -6386,6 +6578,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is CompletionItemTag && other._value == _value;
}
@@ -6412,6 +6605,7 @@
/// The tags supported by the client.
final List<CompletionItemTag> valueSet;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
@@ -6431,9 +6625,9 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List<Object?> &&
- (valueSet.every(
- (item) => CompletionItemTag.canParse(item, reporter)))))) {
+ if (valueSet is! List<Object?> ||
+ valueSet
+ .any((item) => !CompletionItemTag.canParse(item, reporter))) {
reporter.reportError('must be of type List<CompletionItemTag>');
return false;
}
@@ -6520,6 +6714,7 @@
/// The completion items.
final List<CompletionItem> items;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['isIncomplete'] = isIncomplete;
@@ -6543,7 +6738,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(isIncomplete is bool)) {
+ if (isIncomplete is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -6554,7 +6749,7 @@
try {
final itemDefaults = obj['itemDefaults'];
if (itemDefaults != null &&
- !(CompletionListItemDefaults.canParse(itemDefaults, reporter))) {
+ !CompletionListItemDefaults.canParse(itemDefaults, reporter)) {
reporter.reportError('must be of type CompletionListItemDefaults');
return false;
}
@@ -6572,9 +6767,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((items is List<Object?> &&
- (items
- .every((item) => CompletionItem.canParse(item, reporter)))))) {
+ if (items is! List<Object?> ||
+ items.any((item) => !CompletionItem.canParse(item, reporter))) {
reporter.reportError('must be of type List<CompletionItem>');
return false;
}
@@ -6611,101 +6805,6 @@
String toString() => jsonEncoder.convert(toJson());
}
-class CompletionListEditRange implements ToJsonable {
- static const jsonHandler = LspJsonHandler(
- CompletionListEditRange.canParse,
- CompletionListEditRange.fromJson,
- );
-
- CompletionListEditRange({
- required this.insert,
- required this.replace,
- });
- static CompletionListEditRange fromJson(Map<String, Object?> json) {
- final insertJson = json['insert'];
- final insert = Range.fromJson(insertJson as Map<String, Object?>);
- final replaceJson = json['replace'];
- final replace = Range.fromJson(replaceJson as Map<String, Object?>);
- return CompletionListEditRange(
- insert: insert,
- replace: replace,
- );
- }
-
- final Range insert;
- final Range replace;
-
- Map<String, Object?> toJson() {
- var result = <String, Object?>{};
- result['insert'] = insert.toJson();
- result['replace'] = replace.toJson();
- return result;
- }
-
- static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, Object?>) {
- reporter.push('insert');
- try {
- if (!obj.containsKey('insert')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final insert = obj['insert'];
- if (insert == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(Range.canParse(insert, reporter))) {
- reporter.reportError('must be of type Range');
- return false;
- }
- } finally {
- reporter.pop();
- }
- reporter.push('replace');
- try {
- if (!obj.containsKey('replace')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final replace = obj['replace'];
- if (replace == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(Range.canParse(replace, reporter))) {
- reporter.reportError('must be of type Range');
- return false;
- }
- } finally {
- reporter.pop();
- }
- return true;
- } else {
- reporter.reportError('must be of type CompletionListEditRange');
- return false;
- }
- }
-
- @override
- bool operator ==(Object other) {
- if (other is CompletionListEditRange &&
- other.runtimeType == CompletionListEditRange) {
- return insert == other.insert && replace == other.replace && true;
- }
- return false;
- }
-
- @override
- int get hashCode => Object.hash(
- insert,
- replace,
- );
-
- @override
- String toString() => jsonEncoder.convert(toJson());
-}
-
class CompletionListItemDefaults implements ToJsonable {
static const jsonHandler = LspJsonHandler(
CompletionListItemDefaults.canParse,
@@ -6714,6 +6813,7 @@
CompletionListItemDefaults({
this.commitCharacters,
+ this.data,
this.editRange,
this.insertTextFormat,
this.insertTextMode,
@@ -6723,17 +6823,19 @@
final commitCharacters = (commitCharactersJson as List<Object?>?)
?.map((item) => item as String)
.toList();
+ final dataJson = json['data'];
+ final data = dataJson;
final editRangeJson = json['editRange'];
final editRange = editRangeJson == null
? null
- : (CompletionListEditRange.canParse(editRangeJson, nullLspJsonReporter)
- ? Either2<CompletionListEditRange, Range>.t1(
- CompletionListEditRange.fromJson(
+ : (CompletionItemEditRange.canParse(editRangeJson, nullLspJsonReporter)
+ ? Either2<CompletionItemEditRange, Range>.t1(
+ CompletionItemEditRange.fromJson(
editRangeJson as Map<String, Object?>))
: (Range.canParse(editRangeJson, nullLspJsonReporter)
- ? Either2<CompletionListEditRange, Range>.t2(
+ ? Either2<CompletionItemEditRange, Range>.t2(
Range.fromJson(editRangeJson as Map<String, Object?>))
- : (throw '''$editRangeJson was not one of (CompletionListEditRange, Range)''')));
+ : (throw '''$editRangeJson was not one of (CompletionItemEditRange, Range)''')));
final insertTextFormatJson = json['insertTextFormat'];
final insertTextFormat = insertTextFormatJson != null
? InsertTextFormat.fromJson(insertTextFormatJson as int)
@@ -6744,6 +6846,7 @@
: null;
return CompletionListItemDefaults(
commitCharacters: commitCharacters,
+ data: data,
editRange: editRange,
insertTextFormat: insertTextFormat,
insertTextMode: insertTextMode,
@@ -6754,9 +6857,13 @@
/// @since 3.17.0
final List<String>? commitCharacters;
+ /// A default data value.
+ /// @since 3.17.0
+ final Object? data;
+
/// A default edit range
/// @since 3.17.0
- final Either2<CompletionListEditRange, Range>? editRange;
+ final Either2<CompletionItemEditRange, Range>? editRange;
/// A default insert text format
/// @since 3.17.0
@@ -6766,11 +6873,15 @@
/// @since 3.17.0
final InsertTextMode? insertTextMode;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (commitCharacters != null) {
result['commitCharacters'] = commitCharacters;
}
+ if (data != null) {
+ result['data'] = data;
+ }
if (editRange != null) {
result['editRange'] = editRange;
}
@@ -6789,8 +6900,8 @@
try {
final commitCharacters = obj['commitCharacters'];
if (commitCharacters != null &&
- !((commitCharacters is List<Object?> &&
- (commitCharacters.every((item) => item is String))))) {
+ (commitCharacters is! List<Object?> ||
+ commitCharacters.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -6801,10 +6912,10 @@
try {
final editRange = obj['editRange'];
if (editRange != null &&
- !((CompletionListEditRange.canParse(editRange, reporter) ||
- Range.canParse(editRange, reporter)))) {
+ !CompletionItemEditRange.canParse(editRange, reporter) &&
+ !Range.canParse(editRange, reporter)) {
reporter.reportError(
- 'must be of type Either2<CompletionListEditRange, Range>');
+ 'must be of type Either2<CompletionItemEditRange, Range>');
return false;
}
} finally {
@@ -6814,7 +6925,7 @@
try {
final insertTextFormat = obj['insertTextFormat'];
if (insertTextFormat != null &&
- !(InsertTextFormat.canParse(insertTextFormat, reporter))) {
+ !InsertTextFormat.canParse(insertTextFormat, reporter)) {
reporter.reportError('must be of type InsertTextFormat');
return false;
}
@@ -6825,7 +6936,7 @@
try {
final insertTextMode = obj['insertTextMode'];
if (insertTextMode != null &&
- !(InsertTextMode.canParse(insertTextMode, reporter))) {
+ !InsertTextMode.canParse(insertTextMode, reporter)) {
reporter.reportError('must be of type InsertTextMode');
return false;
}
@@ -6845,6 +6956,7 @@
other.runtimeType == CompletionListItemDefaults) {
return listEqual(commitCharacters, other.commitCharacters,
(String a, String b) => a == b) &&
+ data == other.data &&
editRange == other.editRange &&
insertTextFormat == other.insertTextFormat &&
insertTextMode == other.insertTextMode &&
@@ -6856,6 +6968,7 @@
@override
int get hashCode => Object.hash(
lspHashCode(commitCharacters),
+ data,
editRange,
insertTextFormat,
insertTextMode,
@@ -6938,8 +7051,10 @@
/// valid inside an identifier (for example `.` in JavaScript) list them in
/// `triggerCharacters`.
final List<String>? triggerCharacters;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (allCommitCharacters != null) {
@@ -6966,8 +7081,8 @@
try {
final allCommitCharacters = obj['allCommitCharacters'];
if (allCommitCharacters != null &&
- !((allCommitCharacters is List<Object?> &&
- (allCommitCharacters.every((item) => item is String))))) {
+ (allCommitCharacters is! List<Object?> ||
+ allCommitCharacters.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -6978,8 +7093,8 @@
try {
final completionItem = obj['completionItem'];
if (completionItem != null &&
- !(CompletionOptionsCompletionItem.canParse(
- completionItem, reporter))) {
+ !CompletionOptionsCompletionItem.canParse(
+ completionItem, reporter)) {
reporter
.reportError('must be of type CompletionOptionsCompletionItem');
return false;
@@ -6990,7 +7105,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7001,8 +7116,8 @@
try {
final triggerCharacters = obj['triggerCharacters'];
if (triggerCharacters != null &&
- !((triggerCharacters is List<Object?> &&
- (triggerCharacters.every((item) => item is String))))) {
+ (triggerCharacters is! List<Object?> ||
+ triggerCharacters.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -7012,7 +7127,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7077,6 +7192,7 @@
/// @since 3.17.0
final bool? labelDetailsSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (labelDetailsSupport != null) {
@@ -7090,7 +7206,7 @@
reporter.push('labelDetailsSupport');
try {
final labelDetailsSupport = obj['labelDetailsSupport'];
- if (labelDetailsSupport != null && !(labelDetailsSupport is bool)) {
+ if (labelDetailsSupport != null && labelDetailsSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7179,17 +7295,22 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (context != null) {
@@ -7211,8 +7332,7 @@
reporter.push('context');
try {
final context = obj['context'];
- if (context != null &&
- !(CompletionContext.canParse(context, reporter))) {
+ if (context != null && !CompletionContext.canParse(context, reporter)) {
reporter.reportError('must be of type CompletionContext');
return false;
}
@@ -7223,7 +7343,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -7241,7 +7362,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -7259,7 +7380,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -7270,7 +7391,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -7337,8 +7459,8 @@
: null;
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final resolveProviderJson = json['resolveProvider'];
final resolveProvider = resolveProviderJson as bool?;
@@ -7366,18 +7488,22 @@
/// If a server provides both `allCommitCharacters` and commit characters on
/// an individual completion item the ones on the completion item win.
/// @since 3.2.0
+ @override
final List<String>? allCommitCharacters;
/// The server supports the following `CompletionItem` specific capabilities.
/// @since 3.17.0
+ @override
final CompletionOptionsCompletionItem? completionItem;
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The server provides support to resolve additional information for a
/// completion item.
+ @override
final bool? resolveProvider;
/// Most tools trigger completion request automatically without explicitly
@@ -7390,9 +7516,12 @@
/// If code complete should automatically be trigger on characters not being
/// valid inside an identifier (for example `.` in JavaScript) list them in
/// `triggerCharacters`.
+ @override
final List<String>? triggerCharacters;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (allCommitCharacters != null) {
@@ -7420,8 +7549,8 @@
try {
final allCommitCharacters = obj['allCommitCharacters'];
if (allCommitCharacters != null &&
- !((allCommitCharacters is List<Object?> &&
- (allCommitCharacters.every((item) => item is String))))) {
+ (allCommitCharacters is! List<Object?> ||
+ allCommitCharacters.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -7432,8 +7561,8 @@
try {
final completionItem = obj['completionItem'];
if (completionItem != null &&
- !(CompletionOptionsCompletionItem.canParse(
- completionItem, reporter))) {
+ !CompletionOptionsCompletionItem.canParse(
+ completionItem, reporter)) {
reporter
.reportError('must be of type CompletionOptionsCompletionItem');
return false;
@@ -7449,10 +7578,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -7461,7 +7591,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7472,8 +7602,8 @@
try {
final triggerCharacters = obj['triggerCharacters'];
if (triggerCharacters != null &&
- !((triggerCharacters is List<Object?> &&
- (triggerCharacters.every((item) => item is String))))) {
+ (triggerCharacters is! List<Object?> ||
+ triggerCharacters.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -7483,7 +7613,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7504,8 +7634,12 @@
return listEqual(allCommitCharacters, other.allCommitCharacters,
(String a, String b) => a == b) &&
completionItem == other.completionItem &&
- listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
resolveProvider == other.resolveProvider &&
listEqual(triggerCharacters, other.triggerCharacters,
(String a, String b) => a == b) &&
@@ -7557,6 +7691,7 @@
/// Completion was re-triggered as the current completion list is incomplete.
static const TriggerForIncompleteCompletions = CompletionTriggerKind._(3);
+ @override
Object toJson() => _value;
@override
@@ -7565,6 +7700,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is CompletionTriggerKind && other._value == _value;
}
@@ -7596,6 +7732,7 @@
/// The configuration section asked for.
final String? section;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (scopeUri != null) {
@@ -7612,7 +7749,7 @@
reporter.push('scopeUri');
try {
final scopeUri = obj['scopeUri'];
- if (scopeUri != null && !(scopeUri is String)) {
+ if (scopeUri != null && scopeUri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -7622,7 +7759,7 @@
reporter.push('section');
try {
final section = obj['section'];
- if (section != null && !(section is String)) {
+ if (section != null && section is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -7675,6 +7812,7 @@
final List<ConfigurationItem> items;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['items'] = items.map((item) => item.toJson()).toList();
@@ -7694,9 +7832,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((items is List<Object?> &&
- (items.every(
- (item) => ConfigurationItem.canParse(item, reporter)))))) {
+ if (items is! List<Object?> ||
+ items.any((item) => !ConfigurationItem.canParse(item, reporter))) {
reporter.reportError('must be of type List<ConfigurationItem>');
return false;
}
@@ -7777,6 +7914,7 @@
/// The resource to create.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (annotationId != null) {
@@ -7795,7 +7933,7 @@
reporter.push('annotationId');
try {
final annotationId = obj['annotationId'];
- if (annotationId != null && !(annotationId is String)) {
+ if (annotationId != null && annotationId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -7813,7 +7951,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'create')) {
+ if (kind != 'create') {
reporter.reportError('must be the literal \'create\'');
return false;
}
@@ -7823,8 +7961,7 @@
reporter.push('options');
try {
final options = obj['options'];
- if (options != null &&
- !(CreateFileOptions.canParse(options, reporter))) {
+ if (options != null && !CreateFileOptions.canParse(options, reporter)) {
reporter.reportError('must be of type CreateFileOptions');
return false;
}
@@ -7842,7 +7979,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -7908,6 +8045,7 @@
/// Overwrite existing file. Overwrite wins over `ignoreIfExists`
final bool? overwrite;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (ignoreIfExists != null) {
@@ -7924,7 +8062,7 @@
reporter.push('ignoreIfExists');
try {
final ignoreIfExists = obj['ignoreIfExists'];
- if (ignoreIfExists != null && !(ignoreIfExists is bool)) {
+ if (ignoreIfExists != null && ignoreIfExists is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7934,7 +8072,7 @@
reporter.push('overwrite');
try {
final overwrite = obj['overwrite'];
- if (overwrite != null && !(overwrite is bool)) {
+ if (overwrite != null && overwrite is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -7993,6 +8131,7 @@
/// An array of all files/folders created in this operation.
final List<FileCreate> files;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['files'] = files.map((item) => item.toJson()).toList();
@@ -8012,8 +8151,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((files is List<Object?> &&
- (files.every((item) => FileCreate.canParse(item, reporter)))))) {
+ if (files is! List<Object?> ||
+ files.any((item) => !FileCreate.canParse(item, reporter))) {
reporter.reportError('must be of type List<FileCreate>');
return false;
}
@@ -8073,6 +8212,7 @@
/// The client supports additional metadata in the form of declaration links.
final bool? linkSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -8089,7 +8229,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8099,7 +8239,7 @@
reporter.push('linkSupport');
try {
final linkSupport = obj['linkSupport'];
- if (linkSupport != null && !(linkSupport is bool)) {
+ if (linkSupport != null && linkSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8154,8 +8294,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -8169,7 +8311,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8248,17 +8390,22 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -8278,7 +8425,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -8296,7 +8444,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -8314,7 +8462,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -8325,7 +8473,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -8382,8 +8531,8 @@
static DeclarationRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -8398,13 +8547,17 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -8427,10 +8580,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -8439,7 +8593,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -8449,7 +8603,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8467,8 +8621,12 @@
bool operator ==(Object other) {
if (other is DeclarationRegistrationOptions &&
other.runtimeType == DeclarationRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -8515,6 +8673,7 @@
/// @since 3.14.0
final bool? linkSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -8531,7 +8690,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8541,7 +8700,7 @@
reporter.push('linkSupport');
try {
final linkSupport = obj['linkSupport'];
- if (linkSupport != null && !(linkSupport is bool)) {
+ if (linkSupport != null && linkSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8596,8 +8755,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -8611,7 +8772,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8689,17 +8850,22 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -8719,7 +8885,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -8737,7 +8904,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -8755,7 +8922,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -8766,7 +8933,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -8818,8 +8986,8 @@
static DefinitionRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final workDoneProgressJson = json['workDoneProgress'];
final workDoneProgress = workDoneProgressJson as bool?;
@@ -8831,9 +8999,12 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -8853,10 +9024,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -8865,7 +9037,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -8883,8 +9055,12 @@
bool operator ==(Object other) {
if (other is DefinitionRegistrationOptions &&
other.runtimeType == DefinitionRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
workDoneProgress == other.workDoneProgress &&
true;
}
@@ -8950,6 +9126,7 @@
/// The file to delete.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (annotationId != null) {
@@ -8968,7 +9145,7 @@
reporter.push('annotationId');
try {
final annotationId = obj['annotationId'];
- if (annotationId != null && !(annotationId is String)) {
+ if (annotationId != null && annotationId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -8986,7 +9163,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'delete')) {
+ if (kind != 'delete') {
reporter.reportError('must be the literal \'delete\'');
return false;
}
@@ -8996,8 +9173,7 @@
reporter.push('options');
try {
final options = obj['options'];
- if (options != null &&
- !(DeleteFileOptions.canParse(options, reporter))) {
+ if (options != null && !DeleteFileOptions.canParse(options, reporter)) {
reporter.reportError('must be of type DeleteFileOptions');
return false;
}
@@ -9015,7 +9191,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -9081,6 +9257,7 @@
/// Delete the content recursively if a folder is denoted.
final bool? recursive;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (ignoreIfNotExists != null) {
@@ -9097,7 +9274,7 @@
reporter.push('ignoreIfNotExists');
try {
final ignoreIfNotExists = obj['ignoreIfNotExists'];
- if (ignoreIfNotExists != null && !(ignoreIfNotExists is bool)) {
+ if (ignoreIfNotExists != null && ignoreIfNotExists is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9107,7 +9284,7 @@
reporter.push('recursive');
try {
final recursive = obj['recursive'];
- if (recursive != null && !(recursive is bool)) {
+ if (recursive != null && recursive is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9166,6 +9343,7 @@
/// An array of all files/folders deleted in this operation.
final List<FileDelete> files;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['files'] = files.map((item) => item.toJson()).toList();
@@ -9185,8 +9363,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((files is List<Object?> &&
- (files.every((item) => FileDelete.canParse(item, reporter)))))) {
+ if (files is! List<Object?> ||
+ files.any((item) => !FileDelete.canParse(item, reporter))) {
reporter.reportError('must be of type List<FileDelete>');
return false;
}
@@ -9310,6 +9488,7 @@
/// @since 3.15.0
final List<DiagnosticTag>? tags;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (code != null) {
@@ -9344,7 +9523,7 @@
reporter.push('code');
try {
final code = obj['code'];
- if (code != null && !(code is String)) {
+ if (code != null && code is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -9355,7 +9534,7 @@
try {
final codeDescription = obj['codeDescription'];
if (codeDescription != null &&
- !(CodeDescription.canParse(codeDescription, reporter))) {
+ !CodeDescription.canParse(codeDescription, reporter)) {
reporter.reportError('must be of type CodeDescription');
return false;
}
@@ -9373,7 +9552,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(message is String)) {
+ if (message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -9391,7 +9570,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -9402,9 +9581,9 @@
try {
final relatedInformation = obj['relatedInformation'];
if (relatedInformation != null &&
- !((relatedInformation is List<Object?> &&
- (relatedInformation.every((item) =>
- DiagnosticRelatedInformation.canParse(item, reporter)))))) {
+ (relatedInformation is! List<Object?> ||
+ relatedInformation.any((item) =>
+ !DiagnosticRelatedInformation.canParse(item, reporter)))) {
reporter.reportError(
'must be of type List<DiagnosticRelatedInformation>');
return false;
@@ -9416,7 +9595,7 @@
try {
final severity = obj['severity'];
if (severity != null &&
- !(DiagnosticSeverity.canParse(severity, reporter))) {
+ !DiagnosticSeverity.canParse(severity, reporter)) {
reporter.reportError('must be of type DiagnosticSeverity');
return false;
}
@@ -9426,7 +9605,7 @@
reporter.push('source');
try {
final source = obj['source'];
- if (source != null && !(source is String)) {
+ if (source != null && source is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -9437,9 +9616,8 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List<Object?> &&
- (tags.every(
- (item) => DiagnosticTag.canParse(item, reporter)))))) {
+ (tags is! List<Object?> ||
+ tags.any((item) => !DiagnosticTag.canParse(item, reporter)))) {
reporter.reportError('must be of type List<DiagnosticTag>');
return false;
}
@@ -9526,6 +9704,7 @@
/// pulls.
final bool? relatedDocumentSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -9542,7 +9721,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9552,8 +9731,7 @@
reporter.push('relatedDocumentSupport');
try {
final relatedDocumentSupport = obj['relatedDocumentSupport'];
- if (relatedDocumentSupport != null &&
- !(relatedDocumentSupport is bool)) {
+ if (relatedDocumentSupport != null && relatedDocumentSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9631,11 +9809,13 @@
/// Inter file dependencies are common for most programming languages and
/// typically uncommon for linters.
final bool interFileDependencies;
+ @override
final bool? workDoneProgress;
/// The server provides support for workspace diagnostics as well.
final bool workspaceDiagnostics;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (identifier != null) {
@@ -9654,7 +9834,7 @@
reporter.push('identifier');
try {
final identifier = obj['identifier'];
- if (identifier != null && !(identifier is String)) {
+ if (identifier != null && identifier is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -9672,7 +9852,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(interFileDependencies is bool)) {
+ if (interFileDependencies is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9682,7 +9862,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9700,7 +9880,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(workspaceDiagnostics is bool)) {
+ if (workspaceDiagnostics is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9762,8 +9942,8 @@
static DiagnosticRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -9787,26 +9967,33 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
/// An optional identifier under which the diagnostics are managed by the
/// client.
+ @override
final String? identifier;
/// Whether the language has inter file dependencies meaning that editing code
/// in one file can result in a different diagnostic set in another file.
/// Inter file dependencies are common for most programming languages and
/// typically uncommon for linters.
+ @override
final bool interFileDependencies;
+ @override
final bool? workDoneProgress;
/// The server provides support for workspace diagnostics as well.
+ @override
final bool workspaceDiagnostics;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -9834,10 +10021,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -9846,7 +10034,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -9856,7 +10044,7 @@
reporter.push('identifier');
try {
final identifier = obj['identifier'];
- if (identifier != null && !(identifier is String)) {
+ if (identifier != null && identifier is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -9874,7 +10062,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(interFileDependencies is bool)) {
+ if (interFileDependencies is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9884,7 +10072,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9902,7 +10090,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(workspaceDiagnostics is bool)) {
+ if (workspaceDiagnostics is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -9920,8 +10108,12 @@
bool operator ==(Object other) {
if (other is DiagnosticRegistrationOptions &&
other.runtimeType == DiagnosticRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
identifier == other.identifier &&
interFileDependencies == other.interFileDependencies &&
@@ -9976,6 +10168,7 @@
/// The message of this related diagnostic information.
final String message;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['location'] = location.toJson();
@@ -9996,7 +10189,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Location.canParse(location, reporter))) {
+ if (!Location.canParse(location, reporter)) {
reporter.reportError('must be of type Location');
return false;
}
@@ -10014,7 +10207,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(message is String)) {
+ if (message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -10068,6 +10261,7 @@
final bool retriggerRequest;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['retriggerRequest'] = retriggerRequest;
@@ -10087,7 +10281,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(retriggerRequest is bool)) {
+ if (retriggerRequest is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10139,6 +10333,7 @@
/// Reports a warning.
static const Warning = DiagnosticSeverity(2);
+ @override
Object toJson() => _value;
@override
@@ -10147,6 +10342,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is DiagnosticSeverity && other._value == _value;
}
@@ -10174,6 +10370,7 @@
/// of having an error squiggle.
static const Unnecessary = DiagnosticTag(1);
+ @override
Object toJson() => _value;
@override
@@ -10182,6 +10379,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is DiagnosticTag && other._value == _value;
}
@@ -10215,6 +10413,7 @@
/// wide change that requires such a calculation.
final bool? refreshSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (refreshSupport != null) {
@@ -10228,7 +10427,7 @@
reporter.push('refreshSupport');
try {
final refreshSupport = obj['refreshSupport'];
- if (refreshSupport != null && !(refreshSupport is bool)) {
+ if (refreshSupport != null && refreshSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10280,6 +10479,7 @@
/// Did change configuration notification supports dynamic registration.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -10293,7 +10493,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10344,6 +10544,7 @@
/// The actual changed settings
final Object? settings;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['settings'] = settings;
@@ -10417,6 +10618,7 @@
/// version after all provided changes have been applied.
final VersionedNotebookDocumentIdentifier notebookDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['change'] = change.toJson();
@@ -10437,7 +10639,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(NotebookDocumentChangeEvent.canParse(change, reporter))) {
+ if (!NotebookDocumentChangeEvent.canParse(change, reporter)) {
reporter.reportError('must be of type NotebookDocumentChangeEvent');
return false;
}
@@ -10455,8 +10657,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!(VersionedNotebookDocumentIdentifier.canParse(
- notebookDocument, reporter))) {
+ if (!VersionedNotebookDocumentIdentifier.canParse(
+ notebookDocument, reporter)) {
reporter.reportError(
'must be of type VersionedNotebookDocumentIdentifier');
return false;
@@ -10546,6 +10748,7 @@
/// after all provided content changes have been applied.
final VersionedTextDocumentIdentifier textDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['contentChanges'] = contentChanges;
@@ -10566,11 +10769,10 @@
reporter.reportError('must not be null');
return false;
}
- if (!((contentChanges is List<Object?> &&
- (contentChanges.every((item) =>
- (TextDocumentContentChangeEvent1.canParse(item, reporter) ||
- TextDocumentContentChangeEvent2.canParse(
- item, reporter))))))) {
+ if (contentChanges is! List<Object?> ||
+ contentChanges.any((item) =>
+ !TextDocumentContentChangeEvent1.canParse(item, reporter) &&
+ !TextDocumentContentChangeEvent2.canParse(item, reporter))) {
reporter.reportError(
'must be of type List<Either2<TextDocumentContentChangeEvent1, TextDocumentContentChangeEvent2>>');
return false;
@@ -10589,8 +10791,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(VersionedTextDocumentIdentifier.canParse(
- textDocument, reporter))) {
+ if (!VersionedTextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter
.reportError('must be of type VersionedTextDocumentIdentifier');
return false;
@@ -10666,6 +10867,7 @@
/// @since 3.17.0
final bool? relativePatternSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -10682,7 +10884,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10692,8 +10894,7 @@
reporter.push('relativePatternSupport');
try {
final relativePatternSupport = obj['relativePatternSupport'];
- if (relativePatternSupport != null &&
- !(relativePatternSupport is bool)) {
+ if (relativePatternSupport != null && relativePatternSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -10751,6 +10952,7 @@
/// The actual file events.
final List<FileEvent> changes;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['changes'] = changes.map((item) => item.toJson()).toList();
@@ -10770,8 +10972,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((changes is List<Object?> &&
- (changes.every((item) => FileEvent.canParse(item, reporter)))))) {
+ if (changes is! List<Object?> ||
+ changes.any((item) => !FileEvent.canParse(item, reporter))) {
reporter.reportError('must be of type List<FileEvent>');
return false;
}
@@ -10827,6 +11029,7 @@
/// The watchers to register.
final List<FileSystemWatcher> watchers;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['watchers'] = watchers.map((item) => item.toJson()).toList();
@@ -10846,9 +11049,9 @@
reporter.reportError('must not be null');
return false;
}
- if (!((watchers is List<Object?> &&
- (watchers.every(
- (item) => FileSystemWatcher.canParse(item, reporter)))))) {
+ if (watchers is! List<Object?> ||
+ watchers
+ .any((item) => !FileSystemWatcher.canParse(item, reporter))) {
reporter.reportError('must be of type List<FileSystemWatcher>');
return false;
}
@@ -10902,6 +11105,7 @@
/// The actual workspace folder change event.
final WorkspaceFoldersChangeEvent event;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['event'] = event.toJson();
@@ -10921,7 +11125,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(WorkspaceFoldersChangeEvent.canParse(event, reporter))) {
+ if (!WorkspaceFoldersChangeEvent.canParse(event, reporter)) {
reporter.reportError('must be of type WorkspaceFoldersChangeEvent');
return false;
}
@@ -10985,6 +11189,7 @@
/// The notebook document that got closed.
final NotebookDocumentIdentifier notebookDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['cellTextDocuments'] =
@@ -11006,9 +11211,9 @@
reporter.reportError('must not be null');
return false;
}
- if (!((cellTextDocuments is List<Object?> &&
- (cellTextDocuments.every(
- (item) => TextDocumentIdentifier.canParse(item, reporter)))))) {
+ if (cellTextDocuments is! List<Object?> ||
+ cellTextDocuments.any(
+ (item) => !TextDocumentIdentifier.canParse(item, reporter))) {
reporter.reportError('must be of type List<TextDocumentIdentifier>');
return false;
}
@@ -11026,8 +11231,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(NotebookDocumentIdentifier.canParse(
- notebookDocument, reporter))) {
+ if (!NotebookDocumentIdentifier.canParse(notebookDocument, reporter)) {
reporter.reportError('must be of type NotebookDocumentIdentifier');
return false;
}
@@ -11084,6 +11288,7 @@
/// The document that was closed.
final TextDocumentIdentifier textDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['textDocument'] = textDocument.toJson();
@@ -11103,7 +11308,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -11165,6 +11370,7 @@
/// The notebook document that got opened.
final NotebookDocument notebookDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['cellTextDocuments'] =
@@ -11186,9 +11392,9 @@
reporter.reportError('must not be null');
return false;
}
- if (!((cellTextDocuments is List<Object?> &&
- (cellTextDocuments.every(
- (item) => TextDocumentItem.canParse(item, reporter)))))) {
+ if (cellTextDocuments is! List<Object?> ||
+ cellTextDocuments
+ .any((item) => !TextDocumentItem.canParse(item, reporter))) {
reporter.reportError('must be of type List<TextDocumentItem>');
return false;
}
@@ -11206,7 +11412,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(NotebookDocument.canParse(notebookDocument, reporter))) {
+ if (!NotebookDocument.canParse(notebookDocument, reporter)) {
reporter.reportError('must be of type NotebookDocument');
return false;
}
@@ -11263,6 +11469,7 @@
/// The document that was opened.
final TextDocumentItem textDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['textDocument'] = textDocument.toJson();
@@ -11282,7 +11489,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentItem.canParse(textDocument, reporter))) {
+ if (!TextDocumentItem.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentItem');
return false;
}
@@ -11335,6 +11542,7 @@
/// The notebook document that got saved.
final NotebookDocumentIdentifier notebookDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['notebookDocument'] = notebookDocument.toJson();
@@ -11354,8 +11562,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(NotebookDocumentIdentifier.canParse(
- notebookDocument, reporter))) {
+ if (!NotebookDocumentIdentifier.canParse(notebookDocument, reporter)) {
reporter.reportError('must be of type NotebookDocumentIdentifier');
return false;
}
@@ -11414,6 +11621,7 @@
/// The document that was saved.
final TextDocumentIdentifier textDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (text != null) {
@@ -11428,7 +11636,7 @@
reporter.push('text');
try {
final text = obj['text'];
- if (text != null && !(text is String)) {
+ if (text != null && text is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -11446,7 +11654,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -11499,6 +11707,7 @@
/// Whether document color supports dynamic registration.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -11512,7 +11721,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11562,8 +11771,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -11577,7 +11788,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11648,14 +11859,17 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The text document.
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -11674,7 +11888,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -11692,7 +11907,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -11703,7 +11918,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -11759,8 +11975,8 @@
static DocumentColorRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -11775,13 +11991,17 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -11804,10 +12024,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -11816,7 +12037,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -11826,7 +12047,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -11844,8 +12065,12 @@
bool operator ==(Object other) {
if (other is DocumentColorRegistrationOptions &&
other.runtimeType == DocumentColorRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -11918,6 +12143,7 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The result id of a previous response if provided.
@@ -11927,8 +12153,10 @@
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (identifier != null) {
@@ -11952,7 +12180,7 @@
reporter.push('identifier');
try {
final identifier = obj['identifier'];
- if (identifier != null && !(identifier is String)) {
+ if (identifier != null && identifier is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -11963,7 +12191,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -11973,7 +12202,7 @@
reporter.push('previousResultId');
try {
final previousResultId = obj['previousResultId'];
- if (previousResultId != null && !(previousResultId is String)) {
+ if (previousResultId != null && previousResultId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -11991,7 +12220,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -12002,7 +12231,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -12061,6 +12291,7 @@
/// A report indicating that the last returned report is still accurate.
static const Unchanged = DocumentDiagnosticReportKind('unchanged');
+ @override
Object toJson() => _value;
@override
@@ -12069,6 +12300,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is DocumentDiagnosticReportKind && other._value == _value;
}
@@ -12110,6 +12342,7 @@
Either2<FullDocumentDiagnosticReport,
UnchangedDocumentDiagnosticReport>> relatedDocuments;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['relatedDocuments'] = relatedDocuments;
@@ -12129,13 +12362,13 @@
reporter.reportError('must not be null');
return false;
}
- if (!((relatedDocuments is Map &&
- (relatedDocuments.keys.every((item) =>
- item is String &&
- relatedDocuments.values.every((item) =>
- (FullDocumentDiagnosticReport.canParse(item, reporter) ||
- UnchangedDocumentDiagnosticReport.canParse(
- item, reporter)))))))) {
+ if (relatedDocuments is! Map ||
+ (relatedDocuments.keys.any((item) =>
+ item is! String ||
+ relatedDocuments.values.any((item) =>
+ !FullDocumentDiagnosticReport.canParse(item, reporter) &&
+ !UnchangedDocumentDiagnosticReport.canParse(
+ item, reporter))))) {
reporter.reportError(
'must be of type Map<String, Either2<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>');
return false;
@@ -12198,6 +12431,7 @@
/// Whether formatting supports dynamic registration.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -12211,7 +12445,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12263,8 +12497,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -12278,7 +12514,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12348,8 +12584,10 @@
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['options'] = options.toJson();
@@ -12373,7 +12611,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(FormattingOptions.canParse(options, reporter))) {
+ if (!FormattingOptions.canParse(options, reporter)) {
reporter.reportError('must be of type FormattingOptions');
return false;
}
@@ -12391,7 +12629,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -12402,7 +12640,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -12457,8 +12696,8 @@
Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final workDoneProgressJson = json['workDoneProgress'];
final workDoneProgress = workDoneProgressJson as bool?;
@@ -12470,9 +12709,12 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -12492,10 +12734,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -12504,7 +12747,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12523,8 +12766,12 @@
bool operator ==(Object other) {
if (other is DocumentFormattingRegistrationOptions &&
other.runtimeType == DocumentFormattingRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
workDoneProgress == other.workDoneProgress &&
true;
}
@@ -12573,6 +12820,7 @@
/// The range this highlight applies to.
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (kind != null) {
@@ -12587,7 +12835,7 @@
reporter.push('kind');
try {
final kind = obj['kind'];
- if (kind != null && !(DocumentHighlightKind.canParse(kind, reporter))) {
+ if (kind != null && !DocumentHighlightKind.canParse(kind, reporter)) {
reporter.reportError('must be of type DocumentHighlightKind');
return false;
}
@@ -12605,7 +12853,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -12658,6 +12906,7 @@
/// Whether document highlight supports dynamic registration.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -12671,7 +12920,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12722,6 +12971,7 @@
/// Write-access of a symbol, like writing to a variable.
static const Write = DocumentHighlightKind(3);
+ @override
Object toJson() => _value;
@override
@@ -12730,6 +12980,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is DocumentHighlightKind && other._value == _value;
}
@@ -12755,8 +13006,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -12770,7 +13023,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -12849,17 +13102,22 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -12879,7 +13137,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -12897,7 +13156,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -12915,7 +13174,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -12926,7 +13185,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -12983,8 +13243,8 @@
Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final workDoneProgressJson = json['workDoneProgress'];
final workDoneProgress = workDoneProgressJson as bool?;
@@ -12996,9 +13256,12 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -13018,10 +13281,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -13030,7 +13294,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13049,8 +13313,12 @@
bool operator ==(Object other) {
if (other is DocumentHighlightRegistrationOptions &&
other.runtimeType == DocumentHighlightRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
workDoneProgress == other.workDoneProgress &&
true;
}
@@ -13117,6 +13385,7 @@
/// @since 3.15.0
final String? tooltip;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (data != null) {
@@ -13145,7 +13414,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -13155,7 +13424,7 @@
reporter.push('target');
try {
final target = obj['target'];
- if (target != null && !(target is String)) {
+ if (target != null && target is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -13165,7 +13434,7 @@
reporter.push('tooltip');
try {
final tooltip = obj['tooltip'];
- if (tooltip != null && !(tooltip is String)) {
+ if (tooltip != null && tooltip is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -13231,6 +13500,7 @@
/// @since 3.15.0
final bool? tooltipSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -13247,7 +13517,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13257,7 +13527,7 @@
reporter.push('tooltipSupport');
try {
final tooltipSupport = obj['tooltipSupport'];
- if (tooltipSupport != null && !(tooltipSupport is bool)) {
+ if (tooltipSupport != null && tooltipSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13318,8 +13588,10 @@
/// Document links have a resolve provider as well.
final bool? resolveProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (resolveProvider != null) {
@@ -13336,7 +13608,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13346,7 +13618,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13422,14 +13694,17 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The document to provide document links for.
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -13448,7 +13723,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -13466,7 +13742,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -13477,7 +13753,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -13532,8 +13809,8 @@
static DocumentLinkRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final resolveProviderJson = json['resolveProvider'];
final resolveProvider = resolveProviderJson as bool?;
@@ -13548,12 +13825,16 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// Document links have a resolve provider as well.
+ @override
final bool? resolveProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -13576,10 +13857,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -13588,7 +13870,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13598,7 +13880,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13616,8 +13898,12 @@
bool operator ==(Object other) {
if (other is DocumentLinkRegistrationOptions &&
other.runtimeType == DocumentLinkRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
resolveProvider == other.resolveProvider &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -13657,6 +13943,7 @@
/// Whether on type formatting supports dynamic registration.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -13670,7 +13957,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -13734,6 +14021,7 @@
/// More trigger characters.
final List<String>? moreTriggerCharacter;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['firstTriggerCharacter'] = firstTriggerCharacter;
@@ -13756,7 +14044,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(firstTriggerCharacter is String)) {
+ if (firstTriggerCharacter is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -13767,8 +14055,8 @@
try {
final moreTriggerCharacter = obj['moreTriggerCharacter'];
if (moreTriggerCharacter != null &&
- !((moreTriggerCharacter is List<Object?> &&
- (moreTriggerCharacter.every((item) => item is String))))) {
+ (moreTriggerCharacter is! List<Object?> ||
+ moreTriggerCharacter.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -13852,6 +14140,7 @@
/// The document to format.
final TextDocumentIdentifier textDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['ch'] = ch;
@@ -13874,7 +14163,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(ch is String)) {
+ if (ch is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -13892,7 +14181,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(FormattingOptions.canParse(options, reporter))) {
+ if (!FormattingOptions.canParse(options, reporter)) {
reporter.reportError('must be of type FormattingOptions');
return false;
}
@@ -13910,7 +14199,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -13928,7 +14217,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -13986,8 +14275,8 @@
Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final firstTriggerCharacterJson = json['firstTriggerCharacter'];
final firstTriggerCharacter = firstTriggerCharacterJson as String;
@@ -14004,14 +14293,18 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// A character on which formatting should be triggered, like `{`.
+ @override
final String firstTriggerCharacter;
/// More trigger characters.
+ @override
final List<String>? moreTriggerCharacter;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -14032,10 +14325,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -14052,7 +14346,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(firstTriggerCharacter is String)) {
+ if (firstTriggerCharacter is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -14063,8 +14357,8 @@
try {
final moreTriggerCharacter = obj['moreTriggerCharacter'];
if (moreTriggerCharacter != null &&
- !((moreTriggerCharacter is List<Object?> &&
- (moreTriggerCharacter.every((item) => item is String))))) {
+ (moreTriggerCharacter is! List<Object?> ||
+ moreTriggerCharacter.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -14083,8 +14377,12 @@
bool operator ==(Object other) {
if (other is DocumentOnTypeFormattingRegistrationOptions &&
other.runtimeType == DocumentOnTypeFormattingRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
firstTriggerCharacter == other.firstTriggerCharacter &&
listEqual(moreTriggerCharacter, other.moreTriggerCharacter,
(String a, String b) => a == b) &&
@@ -14125,6 +14423,7 @@
/// Whether formatting supports dynamic registration.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -14138,7 +14437,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14191,8 +14490,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -14206,7 +14507,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14284,8 +14585,10 @@
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['options'] = options.toJson();
@@ -14310,7 +14613,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(FormattingOptions.canParse(options, reporter))) {
+ if (!FormattingOptions.canParse(options, reporter)) {
reporter.reportError('must be of type FormattingOptions');
return false;
}
@@ -14328,7 +14631,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -14346,7 +14649,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -14357,7 +14660,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -14414,8 +14718,8 @@
Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final workDoneProgressJson = json['workDoneProgress'];
final workDoneProgress = workDoneProgressJson as bool?;
@@ -14427,9 +14731,12 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -14449,10 +14756,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -14461,7 +14769,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14480,8 +14788,12 @@
bool operator ==(Object other) {
if (other is DocumentRangeFormattingRegistrationOptions &&
other.runtimeType == DocumentRangeFormattingRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
workDoneProgress == other.workDoneProgress &&
true;
}
@@ -14584,6 +14896,7 @@
/// @since 3.16.0
final List<SymbolTag>? tags;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (children != null) {
@@ -14611,9 +14924,9 @@
try {
final children = obj['children'];
if (children != null &&
- !((children is List<Object?> &&
- (children.every(
- (item) => DocumentSymbol.canParse(item, reporter)))))) {
+ (children is! List<Object?> ||
+ children
+ .any((item) => !DocumentSymbol.canParse(item, reporter)))) {
reporter.reportError('must be of type List<DocumentSymbol>');
return false;
}
@@ -14623,7 +14936,7 @@
reporter.push('deprecated');
try {
final deprecated = obj['deprecated'];
- if (deprecated != null && !(deprecated is bool)) {
+ if (deprecated != null && deprecated is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14633,7 +14946,7 @@
reporter.push('detail');
try {
final detail = obj['detail'];
- if (detail != null && !(detail is String)) {
+ if (detail != null && detail is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -14651,7 +14964,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(SymbolKind.canParse(kind, reporter))) {
+ if (!SymbolKind.canParse(kind, reporter)) {
reporter.reportError('must be of type SymbolKind');
return false;
}
@@ -14669,7 +14982,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(name is String)) {
+ if (name is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -14687,7 +15000,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -14705,7 +15018,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(selectionRange, reporter))) {
+ if (!Range.canParse(selectionRange, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -14716,8 +15029,8 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List<Object?> &&
- (tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
+ (tags is! List<Object?> ||
+ tags.any((item) => !SymbolTag.canParse(item, reporter)))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
@@ -14826,6 +15139,7 @@
/// @since 3.16.0
final DocumentSymbolClientCapabilitiesTagSupport? tagSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -14852,7 +15166,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14864,7 +15178,7 @@
final hierarchicalDocumentSymbolSupport =
obj['hierarchicalDocumentSymbolSupport'];
if (hierarchicalDocumentSymbolSupport != null &&
- !(hierarchicalDocumentSymbolSupport is bool)) {
+ hierarchicalDocumentSymbolSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14874,7 +15188,7 @@
reporter.push('labelSupport');
try {
final labelSupport = obj['labelSupport'];
- if (labelSupport != null && !(labelSupport is bool)) {
+ if (labelSupport != null && labelSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -14885,8 +15199,8 @@
try {
final symbolKind = obj['symbolKind'];
if (symbolKind != null &&
- !(DocumentSymbolClientCapabilitiesSymbolKind.canParse(
- symbolKind, reporter))) {
+ !DocumentSymbolClientCapabilitiesSymbolKind.canParse(
+ symbolKind, reporter)) {
reporter.reportError(
'must be of type DocumentSymbolClientCapabilitiesSymbolKind');
return false;
@@ -14898,8 +15212,8 @@
try {
final tagSupport = obj['tagSupport'];
if (tagSupport != null &&
- !(DocumentSymbolClientCapabilitiesTagSupport.canParse(
- tagSupport, reporter))) {
+ !DocumentSymbolClientCapabilitiesTagSupport.canParse(
+ tagSupport, reporter)) {
reporter.reportError(
'must be of type DocumentSymbolClientCapabilitiesTagSupport');
return false;
@@ -14970,6 +15284,7 @@
/// from `File` to `Array` as defined in the initial version of the protocol.
final List<SymbolKind>? valueSet;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (valueSet != null) {
@@ -14984,9 +15299,8 @@
try {
final valueSet = obj['valueSet'];
if (valueSet != null &&
- !((valueSet is List<Object?> &&
- (valueSet
- .every((item) => SymbolKind.canParse(item, reporter)))))) {
+ (valueSet is! List<Object?> ||
+ valueSet.any((item) => !SymbolKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<SymbolKind>');
return false;
}
@@ -15042,6 +15356,7 @@
/// The tags supported by the client.
final List<SymbolTag> valueSet;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
@@ -15061,8 +15376,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List<Object?> &&
- (valueSet.every((item) => SymbolTag.canParse(item, reporter)))))) {
+ if (valueSet is! List<Object?> ||
+ valueSet.any((item) => !SymbolTag.canParse(item, reporter))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
@@ -15123,8 +15438,10 @@
/// shown for the same document.
/// @since 3.16.0
final String? label;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (label != null) {
@@ -15141,7 +15458,7 @@
reporter.push('label');
try {
final label = obj['label'];
- if (label != null && !(label is String)) {
+ if (label != null && label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -15151,7 +15468,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15227,14 +15544,17 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The text document.
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -15253,7 +15573,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -15271,7 +15592,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -15282,7 +15603,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -15337,8 +15659,8 @@
static DocumentSymbolRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final labelJson = json['label'];
final label = labelJson as String?;
@@ -15353,14 +15675,18 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// A human-readable string that is shown when multiple outlines trees are
/// shown for the same document.
/// @since 3.16.0
+ @override
final String? label;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -15383,10 +15709,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -15395,7 +15722,7 @@
reporter.push('label');
try {
final label = obj['label'];
- if (label != null && !(label is String)) {
+ if (label != null && label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -15405,7 +15732,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15423,8 +15750,12 @@
bool operator ==(Object other) {
if (other is DocumentSymbolRegistrationOptions &&
other.runtimeType == DocumentSymbolRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
label == other.label &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -15510,6 +15841,7 @@
static const ServerNotInitialized = ErrorCodes(-32002);
static const UnknownErrorCode = ErrorCodes(-32001);
+ @override
Object toJson() => _value;
@override
@@ -15518,6 +15850,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is ErrorCodes && other._value == _value;
}
@@ -15542,6 +15875,7 @@
/// Execute command supports dynamic registration.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -15555,7 +15889,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15612,8 +15946,10 @@
/// The commands to be executed on the server
final List<String> commands;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['commands'] = commands;
@@ -15636,8 +15972,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((commands is List<Object?> &&
- (commands.every((item) => item is String))))) {
+ if (commands is! List<Object?> ||
+ commands.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -15647,7 +15983,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15722,8 +16058,10 @@
final String command;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (arguments != null) {
@@ -15742,8 +16080,7 @@
try {
final arguments = obj['arguments'];
if (arguments != null &&
- !((arguments is List<Object?> &&
- (arguments.every((item) => true))))) {
+ (arguments is! List<Object?> || arguments.any((item) => false))) {
reporter.reportError('must be of type List<Object?>');
return false;
}
@@ -15761,7 +16098,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(command is String)) {
+ if (command is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -15772,7 +16109,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -15835,9 +16173,12 @@
}
/// The commands to be executed on the server
+ @override
final List<String> commands;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['commands'] = commands;
@@ -15860,8 +16201,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((commands is List<Object?> &&
- (commands.every((item) => item is String))))) {
+ if (commands is! List<Object?> ||
+ commands.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -15871,7 +16212,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -15935,6 +16276,7 @@
/// Whether the execution was successful or not if known by the client.
final bool? success;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['executionOrder'] = executionOrder;
@@ -15957,7 +16299,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(executionOrder is int)) {
+ if (executionOrder is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -15967,7 +16309,7 @@
reporter.push('success');
try {
final success = obj['success'];
- if (success != null && !(success is bool)) {
+ if (success != null && success is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -16037,6 +16379,7 @@
/// guarantee that this is succeeding.
static const Undo = FailureHandlingKind._('undo');
+ @override
Object toJson() => _value;
@override
@@ -16045,6 +16388,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is FailureHandlingKind && other._value == _value;
}
@@ -16069,6 +16413,7 @@
/// The file got deleted.
static const Deleted = FileChangeType(3);
+ @override
Object toJson() => _value;
@override
@@ -16077,6 +16422,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is FileChangeType && other._value == _value;
}
@@ -16103,6 +16449,7 @@
/// A file:// URI for the location of the file/folder being created.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['uri'] = uri;
@@ -16122,7 +16469,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -16173,6 +16520,7 @@
/// A file:// URI for the location of the file/folder being deleted.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['uri'] = uri;
@@ -16192,7 +16540,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -16249,6 +16597,7 @@
/// The file's URI.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['type'] = type;
@@ -16269,7 +16618,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(type is int)) {
+ if (type is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -16287,7 +16636,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -16382,6 +16731,7 @@
/// The client has support for sending willRenameFiles requests.
final bool? willRename;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (didCreate != null) {
@@ -16413,7 +16763,7 @@
reporter.push('didCreate');
try {
final didCreate = obj['didCreate'];
- if (didCreate != null && !(didCreate is bool)) {
+ if (didCreate != null && didCreate is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -16423,7 +16773,7 @@
reporter.push('didDelete');
try {
final didDelete = obj['didDelete'];
- if (didDelete != null && !(didDelete is bool)) {
+ if (didDelete != null && didDelete is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -16433,7 +16783,7 @@
reporter.push('didRename');
try {
final didRename = obj['didRename'];
- if (didRename != null && !(didRename is bool)) {
+ if (didRename != null && didRename is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -16443,7 +16793,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -16453,7 +16803,7 @@
reporter.push('willCreate');
try {
final willCreate = obj['willCreate'];
- if (willCreate != null && !(willCreate is bool)) {
+ if (willCreate != null && willCreate is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -16463,7 +16813,7 @@
reporter.push('willDelete');
try {
final willDelete = obj['willDelete'];
- if (willDelete != null && !(willDelete is bool)) {
+ if (willDelete != null && willDelete is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -16473,7 +16823,7 @@
reporter.push('willRename');
try {
final willRename = obj['willRename'];
- if (willRename != null && !(willRename is bool)) {
+ if (willRename != null && willRename is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -16549,6 +16899,7 @@
/// A Uri like `file` or `untitled`.
final String? scheme;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['pattern'] = pattern.toJson();
@@ -16571,7 +16922,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(FileOperationPattern.canParse(pattern, reporter))) {
+ if (!FileOperationPattern.canParse(pattern, reporter)) {
reporter.reportError('must be of type FileOperationPattern');
return false;
}
@@ -16581,7 +16932,7 @@
reporter.push('scheme');
try {
final scheme = obj['scheme'];
- if (scheme != null && !(scheme is String)) {
+ if (scheme != null && scheme is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -16687,6 +17038,7 @@
/// The server is interested in receiving willRenameFiles requests.
final FileOperationRegistrationOptions? willRename;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (didCreate != null) {
@@ -16716,7 +17068,7 @@
try {
final didCreate = obj['didCreate'];
if (didCreate != null &&
- !(FileOperationRegistrationOptions.canParse(didCreate, reporter))) {
+ !FileOperationRegistrationOptions.canParse(didCreate, reporter)) {
reporter
.reportError('must be of type FileOperationRegistrationOptions');
return false;
@@ -16728,7 +17080,7 @@
try {
final didDelete = obj['didDelete'];
if (didDelete != null &&
- !(FileOperationRegistrationOptions.canParse(didDelete, reporter))) {
+ !FileOperationRegistrationOptions.canParse(didDelete, reporter)) {
reporter
.reportError('must be of type FileOperationRegistrationOptions');
return false;
@@ -16740,7 +17092,7 @@
try {
final didRename = obj['didRename'];
if (didRename != null &&
- !(FileOperationRegistrationOptions.canParse(didRename, reporter))) {
+ !FileOperationRegistrationOptions.canParse(didRename, reporter)) {
reporter
.reportError('must be of type FileOperationRegistrationOptions');
return false;
@@ -16752,8 +17104,7 @@
try {
final willCreate = obj['willCreate'];
if (willCreate != null &&
- !(FileOperationRegistrationOptions.canParse(
- willCreate, reporter))) {
+ !FileOperationRegistrationOptions.canParse(willCreate, reporter)) {
reporter
.reportError('must be of type FileOperationRegistrationOptions');
return false;
@@ -16765,8 +17116,7 @@
try {
final willDelete = obj['willDelete'];
if (willDelete != null &&
- !(FileOperationRegistrationOptions.canParse(
- willDelete, reporter))) {
+ !FileOperationRegistrationOptions.canParse(willDelete, reporter)) {
reporter
.reportError('must be of type FileOperationRegistrationOptions');
return false;
@@ -16778,8 +17128,7 @@
try {
final willRename = obj['willRename'];
if (willRename != null &&
- !(FileOperationRegistrationOptions.canParse(
- willRename, reporter))) {
+ !FileOperationRegistrationOptions.canParse(willRename, reporter)) {
reporter
.reportError('must be of type FileOperationRegistrationOptions');
return false;
@@ -16877,6 +17226,7 @@
/// Additional options used during matching.
final FileOperationPatternOptions? options;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['glob'] = glob;
@@ -16902,7 +17252,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(glob is String)) {
+ if (glob is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -16913,7 +17263,7 @@
try {
final matches = obj['matches'];
if (matches != null &&
- !(FileOperationPatternKind.canParse(matches, reporter))) {
+ !FileOperationPatternKind.canParse(matches, reporter)) {
reporter.reportError('must be of type FileOperationPatternKind');
return false;
}
@@ -16924,7 +17274,7 @@
try {
final options = obj['options'];
if (options != null &&
- !(FileOperationPatternOptions.canParse(options, reporter))) {
+ !FileOperationPatternOptions.canParse(options, reporter)) {
reporter.reportError('must be of type FileOperationPatternOptions');
return false;
}
@@ -16979,6 +17329,7 @@
/// The pattern matches a folder only.
static const folder = FileOperationPatternKind('folder');
+ @override
Object toJson() => _value;
@override
@@ -16987,6 +17338,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is FileOperationPatternKind && other._value == _value;
}
@@ -17013,6 +17365,7 @@
/// The pattern should be matched ignoring casing.
final bool? ignoreCase;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (ignoreCase != null) {
@@ -17026,7 +17379,7 @@
reporter.push('ignoreCase');
try {
final ignoreCase = obj['ignoreCase'];
- if (ignoreCase != null && !(ignoreCase is bool)) {
+ if (ignoreCase != null && ignoreCase is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -17081,6 +17434,7 @@
/// The actual filters.
final List<FileOperationFilter> filters;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['filters'] = filters.map((item) => item.toJson()).toList();
@@ -17100,9 +17454,9 @@
reporter.reportError('must not be null');
return false;
}
- if (!((filters is List<Object?> &&
- (filters.every(
- (item) => FileOperationFilter.canParse(item, reporter)))))) {
+ if (filters is! List<Object?> ||
+ filters
+ .any((item) => !FileOperationFilter.canParse(item, reporter))) {
reporter.reportError('must be of type List<FileOperationFilter>');
return false;
}
@@ -17163,6 +17517,7 @@
/// A file:// URI for the original location of the file/folder being renamed.
final String oldUri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['newUri'] = newUri;
@@ -17183,7 +17538,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(newUri is String)) {
+ if (newUri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -17201,7 +17556,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(oldUri is String)) {
+ if (oldUri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -17268,6 +17623,7 @@
/// | WatchKind.Change | WatchKind.Delete which is 7.
final WatchKind? kind;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['globPattern'] = globPattern;
@@ -17290,8 +17646,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((globPattern is String ||
- RelativePattern.canParse(globPattern, reporter)))) {
+ if (globPattern is! String &&
+ !RelativePattern.canParse(globPattern, reporter)) {
reporter
.reportError('must be of type Either2<String, RelativePattern>');
return false;
@@ -17302,7 +17658,7 @@
reporter.push('kind');
try {
final kind = obj['kind'];
- if (kind != null && !(WatchKind.canParse(kind, reporter))) {
+ if (kind != null && !WatchKind.canParse(kind, reporter)) {
reporter.reportError('must be of type WatchKind');
return false;
}
@@ -17405,6 +17761,7 @@
/// larger and smaller than the number of lines in the document.
final int startLine;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (collapsedText != null) {
@@ -17429,7 +17786,7 @@
reporter.push('collapsedText');
try {
final collapsedText = obj['collapsedText'];
- if (collapsedText != null && !(collapsedText is String)) {
+ if (collapsedText != null && collapsedText is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -17439,7 +17796,7 @@
reporter.push('endCharacter');
try {
final endCharacter = obj['endCharacter'];
- if (endCharacter != null && !(endCharacter is int)) {
+ if (endCharacter != null && endCharacter is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -17457,7 +17814,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(endLine is int)) {
+ if (endLine is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -17467,7 +17824,7 @@
reporter.push('kind');
try {
final kind = obj['kind'];
- if (kind != null && !(FoldingRangeKind.canParse(kind, reporter))) {
+ if (kind != null && !FoldingRangeKind.canParse(kind, reporter)) {
reporter.reportError('must be of type FoldingRangeKind');
return false;
}
@@ -17477,7 +17834,7 @@
reporter.push('startCharacter');
try {
final startCharacter = obj['startCharacter'];
- if (startCharacter != null && !(startCharacter is int)) {
+ if (startCharacter != null && startCharacter is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -17495,7 +17852,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(startLine is int)) {
+ if (startLine is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -17599,6 +17956,7 @@
/// limit.
final int? rangeLimit;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -17624,7 +17982,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -17635,8 +17993,8 @@
try {
final foldingRange = obj['foldingRange'];
if (foldingRange != null &&
- !(FoldingRangeClientCapabilitiesFoldingRange.canParse(
- foldingRange, reporter))) {
+ !FoldingRangeClientCapabilitiesFoldingRange.canParse(
+ foldingRange, reporter)) {
reporter.reportError(
'must be of type FoldingRangeClientCapabilitiesFoldingRange');
return false;
@@ -17648,8 +18006,8 @@
try {
final foldingRangeKind = obj['foldingRangeKind'];
if (foldingRangeKind != null &&
- !(FoldingRangeClientCapabilitiesFoldingRangeKind.canParse(
- foldingRangeKind, reporter))) {
+ !FoldingRangeClientCapabilitiesFoldingRangeKind.canParse(
+ foldingRangeKind, reporter)) {
reporter.reportError(
'must be of type FoldingRangeClientCapabilitiesFoldingRangeKind');
return false;
@@ -17660,7 +18018,7 @@
reporter.push('lineFoldingOnly');
try {
final lineFoldingOnly = obj['lineFoldingOnly'];
- if (lineFoldingOnly != null && !(lineFoldingOnly is bool)) {
+ if (lineFoldingOnly != null && lineFoldingOnly is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -17670,7 +18028,7 @@
reporter.push('rangeLimit');
try {
final rangeLimit = obj['rangeLimit'];
- if (rangeLimit != null && !(rangeLimit is int)) {
+ if (rangeLimit != null && rangeLimit is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -17734,6 +18092,7 @@
/// @since 3.17.0
final bool? collapsedText;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (collapsedText != null) {
@@ -17747,7 +18106,7 @@
reporter.push('collapsedText');
try {
final collapsedText = obj['collapsedText'];
- if (collapsedText != null && !(collapsedText is bool)) {
+ if (collapsedText != null && collapsedText is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -17803,6 +18162,7 @@
/// set gracefully and falls back to a default value when unknown.
final List<FoldingRangeKind>? valueSet;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (valueSet != null) {
@@ -17817,9 +18177,9 @@
try {
final valueSet = obj['valueSet'];
if (valueSet != null &&
- !((valueSet is List<Object?> &&
- (valueSet.every(
- (item) => FoldingRangeKind.canParse(item, reporter)))))) {
+ (valueSet is! List<Object?> ||
+ valueSet.any(
+ (item) => !FoldingRangeKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<FoldingRangeKind>');
return false;
}
@@ -17872,6 +18232,7 @@
/// Folding range for a region (e.g. `#region`)
static const Region = FoldingRangeKind('region');
+ @override
Object toJson() => _value;
@override
@@ -17880,6 +18241,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is FoldingRangeKind && other._value == _value;
}
@@ -17904,8 +18266,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -17919,7 +18283,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -17990,14 +18354,17 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The text document.
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -18016,7 +18383,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -18034,7 +18402,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -18045,7 +18413,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -18101,8 +18470,8 @@
static FoldingRangeRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -18117,13 +18486,17 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -18146,10 +18519,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -18158,7 +18532,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -18168,7 +18542,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -18186,8 +18560,12 @@
bool operator ==(Object other) {
if (other is FoldingRangeRegistrationOptions &&
other.runtimeType == FoldingRangeRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -18258,6 +18636,7 @@
/// @since 3.15.0
final bool? trimTrailingWhitespace;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (insertFinalNewline != null) {
@@ -18279,7 +18658,7 @@
reporter.push('insertFinalNewline');
try {
final insertFinalNewline = obj['insertFinalNewline'];
- if (insertFinalNewline != null && !(insertFinalNewline is bool)) {
+ if (insertFinalNewline != null && insertFinalNewline is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -18297,7 +18676,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(insertSpaces is bool)) {
+ if (insertSpaces is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -18315,7 +18694,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(tabSize is int)) {
+ if (tabSize is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -18325,7 +18704,7 @@
reporter.push('trimFinalNewlines');
try {
final trimFinalNewlines = obj['trimFinalNewlines'];
- if (trimFinalNewlines != null && !(trimFinalNewlines is bool)) {
+ if (trimFinalNewlines != null && trimFinalNewlines is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -18335,8 +18714,7 @@
reporter.push('trimTrailingWhitespace');
try {
final trimTrailingWhitespace = obj['trimTrailingWhitespace'];
- if (trimTrailingWhitespace != null &&
- !(trimTrailingWhitespace is bool)) {
+ if (trimTrailingWhitespace != null && trimTrailingWhitespace is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -18427,6 +18805,7 @@
/// request for the same document.
final String? resultId;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['items'] = items.map((item) => item.toJson()).toList();
@@ -18450,8 +18829,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((items is List<Object?> &&
- (items.every((item) => Diagnostic.canParse(item, reporter)))))) {
+ if (items is! List<Object?> ||
+ items.any((item) => !Diagnostic.canParse(item, reporter))) {
reporter.reportError('must be of type List<Diagnostic>');
return false;
}
@@ -18469,7 +18848,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'full')) {
+ if (kind != 'full') {
reporter.reportError('must be the literal \'full\'');
return false;
}
@@ -18479,7 +18858,7 @@
reporter.push('resultId');
try {
final resultId = obj['resultId'];
- if (resultId != null && !(resultId is String)) {
+ if (resultId != null && resultId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -18588,6 +18967,7 @@
/// @since 3.17.0
final GeneralClientCapabilitiesStaleRequestSupport? staleRequestSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (markdown != null) {
@@ -18612,7 +18992,7 @@
try {
final markdown = obj['markdown'];
if (markdown != null &&
- !(MarkdownClientCapabilities.canParse(markdown, reporter))) {
+ !MarkdownClientCapabilities.canParse(markdown, reporter)) {
reporter.reportError('must be of type MarkdownClientCapabilities');
return false;
}
@@ -18623,9 +19003,9 @@
try {
final positionEncodings = obj['positionEncodings'];
if (positionEncodings != null &&
- !((positionEncodings is List<Object?> &&
- (positionEncodings.every((item) =>
- PositionEncodingKind.canParse(item, reporter)))))) {
+ (positionEncodings is! List<Object?> ||
+ positionEncodings.any((item) =>
+ !PositionEncodingKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<PositionEncodingKind>');
return false;
}
@@ -18636,8 +19016,8 @@
try {
final regularExpressions = obj['regularExpressions'];
if (regularExpressions != null &&
- !(RegularExpressionsClientCapabilities.canParse(
- regularExpressions, reporter))) {
+ !RegularExpressionsClientCapabilities.canParse(
+ regularExpressions, reporter)) {
reporter.reportError(
'must be of type RegularExpressionsClientCapabilities');
return false;
@@ -18649,8 +19029,8 @@
try {
final staleRequestSupport = obj['staleRequestSupport'];
if (staleRequestSupport != null &&
- !(GeneralClientCapabilitiesStaleRequestSupport.canParse(
- staleRequestSupport, reporter))) {
+ !GeneralClientCapabilitiesStaleRequestSupport.canParse(
+ staleRequestSupport, reporter)) {
reporter.reportError(
'must be of type GeneralClientCapabilitiesStaleRequestSupport');
return false;
@@ -18722,6 +19102,7 @@
/// receives a response with error code `ContentModified``
final List<String> retryOnContentModified;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['cancel'] = cancel;
@@ -18742,7 +19123,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(cancel is bool)) {
+ if (cancel is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -18760,8 +19141,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((retryOnContentModified is List<Object?> &&
- (retryOnContentModified.every((item) => item is String))))) {
+ if (retryOnContentModified is! List<Object?> ||
+ retryOnContentModified.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -18834,6 +19215,7 @@
/// visualize a hover, e.g. by changing the background color.
final Range? range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['contents'] = contents;
@@ -18856,8 +19238,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((MarkupContent.canParse(contents, reporter) ||
- contents is String))) {
+ if (!MarkupContent.canParse(contents, reporter) &&
+ contents is! String) {
reporter
.reportError('must be of type Either2<MarkupContent, String>');
return false;
@@ -18868,7 +19250,7 @@
reporter.push('range');
try {
final range = obj['range'];
- if (range != null && !(Range.canParse(range, reporter))) {
+ if (range != null && !Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -18931,6 +19313,7 @@
/// Whether hover supports dynamic registration.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (contentFormat != null) {
@@ -18949,9 +19332,9 @@
try {
final contentFormat = obj['contentFormat'];
if (contentFormat != null &&
- !((contentFormat is List<Object?> &&
- (contentFormat
- .every((item) => MarkupKind.canParse(item, reporter)))))) {
+ (contentFormat is! List<Object?> ||
+ contentFormat
+ .any((item) => !MarkupKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<MarkupKind>');
return false;
}
@@ -18961,7 +19344,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -19017,8 +19400,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -19032,7 +19417,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -19095,14 +19480,18 @@
}
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['position'] = position.toJson();
@@ -19126,7 +19515,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -19144,7 +19533,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -19155,7 +19544,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -19205,8 +19595,8 @@
static HoverRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final workDoneProgressJson = json['workDoneProgress'];
final workDoneProgress = workDoneProgressJson as bool?;
@@ -19218,9 +19608,12 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -19240,10 +19633,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -19252,7 +19646,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -19270,8 +19664,12 @@
bool operator ==(Object other) {
if (other is HoverRegistrationOptions &&
other.runtimeType == HoverRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
workDoneProgress == other.workDoneProgress &&
true;
}
@@ -19318,6 +19716,7 @@
/// @since 3.14.0
final bool? linkSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -19334,7 +19733,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -19344,7 +19743,7 @@
reporter.push('linkSupport');
try {
final linkSupport = obj['linkSupport'];
- if (linkSupport != null && !(linkSupport is bool)) {
+ if (linkSupport != null && linkSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -19399,8 +19798,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -19414,7 +19815,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -19493,17 +19894,22 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -19523,7 +19929,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -19541,7 +19948,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -19559,7 +19966,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -19570,7 +19977,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -19628,8 +20036,8 @@
static ImplementationRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -19644,13 +20052,17 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -19673,10 +20085,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -19685,7 +20098,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -19695,7 +20108,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -19713,8 +20126,12 @@
bool operator ==(Object other) {
if (other is ImplementationRegistrationOptions &&
other.runtimeType == ImplementationRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -19837,6 +20254,7 @@
final String? trace;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
/// The workspace folders configured in the client when the server starts.
@@ -19846,6 +20264,7 @@
/// @since 3.6.0
final List<WorkspaceFolder>? workspaceFolders;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['capabilities'] = capabilities.toJson();
@@ -19889,7 +20308,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(ClientCapabilities.canParse(capabilities, reporter))) {
+ if (!ClientCapabilities.canParse(capabilities, reporter)) {
reporter.reportError('must be of type ClientCapabilities');
return false;
}
@@ -19900,7 +20319,7 @@
try {
final clientInfo = obj['clientInfo'];
if (clientInfo != null &&
- !(InitializeParamsClientInfo.canParse(clientInfo, reporter))) {
+ !InitializeParamsClientInfo.canParse(clientInfo, reporter)) {
reporter.reportError('must be of type InitializeParamsClientInfo');
return false;
}
@@ -19910,7 +20329,7 @@
reporter.push('locale');
try {
final locale = obj['locale'];
- if (locale != null && !(locale is String)) {
+ if (locale != null && locale is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -19924,7 +20343,7 @@
return false;
}
final processId = obj['processId'];
- if (processId != null && !(processId is int)) {
+ if (processId != null && processId is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -19934,7 +20353,7 @@
reporter.push('rootPath');
try {
final rootPath = obj['rootPath'];
- if (rootPath != null && !(rootPath is String)) {
+ if (rootPath != null && rootPath is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -19948,7 +20367,7 @@
return false;
}
final rootUri = obj['rootUri'];
- if (rootUri != null && !(rootUri is String)) {
+ if (rootUri != null && rootUri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -19959,7 +20378,9 @@
try {
final trace = obj['trace'];
if (trace != null &&
- !((trace == 'off' || trace == 'messages' || trace == 'verbose'))) {
+ trace != 'off' &&
+ trace != 'messages' &&
+ trace != 'verbose') {
reporter.reportError(
'must be one of the literals \'off\', \'messages\', \'verbose\'');
return false;
@@ -19971,7 +20392,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -19982,9 +20404,9 @@
try {
final workspaceFolders = obj['workspaceFolders'];
if (workspaceFolders != null &&
- !((workspaceFolders is List<Object?> &&
- (workspaceFolders.every(
- (item) => WorkspaceFolder.canParse(item, reporter)))))) {
+ (workspaceFolders is! List<Object?> ||
+ workspaceFolders.any(
+ (item) => !WorkspaceFolder.canParse(item, reporter)))) {
reporter.reportError('must be of type List<WorkspaceFolder>');
return false;
}
@@ -20062,6 +20484,7 @@
/// The client's version as defined by the client.
final String? version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['name'] = name;
@@ -20084,7 +20507,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(name is String)) {
+ if (name is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -20094,7 +20517,7 @@
reporter.push('version');
try {
final version = obj['version'];
- if (version != null && !(version is String)) {
+ if (version != null && version is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -20159,6 +20582,7 @@
/// @since 3.15.0
final InitializeResultServerInfo? serverInfo;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['capabilities'] = capabilities.toJson();
@@ -20181,7 +20605,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(ServerCapabilities.canParse(capabilities, reporter))) {
+ if (!ServerCapabilities.canParse(capabilities, reporter)) {
reporter.reportError('must be of type ServerCapabilities');
return false;
}
@@ -20192,7 +20616,7 @@
try {
final serverInfo = obj['serverInfo'];
if (serverInfo != null &&
- !(InitializeResultServerInfo.canParse(serverInfo, reporter))) {
+ !InitializeResultServerInfo.canParse(serverInfo, reporter)) {
reporter.reportError('must be of type InitializeResultServerInfo');
return false;
}
@@ -20253,6 +20677,7 @@
/// The server's version as defined by the server.
final String? version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['name'] = name;
@@ -20275,7 +20700,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(name is String)) {
+ if (name is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -20285,7 +20710,7 @@
reporter.push('version');
try {
final version = obj['version'];
- if (version != null && !(version is String)) {
+ if (version != null && version is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -20328,10 +20753,8 @@
return InitializedParams();
}
- Map<String, Object?> toJson() {
- var result = <String, Object?>{};
- return result;
- }
+ @override
+ Map<String, Object?> toJson() => {};
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
@@ -20382,10 +20805,10 @@
final kind =
kindJson != null ? InlayHintKind.fromJson(kindJson as int) : null;
final labelJson = json['label'];
- final label = (labelJson is List<Object?> &&
- (labelJson.every((item) =>
- InlayHintLabelPart.canParse(item, nullLspJsonReporter))))
- ? Either2<List<InlayHintLabelPart>, String>.t1((labelJson)
+ final label = labelJson is List<Object?> &&
+ labelJson.every((item) =>
+ InlayHintLabelPart.canParse(item, nullLspJsonReporter))
+ ? Either2<List<InlayHintLabelPart>, String>.t1(labelJson
.map((item) =>
InlayHintLabelPart.fromJson(item as Map<String, Object?>))
.toList())
@@ -20470,6 +20893,7 @@
/// might resolve this property late using the resolve request.
final Either2<MarkupContent, String>? tooltip;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (data != null) {
@@ -20500,7 +20924,7 @@
reporter.push('kind');
try {
final kind = obj['kind'];
- if (kind != null && !(InlayHintKind.canParse(kind, reporter))) {
+ if (kind != null && !InlayHintKind.canParse(kind, reporter)) {
reporter.reportError('must be of type InlayHintKind');
return false;
}
@@ -20518,10 +20942,9 @@
reporter.reportError('must not be null');
return false;
}
- if (!(((label is List<Object?> &&
- (label.every(
- (item) => InlayHintLabelPart.canParse(item, reporter)))) ||
- label is String))) {
+ if (label is! List<Object?> ||
+ label.any((item) => !InlayHintLabelPart.canParse(item, reporter)) &&
+ label is! String) {
reporter.reportError(
'must be of type Either2<List<InlayHintLabelPart>, String>');
return false;
@@ -20532,7 +20955,7 @@
reporter.push('paddingLeft');
try {
final paddingLeft = obj['paddingLeft'];
- if (paddingLeft != null && !(paddingLeft is bool)) {
+ if (paddingLeft != null && paddingLeft is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -20542,7 +20965,7 @@
reporter.push('paddingRight');
try {
final paddingRight = obj['paddingRight'];
- if (paddingRight != null && !(paddingRight is bool)) {
+ if (paddingRight != null && paddingRight is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -20560,7 +20983,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -20571,9 +20994,8 @@
try {
final textEdits = obj['textEdits'];
if (textEdits != null &&
- !((textEdits is List<Object?> &&
- (textEdits
- .every((item) => TextEdit.canParse(item, reporter)))))) {
+ (textEdits is! List<Object?> ||
+ textEdits.any((item) => !TextEdit.canParse(item, reporter)))) {
reporter.reportError('must be of type List<TextEdit>');
return false;
}
@@ -20584,8 +21006,8 @@
try {
final tooltip = obj['tooltip'];
if (tooltip != null &&
- !((MarkupContent.canParse(tooltip, reporter) ||
- tooltip is String))) {
+ !MarkupContent.canParse(tooltip, reporter) &&
+ tooltip is! String) {
reporter
.reportError('must be of type Either2<MarkupContent, String>');
return false;
@@ -20665,6 +21087,7 @@
/// Indicates which properties a client can resolve lazily on a inlay hint.
final InlayHintClientCapabilitiesResolveSupport? resolveSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -20681,7 +21104,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -20692,8 +21115,8 @@
try {
final resolveSupport = obj['resolveSupport'];
if (resolveSupport != null &&
- !(InlayHintClientCapabilitiesResolveSupport.canParse(
- resolveSupport, reporter))) {
+ !InlayHintClientCapabilitiesResolveSupport.canParse(
+ resolveSupport, reporter)) {
reporter.reportError(
'must be of type InlayHintClientCapabilitiesResolveSupport');
return false;
@@ -20752,6 +21175,7 @@
/// The properties that a client can resolve lazily.
final List<String> properties;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['properties'] = properties;
@@ -20771,8 +21195,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((properties is List<Object?> &&
- (properties.every((item) => item is String))))) {
+ if (properties is! List<Object?> ||
+ properties.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -20823,6 +21247,7 @@
/// An inlay hint that for a type annotation.
static const Type = InlayHintKind(1);
+ @override
Object toJson() => _value;
@override
@@ -20831,6 +21256,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is InlayHintKind && other._value == _value;
}
@@ -20904,6 +21330,7 @@
/// The value of this label part.
final String value;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (command != null) {
@@ -20924,7 +21351,7 @@
reporter.push('command');
try {
final command = obj['command'];
- if (command != null && !(Command.canParse(command, reporter))) {
+ if (command != null && !Command.canParse(command, reporter)) {
reporter.reportError('must be of type Command');
return false;
}
@@ -20934,7 +21361,7 @@
reporter.push('location');
try {
final location = obj['location'];
- if (location != null && !(Location.canParse(location, reporter))) {
+ if (location != null && !Location.canParse(location, reporter)) {
reporter.reportError('must be of type Location');
return false;
}
@@ -20945,8 +21372,8 @@
try {
final tooltip = obj['tooltip'];
if (tooltip != null &&
- !((MarkupContent.canParse(tooltip, reporter) ||
- tooltip is String))) {
+ !MarkupContent.canParse(tooltip, reporter) &&
+ tooltip is! String) {
reporter
.reportError('must be of type Either2<MarkupContent, String>');
return false;
@@ -20965,7 +21392,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(value is String)) {
+ if (value is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -21033,8 +21460,10 @@
/// The server provides support to resolve additional information for an inlay
/// hint item.
final bool? resolveProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (resolveProvider != null) {
@@ -21051,7 +21480,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -21061,7 +21490,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -21136,8 +21565,10 @@
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['range'] = range.toJson();
@@ -21161,7 +21592,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -21179,7 +21610,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -21190,7 +21621,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -21248,8 +21680,8 @@
static InlayHintRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -21267,17 +21699,22 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
/// The server provides support to resolve additional information for an inlay
/// hint item.
+ @override
final bool? resolveProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -21303,10 +21740,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -21315,7 +21753,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -21325,7 +21763,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -21335,7 +21773,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -21353,8 +21791,12 @@
bool operator ==(Object other) {
if (other is InlayHintRegistrationOptions &&
other.runtimeType == InlayHintRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
resolveProvider == other.resolveProvider &&
workDoneProgress == other.workDoneProgress &&
@@ -21404,6 +21846,7 @@
/// change that requires such a calculation.
final bool? refreshSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (refreshSupport != null) {
@@ -21417,7 +21860,7 @@
reporter.push('refreshSupport');
try {
final refreshSupport = obj['refreshSupport'];
- if (refreshSupport != null && !(refreshSupport is bool)) {
+ if (refreshSupport != null && refreshSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -21471,6 +21914,7 @@
/// providers.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -21484,7 +21928,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -21544,6 +21988,7 @@
/// of the range denotes the line where the inline values are shown.
final Range stoppedLocation;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['frameId'] = frameId;
@@ -21564,7 +22009,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(frameId is int)) {
+ if (frameId is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -21582,7 +22027,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(stoppedLocation, reporter))) {
+ if (!Range.canParse(stoppedLocation, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -21652,6 +22097,7 @@
/// to extract the evaluatable expression from the underlying document.
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (expression != null) {
@@ -21666,7 +22112,7 @@
reporter.push('expression');
try {
final expression = obj['expression'];
- if (expression != null && !(expression is String)) {
+ if (expression != null && expression is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -21684,7 +22130,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -21739,8 +22185,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -21754,7 +22202,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -21834,8 +22282,10 @@
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['context'] = context.toJson();
@@ -21860,7 +22310,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(InlineValueContext.canParse(context, reporter))) {
+ if (!InlineValueContext.canParse(context, reporter)) {
reporter.reportError('must be of type InlineValueContext');
return false;
}
@@ -21878,7 +22328,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -21896,7 +22346,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -21907,7 +22357,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -21966,8 +22417,8 @@
static InlineValueRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -21982,13 +22433,17 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -22011,10 +22466,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -22023,7 +22479,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -22033,7 +22489,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -22051,8 +22507,12 @@
bool operator ==(Object other) {
if (other is InlineValueRegistrationOptions &&
other.runtimeType == InlineValueRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -22100,6 +22560,7 @@
/// The text of the inline value.
final String text;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['range'] = range.toJson();
@@ -22120,7 +22581,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -22138,7 +22599,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(text is String)) {
+ if (text is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -22212,6 +22673,7 @@
/// If specified the name of the variable to look up.
final String? variableName;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['caseSensitiveLookup'] = caseSensitiveLookup;
@@ -22235,7 +22697,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(caseSensitiveLookup is bool)) {
+ if (caseSensitiveLookup is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -22253,7 +22715,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -22263,7 +22725,7 @@
reporter.push('variableName');
try {
final variableName = obj['variableName'];
- if (variableName != null && !(variableName is String)) {
+ if (variableName != null && variableName is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -22329,6 +22791,7 @@
/// change that requires such a calculation.
final bool? refreshSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (refreshSupport != null) {
@@ -22342,7 +22805,7 @@
reporter.push('refreshSupport');
try {
final refreshSupport = obj['refreshSupport'];
- if (refreshSupport != null && !(refreshSupport is bool)) {
+ if (refreshSupport != null && refreshSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -22409,6 +22872,7 @@
/// The range if the replace is requested.
final Range replace;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['insert'] = insert.toJson();
@@ -22430,7 +22894,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(insert, reporter))) {
+ if (!Range.canParse(insert, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -22448,7 +22912,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(newText is String)) {
+ if (newText is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -22466,7 +22930,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(replace, reporter))) {
+ if (!Range.canParse(replace, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -22530,6 +22994,7 @@
/// one will update others too.
static const Snippet = InsertTextFormat._(2);
+ @override
Object toJson() => _value;
@override
@@ -22538,6 +23003,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is InsertTextFormat && other._value == _value;
}
@@ -22568,6 +23034,7 @@
/// adjustments to the string.
static const asIs = InsertTextMode(1);
+ @override
Object toJson() => _value;
@override
@@ -22576,6 +23043,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is InsertTextMode && other._value == _value;
}
@@ -22604,6 +23072,7 @@
/// capability as well.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -22617,7 +23086,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -22669,8 +23138,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -22684,7 +23155,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -22748,14 +23219,18 @@
}
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['position'] = position.toJson();
@@ -22779,7 +23254,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -22797,7 +23272,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -22808,7 +23283,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -22865,8 +23341,8 @@
Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -22881,13 +23357,17 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -22910,10 +23390,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -22922,7 +23403,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -22932,7 +23413,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -22951,8 +23432,12 @@
bool operator ==(Object other) {
if (other is LinkedEditingRangeRegistrationOptions &&
other.runtimeType == LinkedEditingRangeRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -23004,6 +23489,7 @@
/// configuration's word pattern will be used.
final String? wordPattern;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['ranges'] = ranges.map((item) => item.toJson()).toList();
@@ -23026,8 +23512,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((ranges is List<Object?> &&
- (ranges.every((item) => Range.canParse(item, reporter)))))) {
+ if (ranges is! List<Object?> ||
+ ranges.any((item) => !Range.canParse(item, reporter))) {
reporter.reportError('must be of type List<Range>');
return false;
}
@@ -23037,7 +23523,7 @@
reporter.push('wordPattern');
try {
final wordPattern = obj['wordPattern'];
- if (wordPattern != null && !(wordPattern is String)) {
+ if (wordPattern != null && wordPattern is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -23096,6 +23582,7 @@
final Range range;
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['range'] = range.toJson();
@@ -23116,7 +23603,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -23134,7 +23621,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -23218,6 +23705,7 @@
/// The target resource identifier of this link.
final String targetUri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (originSelectionRange != null) {
@@ -23235,7 +23723,7 @@
try {
final originSelectionRange = obj['originSelectionRange'];
if (originSelectionRange != null &&
- !(Range.canParse(originSelectionRange, reporter))) {
+ !Range.canParse(originSelectionRange, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -23253,7 +23741,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(targetRange, reporter))) {
+ if (!Range.canParse(targetRange, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -23271,7 +23759,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(targetSelectionRange, reporter))) {
+ if (!Range.canParse(targetSelectionRange, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -23289,7 +23777,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(targetUri is String)) {
+ if (targetUri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -23354,6 +23842,7 @@
/// The message type.
final MessageType type;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['message'] = message;
@@ -23374,7 +23863,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(message is String)) {
+ if (message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -23392,7 +23881,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(MessageType.canParse(type, reporter))) {
+ if (!MessageType.canParse(type, reporter)) {
reporter.reportError('must be of type MessageType');
return false;
}
@@ -23452,6 +23941,7 @@
/// is set to `'verbose'`
final String? verbose;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['message'] = message;
@@ -23474,7 +23964,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(message is String)) {
+ if (message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -23484,7 +23974,7 @@
reporter.push('verbose');
try {
final verbose = obj['verbose'];
- if (verbose != null && !(verbose is String)) {
+ if (verbose != null && verbose is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -23555,6 +24045,7 @@
/// The version of the parser.
final String? version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (allowedTags != null) {
@@ -23573,8 +24064,8 @@
try {
final allowedTags = obj['allowedTags'];
if (allowedTags != null &&
- !((allowedTags is List<Object?> &&
- (allowedTags.every((item) => item is String))))) {
+ (allowedTags is! List<Object?> ||
+ allowedTags.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -23592,7 +24083,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(parser is String)) {
+ if (parser is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -23602,7 +24093,7 @@
reporter.push('version');
try {
final version = obj['version'];
- if (version != null && !(version is String)) {
+ if (version != null && version is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -23687,6 +24178,7 @@
/// The content itself
final String value;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['kind'] = kind.toJson();
@@ -23707,7 +24199,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(MarkupKind.canParse(kind, reporter))) {
+ if (!MarkupKind.canParse(kind, reporter)) {
reporter.reportError('must be of type MarkupKind');
return false;
}
@@ -23725,7 +24217,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(value is String)) {
+ if (value is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -23783,6 +24275,7 @@
/// Plain text is supported as a content format
static const PlainText = MarkupKind._('plaintext');
+ @override
Object toJson() => _value;
@override
@@ -23791,6 +24284,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is MarkupKind && other._value == _value;
}
@@ -23815,6 +24309,7 @@
/// A short title like 'Retry', 'Open Log' etc.
final String title;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['title'] = title;
@@ -23834,7 +24329,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(title is String)) {
+ if (title is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -23885,6 +24380,7 @@
/// A warning message.
static const Warning = MessageType(2);
+ @override
Object toJson() => _value;
@override
@@ -23893,6 +24389,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is MessageType && other._value == _value;
}
@@ -24212,6 +24709,7 @@
/// Constant for the 'workspaceSymbol/resolve' method.
static const workspaceSymbol_resolve = Method('workspaceSymbol/resolve');
+ @override
Object toJson() => _value;
@override
@@ -24220,6 +24718,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) => other is Method && other._value == _value;
}
@@ -24267,6 +24766,7 @@
/// The scope in which the moniker is unique
final UniquenessLevel unique;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['identifier'] = identifier;
@@ -24291,7 +24791,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(identifier is String)) {
+ if (identifier is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -24301,7 +24801,7 @@
reporter.push('kind');
try {
final kind = obj['kind'];
- if (kind != null && !(MonikerKind.canParse(kind, reporter))) {
+ if (kind != null && !MonikerKind.canParse(kind, reporter)) {
reporter.reportError('must be of type MonikerKind');
return false;
}
@@ -24319,7 +24819,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(scheme is String)) {
+ if (scheme is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -24337,7 +24837,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(UniquenessLevel.canParse(unique, reporter))) {
+ if (!UniquenessLevel.canParse(unique, reporter)) {
reporter.reportError('must be of type UniquenessLevel');
return false;
}
@@ -24398,6 +24898,7 @@
/// capability as well.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -24411,7 +24912,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -24462,6 +24963,7 @@
/// variable of a function, a class not visible outside the project, ...)
static const local = MonikerKind('local');
+ @override
Object toJson() => _value;
@override
@@ -24470,6 +24972,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is MonikerKind && other._value == _value;
}
@@ -24494,8 +24997,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -24509,7 +25014,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -24587,17 +25092,22 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -24617,7 +25127,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -24635,7 +25146,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -24653,7 +25164,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -24664,7 +25175,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -24716,8 +25228,8 @@
static MonikerRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final workDoneProgressJson = json['workDoneProgress'];
final workDoneProgress = workDoneProgressJson as bool?;
@@ -24729,9 +25241,12 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -24751,10 +25266,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -24763,7 +25279,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -24781,8 +25297,12 @@
bool operator ==(Object other) {
if (other is MonikerRegistrationOptions &&
other.runtimeType == MonikerRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
workDoneProgress == other.workDoneProgress &&
true;
}
@@ -24849,6 +25369,7 @@
/// Additional metadata stored with the cell.
final Object? metadata;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['document'] = document;
@@ -24875,7 +25396,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(document is String)) {
+ if (document is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -24886,7 +25407,7 @@
try {
final executionSummary = obj['executionSummary'];
if (executionSummary != null &&
- !(ExecutionSummary.canParse(executionSummary, reporter))) {
+ !ExecutionSummary.canParse(executionSummary, reporter)) {
reporter.reportError('must be of type ExecutionSummary');
return false;
}
@@ -24904,7 +25425,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(NotebookCellKind.canParse(kind, reporter))) {
+ if (!NotebookCellKind.canParse(kind, reporter)) {
reporter.reportError('must be of type NotebookCellKind');
return false;
}
@@ -24980,6 +25501,7 @@
/// The start oftest of the cell that changed.
final int start;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (cells != null) {
@@ -24996,9 +25518,8 @@
try {
final cells = obj['cells'];
if (cells != null &&
- !((cells is List<Object?> &&
- (cells.every(
- (item) => NotebookCell.canParse(item, reporter)))))) {
+ (cells is! List<Object?> ||
+ cells.any((item) => !NotebookCell.canParse(item, reporter)))) {
reporter.reportError('must be of type List<NotebookCell>');
return false;
}
@@ -25016,7 +25537,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(deleteCount is int)) {
+ if (deleteCount is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -25034,7 +25555,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(start is int)) {
+ if (start is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -25090,6 +25611,7 @@
/// A markup-cell is formatted source that is used for display.
static const Markup = NotebookCellKind(1);
+ @override
Object toJson() => _value;
@override
@@ -25098,6 +25620,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is NotebookCellKind && other._value == _value;
}
@@ -25119,10 +25642,10 @@
final languageJson = json['language'];
final language = languageJson as String?;
final notebookJson = json['notebook'];
- final notebook = (NotebookDocumentFilter1.canParse(notebookJson, nullLspJsonReporter) ||
+ final notebook = NotebookDocumentFilter1.canParse(notebookJson, nullLspJsonReporter) ||
NotebookDocumentFilter2.canParse(
notebookJson, nullLspJsonReporter) ||
- NotebookDocumentFilter3.canParse(notebookJson, nullLspJsonReporter))
+ NotebookDocumentFilter3.canParse(notebookJson, nullLspJsonReporter)
? Either2<Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String>.t1(
NotebookDocumentFilter1.canParse(notebookJson, nullLspJsonReporter)
? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t1(NotebookDocumentFilter1.fromJson(
@@ -25154,6 +25677,7 @@
NotebookDocumentFilter3>,
String> notebook;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (language != null) {
@@ -25168,7 +25692,7 @@
reporter.push('language');
try {
final language = obj['language'];
- if (language != null && !(language is String)) {
+ if (language != null && language is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -25186,10 +25710,10 @@
reporter.reportError('must not be null');
return false;
}
- if (!(((NotebookDocumentFilter1.canParse(notebook, reporter) ||
- NotebookDocumentFilter2.canParse(notebook, reporter) ||
- NotebookDocumentFilter3.canParse(notebook, reporter)) ||
- notebook is String))) {
+ if (!NotebookDocumentFilter1.canParse(notebook, reporter) &&
+ !NotebookDocumentFilter2.canParse(notebook, reporter) &&
+ !NotebookDocumentFilter3.canParse(notebook, reporter) &&
+ notebook is! String) {
reporter.reportError(
'must be of type Either2<Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String>');
return false;
@@ -25276,6 +25800,7 @@
/// including undo/redo).
final int version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['cells'] = cells.map((item) => item.toJson()).toList();
@@ -25301,8 +25826,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((cells is List<Object?> &&
- (cells.every((item) => NotebookCell.canParse(item, reporter)))))) {
+ if (cells is! List<Object?> ||
+ cells.any((item) => !NotebookCell.canParse(item, reporter))) {
reporter.reportError('must be of type List<NotebookCell>');
return false;
}
@@ -25320,7 +25845,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(notebookType is String)) {
+ if (notebookType is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -25338,7 +25863,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -25356,7 +25881,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(version is int)) {
+ if (version is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -25429,6 +25954,7 @@
/// The changed meta data if any.
final Object? metadata;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (cells != null) {
@@ -25446,7 +25972,7 @@
try {
final cells = obj['cells'];
if (cells != null &&
- !(NotebookDocumentChangeEventCells.canParse(cells, reporter))) {
+ !NotebookDocumentChangeEventCells.canParse(cells, reporter)) {
reporter
.reportError('must be of type NotebookDocumentChangeEventCells');
return false;
@@ -25503,7 +26029,7 @@
: null;
final textContentJson = json['textContent'];
final textContent = (textContentJson as List<Object?>?)
- ?.map((item) => NotebookDocumentChangeEventTextContent.fromJson(
+ ?.map((item) => NotebookDocumentChangeEventCellsTextContent.fromJson(
item as Map<String, Object?>))
.toList();
return NotebookDocumentChangeEventCells(
@@ -25521,8 +26047,9 @@
final NotebookDocumentChangeEventCellsStructure? structure;
/// Changes to the text content of notebook cells.
- final List<NotebookDocumentChangeEventTextContent>? textContent;
+ final List<NotebookDocumentChangeEventCellsTextContent>? textContent;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (data != null) {
@@ -25544,9 +26071,8 @@
try {
final data = obj['data'];
if (data != null &&
- !((data is List<Object?> &&
- (data.every(
- (item) => NotebookCell.canParse(item, reporter)))))) {
+ (data is! List<Object?> ||
+ data.any((item) => !NotebookCell.canParse(item, reporter)))) {
reporter.reportError('must be of type List<NotebookCell>');
return false;
}
@@ -25557,8 +26083,8 @@
try {
final structure = obj['structure'];
if (structure != null &&
- !(NotebookDocumentChangeEventCellsStructure.canParse(
- structure, reporter))) {
+ !NotebookDocumentChangeEventCellsStructure.canParse(
+ structure, reporter)) {
reporter.reportError(
'must be of type NotebookDocumentChangeEventCellsStructure');
return false;
@@ -25570,12 +26096,12 @@
try {
final textContent = obj['textContent'];
if (textContent != null &&
- !((textContent is List<Object?> &&
- (textContent.every((item) =>
- NotebookDocumentChangeEventTextContent.canParse(
- item, reporter)))))) {
+ (textContent is! List<Object?> ||
+ textContent.any((item) =>
+ !NotebookDocumentChangeEventCellsTextContent.canParse(
+ item, reporter)))) {
reporter.reportError(
- 'must be of type List<NotebookDocumentChangeEventTextContent>');
+ 'must be of type List<NotebookDocumentChangeEventCellsTextContent>');
return false;
}
} finally {
@@ -25598,8 +26124,8 @@
listEqual(
textContent,
other.textContent,
- (NotebookDocumentChangeEventTextContent a,
- NotebookDocumentChangeEventTextContent b) =>
+ (NotebookDocumentChangeEventCellsTextContent a,
+ NotebookDocumentChangeEventCellsTextContent b) =>
a == b) &&
true;
}
@@ -25658,6 +26184,7 @@
/// Additional opened cell text documents.
final List<TextDocumentItem>? didOpen;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['array'] = array.toJson();
@@ -25683,7 +26210,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(NotebookCellArrayChange.canParse(array, reporter))) {
+ if (!NotebookCellArrayChange.canParse(array, reporter)) {
reporter.reportError('must be of type NotebookCellArrayChange');
return false;
}
@@ -25694,9 +26221,9 @@
try {
final didClose = obj['didClose'];
if (didClose != null &&
- !((didClose is List<Object?> &&
- (didClose.every((item) =>
- TextDocumentIdentifier.canParse(item, reporter)))))) {
+ (didClose is! List<Object?> ||
+ didClose.any((item) =>
+ !TextDocumentIdentifier.canParse(item, reporter)))) {
reporter.reportError('must be of type List<TextDocumentIdentifier>');
return false;
}
@@ -25707,9 +26234,9 @@
try {
final didOpen = obj['didOpen'];
if (didOpen != null &&
- !((didOpen is List<Object?> &&
- (didOpen.every(
- (item) => TextDocumentItem.canParse(item, reporter)))))) {
+ (didOpen is! List<Object?> ||
+ didOpen.any(
+ (item) => !TextDocumentItem.canParse(item, reporter)))) {
reporter.reportError('must be of type List<TextDocumentItem>');
return false;
}
@@ -25749,17 +26276,17 @@
String toString() => jsonEncoder.convert(toJson());
}
-class NotebookDocumentChangeEventTextContent implements ToJsonable {
+class NotebookDocumentChangeEventCellsTextContent implements ToJsonable {
static const jsonHandler = LspJsonHandler(
- NotebookDocumentChangeEventTextContent.canParse,
- NotebookDocumentChangeEventTextContent.fromJson,
+ NotebookDocumentChangeEventCellsTextContent.canParse,
+ NotebookDocumentChangeEventCellsTextContent.fromJson,
);
- NotebookDocumentChangeEventTextContent({
+ NotebookDocumentChangeEventCellsTextContent({
required this.changes,
required this.document,
});
- static NotebookDocumentChangeEventTextContent fromJson(
+ static NotebookDocumentChangeEventCellsTextContent fromJson(
Map<String, Object?> json) {
final changesJson = json['changes'];
final changes = (changesJson as List<Object?>)
@@ -25777,7 +26304,7 @@
final documentJson = json['document'];
final document = VersionedTextDocumentIdentifier.fromJson(
documentJson as Map<String, Object?>);
- return NotebookDocumentChangeEventTextContent(
+ return NotebookDocumentChangeEventCellsTextContent(
changes: changes,
document: document,
);
@@ -25788,6 +26315,7 @@
TextDocumentContentChangeEvent2>> changes;
final VersionedTextDocumentIdentifier document;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['changes'] = changes;
@@ -25808,10 +26336,10 @@
reporter.reportError('must not be null');
return false;
}
- if (!((changes is List<Object?> &&
- (changes.every((item) => (TextDocumentContentChangeEvent1.canParse(
- item, reporter) ||
- TextDocumentContentChangeEvent2.canParse(item, reporter))))))) {
+ if (changes is! List<Object?> ||
+ changes.any((item) =>
+ !TextDocumentContentChangeEvent1.canParse(item, reporter) &&
+ !TextDocumentContentChangeEvent2.canParse(item, reporter))) {
reporter.reportError(
'must be of type List<Either2<TextDocumentContentChangeEvent1, TextDocumentContentChangeEvent2>>');
return false;
@@ -25830,7 +26358,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(VersionedTextDocumentIdentifier.canParse(document, reporter))) {
+ if (!VersionedTextDocumentIdentifier.canParse(document, reporter)) {
reporter
.reportError('must be of type VersionedTextDocumentIdentifier');
return false;
@@ -25841,15 +26369,15 @@
return true;
} else {
reporter.reportError(
- 'must be of type NotebookDocumentChangeEventTextContent');
+ 'must be of type NotebookDocumentChangeEventCellsTextContent');
return false;
}
}
@override
bool operator ==(Object other) {
- if (other is NotebookDocumentChangeEventTextContent &&
- other.runtimeType == NotebookDocumentChangeEventTextContent) {
+ if (other is NotebookDocumentChangeEventCellsTextContent &&
+ other.runtimeType == NotebookDocumentChangeEventCellsTextContent) {
return listEqual(
changes,
other.changes,
@@ -25901,6 +26429,7 @@
/// @since 3.17.0
final NotebookDocumentSyncClientCapabilities synchronization;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['synchronization'] = synchronization.toJson();
@@ -25920,8 +26449,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!(NotebookDocumentSyncClientCapabilities.canParse(
- synchronization, reporter))) {
+ if (!NotebookDocumentSyncClientCapabilities.canParse(
+ synchronization, reporter)) {
reporter.reportError(
'must be of type NotebookDocumentSyncClientCapabilities');
return false;
@@ -25987,6 +26516,7 @@
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
final String? scheme;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['notebookType'] = notebookType;
@@ -26012,7 +26542,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(notebookType is String)) {
+ if (notebookType is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -26022,7 +26552,7 @@
reporter.push('pattern');
try {
final pattern = obj['pattern'];
- if (pattern != null && !(pattern is String)) {
+ if (pattern != null && pattern is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -26032,7 +26562,7 @@
reporter.push('scheme');
try {
final scheme = obj['scheme'];
- if (scheme != null && !(scheme is String)) {
+ if (scheme != null && scheme is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -26103,6 +26633,7 @@
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
final String scheme;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (notebookType != null) {
@@ -26120,7 +26651,7 @@
reporter.push('notebookType');
try {
final notebookType = obj['notebookType'];
- if (notebookType != null && !(notebookType is String)) {
+ if (notebookType != null && notebookType is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -26130,7 +26661,7 @@
reporter.push('pattern');
try {
final pattern = obj['pattern'];
- if (pattern != null && !(pattern is String)) {
+ if (pattern != null && pattern is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -26148,7 +26679,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(scheme is String)) {
+ if (scheme is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -26219,6 +26750,7 @@
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
final String? scheme;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (notebookType != null) {
@@ -26236,7 +26768,7 @@
reporter.push('notebookType');
try {
final notebookType = obj['notebookType'];
- if (notebookType != null && !(notebookType is String)) {
+ if (notebookType != null && notebookType is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -26254,7 +26786,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(pattern is String)) {
+ if (pattern is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -26264,7 +26796,7 @@
reporter.push('scheme');
try {
final scheme = obj['scheme'];
- if (scheme != null && !(scheme is String)) {
+ if (scheme != null && scheme is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -26323,6 +26855,7 @@
/// The notebook document's uri.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['uri'] = uri;
@@ -26342,7 +26875,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -26382,13 +26915,17 @@
NotebookDocumentSyncClientCapabilities({
this.dynamicRegistration,
+ this.executionSummarySupport,
});
static NotebookDocumentSyncClientCapabilities fromJson(
Map<String, Object?> json) {
final dynamicRegistrationJson = json['dynamicRegistration'];
final dynamicRegistration = dynamicRegistrationJson as bool?;
+ final executionSummarySupportJson = json['executionSummarySupport'];
+ final executionSummarySupport = executionSummarySupportJson as bool?;
return NotebookDocumentSyncClientCapabilities(
dynamicRegistration: dynamicRegistration,
+ executionSummarySupport: executionSummarySupport,
);
}
@@ -26398,11 +26935,18 @@
/// capability as well.
final bool? dynamicRegistration;
+ /// The client supports sending execution summary data per cell.
+ final bool? executionSummarySupport;
+
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
result['dynamicRegistration'] = dynamicRegistration;
}
+ if (executionSummarySupport != null) {
+ result['executionSummarySupport'] = executionSummarySupport;
+ }
return result;
}
@@ -26411,7 +26955,18 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
+ reporter.reportError('must be of type bool');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ reporter.push('executionSummarySupport');
+ try {
+ final executionSummarySupport = obj['executionSummarySupport'];
+ if (executionSummarySupport != null &&
+ executionSummarySupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -26430,13 +26985,18 @@
bool operator ==(Object other) {
if (other is NotebookDocumentSyncClientCapabilities &&
other.runtimeType == NotebookDocumentSyncClientCapabilities) {
- return dynamicRegistration == other.dynamicRegistration && true;
+ return dynamicRegistration == other.dynamicRegistration &&
+ executionSummarySupport == other.executionSummarySupport &&
+ true;
}
return false;
}
@override
- int get hashCode => dynamicRegistration.hashCode;
+ int get hashCode => Object.hash(
+ dynamicRegistration,
+ executionSummarySupport,
+ );
@override
String toString() => jsonEncoder.convert(toJson());
@@ -26496,6 +27056,7 @@
/// honored if mode === `notebook`.
final bool? save;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['notebookSelector'] = notebookSelector;
@@ -26518,12 +27079,12 @@
reporter.reportError('must not be null');
return false;
}
- if (!((notebookSelector is List<Object?> &&
- (notebookSelector.every((item) =>
- (NotebookDocumentSyncOptionsNotebookSelector.canParse(
- item, reporter) ||
- NotebookDocumentSyncOptionsNotebookSelector2.canParse(
- item, reporter))))))) {
+ if (notebookSelector is! List<Object?> ||
+ notebookSelector.any((item) =>
+ !NotebookDocumentSyncOptionsNotebookSelector.canParse(
+ item, reporter) &&
+ !NotebookDocumentSyncOptionsNotebookSelector2.canParse(
+ item, reporter))) {
reporter.reportError(
'must be of type List<Either2<NotebookDocumentSyncOptionsNotebookSelector, NotebookDocumentSyncOptionsNotebookSelector2>>');
return false;
@@ -26534,7 +27095,7 @@
reporter.push('save');
try {
final save = obj['save'];
- if (save != null && !(save is bool)) {
+ if (save != null && save is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -26578,142 +27139,6 @@
String toString() => jsonEncoder.convert(toJson());
}
-class NotebookDocumentSyncOptionsCells implements ToJsonable {
- static const jsonHandler = LspJsonHandler(
- NotebookDocumentSyncOptionsCells.canParse,
- NotebookDocumentSyncOptionsCells.fromJson,
- );
-
- NotebookDocumentSyncOptionsCells({
- required this.language,
- });
- static NotebookDocumentSyncOptionsCells fromJson(Map<String, Object?> json) {
- final languageJson = json['language'];
- final language = languageJson as String;
- return NotebookDocumentSyncOptionsCells(
- language: language,
- );
- }
-
- final String language;
-
- Map<String, Object?> toJson() {
- var result = <String, Object?>{};
- result['language'] = language;
- return result;
- }
-
- static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, Object?>) {
- reporter.push('language');
- try {
- if (!obj.containsKey('language')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final language = obj['language'];
- if (language == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(language is String)) {
- reporter.reportError('must be of type String');
- return false;
- }
- } finally {
- reporter.pop();
- }
- return true;
- } else {
- reporter.reportError('must be of type NotebookDocumentSyncOptionsCells');
- return false;
- }
- }
-
- @override
- bool operator ==(Object other) {
- if (other is NotebookDocumentSyncOptionsCells &&
- other.runtimeType == NotebookDocumentSyncOptionsCells) {
- return language == other.language && true;
- }
- return false;
- }
-
- @override
- int get hashCode => language.hashCode;
-
- @override
- String toString() => jsonEncoder.convert(toJson());
-}
-
-class NotebookDocumentSyncOptionsCells2 implements ToJsonable {
- static const jsonHandler = LspJsonHandler(
- NotebookDocumentSyncOptionsCells2.canParse,
- NotebookDocumentSyncOptionsCells2.fromJson,
- );
-
- NotebookDocumentSyncOptionsCells2({
- required this.language,
- });
- static NotebookDocumentSyncOptionsCells2 fromJson(Map<String, Object?> json) {
- final languageJson = json['language'];
- final language = languageJson as String;
- return NotebookDocumentSyncOptionsCells2(
- language: language,
- );
- }
-
- final String language;
-
- Map<String, Object?> toJson() {
- var result = <String, Object?>{};
- result['language'] = language;
- return result;
- }
-
- static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, Object?>) {
- reporter.push('language');
- try {
- if (!obj.containsKey('language')) {
- reporter.reportError('must not be undefined');
- return false;
- }
- final language = obj['language'];
- if (language == null) {
- reporter.reportError('must not be null');
- return false;
- }
- if (!(language is String)) {
- reporter.reportError('must be of type String');
- return false;
- }
- } finally {
- reporter.pop();
- }
- return true;
- } else {
- reporter.reportError('must be of type NotebookDocumentSyncOptionsCells2');
- return false;
- }
- }
-
- @override
- bool operator ==(Object other) {
- if (other is NotebookDocumentSyncOptionsCells2 &&
- other.runtimeType == NotebookDocumentSyncOptionsCells2) {
- return language == other.language && true;
- }
- return false;
- }
-
- @override
- int get hashCode => language.hashCode;
-
- @override
- String toString() => jsonEncoder.convert(toJson());
-}
-
class NotebookDocumentSyncOptionsNotebookSelector implements ToJsonable {
static const jsonHandler = LspJsonHandler(
NotebookDocumentSyncOptionsNotebookSelector.canParse,
@@ -26722,54 +27147,55 @@
NotebookDocumentSyncOptionsNotebookSelector({
this.cells,
- required this.notebookDocument,
+ required this.notebook,
});
static NotebookDocumentSyncOptionsNotebookSelector fromJson(
Map<String, Object?> json) {
final cellsJson = json['cells'];
final cells = (cellsJson as List<Object?>?)
- ?.map((item) => NotebookDocumentSyncOptionsCells.fromJson(
- item as Map<String, Object?>))
+ ?.map((item) =>
+ NotebookDocumentSyncOptionsNotebookSelectorCells.fromJson(
+ item as Map<String, Object?>))
.toList();
- final notebookDocumentJson = json['notebookDocument'];
- final notebookDocument = (NotebookDocumentFilter1.canParse(
- notebookDocumentJson, nullLspJsonReporter) ||
+ final notebookJson = json['notebook'];
+ final notebook = NotebookDocumentFilter1.canParse(notebookJson, nullLspJsonReporter) ||
NotebookDocumentFilter2.canParse(
- notebookDocumentJson, nullLspJsonReporter) ||
- NotebookDocumentFilter3.canParse(
- notebookDocumentJson, nullLspJsonReporter))
+ notebookJson, nullLspJsonReporter) ||
+ NotebookDocumentFilter3.canParse(notebookJson, nullLspJsonReporter)
? Either2<Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String>.t1(
- NotebookDocumentFilter1.canParse(notebookDocumentJson, nullLspJsonReporter)
- ? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t1(
- NotebookDocumentFilter1.fromJson(
- notebookDocumentJson as Map<String, Object?>))
- : (NotebookDocumentFilter2.canParse(notebookDocumentJson, nullLspJsonReporter)
- ? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t2(
- NotebookDocumentFilter2.fromJson(notebookDocumentJson as Map<String, Object?>))
- : (NotebookDocumentFilter3.canParse(notebookDocumentJson, nullLspJsonReporter) ? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t3(NotebookDocumentFilter3.fromJson(notebookDocumentJson as Map<String, Object?>)) : (throw '''$notebookDocumentJson was not one of (NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3)'''))))
- : (notebookDocumentJson is String ? Either2<Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String>.t2(notebookDocumentJson) : (throw '''$notebookDocumentJson was not one of (Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String)'''));
+ NotebookDocumentFilter1.canParse(notebookJson, nullLspJsonReporter)
+ ? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t1(NotebookDocumentFilter1.fromJson(
+ notebookJson as Map<String, Object?>))
+ : (NotebookDocumentFilter2.canParse(notebookJson, nullLspJsonReporter)
+ ? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t2(NotebookDocumentFilter2.fromJson(
+ notebookJson as Map<String, Object?>))
+ : (NotebookDocumentFilter3.canParse(notebookJson, nullLspJsonReporter)
+ ? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t3(NotebookDocumentFilter3.fromJson(notebookJson as Map<String, Object?>))
+ : (throw '''$notebookJson was not one of (NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3)'''))))
+ : (notebookJson is String ? Either2<Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String>.t2(notebookJson) : (throw '''$notebookJson was not one of (Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String)'''));
return NotebookDocumentSyncOptionsNotebookSelector(
cells: cells,
- notebookDocument: notebookDocument,
+ notebook: notebook,
);
}
/// The cells of the matching notebook to be synced.
- final List<NotebookDocumentSyncOptionsCells>? cells;
+ final List<NotebookDocumentSyncOptionsNotebookSelectorCells>? cells;
/// The notebook to be synced If a string value is provided it matches against
/// the notebook type. '*' matches every notebook.
final Either2<
Either3<NotebookDocumentFilter1, NotebookDocumentFilter2,
NotebookDocumentFilter3>,
- String> notebookDocument;
+ String> notebook;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (cells != null) {
result['cells'] = cells?.map((item) => item.toJson()).toList();
}
- result['notebookDocument'] = notebookDocument;
+ result['notebook'] = notebook;
return result;
}
@@ -26779,32 +27205,32 @@
try {
final cells = obj['cells'];
if (cells != null &&
- !((cells is List<Object?> &&
- (cells.every((item) =>
- NotebookDocumentSyncOptionsCells.canParse(
- item, reporter)))))) {
+ (cells is! List<Object?> ||
+ cells.any((item) =>
+ !NotebookDocumentSyncOptionsNotebookSelectorCells.canParse(
+ item, reporter)))) {
reporter.reportError(
- 'must be of type List<NotebookDocumentSyncOptionsCells>');
+ 'must be of type List<NotebookDocumentSyncOptionsNotebookSelectorCells>');
return false;
}
} finally {
reporter.pop();
}
- reporter.push('notebookDocument');
+ reporter.push('notebook');
try {
- if (!obj.containsKey('notebookDocument')) {
+ if (!obj.containsKey('notebook')) {
reporter.reportError('must not be undefined');
return false;
}
- final notebookDocument = obj['notebookDocument'];
- if (notebookDocument == null) {
+ final notebook = obj['notebook'];
+ if (notebook == null) {
reporter.reportError('must not be null');
return false;
}
- if (!(((NotebookDocumentFilter1.canParse(notebookDocument, reporter) ||
- NotebookDocumentFilter2.canParse(notebookDocument, reporter) ||
- NotebookDocumentFilter3.canParse(notebookDocument, reporter)) ||
- notebookDocument is String))) {
+ if (!NotebookDocumentFilter1.canParse(notebook, reporter) &&
+ !NotebookDocumentFilter2.canParse(notebook, reporter) &&
+ !NotebookDocumentFilter3.canParse(notebook, reporter) &&
+ notebook is! String) {
reporter.reportError(
'must be of type Either2<Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String>');
return false;
@@ -26827,10 +27253,10 @@
return listEqual(
cells,
other.cells,
- (NotebookDocumentSyncOptionsCells a,
- NotebookDocumentSyncOptionsCells b) =>
+ (NotebookDocumentSyncOptionsNotebookSelectorCells a,
+ NotebookDocumentSyncOptionsNotebookSelectorCells b) =>
a == b) &&
- notebookDocument == other.notebookDocument &&
+ notebook == other.notebook &&
true;
}
return false;
@@ -26839,7 +27265,7 @@
@override
int get hashCode => Object.hash(
lspHashCode(cells),
- notebookDocument,
+ notebook,
);
@override
@@ -26854,54 +27280,56 @@
NotebookDocumentSyncOptionsNotebookSelector2({
required this.cells,
- this.notebookDocument,
+ this.notebook,
});
static NotebookDocumentSyncOptionsNotebookSelector2 fromJson(
Map<String, Object?> json) {
final cellsJson = json['cells'];
final cells = (cellsJson as List<Object?>)
- .map((item) => NotebookDocumentSyncOptionsCells2.fromJson(
- item as Map<String, Object?>))
+ .map((item) =>
+ NotebookDocumentSyncOptionsNotebookSelector2Cells.fromJson(
+ item as Map<String, Object?>))
.toList();
- final notebookDocumentJson = json['notebookDocument'];
- final notebookDocument = notebookDocumentJson == null
+ final notebookJson = json['notebook'];
+ final notebook = notebookJson == null
? null
- : ((NotebookDocumentFilter1.canParse(notebookDocumentJson, nullLspJsonReporter) ||
+ : (NotebookDocumentFilter1.canParse(notebookJson, nullLspJsonReporter) ||
NotebookDocumentFilter2.canParse(
- notebookDocumentJson, nullLspJsonReporter) ||
+ notebookJson, nullLspJsonReporter) ||
NotebookDocumentFilter3.canParse(
- notebookDocumentJson, nullLspJsonReporter))
+ notebookJson, nullLspJsonReporter)
? Either2<Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String>.t1(
- NotebookDocumentFilter1.canParse(notebookDocumentJson, nullLspJsonReporter)
+ NotebookDocumentFilter1.canParse(notebookJson, nullLspJsonReporter)
? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t1(
NotebookDocumentFilter1.fromJson(
- notebookDocumentJson as Map<String, Object?>))
- : (NotebookDocumentFilter2.canParse(notebookDocumentJson, nullLspJsonReporter)
+ notebookJson as Map<String, Object?>))
+ : (NotebookDocumentFilter2.canParse(notebookJson, nullLspJsonReporter)
? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t2(
- NotebookDocumentFilter2.fromJson(notebookDocumentJson as Map<String, Object?>))
- : (NotebookDocumentFilter3.canParse(notebookDocumentJson, nullLspJsonReporter) ? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t3(NotebookDocumentFilter3.fromJson(notebookDocumentJson as Map<String, Object?>)) : (throw '''$notebookDocumentJson was not one of (NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3)'''))))
- : (notebookDocumentJson is String ? Either2<Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String>.t2(notebookDocumentJson) : (throw '''$notebookDocumentJson was not one of (Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String)''')));
+ NotebookDocumentFilter2.fromJson(notebookJson as Map<String, Object?>))
+ : (NotebookDocumentFilter3.canParse(notebookJson, nullLspJsonReporter) ? Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>.t3(NotebookDocumentFilter3.fromJson(notebookJson as Map<String, Object?>)) : (throw '''$notebookJson was not one of (NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3)'''))))
+ : (notebookJson is String ? Either2<Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String>.t2(notebookJson) : (throw '''$notebookJson was not one of (Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String)''')));
return NotebookDocumentSyncOptionsNotebookSelector2(
cells: cells,
- notebookDocument: notebookDocument,
+ notebook: notebook,
);
}
/// The cells of the matching notebook to be synced.
- final List<NotebookDocumentSyncOptionsCells2> cells;
+ final List<NotebookDocumentSyncOptionsNotebookSelector2Cells> cells;
/// The notebook to be synced If a string value is provided it matches against
/// the notebook type. '*' matches every notebook.
final Either2<
Either3<NotebookDocumentFilter1, NotebookDocumentFilter2,
NotebookDocumentFilter3>,
- String>? notebookDocument;
+ String>? notebook;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['cells'] = cells.map((item) => item.toJson()).toList();
- if (notebookDocument != null) {
- result['notebookDocument'] = notebookDocument;
+ if (notebook != null) {
+ result['notebook'] = notebook;
}
return result;
}
@@ -26919,26 +27347,25 @@
reporter.reportError('must not be null');
return false;
}
- if (!((cells is List<Object?> &&
- (cells.every((item) => NotebookDocumentSyncOptionsCells2.canParse(
- item, reporter)))))) {
+ if (cells is! List<Object?> ||
+ cells.any((item) =>
+ !NotebookDocumentSyncOptionsNotebookSelector2Cells.canParse(
+ item, reporter))) {
reporter.reportError(
- 'must be of type List<NotebookDocumentSyncOptionsCells2>');
+ 'must be of type List<NotebookDocumentSyncOptionsNotebookSelector2Cells>');
return false;
}
} finally {
reporter.pop();
}
- reporter.push('notebookDocument');
+ reporter.push('notebook');
try {
- final notebookDocument = obj['notebookDocument'];
- if (notebookDocument != null &&
- !(((NotebookDocumentFilter1.canParse(notebookDocument, reporter) ||
- NotebookDocumentFilter2.canParse(
- notebookDocument, reporter) ||
- NotebookDocumentFilter3.canParse(
- notebookDocument, reporter)) ||
- notebookDocument is String))) {
+ final notebook = obj['notebook'];
+ if (notebook != null &&
+ !NotebookDocumentFilter1.canParse(notebook, reporter) &&
+ !NotebookDocumentFilter2.canParse(notebook, reporter) &&
+ !NotebookDocumentFilter3.canParse(notebook, reporter) &&
+ notebook is! String) {
reporter.reportError(
'must be of type Either2<Either3<NotebookDocumentFilter1, NotebookDocumentFilter2, NotebookDocumentFilter3>, String>');
return false;
@@ -26961,10 +27388,10 @@
return listEqual(
cells,
other.cells,
- (NotebookDocumentSyncOptionsCells2 a,
- NotebookDocumentSyncOptionsCells2 b) =>
+ (NotebookDocumentSyncOptionsNotebookSelector2Cells a,
+ NotebookDocumentSyncOptionsNotebookSelector2Cells b) =>
a == b) &&
- notebookDocument == other.notebookDocument &&
+ notebook == other.notebook &&
true;
}
return false;
@@ -26973,13 +27400,156 @@
@override
int get hashCode => Object.hash(
lspHashCode(cells),
- notebookDocument,
+ notebook,
);
@override
String toString() => jsonEncoder.convert(toJson());
}
+class NotebookDocumentSyncOptionsNotebookSelector2Cells implements ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ NotebookDocumentSyncOptionsNotebookSelector2Cells.canParse,
+ NotebookDocumentSyncOptionsNotebookSelector2Cells.fromJson,
+ );
+
+ NotebookDocumentSyncOptionsNotebookSelector2Cells({
+ required this.language,
+ });
+ static NotebookDocumentSyncOptionsNotebookSelector2Cells fromJson(
+ Map<String, Object?> json) {
+ final languageJson = json['language'];
+ final language = languageJson as String;
+ return NotebookDocumentSyncOptionsNotebookSelector2Cells(
+ language: language,
+ );
+ }
+
+ final String language;
+
+ @override
+ Map<String, Object?> toJson() {
+ var result = <String, Object?>{};
+ result['language'] = language;
+ return result;
+ }
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ reporter.push('language');
+ try {
+ if (!obj.containsKey('language')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final language = obj['language'];
+ if (language == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (language is! String) {
+ reporter.reportError('must be of type String');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ return true;
+ } else {
+ reporter.reportError(
+ 'must be of type NotebookDocumentSyncOptionsNotebookSelector2Cells');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is NotebookDocumentSyncOptionsNotebookSelector2Cells &&
+ other.runtimeType ==
+ NotebookDocumentSyncOptionsNotebookSelector2Cells) {
+ return language == other.language && true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => language.hashCode;
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
+class NotebookDocumentSyncOptionsNotebookSelectorCells implements ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ NotebookDocumentSyncOptionsNotebookSelectorCells.canParse,
+ NotebookDocumentSyncOptionsNotebookSelectorCells.fromJson,
+ );
+
+ NotebookDocumentSyncOptionsNotebookSelectorCells({
+ required this.language,
+ });
+ static NotebookDocumentSyncOptionsNotebookSelectorCells fromJson(
+ Map<String, Object?> json) {
+ final languageJson = json['language'];
+ final language = languageJson as String;
+ return NotebookDocumentSyncOptionsNotebookSelectorCells(
+ language: language,
+ );
+ }
+
+ final String language;
+
+ @override
+ Map<String, Object?> toJson() {
+ var result = <String, Object?>{};
+ result['language'] = language;
+ return result;
+ }
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ reporter.push('language');
+ try {
+ if (!obj.containsKey('language')) {
+ reporter.reportError('must not be undefined');
+ return false;
+ }
+ final language = obj['language'];
+ if (language == null) {
+ reporter.reportError('must not be null');
+ return false;
+ }
+ if (language is! String) {
+ reporter.reportError('must be of type String');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ return true;
+ } else {
+ reporter.reportError(
+ 'must be of type NotebookDocumentSyncOptionsNotebookSelectorCells');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is NotebookDocumentSyncOptionsNotebookSelectorCells &&
+ other.runtimeType == NotebookDocumentSyncOptionsNotebookSelectorCells) {
+ return language == other.language && true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => language.hashCode;
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
/// Registration options specific to a notebook.
/// @since 3.17.0
class NotebookDocumentSyncRegistrationOptions
@@ -27025,17 +27595,21 @@
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
/// The notebooks to be synced
+ @override
final List<
Either2<NotebookDocumentSyncOptionsNotebookSelector,
NotebookDocumentSyncOptionsNotebookSelector2>> notebookSelector;
/// Whether save notification should be forwarded to the server. Will only be
/// honored if mode === `notebook`.
+ @override
final bool? save;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (id != null) {
@@ -27053,7 +27627,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -27071,12 +27645,12 @@
reporter.reportError('must not be null');
return false;
}
- if (!((notebookSelector is List<Object?> &&
- (notebookSelector.every((item) =>
- (NotebookDocumentSyncOptionsNotebookSelector.canParse(
- item, reporter) ||
- NotebookDocumentSyncOptionsNotebookSelector2.canParse(
- item, reporter))))))) {
+ if (notebookSelector is! List<Object?> ||
+ notebookSelector.any((item) =>
+ !NotebookDocumentSyncOptionsNotebookSelector.canParse(
+ item, reporter) &&
+ !NotebookDocumentSyncOptionsNotebookSelector2.canParse(
+ item, reporter))) {
reporter.reportError(
'must be of type List<Either2<NotebookDocumentSyncOptionsNotebookSelector, NotebookDocumentSyncOptionsNotebookSelector2>>');
return false;
@@ -27087,7 +27661,7 @@
reporter.push('save');
try {
final save = obj['save'];
- if (save != null && !(save is bool)) {
+ if (save != null && save is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -27158,6 +27732,7 @@
}
/// The text document's URI.
+ @override
final String uri;
/// The version number of this document. If an optional versioned text
@@ -27171,6 +27746,7 @@
/// including undo/redo. The number doesn't need to be consecutive.
final int? version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['uri'] = uri;
@@ -27191,7 +27767,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -27205,7 +27781,7 @@
return false;
}
final version = obj['version'];
- if (version != null && !(version is int)) {
+ if (version != null && version is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -27285,6 +27861,7 @@
/// part in the `SignatureInformation.label`.
final String label;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (documentation != null) {
@@ -27300,8 +27877,8 @@
try {
final documentation = obj['documentation'];
if (documentation != null &&
- !((MarkupContent.canParse(documentation, reporter) ||
- documentation is String))) {
+ !MarkupContent.canParse(documentation, reporter) &&
+ documentation is! String) {
reporter
.reportError('must be of type Either2<MarkupContent, String>');
return false;
@@ -27320,7 +27897,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(label is String)) {
+ if (label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -27460,6 +28037,7 @@
/// streaming) to the client.
final Either2<int, String>? partialResultToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -27474,7 +28052,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -27528,6 +28107,7 @@
final String placeholder;
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['placeholder'] = placeholder;
@@ -27548,7 +28128,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(placeholder is String)) {
+ if (placeholder is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -27566,7 +28146,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -27630,6 +28210,7 @@
/// Line position in a document (zero-based).
final int line;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['character'] = character;
@@ -27650,7 +28231,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(character is int)) {
+ if (character is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -27668,7 +28249,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(line is int)) {
+ if (line is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -27727,6 +28308,7 @@
/// Character offsets count UTF-8 code units.
static const UTF8 = PositionEncodingKind('utf-8');
+ @override
Object toJson() => _value;
@override
@@ -27735,11 +28317,13 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is PositionEncodingKind && other._value == _value;
}
-class PrepareRenameParams implements TextDocumentPositionParams, ToJsonable {
+class PrepareRenameParams
+ implements TextDocumentPositionParams, WorkDoneProgressParams, ToJsonable {
static const jsonHandler = LspJsonHandler(
PrepareRenameParams.canParse,
PrepareRenameParams.fromJson,
@@ -27748,6 +28332,7 @@
PrepareRenameParams({
required this.position,
required this.textDocument,
+ this.workDoneToken,
});
static PrepareRenameParams fromJson(Map<String, Object?> json) {
final positionJson = json['position'];
@@ -27755,22 +28340,41 @@
final textDocumentJson = json['textDocument'];
final textDocument = TextDocumentIdentifier.fromJson(
textDocumentJson as Map<String, Object?>);
+ final workDoneTokenJson = json['workDoneToken'];
+ final workDoneToken = workDoneTokenJson == null
+ ? null
+ : (workDoneTokenJson is int
+ ? Either2<int, String>.t1(workDoneTokenJson)
+ : (workDoneTokenJson is String
+ ? Either2<int, String>.t2(workDoneTokenJson)
+ : (throw '''$workDoneTokenJson was not one of (int, String)''')));
return PrepareRenameParams(
position: position,
textDocument: textDocument,
+ workDoneToken: workDoneToken,
);
}
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
+ /// An optional token that a server can use to report work done progress.
+ @override
+ final Either2<int, String>? workDoneToken;
+
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['position'] = position.toJson();
result['textDocument'] = textDocument.toJson();
+ if (workDoneToken != null) {
+ result['workDoneToken'] = workDoneToken;
+ }
return result;
}
@@ -27787,7 +28391,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -27805,13 +28409,25 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
} finally {
reporter.pop();
}
+ reporter.push('workDoneToken');
+ try {
+ final workDoneToken = obj['workDoneToken'];
+ if (workDoneToken != null &&
+ workDoneToken is! int &&
+ workDoneToken is! String) {
+ reporter.reportError('must be of type Either2<int, String>');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
return true;
} else {
reporter.reportError('must be of type PrepareRenameParams');
@@ -27825,6 +28441,7 @@
other.runtimeType == PrepareRenameParams) {
return position == other.position &&
textDocument == other.textDocument &&
+ workDoneToken == other.workDoneToken &&
true;
}
return false;
@@ -27834,6 +28451,7 @@
int get hashCode => Object.hash(
position,
textDocument,
+ workDoneToken,
);
@override
@@ -27850,10 +28468,11 @@
return obj is int;
}
- /// The client's default behavior is to select the identifier according the to
+ /// The client's default behavior is to select the identifier according to the
/// language's syntax rule.
static const Identifier = PrepareSupportDefaultBehavior(1);
+ @override
Object toJson() => _value;
@override
@@ -27862,6 +28481,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is PrepareSupportDefaultBehavior && other._value == _value;
}
@@ -27895,6 +28515,7 @@
/// The value of the previous result id.
final String value;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['uri'] = uri;
@@ -27915,7 +28536,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -27933,7 +28554,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(value is String)) {
+ if (value is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -27996,6 +28617,7 @@
/// The progress data.
final Object? value;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['token'] = token;
@@ -28016,7 +28638,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((token is int || token is String))) {
+ if (token is! int && token is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -28108,6 +28730,7 @@
/// @since 3.15.0
final bool? versionSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (codeDescriptionSupport != null) {
@@ -28133,8 +28756,7 @@
reporter.push('codeDescriptionSupport');
try {
final codeDescriptionSupport = obj['codeDescriptionSupport'];
- if (codeDescriptionSupport != null &&
- !(codeDescriptionSupport is bool)) {
+ if (codeDescriptionSupport != null && codeDescriptionSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -28144,7 +28766,7 @@
reporter.push('dataSupport');
try {
final dataSupport = obj['dataSupport'];
- if (dataSupport != null && !(dataSupport is bool)) {
+ if (dataSupport != null && dataSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -28154,7 +28776,7 @@
reporter.push('relatedInformation');
try {
final relatedInformation = obj['relatedInformation'];
- if (relatedInformation != null && !(relatedInformation is bool)) {
+ if (relatedInformation != null && relatedInformation is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -28165,8 +28787,8 @@
try {
final tagSupport = obj['tagSupport'];
if (tagSupport != null &&
- !(PublishDiagnosticsClientCapabilitiesTagSupport.canParse(
- tagSupport, reporter))) {
+ !PublishDiagnosticsClientCapabilitiesTagSupport.canParse(
+ tagSupport, reporter)) {
reporter.reportError(
'must be of type PublishDiagnosticsClientCapabilitiesTagSupport');
return false;
@@ -28177,7 +28799,7 @@
reporter.push('versionSupport');
try {
final versionSupport = obj['versionSupport'];
- if (versionSupport != null && !(versionSupport is bool)) {
+ if (versionSupport != null && versionSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -28242,6 +28864,7 @@
/// The tags supported by the client.
final List<DiagnosticTag> valueSet;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
@@ -28261,9 +28884,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List<Object?> &&
- (valueSet
- .every((item) => DiagnosticTag.canParse(item, reporter)))))) {
+ if (valueSet is! List<Object?> ||
+ valueSet.any((item) => !DiagnosticTag.canParse(item, reporter))) {
reporter.reportError('must be of type List<DiagnosticTag>');
return false;
}
@@ -28334,6 +28956,7 @@
/// @since 3.15.0
final int? version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['diagnostics'] = diagnostics.map((item) => item.toJson()).toList();
@@ -28357,9 +28980,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((diagnostics is List<Object?> &&
- (diagnostics
- .every((item) => Diagnostic.canParse(item, reporter)))))) {
+ if (diagnostics is! List<Object?> ||
+ diagnostics.any((item) => !Diagnostic.canParse(item, reporter))) {
reporter.reportError('must be of type List<Diagnostic>');
return false;
}
@@ -28377,7 +28999,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -28387,7 +29009,7 @@
reporter.push('version');
try {
final version = obj['version'];
- if (version != null && !(version is int)) {
+ if (version != null && version is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -28452,6 +29074,7 @@
/// The range's start position.
final Position start;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['end'] = end.toJson();
@@ -28472,7 +29095,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(end, reporter))) {
+ if (!Position.canParse(end, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -28490,7 +29113,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(start, reporter))) {
+ if (!Position.canParse(start, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -28542,6 +29165,7 @@
/// Whether references supports dynamic registration.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -28555,7 +29179,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -28605,6 +29229,7 @@
/// Include the declaration of the current symbol.
final bool includeDeclaration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['includeDeclaration'] = includeDeclaration;
@@ -28624,7 +29249,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(includeDeclaration is bool)) {
+ if (includeDeclaration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -28673,8 +29298,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -28688,7 +29315,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -28773,17 +29400,22 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['context'] = context.toJson();
@@ -28811,7 +29443,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(ReferenceContext.canParse(context, reporter))) {
+ if (!ReferenceContext.canParse(context, reporter)) {
reporter.reportError('must be of type ReferenceContext');
return false;
}
@@ -28822,7 +29454,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -28840,7 +29473,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -28858,7 +29491,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -28869,7 +29502,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -28923,8 +29557,8 @@
static ReferenceRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final workDoneProgressJson = json['workDoneProgress'];
final workDoneProgress = workDoneProgressJson as bool?;
@@ -28936,9 +29570,12 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -28958,10 +29595,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -28970,7 +29608,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -28988,8 +29626,12 @@
bool operator ==(Object other) {
if (other is ReferenceRegistrationOptions &&
other.runtimeType == ReferenceRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
workDoneProgress == other.workDoneProgress &&
true;
}
@@ -29042,6 +29684,7 @@
/// Options necessary for the registration.
final Object? registerOptions;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['id'] = id;
@@ -29065,7 +29708,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(id is String)) {
+ if (id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -29083,7 +29726,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(method is String)) {
+ if (method is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -29140,6 +29783,7 @@
final List<Registration> registrations;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['registrations'] =
@@ -29160,9 +29804,9 @@
reporter.reportError('must not be null');
return false;
}
- if (!((registrations is List<Object?> &&
- (registrations
- .every((item) => Registration.canParse(item, reporter)))))) {
+ if (registrations is! List<Object?> ||
+ registrations
+ .any((item) => !Registration.canParse(item, reporter))) {
reporter.reportError('must be of type List<Registration>');
return false;
}
@@ -29223,6 +29867,7 @@
/// The engine's version.
final String? version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['engine'] = engine;
@@ -29245,7 +29890,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(engine is String)) {
+ if (engine is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -29255,7 +29900,7 @@
reporter.push('version');
try {
final version = obj['version'];
- if (version != null && !(version is String)) {
+ if (version != null && version is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -29341,9 +29986,11 @@
}
/// The actual items.
+ @override
final List<Diagnostic> items;
/// A full document diagnostic report.
+ @override
final String kind;
/// Diagnostics of related documents. This information is useful in
@@ -29359,8 +30006,10 @@
/// An optional result id. If provided it will be sent on the next diagnostic
/// request for the same document.
+ @override
final String? resultId;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['items'] = items.map((item) => item.toJson()).toList();
@@ -29387,8 +30036,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((items is List<Object?> &&
- (items.every((item) => Diagnostic.canParse(item, reporter)))))) {
+ if (items is! List<Object?> ||
+ items.any((item) => !Diagnostic.canParse(item, reporter))) {
reporter.reportError('must be of type List<Diagnostic>');
return false;
}
@@ -29406,7 +30055,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'full')) {
+ if (kind != 'full') {
reporter.reportError('must be the literal \'full\'');
return false;
}
@@ -29417,14 +30066,14 @@
try {
final relatedDocuments = obj['relatedDocuments'];
if (relatedDocuments != null &&
- !((relatedDocuments is Map &&
- (relatedDocuments.keys.every((item) =>
- item is String &&
- relatedDocuments.values.every((item) =>
- (FullDocumentDiagnosticReport.canParse(
- item, reporter) ||
- UnchangedDocumentDiagnosticReport.canParse(
- item, reporter)))))))) {
+ (relatedDocuments is! Map ||
+ (relatedDocuments.keys.any((item) =>
+ item is! String ||
+ relatedDocuments.values.any((item) =>
+ !FullDocumentDiagnosticReport.canParse(
+ item, reporter) &&
+ !UnchangedDocumentDiagnosticReport.canParse(
+ item, reporter)))))) {
reporter.reportError(
'must be of type Map<String, Either2<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>');
return false;
@@ -29435,7 +30084,7 @@
reporter.push('resultId');
try {
final resultId = obj['resultId'];
- if (resultId != null && !(resultId is String)) {
+ if (resultId != null && resultId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -29532,6 +30181,7 @@
/// A document diagnostic report indicating no changes to the last result. A
/// server can only return `unchanged` if result ids are provided.
+ @override
final String kind;
/// Diagnostics of related documents. This information is useful in
@@ -29547,8 +30197,10 @@
/// A result id which will be sent on the next diagnostic request for the same
/// document.
+ @override
final String resultId;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['kind'] = kind;
@@ -29572,7 +30224,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'unchanged')) {
+ if (kind != 'unchanged') {
reporter.reportError('must be the literal \'unchanged\'');
return false;
}
@@ -29583,14 +30235,14 @@
try {
final relatedDocuments = obj['relatedDocuments'];
if (relatedDocuments != null &&
- !((relatedDocuments is Map &&
- (relatedDocuments.keys.every((item) =>
- item is String &&
- relatedDocuments.values.every((item) =>
- (FullDocumentDiagnosticReport.canParse(
- item, reporter) ||
- UnchangedDocumentDiagnosticReport.canParse(
- item, reporter)))))))) {
+ (relatedDocuments is! Map ||
+ (relatedDocuments.keys.any((item) =>
+ item is! String ||
+ relatedDocuments.values.any((item) =>
+ !FullDocumentDiagnosticReport.canParse(
+ item, reporter) &&
+ !UnchangedDocumentDiagnosticReport.canParse(
+ item, reporter)))))) {
reporter.reportError(
'must be of type Map<String, Either2<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>');
return false;
@@ -29609,7 +30261,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(resultId is String)) {
+ if (resultId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -29693,6 +30345,7 @@
/// The actual glob pattern;
final String pattern;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['baseUri'] = baseUri;
@@ -29713,8 +30366,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((baseUri is String ||
- WorkspaceFolder.canParse(baseUri, reporter)))) {
+ if (baseUri is! String &&
+ !WorkspaceFolder.canParse(baseUri, reporter)) {
reporter
.reportError('must be of type Either2<String, WorkspaceFolder>');
return false;
@@ -29733,7 +30386,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(pattern is String)) {
+ if (pattern is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -29821,6 +30474,7 @@
/// @since version 3.16.0
final PrepareSupportDefaultBehavior? prepareSupportDefaultBehavior;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -29844,7 +30498,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -29855,7 +30509,7 @@
try {
final honorsChangeAnnotations = obj['honorsChangeAnnotations'];
if (honorsChangeAnnotations != null &&
- !(honorsChangeAnnotations is bool)) {
+ honorsChangeAnnotations is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -29865,7 +30519,7 @@
reporter.push('prepareSupport');
try {
final prepareSupport = obj['prepareSupport'];
- if (prepareSupport != null && !(prepareSupport is bool)) {
+ if (prepareSupport != null && prepareSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -29877,8 +30531,8 @@
final prepareSupportDefaultBehavior =
obj['prepareSupportDefaultBehavior'];
if (prepareSupportDefaultBehavior != null &&
- !(PrepareSupportDefaultBehavior.canParse(
- prepareSupportDefaultBehavior, reporter))) {
+ !PrepareSupportDefaultBehavior.canParse(
+ prepareSupportDefaultBehavior, reporter)) {
reporter.reportError('must be of type PrepareSupportDefaultBehavior');
return false;
}
@@ -29974,6 +30628,7 @@
/// Rename options.
final RenameFileOptions? options;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (annotationId != null) {
@@ -29993,7 +30648,7 @@
reporter.push('annotationId');
try {
final annotationId = obj['annotationId'];
- if (annotationId != null && !(annotationId is String)) {
+ if (annotationId != null && annotationId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -30011,7 +30666,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'rename')) {
+ if (kind != 'rename') {
reporter.reportError('must be the literal \'rename\'');
return false;
}
@@ -30029,7 +30684,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(newUri is String)) {
+ if (newUri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -30047,7 +30702,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(oldUri is String)) {
+ if (oldUri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -30057,8 +30712,7 @@
reporter.push('options');
try {
final options = obj['options'];
- if (options != null &&
- !(RenameFileOptions.canParse(options, reporter))) {
+ if (options != null && !RenameFileOptions.canParse(options, reporter)) {
reporter.reportError('must be of type RenameFileOptions');
return false;
}
@@ -30126,6 +30780,7 @@
/// Overwrite target if existing. Overwrite wins over `ignoreIfExists`
final bool? overwrite;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (ignoreIfExists != null) {
@@ -30142,7 +30797,7 @@
reporter.push('ignoreIfExists');
try {
final ignoreIfExists = obj['ignoreIfExists'];
- if (ignoreIfExists != null && !(ignoreIfExists is bool)) {
+ if (ignoreIfExists != null && ignoreIfExists is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -30152,7 +30807,7 @@
reporter.push('overwrite');
try {
final overwrite = obj['overwrite'];
- if (overwrite != null && !(overwrite is bool)) {
+ if (overwrite != null && overwrite is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -30212,6 +30867,7 @@
/// renamed, only the folder will be included, and not its children.
final List<FileRename> files;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['files'] = files.map((item) => item.toJson()).toList();
@@ -30231,8 +30887,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((files is List<Object?> &&
- (files.every((item) => FileRename.canParse(item, reporter)))))) {
+ if (files is! List<Object?> ||
+ files.any((item) => !FileRename.canParse(item, reporter))) {
reporter.reportError('must be of type List<FileRename>');
return false;
}
@@ -30289,8 +30945,10 @@
/// Renames should be checked and tested before being executed.
final bool? prepareProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (prepareProvider != null) {
@@ -30307,7 +30965,7 @@
reporter.push('prepareProvider');
try {
final prepareProvider = obj['prepareProvider'];
- if (prepareProvider != null && !(prepareProvider is bool)) {
+ if (prepareProvider != null && prepareProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -30317,7 +30975,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -30393,14 +31051,18 @@
final String newName;
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['newName'] = newName;
@@ -30425,7 +31087,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(newName is String)) {
+ if (newName is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -30443,7 +31105,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -30461,7 +31123,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -30472,7 +31134,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -30525,8 +31188,8 @@
static RenameRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final prepareProviderJson = json['prepareProvider'];
final prepareProvider = prepareProviderJson as bool?;
@@ -30541,12 +31204,16 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// Renames should be checked and tested before being executed.
+ @override
final bool? prepareProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -30569,10 +31236,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -30581,7 +31249,7 @@
reporter.push('prepareProvider');
try {
final prepareProvider = obj['prepareProvider'];
- if (prepareProvider != null && !(prepareProvider is bool)) {
+ if (prepareProvider != null && prepareProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -30591,7 +31259,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -30609,8 +31277,12 @@
bool operator ==(Object other) {
if (other is RenameRegistrationOptions &&
other.runtimeType == RenameRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
prepareProvider == other.prepareProvider &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -30654,6 +31326,7 @@
/// Supports renaming existing files and folders.
static const Rename = ResourceOperationKind._('rename');
+ @override
Object toJson() => _value;
@override
@@ -30662,6 +31335,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is ResourceOperationKind && other._value == _value;
}
@@ -30686,6 +31360,7 @@
/// The client is supposed to include the content on save.
final bool? includeText;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (includeText != null) {
@@ -30699,7 +31374,7 @@
reporter.push('includeText');
try {
final includeText = obj['includeText'];
- if (includeText != null && !(includeText is bool)) {
+ if (includeText != null && includeText is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -30758,6 +31433,7 @@
/// The range ([Range]) of this selection range.
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (parent != null) {
@@ -30772,7 +31448,7 @@
reporter.push('parent');
try {
final parent = obj['parent'];
- if (parent != null && !(SelectionRange.canParse(parent, reporter))) {
+ if (parent != null && !SelectionRange.canParse(parent, reporter)) {
reporter.reportError('must be of type SelectionRange');
return false;
}
@@ -30790,7 +31466,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -30845,6 +31521,7 @@
/// server capability as well.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -30858,7 +31535,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -30908,8 +31585,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -30923,7 +31602,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -31000,6 +31679,7 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The positions inside the text document.
@@ -31009,8 +31689,10 @@
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -31030,7 +31712,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -31048,8 +31731,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((positions is List<Object?> &&
- (positions.every((item) => Position.canParse(item, reporter)))))) {
+ if (positions is! List<Object?> ||
+ positions.any((item) => !Position.canParse(item, reporter))) {
reporter.reportError('must be of type List<Position>');
return false;
}
@@ -31067,7 +31750,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -31078,7 +31761,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -31137,8 +31821,8 @@
static SelectionRangeRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -31153,13 +31837,17 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -31182,10 +31870,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -31194,7 +31883,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -31204,7 +31893,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -31222,8 +31911,12 @@
bool operator ==(Object other) {
if (other is SelectionRangeRegistrationOptions &&
other.runtimeType == SelectionRangeRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -31263,6 +31956,7 @@
static const readonly = SemanticTokenModifiers('readonly');
static const static = SemanticTokenModifiers('static');
+ @override
Object toJson() => _value;
@override
@@ -31271,6 +31965,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is SemanticTokenModifiers && other._value == _value;
}
@@ -31287,6 +31982,9 @@
static const class_ = SemanticTokenTypes('class');
static const comment = SemanticTokenTypes('comment');
+
+ /// @since 3.17.0
+ static const decorator = SemanticTokenTypes('decorator');
static const enum_ = SemanticTokenTypes('enum');
static const enumMember = SemanticTokenTypes('enumMember');
static const event = SemanticTokenTypes('event');
@@ -31311,6 +32009,7 @@
static const typeParameter = SemanticTokenTypes('typeParameter');
static const variable = SemanticTokenTypes('variable');
+ @override
Object toJson() => _value;
@override
@@ -31319,6 +32018,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is SemanticTokenTypes && other._value == _value;
}
@@ -31354,6 +32054,7 @@
/// a delta.
final String? resultId;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['data'] = data;
@@ -31376,7 +32077,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((data is List<Object?> && (data.every((item) => item is int))))) {
+ if (data is! List<Object?> || data.any((item) => item is! int)) {
reporter.reportError('must be of type List<int>');
return false;
}
@@ -31386,7 +32087,7 @@
reporter.push('resultId');
try {
final resultId = obj['resultId'];
- if (resultId != null && !(resultId is String)) {
+ if (resultId != null && resultId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -31522,6 +32223,7 @@
/// The token types that the client supports.
final List<String> tokenTypes;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (augmentsSyntaxTokens != null) {
@@ -31551,7 +32253,7 @@
reporter.push('augmentsSyntaxTokens');
try {
final augmentsSyntaxTokens = obj['augmentsSyntaxTokens'];
- if (augmentsSyntaxTokens != null && !(augmentsSyntaxTokens is bool)) {
+ if (augmentsSyntaxTokens != null && augmentsSyntaxTokens is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -31561,7 +32263,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -31579,8 +32281,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((formats is List<Object?> &&
- (formats.every((item) => TokenFormat.canParse(item, reporter)))))) {
+ if (formats is! List<Object?> ||
+ formats.any((item) => !TokenFormat.canParse(item, reporter))) {
reporter.reportError('must be of type List<TokenFormat>');
return false;
}
@@ -31590,7 +32292,7 @@
reporter.push('multilineTokenSupport');
try {
final multilineTokenSupport = obj['multilineTokenSupport'];
- if (multilineTokenSupport != null && !(multilineTokenSupport is bool)) {
+ if (multilineTokenSupport != null && multilineTokenSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -31601,7 +32303,7 @@
try {
final overlappingTokenSupport = obj['overlappingTokenSupport'];
if (overlappingTokenSupport != null &&
- !(overlappingTokenSupport is bool)) {
+ overlappingTokenSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -31619,8 +32321,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!(SemanticTokensClientCapabilitiesRequests.canParse(
- requests, reporter))) {
+ if (!SemanticTokensClientCapabilitiesRequests.canParse(
+ requests, reporter)) {
reporter.reportError(
'must be of type SemanticTokensClientCapabilitiesRequests');
return false;
@@ -31631,7 +32333,7 @@
reporter.push('serverCancelSupport');
try {
final serverCancelSupport = obj['serverCancelSupport'];
- if (serverCancelSupport != null && !(serverCancelSupport is bool)) {
+ if (serverCancelSupport != null && serverCancelSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -31649,8 +32351,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((tokenModifiers is List<Object?> &&
- (tokenModifiers.every((item) => item is String))))) {
+ if (tokenModifiers is! List<Object?> ||
+ tokenModifiers.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -31668,8 +32370,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((tokenTypes is List<Object?> &&
- (tokenTypes.every((item) => item is String))))) {
+ if (tokenTypes is! List<Object?> ||
+ tokenTypes.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -31721,114 +32423,6 @@
String toString() => jsonEncoder.convert(toJson());
}
-class SemanticTokensClientCapabilitiesFull implements ToJsonable {
- static const jsonHandler = LspJsonHandler(
- SemanticTokensClientCapabilitiesFull.canParse,
- SemanticTokensClientCapabilitiesFull.fromJson,
- );
-
- SemanticTokensClientCapabilitiesFull({
- this.delta,
- });
- static SemanticTokensClientCapabilitiesFull fromJson(
- Map<String, Object?> json) {
- final deltaJson = json['delta'];
- final delta = deltaJson as bool?;
- return SemanticTokensClientCapabilitiesFull(
- delta: delta,
- );
- }
-
- /// The client will send the `textDocument/semanticTokens/full/delta` request
- /// if the server provides a corresponding handler.
- final bool? delta;
-
- Map<String, Object?> toJson() {
- var result = <String, Object?>{};
- if (delta != null) {
- result['delta'] = delta;
- }
- return result;
- }
-
- static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, Object?>) {
- reporter.push('delta');
- try {
- final delta = obj['delta'];
- if (delta != null && !(delta is bool)) {
- reporter.reportError('must be of type bool');
- return false;
- }
- } finally {
- reporter.pop();
- }
- return true;
- } else {
- reporter
- .reportError('must be of type SemanticTokensClientCapabilitiesFull');
- return false;
- }
- }
-
- @override
- bool operator ==(Object other) {
- if (other is SemanticTokensClientCapabilitiesFull &&
- other.runtimeType == SemanticTokensClientCapabilitiesFull) {
- return delta == other.delta && true;
- }
- return false;
- }
-
- @override
- int get hashCode => delta.hashCode;
-
- @override
- String toString() => jsonEncoder.convert(toJson());
-}
-
-class SemanticTokensClientCapabilitiesRange implements ToJsonable {
- static const jsonHandler = LspJsonHandler(
- SemanticTokensClientCapabilitiesRange.canParse,
- SemanticTokensClientCapabilitiesRange.fromJson,
- );
-
- static SemanticTokensClientCapabilitiesRange fromJson(
- Map<String, Object?> json) {
- return SemanticTokensClientCapabilitiesRange();
- }
-
- Map<String, Object?> toJson() {
- var result = <String, Object?>{};
- return result;
- }
-
- static bool canParse(Object? obj, LspJsonReporter reporter) {
- if (obj is Map<String, Object?>) {
- return true;
- } else {
- reporter
- .reportError('must be of type SemanticTokensClientCapabilitiesRange');
- return false;
- }
- }
-
- @override
- bool operator ==(Object other) {
- if (other is SemanticTokensClientCapabilitiesRange &&
- other.runtimeType == SemanticTokensClientCapabilitiesRange) {
- return true;
- }
- return false;
- }
-
- @override
- int get hashCode => 42;
-
- @override
- String toString() => jsonEncoder.convert(toJson());
-}
-
class SemanticTokensClientCapabilitiesRequests implements ToJsonable {
static const jsonHandler = LspJsonHandler(
SemanticTokensClientCapabilitiesRequests.canParse,
@@ -31845,24 +32439,28 @@
final full = fullJson == null
? null
: (fullJson is bool
- ? Either2<bool, SemanticTokensClientCapabilitiesFull>.t1(fullJson)
- : (SemanticTokensClientCapabilitiesFull.canParse(
+ ? Either2<bool, SemanticTokensClientCapabilitiesRequestsFull>.t1(
+ fullJson)
+ : (SemanticTokensClientCapabilitiesRequestsFull.canParse(
fullJson, nullLspJsonReporter)
- ? Either2<bool, SemanticTokensClientCapabilitiesFull>.t2(
- SemanticTokensClientCapabilitiesFull.fromJson(
+ ? Either2<bool,
+ SemanticTokensClientCapabilitiesRequestsFull>.t2(
+ SemanticTokensClientCapabilitiesRequestsFull.fromJson(
fullJson as Map<String, Object?>))
- : (throw '''$fullJson was not one of (bool, SemanticTokensClientCapabilitiesFull)''')));
+ : (throw '''$fullJson was not one of (bool, SemanticTokensClientCapabilitiesRequestsFull)''')));
final rangeJson = json['range'];
final range = rangeJson == null
? null
: (rangeJson is bool
- ? Either2<bool, SemanticTokensClientCapabilitiesRange>.t1(rangeJson)
- : (SemanticTokensClientCapabilitiesRange.canParse(
+ ? Either2<bool, SemanticTokensClientCapabilitiesRequestsRange>.t1(
+ rangeJson)
+ : (SemanticTokensClientCapabilitiesRequestsRange.canParse(
rangeJson, nullLspJsonReporter)
- ? Either2<bool, SemanticTokensClientCapabilitiesRange>.t2(
- SemanticTokensClientCapabilitiesRange.fromJson(
+ ? Either2<bool,
+ SemanticTokensClientCapabilitiesRequestsRange>.t2(
+ SemanticTokensClientCapabilitiesRequestsRange.fromJson(
rangeJson as Map<String, Object?>))
- : (throw '''$rangeJson was not one of (bool, SemanticTokensClientCapabilitiesRange)''')));
+ : (throw '''$rangeJson was not one of (bool, SemanticTokensClientCapabilitiesRequestsRange)''')));
return SemanticTokensClientCapabilitiesRequests(
full: full,
range: range,
@@ -31871,12 +32469,13 @@
/// The client will send the `textDocument/semanticTokens/full` request if the
/// server provides a corresponding handler.
- final Either2<bool, SemanticTokensClientCapabilitiesFull>? full;
+ final Either2<bool, SemanticTokensClientCapabilitiesRequestsFull>? full;
/// The client will send the `textDocument/semanticTokens/range` request if
/// the server provides a corresponding handler.
- final Either2<bool, SemanticTokensClientCapabilitiesRange>? range;
+ final Either2<bool, SemanticTokensClientCapabilitiesRequestsRange>? range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (full != null) {
@@ -31894,11 +32493,11 @@
try {
final full = obj['full'];
if (full != null &&
- !((full is bool ||
- SemanticTokensClientCapabilitiesFull.canParse(
- full, reporter)))) {
+ full is! bool &&
+ !SemanticTokensClientCapabilitiesRequestsFull.canParse(
+ full, reporter)) {
reporter.reportError(
- 'must be of type Either2<bool, SemanticTokensClientCapabilitiesFull>');
+ 'must be of type Either2<bool, SemanticTokensClientCapabilitiesRequestsFull>');
return false;
}
} finally {
@@ -31908,11 +32507,11 @@
try {
final range = obj['range'];
if (range != null &&
- !((range is bool ||
- SemanticTokensClientCapabilitiesRange.canParse(
- range, reporter)))) {
+ range is! bool &&
+ !SemanticTokensClientCapabilitiesRequestsRange.canParse(
+ range, reporter)) {
reporter.reportError(
- 'must be of type Either2<bool, SemanticTokensClientCapabilitiesRange>');
+ 'must be of type Either2<bool, SemanticTokensClientCapabilitiesRequestsRange>');
return false;
}
} finally {
@@ -31945,6 +32544,113 @@
String toString() => jsonEncoder.convert(toJson());
}
+class SemanticTokensClientCapabilitiesRequestsFull implements ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ SemanticTokensClientCapabilitiesRequestsFull.canParse,
+ SemanticTokensClientCapabilitiesRequestsFull.fromJson,
+ );
+
+ SemanticTokensClientCapabilitiesRequestsFull({
+ this.delta,
+ });
+ static SemanticTokensClientCapabilitiesRequestsFull fromJson(
+ Map<String, Object?> json) {
+ final deltaJson = json['delta'];
+ final delta = deltaJson as bool?;
+ return SemanticTokensClientCapabilitiesRequestsFull(
+ delta: delta,
+ );
+ }
+
+ /// The client will send the `textDocument/semanticTokens/full/delta` request
+ /// if the server provides a corresponding handler.
+ final bool? delta;
+
+ @override
+ Map<String, Object?> toJson() {
+ var result = <String, Object?>{};
+ if (delta != null) {
+ result['delta'] = delta;
+ }
+ return result;
+ }
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ reporter.push('delta');
+ try {
+ final delta = obj['delta'];
+ if (delta != null && delta is! bool) {
+ reporter.reportError('must be of type bool');
+ return false;
+ }
+ } finally {
+ reporter.pop();
+ }
+ return true;
+ } else {
+ reporter.reportError(
+ 'must be of type SemanticTokensClientCapabilitiesRequestsFull');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is SemanticTokensClientCapabilitiesRequestsFull &&
+ other.runtimeType == SemanticTokensClientCapabilitiesRequestsFull) {
+ return delta == other.delta && true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => delta.hashCode;
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
+class SemanticTokensClientCapabilitiesRequestsRange implements ToJsonable {
+ static const jsonHandler = LspJsonHandler(
+ SemanticTokensClientCapabilitiesRequestsRange.canParse,
+ SemanticTokensClientCapabilitiesRequestsRange.fromJson,
+ );
+
+ static SemanticTokensClientCapabilitiesRequestsRange fromJson(
+ Map<String, Object?> json) {
+ return SemanticTokensClientCapabilitiesRequestsRange();
+ }
+
+ @override
+ Map<String, Object?> toJson() => {};
+
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
+ if (obj is Map<String, Object?>) {
+ return true;
+ } else {
+ reporter.reportError(
+ 'must be of type SemanticTokensClientCapabilitiesRequestsRange');
+ return false;
+ }
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (other is SemanticTokensClientCapabilitiesRequestsRange &&
+ other.runtimeType == SemanticTokensClientCapabilitiesRequestsRange) {
+ return true;
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => 42;
+
+ @override
+ String toString() => jsonEncoder.convert(toJson());
+}
+
class SemanticTokensDelta implements ToJsonable {
static const jsonHandler = LspJsonHandler(
SemanticTokensDelta.canParse,
@@ -31973,6 +32679,7 @@
final List<SemanticTokensEdit> edits;
final String? resultId;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['edits'] = edits.map((item) => item.toJson()).toList();
@@ -31995,9 +32702,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((edits is List<Object?> &&
- (edits.every(
- (item) => SemanticTokensEdit.canParse(item, reporter)))))) {
+ if (edits is! List<Object?> ||
+ edits.any((item) => !SemanticTokensEdit.canParse(item, reporter))) {
reporter.reportError('must be of type List<SemanticTokensEdit>');
return false;
}
@@ -32007,7 +32713,7 @@
reporter.push('resultId');
try {
final resultId = obj['resultId'];
- if (resultId != null && !(resultId is String)) {
+ if (resultId != null && resultId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -32088,6 +32794,7 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The result id of a previous response. The result Id can either point to a
@@ -32098,8 +32805,10 @@
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -32119,7 +32828,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -32137,7 +32847,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(previousResultId is String)) {
+ if (previousResultId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -32155,7 +32865,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -32166,7 +32876,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -32227,6 +32938,7 @@
final List<SemanticTokensEdit> edits;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['edits'] = edits.map((item) => item.toJson()).toList();
@@ -32246,9 +32958,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((edits is List<Object?> &&
- (edits.every(
- (item) => SemanticTokensEdit.canParse(item, reporter)))))) {
+ if (edits is! List<Object?> ||
+ edits.any((item) => !SemanticTokensEdit.canParse(item, reporter))) {
reporter.reportError('must be of type List<SemanticTokensEdit>');
return false;
}
@@ -32315,6 +33026,7 @@
/// The start offset of the edit.
final int start;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (data != null) {
@@ -32331,7 +33043,7 @@
try {
final data = obj['data'];
if (data != null &&
- !((data is List<Object?> && (data.every((item) => item is int))))) {
+ (data is! List<Object?> || data.any((item) => item is! int))) {
reporter.reportError('must be of type List<int>');
return false;
}
@@ -32349,7 +33061,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(deleteCount is int)) {
+ if (deleteCount is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -32367,7 +33079,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(start is int)) {
+ if (start is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -32435,6 +33147,7 @@
/// The token types a server uses.
final List<String> tokenTypes;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['tokenModifiers'] = tokenModifiers;
@@ -32455,8 +33168,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((tokenModifiers is List<Object?> &&
- (tokenModifiers.every((item) => item is String))))) {
+ if (tokenModifiers is! List<Object?> ||
+ tokenModifiers.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -32474,8 +33187,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((tokenTypes is List<Object?> &&
- (tokenTypes.every((item) => item is String))))) {
+ if (tokenTypes is! List<Object?> ||
+ tokenTypes.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -32571,8 +33284,10 @@
/// Server supports providing semantic tokens for a specific range of a
/// document.
final Either2<bool, SemanticTokensOptionsRange>? range;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (full != null) {
@@ -32594,8 +33309,8 @@
try {
final full = obj['full'];
if (full != null &&
- !((full is bool ||
- SemanticTokensOptionsFull.canParse(full, reporter)))) {
+ full is! bool &&
+ !SemanticTokensOptionsFull.canParse(full, reporter)) {
reporter.reportError(
'must be of type Either2<bool, SemanticTokensOptionsFull>');
return false;
@@ -32614,7 +33329,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(SemanticTokensLegend.canParse(legend, reporter))) {
+ if (!SemanticTokensLegend.canParse(legend, reporter)) {
reporter.reportError('must be of type SemanticTokensLegend');
return false;
}
@@ -32625,8 +33340,8 @@
try {
final range = obj['range'];
if (range != null &&
- !((range is bool ||
- SemanticTokensOptionsRange.canParse(range, reporter)))) {
+ range is! bool &&
+ !SemanticTokensOptionsRange.canParse(range, reporter)) {
reporter.reportError(
'must be of type Either2<bool, SemanticTokensOptionsRange>');
return false;
@@ -32637,7 +33352,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -32696,6 +33411,7 @@
/// The server supports deltas for full documents.
final bool? delta;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (delta != null) {
@@ -32709,7 +33425,7 @@
reporter.push('delta');
try {
final delta = obj['delta'];
- if (delta != null && !(delta is bool)) {
+ if (delta != null && delta is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -32749,10 +33465,8 @@
return SemanticTokensOptionsRange();
}
- Map<String, Object?> toJson() {
- var result = <String, Object?>{};
- return result;
- }
+ @override
+ Map<String, Object?> toJson() => {};
static bool canParse(Object? obj, LspJsonReporter reporter) {
if (obj is Map<String, Object?>) {
@@ -32820,14 +33534,17 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The text document.
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -32846,7 +33563,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -32864,7 +33582,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -32875,7 +33593,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -32932,6 +33651,7 @@
final List<int> data;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['data'] = data;
@@ -32951,7 +33671,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((data is List<Object?> && (data.every((item) => item is int))))) {
+ if (data is! List<Object?> || data.any((item) => item is! int)) {
reporter.reportError('must be of type List<int>');
return false;
}
@@ -33026,6 +33746,7 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The range the semantic tokens are requested for.
@@ -33035,8 +33756,10 @@
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -33056,7 +33779,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -33074,7 +33798,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -33092,7 +33816,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -33103,7 +33827,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -33164,8 +33889,8 @@
static SemanticTokensRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final fullJson = json['full'];
final full = fullJson == null
@@ -33207,23 +33932,30 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// Server supports providing semantic tokens for a full document.
+ @override
final Either2<bool, SemanticTokensOptionsFull>? full;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
/// The legend used by the server
+ @override
final SemanticTokensLegend legend;
/// Server supports providing semantic tokens for a specific range of a
/// document.
+ @override
final Either2<bool, SemanticTokensOptionsRange>? range;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -33253,10 +33985,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -33266,8 +33999,8 @@
try {
final full = obj['full'];
if (full != null &&
- !((full is bool ||
- SemanticTokensOptionsFull.canParse(full, reporter)))) {
+ full is! bool &&
+ !SemanticTokensOptionsFull.canParse(full, reporter)) {
reporter.reportError(
'must be of type Either2<bool, SemanticTokensOptionsFull>');
return false;
@@ -33278,7 +34011,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -33296,7 +34029,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(SemanticTokensLegend.canParse(legend, reporter))) {
+ if (!SemanticTokensLegend.canParse(legend, reporter)) {
reporter.reportError('must be of type SemanticTokensLegend');
return false;
}
@@ -33307,8 +34040,8 @@
try {
final range = obj['range'];
if (range != null &&
- !((range is bool ||
- SemanticTokensOptionsRange.canParse(range, reporter)))) {
+ range is! bool &&
+ !SemanticTokensOptionsRange.canParse(range, reporter)) {
reporter.reportError(
'must be of type Either2<bool, SemanticTokensOptionsRange>');
return false;
@@ -33319,7 +34052,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -33337,8 +34070,12 @@
bool operator ==(Object other) {
if (other is SemanticTokensRegistrationOptions &&
other.runtimeType == SemanticTokensRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
full == other.full &&
id == other.id &&
legend == other.legend &&
@@ -33390,6 +34127,7 @@
/// change that requires such a calculation.
final bool? refreshSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (refreshSupport != null) {
@@ -33403,7 +34141,7 @@
reporter.push('refreshSupport');
try {
final refreshSupport = obj['refreshSupport'];
- if (refreshSupport != null && !(refreshSupport is bool)) {
+ if (refreshSupport != null && refreshSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -34081,6 +34819,7 @@
/// The server provides workspace symbol support.
final Either2<bool, WorkspaceSymbolOptions>? workspaceSymbolProvider;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (callHierarchyProvider != null) {
@@ -34199,11 +34938,10 @@
try {
final callHierarchyProvider = obj['callHierarchyProvider'];
if (callHierarchyProvider != null &&
- !((callHierarchyProvider is bool ||
- CallHierarchyOptions.canParse(
- callHierarchyProvider, reporter) ||
- CallHierarchyRegistrationOptions.canParse(
- callHierarchyProvider, reporter)))) {
+ callHierarchyProvider is! bool &&
+ !CallHierarchyOptions.canParse(callHierarchyProvider, reporter) &&
+ !CallHierarchyRegistrationOptions.canParse(
+ callHierarchyProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>');
return false;
@@ -34215,8 +34953,8 @@
try {
final codeActionProvider = obj['codeActionProvider'];
if (codeActionProvider != null &&
- !((codeActionProvider is bool ||
- CodeActionOptions.canParse(codeActionProvider, reporter)))) {
+ codeActionProvider is! bool &&
+ !CodeActionOptions.canParse(codeActionProvider, reporter)) {
reporter
.reportError('must be of type Either2<bool, CodeActionOptions>');
return false;
@@ -34228,7 +34966,7 @@
try {
final codeLensProvider = obj['codeLensProvider'];
if (codeLensProvider != null &&
- !(CodeLensOptions.canParse(codeLensProvider, reporter))) {
+ !CodeLensOptions.canParse(codeLensProvider, reporter)) {
reporter.reportError('must be of type CodeLensOptions');
return false;
}
@@ -34239,10 +34977,10 @@
try {
final colorProvider = obj['colorProvider'];
if (colorProvider != null &&
- !((colorProvider is bool ||
- DocumentColorOptions.canParse(colorProvider, reporter) ||
- DocumentColorRegistrationOptions.canParse(
- colorProvider, reporter)))) {
+ colorProvider is! bool &&
+ !DocumentColorOptions.canParse(colorProvider, reporter) &&
+ !DocumentColorRegistrationOptions.canParse(
+ colorProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, DocumentColorOptions, DocumentColorRegistrationOptions>');
return false;
@@ -34254,7 +34992,7 @@
try {
final completionProvider = obj['completionProvider'];
if (completionProvider != null &&
- !(CompletionOptions.canParse(completionProvider, reporter))) {
+ !CompletionOptions.canParse(completionProvider, reporter)) {
reporter.reportError('must be of type CompletionOptions');
return false;
}
@@ -34265,10 +35003,10 @@
try {
final declarationProvider = obj['declarationProvider'];
if (declarationProvider != null &&
- !((declarationProvider is bool ||
- DeclarationOptions.canParse(declarationProvider, reporter) ||
- DeclarationRegistrationOptions.canParse(
- declarationProvider, reporter)))) {
+ declarationProvider is! bool &&
+ !DeclarationOptions.canParse(declarationProvider, reporter) &&
+ !DeclarationRegistrationOptions.canParse(
+ declarationProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, DeclarationOptions, DeclarationRegistrationOptions>');
return false;
@@ -34280,8 +35018,8 @@
try {
final definitionProvider = obj['definitionProvider'];
if (definitionProvider != null &&
- !((definitionProvider is bool ||
- DefinitionOptions.canParse(definitionProvider, reporter)))) {
+ definitionProvider is! bool &&
+ !DefinitionOptions.canParse(definitionProvider, reporter)) {
reporter
.reportError('must be of type Either2<bool, DefinitionOptions>');
return false;
@@ -34293,9 +35031,9 @@
try {
final diagnosticProvider = obj['diagnosticProvider'];
if (diagnosticProvider != null &&
- !((DiagnosticOptions.canParse(diagnosticProvider, reporter) ||
- DiagnosticRegistrationOptions.canParse(
- diagnosticProvider, reporter)))) {
+ !DiagnosticOptions.canParse(diagnosticProvider, reporter) &&
+ !DiagnosticRegistrationOptions.canParse(
+ diagnosticProvider, reporter)) {
reporter.reportError(
'must be of type Either2<DiagnosticOptions, DiagnosticRegistrationOptions>');
return false;
@@ -34307,9 +35045,9 @@
try {
final documentFormattingProvider = obj['documentFormattingProvider'];
if (documentFormattingProvider != null &&
- !((documentFormattingProvider is bool ||
- DocumentFormattingOptions.canParse(
- documentFormattingProvider, reporter)))) {
+ documentFormattingProvider is! bool &&
+ !DocumentFormattingOptions.canParse(
+ documentFormattingProvider, reporter)) {
reporter.reportError(
'must be of type Either2<bool, DocumentFormattingOptions>');
return false;
@@ -34321,9 +35059,9 @@
try {
final documentHighlightProvider = obj['documentHighlightProvider'];
if (documentHighlightProvider != null &&
- !((documentHighlightProvider is bool ||
- DocumentHighlightOptions.canParse(
- documentHighlightProvider, reporter)))) {
+ documentHighlightProvider is! bool &&
+ !DocumentHighlightOptions.canParse(
+ documentHighlightProvider, reporter)) {
reporter.reportError(
'must be of type Either2<bool, DocumentHighlightOptions>');
return false;
@@ -34335,7 +35073,7 @@
try {
final documentLinkProvider = obj['documentLinkProvider'];
if (documentLinkProvider != null &&
- !(DocumentLinkOptions.canParse(documentLinkProvider, reporter))) {
+ !DocumentLinkOptions.canParse(documentLinkProvider, reporter)) {
reporter.reportError('must be of type DocumentLinkOptions');
return false;
}
@@ -34347,8 +35085,8 @@
final documentOnTypeFormattingProvider =
obj['documentOnTypeFormattingProvider'];
if (documentOnTypeFormattingProvider != null &&
- !(DocumentOnTypeFormattingOptions.canParse(
- documentOnTypeFormattingProvider, reporter))) {
+ !DocumentOnTypeFormattingOptions.canParse(
+ documentOnTypeFormattingProvider, reporter)) {
reporter
.reportError('must be of type DocumentOnTypeFormattingOptions');
return false;
@@ -34361,9 +35099,9 @@
final documentRangeFormattingProvider =
obj['documentRangeFormattingProvider'];
if (documentRangeFormattingProvider != null &&
- !((documentRangeFormattingProvider is bool ||
- DocumentRangeFormattingOptions.canParse(
- documentRangeFormattingProvider, reporter)))) {
+ documentRangeFormattingProvider is! bool &&
+ !DocumentRangeFormattingOptions.canParse(
+ documentRangeFormattingProvider, reporter)) {
reporter.reportError(
'must be of type Either2<bool, DocumentRangeFormattingOptions>');
return false;
@@ -34375,9 +35113,8 @@
try {
final documentSymbolProvider = obj['documentSymbolProvider'];
if (documentSymbolProvider != null &&
- !((documentSymbolProvider is bool ||
- DocumentSymbolOptions.canParse(
- documentSymbolProvider, reporter)))) {
+ documentSymbolProvider is! bool &&
+ !DocumentSymbolOptions.canParse(documentSymbolProvider, reporter)) {
reporter.reportError(
'must be of type Either2<bool, DocumentSymbolOptions>');
return false;
@@ -34389,8 +35126,7 @@
try {
final executeCommandProvider = obj['executeCommandProvider'];
if (executeCommandProvider != null &&
- !(ExecuteCommandOptions.canParse(
- executeCommandProvider, reporter))) {
+ !ExecuteCommandOptions.canParse(executeCommandProvider, reporter)) {
reporter.reportError('must be of type ExecuteCommandOptions');
return false;
}
@@ -34401,10 +35137,10 @@
try {
final foldingRangeProvider = obj['foldingRangeProvider'];
if (foldingRangeProvider != null &&
- !((foldingRangeProvider is bool ||
- FoldingRangeOptions.canParse(foldingRangeProvider, reporter) ||
- FoldingRangeRegistrationOptions.canParse(
- foldingRangeProvider, reporter)))) {
+ foldingRangeProvider is! bool &&
+ !FoldingRangeOptions.canParse(foldingRangeProvider, reporter) &&
+ !FoldingRangeRegistrationOptions.canParse(
+ foldingRangeProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, FoldingRangeOptions, FoldingRangeRegistrationOptions>');
return false;
@@ -34416,8 +35152,8 @@
try {
final hoverProvider = obj['hoverProvider'];
if (hoverProvider != null &&
- !((hoverProvider is bool ||
- HoverOptions.canParse(hoverProvider, reporter)))) {
+ hoverProvider is! bool &&
+ !HoverOptions.canParse(hoverProvider, reporter)) {
reporter.reportError('must be of type Either2<bool, HoverOptions>');
return false;
}
@@ -34428,11 +35164,10 @@
try {
final implementationProvider = obj['implementationProvider'];
if (implementationProvider != null &&
- !((implementationProvider is bool ||
- ImplementationOptions.canParse(
- implementationProvider, reporter) ||
- ImplementationRegistrationOptions.canParse(
- implementationProvider, reporter)))) {
+ implementationProvider is! bool &&
+ !ImplementationOptions.canParse(implementationProvider, reporter) &&
+ !ImplementationRegistrationOptions.canParse(
+ implementationProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, ImplementationOptions, ImplementationRegistrationOptions>');
return false;
@@ -34444,10 +35179,10 @@
try {
final inlayHintProvider = obj['inlayHintProvider'];
if (inlayHintProvider != null &&
- !((inlayHintProvider is bool ||
- InlayHintOptions.canParse(inlayHintProvider, reporter) ||
- InlayHintRegistrationOptions.canParse(
- inlayHintProvider, reporter)))) {
+ inlayHintProvider is! bool &&
+ !InlayHintOptions.canParse(inlayHintProvider, reporter) &&
+ !InlayHintRegistrationOptions.canParse(
+ inlayHintProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, InlayHintOptions, InlayHintRegistrationOptions>');
return false;
@@ -34459,10 +35194,10 @@
try {
final inlineValueProvider = obj['inlineValueProvider'];
if (inlineValueProvider != null &&
- !((inlineValueProvider is bool ||
- InlineValueOptions.canParse(inlineValueProvider, reporter) ||
- InlineValueRegistrationOptions.canParse(
- inlineValueProvider, reporter)))) {
+ inlineValueProvider is! bool &&
+ !InlineValueOptions.canParse(inlineValueProvider, reporter) &&
+ !InlineValueRegistrationOptions.canParse(
+ inlineValueProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, InlineValueOptions, InlineValueRegistrationOptions>');
return false;
@@ -34474,11 +35209,11 @@
try {
final linkedEditingRangeProvider = obj['linkedEditingRangeProvider'];
if (linkedEditingRangeProvider != null &&
- !((linkedEditingRangeProvider is bool ||
- LinkedEditingRangeOptions.canParse(
- linkedEditingRangeProvider, reporter) ||
- LinkedEditingRangeRegistrationOptions.canParse(
- linkedEditingRangeProvider, reporter)))) {
+ linkedEditingRangeProvider is! bool &&
+ !LinkedEditingRangeOptions.canParse(
+ linkedEditingRangeProvider, reporter) &&
+ !LinkedEditingRangeRegistrationOptions.canParse(
+ linkedEditingRangeProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions>');
return false;
@@ -34490,10 +35225,9 @@
try {
final monikerProvider = obj['monikerProvider'];
if (monikerProvider != null &&
- !((monikerProvider is bool ||
- MonikerOptions.canParse(monikerProvider, reporter) ||
- MonikerRegistrationOptions.canParse(
- monikerProvider, reporter)))) {
+ monikerProvider is! bool &&
+ !MonikerOptions.canParse(monikerProvider, reporter) &&
+ !MonikerRegistrationOptions.canParse(monikerProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, MonikerOptions, MonikerRegistrationOptions>');
return false;
@@ -34505,10 +35239,10 @@
try {
final notebookDocumentSync = obj['notebookDocumentSync'];
if (notebookDocumentSync != null &&
- !((NotebookDocumentSyncOptions.canParse(
- notebookDocumentSync, reporter) ||
- NotebookDocumentSyncRegistrationOptions.canParse(
- notebookDocumentSync, reporter)))) {
+ !NotebookDocumentSyncOptions.canParse(
+ notebookDocumentSync, reporter) &&
+ !NotebookDocumentSyncRegistrationOptions.canParse(
+ notebookDocumentSync, reporter)) {
reporter.reportError(
'must be of type Either2<NotebookDocumentSyncOptions, NotebookDocumentSyncRegistrationOptions>');
return false;
@@ -34520,7 +35254,7 @@
try {
final positionEncoding = obj['positionEncoding'];
if (positionEncoding != null &&
- !(PositionEncodingKind.canParse(positionEncoding, reporter))) {
+ !PositionEncodingKind.canParse(positionEncoding, reporter)) {
reporter.reportError('must be of type PositionEncodingKind');
return false;
}
@@ -34531,8 +35265,8 @@
try {
final referencesProvider = obj['referencesProvider'];
if (referencesProvider != null &&
- !((referencesProvider is bool ||
- ReferenceOptions.canParse(referencesProvider, reporter)))) {
+ referencesProvider is! bool &&
+ !ReferenceOptions.canParse(referencesProvider, reporter)) {
reporter
.reportError('must be of type Either2<bool, ReferenceOptions>');
return false;
@@ -34544,8 +35278,8 @@
try {
final renameProvider = obj['renameProvider'];
if (renameProvider != null &&
- !((renameProvider is bool ||
- RenameOptions.canParse(renameProvider, reporter)))) {
+ renameProvider is! bool &&
+ !RenameOptions.canParse(renameProvider, reporter)) {
reporter.reportError('must be of type Either2<bool, RenameOptions>');
return false;
}
@@ -34556,11 +35290,10 @@
try {
final selectionRangeProvider = obj['selectionRangeProvider'];
if (selectionRangeProvider != null &&
- !((selectionRangeProvider is bool ||
- SelectionRangeOptions.canParse(
- selectionRangeProvider, reporter) ||
- SelectionRangeRegistrationOptions.canParse(
- selectionRangeProvider, reporter)))) {
+ selectionRangeProvider is! bool &&
+ !SelectionRangeOptions.canParse(selectionRangeProvider, reporter) &&
+ !SelectionRangeRegistrationOptions.canParse(
+ selectionRangeProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, SelectionRangeOptions, SelectionRangeRegistrationOptions>');
return false;
@@ -34572,10 +35305,9 @@
try {
final semanticTokensProvider = obj['semanticTokensProvider'];
if (semanticTokensProvider != null &&
- !((SemanticTokensOptions.canParse(
- semanticTokensProvider, reporter) ||
- SemanticTokensRegistrationOptions.canParse(
- semanticTokensProvider, reporter)))) {
+ !SemanticTokensOptions.canParse(semanticTokensProvider, reporter) &&
+ !SemanticTokensRegistrationOptions.canParse(
+ semanticTokensProvider, reporter)) {
reporter.reportError(
'must be of type Either2<SemanticTokensOptions, SemanticTokensRegistrationOptions>');
return false;
@@ -34587,7 +35319,7 @@
try {
final signatureHelpProvider = obj['signatureHelpProvider'];
if (signatureHelpProvider != null &&
- !(SignatureHelpOptions.canParse(signatureHelpProvider, reporter))) {
+ !SignatureHelpOptions.canParse(signatureHelpProvider, reporter)) {
reporter.reportError('must be of type SignatureHelpOptions');
return false;
}
@@ -34598,9 +35330,8 @@
try {
final textDocumentSync = obj['textDocumentSync'];
if (textDocumentSync != null &&
- !((TextDocumentSyncKind.canParse(textDocumentSync, reporter) ||
- TextDocumentSyncOptions.canParse(
- textDocumentSync, reporter)))) {
+ !TextDocumentSyncKind.canParse(textDocumentSync, reporter) &&
+ !TextDocumentSyncOptions.canParse(textDocumentSync, reporter)) {
reporter.reportError(
'must be of type Either2<TextDocumentSyncKind, TextDocumentSyncOptions>');
return false;
@@ -34612,11 +35343,10 @@
try {
final typeDefinitionProvider = obj['typeDefinitionProvider'];
if (typeDefinitionProvider != null &&
- !((typeDefinitionProvider is bool ||
- TypeDefinitionOptions.canParse(
- typeDefinitionProvider, reporter) ||
- TypeDefinitionRegistrationOptions.canParse(
- typeDefinitionProvider, reporter)))) {
+ typeDefinitionProvider is! bool &&
+ !TypeDefinitionOptions.canParse(typeDefinitionProvider, reporter) &&
+ !TypeDefinitionRegistrationOptions.canParse(
+ typeDefinitionProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>');
return false;
@@ -34628,11 +35358,10 @@
try {
final typeHierarchyProvider = obj['typeHierarchyProvider'];
if (typeHierarchyProvider != null &&
- !((typeHierarchyProvider is bool ||
- TypeHierarchyOptions.canParse(
- typeHierarchyProvider, reporter) ||
- TypeHierarchyRegistrationOptions.canParse(
- typeHierarchyProvider, reporter)))) {
+ typeHierarchyProvider is! bool &&
+ !TypeHierarchyOptions.canParse(typeHierarchyProvider, reporter) &&
+ !TypeHierarchyRegistrationOptions.canParse(
+ typeHierarchyProvider, reporter)) {
reporter.reportError(
'must be of type Either3<bool, TypeHierarchyOptions, TypeHierarchyRegistrationOptions>');
return false;
@@ -34644,7 +35373,7 @@
try {
final workspace = obj['workspace'];
if (workspace != null &&
- !(ServerCapabilitiesWorkspace.canParse(workspace, reporter))) {
+ !ServerCapabilitiesWorkspace.canParse(workspace, reporter)) {
reporter.reportError('must be of type ServerCapabilitiesWorkspace');
return false;
}
@@ -34655,9 +35384,9 @@
try {
final workspaceSymbolProvider = obj['workspaceSymbolProvider'];
if (workspaceSymbolProvider != null &&
- !((workspaceSymbolProvider is bool ||
- WorkspaceSymbolOptions.canParse(
- workspaceSymbolProvider, reporter)))) {
+ workspaceSymbolProvider is! bool &&
+ !WorkspaceSymbolOptions.canParse(
+ workspaceSymbolProvider, reporter)) {
reporter.reportError(
'must be of type Either2<bool, WorkspaceSymbolOptions>');
return false;
@@ -34796,6 +35525,7 @@
/// @since 3.6.0
final WorkspaceFoldersServerCapabilities? workspaceFolders;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (fileOperations != null) {
@@ -34813,7 +35543,7 @@
try {
final fileOperations = obj['fileOperations'];
if (fileOperations != null &&
- !(FileOperationOptions.canParse(fileOperations, reporter))) {
+ !FileOperationOptions.canParse(fileOperations, reporter)) {
reporter.reportError('must be of type FileOperationOptions');
return false;
}
@@ -34824,8 +35554,8 @@
try {
final workspaceFolders = obj['workspaceFolders'];
if (workspaceFolders != null &&
- !(WorkspaceFoldersServerCapabilities.canParse(
- workspaceFolders, reporter))) {
+ !WorkspaceFoldersServerCapabilities.canParse(
+ workspaceFolders, reporter)) {
reporter.reportError(
'must be of type WorkspaceFoldersServerCapabilities');
return false;
@@ -34883,6 +35613,7 @@
/// The new value that should be assigned to the trace setting.
final String value;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['value'] = value;
@@ -34902,7 +35633,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((value == 'off' || value == 'messages' || value == 'verbose'))) {
+ if (value != 'off' && value != 'messages' && value != 'verbose') {
reporter.reportError(
'must be one of the literals \'off\', \'messages\', \'verbose\'');
return false;
@@ -34954,6 +35685,7 @@
/// The client has support for the show document request.
final bool support;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['support'] = support;
@@ -34973,7 +35705,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(support is bool)) {
+ if (support is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -35054,6 +35786,7 @@
/// The document uri to show.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (external != null) {
@@ -35074,7 +35807,7 @@
reporter.push('external');
try {
final external = obj['external'];
- if (external != null && !(external is bool)) {
+ if (external != null && external is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -35084,7 +35817,7 @@
reporter.push('selection');
try {
final selection = obj['selection'];
- if (selection != null && !(Range.canParse(selection, reporter))) {
+ if (selection != null && !Range.canParse(selection, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -35094,7 +35827,7 @@
reporter.push('takeFocus');
try {
final takeFocus = obj['takeFocus'];
- if (takeFocus != null && !(takeFocus is bool)) {
+ if (takeFocus != null && takeFocus is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -35112,7 +35845,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -35173,6 +35906,7 @@
/// A boolean indicating if the show was successful.
final bool success;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['success'] = success;
@@ -35192,7 +35926,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(success is bool)) {
+ if (success is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -35249,6 +35983,7 @@
/// The message type.
final MessageType type;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['message'] = message;
@@ -35269,7 +36004,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(message is String)) {
+ if (message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -35287,7 +36022,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(MessageType.canParse(type, reporter))) {
+ if (!MessageType.canParse(type, reporter)) {
reporter.reportError('must be of type MessageType');
return false;
}
@@ -35345,6 +36080,7 @@
final ShowMessageRequestClientCapabilitiesMessageActionItem?
messageActionItem;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (messageActionItem != null) {
@@ -35359,8 +36095,8 @@
try {
final messageActionItem = obj['messageActionItem'];
if (messageActionItem != null &&
- !(ShowMessageRequestClientCapabilitiesMessageActionItem.canParse(
- messageActionItem, reporter))) {
+ !ShowMessageRequestClientCapabilitiesMessageActionItem.canParse(
+ messageActionItem, reporter)) {
reporter.reportError(
'must be of type ShowMessageRequestClientCapabilitiesMessageActionItem');
return false;
@@ -35416,6 +36152,7 @@
/// sent back to the server in the request's response.
final bool? additionalPropertiesSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (additionalPropertiesSupport != null) {
@@ -35430,7 +36167,7 @@
try {
final additionalPropertiesSupport = obj['additionalPropertiesSupport'];
if (additionalPropertiesSupport != null &&
- !(additionalPropertiesSupport is bool)) {
+ additionalPropertiesSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -35500,6 +36237,7 @@
/// The message type.
final MessageType type;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (actions != null) {
@@ -35516,9 +36254,9 @@
try {
final actions = obj['actions'];
if (actions != null &&
- !((actions is List<Object?> &&
- (actions.every(
- (item) => MessageActionItem.canParse(item, reporter)))))) {
+ (actions is! List<Object?> ||
+ actions.any(
+ (item) => !MessageActionItem.canParse(item, reporter)))) {
reporter.reportError('must be of type List<MessageActionItem>');
return false;
}
@@ -35536,7 +36274,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(message is String)) {
+ if (message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -35554,7 +36292,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(MessageType.canParse(type, reporter))) {
+ if (!MessageType.canParse(type, reporter)) {
reporter.reportError('must be of type MessageType');
return false;
}
@@ -35645,6 +36383,7 @@
/// request should return `null`.
final List<SignatureInformation> signatures;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (activeParameter != null) {
@@ -35662,7 +36401,7 @@
reporter.push('activeParameter');
try {
final activeParameter = obj['activeParameter'];
- if (activeParameter != null && !(activeParameter is int)) {
+ if (activeParameter != null && activeParameter is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -35672,7 +36411,7 @@
reporter.push('activeSignature');
try {
final activeSignature = obj['activeSignature'];
- if (activeSignature != null && !(activeSignature is int)) {
+ if (activeSignature != null && activeSignature is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -35690,9 +36429,9 @@
reporter.reportError('must not be null');
return false;
}
- if (!((signatures is List<Object?> &&
- (signatures.every(
- (item) => SignatureInformation.canParse(item, reporter)))))) {
+ if (signatures is! List<Object?> ||
+ signatures.any(
+ (item) => !SignatureInformation.canParse(item, reporter))) {
reporter.reportError('must be of type List<SignatureInformation>');
return false;
}
@@ -35772,6 +36511,7 @@
final SignatureHelpClientCapabilitiesSignatureInformation?
signatureInformation;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (contextSupport != null) {
@@ -35791,7 +36531,7 @@
reporter.push('contextSupport');
try {
final contextSupport = obj['contextSupport'];
- if (contextSupport != null && !(contextSupport is bool)) {
+ if (contextSupport != null && contextSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -35801,7 +36541,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -35812,8 +36552,8 @@
try {
final signatureInformation = obj['signatureInformation'];
if (signatureInformation != null &&
- !(SignatureHelpClientCapabilitiesSignatureInformation.canParse(
- signatureInformation, reporter))) {
+ !SignatureHelpClientCapabilitiesSignatureInformation.canParse(
+ signatureInformation, reporter)) {
reporter.reportError(
'must be of type SignatureHelpClientCapabilitiesSignatureInformation');
return false;
@@ -35895,6 +36635,7 @@
/// Client capabilities specific to parameter information.
final SignatureInformationParameterInformation? parameterInformation;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (activeParameterSupport != null) {
@@ -35915,8 +36656,7 @@
reporter.push('activeParameterSupport');
try {
final activeParameterSupport = obj['activeParameterSupport'];
- if (activeParameterSupport != null &&
- !(activeParameterSupport is bool)) {
+ if (activeParameterSupport != null && activeParameterSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -35927,9 +36667,9 @@
try {
final documentationFormat = obj['documentationFormat'];
if (documentationFormat != null &&
- !((documentationFormat is List<Object?> &&
- (documentationFormat
- .every((item) => MarkupKind.canParse(item, reporter)))))) {
+ (documentationFormat is! List<Object?> ||
+ documentationFormat
+ .any((item) => !MarkupKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<MarkupKind>');
return false;
}
@@ -35940,8 +36680,8 @@
try {
final parameterInformation = obj['parameterInformation'];
if (parameterInformation != null &&
- !(SignatureInformationParameterInformation.canParse(
- parameterInformation, reporter))) {
+ !SignatureInformationParameterInformation.canParse(
+ parameterInformation, reporter)) {
reporter.reportError(
'must be of type SignatureInformationParameterInformation');
return false;
@@ -36040,6 +36780,7 @@
/// Action that caused signature help to be triggered.
final SignatureHelpTriggerKind triggerKind;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (activeSignatureHelp != null) {
@@ -36059,7 +36800,7 @@
try {
final activeSignatureHelp = obj['activeSignatureHelp'];
if (activeSignatureHelp != null &&
- !(SignatureHelp.canParse(activeSignatureHelp, reporter))) {
+ !SignatureHelp.canParse(activeSignatureHelp, reporter)) {
reporter.reportError('must be of type SignatureHelp');
return false;
}
@@ -36077,7 +36818,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(isRetrigger is bool)) {
+ if (isRetrigger is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -36087,7 +36828,7 @@
reporter.push('triggerCharacter');
try {
final triggerCharacter = obj['triggerCharacter'];
- if (triggerCharacter != null && !(triggerCharacter is String)) {
+ if (triggerCharacter != null && triggerCharacter is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -36105,7 +36846,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(SignatureHelpTriggerKind.canParse(triggerKind, reporter))) {
+ if (!SignatureHelpTriggerKind.canParse(triggerKind, reporter)) {
reporter.reportError('must be of type SignatureHelpTriggerKind');
return false;
}
@@ -36185,8 +36926,10 @@
/// The characters that trigger signature help automatically.
final List<String>? triggerCharacters;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (retriggerCharacters != null) {
@@ -36207,8 +36950,8 @@
try {
final retriggerCharacters = obj['retriggerCharacters'];
if (retriggerCharacters != null &&
- !((retriggerCharacters is List<Object?> &&
- (retriggerCharacters.every((item) => item is String))))) {
+ (retriggerCharacters is! List<Object?> ||
+ retriggerCharacters.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -36219,8 +36962,8 @@
try {
final triggerCharacters = obj['triggerCharacters'];
if (triggerCharacters != null &&
- !((triggerCharacters is List<Object?> &&
- (triggerCharacters.every((item) => item is String))))) {
+ (triggerCharacters is! List<Object?> ||
+ triggerCharacters.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -36230,7 +36973,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -36315,14 +37058,18 @@
final SignatureHelpContext? context;
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (context != null) {
@@ -36342,7 +37089,7 @@
try {
final context = obj['context'];
if (context != null &&
- !(SignatureHelpContext.canParse(context, reporter))) {
+ !SignatureHelpContext.canParse(context, reporter)) {
reporter.reportError('must be of type SignatureHelpContext');
return false;
}
@@ -36360,7 +37107,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -36378,7 +37125,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -36389,7 +37136,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -36447,8 +37195,8 @@
static SignatureHelpRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final retriggerCharactersJson = json['retriggerCharacters'];
final retriggerCharacters = (retriggerCharactersJson as List<Object?>?)
@@ -36470,19 +37218,24 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// List of characters that re-trigger signature help.
///
/// These trigger characters are only active when signature help is already
/// showing. All trigger characters are also counted as re-trigger characters.
/// @since 3.15.0
+ @override
final List<String>? retriggerCharacters;
/// The characters that trigger signature help automatically.
+ @override
final List<String>? triggerCharacters;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -36508,10 +37261,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -36521,8 +37275,8 @@
try {
final retriggerCharacters = obj['retriggerCharacters'];
if (retriggerCharacters != null &&
- !((retriggerCharacters is List<Object?> &&
- (retriggerCharacters.every((item) => item is String))))) {
+ (retriggerCharacters is! List<Object?> ||
+ retriggerCharacters.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -36533,8 +37287,8 @@
try {
final triggerCharacters = obj['triggerCharacters'];
if (triggerCharacters != null &&
- !((triggerCharacters is List<Object?> &&
- (triggerCharacters.every((item) => item is String))))) {
+ (triggerCharacters is! List<Object?> ||
+ triggerCharacters.any((item) => item is! String))) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -36544,7 +37298,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -36562,8 +37316,12 @@
bool operator ==(Object other) {
if (other is SignatureHelpRegistrationOptions &&
other.runtimeType == SignatureHelpRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
listEqual(retriggerCharacters, other.retriggerCharacters,
(String a, String b) => a == b) &&
listEqual(triggerCharacters, other.triggerCharacters,
@@ -36608,6 +37366,7 @@
/// Signature help was triggered by a trigger character.
static const TriggerCharacter = SignatureHelpTriggerKind(2);
+ @override
Object toJson() => _value;
@override
@@ -36616,6 +37375,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is SignatureHelpTriggerKind && other._value == _value;
}
@@ -36677,6 +37437,7 @@
/// The parameters of this signature.
final List<ParameterInformation>? parameters;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (activeParameter != null) {
@@ -36697,7 +37458,7 @@
reporter.push('activeParameter');
try {
final activeParameter = obj['activeParameter'];
- if (activeParameter != null && !(activeParameter is int)) {
+ if (activeParameter != null && activeParameter is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -36708,8 +37469,8 @@
try {
final documentation = obj['documentation'];
if (documentation != null &&
- !((MarkupContent.canParse(documentation, reporter) ||
- documentation is String))) {
+ !MarkupContent.canParse(documentation, reporter) &&
+ documentation is! String) {
reporter
.reportError('must be of type Either2<MarkupContent, String>');
return false;
@@ -36728,7 +37489,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(label is String)) {
+ if (label is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -36739,9 +37500,9 @@
try {
final parameters = obj['parameters'];
if (parameters != null &&
- !((parameters is List<Object?> &&
- (parameters.every((item) =>
- ParameterInformation.canParse(item, reporter)))))) {
+ (parameters is! List<Object?> ||
+ parameters.any((item) =>
+ !ParameterInformation.canParse(item, reporter)))) {
reporter.reportError('must be of type List<ParameterInformation>');
return false;
}
@@ -36804,6 +37565,7 @@
/// @since 3.14.0
final bool? labelOffsetSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (labelOffsetSupport != null) {
@@ -36817,7 +37579,7 @@
reporter.push('labelOffsetSupport');
try {
final labelOffsetSupport = obj['labelOffsetSupport'];
- if (labelOffsetSupport != null && !(labelOffsetSupport is bool)) {
+ if (labelOffsetSupport != null && labelOffsetSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -36914,6 +37676,7 @@
/// request again. See also Registration#id.
final String? id;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (id != null) {
@@ -36927,7 +37690,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -37030,6 +37793,7 @@
/// @since 3.16.0
final List<SymbolTag>? tags;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (containerName != null) {
@@ -37052,7 +37816,7 @@
reporter.push('containerName');
try {
final containerName = obj['containerName'];
- if (containerName != null && !(containerName is String)) {
+ if (containerName != null && containerName is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -37062,7 +37826,7 @@
reporter.push('deprecated');
try {
final deprecated = obj['deprecated'];
- if (deprecated != null && !(deprecated is bool)) {
+ if (deprecated != null && deprecated is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -37080,7 +37844,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(SymbolKind.canParse(kind, reporter))) {
+ if (!SymbolKind.canParse(kind, reporter)) {
reporter.reportError('must be of type SymbolKind');
return false;
}
@@ -37098,7 +37862,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Location.canParse(location, reporter))) {
+ if (!Location.canParse(location, reporter)) {
reporter.reportError('must be of type Location');
return false;
}
@@ -37116,7 +37880,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(name is String)) {
+ if (name is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -37127,8 +37891,8 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List<Object?> &&
- (tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
+ (tags is! List<Object?> ||
+ tags.any((item) => !SymbolTag.canParse(item, reporter)))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
@@ -37208,6 +37972,7 @@
static const TypeParameter = SymbolKind(26);
static const Variable = SymbolKind(13);
+ @override
Object toJson() => _value;
@override
@@ -37216,6 +37981,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is SymbolKind && other._value == _value;
}
@@ -37235,6 +38001,7 @@
/// Render a symbol as obsolete, usually using a strike-out.
static const Deprecated = SymbolTag(1);
+ @override
Object toJson() => _value;
@override
@@ -37243,6 +38010,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is SymbolTag && other._value == _value;
}
@@ -37264,8 +38032,8 @@
Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final syncKindJson = json['syncKind'];
final syncKind = TextDocumentSyncKind.fromJson(syncKindJson as int);
@@ -37277,12 +38045,14 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// How documents are synced to the server. See TextDocumentSyncKind.Full and
/// TextDocumentSyncKind.Incremental.
final TextDocumentSyncKind syncKind;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -37300,10 +38070,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -37320,7 +38091,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentSyncKind.canParse(syncKind, reporter))) {
+ if (!TextDocumentSyncKind.canParse(syncKind, reporter)) {
reporter.reportError('must be of type TextDocumentSyncKind');
return false;
}
@@ -37339,8 +38110,12 @@
bool operator ==(Object other) {
if (other is TextDocumentChangeRegistrationOptions &&
other.runtimeType == TextDocumentChangeRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
syncKind == other.syncKind &&
true;
}
@@ -37542,7 +38317,7 @@
: null;
final typeHierarchyJson = json['typeHierarchy'];
final typeHierarchy = typeHierarchyJson != null
- ? TypeHierarchyClientCapabilities1.fromJson(
+ ? TypeHierarchyClientCapabilities.fromJson(
typeHierarchyJson as Map<String, Object?>)
: null;
return TextDocumentClientCapabilities(
@@ -37682,8 +38457,9 @@
/// Capabilities specific to the various type hierarchy requests.
/// @since 3.17.0
- final TypeHierarchyClientCapabilities1? typeHierarchy;
+ final TypeHierarchyClientCapabilities? typeHierarchy;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (callHierarchy != null) {
@@ -37785,8 +38561,8 @@
try {
final callHierarchy = obj['callHierarchy'];
if (callHierarchy != null &&
- !(CallHierarchyClientCapabilities.canParse(
- callHierarchy, reporter))) {
+ !CallHierarchyClientCapabilities.canParse(
+ callHierarchy, reporter)) {
reporter
.reportError('must be of type CallHierarchyClientCapabilities');
return false;
@@ -37798,7 +38574,7 @@
try {
final codeAction = obj['codeAction'];
if (codeAction != null &&
- !(CodeActionClientCapabilities.canParse(codeAction, reporter))) {
+ !CodeActionClientCapabilities.canParse(codeAction, reporter)) {
reporter.reportError('must be of type CodeActionClientCapabilities');
return false;
}
@@ -37809,7 +38585,7 @@
try {
final codeLens = obj['codeLens'];
if (codeLens != null &&
- !(CodeLensClientCapabilities.canParse(codeLens, reporter))) {
+ !CodeLensClientCapabilities.canParse(codeLens, reporter)) {
reporter.reportError('must be of type CodeLensClientCapabilities');
return false;
}
@@ -37820,8 +38596,8 @@
try {
final colorProvider = obj['colorProvider'];
if (colorProvider != null &&
- !(DocumentColorClientCapabilities.canParse(
- colorProvider, reporter))) {
+ !DocumentColorClientCapabilities.canParse(
+ colorProvider, reporter)) {
reporter
.reportError('must be of type DocumentColorClientCapabilities');
return false;
@@ -37833,7 +38609,7 @@
try {
final completion = obj['completion'];
if (completion != null &&
- !(CompletionClientCapabilities.canParse(completion, reporter))) {
+ !CompletionClientCapabilities.canParse(completion, reporter)) {
reporter.reportError('must be of type CompletionClientCapabilities');
return false;
}
@@ -37844,7 +38620,7 @@
try {
final declaration = obj['declaration'];
if (declaration != null &&
- !(DeclarationClientCapabilities.canParse(declaration, reporter))) {
+ !DeclarationClientCapabilities.canParse(declaration, reporter)) {
reporter.reportError('must be of type DeclarationClientCapabilities');
return false;
}
@@ -37855,7 +38631,7 @@
try {
final definition = obj['definition'];
if (definition != null &&
- !(DefinitionClientCapabilities.canParse(definition, reporter))) {
+ !DefinitionClientCapabilities.canParse(definition, reporter)) {
reporter.reportError('must be of type DefinitionClientCapabilities');
return false;
}
@@ -37866,7 +38642,7 @@
try {
final diagnostic = obj['diagnostic'];
if (diagnostic != null &&
- !(DiagnosticClientCapabilities.canParse(diagnostic, reporter))) {
+ !DiagnosticClientCapabilities.canParse(diagnostic, reporter)) {
reporter.reportError('must be of type DiagnosticClientCapabilities');
return false;
}
@@ -37877,8 +38653,8 @@
try {
final documentHighlight = obj['documentHighlight'];
if (documentHighlight != null &&
- !(DocumentHighlightClientCapabilities.canParse(
- documentHighlight, reporter))) {
+ !DocumentHighlightClientCapabilities.canParse(
+ documentHighlight, reporter)) {
reporter.reportError(
'must be of type DocumentHighlightClientCapabilities');
return false;
@@ -37890,8 +38666,7 @@
try {
final documentLink = obj['documentLink'];
if (documentLink != null &&
- !(DocumentLinkClientCapabilities.canParse(
- documentLink, reporter))) {
+ !DocumentLinkClientCapabilities.canParse(documentLink, reporter)) {
reporter
.reportError('must be of type DocumentLinkClientCapabilities');
return false;
@@ -37903,8 +38678,8 @@
try {
final documentSymbol = obj['documentSymbol'];
if (documentSymbol != null &&
- !(DocumentSymbolClientCapabilities.canParse(
- documentSymbol, reporter))) {
+ !DocumentSymbolClientCapabilities.canParse(
+ documentSymbol, reporter)) {
reporter
.reportError('must be of type DocumentSymbolClientCapabilities');
return false;
@@ -37916,8 +38691,7 @@
try {
final foldingRange = obj['foldingRange'];
if (foldingRange != null &&
- !(FoldingRangeClientCapabilities.canParse(
- foldingRange, reporter))) {
+ !FoldingRangeClientCapabilities.canParse(foldingRange, reporter)) {
reporter
.reportError('must be of type FoldingRangeClientCapabilities');
return false;
@@ -37929,8 +38703,8 @@
try {
final formatting = obj['formatting'];
if (formatting != null &&
- !(DocumentFormattingClientCapabilities.canParse(
- formatting, reporter))) {
+ !DocumentFormattingClientCapabilities.canParse(
+ formatting, reporter)) {
reporter.reportError(
'must be of type DocumentFormattingClientCapabilities');
return false;
@@ -37942,7 +38716,7 @@
try {
final hover = obj['hover'];
if (hover != null &&
- !(HoverClientCapabilities.canParse(hover, reporter))) {
+ !HoverClientCapabilities.canParse(hover, reporter)) {
reporter.reportError('must be of type HoverClientCapabilities');
return false;
}
@@ -37953,8 +38727,8 @@
try {
final implementation = obj['implementation'];
if (implementation != null &&
- !(ImplementationClientCapabilities.canParse(
- implementation, reporter))) {
+ !ImplementationClientCapabilities.canParse(
+ implementation, reporter)) {
reporter
.reportError('must be of type ImplementationClientCapabilities');
return false;
@@ -37966,7 +38740,7 @@
try {
final inlayHint = obj['inlayHint'];
if (inlayHint != null &&
- !(InlayHintClientCapabilities.canParse(inlayHint, reporter))) {
+ !InlayHintClientCapabilities.canParse(inlayHint, reporter)) {
reporter.reportError('must be of type InlayHintClientCapabilities');
return false;
}
@@ -37977,7 +38751,7 @@
try {
final inlineValue = obj['inlineValue'];
if (inlineValue != null &&
- !(InlineValueClientCapabilities.canParse(inlineValue, reporter))) {
+ !InlineValueClientCapabilities.canParse(inlineValue, reporter)) {
reporter.reportError('must be of type InlineValueClientCapabilities');
return false;
}
@@ -37988,8 +38762,8 @@
try {
final linkedEditingRange = obj['linkedEditingRange'];
if (linkedEditingRange != null &&
- !(LinkedEditingRangeClientCapabilities.canParse(
- linkedEditingRange, reporter))) {
+ !LinkedEditingRangeClientCapabilities.canParse(
+ linkedEditingRange, reporter)) {
reporter.reportError(
'must be of type LinkedEditingRangeClientCapabilities');
return false;
@@ -38001,7 +38775,7 @@
try {
final moniker = obj['moniker'];
if (moniker != null &&
- !(MonikerClientCapabilities.canParse(moniker, reporter))) {
+ !MonikerClientCapabilities.canParse(moniker, reporter)) {
reporter.reportError('must be of type MonikerClientCapabilities');
return false;
}
@@ -38012,8 +38786,8 @@
try {
final onTypeFormatting = obj['onTypeFormatting'];
if (onTypeFormatting != null &&
- !(DocumentOnTypeFormattingClientCapabilities.canParse(
- onTypeFormatting, reporter))) {
+ !DocumentOnTypeFormattingClientCapabilities.canParse(
+ onTypeFormatting, reporter)) {
reporter.reportError(
'must be of type DocumentOnTypeFormattingClientCapabilities');
return false;
@@ -38025,8 +38799,8 @@
try {
final publishDiagnostics = obj['publishDiagnostics'];
if (publishDiagnostics != null &&
- !(PublishDiagnosticsClientCapabilities.canParse(
- publishDiagnostics, reporter))) {
+ !PublishDiagnosticsClientCapabilities.canParse(
+ publishDiagnostics, reporter)) {
reporter.reportError(
'must be of type PublishDiagnosticsClientCapabilities');
return false;
@@ -38038,8 +38812,8 @@
try {
final rangeFormatting = obj['rangeFormatting'];
if (rangeFormatting != null &&
- !(DocumentRangeFormattingClientCapabilities.canParse(
- rangeFormatting, reporter))) {
+ !DocumentRangeFormattingClientCapabilities.canParse(
+ rangeFormatting, reporter)) {
reporter.reportError(
'must be of type DocumentRangeFormattingClientCapabilities');
return false;
@@ -38051,7 +38825,7 @@
try {
final references = obj['references'];
if (references != null &&
- !(ReferenceClientCapabilities.canParse(references, reporter))) {
+ !ReferenceClientCapabilities.canParse(references, reporter)) {
reporter.reportError('must be of type ReferenceClientCapabilities');
return false;
}
@@ -38062,7 +38836,7 @@
try {
final rename = obj['rename'];
if (rename != null &&
- !(RenameClientCapabilities.canParse(rename, reporter))) {
+ !RenameClientCapabilities.canParse(rename, reporter)) {
reporter.reportError('must be of type RenameClientCapabilities');
return false;
}
@@ -38073,8 +38847,8 @@
try {
final selectionRange = obj['selectionRange'];
if (selectionRange != null &&
- !(SelectionRangeClientCapabilities.canParse(
- selectionRange, reporter))) {
+ !SelectionRangeClientCapabilities.canParse(
+ selectionRange, reporter)) {
reporter
.reportError('must be of type SelectionRangeClientCapabilities');
return false;
@@ -38086,8 +38860,8 @@
try {
final semanticTokens = obj['semanticTokens'];
if (semanticTokens != null &&
- !(SemanticTokensClientCapabilities.canParse(
- semanticTokens, reporter))) {
+ !SemanticTokensClientCapabilities.canParse(
+ semanticTokens, reporter)) {
reporter
.reportError('must be of type SemanticTokensClientCapabilities');
return false;
@@ -38099,8 +38873,8 @@
try {
final signatureHelp = obj['signatureHelp'];
if (signatureHelp != null &&
- !(SignatureHelpClientCapabilities.canParse(
- signatureHelp, reporter))) {
+ !SignatureHelpClientCapabilities.canParse(
+ signatureHelp, reporter)) {
reporter
.reportError('must be of type SignatureHelpClientCapabilities');
return false;
@@ -38112,8 +38886,8 @@
try {
final synchronization = obj['synchronization'];
if (synchronization != null &&
- !(TextDocumentSyncClientCapabilities.canParse(
- synchronization, reporter))) {
+ !TextDocumentSyncClientCapabilities.canParse(
+ synchronization, reporter)) {
reporter.reportError(
'must be of type TextDocumentSyncClientCapabilities');
return false;
@@ -38125,8 +38899,8 @@
try {
final typeDefinition = obj['typeDefinition'];
if (typeDefinition != null &&
- !(TypeDefinitionClientCapabilities.canParse(
- typeDefinition, reporter))) {
+ !TypeDefinitionClientCapabilities.canParse(
+ typeDefinition, reporter)) {
reporter
.reportError('must be of type TypeDefinitionClientCapabilities');
return false;
@@ -38138,10 +38912,10 @@
try {
final typeHierarchy = obj['typeHierarchy'];
if (typeHierarchy != null &&
- !(TypeHierarchyClientCapabilities1.canParse(
- typeHierarchy, reporter))) {
+ !TypeHierarchyClientCapabilities.canParse(
+ typeHierarchy, reporter)) {
reporter
- .reportError('must be of type TypeHierarchyClientCapabilities1');
+ .reportError('must be of type TypeHierarchyClientCapabilities');
return false;
}
} finally {
@@ -38266,6 +39040,7 @@
/// The new text for the provided range.
final String text;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['range'] = range.toJson();
@@ -38289,7 +39064,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -38299,7 +39074,7 @@
reporter.push('rangeLength');
try {
final rangeLength = obj['rangeLength'];
- if (rangeLength != null && !(rangeLength is int)) {
+ if (rangeLength != null && rangeLength is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -38317,7 +39092,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(text is String)) {
+ if (text is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -38374,6 +39149,7 @@
/// The new text of the whole document.
final String text;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['text'] = text;
@@ -38393,7 +39169,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(text is String)) {
+ if (text is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -38464,6 +39240,7 @@
/// The text document to change.
final OptionalVersionedTextDocumentIdentifier textDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['edits'] = edits;
@@ -38484,11 +39261,11 @@
reporter.reportError('must not be null');
return false;
}
- if (!((edits is List<Object?> &&
- (edits.every((item) =>
- (AnnotatedTextEdit.canParse(item, reporter) ||
- SnippetTextEdit.canParse(item, reporter) ||
- TextEdit.canParse(item, reporter))))))) {
+ if (edits is! List<Object?> ||
+ edits.any((item) =>
+ !AnnotatedTextEdit.canParse(item, reporter) &&
+ !SnippetTextEdit.canParse(item, reporter) &&
+ !TextEdit.canParse(item, reporter))) {
reporter.reportError(
'must be of type List<Either3<AnnotatedTextEdit, SnippetTextEdit, TextEdit>>');
return false;
@@ -38507,8 +39284,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!(OptionalVersionedTextDocumentIdentifier.canParse(
- textDocument, reporter))) {
+ if (!OptionalVersionedTextDocumentIdentifier.canParse(
+ textDocument, reporter)) {
reporter.reportError(
'must be of type OptionalVersionedTextDocumentIdentifier');
return false;
@@ -38549,25 +39326,25 @@
String toString() => jsonEncoder.convert(toJson());
}
-class TextDocumentFilter implements ToJsonable {
+class TextDocumentFilterWithScheme implements ToJsonable {
static const jsonHandler = LspJsonHandler(
- TextDocumentFilter.canParse,
- TextDocumentFilter.fromJson,
+ TextDocumentFilterWithScheme.canParse,
+ TextDocumentFilterWithScheme.fromJson,
);
- TextDocumentFilter({
+ TextDocumentFilterWithScheme({
this.language,
this.pattern,
this.scheme,
});
- static TextDocumentFilter fromJson(Map<String, Object?> json) {
+ static TextDocumentFilterWithScheme fromJson(Map<String, Object?> json) {
final languageJson = json['language'];
final language = languageJson as String?;
final patternJson = json['pattern'];
final pattern = patternJson as String?;
final schemeJson = json['scheme'];
final scheme = schemeJson as String?;
- return TextDocumentFilter(
+ return TextDocumentFilterWithScheme(
language: language,
pattern: pattern,
scheme: scheme,
@@ -38595,6 +39372,7 @@
/// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
final String? scheme;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (language != null) {
@@ -38614,7 +39392,7 @@
reporter.push('language');
try {
final language = obj['language'];
- if (language != null && !(language is String)) {
+ if (language != null && language is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -38624,7 +39402,7 @@
reporter.push('pattern');
try {
final pattern = obj['pattern'];
- if (pattern != null && !(pattern is String)) {
+ if (pattern != null && pattern is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -38634,7 +39412,7 @@
reporter.push('scheme');
try {
final scheme = obj['scheme'];
- if (scheme != null && !(scheme is String)) {
+ if (scheme != null && scheme is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -38643,15 +39421,15 @@
}
return true;
} else {
- reporter.reportError('must be of type TextDocumentFilter');
+ reporter.reportError('must be of type TextDocumentFilterWithScheme');
return false;
}
}
@override
bool operator ==(Object other) {
- if (other is TextDocumentFilter &&
- other.runtimeType == TextDocumentFilter) {
+ if (other is TextDocumentFilterWithScheme &&
+ other.runtimeType == TextDocumentFilterWithScheme) {
return language == other.language &&
pattern == other.pattern &&
scheme == other.scheme &&
@@ -38698,6 +39476,7 @@
/// The text document's URI.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['uri'] = uri;
@@ -38717,7 +39496,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -38789,6 +39568,7 @@
/// including undo/redo).
final int version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['languageId'] = languageId;
@@ -38811,7 +39591,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(languageId is String)) {
+ if (languageId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -38829,7 +39609,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(text is String)) {
+ if (text is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -38847,7 +39627,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -38865,7 +39645,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(version is int)) {
+ if (version is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -38976,6 +39756,7 @@
/// The text document.
final TextDocumentIdentifier textDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['position'] = position.toJson();
@@ -38996,7 +39777,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -39014,7 +39795,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -39159,8 +39940,8 @@
}
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
return TextDocumentRegistrationOptions(
documentSelector: documentSelector,
@@ -39169,8 +39950,9 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ final List<TextDocumentFilterWithScheme>? documentSelector;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -39187,10 +39969,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -39207,8 +39990,12 @@
bool operator ==(Object other) {
if (other is TextDocumentRegistrationOptions &&
other.runtimeType == TextDocumentRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
true;
}
return false;
@@ -39242,6 +40029,7 @@
/// or by an API call.
static const Manual = TextDocumentSaveReason(1);
+ @override
Object toJson() => _value;
@override
@@ -39250,6 +40038,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is TextDocumentSaveReason && other._value == _value;
}
@@ -39269,8 +40058,8 @@
Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final includeTextJson = json['includeText'];
final includeText = includeTextJson as bool?;
@@ -39282,11 +40071,13 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The client is supposed to include the content on save.
final bool? includeText;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -39306,10 +40097,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -39318,7 +40110,7 @@
reporter.push('includeText');
try {
final includeText = obj['includeText'];
- if (includeText != null && !(includeText is bool)) {
+ if (includeText != null && includeText is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -39337,8 +40129,12 @@
bool operator ==(Object other) {
if (other is TextDocumentSaveRegistrationOptions &&
other.runtimeType == TextDocumentSaveRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
includeText == other.includeText &&
true;
}
@@ -39399,6 +40195,7 @@
/// saved.
final bool? willSaveWaitUntil;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (didSave != null) {
@@ -39421,7 +40218,7 @@
reporter.push('didSave');
try {
final didSave = obj['didSave'];
- if (didSave != null && !(didSave is bool)) {
+ if (didSave != null && didSave is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -39431,7 +40228,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -39441,7 +40238,7 @@
reporter.push('willSave');
try {
final willSave = obj['willSave'];
- if (willSave != null && !(willSave is bool)) {
+ if (willSave != null && willSave is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -39451,7 +40248,7 @@
reporter.push('willSaveWaitUntil');
try {
final willSaveWaitUntil = obj['willSaveWaitUntil'];
- if (willSaveWaitUntil != null && !(willSaveWaitUntil is bool)) {
+ if (willSaveWaitUntil != null && willSaveWaitUntil is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -39513,6 +40310,7 @@
/// Documents should not be synced at all.
static const None = TextDocumentSyncKind(0);
+ @override
Object toJson() => _value;
@override
@@ -39521,6 +40319,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is TextDocumentSyncKind && other._value == _value;
}
@@ -39589,6 +40388,7 @@
/// omitted the request should not be sent.
final bool? willSaveWaitUntil;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (change != null) {
@@ -39615,7 +40415,7 @@
try {
final change = obj['change'];
if (change != null &&
- !(TextDocumentSyncKind.canParse(change, reporter))) {
+ !TextDocumentSyncKind.canParse(change, reporter)) {
reporter.reportError('must be of type TextDocumentSyncKind');
return false;
}
@@ -39625,7 +40425,7 @@
reporter.push('openClose');
try {
final openClose = obj['openClose'];
- if (openClose != null && !(openClose is bool)) {
+ if (openClose != null && openClose is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -39636,7 +40436,8 @@
try {
final save = obj['save'];
if (save != null &&
- !((save is bool || SaveOptions.canParse(save, reporter)))) {
+ save is! bool &&
+ !SaveOptions.canParse(save, reporter)) {
reporter.reportError('must be of type Either2<bool, SaveOptions>');
return false;
}
@@ -39646,7 +40447,7 @@
reporter.push('willSave');
try {
final willSave = obj['willSave'];
- if (willSave != null && !(willSave is bool)) {
+ if (willSave != null && willSave is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -39656,7 +40457,7 @@
reporter.push('willSaveWaitUntil');
try {
final willSaveWaitUntil = obj['willSaveWaitUntil'];
- if (willSaveWaitUntil != null && !(willSaveWaitUntil is bool)) {
+ if (willSaveWaitUntil != null && willSaveWaitUntil is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -39731,6 +40532,7 @@
/// document create a range where start === end.
final Range range;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['newText'] = newText;
@@ -39751,7 +40553,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(newText is String)) {
+ if (newText is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -39769,7 +40571,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -39813,6 +40615,7 @@
static const Relative = TokenFormat('relative');
+ @override
Object toJson() => _value;
@override
@@ -39821,6 +40624,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is TokenFormat && other._value == _value;
}
@@ -39855,6 +40659,7 @@
/// @since 3.14.0
final bool? linkSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -39871,7 +40676,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -39881,7 +40686,7 @@
reporter.push('linkSupport');
try {
final linkSupport = obj['linkSupport'];
- if (linkSupport != null && !(linkSupport is bool)) {
+ if (linkSupport != null && linkSupport is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -39936,8 +40741,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -39951,7 +40758,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -40030,17 +40837,22 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -40060,7 +40872,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -40078,7 +40891,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -40096,7 +40909,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -40107,7 +40920,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -40165,8 +40979,8 @@
static TypeDefinitionRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -40181,13 +40995,17 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -40210,10 +41028,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -40222,7 +41041,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -40232,7 +41051,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -40250,8 +41069,12 @@
bool operator ==(Object other) {
if (other is TypeDefinitionRegistrationOptions &&
other.runtimeType == TypeDefinitionRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -40270,19 +41093,19 @@
String toString() => jsonEncoder.convert(toJson());
}
-class TypeHierarchyClientCapabilities1 implements ToJsonable {
+class TypeHierarchyClientCapabilities implements ToJsonable {
static const jsonHandler = LspJsonHandler(
- TypeHierarchyClientCapabilities1.canParse,
- TypeHierarchyClientCapabilities1.fromJson,
+ TypeHierarchyClientCapabilities.canParse,
+ TypeHierarchyClientCapabilities.fromJson,
);
- TypeHierarchyClientCapabilities1({
+ TypeHierarchyClientCapabilities({
this.dynamicRegistration,
});
- static TypeHierarchyClientCapabilities1 fromJson(Map<String, Object?> json) {
+ static TypeHierarchyClientCapabilities fromJson(Map<String, Object?> json) {
final dynamicRegistrationJson = json['dynamicRegistration'];
final dynamicRegistration = dynamicRegistrationJson as bool?;
- return TypeHierarchyClientCapabilities1(
+ return TypeHierarchyClientCapabilities(
dynamicRegistration: dynamicRegistration,
);
}
@@ -40293,6 +41116,7 @@
/// capability as well.
final bool? dynamicRegistration;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -40306,7 +41130,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -40315,15 +41139,15 @@
}
return true;
} else {
- reporter.reportError('must be of type TypeHierarchyClientCapabilities1');
+ reporter.reportError('must be of type TypeHierarchyClientCapabilities');
return false;
}
}
@override
bool operator ==(Object other) {
- if (other is TypeHierarchyClientCapabilities1 &&
- other.runtimeType == TypeHierarchyClientCapabilities1) {
+ if (other is TypeHierarchyClientCapabilities &&
+ other.runtimeType == TypeHierarchyClientCapabilities) {
return dynamicRegistration == other.dynamicRegistration && true;
}
return false;
@@ -40414,6 +41238,7 @@
/// The resource identifier of this item.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (data != null) {
@@ -40438,7 +41263,7 @@
reporter.push('detail');
try {
final detail = obj['detail'];
- if (detail != null && !(detail is String)) {
+ if (detail != null && detail is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -40456,7 +41281,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(SymbolKind.canParse(kind, reporter))) {
+ if (!SymbolKind.canParse(kind, reporter)) {
reporter.reportError('must be of type SymbolKind');
return false;
}
@@ -40474,7 +41299,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(name is String)) {
+ if (name is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -40492,7 +41317,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(range, reporter))) {
+ if (!Range.canParse(range, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -40510,7 +41335,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Range.canParse(selectionRange, reporter))) {
+ if (!Range.canParse(selectionRange, reporter)) {
reporter.reportError('must be of type Range');
return false;
}
@@ -40521,8 +41346,8 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List<Object?> &&
- (tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
+ (tags is! List<Object?> ||
+ tags.any((item) => !SymbolTag.canParse(item, reporter)))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
@@ -40540,7 +41365,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -40606,8 +41431,10 @@
);
}
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -40621,7 +41448,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -40685,14 +41512,18 @@
}
/// The position inside the text document.
+ @override
final Position position;
/// The text document.
+ @override
final TextDocumentIdentifier textDocument;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['position'] = position.toJson();
@@ -40716,7 +41547,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(Position.canParse(position, reporter))) {
+ if (!Position.canParse(position, reporter)) {
reporter.reportError('must be of type Position');
return false;
}
@@ -40734,7 +41565,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -40745,7 +41576,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -40801,8 +41633,8 @@
static TypeHierarchyRegistrationOptions fromJson(Map<String, Object?> json) {
final documentSelectorJson = json['documentSelector'];
final documentSelector = (documentSelectorJson as List<Object?>?)
- ?.map(
- (item) => TextDocumentFilter.fromJson(item as Map<String, Object?>))
+ ?.map((item) =>
+ TextDocumentFilterWithScheme.fromJson(item as Map<String, Object?>))
.toList();
final idJson = json['id'];
final id = idJson as String?;
@@ -40817,13 +41649,17 @@
/// A document selector to identify the scope of the registration. If set to
/// null the document selector provided on the client side will be used.
- final List<TextDocumentFilter>? documentSelector;
+ @override
+ final List<TextDocumentFilterWithScheme>? documentSelector;
/// The id used to register the request. The id can be used to deregister the
/// request again. See also Registration#id.
+ @override
final String? id;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['documentSelector'] = documentSelector;
@@ -40846,10 +41682,11 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List<Object?> &&
- (documentSelector.every(
- (item) => TextDocumentFilter.canParse(item, reporter)))))) {
- reporter.reportError('must be of type List<TextDocumentFilter>');
+ (documentSelector is! List<Object?> ||
+ documentSelector.any((item) =>
+ !TextDocumentFilterWithScheme.canParse(item, reporter)))) {
+ reporter.reportError(
+ 'must be of type List<TextDocumentFilterWithScheme>');
return false;
}
} finally {
@@ -40858,7 +41695,7 @@
reporter.push('id');
try {
final id = obj['id'];
- if (id != null && !(id is String)) {
+ if (id != null && id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -40868,7 +41705,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -40886,8 +41723,12 @@
bool operator ==(Object other) {
if (other is TypeHierarchyRegistrationOptions &&
other.runtimeType == TypeHierarchyRegistrationOptions) {
- return listEqual(documentSelector, other.documentSelector,
- (TextDocumentFilter a, TextDocumentFilter b) => a == b) &&
+ return listEqual(
+ documentSelector,
+ other.documentSelector,
+ (TextDocumentFilterWithScheme a,
+ TextDocumentFilterWithScheme b) =>
+ a == b) &&
id == other.id &&
workDoneProgress == other.workDoneProgress &&
true;
@@ -40948,11 +41789,14 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['item'] = item.toJson();
@@ -40978,7 +41822,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TypeHierarchyItem.canParse(item, reporter))) {
+ if (!TypeHierarchyItem.canParse(item, reporter)) {
reporter.reportError('must be of type TypeHierarchyItem');
return false;
}
@@ -40989,7 +41833,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -41000,7 +41845,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -41079,11 +41925,14 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['item'] = item.toJson();
@@ -41109,7 +41958,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TypeHierarchyItem.canParse(item, reporter))) {
+ if (!TypeHierarchyItem.canParse(item, reporter)) {
reporter.reportError('must be of type TypeHierarchyItem');
return false;
}
@@ -41120,7 +41969,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -41131,7 +41981,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -41212,6 +42063,7 @@
/// document.
final String resultId;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['kind'] = kind;
@@ -41232,7 +42084,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'unchanged')) {
+ if (kind != 'unchanged') {
reporter.reportError('must be the literal \'unchanged\'');
return false;
}
@@ -41250,7 +42102,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(resultId is String)) {
+ if (resultId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -41309,6 +42161,7 @@
/// The moniker is unique inside the moniker scheme.
static const scheme = UniquenessLevel('scheme');
+ @override
Object toJson() => _value;
@override
@@ -41317,6 +42170,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is UniquenessLevel && other._value == _value;
}
@@ -41350,6 +42204,7 @@
/// The method / capability to unregister for.
final String method;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['id'] = id;
@@ -41370,7 +42225,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(id is String)) {
+ if (id is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -41388,7 +42243,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(method is String)) {
+ if (method is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -41444,6 +42299,7 @@
/// of the specification.
final List<Unregistration> unregisterations;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['unregisterations'] =
@@ -41464,9 +42320,9 @@
reporter.reportError('must not be null');
return false;
}
- if (!((unregisterations is List<Object?> &&
- (unregisterations
- .every((item) => Unregistration.canParse(item, reporter)))))) {
+ if (unregisterations is! List<Object?> ||
+ unregisterations
+ .any((item) => !Unregistration.canParse(item, reporter))) {
reporter.reportError('must be of type List<Unregistration>');
return false;
}
@@ -41528,6 +42384,7 @@
/// The version number of this notebook document.
final int version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['uri'] = uri;
@@ -41548,7 +42405,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -41566,7 +42423,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(version is int)) {
+ if (version is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -41623,6 +42480,7 @@
}
/// The text document's URI.
+ @override
final String uri;
/// The version number of this document.
@@ -41631,6 +42489,7 @@
/// including undo/redo. The number doesn't need to be consecutive.
final int version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['uri'] = uri;
@@ -41651,7 +42510,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -41669,7 +42528,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(version is int)) {
+ if (version is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -41721,6 +42580,7 @@
/// Interested in delete events
static const Delete = WatchKind(4);
+ @override
Object toJson() => _value;
@override
@@ -41729,6 +42589,7 @@
@override
int get hashCode => _value.hashCode;
+ @override
bool operator ==(Object other) =>
other is WatchKind && other._value == _value;
}
@@ -41762,6 +42623,7 @@
/// The document that will be saved.
final TextDocumentIdentifier textDocument;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['reason'] = reason.toJson();
@@ -41782,7 +42644,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentSaveReason.canParse(reason, reporter))) {
+ if (!TextDocumentSaveReason.canParse(reason, reporter)) {
reporter.reportError('must be of type TextDocumentSaveReason');
return false;
}
@@ -41800,7 +42662,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(TextDocumentIdentifier.canParse(textDocument, reporter))) {
+ if (!TextDocumentIdentifier.canParse(textDocument, reporter)) {
reporter.reportError('must be of type TextDocumentIdentifier');
return false;
}
@@ -41883,6 +42745,7 @@
/// @since 3.15.0
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (showDocument != null) {
@@ -41903,8 +42766,7 @@
try {
final showDocument = obj['showDocument'];
if (showDocument != null &&
- !(ShowDocumentClientCapabilities.canParse(
- showDocument, reporter))) {
+ !ShowDocumentClientCapabilities.canParse(showDocument, reporter)) {
reporter
.reportError('must be of type ShowDocumentClientCapabilities');
return false;
@@ -41916,8 +42778,8 @@
try {
final showMessage = obj['showMessage'];
if (showMessage != null &&
- !(ShowMessageRequestClientCapabilities.canParse(
- showMessage, reporter))) {
+ !ShowMessageRequestClientCapabilities.canParse(
+ showMessage, reporter)) {
reporter.reportError(
'must be of type ShowMessageRequestClientCapabilities');
return false;
@@ -41928,7 +42790,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -42029,6 +42891,7 @@
/// Examples: "Indexing" or "Linking dependencies".
final String title;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (cancellable != null) {
@@ -42050,7 +42913,7 @@
reporter.push('cancellable');
try {
final cancellable = obj['cancellable'];
- if (cancellable != null && !(cancellable is bool)) {
+ if (cancellable != null && cancellable is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -42068,7 +42931,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'begin')) {
+ if (kind != 'begin') {
reporter.reportError('must be the literal \'begin\'');
return false;
}
@@ -42078,7 +42941,7 @@
reporter.push('message');
try {
final message = obj['message'];
- if (message != null && !(message is String)) {
+ if (message != null && message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -42088,7 +42951,7 @@
reporter.push('percentage');
try {
final percentage = obj['percentage'];
- if (percentage != null && !(percentage is int)) {
+ if (percentage != null && percentage is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -42106,7 +42969,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(title is String)) {
+ if (title is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -42171,6 +43034,7 @@
/// The token to be used to report progress.
final Either2<int, String> token;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['token'] = token;
@@ -42190,7 +43054,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((token is int || token is String))) {
+ if (token is! int && token is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -42244,6 +43108,7 @@
/// The token to be used to report progress.
final Either2<int, String> token;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['token'] = token;
@@ -42263,7 +43128,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((token is int || token is String))) {
+ if (token is! int && token is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -42324,6 +43189,7 @@
/// of the operation.
final String? message;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['kind'] = kind;
@@ -42346,7 +43212,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'end')) {
+ if (kind != 'end') {
reporter.reportError('must be the literal \'end\'');
return false;
}
@@ -42356,7 +43222,7 @@
reporter.push('message');
try {
final message = obj['message'];
- if (message != null && !(message is String)) {
+ if (message != null && message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -42495,6 +43361,7 @@
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneProgress != null) {
@@ -42508,7 +43375,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -42656,6 +43523,9 @@
if (MonikerParams.canParse(json, nullLspJsonReporter)) {
return MonikerParams.fromJson(json);
}
+ if (PrepareRenameParams.canParse(json, nullLspJsonReporter)) {
+ return PrepareRenameParams.fromJson(json);
+ }
if (TypeDefinitionParams.canParse(json, nullLspJsonReporter)) {
return TypeDefinitionParams.fromJson(json);
}
@@ -42678,6 +43548,7 @@
/// An optional token that a server can use to report work done progress.
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (workDoneToken != null) {
@@ -42692,7 +43563,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -42778,6 +43650,7 @@
/// that are not following this rule. The value range is [0, 100]
final int? percentage;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (cancellable != null) {
@@ -42798,7 +43671,7 @@
reporter.push('cancellable');
try {
final cancellable = obj['cancellable'];
- if (cancellable != null && !(cancellable is bool)) {
+ if (cancellable != null && cancellable is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -42816,7 +43689,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'report')) {
+ if (kind != 'report') {
reporter.reportError('must be the literal \'report\'');
return false;
}
@@ -42826,7 +43699,7 @@
reporter.push('message');
try {
final message = obj['message'];
- if (message != null && !(message is String)) {
+ if (message != null && message is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -42836,7 +43709,7 @@
reporter.push('percentage');
try {
final percentage = obj['percentage'];
- if (percentage != null && !(percentage is int)) {
+ if (percentage != null && percentage is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -43031,6 +43904,7 @@
/// @since 3.6.0
final bool? workspaceFolders;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (applyEdit != null) {
@@ -43083,7 +43957,7 @@
reporter.push('applyEdit');
try {
final applyEdit = obj['applyEdit'];
- if (applyEdit != null && !(applyEdit is bool)) {
+ if (applyEdit != null && applyEdit is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -43094,8 +43968,7 @@
try {
final codeLens = obj['codeLens'];
if (codeLens != null &&
- !(CodeLensWorkspaceClientCapabilities.canParse(
- codeLens, reporter))) {
+ !CodeLensWorkspaceClientCapabilities.canParse(codeLens, reporter)) {
reporter.reportError(
'must be of type CodeLensWorkspaceClientCapabilities');
return false;
@@ -43106,7 +43979,7 @@
reporter.push('configuration');
try {
final configuration = obj['configuration'];
- if (configuration != null && !(configuration is bool)) {
+ if (configuration != null && configuration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -43117,8 +43990,8 @@
try {
final diagnostics = obj['diagnostics'];
if (diagnostics != null &&
- !(DiagnosticWorkspaceClientCapabilities.canParse(
- diagnostics, reporter))) {
+ !DiagnosticWorkspaceClientCapabilities.canParse(
+ diagnostics, reporter)) {
reporter.reportError(
'must be of type DiagnosticWorkspaceClientCapabilities');
return false;
@@ -43130,8 +44003,8 @@
try {
final didChangeConfiguration = obj['didChangeConfiguration'];
if (didChangeConfiguration != null &&
- !(DidChangeConfigurationClientCapabilities.canParse(
- didChangeConfiguration, reporter))) {
+ !DidChangeConfigurationClientCapabilities.canParse(
+ didChangeConfiguration, reporter)) {
reporter.reportError(
'must be of type DidChangeConfigurationClientCapabilities');
return false;
@@ -43143,8 +44016,8 @@
try {
final didChangeWatchedFiles = obj['didChangeWatchedFiles'];
if (didChangeWatchedFiles != null &&
- !(DidChangeWatchedFilesClientCapabilities.canParse(
- didChangeWatchedFiles, reporter))) {
+ !DidChangeWatchedFilesClientCapabilities.canParse(
+ didChangeWatchedFiles, reporter)) {
reporter.reportError(
'must be of type DidChangeWatchedFilesClientCapabilities');
return false;
@@ -43156,8 +44029,8 @@
try {
final executeCommand = obj['executeCommand'];
if (executeCommand != null &&
- !(ExecuteCommandClientCapabilities.canParse(
- executeCommand, reporter))) {
+ !ExecuteCommandClientCapabilities.canParse(
+ executeCommand, reporter)) {
reporter
.reportError('must be of type ExecuteCommandClientCapabilities');
return false;
@@ -43169,8 +44042,8 @@
try {
final fileOperations = obj['fileOperations'];
if (fileOperations != null &&
- !(FileOperationClientCapabilities.canParse(
- fileOperations, reporter))) {
+ !FileOperationClientCapabilities.canParse(
+ fileOperations, reporter)) {
reporter
.reportError('must be of type FileOperationClientCapabilities');
return false;
@@ -43182,8 +44055,8 @@
try {
final inlayHint = obj['inlayHint'];
if (inlayHint != null &&
- !(InlayHintWorkspaceClientCapabilities.canParse(
- inlayHint, reporter))) {
+ !InlayHintWorkspaceClientCapabilities.canParse(
+ inlayHint, reporter)) {
reporter.reportError(
'must be of type InlayHintWorkspaceClientCapabilities');
return false;
@@ -43195,8 +44068,8 @@
try {
final inlineValue = obj['inlineValue'];
if (inlineValue != null &&
- !(InlineValueWorkspaceClientCapabilities.canParse(
- inlineValue, reporter))) {
+ !InlineValueWorkspaceClientCapabilities.canParse(
+ inlineValue, reporter)) {
reporter.reportError(
'must be of type InlineValueWorkspaceClientCapabilities');
return false;
@@ -43208,8 +44081,8 @@
try {
final semanticTokens = obj['semanticTokens'];
if (semanticTokens != null &&
- !(SemanticTokensWorkspaceClientCapabilities.canParse(
- semanticTokens, reporter))) {
+ !SemanticTokensWorkspaceClientCapabilities.canParse(
+ semanticTokens, reporter)) {
reporter.reportError(
'must be of type SemanticTokensWorkspaceClientCapabilities');
return false;
@@ -43221,7 +44094,7 @@
try {
final symbol = obj['symbol'];
if (symbol != null &&
- !(WorkspaceSymbolClientCapabilities.canParse(symbol, reporter))) {
+ !WorkspaceSymbolClientCapabilities.canParse(symbol, reporter)) {
reporter
.reportError('must be of type WorkspaceSymbolClientCapabilities');
return false;
@@ -43233,8 +44106,8 @@
try {
final workspaceEdit = obj['workspaceEdit'];
if (workspaceEdit != null &&
- !(WorkspaceEditClientCapabilities.canParse(
- workspaceEdit, reporter))) {
+ !WorkspaceEditClientCapabilities.canParse(
+ workspaceEdit, reporter)) {
reporter
.reportError('must be of type WorkspaceEditClientCapabilities');
return false;
@@ -43245,7 +44118,7 @@
reporter.push('workspaceFolders');
try {
final workspaceFolders = obj['workspaceFolders'];
- if (workspaceFolders != null && !(workspaceFolders is bool)) {
+ if (workspaceFolders != null && workspaceFolders is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -43355,14 +44228,17 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// The currently known diagnostic reports with their previous result ids.
final List<PreviousResultId> previousResultIds;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (identifier != null) {
@@ -43384,7 +44260,7 @@
reporter.push('identifier');
try {
final identifier = obj['identifier'];
- if (identifier != null && !(identifier is String)) {
+ if (identifier != null && identifier is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -43395,7 +44271,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -43413,9 +44290,9 @@
reporter.reportError('must not be null');
return false;
}
- if (!((previousResultIds is List<Object?> &&
- (previousResultIds.every(
- (item) => PreviousResultId.canParse(item, reporter)))))) {
+ if (previousResultIds is! List<Object?> ||
+ previousResultIds
+ .any((item) => !PreviousResultId.canParse(item, reporter))) {
reporter.reportError('must be of type List<PreviousResultId>');
return false;
}
@@ -43426,7 +44303,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -43501,6 +44379,7 @@
Either2<WorkspaceFullDocumentDiagnosticReport,
WorkspaceUnchangedDocumentDiagnosticReport>> items;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['items'] = items;
@@ -43520,12 +44399,12 @@
reporter.reportError('must not be null');
return false;
}
- if (!((items is List<Object?> &&
- (items.every((item) =>
- (WorkspaceFullDocumentDiagnosticReport.canParse(
- item, reporter) ||
- WorkspaceUnchangedDocumentDiagnosticReport.canParse(
- item, reporter))))))) {
+ if (items is! List<Object?> ||
+ items.any((item) =>
+ !WorkspaceFullDocumentDiagnosticReport.canParse(
+ item, reporter) &&
+ !WorkspaceUnchangedDocumentDiagnosticReport.canParse(
+ item, reporter))) {
reporter.reportError(
'must be of type List<Either2<WorkspaceFullDocumentDiagnosticReport, WorkspaceUnchangedDocumentDiagnosticReport>>');
return false;
@@ -43602,6 +44481,7 @@
Either2<WorkspaceFullDocumentDiagnosticReport,
WorkspaceUnchangedDocumentDiagnosticReport>> items;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['items'] = items;
@@ -43621,12 +44501,12 @@
reporter.reportError('must not be null');
return false;
}
- if (!((items is List<Object?> &&
- (items.every((item) =>
- (WorkspaceFullDocumentDiagnosticReport.canParse(
- item, reporter) ||
- WorkspaceUnchangedDocumentDiagnosticReport.canParse(
- item, reporter))))))) {
+ if (items is! List<Object?> ||
+ items.any((item) =>
+ !WorkspaceFullDocumentDiagnosticReport.canParse(
+ item, reporter) &&
+ !WorkspaceUnchangedDocumentDiagnosticReport.canParse(
+ item, reporter))) {
reporter.reportError(
'must be of type List<Either2<WorkspaceFullDocumentDiagnosticReport, WorkspaceUnchangedDocumentDiagnosticReport>>');
return false;
@@ -43742,6 +44622,7 @@
final List<Either4<CreateFile, DeleteFile, RenameFile, TextDocumentEdit>>?
documentChanges;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (changeAnnotations != null) {
@@ -43762,11 +44643,11 @@
try {
final changeAnnotations = obj['changeAnnotations'];
if (changeAnnotations != null &&
- !((changeAnnotations is Map &&
- (changeAnnotations.keys.every((item) =>
- item is String &&
- changeAnnotations.values.every((item) =>
- ChangeAnnotation.canParse(item, reporter))))))) {
+ (changeAnnotations is! Map ||
+ (changeAnnotations.keys.any((item) =>
+ item is! String ||
+ changeAnnotations.values.any((item) =>
+ !ChangeAnnotation.canParse(item, reporter)))))) {
reporter.reportError('must be of type Map<String, ChangeAnnotation>');
return false;
}
@@ -43777,12 +44658,13 @@
try {
final changes = obj['changes'];
if (changes != null &&
- !((changes is Map &&
- (changes.keys.every((item) =>
- item is String &&
- changes.values.every((item) => (item is List<Object?> &&
- (item.every((item) =>
- TextEdit.canParse(item, reporter)))))))))) {
+ (changes is! Map ||
+ (changes.keys.any((item) =>
+ item is! String ||
+ changes.values.any((item) =>
+ item is! List<Object?> ||
+ item.any(
+ (item) => !TextEdit.canParse(item, reporter))))))) {
reporter.reportError('must be of type Map<String, List<TextEdit>>');
return false;
}
@@ -43793,12 +44675,12 @@
try {
final documentChanges = obj['documentChanges'];
if (documentChanges != null &&
- !((documentChanges is List<Object?> &&
- (documentChanges.every((item) =>
- (CreateFile.canParse(item, reporter) ||
- DeleteFile.canParse(item, reporter) ||
- RenameFile.canParse(item, reporter) ||
- TextDocumentEdit.canParse(item, reporter))))))) {
+ (documentChanges is! List<Object?> ||
+ documentChanges.any((item) =>
+ !CreateFile.canParse(item, reporter) &&
+ !DeleteFile.canParse(item, reporter) &&
+ !RenameFile.canParse(item, reporter) &&
+ !TextDocumentEdit.canParse(item, reporter)))) {
reporter.reportError(
'must be of type List<Either4<CreateFile, DeleteFile, RenameFile, TextDocumentEdit>>');
return false;
@@ -43912,6 +44794,7 @@
/// @since 3.13.0
final List<ResourceOperationKind>? resourceOperations;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (changeAnnotationSupport != null) {
@@ -43939,8 +44822,8 @@
try {
final changeAnnotationSupport = obj['changeAnnotationSupport'];
if (changeAnnotationSupport != null &&
- !(WorkspaceEditClientCapabilitiesChangeAnnotationSupport.canParse(
- changeAnnotationSupport, reporter))) {
+ !WorkspaceEditClientCapabilitiesChangeAnnotationSupport.canParse(
+ changeAnnotationSupport, reporter)) {
reporter.reportError(
'must be of type WorkspaceEditClientCapabilitiesChangeAnnotationSupport');
return false;
@@ -43951,7 +44834,7 @@
reporter.push('documentChanges');
try {
final documentChanges = obj['documentChanges'];
- if (documentChanges != null && !(documentChanges is bool)) {
+ if (documentChanges != null && documentChanges is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -43962,7 +44845,7 @@
try {
final failureHandling = obj['failureHandling'];
if (failureHandling != null &&
- !(FailureHandlingKind.canParse(failureHandling, reporter))) {
+ !FailureHandlingKind.canParse(failureHandling, reporter)) {
reporter.reportError('must be of type FailureHandlingKind');
return false;
}
@@ -43972,7 +44855,7 @@
reporter.push('normalizesLineEndings');
try {
final normalizesLineEndings = obj['normalizesLineEndings'];
- if (normalizesLineEndings != null && !(normalizesLineEndings is bool)) {
+ if (normalizesLineEndings != null && normalizesLineEndings is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -43983,9 +44866,9 @@
try {
final resourceOperations = obj['resourceOperations'];
if (resourceOperations != null &&
- !((resourceOperations is List<Object?> &&
- (resourceOperations.every((item) =>
- ResourceOperationKind.canParse(item, reporter)))))) {
+ (resourceOperations is! List<Object?> ||
+ resourceOperations.any((item) =>
+ !ResourceOperationKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<ResourceOperationKind>');
return false;
}
@@ -44051,6 +44934,7 @@
/// node.
final bool? groupsOnLabel;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (groupsOnLabel != null) {
@@ -44064,7 +44948,7 @@
reporter.push('groupsOnLabel');
try {
final groupsOnLabel = obj['groupsOnLabel'];
- if (groupsOnLabel != null && !(groupsOnLabel is bool)) {
+ if (groupsOnLabel != null && groupsOnLabel is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -44124,6 +45008,7 @@
/// The associated URI for this workspace folder.
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['name'] = name;
@@ -44144,7 +45029,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(name is String)) {
+ if (name is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -44162,7 +45047,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -44226,6 +45111,7 @@
/// The array of the removed workspace folders
final List<WorkspaceFolder> removed;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['added'] = added.map((item) => item.toJson()).toList();
@@ -44246,9 +45132,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((added is List<Object?> &&
- (added
- .every((item) => WorkspaceFolder.canParse(item, reporter)))))) {
+ if (added is! List<Object?> ||
+ added.any((item) => !WorkspaceFolder.canParse(item, reporter))) {
reporter.reportError('must be of type List<WorkspaceFolder>');
return false;
}
@@ -44266,9 +45151,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((removed is List<Object?> &&
- (removed
- .every((item) => WorkspaceFolder.canParse(item, reporter)))))) {
+ if (removed is! List<Object?> ||
+ removed.any((item) => !WorkspaceFolder.canParse(item, reporter))) {
reporter.reportError('must be of type List<WorkspaceFolder>');
return false;
}
@@ -44344,6 +45228,7 @@
/// The server has support for workspace folders
final bool? supported;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (changeNotifications != null) {
@@ -44361,7 +45246,8 @@
try {
final changeNotifications = obj['changeNotifications'];
if (changeNotifications != null &&
- !((changeNotifications is bool || changeNotifications is String))) {
+ changeNotifications is! bool &&
+ changeNotifications is! String) {
reporter.reportError('must be of type Either2<bool, String>');
return false;
}
@@ -44371,7 +45257,7 @@
reporter.push('supported');
try {
final supported = obj['supported'];
- if (supported != null && !(supported is bool)) {
+ if (supported != null && supported is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -44451,13 +45337,16 @@
}
/// The actual items.
+ @override
final List<Diagnostic> items;
/// A full document diagnostic report.
+ @override
final String kind;
/// An optional result id. If provided it will be sent on the next diagnostic
/// request for the same document.
+ @override
final String? resultId;
/// The URI for which diagnostic information is reported.
@@ -44467,6 +45356,7 @@
/// is not marked as open `null` can be provided.
final int? version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['items'] = items.map((item) => item.toJson()).toList();
@@ -44492,8 +45382,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((items is List<Object?> &&
- (items.every((item) => Diagnostic.canParse(item, reporter)))))) {
+ if (items is! List<Object?> ||
+ items.any((item) => !Diagnostic.canParse(item, reporter))) {
reporter.reportError('must be of type List<Diagnostic>');
return false;
}
@@ -44511,7 +45401,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'full')) {
+ if (kind != 'full') {
reporter.reportError('must be the literal \'full\'');
return false;
}
@@ -44521,7 +45411,7 @@
reporter.push('resultId');
try {
final resultId = obj['resultId'];
- if (resultId != null && !(resultId is String)) {
+ if (resultId != null && resultId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -44539,7 +45429,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -44553,7 +45443,7 @@
return false;
}
final version = obj['version'];
- if (version != null && !(version is int)) {
+ if (version != null && version is! int) {
reporter.reportError('must be of type int');
return false;
}
@@ -44662,6 +45552,7 @@
/// Tags for this completion item.
final List<SymbolTag>? tags;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (containerName != null) {
@@ -44681,7 +45572,7 @@
reporter.push('containerName');
try {
final containerName = obj['containerName'];
- if (containerName != null && !(containerName is String)) {
+ if (containerName != null && containerName is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -44699,7 +45590,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(SymbolKind.canParse(kind, reporter))) {
+ if (!SymbolKind.canParse(kind, reporter)) {
reporter.reportError('must be of type SymbolKind');
return false;
}
@@ -44717,8 +45608,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((Location.canParse(location, reporter) ||
- WorkspaceSymbolLocation.canParse(location, reporter)))) {
+ if (!Location.canParse(location, reporter) &&
+ !WorkspaceSymbolLocation.canParse(location, reporter)) {
reporter.reportError(
'must be of type Either2<Location, WorkspaceSymbolLocation>');
return false;
@@ -44737,7 +45628,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(name is String)) {
+ if (name is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -44748,8 +45639,8 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List<Object?> &&
- (tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
+ (tags is! List<Object?> ||
+ tags.any((item) => !SymbolTag.canParse(item, reporter)))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
@@ -44845,6 +45736,7 @@
/// @since 3.16.0
final WorkspaceSymbolClientCapabilitiesTagSupport? tagSupport;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (dynamicRegistration != null) {
@@ -44867,7 +45759,7 @@
reporter.push('dynamicRegistration');
try {
final dynamicRegistration = obj['dynamicRegistration'];
- if (dynamicRegistration != null && !(dynamicRegistration is bool)) {
+ if (dynamicRegistration != null && dynamicRegistration is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -44878,8 +45770,8 @@
try {
final resolveSupport = obj['resolveSupport'];
if (resolveSupport != null &&
- !(WorkspaceSymbolClientCapabilitiesResolveSupport.canParse(
- resolveSupport, reporter))) {
+ !WorkspaceSymbolClientCapabilitiesResolveSupport.canParse(
+ resolveSupport, reporter)) {
reporter.reportError(
'must be of type WorkspaceSymbolClientCapabilitiesResolveSupport');
return false;
@@ -44891,8 +45783,8 @@
try {
final symbolKind = obj['symbolKind'];
if (symbolKind != null &&
- !(WorkspaceSymbolClientCapabilitiesSymbolKind.canParse(
- symbolKind, reporter))) {
+ !WorkspaceSymbolClientCapabilitiesSymbolKind.canParse(
+ symbolKind, reporter)) {
reporter.reportError(
'must be of type WorkspaceSymbolClientCapabilitiesSymbolKind');
return false;
@@ -44904,8 +45796,8 @@
try {
final tagSupport = obj['tagSupport'];
if (tagSupport != null &&
- !(WorkspaceSymbolClientCapabilitiesTagSupport.canParse(
- tagSupport, reporter))) {
+ !WorkspaceSymbolClientCapabilitiesTagSupport.canParse(
+ tagSupport, reporter)) {
reporter.reportError(
'must be of type WorkspaceSymbolClientCapabilitiesTagSupport');
return false;
@@ -44968,6 +45860,7 @@
/// The properties that a client can resolve lazily. Usually `location.range`
final List<String> properties;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['properties'] = properties;
@@ -44987,8 +45880,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((properties is List<Object?> &&
- (properties.every((item) => item is String))))) {
+ if (properties is! List<Object?> ||
+ properties.any((item) => item is! String)) {
reporter.reportError('must be of type List<String>');
return false;
}
@@ -45049,6 +45942,7 @@
/// from `File` to `Array` as defined in the initial version of the protocol.
final List<SymbolKind>? valueSet;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (valueSet != null) {
@@ -45063,9 +45957,8 @@
try {
final valueSet = obj['valueSet'];
if (valueSet != null &&
- !((valueSet is List<Object?> &&
- (valueSet
- .every((item) => SymbolKind.canParse(item, reporter)))))) {
+ (valueSet is! List<Object?> ||
+ valueSet.any((item) => !SymbolKind.canParse(item, reporter)))) {
reporter.reportError('must be of type List<SymbolKind>');
return false;
}
@@ -45121,6 +46014,7 @@
/// The tags supported by the client.
final List<SymbolTag> valueSet;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
@@ -45140,8 +46034,8 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List<Object?> &&
- (valueSet.every((item) => SymbolTag.canParse(item, reporter)))))) {
+ if (valueSet is! List<Object?> ||
+ valueSet.any((item) => !SymbolTag.canParse(item, reporter))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
}
@@ -45193,6 +46087,7 @@
final String uri;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['uri'] = uri;
@@ -45212,7 +46107,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -45271,8 +46166,10 @@
/// workspace symbol.
/// @since 3.17.0
final bool? resolveProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (resolveProvider != null) {
@@ -45289,7 +46186,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -45299,7 +46196,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -45375,6 +46272,7 @@
/// An optional token that a server can use to report partial results (e.g.
/// streaming) to the client.
+ @override
final Either2<int, String>? partialResultToken;
/// A query string to filter symbols by. Clients may send an empty string here
@@ -45382,8 +46280,10 @@
final String query;
/// An optional token that a server can use to report work done progress.
+ @override
final Either2<int, String>? workDoneToken;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (partialResultToken != null) {
@@ -45402,7 +46302,8 @@
try {
final partialResultToken = obj['partialResultToken'];
if (partialResultToken != null &&
- !((partialResultToken is int || partialResultToken is String))) {
+ partialResultToken is! int &&
+ partialResultToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -45420,7 +46321,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(query is String)) {
+ if (query is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -45431,7 +46332,8 @@
try {
final workDoneToken = obj['workDoneToken'];
if (workDoneToken != null &&
- !((workDoneToken is int || workDoneToken is String))) {
+ workDoneToken is! int &&
+ workDoneToken is! String) {
reporter.reportError('must be of type Either2<int, String>');
return false;
}
@@ -45494,9 +46396,12 @@
/// The server provides support to resolve additional information for a
/// workspace symbol.
/// @since 3.17.0
+ @override
final bool? resolveProvider;
+ @override
final bool? workDoneProgress;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
if (resolveProvider != null) {
@@ -45513,7 +46418,7 @@
reporter.push('resolveProvider');
try {
final resolveProvider = obj['resolveProvider'];
- if (resolveProvider != null && !(resolveProvider is bool)) {
+ if (resolveProvider != null && resolveProvider is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -45523,7 +46428,7 @@
reporter.push('workDoneProgress');
try {
final workDoneProgress = obj['workDoneProgress'];
- if (workDoneProgress != null && !(workDoneProgress is bool)) {
+ if (workDoneProgress != null && workDoneProgress is! bool) {
reporter.reportError('must be of type bool');
return false;
}
@@ -45598,10 +46503,12 @@
/// A document diagnostic report indicating no changes to the last result. A
/// server can only return `unchanged` if result ids are provided.
+ @override
final String kind;
/// A result id which will be sent on the next diagnostic request for the same
/// document.
+ @override
final String resultId;
/// The URI for which diagnostic information is reported.
@@ -45611,6 +46518,7 @@
/// is not marked as open `null` can be provided.
final int? version;
+ @override
Map<String, Object?> toJson() {
var result = <String, Object?>{};
result['kind'] = kind;
@@ -45633,7 +46541,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(kind == 'unchanged')) {
+ if (kind != 'unchanged') {
reporter.reportError('must be the literal \'unchanged\'');
return false;
}
@@ -45651,7 +46559,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(resultId is String)) {
+ if (resultId is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -45669,7 +46577,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!(uri is String)) {
+ if (uri is! String) {
reporter.reportError('must be of type String');
return false;
}
@@ -45683,7 +46591,7 @@
return false;
}
final version = obj['version'];
- if (version != null && !(version is int)) {
+ if (version != null && version is! int) {
reporter.reportError('must be of type int');
return false;
}
diff --git a/pkg/analysis_server/lib/protocol/protocol_constants.dart b/pkg/analysis_server/lib/protocol/protocol_constants.dart
index e1e3e17..4867f3d 100644
--- a/pkg/analysis_server/lib/protocol/protocol_constants.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_constants.dart
@@ -8,7 +8,7 @@
// ignore_for_file: constant_identifier_names
-const String PROTOCOL_VERSION = '1.33.0';
+const String PROTOCOL_VERSION = '1.33.1';
const String ANALYSIS_NOTIFICATION_ANALYZED_FILES = 'analysis.analyzedFiles';
const String ANALYSIS_NOTIFICATION_ANALYZED_FILES_DIRECTORIES = 'directories';
diff --git a/pkg/analysis_server/lib/src/lsp/mapping.dart b/pkg/analysis_server/lib/src/lsp/mapping.dart
index 59eb715..d7db246 100644
--- a/pkg/analysis_server/lib/src/lsp/mapping.dart
+++ b/pkg/analysis_server/lib/src/lsp/mapping.dart
@@ -153,6 +153,7 @@
change.linkedEditGroups,
lineInfo,
selectionOffset: change.selection?.offset,
+ selectionLength: change.selectionLength,
);
// Compile the edits into a TextDocumentEdit for this file.
@@ -908,6 +909,7 @@
required List<server.LinkedEditGroup> editGroups,
required int editOffset,
required int? selectionOffset,
+ required int? selectionLength,
}) {
return lsp.SnippetTextEdit(
insertTextFormat: lsp.InsertTextFormat.Snippet,
@@ -918,6 +920,7 @@
editGroups: editGroups,
editOffset: editOffset,
selectionOffset: selectionOffset,
+ selectionLength: selectionLength,
),
);
}
@@ -982,6 +985,8 @@
lineInfo,
selectionOffset:
changes.selection?.file == file ? changes.selection?.offset : null,
+ selectionLength:
+ changes.selection?.file == file ? changes.selectionLength : null,
);
// For LSP, we need to provide the main edit and other edits separately. The
@@ -1477,6 +1482,7 @@
List<server.LinkedEditGroup> editGroups,
LineInfo lineInfo, {
required int? selectionOffset,
+ required int? selectionLength,
}) {
final snippetEdits = <lsp.SnippetTextEdit>[];
@@ -1497,6 +1503,7 @@
editGroups: editGroups,
editOffset: edit.offset + offsetDelta,
selectionOffset: selectionOffset,
+ selectionLength: selectionLength,
));
offsetDelta += edit.replacement.length - edit.length;
diff --git a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart
index 5b47d0a..3d987f2 100644
--- a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart
+++ b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart
@@ -137,12 +137,13 @@
Set<Registration> currentRegistrations = {};
var _lastRegistrationId = 0;
- final dartFiles = TextDocumentFilter(language: 'dart', scheme: 'file');
- final pubspecFile = TextDocumentFilter(
+ final dartFiles =
+ TextDocumentFilterWithScheme(language: 'dart', scheme: 'file');
+ final pubspecFile = TextDocumentFilterWithScheme(
language: 'yaml', scheme: 'file', pattern: '**/pubspec.yaml');
- final analysisOptionsFile = TextDocumentFilter(
+ final analysisOptionsFile = TextDocumentFilterWithScheme(
language: 'yaml', scheme: 'file', pattern: '**/analysis_options.yaml');
- final fixDataFile = TextDocumentFilter(
+ final fixDataFile = TextDocumentFilterWithScheme(
language: 'yaml', scheme: 'file', pattern: '**/lib/fix_data.yaml');
ServerCapabilitiesComputer(this._server);
@@ -303,7 +304,8 @@
// All published plugins use something like `*.extension` as
// interestingFiles. Prefix a `**/` so that the glob matches nested
// folders as well.
- .map((glob) => TextDocumentFilter(scheme: 'file', pattern: '**/$glob'));
+ .map((glob) =>
+ TextDocumentFilterWithScheme(scheme: 'file', pattern: '**/$glob'));
final pluginTypesExcludingDart =
pluginTypes.where((filter) => filter.pattern != '**/*.dart');
diff --git a/pkg/analysis_server/lib/src/lsp/snippets.dart b/pkg/analysis_server/lib/src/lsp/snippets.dart
index 3cec1f0..afc2155 100644
--- a/pkg/analysis_server/lib/src/lsp/snippets.dart
+++ b/pkg/analysis_server/lib/src/lsp/snippets.dart
@@ -21,6 +21,7 @@
required List<server.LinkedEditGroup> editGroups,
required int editOffset,
int? selectionOffset,
+ int? selectionLength,
}) =>
_buildSnippetString(
text,
@@ -29,6 +30,7 @@
editGroupsOffset: editOffset,
selectionOffset:
selectionOffset != null ? selectionOffset - editOffset : null,
+ selectionLength: selectionLength,
);
/// Builds an LSP snippet string with supplied ranges as tab stops.
diff --git a/pkg/analysis_server/lib/src/search/type_hierarchy.dart b/pkg/analysis_server/lib/src/search/type_hierarchy.dart
index d555525..5dc00b9 100644
--- a/pkg/analysis_server/lib/src/search/type_hierarchy.dart
+++ b/pkg/analysis_server/lib/src/search/type_hierarchy.dart
@@ -196,7 +196,7 @@
result = clazz.getSetter(pivotName);
}
}
- if (result != null && result.isAccessibleIn(_pivotLibrary)) {
+ if (result != null && result.isAccessibleIn2(_pivotLibrary)) {
return result;
}
// try to find in the class mixin
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index 33bc64a..8e1cc46 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -473,6 +473,19 @@
}
}
+ if (entity is Token &&
+ entity.type == TokenType.STRING &&
+ entity.offset < offset &&
+ offset < entity.end) {
+ final uriNode = target.containingNode;
+ if (uriNode is SimpleStringLiteral && uriNode.literal == entity) {
+ final directive = uriNode.parent;
+ if (directive is UriBasedDirective && directive.uri == uriNode) {
+ return uriNode.value.substring(0, offset - uriNode.contentsOffset);
+ }
+ }
+ }
+
while (entity is AstNode) {
if (entity is SimpleIdentifier) {
var identifier = entity.name;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/fuzzy_filter_sort.dart b/pkg/analysis_server/lib/src/services/completion/dart/fuzzy_filter_sort.dart
index 1fbda62..f410bf1 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/fuzzy_filter_sort.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/fuzzy_filter_sort.dart
@@ -5,6 +5,7 @@
import 'package:analysis_server/src/protocol_server.dart';
import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
import 'package:analysis_server/src/services/completion/filtering/fuzzy_matcher.dart';
+import 'package:collection/collection.dart';
final _identifierPattern = RegExp(r'([_a-zA-Z][_a-zA-Z0-9]*)');
@@ -14,7 +15,11 @@
required String pattern,
required List<CompletionSuggestionBuilder> suggestions,
}) {
- var matcher = FuzzyMatcher(pattern, matchStyle: MatchStyle.SYMBOL);
+ final matchStyle =
+ suggestions.firstOrNull?.kind == CompletionSuggestionKind.IMPORT
+ ? MatchStyle.FILENAME
+ : MatchStyle.SYMBOL;
+ final matcher = FuzzyMatcher(pattern, matchStyle: matchStyle);
double score(CompletionSuggestionBuilder suggestion) {
var textToMatch = suggestion.textToMatch;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart
index d852030..8581f4f 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart
@@ -9,6 +9,7 @@
import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart'
show SuggestionBuilder;
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/visitor.dart';
import 'package:analyzer_plugin/src/utilities/completion/optype.dart';
@@ -52,10 +53,14 @@
_addConstructorSuggestions(element);
}
if (opType.includeReturnValueSuggestions) {
- if (element.isEnum) {
- for (var field in element.fields) {
- if (field.isEnumConstant) {
- builder.suggestEnumConstant(field, prefix: prefix);
+ final typeSystem = request.libraryElement.typeSystem;
+ final contextType = request.contextType;
+ if (contextType is InterfaceType) {
+ // TODO(scheglov) This looks not ideal - we should suggest getters.
+ for (final field in element.fields) {
+ if (field.isStatic &&
+ typeSystem.isSubtypeOf(field.type, contextType)) {
+ builder.suggestStaticField(field, prefix: prefix);
}
}
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index 9028362..3eb06e2 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -213,24 +213,7 @@
@override
void declaredClass(ClassDeclaration declaration) {
- var classElt = declaration.declaredElement;
- if (classElt != null && visibilityTracker._isVisible(classElt)) {
- if (opType.includeTypeNameSuggestions) {
- builder.suggestClass(classElt);
- }
-
- // Generate the suggestions for the constructors. We are required to loop
- // through elements here instead of using declaredConstructor() due to
- // implicit constructors (i.e. there is no AstNode for an implicit
- // constructor)
- if (!opType.isPrefixed && opType.includeConstructorSuggestions) {
- for (var constructor in classElt.constructors) {
- if (!classElt.isAbstract || constructor.isFactory) {
- builder.suggestConstructor(constructor);
- }
- }
- }
- }
+ _declaredClassElement(declaration.declaredElement);
}
@override
@@ -248,20 +231,7 @@
@override
void declaredEnum(EnumDeclaration declaration) {
- var declaredElement = declaration.declaredElement;
- if (declaredElement != null &&
- visibilityTracker._isVisible(declaredElement) &&
- opType.includeTypeNameSuggestions) {
- builder.suggestClass(declaredElement);
- for (var enumConstant in declaration.constants) {
- if (!enumConstant.isSynthetic) {
- var constantElement = enumConstant.declaredElement;
- if (constantElement is FieldElement) {
- builder.suggestEnumConstant(constantElement);
- }
- }
- }
- }
+ _declaredClassElement(declaration.declaredElement);
}
@override
@@ -437,6 +407,38 @@
super.visitExtendsClause(node);
}
+ void _declaredClassElement(ClassElement? class_) {
+ if (class_ != null && visibilityTracker._isVisible(class_)) {
+ if (opType.includeTypeNameSuggestions) {
+ builder.suggestClass(class_);
+ }
+
+ if (!opType.isPrefixed &&
+ opType.includeConstructorSuggestions &&
+ !class_.isEnum) {
+ for (final constructor in class_.constructors) {
+ if (!class_.isAbstract || constructor.isFactory) {
+ builder.suggestConstructor(constructor);
+ }
+ }
+ }
+
+ if (!opType.isPrefixed && opType.includeReturnValueSuggestions) {
+ final typeSystem = request.libraryElement.typeSystem;
+ final contextType = request.contextType;
+ if (contextType is InterfaceType) {
+ // TODO(scheglov) This looks not ideal - we should suggest getters.
+ for (final field in class_.fields) {
+ if (field.isStatic &&
+ typeSystem.isSubtypeOf(field.type, contextType)) {
+ builder.suggestStaticField(field);
+ }
+ }
+ }
+ }
+ }
+ }
+
/// Return `true` if the [identifier] is composed of one or more underscore
/// characters and nothing else.
bool _isUnused(String identifier) => RegExp(r'^_+$').hasMatch(identifier);
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/redirecting_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/redirecting_contributor.dart
index e9af2ab..9105538 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/redirecting_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/redirecting_contributor.dart
@@ -41,7 +41,7 @@
containingClass?.declaredElement?.supertype?.element;
if (superclassElement != null) {
for (var constructor in superclassElement.constructors) {
- if (constructor.isAccessibleIn(request.libraryElement)) {
+ if (constructor.isAccessibleIn2(request.libraryElement)) {
builder.suggestConstructor(constructor, hasClassName: true);
}
}
@@ -69,7 +69,7 @@
class_.thisType, classElement.thisType)) {
for (var constructor in class_.constructors) {
if (constructor != constructorElement &&
- constructor.isAccessibleIn(request.libraryElement)) {
+ constructor.isAccessibleIn2(request.libraryElement)) {
builder.suggestConstructor(constructor);
}
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/static_member_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/static_member_contributor.dart
index bc6f68f..727aa03 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/static_member_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/static_member_contributor.dart
@@ -18,7 +18,7 @@
@override
Future<void> computeSuggestions() async {
var library = request.libraryElement;
- bool isVisible(Element element) => element.isAccessibleIn(library);
+ bool isVisible(Element element) => element.isAccessibleIn2(library);
var targetId = request.target.dotTarget;
if (targetId is Identifier && !request.target.isCascade) {
var element = targetId.staticElement;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index b93535a..0dc2490 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -87,7 +87,7 @@
void addSuggestionForAccessor(
{required PropertyAccessorElement accessor,
required double inheritanceDistance}) {
- if (accessor.isAccessibleIn(request.libraryElement)) {
+ if (accessor.isAccessibleIn2(request.libraryElement)) {
var member = accessor.isSynthetic ? accessor.variable : accessor;
if (_shouldAddSuggestion(member)) {
builder.suggestAccessor(accessor,
@@ -101,7 +101,7 @@
{required MethodElement method,
required CompletionSuggestionKind kind,
required double inheritanceDistance}) {
- if (method.isAccessibleIn(request.libraryElement) &&
+ if (method.isAccessibleIn2(request.libraryElement) &&
_shouldAddSuggestion(method)) {
builder.suggestMethod(method,
kind: kind, inheritanceDistance: inheritanceDistance);
@@ -237,10 +237,17 @@
/// invocation. The [inheritanceDistance] is the value of the inheritance
/// distance feature computed for the accessor or `-1.0` if the accessor is a
/// static accessor.
- void suggestAccessor(PropertyAccessorElement accessor,
- {required double inheritanceDistance}) {
- assert(accessor.enclosingElement is ClassElement ||
- accessor.enclosingElement is ExtensionElement);
+ void suggestAccessor(
+ PropertyAccessorElement accessor, {
+ required double inheritanceDistance,
+ bool withEnclosingName = false,
+ }) {
+ var enclosingPrefix = '';
+ var enclosingName = _enclosingClassOrExtensionName(accessor);
+ if (withEnclosingName && enclosingName != null) {
+ enclosingPrefix = '$enclosingName.';
+ }
+
if (accessor.isSynthetic) {
// Avoid visiting a field twice. All fields induce a getter, but only
// non-final fields induce a setter, so we don't add a suggestion for a
@@ -280,6 +287,7 @@
_addBuilder(
_createCompletionSuggestionBuilder(
accessor,
+ completion: enclosingPrefix + accessor.displayName,
kind: CompletionSuggestionKind.IDENTIFIER,
relevance: relevance,
isNotImported: isNotImportedLibrary,
@@ -926,6 +934,43 @@
);
}
+ /// Add a suggestion for a static field declared within a class or extension.
+ /// If the field is synthetic, add the corresponding getter instead.
+ ///
+ /// If the enclosing element can only be referenced using a prefix, then
+ /// the [prefix] should be provided.
+ void suggestStaticField(FieldElement element, {String? prefix}) {
+ assert(element.isStatic);
+ if (element.isSynthetic) {
+ var getter = element.getter;
+ if (getter != null) {
+ suggestAccessor(
+ getter,
+ inheritanceDistance: 0.0,
+ withEnclosingName: true,
+ );
+ }
+ } else {
+ var enclosingPrefix = '';
+ var enclosingName = _enclosingClassOrExtensionName(element);
+ if (enclosingName != null) {
+ enclosingPrefix = '$enclosingName.';
+ }
+ var relevance =
+ _computeTopLevelRelevance(element, elementType: element.type);
+ _addBuilder(
+ _createCompletionSuggestionBuilder(
+ element,
+ completion: enclosingPrefix + element.name,
+ kind: CompletionSuggestionKind.IDENTIFIER,
+ prefix: prefix,
+ relevance: relevance,
+ isNotImported: isNotImportedLibrary,
+ ),
+ );
+ }
+ }
+
/// Add a suggestion to reference a [parameter] in a super formal parameter.
void suggestSuperFormalParameter(ParameterElement parameter) {
_addBuilder(
@@ -1289,6 +1334,22 @@
);
}
+ /// Return the name of the enclosing class or extension.
+ ///
+ /// The enclosing element must be either a class, or extension; otherwise
+ /// we either fail with assertion, or return `null`.
+ String? _enclosingClassOrExtensionName(Element element) {
+ var enclosing = element.enclosingElement;
+ if (enclosing is ClassElement) {
+ return enclosing.name;
+ } else if (enclosing is ExtensionElement) {
+ return enclosing.name;
+ } else {
+ assert(false, 'Expected ClassElement or ExtensionElement');
+ return null;
+ }
+ }
+
/// If the [element] has a documentation comment, return it.
_ElementDocumentation? _getDocumentation(Element element) {
var documentationCache = request.documentationCache;
diff --git a/pkg/analysis_server/lib/src/services/refactoring/refactoring_internal.dart b/pkg/analysis_server/lib/src/services/refactoring/refactoring_internal.dart
index 6fb1f3b..d1b121e 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/refactoring_internal.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/refactoring_internal.dart
@@ -83,6 +83,9 @@
bool get isResolved => _match.isResolved;
+ /// Return the [LibraryElement] for the [file].
+ LibraryElement get libraryElement => _match.libraryElement;
+
SourceRange get range => _match.sourceRange;
Source get unitSource => _match.unitSource;
diff --git a/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart b/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart
index 8065f1f..ce85fb8 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart
@@ -108,11 +108,8 @@
continue;
}
// check the element being renamed is accessible
- {
- var whereLibrary = reference.element.library;
- if (!element.isAccessibleIn(whereLibrary)) {
- continue;
- }
+ if (!element.isAccessibleIn2(reference.libraryElement)) {
+ continue;
}
// add edit
reference.addEdit(change, newName, id: _newPotentialId());
diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/flutter_snippet_producers.dart b/pkg/analysis_server/lib/src/services/snippets/dart/flutter_snippet_producers.dart
index 71a53d6..9644c99 100644
--- a/pkg/analysis_server/lib/src/services/snippets/dart/flutter_snippet_producers.dart
+++ b/pkg/analysis_server/lib/src/services/snippets/dart/flutter_snippet_producers.dart
@@ -17,6 +17,7 @@
final flutter = Flutter.instance;
late ClassElement? classWidget;
+ late ClassElement? classContainer;
FlutterSnippetProducer(super.request);
@@ -27,6 +28,10 @@
return false;
}
+ if ((classContainer = await _getClass('Container')) == null) {
+ return false;
+ }
+
return super.isValid();
}
@@ -344,6 +349,7 @@
// Checked by isValid() before this will be called.
final classBuildContext = this.classBuildContext!;
final classWidget = this.classWidget!;
+ final classContainer = this.classContainer!;
// Add the build method.
builder.writeln(' @override');
@@ -359,9 +365,12 @@
},
bodyWriter: () {
builder.writeln('{');
- builder.write(' ');
- builder.selectHere();
- builder.writeln();
+ builder.write(' return ');
+ builder.selectAll(() {
+ builder.writeType(_getType(classContainer));
+ builder.write('()');
+ });
+ builder.writeln(';');
builder.writeln(' }');
},
);
diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml
index 4b7314d..93103cb 100644
--- a/pkg/analysis_server/pubspec.yaml
+++ b/pkg/analysis_server/pubspec.yaml
@@ -5,6 +5,7 @@
environment:
sdk: '>=2.17.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
_fe_analyzer_shared: any
analyzer: any
@@ -25,6 +26,7 @@
watcher: any
yaml: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
analyzer_utilities: any
cli_util: any
diff --git a/pkg/analysis_server/test/analysis/get_navigation_test.dart b/pkg/analysis_server/test/analysis/get_navigation_test.dart
index e0c55b0..e12cbc1 100644
--- a/pkg/analysis_server/test/analysis/get_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/get_navigation_test.dart
@@ -314,6 +314,64 @@
}
}
+ Future<void> test_partDirective() async {
+ final partFile = newFile(
+ '$testPackageLibPath/a.dart',
+ '''
+part of 'test.dart';
+''',
+ );
+ addTestFile('''
+part 'a.dart';
+''');
+ await waitForTasksFinished();
+ await _getNavigation(offset: 8, length: 0);
+ expect(regions, hasLength(1));
+ assertHasRegionString("'a.dart'");
+ expect(testTargets, hasLength(1));
+ expect(testTargets[0].kind, ElementKind.COMPILATION_UNIT);
+ assertHasFileTarget(partFile.path, 0, 0);
+ }
+
+ Future<void> test_partOfDirective_named() async {
+ final partOfFile = newFile(
+ '$testPackageLibPath/a.dart',
+ '''
+library foo;
+part 'test.dart';
+''',
+ );
+ addTestFile('''
+part of foo;
+''');
+ await waitForTasksFinished();
+ await _getNavigation(offset: 10, length: 0);
+ expect(regions, hasLength(1));
+ assertHasRegionString("foo");
+ expect(testTargets, hasLength(1));
+ expect(testTargets[0].kind, ElementKind.LIBRARY);
+ assertHasFileTarget(partOfFile.path, 8, 3); // library [[foo]]
+ }
+
+ Future<void> test_partOfDirective_uri() async {
+ final partOfFile = newFile(
+ '$testPackageLibPath/a.dart',
+ '''
+part 'test.dart';
+''',
+ );
+ addTestFile('''
+part of 'a.dart';
+''');
+ await waitForTasksFinished();
+ await _getNavigation(offset: 11, length: 0);
+ expect(regions, hasLength(1));
+ assertHasRegionString("'a.dart'");
+ expect(testTargets, hasLength(1));
+ expect(testTargets[0].kind, ElementKind.LIBRARY);
+ assertHasFileTarget(partOfFile.path, 0, 0);
+ }
+
Future<void> test_zeroLength_end() async {
addTestFile('''
void f() {
diff --git a/pkg/analysis_server/test/analysis/notification_highlights2_test.dart b/pkg/analysis_server/test/analysis/notification_highlights2_test.dart
index f8d77d0..a1aa517 100644
--- a/pkg/analysis_server/test/analysis/notification_highlights2_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_highlights2_test.dart
@@ -339,7 +339,7 @@
Future<void> test_BUILT_IN_partOf() async {
addTestFile('''
-part of lib;
+part of my.lib.name;
void f() {
var part = 1;
var of = 2;
@@ -613,11 +613,14 @@
Future<void> test_DIRECTIVE_partOf() async {
addTestFile('''
-part of lib;
+part of my.lib.name;
''');
_addLibraryForTestPart();
await prepareHighlights();
- assertHasStringRegion(HighlightRegionType.DIRECTIVE, 'part of lib;');
+ assertHasStringRegion(
+ HighlightRegionType.DIRECTIVE,
+ 'part of my.lib.name;',
+ );
}
Future<void> test_DYNAMIC_LOCAL_VARIABLE() async {
@@ -1695,7 +1698,7 @@
void _addLibraryForTestPart() {
newFile('$testPackageLibPath/my_lib.dart', '''
-library lib;
+library my.lib.name;
part 'test.dart';
''');
}
diff --git a/pkg/analysis_server/test/analysis/notification_outline_test.dart b/pkg/analysis_server/test/analysis/notification_outline_test.dart
index 4347bad..8bce6e6 100644
--- a/pkg/analysis_server/test/analysis/notification_outline_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_outline_test.dart
@@ -97,7 +97,7 @@
Future<void> test_libraryName_hasPartOfDirective() async {
newFile('$testPackageLibPath/a.dart', r'''
-library lib;
+library my.lib;
part 'test.dart';
''');
diff --git a/pkg/analysis_server/test/client/completion_driver_test.dart b/pkg/analysis_server/test/client/completion_driver_test.dart
index 0508315..9d8f5e4 100644
--- a/pkg/analysis_server/test/client/completion_driver_test.dart
+++ b/pkg/analysis_server/test/client/completion_driver_test.dart
@@ -267,7 +267,7 @@
@override
TestingCompletionProtocol get protocol => TestingCompletionProtocol.version1;
- @failingTest
+ @FailingTest(reason: 'This test fails with available suggestions')
@override
Future<void> test_project_lib_multipleExports() async {
return super.test_project_lib_multipleExports();
@@ -329,7 +329,7 @@
await addTestFile('''
import 'a.dart';
void f() {
- ^
+ E v = ^
}
''');
assertSuggestion(
@@ -605,7 +605,7 @@
Future<void> test_project_lib_setters_static() async {
newFile('$testPackageLibPath/a.dart', r'''
class A {
- static set g(int g) {}
+ static set foo(int _) {}
}
''');
@@ -619,7 +619,7 @@
}
''');
- assertNoSuggestion(completion: 'A.g');
+ assertNoSuggestion(completion: 'A.foo');
}
/// See: https://github.com/dart-lang/sdk/issues/40626
diff --git a/pkg/analysis_server/test/client/impl/completion_driver.dart b/pkg/analysis_server/test/client/impl/completion_driver.dart
index 6695249..c6b01d4 100644
--- a/pkg/analysis_server/test/client/impl/completion_driver.dart
+++ b/pkg/analysis_server/test/client/impl/completion_driver.dart
@@ -276,6 +276,8 @@
} else if (notification.event == ANALYSIS_NOTIFICATION_ERRORS) {
var decoded = AnalysisErrorsParams.fromNotification(notification);
filesErrors[decoded.file] = decoded.errors;
+ } else if (notification.event == ANALYSIS_NOTIFICATION_FLUSH_RESULTS) {
+ // Ignored.
} else if (notification.event == SERVER_NOTIFICATION_ERROR) {
throw Exception('server error: ${notification.toJson()}');
} else if (notification.event == SERVER_NOTIFICATION_CONNECTED) {
diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart
index f86e1d8..3a86b88 100644
--- a/pkg/analysis_server/test/domain_completion_test.dart
+++ b/pkg/analysis_server/test/domain_completion_test.dart
@@ -391,44 +391,6 @@
..suggestions.withElementClass.isEmpty;
}
- Future<void> test_notImported_lowerRelevance_enumConstant() async {
- newFile('$testPackageLibPath/a.dart', '''
-enum E1 {
- foo01
-}
-''');
-
- newFile('$testPackageLibPath/b.dart', '''
-enum E2 {
- foo02
-}
-''');
-
- await _configureWithWorkspaceRoot();
-
- var response = await _getTestCodeSuggestions('''
-import 'b.dart';
-
-void f() {
- foo0^
-}
-''');
-
- check(response)
- ..assertComplete()
- ..hasReplacement(left: 4);
-
- // `foo01` relevance is decreased because it is not yet imported.
- check(response).suggestions.matches([
- (suggestion) => suggestion
- ..completion.isEqualTo('E2.foo02')
- ..libraryUriToImport.isNull,
- (suggestion) => suggestion
- ..completion.isEqualTo('E1.foo01')
- ..libraryUriToImport.isEqualTo('package:test/a.dart'),
- ]);
- }
-
Future<void> test_notImported_lowerRelevance_extension_getter() async {
await _configureWithWorkspaceRoot();
diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
index b006a51..6998661 100644
--- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart
+++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
@@ -1622,6 +1622,7 @@
/// "edits": List<SourceFileEdit>
/// "linkedEditGroups": List<LinkedEditGroup>
/// "selection": optional Position
+/// "selectionLength": optional int
/// "id": optional String
/// }
final Matcher isSourceChange =
@@ -1631,6 +1632,7 @@
'linkedEditGroups': isListOf(isLinkedEditGroup)
}, optionalFields: {
'selection': isPosition,
+ 'selectionLength': isInt,
'id': isString
}));
diff --git a/pkg/analysis_server/test/lsp/completion_dart_test.dart b/pkg/analysis_server/test/lsp/completion_dart_test.dart
index ff5a000..648d17a 100644
--- a/pkg/analysis_server/test/lsp/completion_dart_test.dart
+++ b/pkg/analysis_server/test/lsp/completion_dart_test.dart
@@ -2854,6 +2854,7 @@
class FlutterSnippetCompletionTest extends SnippetCompletionTest {
/// Standard import statements expected for basic Widgets.
String get expectedImports => '''
+import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';''';
/// Nullability suffix expected in this test class.
@@ -2908,7 +2909,7 @@
class _\${1:MyWidget}State extends State<\${1:MyWidget}> {
@override
Widget build(BuildContext context) {
- \$0
+ return \${0:Container()};
}
}
@@ -2965,7 +2966,7 @@
@override
Widget build(BuildContext context) {
- \$0
+ return \${0:Container()};
}
}
@@ -3001,7 +3002,7 @@
@override
Widget build(BuildContext context) {
- \$0
+ return \${0:Container()};
}
}
@@ -3035,7 +3036,7 @@
@override
Widget build(BuildContext context) {
- \$0
+ return \${0:Container()};
}
}
@@ -3063,7 +3064,7 @@
@override
Widget build(BuildContext context) {
- \$0
+ return \${0:Container()};
}
}
''');
@@ -3089,7 +3090,7 @@
@override
Widget build(BuildContext context) {
- \$0
+ return \${0:Container()};
}
}
''');
@@ -3131,6 +3132,7 @@
@override
String get expectedImports => '''
import 'package:flutter/src/foundation/key.dart';
+import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';''';
@override
diff --git a/pkg/analysis_server/test/lsp/definition_test.dart b/pkg/analysis_server/test/lsp/definition_test.dart
index 6f574ca..aa59e35 100644
--- a/pkg/analysis_server/test/lsp/definition_test.dart
+++ b/pkg/analysis_server/test/lsp/definition_test.dart
@@ -284,6 +284,46 @@
);
}
+ Future<void> test_partFilename() async {
+ final mainContents = '''
+part 'pa^rt.dart';
+ ''';
+
+ final partContents = '''
+part of 'main.dart';
+ ''';
+
+ final partFileUri = Uri.file(join(projectFolderPath, 'lib', 'part.dart'));
+
+ await initialize();
+ await openFile(mainFileUri, withoutMarkers(mainContents));
+ await openFile(partFileUri, withoutMarkers(partContents));
+ final res = await getDefinitionAsLocation(
+ mainFileUri, positionFromMarker(mainContents));
+
+ expect(res.single.uri, equals(partFileUri.toString()));
+ }
+
+ Future<void> test_partOfFilename() async {
+ final mainContents = '''
+part 'part.dart';
+ ''';
+
+ final partContents = '''
+part of 'ma^in.dart';
+ ''';
+
+ final partFileUri = Uri.file(join(projectFolderPath, 'lib', 'part.dart'));
+
+ await initialize();
+ await openFile(mainFileUri, withoutMarkers(mainContents));
+ await openFile(partFileUri, withoutMarkers(partContents));
+ final res = await getDefinitionAsLocation(
+ partFileUri, positionFromMarker(partContents));
+
+ expect(res.single.uri, equals(mainFileUri.toString()));
+ }
+
Future<void> test_sameLine() async {
final contents = '''
int plusOne(int [[value]]) => 1 + val^ue;
diff --git a/pkg/analysis_server/test/lsp/initialization_test.dart b/pkg/analysis_server/test/lsp/initialization_test.dart
index a70a2db..e4a8ece 100644
--- a/pkg/analysis_server/test/lsp/initialization_test.dart
+++ b/pkg/analysis_server/test/lsp/initialization_test.dart
@@ -491,9 +491,9 @@
.registrations;
final documentFilterSql =
- TextDocumentFilter(scheme: 'file', pattern: '**/*.sql');
+ TextDocumentFilterWithScheme(scheme: 'file', pattern: '**/*.sql');
final documentFilterDart =
- TextDocumentFilter(language: 'dart', scheme: 'file');
+ TextDocumentFilterWithScheme(language: 'dart', scheme: 'file');
expect(
registrations,
diff --git a/pkg/analysis_server/test/search/element_references_test.dart b/pkg/analysis_server/test/search/element_references_test.dart
index 8e86727..de8f23e 100644
--- a/pkg/analysis_server/test/search/element_references_test.dart
+++ b/pkg/analysis_server/test/search/element_references_test.dart
@@ -742,8 +742,8 @@
}
''');
await findElementReferences('fff(p) {}', false);
- // A part without library, no results.
- expect(results, isEmpty);
+ expect(results, hasLength(1));
+ assertHasResult(SearchResultKind.INVOCATION, 'fff(10);');
}
Future<void> test_parameter() async {
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_check.dart b/pkg/analysis_server/test/services/completion/dart/completion_check.dart
index ff98794..0a2ffad 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_check.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_check.dart
@@ -220,6 +220,10 @@
element.isNotNull.kind.isGetter;
}
+ void get isImport {
+ kind.isImport;
+ }
+
void get isImportPrefix {
kind.isIdentifier;
element.isNotNull.kind.isPrefix;
@@ -262,6 +266,20 @@
element.isNotNull.kind.isSetter;
}
+ void get isStatic {
+ element.isNotNull.isStatic.isTrue;
+ }
+
+ void get isStaticField {
+ isStatic;
+ isField;
+ }
+
+ void get isStaticGetter {
+ isStatic;
+ isGetter;
+ }
+
void get isTopLevelVariable {
kind.isIdentifier;
element.isNotNull.kind.isTopLevelVariable;
@@ -373,6 +391,10 @@
isEqualTo(CompletionSuggestionKind.IDENTIFIER);
}
+ void get isImport {
+ isEqualTo(CompletionSuggestionKind.IMPORT);
+ }
+
void get isInvocation {
isEqualTo(CompletionSuggestionKind.INVOCATION);
}
@@ -397,6 +419,45 @@
}
@useResult
+ CheckTarget<Iterable<CompletionSuggestionForTesting>> get fields {
+ var result = value
+ .where((suggestion) =>
+ suggestion.suggestion.kind == CompletionSuggestionKind.IDENTIFIER &&
+ suggestion.suggestion.element?.kind == ElementKind.FIELD)
+ .toList();
+ return nest(
+ result,
+ (selected) => 'fields ${valueStr(selected)}',
+ );
+ }
+
+ @useResult
+ CheckTarget<Iterable<CompletionSuggestionForTesting>> get getters {
+ var result = value
+ .where((suggestion) =>
+ suggestion.suggestion.kind == CompletionSuggestionKind.IDENTIFIER &&
+ suggestion.suggestion.element?.kind == ElementKind.GETTER)
+ .toList();
+ return nest(
+ result,
+ (selected) => 'getters ${valueStr(selected)}',
+ );
+ }
+
+ @useResult
+ CheckTarget<Iterable<CompletionSuggestionForTesting>> get methods {
+ var result = value
+ .where((suggestion) =>
+ suggestion.suggestion.kind == CompletionSuggestionKind.IDENTIFIER &&
+ suggestion.suggestion.element?.kind == ElementKind.METHOD)
+ .toList();
+ return nest(
+ result,
+ (selected) => 'setters ${valueStr(selected)}',
+ );
+ }
+
+ @useResult
CheckTarget<Iterable<CompletionSuggestionForTesting>> get namedArguments {
var result = value
.where((suggestion) =>
@@ -422,6 +483,19 @@
}
@useResult
+ CheckTarget<Iterable<CompletionSuggestionForTesting>> get setters {
+ var result = value
+ .where((suggestion) =>
+ suggestion.suggestion.kind == CompletionSuggestionKind.IDENTIFIER &&
+ suggestion.suggestion.element?.kind == ElementKind.SETTER)
+ .toList();
+ return nest(
+ result,
+ (selected) => 'setters ${valueStr(selected)}',
+ );
+ }
+
+ @useResult
CheckTarget<Iterable<CompletionSuggestionForTesting>> get withElementClass {
return nest(
value.where((e) {
@@ -446,6 +520,14 @@
extension ElementExtension on CheckTarget<Element> {
@useResult
+ CheckTarget<bool> get isStatic {
+ return nest(
+ value.isStatic,
+ (selected) => 'isStatic ${valueStr(selected)}',
+ );
+ }
+
+ @useResult
CheckTarget<ElementKind> get kind {
return nest(
value.kind,
diff --git a/pkg/analysis_server/test/services/completion/dart/declaration/class_test.dart b/pkg/analysis_server/test/services/completion/dart/declaration/class_test.dart
new file mode 100644
index 0000000..cd5382bb
--- /dev/null
+++ b/pkg/analysis_server/test/services/completion/dart/declaration/class_test.dart
@@ -0,0 +1,249 @@
+// 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 'package:analyzer_utilities/check/check.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../../../../client/completion_driver_test.dart';
+import '../completion_check.dart';
+
+void main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(ClassStaticMembersWithoutClassNameTest);
+ });
+}
+
+@reflectiveTest
+class ClassStaticMembersWithoutClassNameTest
+ extends AbstractCompletionDriverTest with _Helpers {
+ @override
+ TestingCompletionProtocol get protocol => TestingCompletionProtocol.version2;
+
+ Future<void> test_field_hasContextType_exact() async {
+ await _checkLocations(
+ classCode: r'''
+class A {
+ static final int foo01 = 0;
+ static final num foo02 = 0;
+ static final double foo03 = 0;
+ final int foo04 = 0;
+}
+''',
+ contextCode: r'''
+void f() {
+ int a = foo0^
+}
+''',
+ validator: (response) {
+ check(response).suggestions.fields.completions.matchesInAnyOrder([
+ (e) => e.isEqualTo('A.foo01'),
+ ]);
+ },
+ );
+ }
+
+ Future<void> test_field_hasContextType_subtypes() async {
+ await _checkLocations(
+ classCode: r'''
+class A {
+ static final int foo01 = 0;
+ static final double foo02 = 0;
+ static final num foo03 = 0;
+ static final Object foo04 = '';
+}
+''',
+ contextCode: r'''
+void f() {
+ num a = foo0^
+}
+''',
+ validator: (response) {
+ check(response).suggestions.fields.completions.matchesInAnyOrder([
+ (e) => e.isEqualTo('A.foo01'),
+ (e) => e.isEqualTo('A.foo02'),
+ (e) => e.isEqualTo('A.foo03'),
+ ]);
+ },
+ );
+ }
+
+ Future<void> test_field_noContextType() async {
+ await _checkLocations(
+ classCode: r'''
+class A {
+ static final foo01 = 0;
+ static final foo02 = 0;
+ final foo03 = 0;
+}
+''',
+ contextCode: r'''
+void f() {
+ foo0^
+}
+''',
+ validator: (response) {
+ check(response).suggestions.fields.isEmpty;
+ },
+ );
+ }
+
+ Future<void> test_getter_hasContextType_exact() async {
+ await _checkLocations(
+ classCode: r'''
+class A {
+ static int get foo01 => 0;
+ static num get foo02 => 0;
+ static double get foo03 => 0;
+}
+''',
+ contextCode: r'''
+void f() {
+ int a = foo0^
+}
+''',
+ validator: (response) {
+ check(response).suggestions.getters.completions.matchesInAnyOrder([
+ (e) => e.isEqualTo('A.foo01'),
+ ]);
+ },
+ );
+ }
+
+ Future<void> test_getter_hasContextType_subtypes() async {
+ await _checkLocations(
+ classCode: r'''
+class A {
+ static int get foo01 => 0;
+ static double get foo02 => 0;
+ static num get foo03 => 0;
+ static Object get foo04 => '';
+}
+''',
+ contextCode: r'''
+void f() {
+ num a = foo0^
+}
+''',
+ validator: (response) {
+ check(response).suggestions.getters.completions.matchesInAnyOrder([
+ (e) => e.isEqualTo('A.foo01'),
+ (e) => e.isEqualTo('A.foo02'),
+ (e) => e.isEqualTo('A.foo03'),
+ ]);
+ },
+ );
+ }
+
+ Future<void> test_getter_noContextType() async {
+ await _checkLocations(
+ classCode: r'''
+class A {
+ static int get foo01 => 0;
+}
+''',
+ contextCode: r'''
+void f() {
+ foo0^
+}
+''',
+ validator: (response) {
+ check(response).suggestions.getters.isEmpty;
+ },
+ );
+ }
+
+ Future<void> test_method() async {
+ await _checkLocations(
+ classCode: r'''
+class A {
+ static void foo01() {}
+}
+''',
+ contextCode: r'''
+void f() {
+ foo0^
+}
+''',
+ validator: (response) {
+ check(response).suggestions.methods.isEmpty;
+ },
+ );
+ }
+
+ Future<void> test_setter_hasContextType() async {
+ await _checkLocations(
+ classCode: r'''
+class A {
+ static set foo01(int _) {}
+ static set foo02(num _) {}
+ static set foo03(double _) {}
+}
+''',
+ contextCode: r'''
+void f() {
+ int a = foo0^
+}
+''',
+ validator: (response) {
+ check(response).suggestions.setters.isEmpty;
+ },
+ );
+ }
+
+ Future<void> test_setter_noContextType() async {
+ await _checkLocations(
+ classCode: r'''
+class A {
+ static set foo01(int _) {}
+}
+''',
+ contextCode: r'''
+void f() {
+ foo0^
+}
+''',
+ validator: (response) {
+ check(response).suggestions.setters.isEmpty;
+ },
+ );
+ }
+}
+
+mixin _Helpers on AbstractCompletionDriverTest {
+ Future<void> _checkLocations({
+ required String classCode,
+ required String contextCode,
+ required void Function(CompletionResponseForTesting response) validator,
+ }) async {
+ // local
+ {
+ final response = await getTestCodeSuggestions('''
+$classCode
+
+$contextCode
+''');
+ validator(response);
+ }
+
+ // imported, without prefix
+ {
+ newFile('$testPackageLibPath/a.dart', classCode);
+ final response = await getTestCodeSuggestions('''
+import 'a.dart';
+
+$contextCode
+''');
+ validator(response);
+ }
+
+ // not imported
+ {
+ newFile('$testPackageLibPath/a.dart', classCode);
+ final response = await getTestCodeSuggestions('''
+$contextCode
+''');
+ validator(response);
+ }
+ }
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/declaration/enum_test.dart b/pkg/analysis_server/test/services/completion/dart/declaration/enum_test.dart
index cb88047..e15b337 100644
--- a/pkg/analysis_server/test/services/completion/dart/declaration/enum_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/declaration/enum_test.dart
@@ -30,8 +30,12 @@
mixin EnumTestCases on AbstractCompletionDriverTest {
Future<void> test_enumConstantName() async {
await _check_locations(
- declaration: 'enum MyEnum { foo01 }',
- codeAtCompletion: 'foo0^',
+ declaration: '''
+enum MyEnum { foo01 }
+enum OtherEnum { foo02 }
+''',
+ declarationForContextType: 'void useMyEnum(MyEnum _) {}',
+ codeAtCompletion: 'useMyEnum(foo0^);',
validator: (response) {
check(response).hasReplacement(left: 4);
@@ -61,6 +65,7 @@
Future<void> test_enumConstantName_imported_withPrefix() async {
newFile('$testPackageLibPath/a.dart', r'''
enum MyEnum { foo01 }
+enum OtherEnum { foo02 }
''');
if (isProtocolVersion1) {
@@ -70,8 +75,10 @@
var response = await getTestCodeSuggestions('''
import 'a.dart' as prefix;
+void useMyEnum(prefix.MyEnum _) {}
+
void f() {
- foo0^
+ useMyEnum(foo0^);
}
''');
@@ -223,7 +230,8 @@
Future<void> test_nothing() async {
await _check_locations(
declaration: 'enum MyEnum { v }',
- codeAtCompletion: '^',
+ declarationForContextType: 'void useMyEnum(MyEnum _) {}',
+ codeAtCompletion: 'useMyEnum(^);',
validator: (response) {
check(response).hasEmptyReplacement();
@@ -257,8 +265,10 @@
var response = await getTestCodeSuggestions('''
import 'a.dart' as prefix;
+void useMyEnum(prefix.MyEnum _) {}
+
void f() {
- ^
+ useMyEnum(^);
}
''');
@@ -288,6 +298,7 @@
Future<void> _check_locations({
required String declaration,
+ String declarationForContextType = '',
required String codeAtCompletion,
required void Function(CompletionResponseForTesting response) validator,
}) async {
@@ -295,6 +306,7 @@
{
var response = await getTestCodeSuggestions('''
$declaration
+$declarationForContextType
void f() {
$codeAtCompletion
}
@@ -312,6 +324,7 @@
}
var response = await getTestCodeSuggestions('''
import 'a.dart';
+$declarationForContextType
void f() {
$codeAtCompletion
}
@@ -324,10 +337,15 @@
newFile('$testPackageLibPath/a.dart', '''
$declaration
''');
+ newFile('$testPackageLibPath/context_type.dart', '''
+import 'a.dart'; // ignore: unused_import
+$declarationForContextType
+''');
if (isProtocolVersion1) {
await waitForSetWithUri('package:test/a.dart');
}
var response = await getTestCodeSuggestions('''
+import 'context_type.dart';
void f() {
$codeAtCompletion
}
diff --git a/pkg/analysis_server/test/services/completion/dart/declaration/test_all.dart b/pkg/analysis_server/test/services/completion/dart/declaration/test_all.dart
index 12cf693..c74d1a0 100644
--- a/pkg/analysis_server/test/services/completion/dart/declaration/test_all.dart
+++ b/pkg/analysis_server/test/services/completion/dart/declaration/test_all.dart
@@ -4,12 +4,14 @@
import 'package:test_reflective_loader/test_reflective_loader.dart';
+import 'class_test.dart' as class_;
import 'enum_test.dart' as enum_;
import 'library_test.dart' as library_;
/// Tests suggestions produced for various kinds of declarations.
void main() {
defineReflectiveSuite(() {
+ class_.main();
enum_.main();
library_.main();
});
diff --git a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
index 3b05dc9..e0d0fad 100644
--- a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
@@ -1923,8 +1923,8 @@
assertSuggestEnumConst('E.two');
assertSuggestEnum('F');
- assertSuggestEnumConst('F.three');
- assertSuggestEnumConst('F.four');
+ assertNotSuggested('F.three');
+ assertNotSuggested('F.four');
}
Future<void> test_ExpressionStatement_identifier() async {
diff --git a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
index f6e0668..0d839ec 100644
--- a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
@@ -2272,7 +2272,6 @@
assertSuggestKeywords([]);
}
- @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/49046')
Future<void> test_part_of() async {
addTestSource('part of foo;^');
await computeSuggestions();
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index 3cfdb13..db03ff4 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -2312,7 +2312,7 @@
}
Future<void> test_enum() async {
- addTestSource('enum E { one, two } void f() {^}');
+ addTestSource('enum E { one, two } void f() {E v = ^}');
await computeSuggestions();
assertSuggestEnum('E');
assertSuggestEnumConst('E.one');
@@ -2322,7 +2322,7 @@
}
Future<void> test_enum_deprecated() async {
- addTestSource('@deprecated enum E { one, two } void f() {^}');
+ addTestSource('@deprecated enum E { one, two } void f() {E v = ^}');
await computeSuggestions();
assertSuggestEnum('E', isDeprecated: true);
assertSuggestEnumConst('E.one', isDeprecated: true);
@@ -2349,8 +2349,8 @@
assertSuggestEnumConst('E.two');
assertSuggestEnum('F');
- assertSuggestEnumConst('F.three');
- assertSuggestEnumConst('F.four');
+ assertNotSuggested('F.three');
+ assertNotSuggested('F.four');
}
Future<void> test_enum_filter_assignment() async {
@@ -2370,8 +2370,8 @@
assertSuggestEnumConst('E.two');
assertSuggestEnum('F');
- assertSuggestEnumConst('F.three');
- assertSuggestEnumConst('F.four');
+ assertNotSuggested('F.three');
+ assertNotSuggested('F.four');
}
Future<void> test_enum_filter_binaryEquals() async {
@@ -2412,8 +2412,8 @@
assertSuggestEnumConst('E.two');
assertSuggestEnum('F');
- assertSuggestEnumConst('F.three');
- assertSuggestEnumConst('F.four');
+ assertNotSuggested('F.three');
+ assertNotSuggested('F.four');
}
Future<void> test_enum_filter_variableDeclaration() async {
@@ -2432,8 +2432,8 @@
assertSuggestEnumConst('E.two');
assertSuggestEnum('F');
- assertSuggestEnumConst('F.three');
- assertSuggestEnumConst('F.four');
+ assertNotSuggested('F.three');
+ assertNotSuggested('F.four');
}
Future<void> test_enum_shadowed() async {
diff --git a/pkg/analysis_server/test/services/completion/dart/location/directive_uri_test.dart b/pkg/analysis_server/test/services/completion/dart/location/directive_uri_test.dart
new file mode 100644
index 0000000..1c1ceb2
--- /dev/null
+++ b/pkg/analysis_server/test/services/completion/dart/location/directive_uri_test.dart
@@ -0,0 +1,95 @@
+// 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 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
+import 'package:analyzer_utilities/check/check.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../../../../client/completion_driver_test.dart';
+import '../completion_check.dart';
+
+void main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(DirectiveUriTest);
+ });
+}
+
+@reflectiveTest
+class DirectiveUriTest extends AbstractCompletionDriverTest {
+ @override
+ TestingCompletionProtocol get protocol => TestingCompletionProtocol.version2;
+
+ Future<void> test_uri_end() async {
+ await _checkDirectives(
+ uriContent: 'foo0^',
+ validator: (response) {
+ // We have both `foo0x`, but no `bar`.
+ check(response).suggestions.matchesInAnyOrder([
+ (suggestion) => suggestion
+ ..isImport
+ ..completion.isEqualTo('package:foo/foo01.dart'),
+ (suggestion) => suggestion
+ ..isImport
+ ..completion.isEqualTo('package:foo/foo02.dart'),
+ ]);
+ },
+ );
+ }
+
+ Future<void> test_uri_notEnd() async {
+ await _checkDirectives(
+ uriContent: 'foo0^xyz',
+ validator: (response) {
+ // We ignore 'xyz' after the caret.
+ check(response).suggestions.matchesInAnyOrder([
+ (suggestion) => suggestion
+ ..isImport
+ ..completion.isEqualTo('package:foo/foo01.dart'),
+ (suggestion) => suggestion
+ ..isImport
+ ..completion.isEqualTo('package:foo/foo02.dart'),
+ ]);
+ },
+ );
+ }
+
+ Future<void> _checkDirectives({
+ required String uriContent,
+ required void Function(CompletionResponseForTesting response) validator,
+ }) async {
+ _configurePackagesFooBar();
+
+ {
+ var response = await getTestCodeSuggestions('''
+export '$uriContent';
+''');
+ validator(response);
+ }
+
+ {
+ var response = await getTestCodeSuggestions('''
+import '$uriContent';
+''');
+ validator(response);
+ }
+ }
+
+ void _configurePackagesFooBar() {
+ final fooPackageRoot = getFolder('$packagesRootPath/foo');
+ newFile('$packagesRootPath/foo/lib/foo01.dart', '');
+ newFile('$packagesRootPath/foo/lib/foo02.dart', '');
+ // We use this file to check that exactly `foo0` is used as prefix.
+ // So, we don't have one-off and don't use just `foo`.
+ newFile('$packagesRootPath/foo/lib/foo11.dart', '');
+
+ final barPackageRoot = getFolder('$packagesRootPath/bar');
+ newFile('$packagesRootPath/bar/lib/bar01.dart', '');
+
+ writeTestPackageConfig(
+ config: PackageConfigFileBuilder()
+ ..add(name: 'foo', rootPath: fooPackageRoot.path)
+ ..add(name: 'bar', rootPath: barPackageRoot.path),
+ );
+ }
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/location/test_all.dart b/pkg/analysis_server/test/services/completion/dart/location/test_all.dart
index b0fe488..467a484 100644
--- a/pkg/analysis_server/test/services/completion/dart/location/test_all.dart
+++ b/pkg/analysis_server/test/services/completion/dart/location/test_all.dart
@@ -6,6 +6,7 @@
import 'class_body_test.dart' as class_body;
import 'compilation_unit_test.dart' as compilation_unit;
+import 'directive_uri_test.dart' as directive_uri;
import 'enum_constant_test.dart' as enum_constant;
import 'enum_test.dart' as enum_;
import 'field_formal_parameter_test.dart' as field_formal_parameter;
@@ -17,6 +18,7 @@
defineReflectiveSuite(() {
class_body.main();
compilation_unit.main();
+ directive_uri.main();
enum_constant.main();
enum_.main();
field_formal_parameter.main();
diff --git a/pkg/analysis_server/test/services/snippets/dart/flutter_snippet_producers_test.dart b/pkg/analysis_server/test/services/snippets/dart/flutter_snippet_producers_test.dart
index 61a2ca0..fcce56b 100644
--- a/pkg/analysis_server/test/services/snippets/dart/flutter_snippet_producers_test.dart
+++ b/pkg/analysis_server/test/services/snippets/dart/flutter_snippet_producers_test.dart
@@ -91,6 +91,7 @@
}
expect(code, '''
import 'package:flutter/src/foundation/key.dart';
+import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
class MyWidget extends StatefulWidget {
@@ -103,7 +104,7 @@
class _MyWidgetState extends State<MyWidget> {
@override
Widget build(BuildContext context) {
-
+ return Container();
}
}''');
}
@@ -126,6 +127,7 @@
code = SourceEdit.applySequence(code, edit.edits);
}
expect(code, '''
+import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
class MyWidget extends StatefulWidget {
@@ -138,20 +140,21 @@
class _MyWidgetState extends State<MyWidget> {
@override
Widget build(BuildContext context) {
-
+ return Container();
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 296);
+ expect(snippet.change.selection!.offset, 356);
+ expect(snippet.change.selectionLength, 11);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
- {'file': testFile, 'offset': 60},
- {'file': testFile, 'offset': 102},
- {'file': testFile, 'offset': 146},
- {'file': testFile, 'offset': 174},
- {'file': testFile, 'offset': 201},
- {'file': testFile, 'offset': 229},
+ {'file': testFile, 'offset': 113},
+ {'file': testFile, 'offset': 155},
+ {'file': testFile, 'offset': 199},
+ {'file': testFile, 'offset': 227},
+ {'file': testFile, 'offset': 254},
+ {'file': testFile, 'offset': 282},
],
'length': 8,
'suggestions': []
@@ -189,6 +192,7 @@
expect(code, '''
import 'package:flutter/src/animation/animation_controller.dart';
import 'package:flutter/src/foundation/key.dart';
+import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/ticker_provider.dart';
@@ -217,7 +221,7 @@
@override
Widget build(BuildContext context) {
-
+ return Container();
}
}''');
}
@@ -241,6 +245,7 @@
}
expect(code, '''
import 'package:flutter/src/animation/animation_controller.dart';
+import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/ticker_provider.dart';
@@ -269,20 +274,21 @@
@override
Widget build(BuildContext context) {
-
+ return Container();
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 699);
+ expect(snippet.change.selection!.offset, 759);
+ expect(snippet.change.selectionLength, 11);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
- {'file': testFile, 'offset': 185},
- {'file': testFile, 'offset': 227},
- {'file': testFile, 'offset': 271},
- {'file': testFile, 'offset': 299},
- {'file': testFile, 'offset': 326},
- {'file': testFile, 'offset': 354},
+ {'file': testFile, 'offset': 238},
+ {'file': testFile, 'offset': 280},
+ {'file': testFile, 'offset': 324},
+ {'file': testFile, 'offset': 352},
+ {'file': testFile, 'offset': 379},
+ {'file': testFile, 'offset': 407},
],
'length': 8,
'suggestions': []
@@ -316,6 +322,7 @@
}
expect(code, '''
import 'package:flutter/src/foundation/key.dart';
+import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
class MyWidget extends StatelessWidget {
@@ -323,7 +330,7 @@
@override
Widget build(BuildContext context) {
-
+ return Container();
}
}''');
}
@@ -346,6 +353,7 @@
code = SourceEdit.applySequence(code, edit.edits);
}
expect(code, '''
+import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
class MyWidget extends StatelessWidget {
@@ -353,16 +361,17 @@
@override
Widget build(BuildContext context) {
-
+ return Container();
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 182);
+ expect(snippet.change.selection!.offset, 242);
+ expect(snippet.change.selectionLength, 11);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
- {'file': testFile, 'offset': 60},
- {'file': testFile, 'offset': 103},
+ {'file': testFile, 'offset': 113},
+ {'file': testFile, 'offset': 156},
],
'length': 8,
'suggestions': []
diff --git a/pkg/analysis_server/test/src/cider/completion_test.dart b/pkg/analysis_server/test/src/cider/completion_test.dart
index e270153..2fd1095 100644
--- a/pkg/analysis_server/test/src/cider/completion_test.dart
+++ b/pkg/analysis_server/test/src/cider/completion_test.dart
@@ -401,7 +401,7 @@
_assertHasClass(text: 'String');
_assertHasConstructor(text: 'A');
_assertHasConstructor(text: 'B');
- _assertHasEnumConstant(text: 'E.e');
+ _assertHasEnum(text: 'E');
_assertHasMethod(text: 'foo');
_assertHasMethod(text: 'bar');
_assertHasParameter(text: 'a');
@@ -661,10 +661,10 @@
return matching.single;
}
- CompletionSuggestion _assertHasEnumConstant({required String text}) {
+ CompletionSuggestion _assertHasEnum({required String text}) {
var matching = _matchingCompletions(
text: text,
- elementKind: ElementKind.ENUM_CONSTANT,
+ elementKind: ElementKind.ENUM,
);
expect(matching, hasLength(1), reason: 'Expected exactly one completion');
return matching.single;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart
index 7c1d58c..74236cce 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart
@@ -105,7 +105,6 @@
''');
}
- @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/49046')
Future<void> test_function_hasZero_partOfName_noLibrary() async {
await resolveTestCode('''
part of my_lib;
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 c00ab29..62309a8 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
@@ -79,7 +79,6 @@
''', target: a);
}
- @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/49046')
Future<void> test_inPart_partOfName_noLibrary() async {
await resolveTestCode('''
part of my_lib;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
index 0cc45cd..af26bc4 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
@@ -383,7 +383,6 @@
});
}
- @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/49046')
Future<void> test_inPart_self() async {
await resolveTestCode('''
part of lib;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
index f7f443f..7566168 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
@@ -326,7 +326,6 @@
});
}
- @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/49046')
Future<void> test_qualified_instance_inPart_self() async {
await resolveTestCode('''
part of lib;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
index db18da2..fea7674 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
@@ -320,7 +320,6 @@
});
}
- @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/49046')
Future<void> test_qualified_instance_inPart_self() async {
await resolveTestCode('''
part of lib;
diff --git a/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart b/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart
index f10b8ce..772f091 100644
--- a/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart
+++ b/pkg/analysis_server/test/tool/lsp_spec/generated_classes_test.dart
@@ -29,10 +29,10 @@
test('with aliased list fields can be checked for equality', () {
final a = TextDocumentRegistrationOptions(documentSelector: [
- TextDocumentFilter(language: 'dart', scheme: 'file')
+ TextDocumentFilterWithScheme(language: 'dart', scheme: 'file')
]);
final b = TextDocumentRegistrationOptions(documentSelector: [
- TextDocumentFilter(language: 'dart', scheme: 'file')
+ TextDocumentFilterWithScheme(language: 'dart', scheme: 'file')
]);
expect(a, equals(b));
@@ -87,12 +87,12 @@
test('consider subclasses when checking for equality', () {
final a = TextDocumentRegistrationOptions(documentSelector: [
- TextDocumentFilter(language: 'dart', scheme: 'file')
+ TextDocumentFilterWithScheme(language: 'dart', scheme: 'file')
]);
final b = TextDocumentSaveRegistrationOptions(
includeText: true,
documentSelector: [
- TextDocumentFilter(language: 'dart', scheme: 'file')
+ TextDocumentFilterWithScheme(language: 'dart', scheme: 'file')
]);
expect(a, isNot(equals(b)));
diff --git a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
index 14e8620..2fe1e2e 100644
--- a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
+++ b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
@@ -73,23 +73,26 @@
// the migration to JSON meta_model.
'ClientCapabilitiesWindow': 'WindowClientCapabilities',
'ClientCapabilitiesWorkspace': 'WorkspaceClientCapabilities',
- 'ClientCapabilitiesFileOperations': 'FileOperationClientCapabilities',
- 'ServerCapabilitiesFileOperations': 'FileOperationOptions',
+ 'ClientCapabilitiesWorkspaceFileOperations':
+ 'FileOperationClientCapabilities',
+ 'ServerCapabilitiesWorkspaceFileOperations': 'FileOperationOptions',
'ClientCapabilitiesGeneral': 'GeneralClientCapabilities',
- 'CompletionClientCapabilitiesInsertTextModeSupport':
+ 'CompletionClientCapabilitiesCompletionItemInsertTextModeSupport':
'CompletionItemInsertTextModeSupport',
- 'CompletionClientCapabilitiesResolveSupport':
+ 'CompletionClientCapabilitiesCompletionItemResolveSupport':
'CompletionItemResolveSupport',
- 'CompletionClientCapabilitiesTagSupport': 'CompletionItemTagSupport',
- 'CodeActionClientCapabilitiesCodeActionKind':
+ 'CompletionClientCapabilitiesCompletionItemTagSupport':
+ 'CompletionItemTagSupport',
+ 'CodeActionClientCapabilitiesCodeActionLiteralSupportCodeActionKind':
'CodeActionLiteralSupportCodeActionKind',
- 'DocumentFilter': 'TextDocumentFilter',
- 'ClientCapabilitiesStaleRequestSupport':
+ // In JSON model this becomes a union of literals which we assign improved
+ // names to (to avoid numeric suffixes).
+ 'DocumentFilter': 'TextDocumentFilterWithScheme',
+ 'ClientCapabilitiesGeneralStaleRequestSupport':
'GeneralClientCapabilitiesStaleRequestSupport',
- 'SignatureHelpClientCapabilitiesParameterInformation':
+ 'SignatureHelpClientCapabilitiesSignatureInformationParameterInformation':
'SignatureInformationParameterInformation',
- 'NotebookDocumentChangeEventStructure':
- 'NotebookDocumentChangeEventCellsStructure',
+ 'CompletionListItemDefaultsEditRange': 'CompletionItemEditRange',
};
for (final type in types) {
@@ -218,6 +221,21 @@
}
}
+bool _isOverride(Interface interface, Field field) {
+ for (var parentType in interface.baseTypes) {
+ var parent = _interfaces[(parentType as Type).name];
+ if (parent != null) {
+ if (parent.members.any((m) => m.name == field.name)) {
+ return true;
+ }
+ if (_isOverride(parent, field)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
bool _isSimpleType(TypeBase type) {
const literals = ['num', 'String', 'bool', 'int'];
return type is Type && literals.contains(type.dartType);
@@ -364,14 +382,15 @@
..writeIndentedln('}');
}
buffer.writeIndented('if (');
- if (field.allowsNull || field.allowsUndefined) {
+ final nullCheck = field.allowsNull || field.allowsUndefined;
+ if (nullCheck) {
buffer.write('$localName != null && ');
}
- buffer.write('!(');
_writeTypeCheckCondition(
- buffer, interface, localName, field.type, 'reporter');
+ buffer, interface, localName, field.type, 'reporter',
+ negation: true, parenForCollection: nullCheck);
buffer
- ..write(')) {')
+ ..write(') {')
..indent()
..writeIndentedln(
"reporter.reportError('${_getTypeCheckFailureMessage(field.type).replaceAll("'", "\\'")}');")
@@ -528,14 +547,14 @@
});
buffer
..writeln()
- ..writeIndentedln('Object toJson() => _value;')
+ ..writeIndentedln('@override Object toJson() => _value;')
..writeln()
..writeIndentedln('@override String toString() => _value.toString();')
..writeln()
..writeIndentedln('@override int get hashCode => _value.hashCode;')
..writeln()
..writeIndentedln(
- 'bool operator ==(Object other) => other is $namespaceName && other._value == _value;')
+ '@override bool operator ==(Object other) => other is $namespaceName && other._value == _value;')
..outdent()
..writeln('}')
..writeln();
@@ -587,10 +606,14 @@
}
}
-void _writeField(IndentableStringBuffer buffer, Field field) {
+void _writeField(
+ IndentableStringBuffer buffer, Interface interface, Field field) {
_writeDocCommentsAndAnnotations(buffer, field);
final needsNullable =
(field.allowsNull || field.allowsUndefined) && !isAnyType(field.type);
+ if (_isOverride(interface, field)) {
+ buffer.writeIndentedln('@override');
+ }
buffer
..writeIndented('final ')
..write(field.type.dartTypeWithTypeArgs)
@@ -628,7 +651,10 @@
// Lists need to be map()'d so we can recursively call writeFromJsonCode
// as they may need fromJson on each element.
final listCast = requiresCast ? ' as List<Object?>$nullOperator' : '';
- buffer.write('($valueCode$listCast)$nullOperator.map((item) => ');
+ final leftParen = requiresCast ? '(' : '';
+ final rightParen = requiresCast ? ')' : '';
+ buffer.write(
+ '$leftParen$valueCode$listCast$rightParen$nullOperator.map((item) => ');
_writeFromJsonCode(buffer, type.elementType, 'item', allowsNull: false);
buffer.write(').toList()');
} else if (type is MapType) {
@@ -818,9 +844,9 @@
final consts = interface.members.whereType<Const>().toList();
final fields = _getAllFields(interface);
buffer.writeln();
- _writeMembers(buffer, consts);
+ _writeMembers(buffer, interface, consts);
buffer.writeln();
- _writeMembers(buffer, fields);
+ _writeMembers(buffer, interface, fields);
buffer.writeln();
_writeToJsonMethod(buffer, interface);
_writeCanParseMethod(buffer, interface);
@@ -863,9 +889,10 @@
}
}
-void _writeMember(IndentableStringBuffer buffer, Member member) {
+void _writeMember(
+ IndentableStringBuffer buffer, Interface interface, Member member) {
if (member is Field) {
- _writeField(buffer, member);
+ _writeField(buffer, interface, member);
} else if (member is Const) {
_writeConst(buffer, member);
} else {
@@ -873,8 +900,9 @@
}
}
-void _writeMembers(IndentableStringBuffer buffer, List<Member> members) {
- _getSortedUnique(members).forEach((m) => _writeMember(buffer, m));
+void _writeMembers(
+ IndentableStringBuffer buffer, Interface interface, List<Member> members) {
+ _getSortedUnique(members).forEach((m) => _writeMember(buffer, interface, m));
}
void _writeToJsonCode(IndentableStringBuffer buffer, TypeBase type,
@@ -918,11 +946,22 @@
}
void _writeToJsonMethod(IndentableStringBuffer buffer, Interface interface) {
- final mapName = _determineVariableName(interface,
- ['result', 'map', 'json', 'toReturn', 'results', 'value', 'values']);
+ final fields = _getAllFields(interface);
buffer
- ..writeIndentedln('Map<String, Object?> toJson() {')
+ ..writeIndentedln('@override')
+ ..write('Map<String, Object?> toJson() ');
+ if (fields.isEmpty) {
+ buffer
+ ..writeIndentedln('=> {};')
+ ..writeln();
+ return;
+ }
+
+ final mapName = _determineVariableName(interface,
+ ['result', 'map', 'json', 'toReturn', 'results', 'value', 'values']);
+ buffer
+ ..writeIndentedln('{')
..indent()
..writeIndentedln('var $mapName = <String, Object?>{};');
// ResponseMessage must confirm to JSON-RPC which says only one of
@@ -931,7 +970,7 @@
if (interface.name == 'ResponseMessage') {
_writeToJsonFieldsForResponseMessage(buffer, interface, mapName);
} else {
- for (var field in _getAllFields(interface)) {
+ for (var field in fields) {
_writeJsonMapAssignment(buffer, field, mapName);
}
}
@@ -963,62 +1002,88 @@
}
void _writeTypeCheckCondition(IndentableStringBuffer buffer,
- Interface? interface, String valueCode, TypeBase type, String reporter) {
+ Interface? interface, String valueCode, TypeBase type, String reporter,
+ {bool negation = false, bool parenForCollection = false}) {
type = resolveTypeAlias(type);
final dartType = type.dartType;
final fullDartType = type.dartTypeWithTypeArgs;
+
+ final operator = negation ? '!' : '';
+ final and = negation ? '||' : '&&';
+ final every = negation ? 'any' : 'every';
+
if (fullDartType == 'Object?') {
- buffer.write('true');
+ buffer.write(negation ? 'false' : 'true');
} else if (_isSimpleType(type)) {
- buffer.write('$valueCode is $fullDartType');
+ buffer.write('$valueCode is$operator $fullDartType');
} else if (type is LiteralType) {
- buffer.write('$valueCode == ${type.literal}');
+ final equals = negation ? '!=' : '==';
+ buffer.write('$valueCode $equals ${type.literal}');
} else if (_isSpecType(type)) {
- buffer.write('$dartType.canParse($valueCode, $reporter)');
+ buffer.write('$operator$dartType.canParse($valueCode, $reporter)');
} else if (type is ArrayType) {
- buffer.write('($valueCode is List<Object?>');
+ if (parenForCollection) {
+ buffer.write('(');
+ }
+ buffer.write('$valueCode is$operator List<Object?>');
if (fullDartType != 'Object?') {
// TODO(dantup): If we're happy to assume we never have two lists in a union
// we could skip this bit.
- buffer.write(' && ($valueCode.every((item) => ');
+ buffer.write(' $and $valueCode.$every((item) => ');
_writeTypeCheckCondition(
- buffer, interface, 'item', type.elementType, reporter);
- buffer.write('))');
+ buffer, interface, 'item', type.elementType, reporter,
+ negation: negation);
+ buffer.write(')');
}
- buffer.write(')');
+ if (parenForCollection) {
+ buffer.write(')');
+ }
} else if (type is MapType) {
- buffer.write('($valueCode is Map');
+ if (parenForCollection) {
+ buffer.write('(');
+ }
+ buffer.write('$valueCode is$operator Map');
if (fullDartType != 'Object?') {
buffer
- ..write(' && (')
- ..write('$valueCode.keys.every((item) => ');
+ ..write(' $and (')
+ ..write('$valueCode.keys.$every((item) => ');
_writeTypeCheckCondition(
- buffer, interface, 'item', type.indexType, reporter);
- buffer.write('&& $valueCode.values.every((item) => ');
+ buffer, interface, 'item', type.indexType, reporter,
+ negation: negation);
+ buffer.write('$and $valueCode.values.$every((item) => ');
_writeTypeCheckCondition(
- buffer, interface, 'item', type.valueType, reporter);
+ buffer, interface, 'item', type.valueType, reporter,
+ negation: negation);
buffer.write(')))');
}
- buffer.write(')');
+ if (parenForCollection) {
+ buffer.write(')');
+ }
} else if (type is UnionType) {
+ if (parenForCollection && !negation) {
+ buffer.write('(');
+ }
+ var or = negation ? '&&' : '||';
// To type check a union, we just recursively check against each of its types.
- buffer.write('(');
for (var i = 0; i < type.types.length; i++) {
if (i != 0) {
- buffer.write(' || ');
+ buffer.write(' $or ');
}
_writeTypeCheckCondition(
- buffer, interface, valueCode, type.types[i], reporter);
+ buffer, interface, valueCode, type.types[i], reporter,
+ negation: negation);
}
- buffer.write(')');
+ if (parenForCollection && !negation) {
+ buffer.write(')');
+ }
} else if (interface != null &&
interface.typeArgs.any((typeArg) => typeArg.lexeme == fullDartType)) {
- final comment = '/* $fullDartType.canParse($valueCode) */';
+ final comment = '/* $operator$fullDartType.canParse($valueCode) */';
print(
'WARN: Unable to write a type check for $valueCode with generic type $fullDartType. '
'Please review the generated code annotated with $comment');
- buffer.write('true $comment');
+ buffer.write('${negation ? 'false' : 'true'} $comment');
} else {
throw 'Unable to type check $valueCode against $fullDartType';
}
diff --git a/pkg/analysis_server/tool/lsp_spec/generate_all.dart b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
index 5952649..d22b884 100644
--- a/pkg/analysis_server/tool/lsp_spec/generate_all.dart
+++ b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
@@ -166,10 +166,6 @@
// To regenerate the file, use the script
// "pkg/analysis_server/tool/lsp_spec/generate_all.dart".
-// ignore_for_file: annotate_overrides
-// ignore_for_file: prefer_is_not_operator
-// ignore_for_file: unnecessary_parenthesis
-
import 'dart:core' hide deprecated;
import 'dart:core' as core show deprecated;
import 'dart:convert' show JsonEncoder;
diff --git a/pkg/analysis_server/tool/lsp_spec/lsp_specification.md b/pkg/analysis_server/tool/lsp_spec/lsp_specification.md
index 55fd7f4..5bee93f 100644
--- a/pkg/analysis_server/tool/lsp_spec/lsp_specification.md
+++ b/pkg/analysis_server/tool/lsp_spec/lsp_specification.md
@@ -3819,6 +3819,11 @@
* return value for the corresponding server capability as well.
*/
dynamicRegistration?: boolean;
+
+ /**
+ * The client supports sending execution summary data per cell.
+ */
+ executionSummarySupport?: boolean;
}
```
@@ -3857,7 +3862,7 @@
* value is provided it matches against the
* notebook type. '*' matches every notebook.
*/
- notebookDocument: string | NotebookDocumentFilter;
+ notebook: string | NotebookDocumentFilter;
/**
* The cells of the matching notebook to be synced.
@@ -3869,7 +3874,7 @@
* value is provided it matches against the
* notebook type. '*' matches every notebook.
*/
- notebookDocument?: string | NotebookDocumentFilter;
+ notebook?: string | NotebookDocumentFilter;
/**
* The cells of the matching notebook to be synced.
@@ -4735,7 +4740,7 @@
<div class="anchorHolder"><a href="#typeHierarchyClientCapabilities" name="typeHierarchyClientCapabilities" class="linkableAnchor"></a></div>
```typescript
-type TypeHierarchyClientCapabilities = {
+export interface TypeHierarchyClientCapabilities {
/**
* Whether implementation supports dynamic registration. If this is set to
* `true` the client supports the new `(TextDocumentRegistrationOptions &
@@ -5998,6 +6003,10 @@
number = 'number',
regexp = 'regexp',
operator = 'operator'
+ /**
+ * @since 3.17.0
+ */
+ decorator = 'decorator'
}
```
@@ -7601,6 +7610,13 @@
* @since 3.17.0
*/
insertTextMode?: InsertTextMode;
+
+ /**
+ * A default data value.
+ *
+ * @since 3.17.0
+ */
+ data?: LSPAny;
}
/**
@@ -9883,7 +9899,7 @@
export namespace PrepareSupportDefaultBehavior {
/**
* The client's default behavior is to select the identifier
- * according the to language's syntax rule.
+ * according to the language's syntax rule.
*/
export const Identifier: 1 = 1;
}
@@ -9992,7 +10008,7 @@
<div class="anchorHolder"><a href="#prepareRenameParams" name="prepareRenameParams" class="linkableAnchor"></a></div>
```typescript
-export interface PrepareRenameParams extends TextDocumentPositionParams {
+export interface PrepareRenameParams extends TextDocumentPositionParams, WorkDoneProgressParams {
}
```
diff --git a/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart b/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
index d074460..3f790e3 100644
--- a/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
+++ b/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
@@ -623,9 +623,10 @@
TypeBase type;
if (_match([TokenType.LEFT_BRACE])) {
// Inline interfaces.
+ final generatedName = _getAvailableName(containerName, fieldName);
final members = <Member>[];
while (!_check(TokenType.RIGHT_BRACE)) {
- members.add(_member(containerName));
+ members.add(_member(generatedName));
}
_consume(TokenType.RIGHT_BRACE, 'Expected }');
@@ -638,7 +639,6 @@
type = MapType(indexer.indexType, indexer.valueType);
} else {
// Add a synthetic interface to the parsers list of nodes to represent this type.
- final generatedName = _getAvailableName(containerName, fieldName);
_addNode(InlineInterface(generatedName, members));
// Record the type as a simple type that references this interface.
type = Type.identifier(generatedName);
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/SourceChange.java b/pkg/analysis_server/tool/spec/generated/java/types/SourceChange.java
index 55b2761..687d00d 100644
--- a/pkg/analysis_server/tool/spec/generated/java/types/SourceChange.java
+++ b/pkg/analysis_server/tool/spec/generated/java/types/SourceChange.java
@@ -56,6 +56,12 @@
private final Position selection;
/**
+ * The length of the selection (starting at Position) that should be selected after the edits have
+ * been applied.
+ */
+ private final Integer selectionLength;
+
+ /**
* The optional identifier of the change kind. The identifier remains stable even if the message
* changes, or is parameterized.
*/
@@ -64,11 +70,12 @@
/**
* Constructor for {@link SourceChange}.
*/
- public SourceChange(String message, List<SourceFileEdit> edits, List<LinkedEditGroup> linkedEditGroups, Position selection, String id) {
+ public SourceChange(String message, List<SourceFileEdit> edits, List<LinkedEditGroup> linkedEditGroups, Position selection, Integer selectionLength, String id) {
this.message = message;
this.edits = edits;
this.linkedEditGroups = linkedEditGroups;
this.selection = selection;
+ this.selectionLength = selectionLength;
this.id = id;
}
@@ -81,6 +88,7 @@
ObjectUtilities.equals(other.edits, edits) &&
ObjectUtilities.equals(other.linkedEditGroups, linkedEditGroups) &&
ObjectUtilities.equals(other.selection, selection) &&
+ ObjectUtilities.equals(other.selectionLength, selectionLength) &&
ObjectUtilities.equals(other.id, id);
}
return false;
@@ -91,8 +99,9 @@
List<SourceFileEdit> edits = SourceFileEdit.fromJsonArray(jsonObject.get("edits").getAsJsonArray());
List<LinkedEditGroup> linkedEditGroups = LinkedEditGroup.fromJsonArray(jsonObject.get("linkedEditGroups").getAsJsonArray());
Position selection = jsonObject.get("selection") == null ? null : Position.fromJson(jsonObject.get("selection").getAsJsonObject());
+ Integer selectionLength = jsonObject.get("selectionLength") == null ? null : jsonObject.get("selectionLength").getAsInt();
String id = jsonObject.get("id") == null ? null : jsonObject.get("id").getAsString();
- return new SourceChange(message, edits, linkedEditGroups, selection, id);
+ return new SourceChange(message, edits, linkedEditGroups, selection, selectionLength, id);
}
public static List<SourceChange> fromJsonArray(JsonArray jsonArray) {
@@ -143,6 +152,14 @@
return selection;
}
+ /**
+ * The length of the selection (starting at Position) that should be selected after the edits have
+ * been applied.
+ */
+ public Integer getSelectionLength() {
+ return selectionLength;
+ }
+
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
@@ -150,6 +167,7 @@
builder.append(edits);
builder.append(linkedEditGroups);
builder.append(selection);
+ builder.append(selectionLength);
builder.append(id);
return builder.toHashCode();
}
@@ -170,6 +188,9 @@
if (selection != null) {
jsonObject.add("selection", selection.toJson());
}
+ if (selectionLength != null) {
+ jsonObject.addProperty("selectionLength", selectionLength);
+ }
if (id != null) {
jsonObject.addProperty("id", id);
}
@@ -188,6 +209,8 @@
builder.append(StringUtils.join(linkedEditGroups, ", ") + ", ");
builder.append("selection=");
builder.append(selection + ", ");
+ builder.append("selectionLength=");
+ builder.append(selectionLength + ", ");
builder.append("id=");
builder.append(id);
builder.append("]");
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index aaaeeb5..a368876 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -7,7 +7,7 @@
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version
- <version>1.33.0</version>
+ <version>1.33.1</version>
</h1>
<p>
This document contains a specification of the API provided by the
@@ -134,6 +134,11 @@
ignoring the item or treating it with some default/fallback handling.
</p>
<h3>Changelog</h3>
+<h4>1.33.1</h4>
+<ul>
+ <li><tt>SourceChange</tt> now has an optional <tt>selectionLength</tt> that may be
+ provided when <tt>selection</tt> is.</li>
+</ul>
<h4>1.33.0</h4>
<ul>
<li>Requests <tt>getSuggestions2</tt> and <tt>getSuggestionDetails2</tt>
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart
index 363d7e8..e9534c1 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart
@@ -4276,6 +4276,7 @@
/// "edits": List<SourceFileEdit>
/// "linkedEditGroups": List<LinkedEditGroup>
/// "selection": optional Position
+/// "selectionLength": optional int
/// "id": optional String
/// }
///
@@ -4294,6 +4295,10 @@
/// The position that should be selected after the edits have been applied.
Position? selection;
+ /// The length of the selection (starting at Position) that should be
+ /// selected after the edits have been applied.
+ int? selectionLength;
+
/// The optional identifier of the change kind. The identifier remains stable
/// even if the message changes, or is parameterized.
String? id;
@@ -4302,6 +4307,7 @@
{List<SourceFileEdit>? edits,
List<LinkedEditGroup>? linkedEditGroups,
this.selection,
+ this.selectionLength,
this.id})
: edits = edits ?? <SourceFileEdit>[],
linkedEditGroups = linkedEditGroups ?? <LinkedEditGroup>[];
@@ -4342,6 +4348,11 @@
selection = Position.fromJson(
jsonDecoder, jsonPath + '.selection', json['selection']);
}
+ int? selectionLength;
+ if (json.containsKey('selectionLength')) {
+ selectionLength = jsonDecoder.decodeInt(
+ jsonPath + '.selectionLength', json['selectionLength']);
+ }
String? id;
if (json.containsKey('id')) {
id = jsonDecoder.decodeString(jsonPath + '.id', json['id']);
@@ -4350,6 +4361,7 @@
edits: edits,
linkedEditGroups: linkedEditGroups,
selection: selection,
+ selectionLength: selectionLength,
id: id);
} else {
throw jsonDecoder.mismatch(jsonPath, 'SourceChange', json);
@@ -4369,6 +4381,10 @@
if (selection != null) {
result['selection'] = selection.toJson();
}
+ var selectionLength = this.selectionLength;
+ if (selectionLength != null) {
+ result['selectionLength'] = selectionLength;
+ }
var id = this.id;
if (id != null) {
result['id'] = id;
@@ -4411,6 +4427,7 @@
listEqual(linkedEditGroups, other.linkedEditGroups,
(LinkedEditGroup a, LinkedEditGroup b) => a == b) &&
selection == other.selection &&
+ selectionLength == other.selectionLength &&
id == other.id;
}
return false;
@@ -4422,6 +4439,7 @@
edits,
linkedEditGroups,
selection,
+ selectionLength,
id,
);
}
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart
index e1e3e17..4867f3d 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart
@@ -8,7 +8,7 @@
// ignore_for_file: constant_identifier_names
-const String PROTOCOL_VERSION = '1.33.0';
+const String PROTOCOL_VERSION = '1.33.1';
const String ANALYSIS_NOTIFICATION_ANALYZED_FILES = 'analysis.analyzedFiles';
const String ANALYSIS_NOTIFICATION_ANALYZED_FILES_DIRECTORIES = 'directories';
diff --git a/pkg/analysis_server_client/pubspec.yaml b/pkg/analysis_server_client/pubspec.yaml
index c243b32..a5438e9 100644
--- a/pkg/analysis_server_client/pubspec.yaml
+++ b/pkg/analysis_server_client/pubspec.yaml
@@ -13,11 +13,12 @@
path: ^1.8.0
pub_semver: ^2.0.0
+# We use 'any' version constraints here as we get our package versions from
+# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
+# best practice for packages is to specify their compatible version ranges.
+# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
- analyzer:
- path: ../analyzer
- analysis_server:
- path: ../analysis_server
- analyzer_utilities:
- path: ../analyzer_utilities
- test: ^1.14.2
+ analyzer: any
+ analysis_server: any
+ analyzer_utilities: any
+ test: any
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 4cda143..d40a6e6 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,5 +1,7 @@
## 4.2.0-dev
* Update SDK constraints to `>=2.17.0 <3.0.0`.
+* Deprecated `ImportDirective.COMPARATOR`, use appropriate custom logic, if necessary.
+* Deprecated `Element.isAccessibleIn()`, use `isAccessibleIn2()` instead.
## 4.1.0
* Deprecated `ParameterElement.isNotOptional`, use `isRequired` instead.
diff --git a/pkg/analyzer/lib/dart/analysis/results.dart b/pkg/analyzer/lib/dart/analysis/results.dart
index 200ebaf..97198d9 100644
--- a/pkg/analyzer/lib/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/dart/analysis/results.dart
@@ -195,22 +195,6 @@
CompilationUnit get unit;
}
-/// The type of [InvalidResult] returned when the file is a part, and its
-/// containing library is not known.
-///
-/// Clients may not extend, implement or mix-in this class.
-///
-/// TODO(scheglov) Add an error that points at the `part of` location.
-abstract class PartWithoutLibraryResult
- implements
- InvalidResult,
- SomeErrorsResult,
- SomeResolvedUnitResult,
- SomeUnitElementResult {
- /// The absolute and normalized path of the file.
- String get path;
-}
-
/// The result of building resolved AST(s) for the whole library.
///
/// Clients may not extend, implement or mix-in this class.
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 53a072f..a00f66a 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -2733,6 +2733,7 @@
///
/// Clients may not extend, implement or mix-in this class.
abstract class ImportDirective implements NamespaceDirective {
+ @Deprecated('This kind of syntactic equality is rarely useful')
static Comparator<ImportDirective> COMPARATOR =
(ImportDirective import1, ImportDirective import2) {
//
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index 6ed4c00..4291006 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -397,7 +397,7 @@
/// An element representing a compilation unit.
///
/// Clients may not extend, implement or mix-in this class.
-abstract class CompilationUnitElement implements Element, UriReferencedElement {
+abstract class CompilationUnitElement implements UriReferencedElement {
/// Return a list containing all of the top-level accessors (getters and
/// setters) contained in this compilation unit.
List<PropertyAccessorElement> get accessors;
@@ -726,10 +726,18 @@
/// A declaration <i>m</i> is accessible to library <i>L</i> if <i>m</i> is
/// declared in <i>L</i> or if <i>m</i> is public.
/// </blockquote>
- ///
- /// TODO(migration): should not be nullable
+ @Deprecated('Use isAccessibleIn2() instead')
bool isAccessibleIn(LibraryElement? library);
+ /// Return `true` if this element, assuming that it is within scope, is
+ /// accessible to code in the given [library]. This is defined by the Dart
+ /// Language Specification in section 6.2:
+ /// <blockquote>
+ /// A declaration <i>m</i> is accessible to a library <i>L</i> if <i>m</i> is
+ /// declared in <i>L</i> or if <i>m</i> is public.
+ /// </blockquote>
+ bool isAccessibleIn2(LibraryElement library);
+
/// Return either this element or the most immediate ancestor of this element
/// for which the [predicate] returns `true`, or `null` if there is no such
/// element.
@@ -1132,7 +1140,7 @@
/// An export directive within a library.
///
/// Clients may not extend, implement or mix-in this class.
-abstract class ExportElement implements Element, UriReferencedElement {
+abstract class ExportElement implements UriReferencedElement {
/// Return a list containing the combinators that were specified as part of
/// the export directive in the order in which they were specified.
List<NamespaceCombinator> get combinators;
@@ -1288,7 +1296,7 @@
/// A single import directive within a library.
///
/// Clients may not extend, implement or mix-in this class.
-abstract class ImportElement implements Element, UriReferencedElement {
+abstract class ImportElement implements UriReferencedElement {
/// Return a list containing the combinators that were specified as part of
/// the import directive in the order in which they were specified.
List<NamespaceCombinator> get combinators;
diff --git a/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart b/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart
index 4b4946f..d6d58b7 100644
--- a/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart
@@ -43,12 +43,14 @@
bool enableIndex = false,
required List<String> includedPaths,
List<String>? excludedPaths,
+ List<String>? librarySummaryPaths,
String? optionsFile,
String? packagesFile,
PerformanceLog? performanceLog,
ResourceProvider? resourceProvider,
bool retainDataForTesting = false,
String? sdkPath,
+ String? sdkSummaryPath,
AnalysisDriverScheduler? scheduler,
FileContentCache? fileContentCache,
void Function(AnalysisOptionsImpl)? updateAnalysisOptions,
@@ -78,9 +80,11 @@
declaredVariables: DeclaredVariables.fromMap(declaredVariables ?? {}),
drainStreams: drainStreams,
enableIndex: enableIndex,
+ librarySummaryPaths: librarySummaryPaths,
performanceLog: performanceLog,
retainDataForTesting: retainDataForTesting,
sdkPath: sdkPath,
+ sdkSummaryPath: sdkSummaryPath,
scheduler: scheduler,
updateAnalysisOptions: updateAnalysisOptions,
fileContentCache: fileContentCache,
@@ -118,13 +122,17 @@
throw StateError('Unable to find the context to $path');
}
- void dispose() {
+ void dispose({
+ bool forTesting = false,
+ }) {
for (var analysisContext in contexts) {
analysisContext.driver.dispose();
}
macroExecutor.close();
// If there are other collections, they will have to start it again.
- KernelCompilationService.dispose();
+ if (!forTesting) {
+ KernelCompilationService.dispose();
+ }
}
/// Check every element with [_throwIfNotAbsoluteNormalizedPath].
diff --git a/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart b/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
deleted file mode 100644
index 2def037..0000000
--- a/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
+++ /dev/null
@@ -1,792 +0,0 @@
-// Copyright (c) 2018, 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:typed_data';
-
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/src/dart/analysis/dependency/node.dart';
-import 'package:analyzer/src/dart/analysis/dependency/reference_collector.dart';
-import 'package:analyzer/src/dart/ast/token.dart';
-import 'package:analyzer/src/summary/api_signature.dart';
-
-/// Build [Library] that describes nodes and dependencies of the library
-/// with the given [uri] and [units].
-///
-/// If the [units] are just parsed, then only token signatures and referenced
-/// names of nodes can be computed. If the [units] are fully resolved, then
-/// also class member references can be recorded.
-Library buildLibrary(Uri uri, List<CompilationUnit> units) {
- return _LibraryBuilder(uri, units).build();
-}
-
-/// The `show` or `hide` namespace combinator.
-class Combinator {
- final bool isShow;
- final List<String> names;
-
- Combinator(this.isShow, this.names);
-
- @override
- String toString() {
- if (isShow) {
- return 'show ${names.join(', ')}';
- } else {
- return 'hide ${names.join(', ')}';
- }
- }
-}
-
-/// The `export` directive.
-class Export {
- /// The absolute URI of the exported library.
- final Uri uri;
-
- /// The list of namespace combinators to apply, not `null`.
- final List<Combinator> combinators;
-
- Export(this.uri, this.combinators);
-
- @override
- String toString() {
- return 'Export(uri: $uri, combinators: $combinators)';
- }
-}
-
-/// The `import` directive.
-class Import {
- /// The absolute URI of the imported library.
- final Uri uri;
-
- /// The import prefix, or `null` if not specified.
- final String? prefix;
-
- /// The list of namespace combinators to apply, not `null`.
- final List<Combinator> combinators;
-
- Import(this.uri, this.prefix, this.combinators);
-
- @override
- String toString() {
- return 'Import(uri: $uri, prefix: $prefix, combinators: $combinators)';
- }
-}
-
-/// The collection of imports, exports, and top-level nodes.
-class Library {
- /// The absolute URI of the library.
- final Uri uri;
-
- /// The list of imports in this library.
- final List<Import> imports;
-
- /// The list of exports in this library.
- final List<Export> exports;
-
- /// The list of libraries that correspond to the [imports].
- List<Library>? importedLibraries;
-
- /// The list of top-level nodes defined in the library.
- ///
- /// This list is sorted.
- final List<Node> declaredNodes;
-
- /// The map of [declaredNodes], used for fast search.
- /// TODO(scheglov) consider using binary search instead.
- final Map<LibraryQualifiedName, Node> declaredNodeMap = {};
-
- /// The list of nodes exported from this library, either using `export`
- /// directives, or declared in this library.
- ///
- /// This list is sorted.
- List<Node>? exportedNodes;
-
- /// The map of nodes that are visible in the library, either imported,
- /// or declared in this library.
- ///
- /// TODO(scheglov) support for imports with prefixes
- Map<String, Node>? libraryScope;
-
- Library(this.uri, this.imports, this.exports, this.declaredNodes) {
- for (var node in declaredNodes) {
- declaredNodeMap[node.name] = node;
- }
- }
-
- @override
- String toString() => '$uri';
-}
-
-class _LibraryBuilder {
- /// The URI of the library.
- final Uri uri;
-
- /// The units of the library, parsed or fully resolved.
- final List<CompilationUnit> units;
-
- /// The instance of the referenced names, class members collector.
- final ReferenceCollector referenceCollector = ReferenceCollector();
-
- /// The list of imports in the library.
- final List<Import> imports = [];
-
- /// The list of exports in the library.
- final List<Export> exports = [];
-
- /// The top-level nodes declared in the library.
- final List<Node> declaredNodes = [];
-
- /// The precomputed signature of the [uri].
- ///
- /// It is mixed into every API token signature, because for example even
- /// though types of two functions might be the same, their locations
- /// are different.
- late Uint8List uriSignature;
-
- /// The precomputed signature of the enclosing class name, or `null` if
- /// outside a class.
- ///
- /// It is mixed into every API token signature of every class member, because
- /// for example even though types of two methods might be the same, their
- /// locations are different.
- Uint8List? enclosingClassNameSignature;
-
- _LibraryBuilder(this.uri, this.units);
-
- Library build() {
- uriSignature = (ApiSignature()..addString(uri.toString())).toByteList();
-
- _addImports();
- _addExports();
-
- for (var unit in units) {
- _addUnit(unit);
- }
- declaredNodes.sort(Node.compare);
-
- return Library(uri, imports, exports, declaredNodes);
- }
-
- void _addClassOrMixin(ClassOrMixinDeclaration node) {
- var enclosingClassName = node.name.name;
-
- NamedType? enclosingSuperClass;
- if (node is ClassDeclaration) {
- enclosingSuperClass = node.extendsClause?.superclass;
- }
-
- enclosingClassNameSignature =
- (ApiSignature()..addString(enclosingClassName)).toByteList();
-
- var apiTokenSignature = _computeTokenSignature(
- node.beginToken,
- node.leftBracket,
- );
-
- var typeParameters = node.typeParameters;
-
- Dependencies api;
- if (node is ClassDeclaration) {
- api = referenceCollector.collect(
- apiTokenSignature,
- thisNodeName: enclosingClassName,
- typeParameters: typeParameters,
- extendsClause: node.extendsClause,
- withClause: node.withClause,
- implementsClause: node.implementsClause,
- );
- } else if (node is MixinDeclaration) {
- api = referenceCollector.collect(
- apiTokenSignature,
- thisNodeName: enclosingClassName,
- typeParameters: typeParameters,
- onClause: node.onClause,
- implementsClause: node.implementsClause,
- );
- } else {
- throw UnimplementedError('(${node.runtimeType}) $node');
- }
-
- var enclosingClass = Node(
- LibraryQualifiedName(uri, enclosingClassName),
- node is MixinDeclaration ? NodeKind.MIXIN : NodeKind.CLASS,
- api,
- Dependencies.none,
- );
-
- var hasConstConstructor = node.members.any(
- (m) => m is ConstructorDeclaration && m.constKeyword != null,
- );
-
- // TODO(scheglov) do we need type parameters at all?
- List<Node> classTypeParameters;
- if (typeParameters != null) {
- classTypeParameters = <Node>[];
- for (var typeParameter in typeParameters.typeParameters) {
- var api = referenceCollector.collect(
- _computeNodeTokenSignature(typeParameter),
- enclosingClassName: enclosingClassName,
- thisNodeName: typeParameter.name.name,
- type: typeParameter.bound,
- );
- classTypeParameters.add(Node(
- LibraryQualifiedName(uri, typeParameter.name.name),
- NodeKind.TYPE_PARAMETER,
- api,
- Dependencies.none,
- enclosingClass: enclosingClass,
- ));
- }
- classTypeParameters.sort(Node.compare);
- enclosingClass.setTypeParameters(classTypeParameters);
- }
-
- var classMembers = <Node>[];
- var hasConstructor = false;
- for (var member in node.members) {
- if (member is ConstructorDeclaration) {
- hasConstructor = true;
- _addConstructor(
- enclosingClass,
- enclosingSuperClass,
- classMembers,
- member,
- );
- } else if (member is FieldDeclaration) {
- _addVariables(
- enclosingClass,
- classMembers,
- member.metadata,
- member.fields,
- hasConstConstructor,
- );
- } else if (member is MethodDeclaration) {
- _addMethod(enclosingClass, classMembers, member);
- } else {
- throw UnimplementedError('(${member.runtimeType}) $member');
- }
- }
-
- if (node is ClassDeclaration && !hasConstructor) {
- classMembers.add(Node(
- LibraryQualifiedName(uri, ''),
- NodeKind.CONSTRUCTOR,
- Dependencies.none,
- Dependencies.none,
- enclosingClass: enclosingClass,
- ));
- }
-
- classMembers.sort(Node.compare);
- enclosingClass.setClassMembers(classMembers);
-
- declaredNodes.add(enclosingClass);
- enclosingClassNameSignature = null;
- }
-
- void _addClassTypeAlias(ClassTypeAlias node) {
- var apiTokenSignature = _computeNodeTokenSignature(node);
- var api = referenceCollector.collect(
- apiTokenSignature,
- typeParameters: node.typeParameters,
- superClass: node.superclass,
- withClause: node.withClause,
- implementsClause: node.implementsClause,
- );
-
- declaredNodes.add(Node(
- LibraryQualifiedName(uri, node.name.name),
- NodeKind.CLASS_TYPE_ALIAS,
- api,
- Dependencies.none,
- ));
- }
-
- void _addConstructor(
- Node enclosingClass,
- NamedType? enclosingSuperClass,
- List<Node> classMembers,
- ConstructorDeclaration node,
- ) {
- var builder = _newApiSignatureBuilder();
- _appendMetadataTokens(builder, node.metadata);
- _appendFormalParametersTokens(builder, node.parameters);
- var apiTokenSignature = builder.toByteList();
-
- var api = referenceCollector.collect(
- apiTokenSignature,
- enclosingClassName: enclosingClass.name.name,
- formalParameters: node.parameters,
- );
-
- var implTokenSignature = _computeNodeTokenSignature(node.body);
- var impl = referenceCollector.collect(
- implTokenSignature,
- enclosingClassName: enclosingClass.name.name,
- enclosingSuperClass: enclosingSuperClass,
- formalParametersForImpl: node.parameters,
- constructorInitializers: node.initializers,
- redirectedConstructor: node.redirectedConstructor,
- functionBody: node.body,
- );
-
- classMembers.add(Node(
- LibraryQualifiedName(uri, node.name?.name ?? ''),
- NodeKind.CONSTRUCTOR,
- api,
- impl,
- enclosingClass: enclosingClass,
- ));
- }
-
- void _addEnum(EnumDeclaration node) {
- var enumTokenSignature = _newApiSignatureBuilder().toByteList();
-
- var enumNode = Node(
- LibraryQualifiedName(uri, node.name.name),
- NodeKind.ENUM,
- Dependencies(enumTokenSignature, [], [], [], [], []),
- Dependencies.none,
- );
-
- Dependencies fieldDependencies;
- {
- var builder = _newApiSignatureBuilder();
- builder.addString(node.name.name);
- _appendTokens(builder, node.leftBracket, node.rightBracket);
- var tokenSignature = builder.toByteList();
- fieldDependencies = Dependencies(tokenSignature, [], [], [], [], []);
- }
-
- var members = <Node>[];
- for (var constant in node.constants) {
- members.add(Node(
- LibraryQualifiedName(uri, constant.name.name),
- NodeKind.GETTER,
- fieldDependencies,
- Dependencies.none,
- enclosingClass: enumNode,
- ));
- }
-
- members.add(Node(
- LibraryQualifiedName(uri, 'index'),
- NodeKind.GETTER,
- fieldDependencies,
- Dependencies.none,
- enclosingClass: enumNode,
- ));
-
- members.add(Node(
- LibraryQualifiedName(uri, 'values'),
- NodeKind.GETTER,
- fieldDependencies,
- Dependencies.none,
- enclosingClass: enumNode,
- ));
-
- members.sort(Node.compare);
- enumNode.setClassMembers(members);
-
- declaredNodes.add(enumNode);
- }
-
- /// Fill [exports] with information about exports.
- void _addExports() {
- for (var directive in units.first.directives) {
- if (directive is ExportDirective) {
- var refUri = directive.uri.stringValue;
- if (refUri != null) {
- var importUri = uri.resolve(refUri);
- var combinators = _getCombinators(directive);
- exports.add(Export(importUri, combinators));
- }
- }
- }
- }
-
- void _addFunction(FunctionDeclaration node) {
- var functionExpression = node.functionExpression;
-
- var builder = _newApiSignatureBuilder();
- _appendMetadataTokens(builder, node.metadata);
- _appendNodeTokens(builder, node.returnType);
- _appendNodeTokens(builder, functionExpression.typeParameters);
- _appendFormalParametersTokens(builder, functionExpression.parameters);
- var apiTokenSignature = builder.toByteList();
-
- var rawName = node.name.name;
- var name = LibraryQualifiedName(uri, node.isSetter ? '$rawName=' : rawName);
-
- NodeKind kind;
- if (node.isGetter) {
- kind = NodeKind.GETTER;
- } else if (node.isSetter) {
- kind = NodeKind.SETTER;
- } else {
- kind = NodeKind.FUNCTION;
- }
-
- var api = referenceCollector.collect(
- apiTokenSignature,
- thisNodeName: node.name.name,
- typeParameters: functionExpression.typeParameters,
- formalParameters: functionExpression.parameters,
- returnType: node.returnType,
- );
-
- var body = functionExpression.body;
- var implTokenSignature = _computeNodeTokenSignature(body);
- var impl = referenceCollector.collect(
- implTokenSignature,
- thisNodeName: node.name.name,
- formalParametersForImpl: functionExpression.parameters,
- functionBody: body,
- );
-
- declaredNodes.add(Node(name, kind, api, impl));
- }
-
- void _addFunctionTypeAlias(FunctionTypeAlias node) {
- var builder = _newApiSignatureBuilder();
- _appendMetadataTokens(builder, node.metadata);
- _appendNodeTokens(builder, node.typeParameters);
- _appendNodeTokens(builder, node.returnType);
- _appendFormalParametersTokens(builder, node.parameters);
- var apiTokenSignature = builder.toByteList();
-
- var api = referenceCollector.collect(
- apiTokenSignature,
- thisNodeName: node.name.name,
- typeParameters: node.typeParameters,
- formalParameters: node.parameters,
- returnType: node.returnType,
- );
-
- declaredNodes.add(Node(
- LibraryQualifiedName(uri, node.name.name),
- NodeKind.FUNCTION_TYPE_ALIAS,
- api,
- Dependencies.none,
- ));
- }
-
- void _addGenericTypeAlias(GenericTypeAlias node) {
- // TODO(scheglov) Support all types.
- var functionType = node.functionType;
-
- var builder = _newApiSignatureBuilder();
- _appendMetadataTokens(builder, node.metadata);
- _appendNodeTokens(builder, node.typeParameters);
- _appendNodeTokens(builder, functionType?.returnType);
- _appendNodeTokens(builder, functionType?.typeParameters);
- _appendFormalParametersTokens(builder, functionType?.parameters);
- var apiTokenSignature = builder.toByteList();
-
- var api = referenceCollector.collect(
- apiTokenSignature,
- typeParameters: node.typeParameters,
- typeParameters2: functionType?.typeParameters,
- formalParameters: functionType?.parameters,
- returnType: functionType?.returnType,
- );
-
- declaredNodes.add(Node(
- LibraryQualifiedName(uri, node.name.name),
- NodeKind.GENERIC_TYPE_ALIAS,
- api,
- Dependencies.none,
- ));
- }
-
- /// Fill [imports] with information about imports.
- void _addImports() {
- var hasDartCoreImport = false;
- for (var directive in units.first.directives) {
- if (directive is ImportDirective) {
- var refUri = directive.uri.stringValue;
- if (refUri == null) {
- continue;
- }
-
- var importUri = uri.resolve(refUri);
-
- if (importUri.toString() == 'dart:core') {
- hasDartCoreImport = true;
- }
-
- var combinators = _getCombinators(directive);
-
- var prefix = directive.prefix;
- imports.add(Import(importUri, prefix?.name, combinators));
-
- if (prefix != null) {
- referenceCollector.addImportPrefix(prefix.name);
- }
- }
- }
-
- if (!hasDartCoreImport) {
- imports.add(Import(Uri.parse('dart:core'), null, []));
- }
- }
-
- void _addMethod(
- Node enclosingClass,
- List<Node> classMembers,
- MethodDeclaration node,
- ) {
- var builder = _newApiSignatureBuilder();
- _appendMetadataTokens(builder, node.metadata);
- _appendNodeTokens(builder, node.returnType);
- _appendNodeTokens(builder, node.typeParameters);
- _appendFormalParametersTokens(builder, node.parameters);
- var apiTokenSignature = builder.toByteList();
-
- NodeKind kind;
- if (node.isGetter) {
- kind = NodeKind.GETTER;
- } else if (node.isSetter) {
- kind = NodeKind.SETTER;
- } else {
- kind = NodeKind.METHOD;
- }
-
- // TODO(scheglov) metadata, here and everywhere
- var api = referenceCollector.collect(
- apiTokenSignature,
- enclosingClassName: enclosingClass.name.name,
- thisNodeName: node.name.name,
- typeParameters: node.typeParameters,
- formalParameters: node.parameters,
- returnType: node.returnType,
- );
-
- var implTokenSignature = _computeNodeTokenSignature(node.body);
- var impl = referenceCollector.collect(
- implTokenSignature,
- enclosingClassName: enclosingClass.name.name,
- thisNodeName: node.name.name,
- formalParametersForImpl: node.parameters,
- functionBody: node.body,
- );
-
- var name = LibraryQualifiedName(uri, node.name.name);
- classMembers.add(
- Node(name, kind, api, impl, enclosingClass: enclosingClass),
- );
- }
-
- void _addUnit(CompilationUnit unit) {
- for (var declaration in unit.declarations) {
- if (declaration is ClassOrMixinDeclaration) {
- _addClassOrMixin(declaration);
- } else if (declaration is ClassTypeAlias) {
- _addClassTypeAlias(declaration);
- } else if (declaration is EnumDeclaration) {
- _addEnum(declaration);
- } else if (declaration is FunctionDeclaration) {
- _addFunction(declaration);
- } else if (declaration is FunctionTypeAlias) {
- _addFunctionTypeAlias(declaration);
- } else if (declaration is GenericTypeAlias) {
- _addGenericTypeAlias(declaration);
- } else if (declaration is TopLevelVariableDeclaration) {
- _addVariables(
- null,
- declaredNodes,
- declaration.metadata,
- declaration.variables,
- false,
- );
- } else {
- throw UnimplementedError('(${declaration.runtimeType}) $declaration');
- }
- }
- }
-
- void _addVariables(
- Node? enclosingClass,
- List<Node> variableNodes,
- List<Annotation> metadata,
- VariableDeclarationList variables,
- bool appendInitializerToApi,
- ) {
- if (variables.isConst || variables.type == null) {
- appendInitializerToApi = true;
- }
-
- for (var variable in variables.variables) {
- var initializer = variable.initializer;
-
- var builder = _newApiSignatureBuilder();
- builder.addInt(variables.isConst ? 1 : 0); // const flag
- _appendMetadataTokens(builder, metadata);
- _appendNodeTokens(builder, variables.type);
- if (appendInitializerToApi) {
- _appendNodeTokens(builder, initializer);
- }
-
- var apiTokenSignature = builder.toByteList();
- var api = referenceCollector.collect(
- apiTokenSignature,
- enclosingClassName: enclosingClass?.name.name,
- thisNodeName: variable.name.name,
- type: variables.type,
- expression: appendInitializerToApi ? initializer : null,
- );
-
- var implTokenSignature = _computeNodeTokenSignature(initializer);
- var impl = referenceCollector.collect(
- implTokenSignature,
- enclosingClassName: enclosingClass?.name.name,
- thisNodeName: variable.name.name,
- expression: initializer,
- );
-
- var rawName = variable.name.name;
- variableNodes.add(Node(
- LibraryQualifiedName(uri, rawName),
- NodeKind.GETTER,
- api,
- impl,
- enclosingClass: enclosingClass,
- ));
-
- if (!variables.isConst && !variables.isFinal) {
- // Note that one set of dependencies is enough for body.
- // So, the setter has empty "impl" dependencies.
- variableNodes.add(
- Node(
- LibraryQualifiedName(uri, '$rawName='),
- NodeKind.SETTER,
- api,
- Dependencies.none,
- enclosingClass: enclosingClass,
- ),
- );
- }
- }
- }
-
- /// Return the signature for all tokens of the [node].
- Uint8List _computeNodeTokenSignature(AstNode? node) {
- if (node == null) {
- return Uint8List(0);
- }
- return _computeTokenSignature(node.beginToken, node.endToken);
- }
-
- /// Return the signature for tokens from [begin] to [end] (both including).
- Uint8List _computeTokenSignature(Token begin, Token end) {
- var signature = _newApiSignatureBuilder();
- _appendTokens(signature, begin, end);
- return signature.toByteList();
- }
-
- /// Return a new signature builder, primed with the current context salts.
- ApiSignature _newApiSignatureBuilder() {
- var builder = ApiSignature();
- builder.addBytes(uriSignature);
-
- final enclosingClassNameSignature = this.enclosingClassNameSignature;
- if (enclosingClassNameSignature != null) {
- builder.addBytes(enclosingClassNameSignature);
- }
-
- return builder;
- }
-
- /// Append tokens of the given [parameters] to the [signature].
- static void _appendFormalParametersTokens(
- ApiSignature signature, FormalParameterList? parameters) {
- if (parameters == null) return;
-
- for (var parameter in parameters.parameters) {
- if (parameter.isRequiredPositional) {
- signature.addInt(1);
- } else if (parameter.isRequiredNamed) {
- signature.addInt(4);
- } else if (parameter.isOptionalPositional) {
- signature.addInt(2);
- } else if (parameter.isOptionalNamed) {
- signature.addInt(3);
- }
-
- // If a simple not named parameter, we don't need its name.
- // We should be careful to include also annotations.
- if (parameter is SimpleFormalParameter) {
- var type = parameter.type;
- if (type != null) {
- _appendTokens(signature, parameter.beginToken, type.endToken);
- continue;
- }
- }
-
- // We don't know anything better than adding the whole parameter.
- _appendNodeTokens(signature, parameter);
- }
- }
-
- static void _appendMetadataTokens(
- ApiSignature signature, List<Annotation> metadata) {
- for (var annotation in metadata) {
- _appendNodeTokens(signature, annotation);
- }
- }
-
- /// Append tokens of the given [node] to the [signature].
- static void _appendNodeTokens(ApiSignature signature, AstNode? node) {
- if (node != null) {
- _appendTokens(signature, node.beginToken, node.endToken);
- }
- }
-
- /// Append tokens from [begin] to [end] (both including) to the [signature].
- static void _appendTokens(ApiSignature signature, Token begin, Token end) {
- if (begin is CommentToken) {
- begin = begin.parent!;
- }
-
- Token? token = begin;
- while (token != null) {
- signature.addString(token.lexeme);
-
- if (token == end) {
- break;
- }
-
- var nextToken = token.next;
- if (nextToken == token) {
- break;
- }
-
- token = nextToken;
- }
- }
-
- /// Return [Combinator]s for the given import or export [directive].
- static List<Combinator> _getCombinators(NamespaceDirective directive) {
- var combinators = <Combinator>[];
- for (var combinator in directive.combinators) {
- if (combinator is ShowCombinator) {
- combinators.add(
- Combinator(
- true,
- combinator.shownNames.map((id) => id.name).toList(),
- ),
- );
- }
- if (combinator is HideCombinator) {
- combinators.add(
- Combinator(
- false,
- combinator.hiddenNames.map((id) => id.name).toList(),
- ),
- );
- }
- }
- return combinators;
- }
-}
diff --git a/pkg/analyzer/lib/src/dart/analysis/dependency/node.dart b/pkg/analyzer/lib/src/dart/analysis/dependency/node.dart
deleted file mode 100644
index 1243762..0000000
--- a/pkg/analyzer/lib/src/dart/analysis/dependency/node.dart
+++ /dev/null
@@ -1,245 +0,0 @@
-// Copyright (c) 2018, 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:typed_data';
-
-import 'package:convert/convert.dart';
-
-/// The reference to a class member.
-class ClassMemberReference {
- /// The target class name.
- ///
- /// This is different from the class that actually turned out to define
- /// the referenced member at the time of recording this reference. So, we
- /// will notice added overrides in the target class, or anywhere in between.
- final LibraryQualifiedName target;
-
- /// The name referenced in the [target].
- final String name;
-
- @override
- final int hashCode;
-
- ClassMemberReference(this.target, this.name)
- : hashCode = Object.hash(target, name);
-
- @override
- bool operator ==(Object other) {
- return other is ClassMemberReference &&
- other.target == target &&
- other.name == name;
- }
-
- @override
- String toString() {
- return '($target, $name)';
- }
-
- static int compare(ClassMemberReference first, ClassMemberReference second) {
- var result = LibraryQualifiedName.compare(first.target, second.target);
- if (result != 0) return result;
-
- return first.name.compareTo(second.name);
- }
-}
-
-/// The dependencies of the API or implementation portion of a node.
-class Dependencies {
- static final none = Dependencies(Uint8List(0), [], [], [], [], []);
-
- /// The token signature of this portion of the node. It depends on all
- /// tokens that might affect the node API or implementation resolution.
- final Uint8List tokenSignature;
-
- /// The names that appear unprefixed in this portion of the node, and are
- /// not defined locally in the node. Locally defined names themselves
- /// depend on some non-local nodes, which will also recorded here.
- ///
- /// This list is sorted.
- final List<String> unprefixedReferencedNames;
-
- /// The names of import prefixes used to reference names in this node.
- ///
- /// This list is sorted.
- final List<String> importPrefixes;
-
- /// The names referenced by this node with the import prefix at the
- /// corresponding index in [importPrefixes].
- ///
- /// This list is sorted.
- final List<List<String>> importPrefixedReferencedNames;
-
- /// The names that appear prefixed with `super` in this portion of the node.
- ///
- /// This list is sorted.
- final List<String> superReferencedNames;
-
- /// The class members referenced in this portion of the node.
- ///
- /// This list is sorted.
- final List<ClassMemberReference> classMemberReferences;
-
- /// All referenced nodes, computed from [unprefixedReferencedNames],
- /// [importPrefixedReferencedNames], and [classMemberReferences].
- List<Node>? referencedNodes;
-
- /// The transitive signature of this portion of the node, computed using
- /// the [tokenSignature] of this node, and API signatures of the
- /// [referencedNodes].
- Uint8List? transitiveSignature;
-
- Dependencies(
- this.tokenSignature,
- this.unprefixedReferencedNames,
- this.importPrefixes,
- this.importPrefixedReferencedNames,
- this.superReferencedNames,
- this.classMemberReferences);
-
- String get tokenSignatureHex => hex.encode(tokenSignature);
-}
-
-/// A name qualified by a library URI.
-class LibraryQualifiedName {
- /// The URI of the defining library.
- /// Not `null`.
- final Uri libraryUri;
-
- /// The name of this name object.
- /// If the name starts with `_`, then the name is private.
- /// Names of setters end with `=`.
- final String name;
-
- /// Whether this name is private, and its [name] starts with `_`.
- final bool isPrivate;
-
- /// The cached, pre-computed hash code.
- @override
- final int hashCode;
-
- factory LibraryQualifiedName(Uri libraryUri, String name) {
- var isPrivate = name.startsWith('_');
- var hashCode = Object.hash(libraryUri, name);
- return LibraryQualifiedName._internal(
- libraryUri, name, isPrivate, hashCode);
- }
-
- LibraryQualifiedName._internal(
- this.libraryUri, this.name, this.isPrivate, this.hashCode);
-
- @override
- bool operator ==(Object other) {
- return other is LibraryQualifiedName &&
- other.hashCode == hashCode &&
- name == other.name &&
- libraryUri == other.libraryUri;
- }
-
- /// Whether this name us accessible for the library with the given
- /// [libraryUri], i.e. when the name is public, or is defined in a library
- /// with the same URI.
- bool isAccessibleFor(Uri libraryUri) {
- return !isPrivate || this.libraryUri == libraryUri;
- }
-
- @override
- String toString() => '$libraryUri::$name';
-
- /// Compare given names by their raw names.
- ///
- /// This method should be used only for sorting, it does not follow the
- /// complete semantics of [==] and [hashCode].
- static int compare(LibraryQualifiedName first, LibraryQualifiedName second) {
- return first.name.compareTo(second.name);
- }
-}
-
-/// A dependency node - anything that has a name, and can be referenced.
-class Node {
- /// The API or implementation signature used in [Dependencies]
- /// as a marker that this node is changed, explicitly because its token
- /// signature changed, or implicitly - because it references a changed node.
- static final changedSignature = Uint8List.fromList([0xDE, 0xAD, 0xBE, 0xEF]);
-
- final LibraryQualifiedName name;
- final NodeKind kind;
-
- /// Dependencies that affect the API of the node, so affect API or
- /// implementation dependencies of the nodes that use this node.
- final Dependencies api;
-
- /// Additional (to the [api]) dependencies that affect only the
- /// "implementation" of the node, e.g. the body of a method, but are not
- /// visible outside of the node, and so don't affect any other nodes.
- final Dependencies impl;
-
- /// If the node is a class member, the node of the enclosing class.
- /// Otherwise `null`.
- final Node? enclosingClass;
-
- /// If the node is a class, the nodes of its type parameters.
- /// Otherwise `null`.
- List<Node>? classTypeParameters;
-
- /// If the node is a class, the sorted list of members in this class.
- /// Otherwise `null`.
- List<Node>? classMembers;
-
- Node(this.name, this.kind, this.api, this.impl,
- {this.enclosingClass, this.classTypeParameters});
-
- /// Return the node that can be referenced by the given [name] from the
- /// library with the given [libraryUri].
- Node? getClassMember(Uri libraryUri, String name) {
- // TODO(scheglov) The list is sorted, use this fact to search faster.
- // TODO(scheglov) Collect superclass members here or outside.
- for (var i = 0; i < classMembers!.length; ++i) {
- var member = classMembers![i];
- var memberName = member.name;
- if (memberName.name == name && memberName.isAccessibleFor(libraryUri)) {
- return member;
- }
- }
- return null;
- }
-
- /// Set new class members for this class.
- void setClassMembers(List<Node> newClassMembers) {
- classMembers = newClassMembers;
- }
-
- /// Set new class type parameters for this class.
- void setTypeParameters(List<Node> newTypeParameters) {
- classTypeParameters = newTypeParameters;
- }
-
- @override
- String toString() {
- if (enclosingClass != null) {
- return '$enclosingClass::${name.name}';
- }
- return name.toString();
- }
-
- /// Compare given nodes by their names.
- static int compare(Node first, Node second) {
- return LibraryQualifiedName.compare(first.name, second.name);
- }
-}
-
-/// Kinds of nodes.
-enum NodeKind {
- CLASS,
- CLASS_TYPE_ALIAS,
- CONSTRUCTOR,
- ENUM,
- FUNCTION,
- FUNCTION_TYPE_ALIAS,
- GENERIC_TYPE_ALIAS,
- GETTER,
- METHOD,
- MIXIN,
- SETTER,
- TYPE_PARAMETER,
-}
diff --git a/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart b/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
deleted file mode 100644
index 706248e..0000000
--- a/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
+++ /dev/null
@@ -1,957 +0,0 @@
-// Copyright (c) 2018, 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:typed_data';
-
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/src/dart/analysis/dependency/node.dart';
-
-/// Collector of information about external nodes referenced by a node.
-///
-/// The workflow for using it is that the library builder creates a new
-/// instance, fills it with names of import prefixes using [addImportPrefix].
-/// Then for each node defined in the library, [collect] is called with
-/// corresponding AST nodes to record references to external names, and
-/// construct the API or implementation [Dependencies].
-class ReferenceCollector {
- /// Local scope inside the node, containing local names such as parameters,
- /// local variables, local functions, local type parameters, etc.
- final _LocalScopes _localScopes = _LocalScopes();
-
- /// The list of names that are referenced without any prefix, neither an
- /// import prefix, nor a target expression.
- _NameSet _unprefixedReferences = _NameSet();
-
- /// The list of names that are referenced using an import prefix.
- ///
- /// It is filled by [addImportPrefix] and shared across all nodes.
- final List<_ReferencedImportPrefixedNames> _importPrefixedReferences = [];
-
- /// The list of names that are referenced with `super`.
- _NameSet _superReferences = _NameSet();
-
- /// The set of referenced class members.
- _ClassMemberReferenceSet _memberReferences = _ClassMemberReferenceSet();
-
- /// Record that the [name] is a name of an import prefix.
- ///
- /// So, when we see code like `prefix.foo` we know that `foo` should be
- /// resolved in the import scope that corresponds to `prefix` (unless the
- /// name `prefix` is shadowed by a local declaration).
- void addImportPrefix(String name) {
- assert(_localScopes.isEmpty);
- for (var import in _importPrefixedReferences) {
- if (import.prefix == name) {
- return;
- }
- }
- _importPrefixedReferences.add(_ReferencedImportPrefixedNames(name));
- }
-
- /// Construct and return a new [Dependencies] with the given [tokenSignature]
- /// and all recorded references to external nodes in the given AST nodes.
- Dependencies collect(Uint8List tokenSignature,
- {String? enclosingClassName,
- String? thisNodeName,
- List<ConstructorInitializer>? constructorInitializers,
- NamedType? enclosingSuperClass,
- Expression? expression,
- ExtendsClause? extendsClause,
- FormalParameterList? formalParameters,
- FormalParameterList? formalParametersForImpl,
- FunctionBody? functionBody,
- ImplementsClause? implementsClause,
- OnClause? onClause,
- ConstructorName? redirectedConstructor,
- TypeAnnotation? returnType,
- NamedType? superClass,
- TypeAnnotation? type,
- TypeParameterList? typeParameters,
- TypeParameterList? typeParameters2,
- WithClause? withClause}) {
- _localScopes.enter();
-
- // The name of the node shadows any external names.
- if (enclosingClassName != null) {
- _localScopes.add(enclosingClassName);
- }
- if (thisNodeName != null) {
- _localScopes.add(thisNodeName);
- }
-
- // Add type parameters first, they might be referenced later.
- _visitTypeParameterList(typeParameters);
- _visitTypeParameterList(typeParameters2);
-
- // Parts of classes.
- _visitTypeAnnotation(extendsClause?.superclass);
- _visitTypeAnnotation(superClass);
- _visitTypeAnnotations(withClause?.mixinTypes);
- _visitTypeAnnotations(onClause?.superclassConstraints);
- _visitTypeAnnotations(implementsClause?.interfaces);
-
- // Parts of executables.
- _visitFormalParameterList(formalParameters);
- _visitFormalParameterListImpl(formalParametersForImpl);
- _visitTypeAnnotation(returnType);
- _visitFunctionBody(functionBody);
-
- // Parts of constructors.
- _visitConstructorInitializers(enclosingSuperClass, constructorInitializers);
- _visitConstructorName(redirectedConstructor);
-
- // Parts of variables.
- _visitTypeAnnotation(type);
- _visitExpression(expression);
-
- _localScopes.exit();
-
- var unprefixedReferencedNames = _unprefixedReferences.toList();
- _unprefixedReferences = _NameSet();
-
- var importPrefixes = <String>[];
- var importPrefixedReferencedNames = <List<String>>[];
- for (var i = 0; i < _importPrefixedReferences.length; i++) {
- var import = _importPrefixedReferences[i];
-
- if (import.names.isNotEmpty) {
- importPrefixes.add(import.prefix);
- importPrefixedReferencedNames.add(import.names.toList());
- }
-
- import.clear();
- }
-
- var superReferencedNames = _superReferences.toList();
- _superReferences = _NameSet();
-
- var classMemberReferences = _memberReferences.toList();
- _memberReferences = _ClassMemberReferenceSet();
-
- return Dependencies(
- tokenSignature,
- unprefixedReferencedNames,
- importPrefixes,
- importPrefixedReferencedNames,
- superReferencedNames,
- classMemberReferences,
- );
- }
-
- /// Return the collector for the import prefix with the given [name].
- _ReferencedImportPrefixedNames _importPrefix(String name) {
- assert(!_localScopes.contains(name));
- for (var i = 0; i < _importPrefixedReferences.length; i++) {
- var references = _importPrefixedReferences[i];
- if (references.prefix == name) {
- return references;
- }
- }
- throw StateError('Expected prefix: $name');
- }
-
- void _recordClassMemberReference(
- {Expression? target, DartType? targetType, required String name}) {
- if (target is Identifier) {
- var element = target.staticElement;
- if (element is ClassElement) {
- _memberReferences.add(element, name);
- return;
- }
- }
- targetType ??= target!.staticType;
-
- if (targetType is InterfaceType) {
- _memberReferences.add(targetType.element, name);
- }
- }
-
- /// Record a new unprefixed name reference.
- void _recordUnprefixedReference(String name) {
- assert(!_localScopes.contains(name));
- _unprefixedReferences.add(name);
- }
-
- void _visitAdjacentStrings(AdjacentStrings node) {
- var strings = node.strings;
- for (var i = 0; i < strings.length; i++) {
- var string = strings[i];
- _visitExpression(string);
- }
- }
-
- void _visitArgumentList(ArgumentList? node) {
- if (node == null) return;
-
- var arguments = node.arguments;
- for (var i = 0; i < arguments.length; i++) {
- var argument = arguments[i];
- _visitExpression(argument);
- }
- }
-
- void _visitAssignmentExpression(AssignmentExpression node) {
- var assignmentType = node.operator.type;
-
- _visitExpression(node.leftHandSide,
- get: assignmentType != TokenType.EQ, set: true);
- _visitExpression(node.rightHandSide);
-
- if (assignmentType != TokenType.EQ &&
- assignmentType != TokenType.QUESTION_QUESTION_EQ) {
- var operatorType = assignmentType.binaryOperatorOfCompoundAssignment;
- if (operatorType != null) {
- _recordClassMemberReference(
- targetType: node.readType,
- name: operatorType.lexeme,
- );
- }
- }
- }
-
- void _visitBinaryExpression(BinaryExpression node) {
- var operatorName = node.operator.lexeme;
- var leftOperand = node.leftOperand;
- if (leftOperand is SuperExpression) {
- _superReferences.add(operatorName);
- } else {
- _visitExpression(leftOperand);
- _recordClassMemberReference(
- targetType: leftOperand.staticType,
- name: operatorName,
- );
- }
- _visitExpression(node.rightOperand);
- }
-
- void _visitBlock(Block? node) {
- if (node == null) return;
-
- _visitStatements(node.statements);
- }
-
- void _visitCascadeExpression(CascadeExpression node) {
- _visitExpression(node.target);
- var sections = node.cascadeSections;
- for (var i = 0; i < sections.length; i++) {
- var section = sections[i];
- _visitExpression(section);
- }
- }
-
- void _visitCollectionElement(CollectionElement? node) {
- if (node == null) {
- return;
- } else if (node is Expression) {
- _visitExpression(node);
- } else if (node is ForElement) {
- _visitForLoopParts(node.forLoopParts);
- _visitCollectionElement(node.body);
- } else if (node is IfElement) {
- _visitExpression(node.condition);
- _visitCollectionElement(node.thenElement);
- _visitCollectionElement(node.elseElement);
- } else if (node is MapLiteralEntry) {
- _visitExpression(node.key);
- _visitExpression(node.value);
- } else if (node is SpreadElement) {
- _visitExpression(node.expression);
- } else {
- throw UnimplementedError('(${node.runtimeType}) $node');
- }
- }
-
- /// Record reference to the constructor of the [type] with the given [name].
- void _visitConstructor(NamedType type, SimpleIdentifier? name) {
- _visitTypeAnnotation(type);
-
- if (name != null) {
- _recordClassMemberReference(targetType: type.type, name: name.name);
- } else {
- _recordClassMemberReference(targetType: type.type, name: '');
- }
- }
-
- void _visitConstructorInitializers(
- NamedType? superClass, List<ConstructorInitializer>? initializers) {
- if (initializers == null) return;
-
- for (var i = 0; i < initializers.length; i++) {
- var initializer = initializers[i];
- if (initializer is AssertInitializer) {
- _visitExpression(initializer.condition);
- _visitExpression(initializer.message);
- } else if (initializer is ConstructorFieldInitializer) {
- _visitExpression(initializer.expression);
- } else if (initializer is SuperConstructorInvocation) {
- _visitConstructor(superClass!, initializer.constructorName);
- _visitArgumentList(initializer.argumentList);
- } else if (initializer is RedirectingConstructorInvocation) {
- _visitArgumentList(initializer.argumentList);
- // Strongly speaking, we reference a field of the enclosing class.
- //
- // However the current plan is to resolve the whole library on a change.
- // So, we will resolve the enclosing constructor anyway.
- } else {
- throw UnimplementedError('(${initializer.runtimeType}) $initializer');
- }
- }
- }
-
- void _visitConstructorName(ConstructorName? node) {
- if (node == null) return;
-
- _visitConstructor(node.type, node.name);
- }
-
- void _visitExpression(Expression? node, {bool get = true, bool set = false}) {
- if (node == null) return;
-
- if (node is AdjacentStrings) {
- _visitAdjacentStrings(node);
- } else if (node is AsExpression) {
- _visitExpression(node.expression);
- _visitTypeAnnotation(node.type);
- } else if (node is AssignmentExpression) {
- _visitAssignmentExpression(node);
- } else if (node is AwaitExpression) {
- _visitExpression(node.expression);
- } else if (node is BinaryExpression) {
- _visitBinaryExpression(node);
- } else if (node is BooleanLiteral) {
- // no dependencies
- } else if (node is CascadeExpression) {
- _visitCascadeExpression(node);
- } else if (node is ConditionalExpression) {
- _visitExpression(node.condition);
- _visitExpression(node.thenExpression);
- _visitExpression(node.elseExpression);
- } else if (node is DoubleLiteral) {
- // no dependencies
- } else if (node is FunctionExpression) {
- _visitFunctionExpression(node);
- } else if (node is FunctionExpressionInvocation) {
- _visitExpression(node.function);
- _visitTypeArguments(node.typeArguments);
- _visitArgumentList(node.argumentList);
- } else if (node is IndexExpression) {
- _visitIndexExpression(node, get: get, set: set);
- } else if (node is InstanceCreationExpression) {
- _visitInstanceCreationExpression(node);
- } else if (node is IntegerLiteral) {
- // no dependencies
- } else if (node is IsExpression) {
- _visitExpression(node.expression);
- _visitTypeAnnotation(node.type);
- } else if (node is ListLiteral) {
- _visitListLiteral(node);
- } else if (node is MethodInvocation) {
- _visitMethodInvocation(node);
- } else if (node is NamedExpression) {
- _visitExpression(node.expression);
- } else if (node is NullLiteral) {
- // no dependencies
- } else if (node is ParenthesizedExpression) {
- _visitExpression(node.expression);
- } else if (node is PostfixExpression) {
- _visitPostfixExpression(node);
- } else if (node is PrefixExpression) {
- _visitPrefixExpression(node);
- } else if (node is PrefixedIdentifier) {
- _visitPrefixedIdentifier(node);
- } else if (node is PropertyAccess) {
- _visitPropertyAccess(node, get: get, set: set);
- } else if (node is RethrowExpression) {
- // no dependencies
- } else if (node is SetOrMapLiteral) {
- _visitSetOrMapLiteral(node);
- } else if (node is SimpleIdentifier) {
- _visitSimpleIdentifier(node, get: get, set: set);
- } else if (node is SimpleStringLiteral) {
- // no dependencies
- } else if (node is StringInterpolation) {
- _visitStringInterpolation(node);
- } else if (node is SymbolLiteral) {
- // no dependencies
- } else if (node is ThisExpression) {
- // Strongly speaking, "this" should add dependencies.
- // Just like any class reference, it depends on the class hierarchy.
- // For example adding a new type to the `implements` clause might make
- // it OK to pass `this` as an argument of an invocation.
- //
- // However the current plan is to resolve the whole library on a change.
- // So, we will resolve all implementations that reference `this`.
- } else if (node is ThrowExpression) {
- _visitExpression(node.expression);
- } else {
- throw UnimplementedError('(${node.runtimeType}) $node');
- }
- }
-
- void _visitExpressionList(NodeList<Expression> nodes) {
- for (Expression node in nodes) {
- _visitExpression(node);
- }
- }
-
- void _visitForLoopParts(ForLoopParts? node) {
- if (node == null) {
- return;
- } else if (node is ForPartsWithDeclarations) {
- _visitVariableList(node.variables);
- _visitExpression(node.condition);
- _visitExpressionList(node.updaters);
- } else if (node is ForPartsWithExpression) {
- _visitExpression(node.initialization);
- _visitExpression(node.condition);
- _visitExpressionList(node.updaters);
- } else if (node is ForEachPartsWithDeclaration) {
- var variable = node.loopVariable;
- _visitTypeAnnotation(variable.type);
- _visitExpression(node.iterable);
- _localScopes.add(variable.identifier.name);
- } else if (node is ForEachPartsWithIdentifier) {
- _visitExpression(node.identifier);
- _visitExpression(node.iterable);
- } else {
- throw UnimplementedError('(${node.runtimeType}) $node');
- }
- }
-
- void _visitFormalParameterList(FormalParameterList? node) {
- if (node == null) return;
-
- var parameters = node.parameters;
- for (var i = 0; i < parameters.length; i++) {
- FormalParameter parameter = parameters[i];
- if (parameter is DefaultFormalParameter) {
- DefaultFormalParameter defaultParameter = parameter;
- parameter = defaultParameter.parameter;
- }
-
- var identifier = parameter.identifier;
- if (identifier != null) {
- _localScopes.add(identifier.name);
- }
-
- if (parameter is FieldFormalParameter) {
- _visitTypeAnnotation(parameter.type);
- // Strongly speaking, we reference a field of the enclosing class.
- //
- // However the current plan is to resolve the whole library on a change.
- // So, we will resolve the enclosing constructor anyway.
- } else if (parameter is FunctionTypedFormalParameter) {
- _visitTypeAnnotation(parameter.returnType);
- _visitFormalParameterList(parameter.parameters);
- } else if (parameter is SimpleFormalParameter) {
- _visitTypeAnnotation(parameter.type);
- } else {
- throw StateError('Unexpected: (${parameter.runtimeType}) $parameter');
- }
- }
- }
-
- void _visitFormalParameterListImpl(FormalParameterList? node) {
- if (node == null) return;
-
- var parameters = node.parameters;
- for (var i = 0; i < parameters.length; i++) {
- FormalParameter parameter = parameters[i];
-
- if (parameter is DefaultFormalParameter) {
- DefaultFormalParameter defaultParameter = parameter;
- _visitExpression(defaultParameter.defaultValue);
- parameter = defaultParameter.parameter;
- }
-
- var identifier = parameter.identifier;
- if (identifier != null) {
- _localScopes.add(identifier.name);
- }
- }
- }
-
- void _visitForStatement(ForStatement node) {
- _localScopes.enter();
-
- _visitForLoopParts(node.forLoopParts);
- _visitStatement(node.body);
-
- _localScopes.exit();
- }
-
- void _visitFunctionBody(FunctionBody? node) {
- if (node == null) return;
-
- if (node is BlockFunctionBody) {
- _visitStatement(node.block);
- } else if (node is EmptyFunctionBody) {
- return;
- } else if (node is ExpressionFunctionBody) {
- _visitExpression(node.expression);
- } else {
- throw UnimplementedError('(${node.runtimeType}) $node');
- }
- }
-
- void _visitFunctionDeclarationStatement(FunctionDeclarationStatement node) {
- var function = node.functionDeclaration;
- _visitTypeAnnotation(function.returnType);
- _visitFunctionExpression(function.functionExpression);
- }
-
- void _visitFunctionExpression(FunctionExpression node) {
- _localScopes.enter();
- _visitTypeParameterList(node.typeParameters);
- _visitFormalParameterList(node.parameters);
- _visitFormalParameterListImpl(node.parameters);
- _visitFunctionBody(node.body);
- _localScopes.exit();
- }
-
- void _visitIndexExpression(IndexExpression node,
- {required bool get, required bool set}) {
- var target = node.target;
- if (target == null) {
- // no dependencies
- } else if (target is SuperExpression) {
- if (get) {
- _superReferences.add('[]');
- }
- if (set) {
- _superReferences.add('[]=');
- }
- } else {
- _visitExpression(target);
- var targetType = target.staticType;
- if (get) {
- _recordClassMemberReference(targetType: targetType, name: '[]');
- }
- if (set) {
- _recordClassMemberReference(targetType: targetType, name: '[]=');
- }
- }
-
- _visitExpression(node.index);
- }
-
- void _visitInstanceCreationExpression(InstanceCreationExpression node) {
- _visitConstructorName(node.constructorName);
- _visitArgumentList(node.argumentList);
- }
-
- void _visitListLiteral(ListLiteral node) {
- _visitTypeArguments(node.typeArguments);
- var elements = node.elements;
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- _visitCollectionElement(element);
- }
- }
-
- void _visitMethodInvocation(MethodInvocation node) {
- var realTarget = node.realTarget;
- if (realTarget == null) {
- _visitExpression(node.methodName);
- } else if (realTarget is SuperExpression) {
- _superReferences.add(node.methodName.name);
- } else {
- _visitExpression(node.target);
- _recordClassMemberReference(
- target: realTarget, name: node.methodName.name);
- }
- _visitTypeArguments(node.typeArguments);
- _visitArgumentList(node.argumentList);
- }
-
- void _visitPostfixExpression(PostfixExpression node) {
- _visitExpression(node.operand);
-
- var operator = node.operator.type;
- if (operator == TokenType.MINUS_MINUS) {
- _recordClassMemberReference(
- targetType: node.readType,
- name: '-',
- );
- } else if (operator == TokenType.PLUS_PLUS) {
- _recordClassMemberReference(
- targetType: node.readType,
- name: '+',
- );
- } else {
- throw UnimplementedError('$operator');
- }
- }
-
- void _visitPrefixedIdentifier(PrefixedIdentifier node) {
- var prefix = node.prefix;
- var prefixElement = prefix.staticElement;
- if (prefixElement is PrefixElement) {
- var prefixName = prefix.name;
- var importPrefix = _importPrefix(prefixName);
- importPrefix.add(node.identifier.name);
- } else {
- _visitExpression(prefix);
- _recordClassMemberReference(target: prefix, name: node.identifier.name);
- }
- }
-
- void _visitPrefixExpression(PrefixExpression node) {
- _visitExpression(node.operand);
-
- var operatorName = node.operator.lexeme;
- if (operatorName == '-') operatorName = 'unary-';
-
- _recordClassMemberReference(
- targetType: node.operand.staticType,
- name: operatorName,
- );
- }
-
- void _visitPropertyAccess(PropertyAccess node,
- {required bool get, required bool set}) {
- var realTarget = node.realTarget;
- var name = node.propertyName.name;
-
- if (realTarget is SuperExpression) {
- if (get) {
- _superReferences.add(name);
- }
- if (set) {
- _superReferences.add('$name=');
- }
- } else {
- _visitExpression(node.target);
- if (get) {
- _recordClassMemberReference(target: realTarget, name: name);
- }
- if (set) {
- _recordClassMemberReference(target: realTarget, name: '$name=');
- }
- }
- }
-
- void _visitSetOrMapLiteral(SetOrMapLiteral node) {
- _visitTypeArguments(node.typeArguments);
- var elements = node.elements;
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- _visitCollectionElement(element);
- }
- }
-
- void _visitSimpleIdentifier(SimpleIdentifier node,
- {required bool get, required bool set}) {
- if (node.isSynthetic) return;
-
- var name = node.name;
- if (_localScopes.contains(name) ||
- name == 'void' ||
- name == 'dynamic' ||
- name == 'Never') {
- return;
- }
-
- if (get) {
- _recordUnprefixedReference(name);
- }
- if (set) {
- _recordUnprefixedReference('$name=');
- }
- }
-
- void _visitStatement(Statement? node) {
- if (node == null) return;
-
- if (node is AssertStatement) {
- _visitExpression(node.condition);
- _visitExpression(node.message);
- } else if (node is Block) {
- _visitBlock(node);
- } else if (node is BreakStatement) {
- // nothing
- } else if (node is ContinueStatement) {
- // nothing
- } else if (node is DoStatement) {
- _visitStatement(node.body);
- _visitExpression(node.condition);
- } else if (node is EmptyStatement) {
- // nothing
- } else if (node is ExpressionStatement) {
- _visitExpression(node.expression);
- } else if (node is ForStatement) {
- _visitForStatement(node);
- } else if (node is FunctionDeclarationStatement) {
- _visitFunctionDeclarationStatement(node);
- } else if (node is IfStatement) {
- _visitExpression(node.condition);
- _visitStatement(node.thenStatement);
- _visitStatement(node.elseStatement);
- } else if (node is LabeledStatement) {
- _visitStatement(node.statement);
- } else if (node is ReturnStatement) {
- _visitExpression(node.expression);
- } else if (node is SwitchStatement) {
- _visitSwitchStatement(node);
- } else if (node is TryStatement) {
- _visitTryStatement(node);
- } else if (node is VariableDeclarationStatement) {
- _visitVariableList(node.variables);
- } else if (node is WhileStatement) {
- _visitExpression(node.condition);
- _visitStatement(node.body);
- } else if (node is YieldStatement) {
- _visitExpression(node.expression);
- } else {
- throw UnimplementedError('(${node.runtimeType}) $node');
- }
- }
-
- void _visitStatements(List<Statement> statements) {
- _localScopes.enter();
-
- for (var i = 0; i < statements.length; i++) {
- var statement = statements[i];
- if (statement is FunctionDeclarationStatement) {
- _localScopes.add(statement.functionDeclaration.name.name);
- } else if (statement is VariableDeclarationStatement) {
- var variables = statement.variables.variables;
- for (int i = 0; i < variables.length; i++) {
- _localScopes.add(variables[i].name.name);
- }
- }
- }
-
- for (var i = 0; i < statements.length; i++) {
- var statement = statements[i];
- _visitStatement(statement);
- }
-
- _localScopes.exit();
- }
-
- void _visitStringInterpolation(StringInterpolation node) {
- var elements = node.elements;
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- if (element is InterpolationExpression) {
- _visitExpression(element.expression);
- }
- }
- }
-
- void _visitSwitchStatement(SwitchStatement node) {
- _visitExpression(node.expression);
- var members = node.members;
- for (var i = 0; i < members.length; i++) {
- var member = members[i];
- if (member is SwitchCase) {
- _visitExpression(member.expression);
- }
- _visitStatements(member.statements);
- }
- }
-
- void _visitTryStatement(TryStatement node) {
- _visitBlock(node.body);
-
- var catchClauses = node.catchClauses;
- for (var i = 0; i < catchClauses.length; i++) {
- var catchClause = catchClauses[i];
- _visitTypeAnnotation(catchClause.exceptionType);
-
- _localScopes.enter();
-
- var exceptionParameter = catchClause.exceptionParameter;
- if (exceptionParameter != null) {
- _localScopes.add(exceptionParameter.name);
- }
-
- var stackTraceParameter = catchClause.stackTraceParameter;
- if (stackTraceParameter != null) {
- _localScopes.add(stackTraceParameter.name);
- }
-
- _visitBlock(catchClause.body);
-
- _localScopes.exit();
- }
-
- _visitBlock(node.finallyBlock);
- }
-
- void _visitTypeAnnotation(TypeAnnotation? node) {
- if (node == null) return;
-
- if (node is GenericFunctionType) {
- _localScopes.enter();
-
- var typeParameterList = node.typeParameters;
- if (typeParameterList != null) {
- var typeParameters = typeParameterList.typeParameters;
- for (var i = 0; i < typeParameters.length; i++) {
- var typeParameter = typeParameters[i];
- _localScopes.add(typeParameter.name.name);
- }
- for (var i = 0; i < typeParameters.length; i++) {
- var typeParameter = typeParameters[i];
- _visitTypeAnnotation(typeParameter.bound);
- }
- }
-
- _visitTypeAnnotation(node.returnType);
- _visitFormalParameterList(node.parameters);
-
- _localScopes.exit();
- } else if (node is NamedType) {
- var identifier = node.name;
- _visitExpression(identifier);
- _visitTypeArguments(node.typeArguments);
- } else {
- throw UnimplementedError('(${node.runtimeType}) $node');
- }
- }
-
- void _visitTypeAnnotations(List<TypeAnnotation>? typeAnnotations) {
- if (typeAnnotations == null) return;
-
- for (var i = 0; i < typeAnnotations.length; i++) {
- var typeAnnotation = typeAnnotations[i];
- _visitTypeAnnotation(typeAnnotation);
- }
- }
-
- void _visitTypeArguments(TypeArgumentList? node) {
- if (node == null) return;
-
- _visitTypeAnnotations(node.arguments);
- }
-
- void _visitTypeParameterList(TypeParameterList? node) {
- if (node == null) return;
-
- var typeParameters = node.typeParameters;
-
- // Define all type parameters in the local scope.
- for (var i = 0; i < typeParameters.length; i++) {
- var typeParameter = typeParameters[i];
- _localScopes.add(typeParameter.name.name);
- }
-
- // Record bounds.
- for (var i = 0; i < typeParameters.length; i++) {
- var typeParameter = typeParameters[i];
- _visitTypeAnnotation(typeParameter.bound);
- }
- }
-
- void _visitVariableList(VariableDeclarationList? node) {
- if (node == null) return;
-
- _visitTypeAnnotation(node.type);
-
- var variables = node.variables;
- for (int i = 0; i < variables.length; i++) {
- var variable = variables[i];
- _localScopes.add(variable.name.name);
- _visitExpression(variable.initializer);
- }
- }
-}
-
-/// The sorted set of [ClassMemberReference]s.
-class _ClassMemberReferenceSet {
- final List<ClassMemberReference> references = [];
-
- void add(ClassElement class_, String name) {
- var target = LibraryQualifiedName(class_.library.source.uri, class_.name);
- var reference = ClassMemberReference(target, name);
- if (!references.contains(reference)) {
- references.add(reference);
- }
- }
-
- /// Return the sorted list of unique class member references.
- List<ClassMemberReference> toList() {
- references.sort(ClassMemberReference.compare);
- return references;
- }
-}
-
-/// The stack of names that are defined in a local scope inside the node,
-/// such as parameters, local variables, local functions, local type
-/// parameters, etc.
-class _LocalScopes {
- /// The stack of name sets.
- final List<_NameSet> scopes = [];
-
- bool get isEmpty => scopes.isEmpty;
-
- /// Add the given [name] to the current local scope.
- void add(String name) {
- scopes.last.add(name);
- }
-
- /// Return whether the given [name] is defined in one of the local scopes.
- bool contains(String name) {
- for (var i = 0; i < scopes.length; i++) {
- if (scopes[i].contains(name)) {
- return true;
- }
- }
- return false;
- }
-
- /// Enter a new local scope, e.g. a block, or a type parameter scope.
- void enter() {
- scopes.add(_NameSet());
- }
-
- /// Exit the current local scope.
- void exit() {
- scopes.removeLast();
- }
-}
-
-class _NameSet {
- final List<String> names = [];
-
- bool get isNotEmpty => names.isNotEmpty;
-
- void add(String name) {
- // TODO(scheglov) consider just adding, but toList() sort and unique
- if (!contains(name)) {
- names.add(name);
- }
- }
-
- bool contains(String name) => names.contains(name);
-
- List<String> toList() {
- names.sort(_compareStrings);
- return names;
- }
-
- static int _compareStrings(String first, String second) {
- return first.compareTo(second);
- }
-}
-
-class _ReferencedImportPrefixedNames {
- final String prefix;
- _NameSet names = _NameSet();
-
- _ReferencedImportPrefixedNames(this.prefix);
-
- void add(String name) {
- names.add(name);
- }
-
- void clear() {
- names = _NameSet();
- }
-}
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 1160d53..a376df8 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -84,7 +84,7 @@
/// TODO(scheglov) Clean up the list of implicitly analyzed files.
class AnalysisDriver implements AnalysisDriverGeneric {
/// The version of data format, should be incremented on every format change.
- static const int DATA_VERSION = 220;
+ static const int DATA_VERSION = 221;
/// The number of exception contexts allowed to write. Once this field is
/// zero, we stop writing any new exception contexts in this process.
@@ -1045,14 +1045,7 @@
_fileTracker.fileWasAnalyzed(path);
try {
final result = await _computeAnalysisResult(path, withUnit: true);
- final SomeResolvedUnitResult unitResult;
- if (result != null) {
- unitResult = result.unitResult!;
- } else {
- unitResult = PartWithoutLibraryResultImpl(
- path: path,
- );
- }
+ final unitResult = result.unitResult!;
for (final completer in completers) {
completer.complete(unitResult);
}
@@ -1091,7 +1084,6 @@
var result = await _computeErrors(
path: path,
);
- result ??= PartWithoutLibraryResultImpl(path: path);
for (var completer in completers) {
completer.complete(result);
}
@@ -1112,8 +1104,7 @@
if (_unitElementRequestedFiles.isNotEmpty) {
String path = _unitElementRequestedFiles.keys.first;
var completers = _unitElementRequestedFiles.remove(path)!;
- SomeUnitElementResult? result = await _computeUnitElement(path);
- result ??= PartWithoutLibraryResultImpl(path: path);
+ final result = await _computeUnitElement(path);
for (var completer in completers) {
completer.complete(result);
}
@@ -1154,18 +1145,7 @@
if (_fileTracker.isFilePending(path)) {
try {
var result = await _computeAnalysisResult(path, withUnit: true);
- if (result == null) {
- // We report an invalid result (instead of silently ignoring
- // this disconnected part) so that the listener of the stream
- // knows, and for example removes all errors.
- _resultController.add(
- PartWithoutLibraryResultImpl(
- path: path,
- ),
- );
- } else {
- _resultController.add(result.unitResult!);
- }
+ _resultController.add(result.unitResult!);
} catch (exception, stackTrace) {
_reportException(path, exception, stackTrace);
_clearLibraryContextAfterException();
@@ -1183,13 +1163,7 @@
try {
var result = await _computeAnalysisResult(path,
withUnit: false, skipIfSameSignature: true);
- if (result == null) {
- _resultController.add(
- PartWithoutLibraryResultImpl(
- path: path,
- ),
- );
- } else if (result.isUnchangedErrors) {
+ if (result.isUnchangedErrors) {
// We found that the set of errors is the same as we produced the
// last time, so we don't need to produce it again now.
} else {
@@ -1302,27 +1276,22 @@
/// When `true`, [AnalysisResult.unitResult] will be set.
/// Otherwise [AnalysisResult.errorsResult] will be set.
///
- /// Return `null` if the file is a part of an unknown library, so cannot be
- /// analyzed yet. But [asIsIfPartWithoutLibrary] is `true`, then the file is
- /// analyzed anyway, even without a library.
- ///
/// Return [AnalysisResult._UNCHANGED] if [skipIfSameSignature] is `true` and
/// the resolved signature of the file in its library is the same as the one
/// that was the most recently produced to the client.
- Future<AnalysisResult?> _computeAnalysisResult(String path,
- {required bool withUnit,
- bool asIsIfPartWithoutLibrary = false,
- bool skipIfSameSignature = false}) async {
+ Future<AnalysisResult> _computeAnalysisResult(String path,
+ {required bool withUnit, bool skipIfSameSignature = false}) async {
FileState file = _fsState.getFileForPath(path);
// Prepare the library - the file itself, or the known library.
- FileState? library = file.isPart ? file.library : file;
- if (library == null) {
- if (asIsIfPartWithoutLibrary) {
- library = file;
- } else {
- return null;
- }
+ final FileState library;
+ final kind = file.kind;
+ if (kind is LibraryFileStateKind) {
+ library = kind.file;
+ } else if (kind is PartFileStateKind) {
+ library = kind.library ?? kind.asLibrary.file;
+ } else {
+ throw UnimplementedError('${kind.runtimeType}');
}
// Prepare the signature and key.
@@ -1359,7 +1328,7 @@
return _newMissingDartLibraryResult(file, 'dart:async');
}
- await libraryContext.load(library!);
+ await libraryContext.load(library);
var results = LibraryAnalyzer(
analysisOptions as AnalysisOptionsImpl,
@@ -1397,22 +1366,22 @@
return result;
} catch (exception, stackTrace) {
String? contextKey =
- _storeExceptionContext(path, library!, exception, stackTrace);
+ _storeExceptionContext(path, library, exception, stackTrace);
throw _ExceptionState(exception, stackTrace, contextKey);
}
});
}
- Future<SomeErrorsResult?> _computeErrors({
+ Future<SomeErrorsResult> _computeErrors({
required String path,
}) async {
var analysisResult = await _computeAnalysisResult(path, withUnit: false);
- return analysisResult?.errorsResult;
+ return analysisResult.errorsResult!;
}
- Future<AnalysisDriverUnitIndex?> _computeIndex(String path) async {
+ Future<AnalysisDriverUnitIndex> _computeIndex(String path) async {
var analysisResult = await _computeAnalysisResult(path, withUnit: false);
- return analysisResult?._index;
+ return analysisResult._index!;
}
/// Return the newly computed resolution result of the library with the
@@ -1460,23 +1429,23 @@
});
}
- Future<UnitElementResult?> _computeUnitElement(String path,
- {bool asIsIfPartWithoutLibrary = false}) async {
+ Future<UnitElementResult?> _computeUnitElement(String path) async {
FileState file = _fsState.getFileForPath(path);
// Prepare the library - the file itself, or the known library.
- FileState? library = file.isPart ? file.library : file;
- if (library == null) {
- if (asIsIfPartWithoutLibrary) {
- library = file;
- } else {
- return null;
- }
+ final FileState library;
+ final kind = file.kind;
+ if (kind is LibraryFileStateKind) {
+ library = kind.file;
+ } else if (kind is PartFileStateKind) {
+ library = kind.library ?? kind.asLibrary.file;
+ } else {
+ throw UnimplementedError('${kind.runtimeType}');
}
return _logger.runAsync('Compute unit element for $path', () async {
_logger.writeln('Work in $name');
- await libraryContext.load(library!);
+ await libraryContext.load(library);
var element = libraryContext.computeUnitElement(library, file);
return UnitElementResultImpl(
currentSession,
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
index 0ddc93b..de04c11 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
@@ -197,7 +197,7 @@
documentation:
'Horizontal type inference for function expressions passed to generic invocations.',
experimentalReleaseVersion: null,
- releaseVersion: null,
+ releaseVersion: Version.parse('2.18.0'),
);
static final inference_update_2 = ExperimentalFeature(
@@ -350,7 +350,7 @@
static const bool generic_metadata = true;
/// Default state of the experiment "inference-update-1"
- static const bool inference_update_1 = false;
+ static const bool inference_update_1 = true;
/// Default state of the experiment "inference-update-2"
static const bool inference_update_2 = false;
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index 2e35c85..a14226d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -43,6 +43,48 @@
import 'package:path/path.dart' as package_path;
import 'package:pub_semver/pub_semver.dart';
+/// The file has a `library augmentation` directive.
+abstract class AugmentationFileStateKind extends LibraryOrAugmentationFileKind {
+ final UnlinkedLibraryAugmentationDirective directive;
+
+ AugmentationFileStateKind({
+ required super.file,
+ required this.directive,
+ });
+}
+
+/// The URI of the [directive] can be resolved.
+class AugmentationKnownFileStateKind extends AugmentationFileStateKind {
+ /// The file that is referenced by the [directive].
+ final FileState uriFile;
+
+ AugmentationKnownFileStateKind({
+ required super.file,
+ required super.directive,
+ required this.uriFile,
+ });
+
+ /// If the [uriFile] has `import augment` of this file, returns [uriFile].
+ /// Otherwise, this file is not a valid augmentation, returns `null`.
+ FileState? get augmented {
+ final uriKind = uriFile.kind;
+ if (uriKind is LibraryOrAugmentationFileKind) {
+ if (uriKind.hasAugmentation(this)) {
+ return uriFile;
+ }
+ }
+ return null;
+ }
+}
+
+/// The URI of the [directive] can not be resolved.
+class AugmentationUnknownFileStateKind extends AugmentationFileStateKind {
+ AugmentationUnknownFileStateKind({
+ required super.file,
+ required super.directive,
+ });
+}
+
/// A library from [SummaryDataStore].
class ExternalLibrary {
final Uri uri;
@@ -131,6 +173,7 @@
/// Files that reference this file.
final List<FileState> referencingFiles = [];
+ List<FileState?> _augmentationFiles = [];
List<FileState?>? _importedFiles;
List<FileState?>? _exportedFiles;
List<FileState?> _partedFiles = [];
@@ -163,6 +206,11 @@
/// The unlinked API signature of the file.
Uint8List get apiSignature => _apiSignature!;
+ /// The list of imported augmentations.
+ List<FileState?> get augmentationFiles {
+ return _augmentationFiles;
+ }
+
/// The content of the file.
String get content => _content!;
@@ -251,7 +299,7 @@
/// not processed a library file yet.
FileState? get library {
final kind = _kind;
- if (kind is PartKnownFileStateKind) {
+ if (kind is PartFileStateKind) {
return kind.library;
} else {
return null;
@@ -395,14 +443,7 @@
// Flush exported top-level declarations of all files.
if (apiSignatureChanged) {
_libraryCycle?.invalidate();
-
- // If this is a part, invalidate the libraries.
- final kind = _kind;
- if (kind is PartKnownFileStateKind) {
- for (final library in kind._libraries) {
- library._libraryCycle?.invalidate();
- }
- }
+ _invalidatesLibrariesOfThisPart();
}
// It is possible that this file does not reference these files.
@@ -417,6 +458,7 @@
// Read parts eagerly to link parts to libraries.
_updateKind();
_updatePartedFiles();
+ _updateAugmentationFiles();
// Update mapping from subtyped names to files.
for (var name in _driverUnlinkedUnit!.subtypedNames) {
@@ -499,6 +541,19 @@
}
}
+ /// If this is a part, invalidate the libraries that use it.
+ void _invalidatesLibrariesOfThisPart() {
+ if (_kind is PartFileStateKind) {
+ for (final library in _fsState._pathToFile.values) {
+ if (library._kind is LibraryFileStateKind) {
+ if (library.partedFiles.contains(this)) {
+ library._libraryCycle?.invalidate();
+ }
+ }
+ }
+ }
+ }
+
CompilationUnitImpl _parse(AnalysisErrorListener errorListener) {
CharSequenceReader reader = CharSequenceReader(content);
Scanner scanner = Scanner(source, reader, errorListener)
@@ -555,107 +610,93 @@
}
}
- removeForOne(_importedFiles);
+ removeForOne(_augmentationFiles);
removeForOne(_exportedFiles);
+ removeForOne(_importedFiles);
removeForOne(_partedFiles);
}
+ void _updateAugmentationFiles() {
+ _augmentationFiles = unlinked2.augmentations.map((directive) {
+ return _fileForRelativeUri(directive.uri).map(
+ (augmentation) {
+ augmentation?.referencingFiles.add(this);
+ return augmentation;
+ },
+ (_) => null,
+ );
+ }).toList();
+ }
+
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();
- }
- }
- }
- }
+ _fsState._libraryNameToFiles.remove(_kind);
final libraryAugmentationDirective = unlinked2.libraryAugmentationDirective;
+ final libraryDirective = unlinked2.libraryDirective;
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,
+ final uri = libraryAugmentationDirective.uri;
+ final uriFile = _fileForRelativeUri(uri).map(
+ (file) => file,
+ (_) => null,
);
- _fileForRelativeUri(libraryAugmentationDirective.uri);
- } else if (unlinked2.libraryDirective != null) {
+ if (uriFile != null) {
+ _kind = AugmentationKnownFileStateKind(
+ file: this,
+ directive: libraryAugmentationDirective,
+ uriFile: uriFile,
+ );
+ } else {
+ _kind = AugmentationUnknownFileStateKind(
+ file: this,
+ directive: libraryAugmentationDirective,
+ );
+ }
+ } else if (libraryDirective != null) {
_kind = LibraryFileStateKind(
file: this,
+ name: libraryDirective.name,
);
} else if (partOfNameDirective != null) {
- if (_kind is! PartKnownFileStateKind) {
- _kind = PartUnknownNameFileStateKind(
- file: this,
- directive: partOfNameDirective,
- );
- updateLibrariesWithThisPart();
- }
+ _kind = PartOfNameFileStateKind(
+ file: this,
+ directive: partOfNameDirective,
+ );
} else if (partOfUriDirective != null) {
- if (_kind is! PartKnownFileStateKind) {
- _kind = PartUnknownUriFileStateKind(
+ final uri = partOfUriDirective.uri;
+ final uriFile = _fileForRelativeUri(uri).map(
+ (file) => file,
+ (_) => null,
+ );
+ if (uriFile != null) {
+ _kind = PartOfUriKnownFileStateKind(
+ file: this,
+ directive: partOfUriDirective,
+ uriFile: uriFile,
+ );
+ } else {
+ _kind = PartOfUriUnknownFileStateKind(
file: this,
directive: partOfUriDirective,
);
- _fileForRelativeUri(partOfUriDirective.uri);
- updateLibrariesWithThisPart();
}
} else {
_kind = LibraryFileStateKind(
file: this,
+ name: null,
);
}
+
+ _fsState._libraryNameToFiles.add(_kind);
+ _invalidatesLibrariesOfThisPart();
}
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,
- );
- }
- }
+ part?.referencingFiles.add(this);
return part;
},
(_) => null,
@@ -673,6 +714,7 @@
UnlinkedLibraryAugmentationDirective? libraryAugmentationDirective;
UnlinkedPartOfNameDirective? partOfNameDirective;
UnlinkedPartOfUriDirective? partOfUriDirective;
+ var augmentations = <UnlinkedImportAugmentationDirective>[];
var exports = <UnlinkedNamespaceDirective>[];
var imports = <UnlinkedNamespaceDirective>[];
var parts = <String>[];
@@ -682,11 +724,19 @@
if (directive is ExportDirective) {
var builder = _serializeNamespaceDirective(directive);
exports.add(builder);
- } else if (directive is ImportDirective) {
- var builder = _serializeNamespaceDirective(directive);
- imports.add(builder);
- if (builder.uri == 'dart:core') {
- hasDartCoreImport = true;
+ } else if (directive is ImportDirectiveImpl) {
+ if (directive.augmentKeyword != null) {
+ augmentations.add(
+ UnlinkedImportAugmentationDirective(
+ uri: directive.uri.stringValue ?? '',
+ ),
+ );
+ } else {
+ var builder = _serializeNamespaceDirective(directive);
+ imports.add(builder);
+ if (builder.uri == 'dart:core') {
+ hasDartCoreImport = true;
+ }
}
} else if (directive is LibraryAugmentationDirective) {
final uri = directive.uri;
@@ -761,6 +811,7 @@
}
return UnlinkedUnit(
apiSignature: Uint8List.fromList(computeUnlinkedApiSignature(unit)),
+ augmentations: augmentations,
exports: exports,
imports: imports,
informativeBytes: writeUnitInformative(unit),
@@ -875,6 +926,9 @@
/// Mapping from a path to the corresponding [FileState].
final Map<String, FileState> _pathToFile = {};
+ /// Mapping from a library name to the [LibraryFileStateKind] that have it.
+ final _LibraryNameToFiles _libraryNameToFiles = _LibraryNameToFiles();
+
/// The map of subtyped names to files where these names are subtyped.
final Map<String, Set<FileState>> _subtypedNameToFiles = {};
@@ -1070,6 +1124,7 @@
_hasUriForPath.clear();
_pathToFile.clear();
_subtypedNameToFiles.clear();
+ _libraryNameToFiles.clear();
}
FileState _newFile(File resource, String path, Uri uri) {
@@ -1152,63 +1207,161 @@
bool get isSrc => (_flags & _isSrc) != 0;
}
-class LibraryAugmentationKnownFileStateKind extends FileStateKind {
- final FileState augmented;
+class LibraryFileStateKind extends LibraryOrAugmentationFileKind {
+ /// The name of the library from the `library` directive.
+ /// Or `null` if no `library` directive.
+ final String? name;
- 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,
+ required this.name,
});
+
+ bool hasPart(PartFileStateKind part) {
+ return file.partedFiles.contains(part.file);
+ }
}
-class PartKnownFileStateKind extends FileStateKind {
- final List<FileState> _libraries = [];
-
- PartKnownFileStateKind({
+abstract class LibraryOrAugmentationFileKind extends FileStateKind {
+ LibraryOrAugmentationFileKind({
required super.file,
- required FileState library,
- }) {
- _libraries.add(library);
+ });
+
+ bool hasAugmentation(AugmentationFileStateKind augmentation) {
+ return file.augmentationFiles.contains(augmentation.file);
+ }
+}
+
+/// The file has `part of` directive.
+abstract class PartFileStateKind extends FileStateKind {
+ PartFileStateKind({
+ required super.file,
+ });
+
+ /// When [library] returns `null`, this getter is used to look at this
+ /// file itself as a library.
+ LibraryFileStateKind get asLibrary {
+ return LibraryFileStateKind(
+ file: file,
+ name: null,
+ );
}
- FileState get library => _libraries.first;
+ /// Returns the library in which this part should be analyzed.
+ FileState? get library;
}
-/// The file is a part, but its library is unknown.
-/// We don't know the library with this name.
-class PartUnknownNameFileStateKind extends FileStateKind {
+/// The file has `part of name` directive.
+class PartOfNameFileStateKind extends PartFileStateKind {
final UnlinkedPartOfNameDirective directive;
- PartUnknownNameFileStateKind({
+ PartOfNameFileStateKind({
+ required super.file,
+ required this.directive,
+ });
+
+ /// Libraries with the same name as in [directive].
+ List<LibraryFileStateKind> get libraries {
+ final files = file._fsState._libraryNameToFiles;
+ return files[directive.name] ?? [];
+ }
+
+ /// If there are libraries that include this file as a part, return the
+ /// first one as if sorted by path.
+ @override
+ FileState? get library {
+ LibraryFileStateKind? result;
+ for (final library in libraries) {
+ if (library.hasPart(this)) {
+ if (result == null) {
+ result = library;
+ } else if (library.file.path.compareTo(result.file.path) < 0) {
+ result = library;
+ }
+ }
+ }
+ return result?.file;
+ }
+}
+
+/// The file has `part of URI` directive.
+abstract class PartOfUriFileStateKind extends PartFileStateKind {
+ final UnlinkedPartOfUriDirective directive;
+
+ PartOfUriFileStateKind({
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;
+/// The file has `part of URI` directive, and the URI can be resolved.
+class PartOfUriKnownFileStateKind extends PartOfUriFileStateKind {
+ final FileState uriFile;
- PartUnknownUriFileStateKind({
+ PartOfUriKnownFileStateKind({
required super.file,
- required this.directive,
+ required super.directive,
+ required this.uriFile,
});
+
+ @override
+ FileState? get library {
+ final uriKind = uriFile.kind;
+ if (uriKind is LibraryFileStateKind) {
+ if (uriKind.hasPart(this)) {
+ return uriFile;
+ }
+ }
+ return null;
+ }
+}
+
+/// The file has `part of URI` directive, and the URI cannot be resolved.
+class PartOfUriUnknownFileStateKind extends PartOfUriFileStateKind {
+ PartOfUriUnknownFileStateKind({
+ required super.file,
+ required super.directive,
+ });
+
+ @override
+ FileState? get library => null;
+}
+
+class _LibraryNameToFiles {
+ final Map<String, List<LibraryFileStateKind>> _map = {};
+
+ List<LibraryFileStateKind>? operator [](String name) {
+ return _map[name];
+ }
+
+ /// If [kind] is a named library, register it.
+ void add(FileStateKind? kind) {
+ if (kind is LibraryFileStateKind) {
+ final name = kind.name;
+ if (name != null) {
+ final libraries = _map[name] ??= [];
+ libraries.add(kind);
+ }
+ }
+ }
+
+ void clear() {
+ _map.clear();
+ }
+
+ /// If [kind] is a named library, unregister it.
+ void remove(FileStateKind? kind) {
+ if (kind is LibraryFileStateKind) {
+ final name = kind.name;
+ if (name != null) {
+ final libraries = _map[name];
+ if (libraries != null) {
+ libraries.remove(kind);
+ if (libraries.isEmpty) {
+ _map.remove(name);
+ }
+ }
+ }
+ }
+ }
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/results.dart b/pkg/analyzer/lib/src/dart/analysis/results.dart
index 789a751..81dcce5 100644
--- a/pkg/analyzer/lib/src/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/results.dart
@@ -137,15 +137,6 @@
LineInfo get lineInfo => unit.lineInfo;
}
-class PartWithoutLibraryResultImpl implements PartWithoutLibraryResult {
- @override
- final String path;
-
- PartWithoutLibraryResultImpl({
- required this.path,
- });
-}
-
class ResolvedForCompletionResultImpl {
final AnalysisSession analysisSession;
final String path;
diff --git a/pkg/analyzer/lib/src/dart/analysis/unlinked_api_signature.dart b/pkg/analyzer/lib/src/dart/analysis/unlinked_api_signature.dart
index e1f1f9e..20b101b 100644
--- a/pkg/analyzer/lib/src/dart/analysis/unlinked_api_signature.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/unlinked_api_signature.dart
@@ -130,6 +130,7 @@
if (node != null) {
signature.addBool(node.isSynchronous);
signature.addBool(node.isGenerator);
+ signature.addBool(node is NativeFunctionBody);
}
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/unlinked_data.dart b/pkg/analyzer/lib/src/dart/analysis/unlinked_data.dart
index e4b4773..605461c 100644
--- a/pkg/analyzer/lib/src/dart/analysis/unlinked_data.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/unlinked_data.dart
@@ -90,6 +90,26 @@
}
}
+class UnlinkedImportAugmentationDirective {
+ final String uri;
+
+ UnlinkedImportAugmentationDirective({
+ required this.uri,
+ });
+
+ factory UnlinkedImportAugmentationDirective.read(
+ SummaryDataReader reader,
+ ) {
+ return UnlinkedImportAugmentationDirective(
+ uri: reader.readStringUtf8(),
+ );
+ }
+
+ void write(BufferedSink sink) {
+ sink.writeStringUtf8(uri);
+ }
+}
+
class UnlinkedLibraryAugmentationDirective {
final String uri;
final UnlinkedSourceRange uriRange;
@@ -285,6 +305,9 @@
/// TODO(scheglov) Do we need it?
final Uint8List apiSignature;
+ /// `import augmentation` directives.
+ final List<UnlinkedImportAugmentationDirective> augmentations;
+
/// URIs of `export` directives.
final List<UnlinkedNamespaceDirective> exports;
@@ -317,6 +340,7 @@
UnlinkedUnit({
required this.apiSignature,
+ required this.augmentations,
required this.exports,
required this.imports,
required this.informativeBytes,
@@ -332,6 +356,9 @@
factory UnlinkedUnit.read(SummaryDataReader reader) {
return UnlinkedUnit(
apiSignature: reader.readUint8List(),
+ augmentations: reader.readTypedList(
+ () => UnlinkedImportAugmentationDirective.read(reader),
+ ),
exports: reader.readTypedList(
() => UnlinkedNamespaceDirective.read(reader),
),
@@ -361,6 +388,9 @@
void write(BufferedSink sink) {
sink.writeUint8List(apiSignature);
+ sink.writeList<UnlinkedImportAugmentationDirective>(augmentations, (x) {
+ x.write(sink);
+ });
sink.writeList<UnlinkedNamespaceDirective>(exports, (x) {
x.write(sink);
});
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 00e49a0..7a61f73 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -3903,6 +3903,7 @@
return parent._staticParameterElementForIndex;
}
} else if (parent is BinaryExpressionImpl) {
+ // TODO(scheglov) https://github.com/dart-lang/sdk/issues/49102
if (identical(parent.rightOperand, this)) {
var parameters = parent.staticInvokeType?.parameters;
if (parameters != null && parameters.isNotEmpty) {
@@ -3915,8 +3916,12 @@
return parent._staticParameterElementForRightHandSide;
}
} else if (parent is PrefixExpressionImpl) {
+ // TODO(scheglov) This does not look right, there is no element for
+ // the operand, for `a++` we invoke `a = a + 1`, so the parameter
+ // is for `1`, not for `a`.
return parent._staticParameterElementForOperand;
} else if (parent is PostfixExpressionImpl) {
+ // TODO(scheglov) The same as above.
return parent._staticParameterElementForOperand;
}
return null;
@@ -6383,6 +6388,58 @@
_prefix?.accept(visitor);
combinators.accept(visitor);
}
+
+ /// Return `true` if the non-URI components of the two directives are
+ /// syntactically identical. URIs are checked outside to see if they resolve
+ /// to the same absolute URI, so to the same library, regardless of the used
+ /// syntax (absolute, relative, not normalized).
+ static bool areSyntacticallyIdenticalExceptUri(
+ ImportDirective node1,
+ ImportDirective node2,
+ ) {
+ if (node1.prefix?.name != node2.prefix?.name) {
+ return false;
+ }
+
+ bool areSameNames(
+ List<SimpleIdentifier> names1,
+ List<SimpleIdentifier> names2,
+ ) {
+ if (names1.length != names2.length) {
+ return false;
+ }
+ for (var i = 0; i < names1.length; i++) {
+ if (names1[i].name != names2[i].name) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ final combinators1 = node1.combinators;
+ final combinators2 = node2.combinators;
+ if (combinators1.length != combinators2.length) {
+ return false;
+ }
+ for (var i = 0; i < combinators1.length; i++) {
+ final combinator1 = combinators1[i];
+ final combinator2 = combinators2[i];
+ if (combinator1 is HideCombinator && combinator2 is HideCombinator) {
+ if (!areSameNames(combinator1.hiddenNames, combinator2.hiddenNames)) {
+ return false;
+ }
+ } else if (combinator1 is ShowCombinator &&
+ combinator2 is ShowCombinator) {
+ if (!areSameNames(combinator1.shownNames, combinator2.shownNames)) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ return true;
+ }
}
/// An index expression.
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index c83df2c..0f4d313 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -292,13 +292,13 @@
String methodName, LibraryElement library) =>
_first(_implementationsOfMethod(methodName).where(
(MethodElement method) =>
- !method.isAbstract && method.isAccessibleIn(library)));
+ !method.isAbstract && method.isAccessibleIn2(library)));
@override
PropertyAccessorElement? lookUpGetter(
String getterName, LibraryElement library) =>
_first(_implementationsOfGetter(getterName).where(
- (PropertyAccessorElement getter) => getter.isAccessibleIn(library)));
+ (PropertyAccessorElement getter) => getter.isAccessibleIn2(library)));
@override
PropertyAccessorElement? lookUpInheritedConcreteGetter(
@@ -307,7 +307,7 @@
(PropertyAccessorElement getter) =>
!getter.isAbstract &&
!getter.isStatic &&
- getter.isAccessibleIn(library) &&
+ getter.isAccessibleIn2(library) &&
getter.enclosingElement != this));
ExecutableElement? lookUpInheritedConcreteMember(
@@ -327,7 +327,7 @@
(MethodElement method) =>
!method.isAbstract &&
!method.isStatic &&
- method.isAccessibleIn(library) &&
+ method.isAccessibleIn2(library) &&
method.enclosingElement != this));
@override
@@ -337,7 +337,7 @@
(PropertyAccessorElement setter) =>
!setter.isAbstract &&
!setter.isStatic &&
- setter.isAccessibleIn(library) &&
+ setter.isAccessibleIn2(library) &&
setter.enclosingElement != this));
@override
@@ -346,19 +346,19 @@
_first(_implementationsOfMethod(methodName).where(
(MethodElement method) =>
!method.isStatic &&
- method.isAccessibleIn(library) &&
+ method.isAccessibleIn2(library) &&
method.enclosingElement != this));
@override
MethodElement? lookUpMethod(String methodName, LibraryElement library) =>
_first(_implementationsOfMethod(methodName)
- .where((MethodElement method) => method.isAccessibleIn(library)));
+ .where((MethodElement method) => method.isAccessibleIn2(library)));
@override
PropertyAccessorElement? lookUpSetter(
String setterName, LibraryElement library) =>
_first(_implementationsOfSetter(setterName).where(
- (PropertyAccessorElement setter) => setter.isAccessibleIn(library)));
+ (PropertyAccessorElement setter) => setter.isAccessibleIn2(library)));
/// Return the static getter with the [name], accessible to the [library].
///
@@ -368,7 +368,7 @@
PropertyAccessorElement? lookupStaticGetter(
String name, LibraryElement library) {
return _first(_implementationsOfGetter(name).where((element) {
- return element.isStatic && element.isAccessibleIn(library);
+ return element.isStatic && element.isAccessibleIn2(library);
}));
}
@@ -379,7 +379,7 @@
/// or a superclass.
MethodElement? lookupStaticMethod(String name, LibraryElement library) {
return _first(_implementationsOfMethod(name).where((element) {
- return element.isStatic && element.isAccessibleIn(library);
+ return element.isStatic && element.isAccessibleIn2(library);
}));
}
@@ -391,7 +391,7 @@
PropertyAccessorElement? lookupStaticSetter(
String name, LibraryElement library) {
return _first(_implementationsOfSetter(name).where((element) {
- return element.isStatic && element.isAccessibleIn(library);
+ return element.isStatic && element.isAccessibleIn2(library);
}));
}
@@ -883,7 +883,7 @@
if (!superElement.isMixinApplication) {
final library = this.library;
constructorsToForward = superElement.constructors
- .where((constructor) => constructor.isAccessibleIn(library))
+ .where((constructor) => constructor.isAccessibleIn2(library))
.where((constructor) => !constructor.isFactory);
} else {
if (visitedClasses == null) {
@@ -2485,6 +2485,7 @@
bool hasModifier(Modifier modifier) =>
BooleanArray.get(_modifiers, modifier.ordinal);
+ @Deprecated('Use isAccessibleIn2() instead')
@override
bool isAccessibleIn(LibraryElement? library) {
if (Identifier.isPrivateName(name!)) {
@@ -2493,6 +2494,14 @@
return true;
}
+ @override
+ bool isAccessibleIn2(LibraryElement library) {
+ if (Identifier.isPrivateName(name!)) {
+ return library == this.library;
+ }
+ return true;
+ }
+
/// Use the given [visitor] to visit all of the [children] in the given array.
void safelyVisitChildren(List<Element> children, ElementVisitor visitor) {
for (Element child in children) {
@@ -4710,6 +4719,7 @@
return displayName;
}
+ @Deprecated('Use isAccessibleIn2() instead')
@override
bool isAccessibleIn(LibraryElement? library) {
for (Element element in conflictingElements) {
@@ -4721,6 +4731,16 @@
}
@override
+ bool isAccessibleIn2(LibraryElement library) {
+ for (Element element in conflictingElements) {
+ if (element.isAccessibleIn2(library)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @override
E? thisOrAncestorMatching<E extends Element>(
bool Function(Element) predicate,
) {
diff --git a/pkg/analyzer/lib/src/dart/element/member.dart b/pkg/analyzer/lib/src/dart/element/member.dart
index 19aa560..679555e 100644
--- a/pkg/analyzer/lib/src/dart/element/member.dart
+++ b/pkg/analyzer/lib/src/dart/element/member.dart
@@ -612,10 +612,15 @@
String getExtendedDisplayName(String? shortName) =>
_declaration.getExtendedDisplayName(shortName);
+ @Deprecated('Use isAccessibleIn2() instead')
@override
bool isAccessibleIn(LibraryElement? library) =>
_declaration.isAccessibleIn(library);
+ @override
+ bool isAccessibleIn2(LibraryElement library) =>
+ _declaration.isAccessibleIn2(library);
+
/// Use the given [visitor] to visit all of the [children].
void safelyVisitChildren(List<Element> children, ElementVisitor visitor) {
// TODO(brianwilkerson) Make this private
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index bd1c52f..8070b07 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -707,7 +707,7 @@
}
// not found or not accessible
if (constructorElement == null ||
- !constructorElement.isAccessibleIn(library)) {
+ !constructorElement.isAccessibleIn2(library)) {
return null;
}
// return member
diff --git a/pkg/analyzer/lib/src/dart/micro/library_graph.dart b/pkg/analyzer/lib/src/dart/micro/library_graph.dart
index 0f722d7..f560b03 100644
--- a/pkg/analyzer/lib/src/dart/micro/library_graph.dart
+++ b/pkg/analyzer/lib/src/dart/micro/library_graph.dart
@@ -904,6 +904,7 @@
UnlinkedLibraryAugmentationDirective? libraryAugmentationDirective;
UnlinkedPartOfNameDirective? partOfNameDirective;
UnlinkedPartOfUriDirective? partOfUriDirective;
+ var augmentations = <UnlinkedImportAugmentationDirective>[];
var exports = <UnlinkedNamespaceDirective>[];
var imports = <UnlinkedNamespaceDirective>[];
var parts = <String>[];
@@ -912,11 +913,19 @@
if (directive is ExportDirective) {
var builder = _serializeNamespaceDirective(directive);
exports.add(builder);
- } else if (directive is ImportDirective) {
- var builder = _serializeNamespaceDirective(directive);
- imports.add(builder);
- if (builder.uri == 'dart:core') {
- hasDartCoreImport = true;
+ } else if (directive is ImportDirectiveImpl) {
+ if (directive.augmentKeyword != null) {
+ augmentations.add(
+ UnlinkedImportAugmentationDirective(
+ uri: directive.uri.stringValue ?? '',
+ ),
+ );
+ } else {
+ var builder = _serializeNamespaceDirective(directive);
+ imports.add(builder);
+ if (builder.uri == 'dart:core') {
+ hasDartCoreImport = true;
+ }
}
} else if (directive is LibraryAugmentationDirective) {
final uri = directive.uri;
@@ -995,6 +1004,7 @@
var unlinkedUnit = UnlinkedUnit(
apiSignature: computeUnlinkedApiSignature(unit),
+ augmentations: augmentations,
exports: exports,
imports: imports,
informativeBytes: writeUnitInformative(unit),
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
index 0aa5a1e..508dbaa 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
@@ -770,7 +770,7 @@
}
element ??= classElement.getGetter(name);
element ??= classElement.getMethod(name);
- if (element != null && element.isAccessibleIn(_resolver.definingLibrary)) {
+ if (element != null && element.isAccessibleIn2(_resolver.definingLibrary)) {
return element;
}
return null;
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
index ee320b5..1c1a643 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
@@ -95,7 +95,8 @@
} else {
var name = constructorIdentifier.name;
rawElement = typeElement.getNamedConstructor(name);
- if (rawElement != null && !rawElement.isAccessibleIn(definingLibrary)) {
+ if (rawElement != null &&
+ !rawElement.isAccessibleIn2(definingLibrary)) {
rawElement = null;
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
index 44f0869..c7169aa 100644
--- a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
@@ -351,7 +351,7 @@
}
element ??= classElement.getGetter(name);
element ??= classElement.getMethod(name);
- if (element != null && element.isAccessibleIn(_definingLibrary)) {
+ if (element != null && element.isAccessibleIn2(_definingLibrary)) {
return element;
}
return null;
diff --git a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
index 47bfe31..28f5ec9 100644
--- a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
@@ -326,7 +326,7 @@
}
bool _isAccessible(ExecutableElement element) {
- return element.isAccessibleIn(_definingLibrary);
+ return element.isAccessibleIn2(_definingLibrary);
}
void _reportUnresolvedIndex(
diff --git a/pkg/analyzer/lib/src/error/deprecated_member_use_verifier.dart b/pkg/analyzer/lib/src/error/deprecated_member_use_verifier.dart
index ff183f5..82de45d 100644
--- a/pkg/analyzer/lib/src/error/deprecated_member_use_verifier.dart
+++ b/pkg/analyzer/lib/src/error/deprecated_member_use_verifier.dart
@@ -146,6 +146,10 @@
return;
}
+ if (element is ParameterElement && element.isRequired) {
+ return;
+ }
+
var errorNode = node;
var parent = node.parent;
if (parent is AssignmentExpression && parent.leftHandSide == node) {
@@ -204,11 +208,7 @@
_visitParametersAndArguments(
element.parameters,
arguments.arguments,
- (parameter, argument) {
- if (parameter.isOptional) {
- _checkForDeprecated(parameter, argument);
- }
- },
+ _checkForDeprecated,
);
}
}
diff --git a/pkg/analyzer/lib/src/error/imports_verifier.dart b/pkg/analyzer/lib/src/error/imports_verifier.dart
index 425cb32..52781b7 100644
--- a/pkg/analyzer/lib/src/error/imports_verifier.dart
+++ b/pkg/analyzer/lib/src/error/imports_verifier.dart
@@ -8,6 +8,7 @@
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/resolver/scope.dart';
import 'package:analyzer/src/error/codes.dart';
@@ -254,6 +255,7 @@
HashMap<NamespaceDirective, List<SimpleIdentifier>>();
void addImports(CompilationUnit node) {
+ final importsWithLibraries = <_ImportDirective>[];
for (Directive directive in node.directives) {
if (directive is ImportDirective) {
var libraryElement = directive.uriElement;
@@ -262,6 +264,12 @@
}
_allImports.add(directive);
_unusedImports.add(directive);
+ importsWithLibraries.add(
+ _ImportDirective(
+ node: directive,
+ importedLibrary: libraryElement,
+ ),
+ );
//
// Initialize prefixElementMap
//
@@ -286,23 +294,27 @@
_addDuplicateShownHiddenNames(directive);
}
}
- if (_unusedImports.length > 1) {
+ if (importsWithLibraries.length > 1) {
// order the list of unusedImports to find duplicates in faster than
// O(n^2) time
- List<ImportDirective> importDirectiveArray =
- List<ImportDirective>.from(_unusedImports);
- importDirectiveArray.sort(ImportDirective.COMPARATOR);
- ImportDirective currentDirective = importDirectiveArray[0];
- for (int i = 1; i < importDirectiveArray.length; i++) {
- ImportDirective nextDirective = importDirectiveArray[i];
- if (ImportDirective.COMPARATOR(currentDirective, nextDirective) == 0) {
+ importsWithLibraries.sort((import1, import2) {
+ return import1.libraryUriStr.compareTo(import2.libraryUriStr);
+ });
+ var currentDirective = importsWithLibraries[0];
+ for (var i = 1; i < importsWithLibraries.length; i++) {
+ final nextDirective = importsWithLibraries[i];
+ if (currentDirective.libraryUriStr == nextDirective.libraryUriStr &&
+ ImportDirectiveImpl.areSyntacticallyIdenticalExceptUri(
+ currentDirective.node,
+ nextDirective.node,
+ )) {
// Add either the currentDirective or nextDirective depending on which
// comes second, this guarantees that the first of the duplicates
// won't be highlighted.
- if (currentDirective.offset < nextDirective.offset) {
- _duplicateImports.add(nextDirective);
+ if (currentDirective.node.offset < nextDirective.node.offset) {
+ _duplicateImports.add(nextDirective.node);
} else {
- _duplicateImports.add(currentDirective);
+ _duplicateImports.add(currentDirective.node);
}
}
currentDirective = nextDirective;
@@ -603,6 +615,20 @@
final Set<ExtensionElement> usedExtensions = {};
}
+/// [ImportDirective] with non-null imported [LibraryElement].
+class _ImportDirective {
+ final ImportDirective node;
+ final LibraryElement importedLibrary;
+
+ _ImportDirective({
+ required this.node,
+ required this.importedLibrary,
+ });
+
+ /// Returns the absolute URI of the imported library.
+ String get libraryUriStr => '${importedLibrary.source.uri}';
+}
+
/// A class which verifies (and reports) whether any import directives are
/// unnecessary.
///
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 93bcdab..9ae6c75 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -341,7 +341,7 @@
var superName = name?.name;
var element = superType.lookUpConstructor(superName, _definingLibrary);
element = _resolver.toLegacyElement(element);
- if (element == null || !element.isAccessibleIn(_definingLibrary)) {
+ if (element == null || !element.isAccessibleIn2(_definingLibrary)) {
if (name != null) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER,
diff --git a/pkg/analyzer/lib/src/summary2/default_value_resolver.dart b/pkg/analyzer/lib/src/summary2/default_value_resolver.dart
index 632a6c4..8170e42 100644
--- a/pkg/analyzer/lib/src/summary2/default_value_resolver.dart
+++ b/pkg/analyzer/lib/src/summary2/default_value_resolver.dart
@@ -23,6 +23,7 @@
for (var unitElement in _libraryElement.units.impl) {
_UnitContext(unitElement)
..forEach(unitElement.classes, _class)
+ ..forEach(unitElement.enums, _class)
..forEach(unitElement.extensions, _extension)
..forEach(unitElement.functions, _executable)
..forEach(unitElement.mixins, _class);
diff --git a/pkg/analyzer/lib/src/summary2/library_builder.dart b/pkg/analyzer/lib/src/summary2/library_builder.dart
index 7594b79..4a1838a 100644
--- a/pkg/analyzer/lib/src/summary2/library_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/library_builder.dart
@@ -333,6 +333,9 @@
unitElement: unitElement,
).buildDeclarationElements(unitNode);
+ // We move elements, so they don't have real offsets.
+ unitElement.accept(_FlushElementOffsets());
+
units.add(
LinkingUnit(
isDefiningUnit: false,
diff --git a/pkg/analyzer/lib/src/summary2/top_level_inference.dart b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
index 50db402..5045d1f 100644
--- a/pkg/analyzer/lib/src/summary2/top_level_inference.dart
+++ b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
@@ -180,7 +180,7 @@
if (superType != null) {
var index = classElement.constructors.indexOf(_constructor);
var superConstructors = superType.element.constructors
- .where((element) => element.isAccessibleIn(classElement.library))
+ .where((element) => element.isAccessibleIn2(classElement.library))
.toList();
if (index < superConstructors.length) {
_baseConstructor = _BaseConstructor(
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 25c8cda..77c258e 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -20,13 +20,16 @@
watcher: ^1.0.0
yaml: ^3.0.0
+# We use 'any' version constraints here as we get our package versions from
+# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
+# best practice for packages is to specify their compatible version ranges.
+# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
- analyzer_utilities:
- path: ../analyzer_utilities
- args: ^2.0.0
- async: ^2.5.0
- linter: ^1.12.0
- lints: ^2.0.0
- matcher: ^0.12.10
- test: ^1.16.0
- test_reflective_loader: ^0.2.0
+ analyzer_utilities: any
+ args: any
+ async: any
+ linter: any
+ lints: any
+ matcher: any
+ test: any
+ test_reflective_loader: any
diff --git a/pkg/analyzer/test/dart/sdk/build_sdk_summary_test.dart b/pkg/analyzer/test/dart/sdk/build_sdk_summary_test.dart
new file mode 100644
index 0000000..ea020f8
--- /dev/null
+++ b/pkg/analyzer/test/dart/sdk/build_sdk_summary_test.dart
@@ -0,0 +1,140 @@
+// 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 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/dart/analysis/session.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/sdk/build_sdk_summary.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/dart/analysis/analysis_context_collection.dart';
+import 'package:analyzer/src/test_utilities/mock_sdk.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(BuildSdkSummaryTest);
+ });
+}
+
+@reflectiveTest
+class BuildSdkSummaryTest with ResourceProviderMixin {
+ Folder get sdkRoot => getFolder('/sdk');
+
+ test_embedderYamlPath() async {
+ createMockSdk(
+ resourceProvider: resourceProvider,
+ root: sdkRoot,
+ );
+
+ // The idea of the embedder is probably to replace the SDK.
+ // But the current implementation only adds new libraries.
+ final skyEngineLib = getFolder('/home/sky_engine/lib');
+ newFile('${skyEngineLib.path}/core/core.dart', r'''
+class NotObject {}
+''');
+ newFile('${skyEngineLib.path}/ui/ui.dart', r'''
+class Offset {}
+''');
+ final embedderFile = newFile('${skyEngineLib.path}/_embedder.yaml', r'''
+embedded_libs:
+ "dart:core": "core/core.dart"
+ "dart:ui": "ui/ui.dart"
+''');
+
+ final sdkSummaryBytes = await buildSdkSummary2(
+ resourceProvider: resourceProvider,
+ sdkPath: sdkRoot.path,
+ embedderYamlPath: embedderFile.path,
+ );
+
+ // Delete SDK files, to prove that we don't read them later.
+ sdkRoot.delete();
+ skyEngineLib.delete();
+
+ // Write the summary bytes, will be read later.
+ final sdkSummaryFile = getFile('/home/sdk_summary.bytes');
+ sdkSummaryFile.writeAsBytesSync(sdkSummaryBytes);
+
+ // Pub workspace does not support SDK summaries.
+ // So, we use Bazel workspace.
+ const workspacePath = '/workspace';
+ newFile('$workspacePath/WORKSPACE', '');
+ final myPackageRoot = getFolder('$workspacePath/dart/my');
+
+ final collection = AnalysisContextCollectionImpl(
+ includedPaths: [myPackageRoot.path],
+ librarySummaryPaths: [],
+ resourceProvider: resourceProvider,
+ sdkSummaryPath: sdkSummaryFile.path,
+ );
+
+ final analysisContext = collection.contextFor(myPackageRoot.path);
+ final analysisSession = analysisContext.currentSession;
+
+ // We can ask for SDK libraries and classes.
+ // They should be created from the summary bytes.
+ final dartAsync = await analysisSession.getLibrary('dart:async');
+ final dartCore = await analysisSession.getLibrary('dart:core');
+ final dartMath = await analysisSession.getLibrary('dart:math');
+ final dartUi = await analysisSession.getLibrary('dart:ui');
+ expect(dartAsync.getType('Stream'), isNotNull);
+ expect(dartCore.getType('String'), isNotNull);
+ expect(dartMath.getType('Random'), isNotNull);
+ expect(dartUi.getType('Offset'), isNotNull);
+ }
+
+ test_it() async {
+ createMockSdk(
+ resourceProvider: resourceProvider,
+ root: sdkRoot,
+ );
+
+ final sdkSummaryBytes = await buildSdkSummary2(
+ resourceProvider: resourceProvider,
+ sdkPath: sdkRoot.path,
+ );
+
+ // Delete SDK files, to prove that we don't read them later.
+ sdkRoot.delete();
+
+ // Write the summary bytes, will be read later.
+ final sdkSummaryFile = getFile('/home/sdk_summary.bytes');
+ sdkSummaryFile.writeAsBytesSync(sdkSummaryBytes);
+
+ // Pub workspace does not support SDK summaries.
+ // So, we use Bazel workspace.
+ const workspacePath = '/workspace';
+ newFile('$workspacePath/WORKSPACE', '');
+ final myPackageRoot = getFolder('$workspacePath/dart/my');
+
+ final collection = AnalysisContextCollectionImpl(
+ includedPaths: [myPackageRoot.path],
+ librarySummaryPaths: [],
+ resourceProvider: resourceProvider,
+ sdkSummaryPath: sdkSummaryFile.path,
+ );
+
+ final analysisContext = collection.contextFor(myPackageRoot.path);
+ final analysisSession = analysisContext.currentSession;
+
+ // We can ask for SDK libraries and classes.
+ // They should be created from the summary bytes.
+ final dartAsync = await analysisSession.getLibrary('dart:async');
+ final dartCore = await analysisSession.getLibrary('dart:core');
+ final dartMath = await analysisSession.getLibrary('dart:math');
+ expect(dartAsync.getType('Stream'), isNotNull);
+ expect(dartCore.getType('String'), isNotNull);
+ expect(dartMath.getType('Random'), isNotNull);
+ }
+}
+
+extension on AnalysisSession {
+ Future<LibraryElement> getLibrary(String uriStr) async {
+ final libraryResult = await getLibraryByUri(uriStr);
+ libraryResult as LibraryElementResult;
+ return libraryResult.element;
+ }
+}
diff --git a/pkg/analyzer/test/dart/sdk/test_all.dart b/pkg/analyzer/test/dart/sdk/test_all.dart
new file mode 100644
index 0000000..84d512d
--- /dev/null
+++ b/pkg/analyzer/test/dart/sdk/test_all.dart
@@ -0,0 +1,13 @@
+// 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 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'build_sdk_summary_test.dart' as build_sdk_summary;
+
+main() {
+ defineReflectiveSuite(() {
+ build_sdk_summary.main();
+ }, name: 'sdk');
+}
diff --git a/pkg/analyzer/test/dart/test_all.dart b/pkg/analyzer/test/dart/test_all.dart
index fb48b99..12db7b3 100644
--- a/pkg/analyzer/test/dart/test_all.dart
+++ b/pkg/analyzer/test/dart/test_all.dart
@@ -7,11 +7,13 @@
import 'analysis/test_all.dart' as analysis;
import 'ast/test_all.dart' as ast;
import 'element/test_all.dart' as element;
+import 'sdk/test_all.dart' as sdk;
main() {
defineReflectiveSuite(() {
analysis.main();
ast.main();
element.main();
+ sdk.main();
}, name: 'dart');
}
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index 004ee23..4d1deaf 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -4096,6 +4096,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/dart/analysis/dependency/base.dart b/pkg/analyzer/test/src/dart/analysis/dependency/base.dart
deleted file mode 100644
index c53ca65..0000000
--- a/pkg/analyzer/test/src/dart/analysis/dependency/base.dart
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (c) 2018, 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 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/src/dart/analysis/dependency/library_builder.dart';
-import 'package:analyzer/src/dart/analysis/dependency/node.dart';
-import 'package:test/test.dart';
-
-import '../../resolution/context_collection_resolution.dart';
-
-class BaseDependencyTest extends PubPackageResolutionTest {
- late final String a;
- late final String b;
- late final String c;
- late final Uri aUri;
- late final Uri bUri;
- late final Uri cUri;
-
- bool hasDartCore = false;
-
- void assertNodes(List<Node> actualNodes, List<ExpectedNode> expectedNodes,
- {Node? expectedEnclosingClass}) {
- expect(actualNodes, hasLength(expectedNodes.length));
- for (var expectedNode in expectedNodes) {
- var topNode = _getNode(
- actualNodes,
- uri: expectedNode.uri,
- name: expectedNode.name,
- kind: expectedNode.kind,
- );
- expect(topNode.enclosingClass, expectedEnclosingClass);
-
- if (expectedNode.classMembers != null) {
- assertNodes(topNode.classMembers!, expectedNode.classMembers!,
- expectedEnclosingClass: topNode);
- } else {
- expect(topNode.classMembers, isNull);
- }
-
- if (expectedNode.classTypeParameters != null) {
- assertNodes(
- topNode.classTypeParameters!,
- expectedNode.classTypeParameters!,
- expectedEnclosingClass: topNode,
- );
- } else {
- expect(topNode.classTypeParameters, isNull);
- }
- }
- }
-
- Future<Library> buildTestLibrary(String path, String content) async {
-// if (!hasDartCore) {
-// hasDartCore = true;
-// await _addLibraryByUri('dart:core');
-// await _addLibraryByUri('dart:async');
-// await _addLibraryByUri('dart:math');
-// await _addLibraryByUri('dart:_internal');
-// }
-
- newFile(path, content);
-
- var analysisDriver = driverFor(path);
- analysisDriver.changeFile(path);
- await analysisDriver.applyPendingFileChanges();
-
- var units = await _resolveLibrary(path);
- var uri = units.first.declaredElement!.source.uri;
-
- return buildLibrary(uri, units);
-
-// tracker.addLibrary(uri, units);
-//
-// var library = tracker.libraries[uri];
-// expect(library, isNotNull);
-//
-// return library;
- }
-
- Node getNode(Library library,
- {required String name,
- NodeKind? kind,
- String? memberOf,
- String? typeParameterOf}) {
- var uri = library.uri;
- var nodes = library.declaredNodes;
- if (memberOf != null) {
- var class_ = _getNode(nodes, uri: uri, name: memberOf);
- expect(
- class_.kind,
- anyOf(NodeKind.CLASS, NodeKind.ENUM, NodeKind.MIXIN),
- );
- nodes = class_.classMembers!;
- } else if (typeParameterOf != null) {
- var class_ = _getNode(nodes, uri: uri, name: typeParameterOf);
- expect(class_.kind, anyOf(NodeKind.CLASS, NodeKind.MIXIN));
- nodes = class_.classTypeParameters!;
- }
- return _getNode(nodes, uri: uri, name: name, kind: kind);
- }
-
- @override
- void setUp() {
- super.setUp();
-// var logger = PerformanceLog(null);
-// tracker = DependencyTracker(logger);
- a = convertPath('$testPackageLibPath/a.dart');
- b = convertPath('$testPackageLibPath/b.dart');
- c = convertPath('$testPackageLibPath/c.dart');
- aUri = Uri.parse('package:test/a.dart');
- bUri = Uri.parse('package:test/b.dart');
- cUri = Uri.parse('package:test/c.dart');
- }
-
-// Future _addLibraryByUri(String uri) async {
-// var path = driver.sourceFactory.forUri(uri).fullName;
-// var unitResult = await driver.getUnitElement(path);
-//
-// var signature = ApiSignature();
-// signature.addString(unitResult.signature);
-// var signatureBytes = signature.toByteList();
-//
-// tracker.addLibraryElement(unitResult.element.library, signatureBytes);
-// }
-
- Node _getNode(List<Node> nodes,
- {required Uri uri, required String name, NodeKind? kind}) {
- var nameObj = LibraryQualifiedName(uri, name);
- for (var node in nodes) {
- if (node.name == nameObj) {
- if (kind != null && node.kind != kind) {
- fail('Expected $kind "$name", found ${node.kind}');
- }
- return node;
- }
- }
- fail('Expected to find $uri::$name in:\n ${nodes.join('\n ')}');
- }
-
- Future<List<CompilationUnit>> _resolveLibrary(String libraryPath) async {
- var session = contextFor(libraryPath).currentSession;
- var resolvedLibrary = await session.getResolvedLibrary(libraryPath);
- resolvedLibrary as ResolvedLibraryResult;
- return resolvedLibrary.units.map((ru) => ru.unit).toList();
- }
-}
-
-class ExpectedNode {
- final Uri uri;
- final String name;
- final NodeKind kind;
- final List<ExpectedNode>? classMembers;
- final List<ExpectedNode>? classTypeParameters;
-
- ExpectedNode(
- this.uri,
- this.name,
- this.kind, {
- this.classMembers,
- this.classTypeParameters,
- });
-}
diff --git a/pkg/analyzer/test/src/dart/analysis/dependency/declared_nodes_test.dart b/pkg/analyzer/test/src/dart/analysis/dependency/declared_nodes_test.dart
deleted file mode 100644
index c59eefd..0000000
--- a/pkg/analyzer/test/src/dart/analysis/dependency/declared_nodes_test.dart
+++ /dev/null
@@ -1,1795 +0,0 @@
-// Copyright (c) 2018, 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 'package:analyzer/src/dart/analysis/dependency/library_builder.dart'
- hide buildLibrary;
-import 'package:analyzer/src/dart/analysis/dependency/node.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import 'base.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(DeclaredNodesTest);
- });
-}
-
-@reflectiveTest
-class DeclaredNodesTest extends BaseDependencyTest {
- test_api_tokens_include_enclosingClass() async {
- var library = await buildTestLibrary(a, r'''
-class A {
- void foo() {}
-}
-
-class B {
- void foo() {}
-}
-''');
- _assertDifferentApiTokenSignature(
- getNode(library, name: 'foo', memberOf: 'A'),
- getNode(library, name: 'foo', memberOf: 'B'),
- );
- }
-
- test_api_tokens_include_enclosingEnum() async {
- var library = await buildTestLibrary(a, r'''
-enum A {
- foo
-}
-
-enum B {
- foo
-}
-''');
- _assertDifferentApiTokenSignature(
- getNode(library, name: 'foo', memberOf: 'A'),
- getNode(library, name: 'foo', memberOf: 'B'),
- );
- _assertDifferentApiTokenSignature(
- getNode(library, name: 'index', memberOf: 'A'),
- getNode(library, name: 'index', memberOf: 'B'),
- );
- _assertDifferentApiTokenSignature(
- getNode(library, name: 'values', memberOf: 'A'),
- getNode(library, name: 'values', memberOf: 'B'),
- );
- }
-
- test_api_tokens_include_enclosingLibrary_class() async {
- var aLib = await buildTestLibrary(a, 'class C {}');
- var bLib = await buildTestLibrary(b, 'class C {}');
- _assertDifferentApiTokenSignature(
- getNode(aLib, name: 'C'),
- getNode(bLib, name: 'C'),
- );
- }
-
- test_api_tokens_include_enclosingLibrary_enum() async {
- var aLib = await buildTestLibrary(a, 'enum Foo {a, b, c}');
- var bLib = await buildTestLibrary(b, 'enum Foo {a, b, c}');
- _assertDifferentApiTokenSignature(
- getNode(aLib, name: 'Foo'),
- getNode(bLib, name: 'Foo'),
- );
- }
-
- test_api_tokens_include_enclosingLibrary_function() async {
- var aLib = await buildTestLibrary(a, 'void foo() {}');
- var bLib = await buildTestLibrary(b, 'void foo() {}');
- _assertDifferentApiTokenSignature(
- getNode(aLib, name: 'foo'),
- getNode(bLib, name: 'foo'),
- );
- }
-
- test_api_tokens_include_functionOrMethod() async {
- var library = await buildTestLibrary(a, r'''
-void foo() {}
-
-class C {
- void foo() {}
-}
-''');
- var fooFunction = getNode(library, name: 'foo');
- var fooMethod = getNode(library, name: 'foo', memberOf: 'C');
- expect(
- fooFunction.api.tokenSignatureHex,
- isNot(fooMethod.api.tokenSignatureHex),
- );
- }
-
- test_class_constructor() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- C();
- C.named();
-}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(
- aUri,
- 'C',
- NodeKind.CLASS,
- classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ExpectedNode(aUri, 'named', NodeKind.CONSTRUCTOR),
- ],
- ),
- ]);
- }
-
- test_class_constructor_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.CONSTRUCTOR,
- 'class X { X.foo(); }',
- 'class X { @deprecated X.foo(); }',
- memberOf: 'X',
- );
- }
-
- test_class_constructor_api_tokens_notSame_parameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.CONSTRUCTOR,
- 'class X { X.foo(); }',
- 'class X { X.foo(int a); }',
- memberOf: 'X',
- );
- }
-
- test_class_constructor_api_tokens_notSame_parameter_name_edit_named() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.CONSTRUCTOR,
- 'class X { X.foo({int a}); }',
- 'class X { X.foo({int b}); }',
- memberOf: 'X',
- );
- }
-
- test_class_constructor_api_tokens_notSame_parameter_type() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.CONSTRUCTOR,
- 'class X { X.foo(int a); }',
- 'class X { X.foo(double a); }',
- memberOf: 'X',
- );
- }
-
- test_class_constructor_api_tokens_same_body() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.CONSTRUCTOR,
- 'class X { X.foo() { print(1); } }',
- 'class X { X.foo() { print(2); } }',
- memberOf: 'X',
- );
- }
-
- test_class_constructor_api_tokens_same_body_add() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.CONSTRUCTOR,
- 'class X { X.foo(); }',
- 'class X { X.foo() {} }',
- memberOf: 'X',
- );
- }
-
- test_class_constructor_api_tokens_same_parameter_name_edit_required() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.CONSTRUCTOR,
- 'class X { X.foo(int a); }',
- 'class X { X.foo(int b); }',
- memberOf: 'X',
- );
- }
-
- test_class_constructor_default() async {
- var library = await buildTestLibrary(a, r'''
-class C {}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(
- aUri,
- 'C',
- NodeKind.CLASS,
- classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ],
- ),
- ]);
- }
-
- test_class_field() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- int a = 1;
- int b = 2, c = 3;
-}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(
- aUri,
- 'C',
- NodeKind.CLASS,
- classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ExpectedNode(aUri, 'a', NodeKind.GETTER),
- ExpectedNode(aUri, 'b', NodeKind.GETTER),
- ExpectedNode(aUri, 'c', NodeKind.GETTER),
- ExpectedNode(aUri, 'a=', NodeKind.SETTER),
- ExpectedNode(aUri, 'b=', NodeKind.SETTER),
- ExpectedNode(aUri, 'c=', NodeKind.SETTER),
- ],
- ),
- ]);
- }
-
- test_class_field_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { int foo = 0; }',
- 'class X { @deprecated int foo = 0; }',
- memberOf: 'X',
- );
- }
-
- test_class_field_api_tokens_notSame_const() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { int foo = 0; }',
- 'class X { const int foo = 0; }',
- memberOf: 'X',
- );
- }
-
- test_class_field_api_tokens_same_final() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { int foo = 0; }',
- 'class X { final int foo = 0; }',
- memberOf: 'X',
- );
- }
-
- test_class_field_api_tokens_typed_notSame_type() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { int foo = 0; }',
- 'class X { num foo = 1; }',
- memberOf: 'X',
- );
- }
-
- test_class_field_api_tokens_typed_same_initializer() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { int foo = 0; }',
- 'class X { int foo = 1; }',
- memberOf: 'X',
- );
- }
-
- test_class_field_api_tokens_untyped_notSame_initializer() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { var foo = 0; }',
- 'class X { var foo = 1.0; }',
- memberOf: 'X',
- );
- }
-
- test_class_field_const() async {
- var library = await buildTestLibrary(a, r'''
-class X {
- const foo = 1;
- const bar = 2;
-}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(
- aUri,
- 'X',
- NodeKind.CLASS,
- classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ExpectedNode(aUri, 'foo', NodeKind.GETTER),
- ExpectedNode(aUri, 'bar', NodeKind.GETTER),
- ],
- ),
- ]);
- }
-
- test_class_field_const_api_tokens_typed_notSame_initializer() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { const int foo = 0; }',
- 'class X { const int foo = 1; }',
- memberOf: 'X',
- );
- }
-
- test_class_field_final() async {
- var library = await buildTestLibrary(a, r'''
-class X {
- final foo = 1;
- final bar = 2;
-}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(
- aUri,
- 'X',
- NodeKind.CLASS,
- classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ExpectedNode(aUri, 'foo', NodeKind.GETTER),
- ExpectedNode(aUri, 'bar', NodeKind.GETTER),
- ],
- ),
- ]);
- }
-
- test_class_field_final_api_tokens_typed_notSame_initializer_constClass() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { final int foo = 0; const X(); }',
- 'class X { final int foo = 1; const X(); }',
- memberOf: 'X',
- );
- }
-
- test_class_field_final_api_tokens_typed_same_initializer() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { final int foo = 0; }',
- 'class X { final int foo = 1; }',
- memberOf: 'X',
- );
- }
-
- test_class_field_final_api_tokens_untyped_notSame_initializer() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { final foo = 0; }',
- 'class X { final foo = 1.0; }',
- memberOf: 'X',
- );
- }
-
- test_class_getter() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- int get foo => 0;
- int get bar => 0;
-}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(
- aUri,
- 'C',
- NodeKind.CLASS,
- classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ExpectedNode(aUri, 'foo', NodeKind.GETTER),
- ExpectedNode(aUri, 'bar', NodeKind.GETTER),
- ],
- ),
- ]);
- }
-
- test_class_getter_api_tokens_notSame_returnType() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'class X { int get foo => null; }',
- 'class X { double get foo => null; }',
- memberOf: 'X',
- );
- }
-
- test_class_method() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- void foo() {}
- void bar() {}
-}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(
- aUri,
- 'C',
- NodeKind.CLASS,
- classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ExpectedNode(aUri, 'foo', NodeKind.METHOD),
- ExpectedNode(aUri, 'bar', NodeKind.METHOD),
- ],
- ),
- ]);
- }
-
- test_class_method_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.METHOD,
- 'class X { void foo() {} }',
- 'class X { @deprecated void foo() {} }',
- memberOf: 'X',
- );
- }
-
- test_class_method_api_tokens_notSame_parameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.METHOD,
- 'class X { void foo() {} }',
- 'class X { void foo(int a) {} }',
- memberOf: 'X',
- );
- }
-
- test_class_method_api_tokens_notSame_parameter_name_edit_named() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.METHOD,
- 'class X { void foo({int a}) {} }',
- 'class X { void foo({int b}) {} }',
- memberOf: 'X',
- );
- }
-
- test_class_method_api_tokens_notSame_parameter_type() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.METHOD,
- 'class X { void foo(int a) {} }',
- 'class X { void foo(double a) {} }',
- memberOf: 'X',
- );
- }
-
- test_class_method_api_tokens_notSame_returnType() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.METHOD,
- 'class X { int foo() {} }',
- 'class X { double foo() {} }',
- memberOf: 'X',
- );
- }
-
- test_class_method_api_tokens_notSame_typeParameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.METHOD,
- 'class X { void foo() {} }',
- 'class X { void foo<T>() {} }',
- memberOf: 'X',
- );
- }
-
- test_class_method_api_tokens_notSame_typeParameter_bound_add() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.METHOD,
- 'class X { void foo<T>() {} }',
- 'class X { void foo<T extends num>() {} }',
- memberOf: 'X',
- );
- }
-
- test_class_method_api_tokens_same_async_add() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.METHOD,
- 'class X { foo() {} }',
- 'class X { foo() async {} }',
- memberOf: 'X',
- );
- }
-
- test_class_method_api_tokens_same_body() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.METHOD,
- 'class X { void foo() { print(1); } }',
- 'class X { void foo() { print(2); } }',
- memberOf: 'X',
- );
- }
-
- test_class_method_api_tokens_same_parameter_name_edit_required() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.METHOD,
- 'class X { void foo(int a) {} }',
- 'class X { void foo(int b) {} }',
- memberOf: 'X',
- );
- }
-
- test_class_setter() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- set foo(_) {}
- set bar(_) {}
-}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(
- aUri,
- 'C',
- NodeKind.CLASS,
- classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ExpectedNode(aUri, 'foo', NodeKind.SETTER),
- ExpectedNode(aUri, 'bar', NodeKind.SETTER),
- ],
- ),
- ]);
- }
-
- test_class_setter_api_tokens_notSame_returnType() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.SETTER,
- 'class X { set foo(int a) {} }',
- 'class X { set foo(double a) {} }',
- memberOf: 'X',
- );
- }
-
- test_class_setter_api_tokens_same_parameter_name() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.SETTER,
- 'class X { set foo(int a) {} }',
- 'class X { set foo(int b) {} }',
- memberOf: 'X',
- );
- }
-
- test_class_typeParameter() async {
- var library = await buildTestLibrary(a, r'''
-class A<T> {}
-class B<T, U> {}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(
- aUri,
- 'A',
- NodeKind.CLASS,
- classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ],
- classTypeParameters: [
- ExpectedNode(aUri, 'T', NodeKind.TYPE_PARAMETER),
- ],
- ),
- ExpectedNode(
- aUri,
- 'B',
- NodeKind.CLASS,
- classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ],
- classTypeParameters: [
- ExpectedNode(aUri, 'T', NodeKind.TYPE_PARAMETER),
- ExpectedNode(aUri, 'U', NodeKind.TYPE_PARAMETER),
- ],
- ),
- ]);
- }
-
- test_class_typeParameter_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'T',
- NodeKind.TYPE_PARAMETER,
- 'class X<T> {}',
- 'class X<@deprecate T> {}',
- typeParameterOf: 'X',
- );
- }
-
- test_class_typeParameter_api_tokens_notSame_bound_add() async {
- await _assertApiTokenSignatureNotSame(
- 'T',
- NodeKind.TYPE_PARAMETER,
- 'class X<T> {}',
- 'class X<T extends num> {}',
- typeParameterOf: 'X',
- );
- }
-
- test_class_typeParameter_api_tokens_notSame_bound_edit() async {
- await _assertApiTokenSignatureNotSame(
- 'T',
- NodeKind.TYPE_PARAMETER,
- 'class X<T extends num> {}',
- 'class X<T extends int> {}',
- typeParameterOf: 'X',
- );
- }
-
- test_library_export() async {
- var library = await buildTestLibrary(a, r'''
-export 'dart:math';
-export 'package:aaa/aaa.dart';
-export 'package:bbb/bbb.dart' show b1, b2 hide b3;
-''');
- _assertExports(library, [
- Export(Uri.parse('dart:math'), []),
- Export(Uri.parse('package:aaa/aaa.dart'), []),
- Export(Uri.parse('package:bbb/bbb.dart'), [
- Combinator(true, ['b1', 'b2']),
- Combinator(false, ['b3']),
- ]),
- ]);
- }
-
- test_library_import() async {
- var library = await buildTestLibrary(a, r'''
-import 'dart:math';
-import 'package:aaa/aaa.dart';
-import 'package:bbb/bbb.dart' as b;
-import 'package:ccc/ccc.dart' show c1, c2 hide c3;
-''');
- _assertImports(library, [
- Import(Uri.parse('dart:math'), null, []),
- Import(Uri.parse('package:aaa/aaa.dart'), null, []),
- Import(Uri.parse('package:bbb/bbb.dart'), 'b', []),
- Import(Uri.parse('package:ccc/ccc.dart'), null, [
- Combinator(true, ['c1', 'c2']),
- Combinator(false, ['c3']),
- ]),
- Import(Uri.parse('dart:core'), null, []),
- ]);
- }
-
- test_library_import_core_explicit() async {
- var library = await buildTestLibrary(a, r'''
-import 'dart:core' hide List;
-''');
- _assertImports(library, [
- Import(Uri.parse('dart:core'), null, [
- Combinator(false, ['List']),
- ]),
- ]);
- }
-
- test_library_import_core_implicit() async {
- var library = await buildTestLibrary(a, '');
- _assertImports(library, [
- Import(Uri.parse('dart:core'), null, []),
- ]);
- }
-
- test_unit_class() async {
- var library = await buildTestLibrary(a, r'''
-class Foo {}
-class Bar {}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'Foo', NodeKind.CLASS, classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ]),
- ExpectedNode(aUri, 'Bar', NodeKind.CLASS, classMembers: [
- ExpectedNode(aUri, '', NodeKind.CONSTRUCTOR),
- ]),
- ]);
- }
-
- test_unit_class_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X {}',
- '@deprecated class X {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_extends_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X {}',
- 'class X extends A {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_extends_edit() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X extends A {}',
- 'class X extends B {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_extends_replace() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X extends A {}',
- 'class X implements A {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_extends_typeArgument() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X extends A {}',
- 'class X extends A<int> {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_implements_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X {}',
- 'class X implements A {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_implements_edit() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X implements A {}',
- 'class X implements B {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_implements_remove() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X implements A {}',
- 'class X {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_implements_remove2() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X implements A, B {}',
- 'class X implements B {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_implements_typeArgument() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X implements A {}',
- 'class X implements A<int> {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_typeParameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X {}',
- 'class X<T> {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_typeParameter_add2() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X<T> {}',
- 'class X<T, U> {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_typeParameter_bound_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X<T> {}',
- 'class X<T extends num> {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_with_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X extends A {}',
- 'class X extends A with B {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_with_edit() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X extends A with B {}',
- 'class X extends A with C {}',
- );
- }
-
- test_unit_class_api_tokens_notSame_with_typeArgument() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS,
- 'class X extends A with B {}',
- 'class X extends A with B<int> {}',
- );
- }
-
- test_unit_class_api_tokens_same_body() async {
- await _assertApiTokenSignatureSame(
- 'X',
- NodeKind.CLASS,
- 'class X { }',
- 'class X { void foo() {} }',
- );
- }
-
- test_unit_classTypeAlias() async {
- var library = await buildTestLibrary(a, r'''
-class X = Object with M;
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'X', NodeKind.CLASS_TYPE_ALIAS),
- ]);
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_implements_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X = A with M;',
- 'class X = A with M implements I;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_implements_edit() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X = A with M implements I;',
- 'class X = A with M implements J;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_implements_remove() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X = A with M implements I;',
- 'class X = A with M;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_implements_typeArgument() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X = A with M implements I;',
- 'class X = A with M implements I<int>;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_super() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X = A with M;',
- 'class X = B with M;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_super_typeArgument() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X = A with M;',
- 'class X = A<int> with M;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_typeParameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X = A with M;',
- 'class X<T> = A with M;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_typeParameter_add2() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X<T> = A with M;',
- 'class X<T, U> = A with M;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_typeParameter_bound_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X<T> = A with M;',
- 'class X<T extends num> = A with M;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_with_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X = A with M;',
- 'class X = A with M, N;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_with_edit() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X = A with M;',
- 'class X = A with N;',
- );
- }
-
- test_unit_classTypeAlias_api_tokens_notSame_with_typeArgument() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.CLASS_TYPE_ALIAS,
- 'class X = A with M;',
- 'class X = A with M<int>;',
- );
- }
-
- test_unit_enumDeclaration() async {
- var library = await buildTestLibrary(a, r'''
-enum Foo {a, b, c}
-enum Bar {d, e, f}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(
- aUri,
- 'Foo',
- NodeKind.ENUM,
- classMembers: [
- ExpectedNode(aUri, 'a', NodeKind.GETTER),
- ExpectedNode(aUri, 'b', NodeKind.GETTER),
- ExpectedNode(aUri, 'c', NodeKind.GETTER),
- ExpectedNode(aUri, 'index', NodeKind.GETTER),
- ExpectedNode(aUri, 'values', NodeKind.GETTER),
- ],
- ),
- ExpectedNode(
- aUri,
- 'Bar',
- NodeKind.ENUM,
- classMembers: [
- ExpectedNode(aUri, 'd', NodeKind.GETTER),
- ExpectedNode(aUri, 'e', NodeKind.GETTER),
- ExpectedNode(aUri, 'f', NodeKind.GETTER),
- ExpectedNode(aUri, 'index', NodeKind.GETTER),
- ExpectedNode(aUri, 'values', NodeKind.GETTER),
- ],
- ),
- ]);
- }
-
- test_unit_function() async {
- var library = await buildTestLibrary(a, r'''
-void foo() {}
-void bar() {}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'foo', NodeKind.FUNCTION),
- ExpectedNode(aUri, 'bar', NodeKind.FUNCTION),
- ]);
- }
-
- test_unit_function_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.FUNCTION,
- 'void foo() {}',
- '@deprecated void foo() {}',
- );
- }
-
- test_unit_function_api_tokens_notSame_parameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.FUNCTION,
- 'void foo() {}',
- 'void foo(int a) {}',
- );
- }
-
- test_unit_function_api_tokens_notSame_parameter_name_edit_named() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.FUNCTION,
- 'void foo({int a}) {}',
- 'void foo({int b}) {}',
- );
- }
-
- test_unit_function_api_tokens_notSame_parameter_type() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.FUNCTION,
- 'void foo(int a) {}',
- 'void foo(double a) {}',
- );
- }
-
- test_unit_function_api_tokens_notSame_returnType() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.FUNCTION,
- 'int foo() {}',
- 'num foo() {}',
- );
- }
-
- test_unit_function_api_tokens_notSame_typeParameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.FUNCTION,
- 'void foo() {}',
- 'void foo<T>() {}',
- );
- }
-
- test_unit_function_api_tokens_notSame_typeParameter_bound_add() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.FUNCTION,
- 'void foo<T>() {}',
- 'void foo<T extends num>() {}',
- );
- }
-
- test_unit_function_api_tokens_same_async_add() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.FUNCTION,
- 'foo() {}',
- 'foo() async {}',
- );
- }
-
- test_unit_function_api_tokens_same_body() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.FUNCTION,
- 'void foo() { print(1); }',
- 'void foo() { print(2); }',
- );
- }
-
- test_unit_function_api_tokens_same_parameter_name_edit_required() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.FUNCTION,
- 'void foo(int a) {}',
- 'void foo(int b) {}',
- );
- }
-
- test_unit_function_api_tokens_same_syncStar_add() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.FUNCTION,
- 'foo() {}',
- 'foo() sync* {}',
- );
- }
-
- test_unit_functionTypeAlias() async {
- var library = await buildTestLibrary(a, r'''
-typedef void Foo();
-typedef void Bar();
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'Foo', NodeKind.FUNCTION_TYPE_ALIAS),
- ExpectedNode(aUri, 'Bar', NodeKind.FUNCTION_TYPE_ALIAS),
- ]);
- }
-
- test_unit_functionTypeAlias_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.FUNCTION_TYPE_ALIAS,
- 'typedef void Foo();',
- '@deprecated typedef void Foo();',
- );
- }
-
- test_unit_functionTypeAlias_api_tokens_notSame_parameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.FUNCTION_TYPE_ALIAS,
- 'typedef void Foo();',
- 'typedef void Foo(int a);',
- );
- }
-
- test_unit_functionTypeAlias_api_tokens_notSame_parameter_name_edit_named() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.FUNCTION_TYPE_ALIAS,
- 'typedef void Foo({int a});',
- 'typedef void Foo({int b});',
- );
- }
-
- test_unit_functionTypeAlias_api_tokens_notSame_parameter_type() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.FUNCTION_TYPE_ALIAS,
- 'typedef void Foo(int a);',
- 'typedef void Foo(double a);',
- );
- }
-
- test_unit_functionTypeAlias_api_tokens_notSame_returnType() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.FUNCTION_TYPE_ALIAS,
- 'typedef int Foo();',
- 'typedef num Foo();',
- );
- }
-
- test_unit_functionTypeAlias_api_tokens_notSame_typeParameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.FUNCTION_TYPE_ALIAS,
- 'typedef void Foo();',
- 'typedef void Foo<T>();',
- );
- }
-
- test_unit_functionTypeAlias_api_tokens_notSame_typeParameter_bound_add() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.FUNCTION_TYPE_ALIAS,
- 'typedef void Foo<T>();',
- 'typedef void Foo<T extends num>();',
- );
- }
-
- test_unit_functionTypeAlias_api_tokens_same_comment() async {
- await _assertApiTokenSignatureSame(
- 'Foo',
- NodeKind.FUNCTION_TYPE_ALIAS,
- 'typedef int Foo();',
- '/* text */ typedef int Foo();',
- );
- }
-
- test_unit_functionTypeAlias_api_tokens_same_parameter_name_edit_required() async {
- await _assertApiTokenSignatureSame(
- 'Foo',
- NodeKind.FUNCTION_TYPE_ALIAS,
- 'typedef void Foo(int a);',
- 'typedef void Foo(int b);',
- );
- }
-
- test_unit_genericTypeAlias() async {
- var library = await buildTestLibrary(a, r'''
-typedef Foo = void Function();
-typedef Bar = void Function();
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'Foo', NodeKind.GENERIC_TYPE_ALIAS),
- ExpectedNode(aUri, 'Bar', NodeKind.GENERIC_TYPE_ALIAS),
- ]);
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function();',
- '@deprecated typedef Foo = void Function();',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_parameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function();',
- 'typedef Foo = void Function(int);',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_parameter_kind() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function(int a);',
- 'typedef Foo = void Function([int a]);',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_parameter_name_add_positional() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function([int]);',
- 'typedef Foo = void Function([int a]);',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_parameter_name_edit_named() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function({int a});',
- 'typedef Foo = void Function({int b});',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_parameter_name_edit_positional() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function([int]);',
- 'typedef Foo = void Function([int a]);',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_returnType() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = int Function();',
- 'typedef Foo = double Function();',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_typeParameter2_add() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function();',
- 'typedef Foo = void Function<T>();',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_typeParameter2_bound_add() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function<T>();',
- 'typedef Foo = void Function<T extends num>();',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_typeParameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function();',
- 'typedef Foo<T> = void Function();',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_notSame_typeParameter_bound_add() async {
- await _assertApiTokenSignatureNotSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo<T> = void Function();',
- 'typedef Foo<T extends num> = void Function();',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_same_parameter_name_add_required() async {
- await _assertApiTokenSignatureSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function(int);',
- 'typedef Foo = void Function(int a);',
- );
- }
-
- test_unit_genericTypeAlias_api_tokens_same_parameter_name_edit_required() async {
- await _assertApiTokenSignatureSame(
- 'Foo',
- NodeKind.GENERIC_TYPE_ALIAS,
- 'typedef Foo = void Function(int a);',
- 'typedef Foo = void Function(int b);',
- );
- }
-
- test_unit_getter() async {
- var library = await buildTestLibrary(a, r'''
-int get foo => 0;
-int get bar => 0;
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'foo', NodeKind.GETTER),
- ExpectedNode(aUri, 'bar', NodeKind.GETTER),
- ]);
- }
-
- test_unit_getter_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'int get foo => 0;',
- '@deprecated int get foo => 0;',
- );
- }
-
- test_unit_getter_api_tokens_notSame_returnType() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'int get foo => 0;',
- 'num get foo => 0;',
- );
- }
-
- test_unit_getter_api_tokens_same_body() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.GETTER,
- 'int get foo => 0;',
- 'int get foo => 1;',
- );
- }
-
- test_unit_mixin() async {
- var library = await buildTestLibrary(a, r'''
-mixin Foo {}
-mixin Bar {}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'Foo', NodeKind.MIXIN, classMembers: const []),
- ExpectedNode(aUri, 'Bar', NodeKind.MIXIN, classMembers: const []),
- ]);
- }
-
- test_unit_mixin_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X {}',
- '@deprecated mixin X {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_implements_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X {}',
- 'mixin X implements A {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_implements_edit() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X implements A {}',
- 'mixin X implements B {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_implements_remove() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X implements A {}',
- 'mixin X {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_implements_remove2() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X implements A, B {}',
- 'mixin X implements B {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_implements_typeArgument() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X implements A {}',
- 'mixin X implements A<int> {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_on_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X {}',
- 'mixin X on A {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_on_add2() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X on A {}',
- 'mixin X on A, B {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_on_edit() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X on A {}',
- 'mixin X on B {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_on_replace() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X on A {}',
- 'mixin X implements A {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_on_typeArgument() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X on A {}',
- 'mixin X on A<int> {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_typeParameter_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X {}',
- 'mixin X<T> {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_typeParameter_add2() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X<T> {}',
- 'mixin X<T, U> {}',
- );
- }
-
- test_unit_mixin_api_tokens_notSame_typeParameter_bound_add() async {
- await _assertApiTokenSignatureNotSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X<T> {}',
- 'mixin X<T extends num> {}',
- );
- }
-
- test_unit_mixin_api_tokens_same_body() async {
- await _assertApiTokenSignatureSame(
- 'X',
- NodeKind.MIXIN,
- 'mixin X { }',
- 'mixin X { void foo() {} }',
- );
- }
-
- test_unit_setter() async {
- var library = await buildTestLibrary(a, r'''
-void set foo(_) {}
-void set bar(_) {}
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'foo=', NodeKind.SETTER),
- ExpectedNode(aUri, 'bar=', NodeKind.SETTER),
- ]);
- }
-
- test_unit_setter_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'foo=',
- NodeKind.SETTER,
- 'set foo(int a) {}',
- '@deprecated set foo(int a) {}',
- );
- }
-
- test_unit_setter_api_tokens_notSame_parameter_type() async {
- await _assertApiTokenSignatureNotSame(
- 'foo=',
- NodeKind.SETTER,
- 'set foo(int a) {}',
- 'set foo(num a) {}',
- );
- }
-
- test_unit_setter_api_tokens_same_body() async {
- await _assertApiTokenSignatureSame(
- 'foo=',
- NodeKind.SETTER,
- 'set foo(int a) { print(0); }',
- 'set foo(int a) { print(1); }',
- );
- }
-
- test_unit_variable() async {
- var library = await buildTestLibrary(a, r'''
-int a = 1;
-int b = 2, c = 3;
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'a', NodeKind.GETTER),
- ExpectedNode(aUri, 'b', NodeKind.GETTER),
- ExpectedNode(aUri, 'c', NodeKind.GETTER),
- ExpectedNode(aUri, 'a=', NodeKind.SETTER),
- ExpectedNode(aUri, 'b=', NodeKind.SETTER),
- ExpectedNode(aUri, 'c=', NodeKind.SETTER),
- ]);
- }
-
- test_unit_variable_api_tokens_notSame_annotation() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'int foo = 0;',
- '@deprecated int foo = 0;',
- );
- }
-
- test_unit_variable_api_tokens_notSame_const() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'int foo = 0;',
- 'const int foo = 0;',
- );
- }
-
- test_unit_variable_api_tokens_same_final() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.GETTER,
- 'int foo = 0;',
- 'final int foo = 0;',
- );
- }
-
- test_unit_variable_api_tokens_typed_notSame_type() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'int foo = 0;',
- 'num foo = 1;',
- );
- }
-
- test_unit_variable_api_tokens_typed_same_initializer() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.GETTER,
- 'int foo = 0;',
- 'int foo = 1;',
- );
- }
-
- test_unit_variable_api_tokens_untyped_notSame_initializer() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'var foo = 0;',
- 'var foo = 1.0;',
- );
- }
-
- test_unit_variable_const() async {
- var library = await buildTestLibrary(a, r'''
-const foo = 1;
-const bar = 2;
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'foo', NodeKind.GETTER),
- ExpectedNode(aUri, 'bar', NodeKind.GETTER),
- ]);
- }
-
- test_unit_variable_const_api_tokens_typed_notSame_initializer() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'const int foo = 0;',
- 'const int foo = 1;',
- );
- }
-
- test_unit_variable_final() async {
- var library = await buildTestLibrary(a, r'''
-final foo = 1;
-final bar = 2;
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'foo', NodeKind.GETTER),
- ExpectedNode(aUri, 'bar', NodeKind.GETTER),
- ]);
- }
-
- test_unit_variable_final_api_tokens_typed_same_initializer() async {
- await _assertApiTokenSignatureSame(
- 'foo',
- NodeKind.GETTER,
- 'final int foo = 0;',
- 'final int foo = 1;',
- );
- }
-
- test_unit_variable_final_api_tokens_untyped_notSame_initializer() async {
- await _assertApiTokenSignatureNotSame(
- 'foo',
- NodeKind.GETTER,
- 'final foo = 0;',
- 'final foo = 1.0;',
- );
- }
-
- test_unit_variable_final_withoutValue() async {
- var library = await buildTestLibrary(a, r'''
-final foo;
-final bar;
-''');
- assertNodes(library.declaredNodes, [
- ExpectedNode(aUri, 'foo', NodeKind.GETTER),
- ExpectedNode(aUri, 'bar', NodeKind.GETTER),
- ]);
- }
-
- Future<void> _assertApiTokenSignatureNotSame(
- String name, NodeKind kind, String codeBefore, String codeAfter,
- {String? memberOf, String? typeParameterOf}) async {
- Node getNodeLocal(Library library) {
- return getNode(
- library,
- name: name,
- kind: kind,
- memberOf: memberOf,
- typeParameterOf: typeParameterOf,
- );
- }
-
- var libraryBefore = await buildTestLibrary(a, codeBefore);
- var nodeBefore = getNodeLocal(libraryBefore);
-
- var libraryAfter = await buildTestLibrary(a, codeAfter);
- var nodeAfter = getNodeLocal(libraryAfter);
-
- expect(
- nodeAfter.api.tokenSignatureHex,
- isNot(nodeBefore.api.tokenSignatureHex),
- );
- }
-
- Future<void> _assertApiTokenSignatureSame(
- String name, NodeKind kind, String codeBefore, String codeAfter,
- {String? memberOf, String? typeParameterOf}) async {
- Node getNodeLocal(Library library) {
- return getNode(
- library,
- name: name,
- kind: kind,
- memberOf: memberOf,
- typeParameterOf: typeParameterOf,
- );
- }
-
- var libraryBefore = await buildTestLibrary(a, codeBefore);
- var nodeBefore = getNodeLocal(libraryBefore);
-
- var libraryAfter = await buildTestLibrary(a, codeAfter);
- var nodeAfter = getNodeLocal(libraryAfter);
-
- expect(
- nodeAfter.api.tokenSignatureHex,
- nodeBefore.api.tokenSignatureHex,
- );
- }
-
- static _assertDifferentApiTokenSignature(Node a, Node b) {
- expect(
- a.api.tokenSignatureHex,
- isNot(b.api.tokenSignatureHex),
- );
- }
-
- static void _assertExports(Library library, List<Export> expectedExports) {
- var actualExports = library.exports;
- expect(actualExports, hasLength(expectedExports.length));
- for (var i = 0; i < actualExports.length; ++i) {
- var actual = actualExports[i];
- var expected = expectedExports[i];
- if (actual.uri != expected.uri ||
- !_equalCombinators(actual.combinators, expected.combinators)) {
- fail('Expected: $expected\nActual: $actual');
- }
- }
- }
-
- static void _assertImports(Library library, List<Import> expectedImports) {
- var actualImports = library.imports;
- expect(actualImports, hasLength(expectedImports.length));
- for (var i = 0; i < actualImports.length; ++i) {
- var actual = actualImports[i];
- var expected = expectedImports[i];
- if (actual.uri != expected.uri ||
- actual.prefix != expected.prefix ||
- !_equalCombinators(actual.combinators, expected.combinators)) {
- fail('Expected: $expected\nActual: $actual');
- }
- }
- }
-
- static bool _equalCombinators(List<Combinator> actualCombinators,
- List<Combinator> expectedCombinators) {
- if (actualCombinators.length != expectedCombinators.length) {
- return false;
- }
-
- for (var i = 0; i < actualCombinators.length; i++) {
- var actualCombinator = actualCombinators[i];
- var expectedCombinator = expectedCombinators[i];
- if (actualCombinator.isShow != expectedCombinator.isShow) {
- return false;
- }
-
- var actualNames = actualCombinator.names;
- var expectedNames = expectedCombinator.names;
- if (actualNames.length != expectedNames.length) {
- return false;
- }
- for (var j = 0; j < actualNames.length; j++) {
- if (actualNames[j] != expectedNames[j]) {
- return false;
- }
- }
- }
-
- return true;
- }
-}
diff --git a/pkg/analyzer/test/src/dart/analysis/dependency/reference_collector_test.dart b/pkg/analyzer/test/src/dart/analysis/dependency/reference_collector_test.dart
deleted file mode 100644
index a705db6..0000000
--- a/pkg/analyzer/test/src/dart/analysis/dependency/reference_collector_test.dart
+++ /dev/null
@@ -1,2336 +0,0 @@
-// Copyright (c) 2018, 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 'package:analyzer/src/dart/analysis/dependency/library_builder.dart'
- hide buildLibrary;
-import 'package:analyzer/src/dart/analysis/dependency/node.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import 'base.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(ApiReferenceCollectorTest);
- defineReflectiveTests(ExpressionReferenceCollectorTest);
- defineReflectiveTests(ImplReferenceCollectorTest);
- defineReflectiveTests(ShadowReferenceCollectorTest);
- defineReflectiveTests(StatementReferenceCollectorTest);
- defineReflectiveTests(TypeReferenceCollectorTest);
- });
-}
-
-final dartCoreUri = Uri.parse('dart:core');
-
-@reflectiveTest
-class ApiReferenceCollectorTest extends _Base {
- test_class_constructor_named_body() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- C.test() {
- x;
- }
-}
-''');
- _assertApi(library, 'test', NodeKind.CONSTRUCTOR, memberOf: 'C');
- }
-
- test_class_constructor_named_parameter_defaultValue_named() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- C.test({A a = x}) {}
-}
-''');
- _assertApi(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['A']);
- }
-
- test_class_constructor_named_parameter_defaultValue_positional() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- C.test([A a = x]) {}
-}
-''');
- _assertApi(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['A']);
- }
-
- test_class_constructor_named_parameter_field_named() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- A f1;
- B f2;
- C.test({A this.f1: x, this.f2: y});
-}
-''');
- _assertApi(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['A']);
- }
-
- test_class_constructor_named_parameter_field_required() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- A f1;
- B f2;
- C.test(A this.f1, this.f2);
-}
-''');
- _assertApi(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['A']);
- }
-
- test_class_constructor_named_parameter_required() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- C.test(A a, B b) {}
-}
-''');
- _assertApi(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['A', 'B']);
- }
-
- test_class_constructor_unnamed_body() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- C() {
- x;
- }
-}
-''');
- _assertApi(library, '', NodeKind.CONSTRUCTOR, memberOf: 'C');
- }
-
- test_class_constructor_unnamed_parameter_required() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- C(A a, B b) {}
-}
-''');
- _assertApi(library, '', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['A', 'B']);
- }
-
- test_class_field_hasType() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- int test = x;
-}
-''');
- _assertApi(library, 'test', NodeKind.GETTER,
- memberOf: 'C', unprefixed: ['int']);
- _assertApi(library, 'test=', NodeKind.SETTER,
- memberOf: 'C', unprefixed: ['int']);
- }
-
- test_class_field_hasType_const() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- static const int test = x;
-}
-''');
- _assertApi(library, 'test', NodeKind.GETTER,
- memberOf: 'C', unprefixed: ['int', 'x']);
- }
-
- test_class_field_hasType_final() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- final int test = x;
-}
-''');
- _assertApi(library, 'test', NodeKind.GETTER,
- memberOf: 'C', unprefixed: ['int']);
- }
-
- test_class_field_hasType_noInitializer() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- int test;
-}
-''');
- _assertApi(library, 'test', NodeKind.GETTER,
- memberOf: 'C', unprefixed: ['int']);
- _assertApi(library, 'test=', NodeKind.SETTER,
- memberOf: 'C', unprefixed: ['int']);
- }
-
- test_class_field_noType() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- var test = x;
-}
-''');
- _assertApi(library, 'test', NodeKind.GETTER,
- memberOf: 'C', unprefixed: ['x']);
- _assertApi(library, 'test=', NodeKind.SETTER,
- memberOf: 'C', unprefixed: ['x']);
- }
-
- test_class_field_noType_const() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- static const test = x;
-}
-''');
- _assertApi(library, 'test', NodeKind.GETTER,
- memberOf: 'C', unprefixed: ['x']);
- }
-
- test_class_field_noType_final() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- final test = x;
-}
-''');
- _assertApi(library, 'test', NodeKind.GETTER,
- memberOf: 'C', unprefixed: ['x']);
- }
-
- test_class_field_noType_noInitializer() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- var test;
-}
-''');
- _assertApi(library, 'test', NodeKind.GETTER, memberOf: 'C');
- _assertApi(library, 'test=', NodeKind.SETTER, memberOf: 'C');
- }
-
- test_class_method_body() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- void test() {
- x;
- }
-}
-''');
- _assertApi(library, 'test', NodeKind.METHOD, memberOf: 'C');
- }
-
- test_class_method_parameter_defaultValue_named() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- void test({A a = x}) {}
-}
-''');
- _assertApi(library, 'test', NodeKind.METHOD,
- memberOf: 'C', unprefixed: ['A']);
- }
-
- test_class_method_parameter_defaultValue_positional() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- void test([A a = x]) {}
-}
-''');
- _assertApi(library, 'test', NodeKind.METHOD,
- memberOf: 'C', unprefixed: ['A']);
- }
-
- test_class_method_parameter_required() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- void test(A a, B b) {}
-}
-''');
- _assertApi(library, 'test', NodeKind.METHOD,
- memberOf: 'C', unprefixed: ['A', 'B']);
- }
-
- test_class_method_returnType() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- A test() {}
-}
-''');
- _assertApi(library, 'test', NodeKind.METHOD,
- memberOf: 'C', unprefixed: ['A']);
- }
-
- test_class_method_typeParameter() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- void test<T, U extends A, V extends U>(T t, U u, V v) {}
-}
-''');
- _assertApi(library, 'test', NodeKind.METHOD,
- memberOf: 'C', unprefixed: ['A']);
- }
-
- test_class_typeParameter() async {
- var library = await buildTestLibrary(a, r'''
-class X<T extends A<B, C>> {}
-''');
- _assertApi(library, 'T', NodeKind.TYPE_PARAMETER,
- typeParameterOf: 'X', unprefixed: ['A', 'B', 'C']);
- }
-
- test_unit_class() async {
- var library = await buildTestLibrary(a, r'''
-class Test<T extends A, U extends T>
- extends B<T> with C, D<E, U>
- implements F<T>, G {
- void test() {
- x
- }
-}
-''');
- _assertApi(library, 'Test', NodeKind.CLASS,
- unprefixed: ['A', 'B', 'C', 'D', 'E', 'F', 'G']);
- }
-
- test_unit_classTypeAlias() async {
- var library = await buildTestLibrary(a, r'''
-class Test = A with M1, M2 implements I1, I2;
-''');
- _assertApi(library, 'Test', NodeKind.CLASS_TYPE_ALIAS,
- unprefixed: ['A', 'I1', 'I2', 'M1', 'M2']);
- }
-
- test_unit_classTypeAlias_generic() async {
- var library = await buildTestLibrary(a, r'''
-class Test<T extends A, U extends T> = B<T> with C<U, D> implements E<T, F>;
-''');
- _assertApi(library, 'Test', NodeKind.CLASS_TYPE_ALIAS,
- unprefixed: ['A', 'B', 'C', 'D', 'E', 'F']);
- }
-
- test_unit_function_body() async {
- var library = await buildTestLibrary(a, r'''
-void test() {
- x;
-}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION);
- }
-
- test_unit_function_parameter_defaultValue_named() async {
- var library = await buildTestLibrary(a, r'''
-void test({a = x}) {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION);
- }
-
- test_unit_function_parameter_defaultValue_positional() async {
- var library = await buildTestLibrary(a, r'''
-void test([a = x]) {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION);
- }
-
- test_unit_function_parameter_named() async {
- var library = await buildTestLibrary(a, r'''
-void test({A a, B b}) {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A', 'B']);
- }
-
- test_unit_function_parameter_positional() async {
- var library = await buildTestLibrary(a, r'''
-void test([A a, B b]) {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A', 'B']);
- }
-
- test_unit_function_parameter_required() async {
- var library = await buildTestLibrary(a, r'''
-void test(A a, B b) {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A', 'B']);
- }
-
- test_unit_function_parameter_required_function() async {
- var library = await buildTestLibrary(a, r'''
-void test(A Function(B) a) {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A', 'B']);
- }
-
- test_unit_function_parameter_required_functionTyped() async {
- var library = await buildTestLibrary(a, r'''
-void test(A a(B b, C c)) {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A', 'B', 'C']);
- }
-
- test_unit_function_returnType_absent() async {
- var library = await buildTestLibrary(a, r'''
-test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION);
- }
-
- test_unit_function_returnType_interface() async {
- var library = await buildTestLibrary(a, r'''
-A test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A']);
- }
-
- test_unit_function_typeParameter() async {
- var library = await buildTestLibrary(a, r'''
-void test<T, U extends A, V extends U>(T t, U u, V v) {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A']);
- }
-
- test_unit_functionTypeAlias() async {
- var library = await buildTestLibrary(a, r'''
-typedef A<B, U> Test<T extends C, U extends T>(D d, T t, U u);
-''');
- _assertApi(library, 'Test', NodeKind.FUNCTION_TYPE_ALIAS,
- unprefixed: ['A', 'B', 'C', 'D']);
- }
-
- test_unit_functionTypeAlias_reverseOrderTypeParameters() async {
- var library = await buildTestLibrary(a, r'''
-typedef void Test<U extends T, T extends A>();
-''');
- _assertApi(library, 'Test', NodeKind.FUNCTION_TYPE_ALIAS,
- unprefixed: ['A']);
- }
-
- test_unit_genericTypeAlias_function() async {
- var library = await buildTestLibrary(a, r'''
-typedef Test<T extends A, U extends T> =
- B<T, C, V> Function<V extends D, W extends E<F, T, V>>(E, T, U, V, V, W);
-''');
- _assertApi(library, 'Test', NodeKind.GENERIC_TYPE_ALIAS,
- unprefixed: ['A', 'B', 'C', 'D', 'E', 'F']);
- }
-
- test_unit_genericTypeAlias_function_reverseOrderTypeParameters() async {
- var library = await buildTestLibrary(a, r'''
-typedef Test<U extends T, T extends A> = Function<W extends V, V extends B>();
-''');
- _assertApi(library, 'Test', NodeKind.GENERIC_TYPE_ALIAS,
- unprefixed: ['A', 'B']);
- }
-
- test_unit_mixin() async {
- var library = await buildTestLibrary(a, r'''
-mixin Test<T extends A, U extends T>
- on B<T>, C, D<E, U>
- implements F<T>, G {
- void test() {
- x
- }
-}
-''');
- _assertApi(library, 'Test', NodeKind.MIXIN,
- unprefixed: ['A', 'B', 'C', 'D', 'E', 'F', 'G']);
- }
-
- test_unit_variable_hasType() async {
- var library = await buildTestLibrary(a, r'''
-int test = x;
-''');
- _assertApi(library, 'test', NodeKind.GETTER, unprefixed: ['int']);
- _assertApi(library, 'test=', NodeKind.SETTER, unprefixed: ['int']);
- }
-
- test_unit_variable_hasType_const() async {
- var library = await buildTestLibrary(a, r'''
-const int test = x;
-''');
- _assertApi(library, 'test', NodeKind.GETTER, unprefixed: ['int', 'x']);
- }
-
- test_unit_variable_hasType_final() async {
- var library = await buildTestLibrary(a, r'''
-final int test = x;
-''');
- _assertApi(library, 'test', NodeKind.GETTER, unprefixed: ['int']);
- }
-
- test_unit_variable_hasType_noInitializer() async {
- var library = await buildTestLibrary(a, r'''
-int test;
-''');
- _assertApi(library, 'test', NodeKind.GETTER, unprefixed: ['int']);
- _assertApi(library, 'test=', NodeKind.SETTER, unprefixed: ['int']);
- }
-
- test_unit_variable_noType() async {
- var library = await buildTestLibrary(a, r'''
-var test = x;
-''');
- _assertApi(library, 'test', NodeKind.GETTER, unprefixed: ['x']);
- _assertApi(library, 'test=', NodeKind.SETTER, unprefixed: ['x']);
- }
-
- test_unit_variable_noType_const() async {
- var library = await buildTestLibrary(a, r'''
-const test = x;
-''');
- _assertApi(library, 'test', NodeKind.GETTER, unprefixed: ['x']);
- }
-
- test_unit_variable_noType_final() async {
- var library = await buildTestLibrary(a, r'''
-final test = x;
-''');
- _assertApi(library, 'test', NodeKind.GETTER, unprefixed: ['x']);
- }
-
- test_unit_variable_noType_noInitializer() async {
- var library = await buildTestLibrary(a, r'''
-var test;
-''');
- _assertApi(library, 'test', NodeKind.GETTER);
- _assertApi(library, 'test=', NodeKind.SETTER);
- }
-}
-
-@reflectiveTest
-class ExpressionReferenceCollectorTest extends _Base {
- test_adjacentStrings() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- 'foo' '$x' 'bar';
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-
- test_asExpression() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x as Y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['Y', 'x']);
- }
-
- test_assignmentExpression() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x = y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x=', 'y']);
- }
-
- test_assignmentExpression_compound() async {
- var library = await buildTestLibrary(a, r'''
-class A {
- operator+(_) {}
-}
-
-class B extends A {}
-
-B x, y;
-
-test() {
- x += y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'x=', 'y'],
- expectedMembers: [_ExpectedClassMember(aUri, 'B', '+')]);
- }
-
- test_assignmentExpression_nullAware() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x ??= y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'x=', 'y']);
- }
-
- test_awaitExpression() async {
- var library = await buildTestLibrary(a, r'''
-test() async {
- await x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-
- test_binaryExpression() async {
- var library = await buildTestLibrary(a, r'''
-class A {
- operator+(_) {}
-}
-
-class B extends A {}
-
-B x, y;
-
-test() {
- x + y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'y'],
- expectedMembers: [_ExpectedClassMember(aUri, 'B', '+')]);
- }
-
- test_binaryExpression_int() async {
- var library = await buildTestLibrary(a, r'''
-class A {
- int operator+(_) {}
-}
-
-A x;
-
-test() {
- x + 1 + 2;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: [
- 'x'
- ], expectedMembers: [
- _ExpectedClassMember(aUri, 'A', '+'),
- _ExpectedClassMember(dartCoreUri, 'int', '+'),
- ]);
- }
-
- test_binaryExpression_sort() async {
- var library = await buildTestLibrary(a, r'''
-class A {
- operator*(_) {}
-}
-
-class B {
- operator+(_) {}
-}
-
-A a;
-B b;
-
-test() {
- (b + 1) + a * 2;
-}
-''');
- _assertImpl(
- library,
- 'test',
- NodeKind.FUNCTION,
- unprefixed: ['a', 'b'],
- expectedMembers: [
- _ExpectedClassMember(aUri, 'A', '*'),
- _ExpectedClassMember(aUri, 'B', '+'),
- ],
- );
- }
-
- test_binaryExpression_super() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-class B extends A {
- test() {
- super + x;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'B', unprefixed: ['x'], superPrefixed: ['+']);
- }
-
- test_binaryExpression_super2() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-class B extends A {
- test() {
- super == x;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'B', unprefixed: ['x'], superPrefixed: ['==']);
- }
-
- test_binaryExpression_unique() async {
- var library = await buildTestLibrary(a, r'''
-class A {
- A operator+(_) => null;
-}
-
-A x;
-
-test() {
- x + 1 + 2 + 3;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', '+')]);
- }
-
- test_binaryExpression_unresolvedOperator() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-A x, y;
-
-test() {
- x + y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'y'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', '+')]);
- }
-
- test_binaryExpression_unresolvedTarget() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x + y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_booleanLiteral() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- true;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION);
- }
-
- test_cascadeExpression() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-A x;
-
-test() {
- x
- ..foo(y)
- ..bar = z;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: [
- 'x',
- 'y',
- 'z'
- ], expectedMembers: [
- _ExpectedClassMember(aUri, 'A', 'bar='),
- _ExpectedClassMember(aUri, 'A', 'foo'),
- ]);
- }
-
- test_conditionalExpression() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x ? y : z;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'y', 'z']);
- }
-
- test_doubleLiteral() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- 1.2;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION);
- }
-
- test_functionExpression() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- <T extends A, U extends T>(B b, C c, T t, U u) {
- T;
- U;
- x;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'B', 'C', 'x']);
- }
-
- test_functionExpressionInvocation() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- (x)<T>(y, z);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['T', 'x', 'y', 'z']);
- }
-
- test_indexExpression_get() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-A x;
-
-test() {
- x[y];
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'y'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', '[]')]);
- }
-
- test_indexExpression_getSet() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-A x;
-
-test() {
- x[y] += x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: [
- 'x',
- 'y'
- ], expectedMembers: [
- _ExpectedClassMember(aUri, 'A', '[]'),
- _ExpectedClassMember(aUri, 'A', '[]=')
- ]);
- }
-
- test_indexExpression_set() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-A x;
-
-test() {
- x[y] = x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'y'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', '[]=')]);
- }
-
- test_indexExpression_super_get() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- test() {
- super[x];
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'C', unprefixed: ['x'], superPrefixed: ['[]']);
- }
-
- test_indexExpression_super_getSet() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- test() {
- super[x] += y;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'C', unprefixed: ['x', 'y'], superPrefixed: ['[]', '[]=']);
- }
-
- test_indexExpression_super_set() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- test() {
- super[x] = y;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'C', unprefixed: ['x', 'y'], superPrefixed: ['[]=']);
- }
-
- test_indexExpression_unresolvedTarget() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x[y];
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_instanceCreationExpression_explicitNew_named() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-test() {
- new A<T>.named(x, b: y);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'T', 'x', 'y'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', 'named')]);
- }
-
- test_instanceCreationExpression_explicitNew_unnamed() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-test() {
- new A<T>(x, b: y);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'T', 'x', 'y'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', '')]);
- }
-
- test_instanceCreationExpression_explicitNew_unresolvedClass() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- new A<T>.named(x);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'T', 'x']);
- }
-
- test_instanceCreationExpression_implicitNew_named() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-test() {
- A<T>.named(x, b: y);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'T', 'x', 'y'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', 'named')]);
- }
-
- test_instanceCreationExpression_implicitNew_unnamed() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-test() {
- A<T>(x, b: y);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'T', 'x', 'y'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', '')]);
- }
-
- test_instanceCreationExpression_implicitNew_unresolvedClass_named() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- A<T>.named(x, b: y);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'T', 'x', 'y']);
- }
-
- test_integerLiteral() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- 0;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION);
- }
-
- test_isExpression() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x is Y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['Y', 'x']);
- }
-
- test_listLiteral() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- <A>[x, y];
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'x', 'y']);
- }
-
- test_mapLiteral() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- <A, B>{x: y, v: w};
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'B', 'v', 'w', 'x', 'y']);
- }
-
- test_methodInvocation_instance_withoutTarget_function() async {
- var library = await buildTestLibrary(a, r'''
-void foo(a, {b}) {}
-
-test() {
- foo(x, b: y);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['foo', 'x', 'y']);
- }
-
- test_methodInvocation_instance_withoutTarget_method() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- void foo(a, {b}) {}
-
- test() {
- foo(x, b: y);
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'C', unprefixed: ['foo', 'x', 'y']);
- }
-
- test_methodInvocation_instance_withTarget() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-A x;
-
-test() {
- x.foo<T>(y, b: z);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['T', 'x', 'y', 'z'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', 'foo')]);
- }
-
- test_methodInvocation_instance_withTarget_super() async {
- var library = await buildTestLibrary(a, r'''
-class A {
- void foo(a, b) {}
-}
-
-class B extends A {
- test() {
- super.foo(x, y);
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'B', unprefixed: ['x', 'y'], superPrefixed: ['foo']);
- }
-
- test_methodInvocation_static_withTarget() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-test() {
- A.foo<T>(x);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'T', 'x'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', 'foo')]);
- }
-
- test_nullLiteral() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- null;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION);
- }
-
- test_parenthesizedExpression() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- ((x));
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-
- test_postfixExpression() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-class B extend A {}
-
-B x, y;
-
-test() {
- x++;
- y--;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: [
- 'x',
- 'y'
- ], expectedMembers: [
- _ExpectedClassMember(aUri, 'B', '+'),
- _ExpectedClassMember(aUri, 'B', '-')
- ]);
- }
-
- test_postfixExpression_unresolvedTarget() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x++;
- y--;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_prefixedIdentifier_importPrefix() async {
- newFile(b, 'var b = 0;');
- var library = await buildTestLibrary(a, r'''
-import 'b.dart' as pb;
-
-test() {
- pb.b;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, prefixed: {
- 'pb': ['b']
- });
- }
-
- test_prefixedIdentifier_importPrefix_unresolvedIdentifier() async {
- newFile(b, '');
- var library = await buildTestLibrary(a, r'''
-import 'b.dart' as pb;
-
-test() {
- pb.b;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, prefixed: {
- 'pb': ['b']
- });
- }
-
- test_prefixedIdentifier_interfaceProperty() async {
- var library = await buildTestLibrary(a, r'''
-class A {
- int get y => 0;
-}
-
-class B extends A {}
-
-B x;
-test() {
- x.y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x'],
- expectedMembers: [_ExpectedClassMember(aUri, 'B', 'y')]);
- }
-
- test_prefixedIdentifier_static() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-class B extends A {}
-
-test() {
- B.x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['B'],
- expectedMembers: [_ExpectedClassMember(aUri, 'B', 'x')]);
- }
-
- test_prefixedIdentifier_unresolvedPrefix() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x.y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-
- test_prefixExpression() async {
- var library = await buildTestLibrary(a, r'''
-class A {
- operator-() {}
-}
-
-class B extend A {}
-
-B x;
-
-test() {
- -x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x'],
- expectedMembers: [_ExpectedClassMember(aUri, 'B', 'unary-')]);
- }
-
- test_prefixExpression_unresolvedOperator() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-A x;
-
-test() {
- -x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', 'unary-')]);
- }
-
- test_prefixExpression_unresolvedTarget() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- -x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-
- test_propertyAccess_get() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-A x;
-
-test() {
- (x).foo;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', 'foo')]);
- }
-
- test_propertyAccess_getSet() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-A x;
-
-test() {
- (x).foo += 1;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: [
- 'x'
- ], expectedMembers: [
- _ExpectedClassMember(aUri, 'A', 'foo'),
- _ExpectedClassMember(aUri, 'A', 'foo='),
- ]);
- }
-
- test_propertyAccess_set() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-A x;
-
-test() {
- (x).foo = 1;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', 'foo=')]);
- }
-
- test_propertyAccess_super_get() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- test() {
- super.foo;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'C', superPrefixed: ['foo']);
- }
-
- test_propertyAccess_super_getSet() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- test() {
- super.foo += 1;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'C', superPrefixed: ['foo', 'foo=']);
- }
-
- test_propertyAccess_super_set() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- test() {
- super.foo = 1;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'C', superPrefixed: ['foo=']);
- }
-
- test_rethrowExpression() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- try {
- } on A {
- rethrow;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['A']);
- }
-
- test_setLiteral() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- <A>{x, y, z};
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'x', 'y', 'z']);
- }
-
- test_simpleIdentifier() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-
- test_simpleIdentifier_sort() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- d; c; a; b; e;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['a', 'b', 'c', 'd', 'e']);
- }
-
- test_simpleIdentifier_synthetic() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x +;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-
- test_simpleIdentifier_unique() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- x; x; y; x; y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_simpleStringLiteral() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- '';
- """""";
- r"""""";
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION);
- }
-
- test_stringInterpolation() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- '$x ${y}';
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_symbolLiteral() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- #foo.bar;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION);
- }
-
- test_thisExpression() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- test() {
- this;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD, memberOf: 'C');
- }
-
- test_throwExpression() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- throw x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-}
-
-@reflectiveTest
-class ImplReferenceCollectorTest extends _Base {
- test_class_constructor() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- var f;
- C.test(A a, {b: x, this.f: y}) {
- z;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['x', 'y', 'z']);
- }
-
- test_class_constructor_factoryRedirect_named() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-class X {
- factory X.test() = A.named;
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'X',
- unprefixed: ['A'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', 'named')]);
- }
-
- test_class_constructor_factoryRedirect_named_prefixed() async {
- newFile(b, 'class A {}');
-
- var library = await buildTestLibrary(a, r'''
-import 'b.dart' as p;
-
-class X {
- factory X.test() = p.A.named;
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'X',
- prefixed: {
- 'p': ['A']
- },
- expectedMembers: [
- _ExpectedClassMember(bUri, 'A', 'named')
- ]);
- }
-
- test_class_constructor_factoryRedirect_named_unresolvedTarget() async {
- var library = await buildTestLibrary(a, r'''
-class X {
- factory X.test() = A.named;
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'X', unprefixed: ['A']);
- }
-
- test_class_constructor_factoryRedirect_unnamed() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-class X {
- factory X.test() = A;
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'X',
- unprefixed: ['A'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', '')]);
- }
-
- test_class_constructor_factoryRedirect_unnamed_prefixed() async {
- newFile(b, 'class A {}');
-
- var library = await buildTestLibrary(a, r'''
-import 'b.dart' as p;
-
-class X {
- factory X.test() = p.A;
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'X',
- prefixed: {
- 'p': ['A']
- },
- expectedMembers: [
- _ExpectedClassMember(bUri, 'A', '')
- ]);
- }
-
- test_class_constructor_factoryRedirect_unnamed_unresolvedTarget() async {
- var library = await buildTestLibrary(a, r'''
-class X {
- factory X.test() = A;
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'X', unprefixed: ['A']);
- }
-
- test_class_constructor_initializer_assert() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- C.test(a) : assert(a > x, y);
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['x', 'y']);
- }
-
- test_class_constructor_initializer_field() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- var f;
-
- C.test() : f = x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['x']);
- }
-
- test_class_constructor_initializer_super_named() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-class C extends A {
- C.test() : super.named(x);
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C',
- unprefixed: ['A', 'x'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', 'named')]);
- }
-
- test_class_constructor_initializer_super_named_unresolvedSuper() async {
- var library = await buildTestLibrary(a, r'''
-class C extends A {
- C.test() : super.named(x);
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['A', 'x']);
- }
-
- test_class_constructor_initializer_super_unnamed() async {
- var library = await buildTestLibrary(a, r'''
-class A {}
-
-class C extends A {
- C.test() : super(x);
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C',
- unprefixed: ['A', 'x'],
- expectedMembers: [_ExpectedClassMember(aUri, 'A', '')]);
- }
-
- test_class_constructor_initializer_super_unnamed_unresolvedSuper() async {
- var library = await buildTestLibrary(a, r'''
-class C extends A {
- C.test() : super(x);
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['A', 'x']);
- }
-
- test_class_constructor_initializer_this_named() async {
- var library = await buildTestLibrary(a, r'''
-class C extends A {
- C.test() : this.named(x);
-
- C.named(a);
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['x']);
- }
-
- test_class_constructor_initializer_this_unnamed() async {
- var library = await buildTestLibrary(a, r'''
-class C extends A {
- C.test() : this(x);
-
- C(a);
-}
-''');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'C', unprefixed: ['x']);
- }
-
- test_class_method() async {
- var library = await buildTestLibrary(a, r'''
-class C {
- void test(A a, {b: x}) {
- y;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'C', unprefixed: ['x', 'y']);
- }
-
- test_class_typeParameter() async {
- var library = await buildTestLibrary(a, r'''
-class C<T extends A> {}
-''');
- _assertImpl(library, 'T', NodeKind.TYPE_PARAMETER, typeParameterOf: 'C');
- }
-
- test_classTypeAlias() async {
- var library = await buildTestLibrary(a, r'''
-class Test = A with B implements C;
-''');
- _assertImpl(library, 'Test', NodeKind.CLASS_TYPE_ALIAS);
- }
-
- test_functionTypeAlias() async {
- var library = await buildTestLibrary(a, r'''
-typedef A Test<T extends B>(C c, T t);
-''');
- _assertImpl(library, 'Test', NodeKind.FUNCTION_TYPE_ALIAS);
- }
-
- test_unit_class() async {
- var library = await buildTestLibrary(a, r'''
-class Test<T extends A, U extends T> extends B with C, implements D {
- void test() {
- x;
- }
-}
-''');
- _assertImpl(library, 'Test', NodeKind.CLASS);
- }
-
- test_unit_classTypeAlias() async {
- var library = await buildTestLibrary(a, r'''
-class Test<T extends V, U extends T> = A<T> with B<U, W>;
-''');
- _assertImpl(library, 'Test', NodeKind.CLASS_TYPE_ALIAS);
- }
-
- test_unit_function() async {
- var library = await buildTestLibrary(a, r'''
-void test(A a, {b: x}) {
- y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_unit_mixin() async {
- var library = await buildTestLibrary(a, r'''
-mixin Test<T extends A, U extends T> on B<T>, C<D, U> {
- void test() {
- x;
- }
-}
-''');
- _assertImpl(library, 'Test', NodeKind.MIXIN);
- }
-
- test_unit_variable() async {
- var library = await buildTestLibrary(a, r'''
-int test = x;
-''');
- _assertImpl(library, 'test', NodeKind.GETTER, unprefixed: ['x']);
- _assertImpl(library, 'test=', NodeKind.SETTER); // empty
- }
-
- test_unit_variable_noInitializer() async {
- var library = await buildTestLibrary(a, r'''
-int test;
-''');
- _assertImpl(library, 'test', NodeKind.GETTER);
- _assertImpl(library, 'test=', NodeKind.SETTER); // empty
- }
-}
-
-@reflectiveTest
-class ShadowReferenceCollectorTest extends _Base {
- test_importPrefix_with_classMember_getter_field() async {
- var library = await buildTestLibrary(a, r'''
-import 'b.dart' as p;
-
-class X {
- p.A<B> test() {}
-
- int p;
-}
-''');
- _assertApi(library, 'test', NodeKind.METHOD,
- memberOf: 'X', unprefixed: ['B', 'p']);
- }
-
- test_importPrefix_with_classMember_method() async {
- var library = await buildTestLibrary(a, r'''
-import 'b.dart' as p;
-
-class X {
- p.A<B> test() {}
-
- p() {}
-}
-''');
- _assertApi(library, 'test', NodeKind.METHOD,
- memberOf: 'X', unprefixed: ['B', 'p']);
- }
-
- test_importPrefix_with_function() async {
- var library = await buildTestLibrary(a, r'''
-import 'b.dart' as p;
-
-p() {} // this is a compilation error
-
-class X extends p.A<B> {}
-''');
- _assertApi(library, 'X', NodeKind.CLASS, unprefixed: [
- 'B'
- ], prefixed: {
- 'p': ['A']
- });
- }
-
- test_syntacticScope_class_constructor() async {
- var library = await buildTestLibrary(a, r'''
-class X {
- X.test(A a, X b) {
- X;
- }
-}
-''');
- _assertApi(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'X', unprefixed: ['A']);
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR, memberOf: 'X');
- }
-
- test_syntacticScope_class_constructor_parameters() async {
- var library = await buildTestLibrary(a, r'''
-class X {
- X.test(a, b, c) {
- a; b; c;
- d;
- }
-}
-''');
- _assertApi(library, 'test', NodeKind.CONSTRUCTOR, memberOf: 'X');
- _assertImpl(library, 'test', NodeKind.CONSTRUCTOR,
- memberOf: 'X', unprefixed: ['d']);
- }
-
- test_syntacticScope_class_field() async {
- var library = await buildTestLibrary(a, r'''
-class X {
- var test = x + X + test;
-}
-''');
- _assertApi(library, 'test', NodeKind.GETTER,
- memberOf: 'X', unprefixed: ['x']);
- _assertImpl(library, 'test', NodeKind.GETTER,
- memberOf: 'X', unprefixed: ['x']);
- }
-
- test_syntacticScope_class_method() async {
- var library = await buildTestLibrary(a, r'''
-class X {
- test(A a, X b, test c) {
- X;
- test;
- B;
- }
-}
-''');
- _assertApi(library, 'test', NodeKind.METHOD,
- memberOf: 'X', unprefixed: ['A']);
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'X', unprefixed: ['B']);
- }
-
- test_syntacticScope_class_method_parameters() async {
- var library = await buildTestLibrary(a, r'''
-class X {
- test(a, b, c) {
- a; b; c;
- d;
- }
-}
-''');
- _assertApi(library, 'test', NodeKind.METHOD, memberOf: 'X');
- _assertImpl(library, 'test', NodeKind.METHOD,
- memberOf: 'X', unprefixed: ['d']);
- }
-
- test_syntacticScope_class_typeParameter_ofClass() async {
- var library = await buildTestLibrary(a, r'''
-class X<T extends A<B, X, T>> {}
-''');
- _assertApi(library, 'T', NodeKind.TYPE_PARAMETER,
- typeParameterOf: 'X', unprefixed: ['A', 'B']);
- }
-
- test_syntacticScope_unit_class() async {
- var library = await buildTestLibrary(a, r'''
-class X extends A<B, X> {}
-''');
- _assertApi(library, 'X', NodeKind.CLASS, unprefixed: ['A', 'B']);
- }
-
- test_syntacticScope_unit_function() async {
- var library = await buildTestLibrary(a, r'''
-test(A a, test b) {
- test;
- B;
-}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A']);
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['B']);
- }
-
- test_syntacticScope_unit_function_parameters() async {
- var library = await buildTestLibrary(a, r'''
-test(a, b, {c}) {
- a; b; c;
- d;
-}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION);
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['d']);
- }
-
- test_syntacticScope_unit_functionTypeAlias() async {
- var library = await buildTestLibrary(a, r'''
-typedef X(A a, X b);
-''');
- _assertApi(library, 'X', NodeKind.FUNCTION_TYPE_ALIAS, unprefixed: ['A']);
- }
-
- test_syntacticScope_unit_mixin() async {
- var library = await buildTestLibrary(a, r'''
-mixin X on A<B, X> {}
-''');
- _assertApi(library, 'X', NodeKind.MIXIN, unprefixed: ['A', 'B']);
- }
-}
-
-@reflectiveTest
-class StatementReferenceCollectorTest extends _Base {
- test_assertStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- assert(x, y);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_block_localScope() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- var x = 0;
- {
- var y = 0;
- {
- x;
- y;
- }
- x;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION);
- }
-
- test_breakStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- while (true) {
- break;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION);
- }
-
- test_continueStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- while (true) {
- continue;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION);
- }
-
- test_doStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- do {
- x;
- } while (y);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_emptyStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- while (true);
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION);
- }
-
- test_forEachStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- for (A a in x) {
- a;
- y;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'x', 'y']);
- }
-
- test_forEachStatement_body_singleStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- for (var a in x) a;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-
- test_forEachStatement_iterableAsLoopVariable() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- for (A x in x) {
- y;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'x', 'y']);
- }
-
- test_forEachStatement_loopIdentifier() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- for (x in y) {
- z;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'y', 'z']);
- }
-
- test_forStatement_initialization() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- for (x; y; z) {
- z2;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'y', 'z', 'z2']);
- }
-
- test_forStatement_variables() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- for (A a = x, b = y, c = a; z; a, b, z2) {
- z3;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'x', 'y', 'z', 'z2', 'z3']);
- }
-
- test_functionDeclarationStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- A foo(B b) {
- x;
- C;
- b;
- foo();
- }
- foo();
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'B', 'C', 'x']);
- }
-
- test_ifStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- if (x) {
- y;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_ifStatement_else() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- if (x) {
- y;
- } else {
- z;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'y', 'z']);
- }
-
- test_labeledStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- label: x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-
- test_returnStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- return x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-
- test_switchStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- switch (x) {
- case y:
- var local1 = 1;
- z;
- local1;
- break;
- default:
- var local2 = 2;
- z2;
- local2;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['x', 'y', 'z', 'z2']);
- }
-
- test_switchStatement_localScopePerCase() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- switch (0) {
- case 0:
- var v1 = 1;
- var v2 = 2;
- v1;
- v2;
- default:
- v1;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['v1']);
- }
-
- test_tryStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- try {
- var local1 = 1;
- x;
- local1;
- } finally {
- var local2 = 2;
- y;
- local2;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_tryStatement_catch() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- try {
- var local1 = 1;
- x;
- local1;
- } on A {
- var local2 = 2;
- y;
- local2;
- } on B catch (ex1) {
- var local3 = 3;
- z;
- ex1;
- local3;
- } catch (ex2, st2) {
- ex2;
- st2;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'B', 'x', 'y', 'z']);
- }
-
- test_variableDeclarationStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- var a = x, b = y;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_whileStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() {
- while (x) {
- y;
- }
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x', 'y']);
- }
-
- test_yieldStatement() async {
- var library = await buildTestLibrary(a, r'''
-test() sync* {
- yield x;
-}
-''');
- _assertImpl(library, 'test', NodeKind.FUNCTION, unprefixed: ['x']);
- }
-}
-
-@reflectiveTest
-class TypeReferenceCollectorTest extends _Base {
- test_dynamic() async {
- var library = await buildTestLibrary(a, r'''
-dynamic test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION);
- }
-
- test_function() async {
- var library = await buildTestLibrary(a, r'''
-A Function(B) test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A', 'B']);
- }
-
- test_function_generic() async {
- var library = await buildTestLibrary(a, r'''
-A Function<T, U extends B>(T t, C c, D<T> d, E e) test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'B', 'C', 'D', 'E']);
- }
-
- test_function_nested_generic() async {
- var library = await buildTestLibrary(a, r'''
-A Function<T>(B Function<U>(U, C, T) f, D) test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'B', 'C', 'D']);
- }
-
- test_function_parameter_named() async {
- var library = await buildTestLibrary(a, r'''
-A Function({B, C}) test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A', 'B', 'C']);
- }
-
- test_function_parameter_positional() async {
- var library = await buildTestLibrary(a, r'''
-A Function([B, C]) test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A', 'B', 'C']);
- }
-
- test_function_shadow_typeParameters() async {
- var library = await buildTestLibrary(a, r'''
-A Function<T2 extends U2, U2>(B) test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A', 'B']);
- }
-
- test_interface_generic() async {
- var library = await buildTestLibrary(a, r'''
-A<B, C<D>> test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION,
- unprefixed: ['A', 'B', 'C', 'D']);
- }
-
- test_interface_prefixed() async {
- var library = await buildTestLibrary(a, r'''
-import 'b.dart' as pb;
-import 'c.dart' as pc;
-A<pb.B2, pc.C2, pb.B1, pc.C1, pc.C3> test() {}
-''');
- _assertApi(
- library,
- 'test',
- NodeKind.FUNCTION,
- unprefixed: ['A'],
- prefixed: {
- 'pb': ['B1', 'B2'],
- 'pc': ['C1', 'C2', 'C3']
- },
- );
- }
-
- test_interface_simple() async {
- var library = await buildTestLibrary(a, r'''
-A test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION, unprefixed: ['A']);
- }
-
- test_void() async {
- var library = await buildTestLibrary(a, r'''
-void test() {}
-''');
- _assertApi(library, 'test', NodeKind.FUNCTION);
- }
-}
-
-class _Base extends BaseDependencyTest {
- void _assertApi(Library library, String name, NodeKind kind,
- {String? memberOf,
- String? typeParameterOf,
- List<String> unprefixed = const [],
- Map<String, List<String>> prefixed = const {},
- List<String> superPrefixed = const [],
- List<_ExpectedClassMember> expectedMembers = const []}) {
- var node = getNode(
- library,
- name: name,
- kind: kind,
- memberOf: memberOf,
- typeParameterOf: typeParameterOf,
- );
- _assertDependencies(
- node.api,
- unprefixed: unprefixed,
- prefixed: prefixed,
- superPrefixed: superPrefixed,
- expectedMembers: expectedMembers,
- );
- }
-
- void _assertDependencies(Dependencies dependencies,
- {List<String> unprefixed = const [],
- Map<String, List<String>> prefixed = const {},
- List<String> superPrefixed = const [],
- List<_ExpectedClassMember> expectedMembers = const []}) {
- expect(dependencies.unprefixedReferencedNames, unprefixed);
- expect(dependencies.importPrefixes, prefixed.keys);
- expect(dependencies.importPrefixedReferencedNames, prefixed.values);
- expect(dependencies.superReferencedNames, superPrefixed);
-
- var actualMembers = dependencies.classMemberReferences;
- if (actualMembers.length != expectedMembers.length) {
- fail('Expected: $expectedMembers\nActual: $actualMembers');
- }
- expect(actualMembers, hasLength(expectedMembers.length));
- for (var i = 0; i < actualMembers.length; i++) {
- var actualMember = actualMembers[i];
- var expectedMember = expectedMembers[i];
- if (actualMember.target.libraryUri != expectedMember.targetUri ||
- actualMember.target.name != expectedMember.targetName ||
- actualMember.name != expectedMember.name) {
- fail('Expected: $expectedMember\nActual: $actualMember');
- }
- }
- }
-
- void _assertImpl(Library library, String name, NodeKind kind,
- {String? memberOf,
- String? typeParameterOf,
- List<String> unprefixed = const [],
- Map<String, List<String>> prefixed = const {},
- List<String> superPrefixed = const [],
- List<_ExpectedClassMember> expectedMembers = const []}) {
- var node = getNode(
- library,
- name: name,
- kind: kind,
- memberOf: memberOf,
- typeParameterOf: typeParameterOf,
- );
- _assertDependencies(
- node.impl,
- unprefixed: unprefixed,
- prefixed: prefixed,
- superPrefixed: superPrefixed,
- expectedMembers: expectedMembers,
- );
- }
-}
-
-class _ExpectedClassMember {
- final Uri targetUri;
- final String targetName;
- final String name;
-
- _ExpectedClassMember(
- this.targetUri,
- this.targetName,
- this.name,
- );
-
- @override
- String toString() {
- return '($targetUri, $targetName, $name)';
- }
-}
diff --git a/pkg/analyzer/test/src/dart/analysis/dependency/test_all.dart b/pkg/analyzer/test/src/dart/analysis/dependency/test_all.dart
deleted file mode 100644
index 9ddb5bd..0000000
--- a/pkg/analyzer/test/src/dart/analysis/dependency/test_all.dart
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) 2018, 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 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import 'declared_nodes_test.dart' as declared_nodes_test;
-import 'reference_collector_test.dart' as reference_collector_test;
-
-main() {
- defineReflectiveSuite(() {
- declared_nodes_test.main();
- reference_collector_test.main();
- }, name: 'dependency');
-}
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
index 82158be..1901bb3 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
@@ -810,6 +810,7 @@
operator: >>>
rightOperand: IntegerLiteral
literal: 3
+ parameter: self::@class::A::@method::>>>::@parameter::amount
staticType: int
staticElement: self::@class::A::@method::>>>
staticInvokeType: A Function(int)
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 5ceb724..7cc3008 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -2548,7 +2548,7 @@
expect(driver.knownFiles, contains(p));
}
- test_part_getErrors_afterLibrary() async {
+ test_partOfName_getErrors_afterLibrary() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
var c = convertPath('/test/lib/c.dart');
@@ -2584,7 +2584,7 @@
}
}
- test_part_getErrors_beforeLibrary() async {
+ test_partOfName_getErrors_beforeLibrary() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
var c = convertPath('/test/lib/c.dart');
@@ -2614,7 +2614,7 @@
}
}
- test_part_getResult_afterLibrary() async {
+ test_partOfName_getResult_afterLibrary() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
var c = convertPath('/test/lib/c.dart');
@@ -2653,7 +2653,7 @@
}
}
- test_part_getResult_beforeLibrary() async {
+ test_partOfName_getResult_beforeLibrary() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
var c = convertPath('/test/lib/c.dart');
@@ -2684,7 +2684,7 @@
_assertTopLevelVarType(result.unit, 'b', 'B');
}
- test_part_getResult_changePart_invalidatesLibraryCycle() async {
+ test_partOfName_getResult_changePart_invalidatesLibraryCycle() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
newFile(a, r'''
@@ -2710,19 +2710,44 @@
expect(result.errors, isEmpty);
}
- test_part_getResult_noLibrary() async {
- final c = newFile('/test/lib/c.dart', r'''
-part of a;
-class C {}
+ test_partOfName_getResult_hasLibrary_noPart() async {
+ final a = newFile('/test/lib/a.dart', r'''
+library my.lib;
''');
- // There is no library which c.dart is a part of, so invalid result.
- final result = await driver.getResult(c.path);
- result as PartWithoutLibraryResult;
- expect(result.path, c.path);
+ final c = newFile('/test/lib/c.dart', r'''
+part of my.lib;
+final a = A();
+''');
+
+ // Discover the library.
+ driver.getFileSync(a.path);
+
+ // There is no library which c.dart is a part of, so `A` is unresolved.
+ ResolvedUnitResult result = await driver.getResultValid(c.path);
+ expect(result.errors, isNotEmpty);
+ expect(result.unit, isNotNull);
}
- test_part_getUnitElement_afterLibrary() async {
+ test_partOfName_getResult_noLibrary() async {
+ var c = convertPath('/test/lib/c.dart');
+ newFile(c, r'''
+part of a;
+class C {}
+var a = new A();
+var b = new B();
+''');
+
+ driver.addFile(c);
+
+ // There is no library which c.dart is a part of, so it has unresolved
+ // A and B references.
+ ResolvedUnitResult result = await driver.getResultValid(c);
+ expect(result.errors, isNotEmpty);
+ expect(result.unit, isNotNull);
+ }
+
+ test_partOfName_getUnitElement_afterLibrary() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
var c = convertPath('/test/lib/c.dart');
@@ -2762,7 +2787,7 @@
}
}
- test_part_getUnitElement_beforeLibrary() async {
+ test_partOfName_getUnitElement_beforeLibrary() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
var c = convertPath('/test/lib/c.dart');
@@ -2799,18 +2824,32 @@
}
}
- test_part_getUnitElement_noLibrary() async {
- final c = newFile('/test/lib/c.dart', r'''
+ test_partOfName_getUnitElement_noLibrary() async {
+ var c = convertPath('/test/lib/c.dart');
+ newFile(c, r'''
part of a;
+var a = new A();
+var b = new B();
''');
- // We don't know the library of c.dart, so invalid result.
- var result = await driver.getUnitElement(c.path);
- result as PartWithoutLibraryResult;
- expect(result.path, c.path);
+ driver.addFile(c);
+
+ // We don't know the library of c.dart, but we should get a result.
+ // The types "A" and "B" are unresolved.
+ {
+ var result = await driver.getUnitElement(c);
+ result as UnitElementResult;
+ var partUnit = result.element;
+
+ expect(partUnit.topLevelVariables[0].name, 'a');
+ assertType(partUnit.topLevelVariables[0].type, 'dynamic');
+
+ expect(partUnit.topLevelVariables[1].name, 'b');
+ assertType(partUnit.topLevelVariables[1].type, 'dynamic');
+ }
}
- test_part_results_afterLibrary() async {
+ test_partOfName_results_afterLibrary() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
var c = convertPath('/test/lib/c.dart');
@@ -2846,20 +2885,19 @@
// Update a.dart so that c.dart is not a part.
{
- allResults.clear();
-
modifyFile(a, '// does not use c.dart anymore');
driver.changeFile(a);
await waitForIdleWithoutExceptions();
- // Now c.dart does not know the library, so invalid result.
- allResults
- .whereType<PartWithoutLibraryResult>()
- .lastWhere((r) => r.path == c);
+ // Now c.dart does not have a library context, so A and B cannot be
+ // resolved, so there are errors.
+ var result =
+ allResults.whereType<ErrorsResult>().lastWhere((r) => r.path == c);
+ expect(result.errors, isNotEmpty);
}
}
- test_part_results_beforeLibrary() async {
+ test_partOfName_results_beforeLibrary() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
var c = convertPath('/test/lib/c.dart');
@@ -2894,7 +2932,7 @@
expect(result.errors, isEmpty);
}
- test_part_results_noLibrary() async {
+ test_partOfName_results_noLibrary() async {
var c = convertPath('/test/lib/c.dart');
newFile(c, r'''
part of a;
@@ -2907,13 +2945,14 @@
await waitForIdleWithoutExceptions();
- // We don't know the library for `c.dart`, so report an invalid result.
- allResults
- .whereType<PartWithoutLibraryResult>()
- .lastWhere((result) => result.path == c);
+ // There is no library which c.dart is a part of, so it has unresolved
+ // A and B references.
+ var result =
+ allResults.whereType<ErrorsResult>().lastWhere((r) => r.path == c);
+ expect(result.errors, isNotEmpty);
}
- test_part_results_noLibrary_priority() async {
+ test_partOfName_results_noLibrary_priority() async {
var c = newFile('/test/lib/c.dart', r'''
part of a;
class C {}
@@ -2926,13 +2965,15 @@
await waitForIdleWithoutExceptions();
- // We don't know the library for `c.dart`, so report an invalid result.
- allResults
- .whereType<PartWithoutLibraryResult>()
+ // There is no library which c.dart is a part of, so it has unresolved
+ // A and B references.
+ final result = allResults
+ .whereType<ResolvedUnitResult>()
.lastWhere((result) => result.path == c.path);
+ expect(result.errors, isNotEmpty);
}
- test_part_results_priority_beforeLibrary() async {
+ test_partOfName_results_priority_beforeLibrary() async {
var a = convertPath('/test/lib/a.dart');
var b = convertPath('/test/lib/b.dart');
var c = convertPath('/test/lib/c.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 0070cbe..c0b0ac1 100644
--- a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
@@ -129,6 +129,416 @@
return driverFor(file.path).fsState;
}
+ test_newFile_augmentation_augmentationExists_hasImport() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+import augment 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'a.dart';
+import augment 'c.dart';
+''');
+
+ final c = newFile('$testPackageLibPath/c.dart', r'''
+library augment 'b.dart';
+''');
+
+ final cState = fileStateFor(c);
+ // We have not asked for `b.dart` yet, but it was found using URI.
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile.path, b.path);
+ expect(kind.augmented?.path, b.path);
+ });
+
+ final bState = fileStateFor(b);
+ _assertAugmentationFiles(bState, [c]);
+ // We have not asked for `a.dart` yet, but it was found using URI.
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile.path, a.path);
+ expect(kind.augmented?.path, a.path);
+ });
+ // Check `c.dart` again, now using the `b.dart` state.
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(bState));
+ expect(kind.augmented, same(bState));
+ });
+
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, [b]);
+ // Check `b.dart` again, now using the `a.dart` state.
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+ }
+
+ test_newFile_augmentation_augmentationExists_hasImport_disconnected() async {
+ final a = getFile('$testPackageLibPath/a.dart');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'a.dart';
+import augment 'c.dart';
+''');
+
+ final c = newFile('$testPackageLibPath/c.dart', r'''
+library augment 'b.dart';
+''');
+
+ final cState = fileStateFor(c);
+ // We have not asked for `b.dart` yet, but it was found using URI.
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile.path, b.path);
+ expect(kind.augmented?.path, b.path);
+ });
+
+ final bState = fileStateFor(b);
+ _assertAugmentationFiles(bState, [c]);
+ // We have not asked for `a.dart` yet, but it was found using URI.
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile.path, a.path);
+ // The file `a.dart` does not exist, so no import, so `null`.
+ expect(kind.augmented, isNull);
+ });
+ // Check `c.dart` again, now using the `b.dart` state.
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(bState));
+ expect(kind.augmented, same(bState));
+ });
+
+ // The file `a.dart` does not exist.
+ final aState = fileStateFor(a);
+ expect(aState.exists, isFalse);
+ _assertAugmentationFiles(aState, []);
+ // Check `b.dart` again, now using the `a.dart` state.
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ // The URI can be resolved, it points at `a.dart` file.
+ expect(kind.uriFile, same(aState));
+ // The file `a.dart` does not exist, so no import, so `null`.
+ expect(kind.augmented, isNull);
+ });
+ }
+
+ test_newFile_augmentation_augmentationExists_noImport() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+import augment 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'a.dart';
+''');
+
+ final c = newFile('$testPackageLibPath/c.dart', r'''
+library augment 'b.dart';
+''');
+
+ // We found `b.dart` from the augmentation file `c.dart`.
+ final cState = fileStateFor(c);
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile.path, b.path);
+ // `b.dart` does not import `c.dart` as an augmentation.
+ expect(kind.augmented, isNull);
+ });
+
+ // Reading `a.dart` does not change anything.
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, [b]);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
+ });
+
+ // `b.dart` does not import `c.dart` as an augmentation.
+ final bState = fileStateFor(b);
+ _assertAugmentationFiles(bState, []);
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+
+ // Check `c.dart` again, now using the `b.dart` state.
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(bState));
+ expect(kind.augmented, isNull);
+ });
+ }
+
+ test_newFile_augmentation_cycle1_augmentSelf() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+import augment 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'b.dart';
+import augment 'b.dart';
+''');
+
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, [b]);
+
+ // We can construct a cycle using augmentations.
+ final bState = fileStateFor(b);
+ _assertAugmentationFiles(bState, [b]);
+ bState.assertKind((bKind) {
+ bKind as AugmentationKnownFileStateKind;
+ expect(bKind.uriFile, same(bState));
+ expect(bKind.augmented, same(bState));
+ });
+
+ // The cycle does not prevent building of the library cycle.
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
+ // TODO(scheglov) ask for the cycle signature
+ });
+ }
+
+ test_newFile_augmentation_cycle2() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+import augment 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'a.dart';
+import augment 'c.dart';
+''');
+
+ final c = newFile('$testPackageLibPath/c.dart', r'''
+library augment 'b.dart';
+import augment 'b.dart';
+''');
+
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, [b]);
+
+ final bState = fileStateFor(b);
+ _assertAugmentationFiles(bState, [c]);
+
+ final cState = fileStateFor(c);
+ _assertAugmentationFiles(cState, [b]);
+
+ // We can construct a cycle using augmentations.
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(bState));
+ expect(kind.augmented, same(bState));
+ });
+
+ // The cycle does not prevent building of the library cycle.
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
+ // TODO(scheglov) ask for the cycle signature
+ });
+ }
+
+ test_newFile_augmentation_invalid() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+library augment 'da:';
+''');
+
+ // The URI is invalid, so there is no way to discover the target.
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as AugmentationUnknownFileStateKind;
+ expect(kind.directive.uri, 'da:');
+ });
+ }
+
+ test_newFile_augmentation_libraryExists_hasImport() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+import augment 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'a.dart';
+''');
+
+ final bState = fileStateFor(b);
+ // We have not asked for `a.dart` yet, but it was found using URI.
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile.path, a.path);
+ expect(kind.augmented?.path, a.path);
+ });
+
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, [b]);
+ // Check `b.dart` again, now using the `a.dart` state.
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+ }
+
+ test_newFile_augmentation_libraryExists_noImport() async {
+ final a = newFile('$testPackageLibPath/a.dart', '');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'a.dart';
+''');
+
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, []);
+
+ final bState = fileStateFor(b);
+ // We can find `a.dart` using the URI.
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ // But `a.dart` does not import `b.dart`.
+ expect(kind.augmented, isNull);
+ });
+
+ // Refreshing `a.dart` does not change anything.
+ aState.refresh();
+ _assertAugmentationFiles(aState, []);
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, isNull);
+ });
+ }
+
+ test_newFile_augmentation_targetNotExists() async {
+ final a = getFile('$testPackageLibPath/a.dart');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'a.dart';
+''');
+
+ final bState = fileStateFor(b);
+ // We can find `a.dart` from `b.dart` using the URI.
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile.path, a.path);
+ // The file `a.dart` does not exist, so no import.
+ expect(kind.augmented, isNull);
+ });
+
+ // We can get `a.dart`, but it does not exist.
+ final aState = fileStateFor(a);
+ expect(aState.exists, isFalse);
+ _assertAugmentationFiles(aState, []);
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ // The file `a.dart` does not exist, so no import.
+ expect(kind.augmented, isNull);
+ });
+ }
+
+ test_newFile_augmentation_twoLibraries() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+import augment 'c.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+import augment 'c.dart';
+''');
+
+ final c = newFile('$testPackageLibPath/c.dart', r'''
+library augment 'a.dart';
+''');
+
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, [c]);
+
+ // We use the URI from `library augment` to find the augmentation target.
+ final cState = fileStateFor(c);
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+
+ // Reading `b.dart` does not update the augmentation.
+ final bState = fileStateFor(b);
+ _assertAugmentationFiles(bState, [c]);
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+
+ // Refreshing `a.dart` does not update the augmentation.
+ aState.refresh();
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+
+ // Refreshing `b.dart` does not update the augmentation.
+ bState.refresh();
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+
+ // Exclude from `a.dart`, the URI still points at `a.dart`.
+ // But `c.dart` is not a valid augmentation anymore.
+ newFile(a.path, '');
+ aState.refresh();
+ _assertAugmentationFiles(aState, []);
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, isNull);
+ });
+
+ // Exclude from `b.dart`, still point at `a.dart`, still not valid.
+ newFile(b.path, '');
+ bState.refresh();
+ _assertAugmentationFiles(bState, []);
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, isNull);
+ });
+
+ // Include into `b.dart`, still point at `a.dart`, still not valid.
+ newFile(b.path, r'''
+import augment 'c.dart';
+''');
+ bState.refresh();
+ _assertAugmentationFiles(bState, [c]);
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, isNull);
+ });
+
+ // Include into `a.dart`, restore to `a.dart` as the target.
+ newFile(a.path, r'''
+import augment 'c.dart';
+''');
+ aState.refresh();
+ _assertAugmentationFiles(aState, [c]);
+ cState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+ }
+
test_newFile_library_includePart_withoutPartOf() async {
final a = newFile('$testPackageLibPath/a.dart', r'''
part 'b.dart';
@@ -141,6 +551,7 @@
final aState = fileStateFor(a);
aState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
});
// Library `a.dart` includes `b.dart` as a part.
@@ -150,6 +561,7 @@
final bState = fileStateFor(b);
bState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
});
// Refreshing the library does not change this.
@@ -157,36 +569,7 @@
_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));
+ expect(kind.name, isNull);
});
}
@@ -198,6 +581,7 @@
final aState = fileStateFor(a);
aState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, 'my');
});
}
@@ -207,6 +591,7 @@
final aState = fileStateFor(a);
aState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
});
}
@@ -225,20 +610,24 @@
// 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;
+ kind as PartOfNameFileStateKind;
expect(kind.directive.name, 'my.lib');
+ expect(kind.libraries, isEmpty);
+ expect(kind.library, isNull);
});
// Read the library file.
final aState = fileStateFor(a);
aState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, 'my.lib');
});
_assertPartedFiles(aState, [b]);
// Now the part knows its library.
bState.assertKind((kind) {
- kind as PartKnownFileStateKind;
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([aState]);
expect(kind.library, same(aState));
});
}
@@ -256,117 +645,184 @@
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;
+ kind as PartOfNameFileStateKind;
expect(kind.directive.name, 'other.lib');
+ kind.assertLibraries([]);
+ expect(kind.library, isNull);
});
// Read the library file.
final aState = fileStateFor(a);
aState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, 'my.lib');
});
_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.
+ // We still don't know the library, because the part wants `other.lib`,
+ // but `a.dart` that includes `b.dart` has the name `my.lib`.
bState.assertKind((kind) {
- kind as PartKnownFileStateKind;
- expect(kind.library, same(aState));
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([]);
+ expect(kind.library, isNull);
});
}
test_newFile_partOfName_twoLibraries() async {
final a = newFile('$testPackageLibPath/a.dart', r'''
+library my.lib;
part 'c.dart';
''');
final b = newFile('$testPackageLibPath/b.dart', r'''
+library my.lib;
part 'c.dart';
''');
final c = newFile('$testPackageLibPath/c.dart', r'''
-part of 'doesNotMatter.dart';
+part of my.lib;
''');
final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, 'my.lib');
+ });
_assertPartedFiles(aState, [c]);
// We set the library while reading `a.dart` file.
final cState = fileStateFor(c);
cState.assertKind((kind) {
- kind as PartKnownFileStateKind;
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([aState]);
expect(kind.library, aState);
});
// Reading `b.dart` does not update the part.
final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, 'my.lib');
+ });
_assertPartedFiles(bState, [c]);
cState.assertKind((kind) {
- kind as PartKnownFileStateKind;
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([aState, bState]);
expect(kind.library, aState);
});
// Refreshing `b.dart` does not update the part.
bState.refresh();
cState.assertKind((kind) {
- kind as PartKnownFileStateKind;
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([aState, bState]);
expect(kind.library, aState);
});
- // Exclude the part from `a.dart` - switches to `b.dart` as its library.
+ // Refreshing `a.dart` does not update the part.
+ aState.refresh();
+ cState.assertKind((kind) {
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([aState, bState]);
+ expect(kind.library, aState);
+ });
+
+ // Exclude the part from `a.dart`, switch to `b.dart` instead.
newFile(a.path, '');
aState.refresh();
cState.assertKind((kind) {
- kind as PartKnownFileStateKind;
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([bState]);
expect(kind.library, bState);
});
- // Exclude the part from `b.dart` as well - switches to unknown.
+ // Exclude the part from `b.dart`, no library.
newFile(b.path, '');
bState.refresh();
cState.assertKind((kind) {
- kind as PartUnknownUriFileStateKind;
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([]);
+ expect(kind.library, isNull);
+ });
+
+ // Include into `b.dart`, use it as the library.
+ newFile(b.path, r'''
+library my.lib;
+part 'c.dart';
+''');
+ bState.refresh();
+ cState.assertKind((kind) {
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([bState]);
+ expect(kind.library, bState);
+ });
+
+ // Include into `a.dart`, switch to `a.dart`.
+ newFile(a.path, r'''
+library my.lib;
+part 'c.dart';
+''');
+ aState.refresh();
+ cState.assertKind((kind) {
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([aState, bState]);
+ expect(kind.library, aState);
});
}
test_newFile_partOfUri_doesNotExist() async {
+ final a = getFile('$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.
+ // The URI in `part of URI` tells us which library to use.
+ // However it does not exist, so it does not include the file, so the
+ // part file will not be analyzed during the library analysis.
bState.assertKind((kind) {
- kind as PartUnknownUriFileStateKind;
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile.path, a.path);
+ expect(kind.library, isNull);
});
- // Create the library that includes the part file.
- final a = newFile('$testPackageLibPath/a.dart', r'''
+ final aState = fileStateFor(a);
+ expect(aState.exists, isFalse);
+ _assertPartedFiles(aState, []);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+ bState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.library, isNull);
+ });
+
+ // Create `a.dart` that includes the part file.
+ newFile(a.path, 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;
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
expect(kind.library, same(aState));
});
// Refreshing the part file does not break the kind.
bState.refresh();
bState.assertKind((kind) {
- kind as PartKnownFileStateKind;
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
expect(kind.library, same(aState));
});
}
@@ -381,38 +837,51 @@
''');
final bState = fileStateFor(b);
+ // We have not read the library file explicitly yet.
+ // But it was read because of the `part of` directive.
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]);
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile.path, a.path);
+ expect(kind.library?.path, a.path);
+ });
+
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
+ _assertPartedFiles(aState, [b]);
+ bState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
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);
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
expect(kind.library, same(aState));
});
}
test_newFile_partOfUri_exists_noPart() async {
- newFile('$testPackageLibPath/a.dart', '');
+ final a = newFile('$testPackageLibPath/a.dart', '');
final b = newFile('$testPackageLibPath/b.dart', r'''
part of 'a.dart';
''');
+ final aState = fileStateFor(a);
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.
+ // The URI in `part of URI` tells us which library to use.
+ // However `a.dart` does not include `b.dart` as a part, so `b.dart` will
+ // not be analyzed during the library analysis.
bState.assertKind((kind) {
- kind as PartUnknownUriFileStateKind;
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.library, isNull);
});
}
@@ -425,19 +894,265 @@
// The URI is invalid, so there is no way to discover the library.
bState.assertKind((kind) {
- kind as PartUnknownUriFileStateKind;
+ kind as PartOfUriUnknownFileStateKind;
expect(kind.directive.uri, 'da:');
});
- // But reading a library that includes this part will update it.
+ // Reading a library that includes this part does not change the fact
+ // that the URI in the `part of URI` in `b.dart` cannot be resolved.
final a = newFile('$testPackageLibPath/a.dart', r'''
part 'b.dart';
''');
final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ });
_assertPartedFiles(aState, [b]);
bState.assertKind((kind) {
- kind as PartKnownFileStateKind;
+ kind as PartOfUriUnknownFileStateKind;
+ expect(kind.directive.uri, 'da:');
+ });
+ }
+
+ test_newFile_partOfUri_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 'a.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 PartOfUriKnownFileStateKind;
+ expect(kind.library, aState);
+ });
+
+ // Reading `b.dart` does not update the part.
+ final bState = fileStateFor(b);
+ _assertPartedFiles(bState, [c]);
+ cState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.library, aState);
+ });
+
+ // Refreshing `b.dart` does not update the part.
+ bState.refresh();
+ cState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.library, aState);
+ });
+
+ // Refreshing `a.dart` does not update the part.
+ aState.refresh();
+ cState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.library, aState);
+ });
+
+ // Exclude the part from `a.dart`, but the URI in `part of` still resolves
+ // to `a.dart`, so no changes.
+ newFile(a.path, '');
+ aState.refresh();
+ cState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.library, isNull);
+ });
+
+ // Exclude the part from `b.dart`, no changes.
+ newFile(b.path, '');
+ bState.refresh();
+ cState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.library, isNull);
+ });
+
+ // Include into `b.dart`, no changes.
+ newFile(b.path, r'''
+part 'c.dart';
+''');
+ bState.refresh();
+ cState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.library, isNull);
+ });
+
+ // Include into `a.dart`, no changes.
+ newFile(a.path, r'''
+part 'c.dart';
+''');
+ aState.refresh();
+ cState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.library, aState);
+ });
+ }
+
+ test_refresh_augmentation_to_library() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+import augment 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'a.dart';
+''');
+
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, [b]);
+
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+
+ // Make it a library.
+ newFile(b.path, '');
+
+ // Not an augmentation anymore, but a library.
+ bState.refresh();
+ bState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
+ });
+
+ // But `a.dart` still uses `b.dart` as an augmentation.
+ _assertAugmentationFiles(aState, [b]);
+
+ // ...even if we attempt to refresh.
+ aState.refresh();
+ _assertAugmentationFiles(aState, [b]);
+ }
+
+ test_refresh_augmentation_to_partOfName() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+library my.lib;
+import augment 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'a.dart';
+''');
+
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, [b]);
+
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+
+ // Make it a part.
+ newFile(b.path, r'''
+part of my.lib;
+''');
+
+ // Not an augmentation anymore, but a part.
+ // This part can find the referenced library by name `my.lib`.
+ // But the library does not include this part, so no library.
+ bState.refresh();
+ bState.assertKind((kind) {
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([aState]);
+ expect(kind.library, isNull);
+ });
+
+ // But `a.dart` still uses `b.dart` as an augmentation.
+ _assertAugmentationFiles(aState, [b]);
+ _assertPartedFiles(aState, []);
+
+ // ...even if we attempt to refresh.
+ aState.refresh();
+ _assertAugmentationFiles(aState, [b]);
+ _assertPartedFiles(aState, []);
+
+ // Now include `b.dart` into `a.dart` as a part.
+ newFile(a.path, r'''
+library my.lib;
+part 'b.dart';
+''');
+ aState.refresh();
+
+ // ...not an augmentation, but a known part.
+ _assertAugmentationFiles(aState, []);
+ _assertPartedFiles(aState, [b]);
+ bState.assertKind((kind) {
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([aState]);
+ expect(kind.library, same(aState));
+ });
+ }
+
+ test_refresh_augmentation_to_partOfUri() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+import augment 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library augment 'a.dart';
+''');
+
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, [b]);
+
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.augmented, same(aState));
+ });
+
+ // Make it a part.
+ newFile(b.path, r'''
+part of 'a.dart';
+''');
+
+ // Not an augmentation anymore, but a part.
+ bState.refresh();
+ bState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.library, isNull);
+ });
+
+ // But `a.dart` still uses `b.dart` as an augmentation.
+ _assertAugmentationFiles(aState, [b]);
+ _assertPartedFiles(aState, []);
+
+ // ...even if we attempt to refresh.
+ aState.refresh();
+ _assertAugmentationFiles(aState, [b]);
+ _assertPartedFiles(aState, []);
+
+ // Now include `b.dart` into `a.dart` as a part.
+ newFile(a.path, r'''
+part 'b.dart';
+''');
+ aState.refresh();
+
+ // ...not an augmentation, but a known part.
+ _assertAugmentationFiles(aState, []);
+ _assertPartedFiles(aState, [b]);
+ bState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
expect(kind.library, same(aState));
});
}
@@ -460,6 +1175,7 @@
final cState = fileStateFor(c);
cState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, 'my');
});
_assertPartedFiles(cState, [a, b]);
@@ -468,12 +1184,14 @@
// Both part files know the library.
aState.assertKind((kind) {
- kind as PartKnownFileStateKind;
- expect(kind.library, cState);
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([cState]);
+ expect(kind.library, same(cState));
});
bState.assertKind((kind) {
- kind as PartKnownFileStateKind;
- expect(kind.library, cState);
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([cState]);
+ expect(kind.library, same(cState));
});
newFile(c.path, r'''
@@ -485,24 +1203,27 @@
cState.refresh();
_assertPartedFiles(cState, [b]);
- // So, the `a.dart` does not know its library anymore.
- // But `b.dart` still knows it.
+ // The library does not include `a.dart` as a part anymore.
+ // The part `b.dart` is still connected.
aState.assertKind((kind) {
- kind as PartUnknownNameFileStateKind;
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([cState]);
+ expect(kind.library, isNull);
});
bState.assertKind((kind) {
- kind as PartKnownFileStateKind;
- expect(kind.library, cState);
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([cState]);
+ expect(kind.library, same(cState));
});
}
test_refresh_library_removePart_partOfUri() async {
final a = newFile('$testPackageLibPath/a.dart', r'''
-part of 'test.dart';
+part of 'c.dart';
''');
final b = newFile('$testPackageLibPath/b.dart', r'''
-part of 'test.dart';
+part of 'c.dart';
''');
final c = newFile('$testPackageLibPath/c.dart', r'''
@@ -514,6 +1235,7 @@
final cState = fileStateFor(c);
cState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, 'my');
});
_assertPartedFiles(cState, [a, b]);
@@ -522,11 +1244,13 @@
// Both part files know the library.
aState.assertKind((kind) {
- kind as PartKnownFileStateKind;
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, cState);
expect(kind.library, cState);
});
bState.assertKind((kind) {
- kind as PartKnownFileStateKind;
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, cState);
expect(kind.library, cState);
});
@@ -539,19 +1263,63 @@
cState.refresh();
_assertPartedFiles(cState, [b]);
- // So, the `a.dart` does not know its library anymore.
- // But `b.dart` still knows it.
+ // But the URIs in the `part of URI` are still the same.
+ // So, both parts are still linked to the library.
aState.assertKind((kind) {
- kind as PartUnknownUriFileStateKind;
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(cState));
+ expect(kind.library, isNull);
});
bState.assertKind((kind) {
- kind as PartKnownFileStateKind;
- expect(kind.library, cState);
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, cState);
+ expect(kind.library, same(cState));
});
}
+ test_refresh_library_to_augmentation() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+import augment 'b.dart';
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library b;
+''');
+
+ final aState = fileStateFor(a);
+ _assertAugmentationFiles(aState, [b]);
+
+ // TODO(scheglov) Restore.
+ // final aCycle_1 = aState.libraryCycle;
+
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, 'b');
+ });
+
+ newFile(b.path, r'''
+library augment 'a.dart';
+''');
+
+ // We will discover the target by URI.
+ bState.refresh();
+ bState.assertKind((kind) {
+ kind as AugmentationKnownFileStateKind;
+ expect(kind.uriFile, aState);
+ expect(kind.augmented, same(aState));
+ });
+
+ // The file `b.dart` was something else, but now it is a known augmentation.
+ // This affects libraries that include it.
+ // TODO(scheglov) Restore.
+ // final aCycle_2 = aState.libraryCycle;
+ // expect(aCycle_2.apiSignature, isNot(aCycle_1.apiSignature));
+ }
+
test_refresh_library_to_partOfName() async {
final a = newFile('$testPackageLibPath/a.dart', r'''
+library my.lib;
part 'b.dart';
''');
@@ -568,6 +1336,7 @@
final bState = fileStateFor(b);
bState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
});
// Make it a part.
@@ -575,11 +1344,12 @@
part of my.lib;
''');
- // We will discover the library, by asking each of them.
+ // We will discover the library by name.
bState.refresh();
bState.assertKind((kind) {
- kind as PartKnownFileStateKind;
- expect(kind.library, same(aState));
+ kind as PartOfNameFileStateKind;
+ kind.assertLibraries([aState]);
+ expect(kind.library, aState);
});
// The file `b.dart` was something else, but now it is a known part.
@@ -596,6 +1366,7 @@
final aState = fileStateFor(a);
aState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, 'my');
});
newFile(a.path, r'''
@@ -606,8 +1377,10 @@
// No library that includes it, so it stays unknown.
aState.assertKind((kind) {
- kind as PartUnknownNameFileStateKind;
+ kind as PartOfNameFileStateKind;
expect(kind.directive.name, 'my');
+ kind.assertLibraries([]);
+ expect(kind.library, isNull);
});
}
@@ -628,16 +1401,18 @@
final bState = fileStateFor(b);
bState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, 'b');
});
newFile(b.path, r'''
part of 'a.dart';
''');
- // We will discover the library, by asking each of them.
+ // We will discover the library using the URI.
bState.refresh();
bState.assertKind((kind) {
- kind as PartKnownFileStateKind;
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
expect(kind.library, same(aState));
});
@@ -647,6 +1422,71 @@
expect(aCycle_2.apiSignature, isNot(aCycle_1.apiSignature));
}
+ test_refresh_partOfName_twoLibraries() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part of my.lib;
+class A1 {}
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+library my.lib;
+part 'a.dart';
+''');
+
+ final c = newFile('$testPackageLibPath/c.dart', r'''
+library my.lib;
+part 'a.dart';
+''');
+
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, 'my.lib');
+ });
+ _assertPartedFiles(bState, [a]);
+
+ final cState = fileStateFor(c);
+ cState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, 'my.lib');
+ });
+ _assertPartedFiles(cState, [a]);
+
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as PartOfNameFileStateKind;
+ expect(kind.directive.name, 'my.lib');
+ kind.assertLibraries([bState, cState]);
+ expect(kind.library, same(bState));
+ });
+
+ final bCycle_1 = bState.libraryCycle;
+ final cCycle_1 = cState.libraryCycle;
+
+ // Update `a.dart` part.
+ newFile(a.path, r'''
+part of my.lib;
+class A2 {}
+''');
+ aState.refresh();
+ // `a.dart` is still a part.
+ aState.assertKind((kind) {
+ kind as PartOfNameFileStateKind;
+ expect(kind.directive.name, 'my.lib');
+ kind.assertLibraries([bState, cState]);
+ expect(kind.library, same(bState));
+ });
+
+ // ...but the unlinked signature of `a.dart` is different.
+ // We invalidate `b.dart` it references `a.dart`.
+ // We invalidate `c.dart` it references `a.dart`.
+ // Even though `a.dart` is not a valid part of `c.dart`.
+ final bCycle_2 = bState.libraryCycle;
+ final cCycle_2 = cState.libraryCycle;
+ expect(bCycle_2.apiSignature, isNot(bCycle_1.apiSignature));
+ expect(cCycle_2.apiSignature, isNot(cCycle_1.apiSignature));
+ }
+
test_refresh_partOfUri_to_library() async {
final a = newFile('$testPackageLibPath/a.dart', r'''
part 'b.dart';
@@ -659,6 +1499,7 @@
final aState = fileStateFor(a);
aState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
});
_assertPartedFiles(aState, [b]);
@@ -667,8 +1508,9 @@
// 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);
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(aState));
+ expect(kind.library, same(aState));
});
// There are no directives in `b.dart`, so it is a library.
@@ -678,6 +1520,7 @@
bState.refresh();
bState.assertKind((kind) {
kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
});
// Library `a.dart` still considers `b.dart` its part.
@@ -688,6 +1531,76 @@
expect(aCycle_2.apiSignature, isNot(aCycle_1.apiSignature));
}
+ test_refresh_partOfUri_twoLibraries() async {
+ final a = newFile('$testPackageLibPath/a.dart', r'''
+part of 'b.dart';
+class A1 {}
+''');
+
+ final b = newFile('$testPackageLibPath/b.dart', r'''
+part 'a.dart';
+''');
+
+ final c = newFile('$testPackageLibPath/c.dart', r'''
+part 'a.dart';
+''');
+
+ final bState = fileStateFor(b);
+ bState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
+ });
+ _assertPartedFiles(bState, [a]);
+
+ final cState = fileStateFor(c);
+ cState.assertKind((kind) {
+ kind as LibraryFileStateKind;
+ expect(kind.name, isNull);
+ });
+ _assertPartedFiles(cState, [a]);
+
+ final aState = fileStateFor(a);
+ aState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(bState));
+ expect(kind.library, same(bState));
+ });
+
+ final bCycle_1 = bState.libraryCycle;
+ final cCycle_1 = cState.libraryCycle;
+
+ // Update `a.dart` part.
+ newFile(a.path, r'''
+part of 'b.dart';
+class A2 {}
+''');
+ aState.refresh();
+ // `a.dart` is still a part.
+ aState.assertKind((kind) {
+ kind as PartOfUriKnownFileStateKind;
+ expect(kind.uriFile, same(bState));
+ expect(kind.library, same(bState));
+ });
+
+ // ...but the unlinked signature of `a.dart` is different.
+ // We invalidate `b.dart` it references `a.dart`.
+ // We invalidate `c.dart` it references `a.dart`.
+ // Even though `a.dart` is not a valid part of `c.dart`.
+ final bCycle_2 = bState.libraryCycle;
+ final cCycle_2 = cState.libraryCycle;
+ expect(bCycle_2.apiSignature, isNot(bCycle_1.apiSignature));
+ expect(cCycle_2.apiSignature, isNot(cCycle_1.apiSignature));
+ }
+
+ void _assertAugmentationFiles(FileState fileState, List<File> expected) {
+ final actualFiles = fileState.augmentationFiles.map((part) {
+ if (part != null) {
+ return getFile(part.path);
+ }
+ }).toList();
+ expect(actualFiles, expected);
+ }
+
void _assertPartedFiles(FileState fileState, List<File> expected) {
final actualFiles = fileState.partedFiles.map((part) {
if (part != null) {
@@ -1043,8 +1956,7 @@
expect(file_a2.library, same(file_a1));
// Now update the library, and refresh its file.
- // The 'a2.dart' is not referenced anymore.
- // So the part file does not have the library anymore.
+ // The library does not include this part, so no library.
newFile(a1, r'''
library a1;
part 'not-a2.dart';
@@ -1545,6 +2457,15 @@
}
}
+extension on PartOfNameFileStateKind {
+ void assertLibraries(Iterable<FileState> expectedFiles) {
+ final expectedKinds = expectedFiles.map((e) {
+ return e.kind as LibraryFileStateKind;
+ }).toList();
+ expect(libraries, unorderedEquals(expectedKinds));
+ }
+}
+
extension _Either2Extension<T1, T2> on Either2<T1, T2> {
T1 get t1 {
late T1 result;
diff --git a/pkg/analyzer/test/src/dart/analysis/test_all.dart b/pkg/analyzer/test/src/dart/analysis/test_all.dart
index 2c5030d..10ff606 100644
--- a/pkg/analyzer/test/src/dart/analysis/test_all.dart
+++ b/pkg/analyzer/test/src/dart/analysis/test_all.dart
@@ -12,7 +12,6 @@
import 'context_root_test.dart' as context_root;
import 'crc32_test.dart' as crc32_test;
import 'defined_names_test.dart' as defined_names;
-import 'dependency/test_all.dart' as dependency_test;
import 'driver_caching_test.dart' as driver_caching;
import 'driver_resolution_test.dart' as driver_resolution;
import 'driver_test.dart' as driver;
@@ -42,7 +41,6 @@
context_root.main();
crc32_test.main();
defined_names.main();
- dependency_test.main();
driver.main();
driver_caching.main();
driver_resolution.main();
diff --git a/pkg/analyzer/test/src/dart/analysis/unlinked_api_signature_test.dart b/pkg/analyzer/test/src/dart/analysis/unlinked_api_signature_test.dart
index 21157c3..4e29972 100644
--- a/pkg/analyzer/test/src/dart/analysis/unlinked_api_signature_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/unlinked_api_signature_test.dart
@@ -1010,6 +1010,16 @@
''');
}
+ test_executable_body_block_to_native() {
+ _assertNotSameSignature_executable(r'''
+int foo() {
+ return 0;
+}
+''', r'''
+int foo() native;
+''');
+ }
+
test_executable_body_expression() {
_assertSameSignature_executable(r'''
int foo() => 1;
@@ -1028,6 +1038,32 @@
''');
}
+ test_executable_body_expression_to_native() {
+ _assertNotSameSignature_executable(r'''
+int foo() => 0;
+''', r'''
+int foo() native;
+''');
+ }
+
+ test_executable_body_native_to_block() {
+ _assertNotSameSignature_executable(r'''
+int foo() native;
+''', r'''
+int foo() {
+ return 0;
+}
+''');
+ }
+
+ test_executable_body_native_to_expression() {
+ _assertNotSameSignature_executable(r'''
+int foo() native;
+''', r'''
+int foo() => 0;
+''');
+ }
+
test_executable_body_sync_to_async() {
_assertNotSameSignature_executable(r'''
foo() {}
diff --git a/pkg/analyzer/test/src/dart/element/element_test.dart b/pkg/analyzer/test/src/dart/element/element_test.dart
index 6873d5f..0f13ac7 100644
--- a/pkg/analyzer/test/src/dart/element/element_test.dart
+++ b/pkg/analyzer/test/src/dart/element/element_test.dart
@@ -524,14 +524,14 @@
(library1.definingCompilationUnit).classes = <ClassElement>[classElement];
LibraryElementImpl library2 =
ElementFactory.library(analysisContext, "lib2");
- expect(classElement.isAccessibleIn(library2), isFalse);
+ expect(classElement.isAccessibleIn2(library2), isFalse);
}
void test_isAccessibleIn_private_sameLibrary() {
LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
ClassElement classElement = ElementFactory.classElement2("_C");
(library.definingCompilationUnit).classes = <ClassElement>[classElement];
- expect(classElement.isAccessibleIn(library), isTrue);
+ expect(classElement.isAccessibleIn2(library), isTrue);
}
void test_isAccessibleIn_public_differentLibrary() {
@@ -541,14 +541,14 @@
(library1.definingCompilationUnit).classes = <ClassElement>[classElement];
LibraryElementImpl library2 =
ElementFactory.library(analysisContext, "lib2");
- expect(classElement.isAccessibleIn(library2), isTrue);
+ expect(classElement.isAccessibleIn2(library2), isTrue);
}
void test_isAccessibleIn_public_sameLibrary() {
LibraryElementImpl library = ElementFactory.library(analysisContext, "lib");
ClassElement classElement = ElementFactory.classElement2("C");
(library.definingCompilationUnit).classes = <ClassElement>[classElement];
- expect(classElement.isAccessibleIn(library), isTrue);
+ expect(classElement.isAccessibleIn2(library), isTrue);
}
void test_isPrivate_false() {
diff --git a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
index 2a5f408..a694e0b 100644
--- a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
@@ -100,6 +100,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -107,6 +108,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@method::[]
readType: int
@@ -141,6 +143,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -148,6 +151,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@method::[]
readType: int
@@ -182,6 +186,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -189,6 +194,7 @@
operator: +=
rightHandSide: DoubleLiteral
literal: 2.0
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: double
readElement: self::@class::A::@method::[]
readType: num
@@ -223,6 +229,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -230,6 +237,7 @@
operator: ??=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: self::@class::A::@method::[]
readType: int?
@@ -263,6 +271,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -270,6 +279,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::A::@method::[]=::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -305,6 +315,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -312,6 +323,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@method::[]
readType: int
@@ -345,6 +357,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -352,6 +365,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@method::[]
readType: int
@@ -384,6 +398,7 @@
leftBracket: [
index: SimpleIdentifier
token: b
+ parameter: <null>
staticElement: <null>
staticType: dynamic
rightBracket: ]
@@ -392,6 +407,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: int
readElement: <null>
@@ -425,6 +441,7 @@
leftBracket: [
index: SimpleIdentifier
token: b
+ parameter: <null>
staticElement: <null>
staticType: dynamic
rightBracket: ]
@@ -433,6 +450,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: int
readElement: <null>
@@ -469,6 +487,7 @@
leftBracket: [
index: SimpleIdentifier
token: b
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticElement: <null>
staticType: dynamic
rightBracket: ]
@@ -477,6 +496,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: c
+ parameter: self::@class::A::@method::[]=::@parameter::_
staticElement: self::@function::f::@parameter::c
staticType: int
readElement: <null>
@@ -510,6 +530,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::+
@@ -518,6 +539,7 @@
operator: +=
rightHandSide: SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: double
readElement: <null>
@@ -553,6 +575,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::+
@@ -563,6 +586,7 @@
operator: +=
rightHandSide: SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: double
readElement: <null>
@@ -598,6 +622,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::+
@@ -608,6 +633,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: double
readElement: <null>
@@ -648,6 +674,7 @@
operator: +=
rightHandSide: SimpleIdentifier
token: y
+ parameter: <null>
staticElement: self::@function::f::@parameter::y
staticType: int
readElement: <null>
@@ -688,6 +715,7 @@
operator: ??=
rightHandSide: SimpleIdentifier
token: y
+ parameter: <null>
staticElement: self::@function::f::@parameter::y
staticType: int
readElement: <null>
@@ -728,6 +756,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: y
+ parameter: <null>
staticElement: self::@function::f::@parameter::y
staticType: int
readElement: <null>
@@ -768,6 +797,7 @@
operator: +=
rightHandSide: SimpleIdentifier
token: y
+ parameter: <null>
staticElement: self::@function::f::@parameter::y
staticType: int
readElement: <null>
@@ -808,6 +838,7 @@
operator: ??=
rightHandSide: SimpleIdentifier
token: y
+ parameter: <null>
staticElement: self::@function::f::@parameter::y
staticType: int
readElement: <null>
@@ -848,6 +879,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: y
+ parameter: <null>
staticElement: self::@function::f::@parameter::y
staticType: int
readElement: <null>
@@ -883,6 +915,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -915,6 +948,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -967,6 +1001,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::x
readType: int
@@ -1008,6 +1043,7 @@
operator: ??=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: self::@class::A::@getter::x
readType: int?
@@ -1048,6 +1084,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::A::@setter::x::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -1090,6 +1127,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -1130,6 +1168,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::A::@setter::x::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -1172,6 +1211,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -1214,6 +1254,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: package:test/a.dart::@getter::x
readType: int
@@ -1257,6 +1298,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::x
readType: int
@@ -1295,6 +1337,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: int
readElement: <null>
@@ -1335,6 +1378,7 @@
operator: +=
rightHandSide: SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: int
readElement: <null>
@@ -1372,6 +1416,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::x
readType: int
@@ -1424,6 +1469,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::A::@setter::x::@parameter::_x
staticType: int
readElement: <null>
readType: null
@@ -1468,6 +1514,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::x
readType: int
@@ -1520,6 +1567,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::M2::@getter::x
readType: int
@@ -1564,6 +1612,7 @@
operator: ??=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: self::@class::A::@getter::x
readType: int?
@@ -1607,6 +1656,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::A::@setter::x::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -1651,6 +1701,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::x
readType: int
@@ -1690,6 +1741,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::x
readType: int
@@ -1731,6 +1783,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: int
readElement: <null>
@@ -1773,6 +1826,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: int
readElement: <null>
@@ -1806,6 +1860,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@setter::x::@parameter::_x
staticType: int
readElement: <null>
readType: null
@@ -1838,6 +1893,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@setter::x::@parameter::_x
staticType: int
readElement: <null>
readType: null
@@ -1872,6 +1928,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -1906,6 +1963,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -1938,6 +1996,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -1977,6 +2036,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2009,6 +2069,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2039,6 +2100,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 3
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: x@51
readType: num
@@ -2069,6 +2131,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2101,6 +2164,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2133,6 +2197,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2161,6 +2226,7 @@
operator: ??=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
readElement: self::@function::f::@parameter::x
readType: num?
@@ -2205,6 +2271,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: <null>
staticType: C
readElement: self::@function::f::@parameter::x
readType: B?
@@ -2235,6 +2302,7 @@
operator: ??=
rightHandSide: SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: int
readElement: self::@function::f::@parameter::a
@@ -2301,6 +2369,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2331,6 +2400,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: <null>
staticType: double
readElement: <null>
readType: null
@@ -2361,6 +2431,7 @@
operator: =
rightHandSide: BooleanLiteral
literal: true
+ parameter: <null>
staticType: bool
readElement: <null>
readType: null
@@ -2391,6 +2462,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2430,6 +2502,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2469,6 +2542,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2503,6 +2577,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::A::@setter::x::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -2533,6 +2608,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: y
+ parameter: <null>
staticElement: self::@function::f::@parameter::y
staticType: int
readElement: <null>
@@ -2570,6 +2646,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::A::@setter::x::@parameter::_x
staticType: int
readElement: <null>
readType: null
@@ -2603,6 +2680,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::C::@getter::x
readType: int
@@ -2643,6 +2721,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::M2::@getter::x
readType: int
@@ -2676,6 +2755,7 @@
operator: ??=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: self::@class::C::@getter::x
readType: int?
@@ -2715,6 +2795,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2746,6 +2827,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@getter::x
readType: int
@@ -2793,6 +2875,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: <null>
staticType: C
readElement: self::@getter::x
readType: B?
@@ -2826,6 +2909,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@getter::x
readType: int
@@ -2856,6 +2940,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@setter::x::@parameter::_x
staticType: int
readElement: <null>
readType: null
@@ -2888,6 +2973,7 @@
operator: =
rightHandSide: BooleanLiteral
literal: true
+ parameter: self::@setter::x::@parameter::_x
staticType: bool
readElement: <null>
readType: null
@@ -2920,6 +3006,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -2950,6 +3037,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 3
+ parameter: <null>
staticType: int
readElement: dart:core::@class::int
readType: dynamic
@@ -2980,6 +3068,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -3010,6 +3099,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: <null>
staticType: int
readElement: <null>
readType: dynamic
@@ -3040,6 +3130,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: int
readElement: <null>
diff --git a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
index 6a8b233..f2100ef 100644
--- a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
@@ -399,6 +399,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::•::@parameter::a
+ substitution: {T: int, U: String}
staticType: int
rightParenthesis: )
staticType: A<int, String>
@@ -464,6 +467,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@function::A::@parameter::a
+ substitution: {T: int, U: String}
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -521,6 +527,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::•::@parameter::_
+ substitution: {T: int, U: String}
staticType: int
rightParenthesis: )
staticType: A<int, String>
@@ -590,6 +599,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@constructor::named::@parameter::a
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticType: A<int>
@@ -658,6 +670,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@constructor::named::@parameter::a
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticType: A<int>
@@ -726,6 +741,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@constructor::•::@parameter::a
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticType: A<int>
@@ -774,6 +792,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: package:test/a.dart::@class::A::@method::bar::@parameter::a
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -831,6 +850,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@constructor::named::@parameter::a
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticType: A<int>
@@ -873,6 +895,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::named::@parameter::a
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticType: A<int>
@@ -936,6 +961,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::named::@parameter::a
+ substitution: {T: dynamic, U: dynamic}
staticType: int
rightParenthesis: )
staticType: A<dynamic, dynamic>
@@ -999,6 +1027,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::•::@parameter::a
+ substitution: {T: dynamic, U: dynamic}
staticType: int
rightParenthesis: )
staticType: A<dynamic, dynamic>
@@ -1077,6 +1108,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@constructor::•::@parameter::a
+ substitution: {T: int, U: String}
staticType: int
rightParenthesis: )
staticType: A<int, String>
@@ -1158,6 +1192,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@function::A::@parameter::a
+ substitution: {T: int, U: String}
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -1206,6 +1243,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::named::@parameter::a
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticType: A<int>
diff --git a/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart
index a848c7c..4d89bf3 100644
--- a/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart
@@ -36,6 +36,9 @@
arguments
NullLiteral
literal: null
+ parameter: ParameterMember
+ base: root::@parameter::t
+ substitution: {T: int?}
staticType: Null
rightParenthesis: )
staticInvokeType: int? Function(int?)
@@ -45,6 +48,7 @@
operator: ??
rightOperand: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
staticElement: <null>
staticInvokeType: null
@@ -68,6 +72,7 @@
operator: ??
rightOperand: SimpleIdentifier
token: y
+ parameter: <null>
staticElement: self::@function::f::@parameter::y
staticType: int
staticElement: <null>
@@ -92,6 +97,7 @@
operator: ??
rightOperand: SimpleIdentifier
token: y
+ parameter: <null>
staticElement: self::@function::f::@parameter::y
staticType: double?
staticElement: <null>
@@ -116,6 +122,7 @@
operator: ??
rightOperand: SimpleIdentifier
token: x
+ parameter: <null>
staticElement: self::@function::f::@parameter::x
staticType: int?
staticElement: <null>
@@ -140,6 +147,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: Never
staticElement: dart:core::@class::num::@method::+
@@ -167,6 +175,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: <null>
@@ -193,6 +202,7 @@
operator: !=
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::==::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::==
@@ -224,6 +234,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: int
rightParenthesis: )
@@ -232,6 +243,7 @@
operator: !=
rightOperand: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
staticElement: <null>
staticInvokeType: null
@@ -257,6 +269,7 @@
operator: !==
rightOperand: SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: <null>
@@ -281,6 +294,7 @@
operator: ==
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::==::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::==
@@ -312,6 +326,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: int
rightParenthesis: )
@@ -320,6 +335,7 @@
operator: ==
rightOperand: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
staticElement: <null>
staticInvokeType: null
@@ -345,6 +361,7 @@
operator: ===
rightOperand: SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: <null>
@@ -370,6 +387,7 @@
operator: ??
rightOperand: SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: double
staticElement: <null>
@@ -394,6 +412,7 @@
operator: &&
rightOperand: SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: bool
staticElement: <null>
@@ -418,6 +437,7 @@
operator: ||
rightOperand: SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: bool
staticElement: <null>
@@ -455,6 +475,7 @@
operator: -
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::-::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: double
staticElement: dart:core::@class::num::@method::-
@@ -479,6 +500,7 @@
operator: -
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::-::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::-
@@ -516,6 +538,7 @@
operator: %
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::%::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: double
staticElement: dart:core::@class::num::@method::%
@@ -540,6 +563,7 @@
operator: %
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::%::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::%
@@ -601,6 +625,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::double::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: dynamic
staticElement: dart:core::@class::double::@method::+
@@ -692,6 +717,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: double
staticElement: dart:core::@class::num::@method::+
@@ -716,6 +742,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: dynamic
staticElement: dart:core::@class::num::@method::+
@@ -740,6 +767,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::+
@@ -771,6 +799,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::+
@@ -801,6 +830,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: int
rightParenthesis: )
@@ -809,6 +839,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: self::@extension::E::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: self::@extension::E::@method::+
@@ -833,6 +864,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: num
staticElement: dart:core::@class::num::@method::+
@@ -931,6 +963,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: self::@class::A::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: double
staticElement: self::@class::A::@method::+
@@ -962,6 +995,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -970,6 +1004,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: self::@extension::E::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: self::@extension::E::@method::+
@@ -998,6 +1033,7 @@
operator: +
rightOperand: SimpleIdentifier
token: b
+ parameter: self::@extension::E::@method::+::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: self::@extension::E::@method::+
@@ -1022,6 +1058,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
staticElement: <null>
staticInvokeType: null
@@ -1045,6 +1082,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 0
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
@@ -1068,6 +1106,7 @@
operator: /
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::/::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::/
@@ -1105,6 +1144,7 @@
operator: *
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::*::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: double
staticElement: dart:core::@class::num::@method::*
@@ -1129,6 +1169,7 @@
operator: *
rightOperand: SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::*::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
staticElement: dart:core::@class::num::@method::*
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 f638f17..8773df4 100644
--- a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
@@ -12,6 +12,7 @@
import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
+import 'package:analyzer/src/summary2/kernel_compilation_service.dart';
import 'package:analyzer/src/test_utilities/mock_packages.dart';
import 'package:analyzer/src/test_utilities/mock_sdk.dart';
import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
@@ -176,7 +177,9 @@
void disposeAnalysisContextCollection() {
final analysisContextCollection = _analysisContextCollection;
if (analysisContextCollection != null) {
- analysisContextCollection.dispose();
+ analysisContextCollection.dispose(
+ forTesting: true,
+ );
_analysisContextCollection = null;
}
}
@@ -218,6 +221,9 @@
@mustCallSuper
Future<void> tearDown() async {
disposeAnalysisContextCollection();
+ KernelCompilationService.disposeDelayed(
+ const Duration(milliseconds: 500),
+ );
}
/// Override this method to update [analysisOptions] for every context root,
diff --git a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
index a385e48..0073ce7 100644
--- a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
@@ -1168,6 +1168,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@method::+::@parameter::_
staticType: int
staticElement: self::@extension::E::@method::+
staticInvokeType: int Function(int)
@@ -1195,6 +1196,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@extension::E::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@extension::E::@method::[]
@@ -1222,6 +1224,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@extension::E::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@extension::E::@method::[]
@@ -1339,6 +1342,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -1375,6 +1379,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -1434,6 +1439,7 @@
arguments
IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::call::@parameter::x
staticType: int
rightParenthesis: )
staticElement: self::@class::C::@method::call
@@ -1452,6 +1458,7 @@
arguments
IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::call::@parameter::x
staticType: int*
rightParenthesis: )
staticElement: self::@class::C::@method::call
@@ -1486,6 +1493,7 @@
arguments
IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::call::@parameter::x
staticType: int
rightParenthesis: )
staticElement: self::@extension::E::@method::call
@@ -1504,6 +1512,7 @@
arguments
IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::call::@parameter::x
staticType: int*
rightParenthesis: )
staticElement: self::@extension::E::@method::call
@@ -1535,6 +1544,7 @@
arguments
IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::call::@parameter::x
staticType: int
rightParenthesis: )
staticElement: self::@extension::E::@method::call
@@ -1552,6 +1562,7 @@
arguments
IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::call::@parameter::x
staticType: int*
rightParenthesis: )
staticElement: self::@extension::E::@method::call
@@ -1584,6 +1595,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::+::@parameter::i
staticType: int
readElement: self::@function::f::@parameter::c
readType: C
@@ -1602,6 +1614,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::+::@parameter::i
staticType: int*
readElement: self::@function::f::@parameter::c
readType: C*
@@ -1634,6 +1647,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::+::@parameter::i
staticType: int
readElement: self::@function::f::@parameter::c
readType: C
@@ -1652,6 +1666,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::+::@parameter::i
staticType: int*
readElement: self::@function::f::@parameter::c
readType: C*
@@ -1902,6 +1917,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -1927,6 +1943,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -2405,6 +2422,7 @@
arguments
SimpleIdentifier
token: o
+ parameter: root::@parameter::x
staticElement: self::@function::f::@parameter::o
staticType: C
rightParenthesis: )
@@ -2430,6 +2448,7 @@
arguments
SimpleIdentifier
token: o
+ parameter: root::@parameter::x
staticElement: self::@function::f::@parameter::o
staticType: C*
rightParenthesis: )
@@ -2462,6 +2481,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::+::@parameter::i
staticType: int
staticElement: self::@class::C::@method::+
staticInvokeType: void Function(int)
@@ -2477,6 +2497,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::+::@parameter::i
staticType: int*
staticElement: self::@class::C::@method::+
staticInvokeType: void Function(int*)*
@@ -2505,6 +2526,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::+::@parameter::i
staticType: int
staticElement: self::@extension::E::@method::+
staticInvokeType: void Function(int)
@@ -2520,6 +2542,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::+::@parameter::i
staticType: int*
staticElement: self::@extension::E::@method::+
staticInvokeType: void Function(int*)*
@@ -2549,6 +2572,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::+::@parameter::i
staticType: int
staticElement: self::@extension::E::@method::+
staticInvokeType: void Function(int)
@@ -2564,6 +2588,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::+::@parameter::i
staticType: int*
staticElement: self::@extension::E::@method::+
staticInvokeType: void Function(int*)*
@@ -2606,6 +2631,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@class::C::@method::[]
@@ -2621,6 +2647,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::[]::@parameter::index
staticType: int*
rightBracket: ]
staticElement: self::@class::C::@method::[]
@@ -2649,6 +2676,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@extension::E::@method::[]
@@ -2664,6 +2692,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]::@parameter::index
staticType: int*
rightBracket: ]
staticElement: self::@extension::E::@method::[]
@@ -2693,6 +2722,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@extension::E::@method::[]
@@ -2708,6 +2738,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]::@parameter::index
staticType: int*
rightBracket: ]
staticElement: self::@extension::E::@method::[]
@@ -2740,6 +2771,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -2747,6 +2779,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::C::@method::[]=::@parameter::value
staticType: int
readElement: <null>
readType: null
@@ -2766,6 +2799,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
@@ -2773,6 +2807,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::C::@method::[]=::@parameter::value
staticType: int*
readElement: <null>
readType: null
@@ -2805,6 +2840,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -2812,6 +2848,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@method::[]=::@parameter::value
staticType: int
readElement: <null>
readType: null
@@ -2831,6 +2868,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
@@ -2838,6 +2876,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@method::[]=::@parameter::value
staticType: int*
readElement: <null>
readType: null
@@ -2871,6 +2910,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -2878,6 +2918,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@method::[]=::@parameter::value
staticType: int
readElement: <null>
readType: null
@@ -2897,6 +2938,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
@@ -2904,6 +2946,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@method::[]=::@parameter::value
staticType: int*
readElement: <null>
readType: null
@@ -3318,6 +3361,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@setter::a::@parameter::x
staticType: int
readElement: <null>
readType: null
@@ -3344,6 +3388,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@setter::a::@parameter::x
staticType: int*
readElement: <null>
readType: null
@@ -3386,6 +3431,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@setter::a::@parameter::x
staticType: int
readElement: <null>
readType: null
@@ -3412,6 +3458,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@setter::a::@parameter::x
staticType: int*
readElement: <null>
readType: null
@@ -3890,6 +3937,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: package:test/lib.dart::@extension::E::@setter::a::@parameter::x
staticType: int
readElement: <null>
readType: null
@@ -3923,6 +3971,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: package:test/lib.dart::@extension::E::@setter::a::@parameter::x
staticType: int*
readElement: <null>
readType: null
@@ -3965,6 +4014,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@setter::a::@parameter::x
staticType: int
readElement: <null>
readType: null
@@ -3991,6 +4041,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@setter::a::@parameter::x
staticType: int*
readElement: <null>
readType: null
@@ -4109,6 +4160,7 @@
arguments
IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::call::@parameter::x
staticType: int
rightParenthesis: )
staticElement: self::@extension::E::@method::call
@@ -4126,6 +4178,7 @@
arguments
IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::call::@parameter::x
staticType: int*
rightParenthesis: )
staticElement: self::@extension::E::@method::call
@@ -4161,6 +4214,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -4179,6 +4233,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
readElement: <null>
readType: null
@@ -4427,6 +4482,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::+::@parameter::i
staticType: int
staticElement: self::@class::C::@method::+
staticInvokeType: void Function(int)
@@ -4441,6 +4497,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::+::@parameter::i
staticType: int*
staticElement: self::@class::C::@method::+
staticInvokeType: void Function(int*)*
@@ -4467,6 +4524,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::+::@parameter::i
staticType: int
staticElement: self::@extension::E::@method::+
staticInvokeType: void Function(int)
@@ -4481,6 +4539,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::+::@parameter::i
staticType: int*
staticElement: self::@extension::E::@method::+
staticInvokeType: void Function(int*)*
@@ -4509,6 +4568,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@class::C::@method::[]
@@ -4523,6 +4583,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::[]::@parameter::index
staticType: int*
rightBracket: ]
staticElement: self::@class::C::@method::[]
@@ -4549,6 +4610,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@extension::E::@method::[]
@@ -4563,6 +4625,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]::@parameter::index
staticType: int*
rightBracket: ]
staticElement: self::@extension::E::@method::[]
@@ -4592,6 +4655,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -4599,6 +4663,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::C::@method::[]=::@parameter::value
staticType: int
readElement: <null>
readType: null
@@ -4617,6 +4682,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@class::C::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
@@ -4624,6 +4690,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::C::@method::[]=::@parameter::value
staticType: int*
readElement: <null>
readType: null
@@ -4654,6 +4721,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -4661,6 +4729,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@method::[]=::@parameter::value
staticType: int
readElement: <null>
readType: null
@@ -4679,6 +4748,7 @@
leftBracket: [
index: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
@@ -4686,6 +4756,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@method::[]=::@parameter::value
staticType: int*
readElement: <null>
readType: null
@@ -4820,6 +4891,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@setter::a::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -4838,6 +4910,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@setter::a::@parameter::_
staticType: int*
readElement: <null>
readType: null
@@ -4879,6 +4952,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@class::C::@setter::a::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -4903,6 +4977,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@class::C::@setter::a::@parameter::_
staticType: int*
readElement: <null>
readType: null
@@ -4942,6 +5017,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@setter::a::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -4966,6 +5042,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@setter::a::@parameter::_
staticType: int*
readElement: <null>
readType: null
@@ -5249,6 +5326,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@setter::a::@parameter::x
staticType: int
readElement: <null>
readType: null
@@ -5267,6 +5345,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@setter::a::@parameter::x
staticType: int*
readElement: <null>
readType: null
@@ -5300,6 +5379,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@setter::a::@parameter::x
staticType: int
readElement: <null>
readType: null
@@ -5318,6 +5398,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: self::@extension::E::@setter::a::@parameter::x
staticType: int*
readElement: <null>
readType: null
@@ -5560,6 +5641,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: self::@setter::a::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -5578,6 +5660,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: self::@setter::a::@parameter::_
staticType: int*
readElement: <null>
readType: null
@@ -5614,6 +5697,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: self::@setter::a::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -5632,6 +5716,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: self::@setter::a::@parameter::_
staticType: int*
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart
index de64c30..249d75a 100644
--- a/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart
@@ -40,6 +40,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: int?
rightParenthesis: )
@@ -48,6 +49,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@extension::E::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@extension::E::@method::[]
@@ -79,6 +81,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: int?
rightParenthesis: )
@@ -87,6 +90,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@extension::E::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -94,6 +98,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@method::[]=::@parameter::value
staticType: int
readElement: <null>
readType: null
@@ -128,6 +133,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: int?
rightParenthesis: )
@@ -203,6 +209,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -231,6 +238,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -285,6 +293,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -327,6 +336,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -385,6 +395,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -421,6 +432,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -486,6 +498,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -536,6 +549,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -583,6 +597,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -608,6 +623,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -651,6 +667,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -667,6 +684,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -687,6 +705,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -703,6 +722,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -747,6 +767,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -786,6 +807,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -841,6 +863,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -874,6 +897,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -935,6 +959,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -982,6 +1007,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -1026,6 +1052,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -1055,6 +1082,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -1109,6 +1137,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -1152,6 +1181,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -1211,6 +1241,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -1248,6 +1279,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -1313,6 +1345,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -1364,6 +1397,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -1412,6 +1446,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -1420,6 +1455,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@method::+::@parameter::offset
staticType: int
staticElement: self::@extension::E::@method::+
staticInvokeType: void Function(int)
@@ -1438,6 +1474,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -1446,6 +1483,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@method::+::@parameter::offset
staticType: int*
staticElement: self::@extension::E::@method::+
staticInvokeType: void Function(int*)*
@@ -1489,6 +1527,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -1499,6 +1538,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@method::+::@parameter::offset
staticType: int
staticElement: self::@extension::E::@method::+
staticInvokeType: void Function(int)
@@ -1527,6 +1567,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -1537,6 +1578,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@method::+::@parameter::offset
staticType: int*
staticElement: self::@extension::E::@method::+
staticInvokeType: void Function(int*)*
@@ -1574,6 +1616,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
extendedType: int
@@ -1606,6 +1649,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
extendedType: int*
@@ -1663,6 +1707,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -1671,6 +1716,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 1
+ parameter: package:test/lib.dart::@extension::E::@method::+::@parameter::offset
staticType: int
staticElement: package:test/lib.dart::@extension::E::@method::+
staticInvokeType: void Function(int)
@@ -1697,6 +1743,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -1705,6 +1752,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 1
+ parameter: package:test/lib.dart::@extension::E::@method::+::@parameter::offset
staticType: int*
staticElement: package:test/lib.dart::@extension::E::@method::+
staticInvokeType: void Function(int*)*
@@ -1759,6 +1807,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -1769,6 +1818,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 1
+ parameter: package:test/lib.dart::@extension::E::@method::+::@parameter::offset
staticType: int
staticElement: package:test/lib.dart::@extension::E::@method::+
staticInvokeType: void Function(int)
@@ -1805,6 +1855,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -1815,6 +1866,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 1
+ parameter: package:test/lib.dart::@extension::E::@method::+::@parameter::offset
staticType: int*
staticElement: package:test/lib.dart::@extension::E::@method::+
staticInvokeType: void Function(int*)*
@@ -1849,6 +1901,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -1863,6 +1916,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: self::@extension::E::@setter::s::@parameter::x
staticType: int
readElement: <null>
readType: null
@@ -1885,6 +1939,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -1899,6 +1954,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: self::@extension::E::@setter::s::@parameter::x
staticType: int*
readElement: <null>
readType: null
@@ -1946,6 +2002,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -1962,6 +2019,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@extension::E::@setter::s::@parameter::x
+ substitution: {T: int}
staticType: int
readElement: <null>
readType: null
@@ -1996,6 +2056,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -2012,6 +2073,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@extension::E::@setter::s::@parameter::x
+ substitution: {T: int*}
staticType: int*
readElement: <null>
readType: null
@@ -2062,6 +2126,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -2076,6 +2141,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: package:test/lib.dart::@extension::E::@setter::s::@parameter::x
staticType: int
readElement: <null>
readType: null
@@ -2106,6 +2172,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -2120,6 +2187,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: package:test/lib.dart::@extension::E::@setter::s::@parameter::x
staticType: int*
readElement: <null>
readType: null
@@ -2178,6 +2246,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -2194,6 +2263,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/lib.dart::@extension::E::@setter::s::@parameter::x
+ substitution: {T: int}
staticType: int
readElement: <null>
readType: null
@@ -2236,6 +2308,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -2252,6 +2325,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/lib.dart::@extension::E::@setter::s::@parameter::x
+ substitution: {T: int*}
staticType: int*
readElement: <null>
readType: null
@@ -2292,6 +2368,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -2306,6 +2383,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@extension::E::@getter::s
readType: int
@@ -2328,6 +2406,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -2342,6 +2421,9 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: dart:core::@class::num::@method::+::@parameter::other
+ isLegacy: true
staticType: int*
readElement: self::@extension::E::@getter::s
readType: int*
@@ -2392,6 +2474,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -2408,6 +2491,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: PropertyAccessorMember
base: self::@extension::E::@getter::s
@@ -2444,6 +2528,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -2460,6 +2545,9 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: dart:core::@class::num::@method::+::@parameter::other
+ isLegacy: true
staticType: int*
readElement: PropertyAccessorMember
base: self::@extension::E::@getter::s
@@ -2515,6 +2603,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -2529,6 +2618,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: package:test/lib.dart::@extension::E::@getter::s
readType: int
@@ -2559,6 +2649,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -2573,6 +2664,9 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: dart:core::@class::num::@method::+::@parameter::other
+ isLegacy: true
staticType: int*
readElement: package:test/lib.dart::@extension::E::@getter::s
readType: int*
@@ -2634,6 +2728,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -2650,6 +2745,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: PropertyAccessorMember
base: package:test/lib.dart::@extension::E::@getter::s
@@ -2694,6 +2790,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -2710,6 +2807,9 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: dart:core::@class::num::@method::+::@parameter::other
+ isLegacy: true
staticType: int*
readElement: PropertyAccessorMember
base: package:test/lib.dart::@extension::E::@getter::s
@@ -2752,6 +2852,7 @@
arguments
SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: C
rightParenthesis: )
@@ -2777,6 +2878,7 @@
arguments
SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: C*
rightParenthesis: )
diff --git a/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart b/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart
index 1ef7367..0cb0ce2 100644
--- a/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart
@@ -113,6 +113,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: f
+ parameter: self::@setter::g::@parameter::_g
staticElement: self::@function::foo::@parameter::f
staticType: void Function<T>(T)
readElement: <null>
@@ -150,6 +151,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::0::@method::+::@parameter::i
staticType: int
readElement: self::@function::foo::@parameter::f
readType: void Function<T>(T)
@@ -208,6 +210,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 1
+ parameter: self::@class::C::@method::+::@parameter::i
staticType: int
staticElement: self::@class::C::@method::+
staticInvokeType: void Function<T>(T) Function(int)
@@ -402,6 +405,9 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: dart:core::@class::List::@method::[]::@parameter::index
+ substitution: {E: void Function<T>(T)}
staticType: int
rightBracket: ]
staticElement: MethodMember
@@ -1089,6 +1095,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::bar::@parameter::a
staticType: A
rightParenthesis: )
@@ -1221,6 +1228,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::bar::@parameter::a
staticType: A
rightParenthesis: )
@@ -1321,6 +1329,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::bar::@parameter::a
staticType: A
rightParenthesis: )
@@ -1374,6 +1383,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::bar::@parameter::a
staticType: A
rightParenthesis: )
@@ -2272,6 +2282,7 @@
operator: ??
rightOperand: SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: A
staticElement: <null>
diff --git a/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart
index 6bb0204..2c998d6 100644
--- a/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart
@@ -20,6 +20,7 @@
void f({a = b?[0]}) {}
''');
+ // TODO(scheglov) https://github.com/dart-lang/sdk/issues/49101
assertResolvedNodeText(findNode.index('[0]'), r'''
IndexExpression
target: SimpleIdentifier
@@ -29,6 +30,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightBracket: ]
staticElement: <null>
@@ -50,6 +52,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightBracket: ]
staticElement: <null>
@@ -80,6 +83,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@class::A::@method::[]
@@ -108,6 +112,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@class::A::@method::[]
@@ -120,6 +125,7 @@
leftBracket: [
index: IntegerLiteral
literal: 1
+ parameter: self::@class::A::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@class::A::@method::[]
@@ -152,6 +158,9 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@method::[]::@parameter::index
+ substitution: {T: double}
staticType: int
rightBracket: ]
staticElement: MethodMember
@@ -189,6 +198,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]::@parameter::index
staticType: int
rightBracket: ]
staticElement: self::@class::A::@method::[]
@@ -228,6 +238,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -235,6 +246,7 @@
operator: +=
rightHandSide: DoubleLiteral
literal: 1.2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: double
readElement: self::@class::A::@method::[]
readType: num
@@ -286,6 +298,9 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@method::[]=::@parameter::index
+ substitution: {T: double}
staticType: int
rightBracket: ]
staticElement: <null>
@@ -293,6 +308,7 @@
operator: +=
rightHandSide: DoubleLiteral
literal: 1.2
+ parameter: dart:core::@class::double::@method::+::@parameter::other
staticType: double
readElement: MethodMember
base: self::@class::A::@method::[]
@@ -345,6 +361,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -352,6 +369,7 @@
operator: +=
rightHandSide: DoubleLiteral
literal: 1.2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: double
readElement: self::@class::A::@method::[]
readType: num
@@ -398,6 +416,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -405,6 +424,7 @@
operator: =
rightHandSide: DoubleLiteral
literal: 1.2
+ parameter: self::@class::A::@method::[]=::@parameter::value
staticType: double
readElement: <null>
readType: null
@@ -445,6 +465,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -452,6 +473,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: a
+ parameter: self::@class::A::@method::[]=::@parameter::a
staticElement: self::@function::f::@parameter::a
staticType: A
readElement: <null>
@@ -466,6 +488,7 @@
leftBracket: [
index: IntegerLiteral
literal: 1
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -473,6 +496,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: a
+ parameter: self::@class::A::@method::[]=::@parameter::a
staticElement: self::@function::f::@parameter::a
staticType: A
readElement: <null>
@@ -519,6 +543,9 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@method::[]=::@parameter::index
+ substitution: {T: double}
staticType: int
rightBracket: ]
staticElement: <null>
@@ -526,6 +553,9 @@
operator: =
rightHandSide: DoubleLiteral
literal: 1.2
+ parameter: ParameterMember
+ base: self::@class::A::@method::[]=::@parameter::value
+ substitution: {T: double}
staticType: double
readElement: <null>
readType: null
@@ -577,6 +607,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -584,6 +615,7 @@
operator: =
rightHandSide: DoubleLiteral
literal: 1.2
+ parameter: self::@class::A::@method::[]=::@parameter::value
staticType: double
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/dart/resolution/instance_creation_test.dart b/pkg/analyzer/test/src/dart/resolution/instance_creation_test.dart
index b0f2e14..ee95251 100644
--- a/pkg/analyzer/test/src/dart/resolution/instance_creation_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/instance_creation_test.dart
@@ -57,6 +57,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::named::@parameter::t
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticType: A<int>
@@ -143,6 +146,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::•::@parameter::t
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticType: A<int>
@@ -218,6 +224,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@constructor::•::@parameter::a
staticType: int
rightParenthesis: )
staticType: A
@@ -256,6 +263,9 @@
arguments
SimpleIdentifier
token: s
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::•::@parameter::t
+ substitution: {T: S}
staticElement: self::@function::f::@parameter::s
staticType: S & int
rightParenthesis: )
@@ -626,6 +636,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@class::X::@constructor::•::@parameter::a
staticInvokeType: A Function()
staticType: A
typeArgumentTypes
@@ -645,6 +656,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: <null>
staticInvokeType: C? Function()
staticType: C?
typeArgumentTypes
@@ -657,6 +669,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@class::X::@constructor::•::@parameter::b
staticInvokeType: B Function()
staticType: B
typeArgumentTypes
@@ -676,6 +689,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: <null>
staticInvokeType: D? Function()
staticType: D?
typeArgumentTypes
@@ -741,6 +755,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::named::@parameter::t
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticType: A<int>
@@ -785,6 +802,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::named::@parameter::t
+ substitution: {T: int, U: String}
staticType: int
SimpleStringLiteral
literal: ''
@@ -824,6 +844,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::•::@parameter::t
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticType: A<int>
@@ -861,6 +884,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::•::@parameter::t
+ substitution: {T: int, U: String}
staticType: int
SimpleStringLiteral
literal: ''
@@ -909,6 +935,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::named::@parameter::t
+ substitution: {T: String}
staticType: int
rightParenthesis: )
staticType: A<String>
@@ -948,6 +977,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@class::A::@constructor::•::@parameter::t
+ substitution: {T: String}
staticType: int
rightParenthesis: )
staticType: A<String>
@@ -982,6 +1014,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@constructor::•::@parameter::a
staticType: int
rightParenthesis: )
staticType: A
@@ -1021,6 +1054,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@constructor::•::@parameter::a
staticType: int
rightParenthesis: )
staticType: A
@@ -1060,6 +1094,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@constructor::•::@parameter::a
staticType: int
rightParenthesis: )
staticType: A
@@ -1106,6 +1141,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@constructor::•::@parameter::a
staticType: int
rightParenthesis: )
staticType: A
diff --git a/pkg/analyzer/test/src/dart/resolution/metadata_test.dart b/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
index 7a787e3..8da2b07 100644
--- a/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
@@ -168,8 +168,10 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@constructor::•::@parameter::f
staticType: int
rightParenthesis: )
+ parameter: self::@class::A::@constructor::•::@parameter::f
staticType: A
rightParenthesis: )
element: self::@class::A::@constructor::•
@@ -208,6 +210,7 @@
arguments
IntegerLiteral
literal: 3
+ parameter: self::@class::A::@constructor::•::@parameter::a
staticType: int
rightParenthesis: )
element: self::@class::A::@constructor::•
@@ -248,6 +251,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@constructor::•::@parameter::a
+ isLegacy: true
staticType: int*
rightParenthesis: )
element: ConstructorMember
@@ -297,6 +303,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: package:test/a.dart::@class::A::@constructor::named::@parameter::a
+ isLegacy: true
staticType: int*
rightParenthesis: )
element: ConstructorMember
@@ -475,6 +484,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@constructor::•::@parameter::a
+ isLegacy: true
staticType: int*
rightParenthesis: )
element: ConstructorMember
@@ -525,6 +537,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@constructor::named::@parameter::a
+ isLegacy: true
staticType: int*
rightParenthesis: )
element: ConstructorMember
@@ -646,6 +661,7 @@
arguments
IntegerLiteral
literal: 42
+ parameter: self::@class::A::@constructor::named::@parameter::f
staticType: int
rightParenthesis: )
element: self::@class::A::@constructor::named
@@ -718,6 +734,7 @@
arguments
IntegerLiteral
literal: 42
+ parameter: self::@class::A::@constructor::•::@parameter::f
staticType: int
rightParenthesis: )
element: self::@class::A::@constructor::•
@@ -770,6 +787,9 @@
ListLiteral
leftBracket: [
rightBracket: ]
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::named::@parameter::f
+ substitution: {T: Object?}
staticType: List<List<Object?>>
rightParenthesis: )
element: ConstructorMember
@@ -813,6 +833,9 @@
ListLiteral
leftBracket: [
rightBracket: ]
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::•::@parameter::f
+ substitution: {T: Object?}
staticType: List<List<Object?>>
rightParenthesis: )
element: ConstructorMember
@@ -867,6 +890,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::named::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -908,6 +934,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -990,6 +1019,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::named::@parameter::f
+ substitution: {T: dynamic}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1076,6 +1108,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::named::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1127,6 +1162,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1169,6 +1207,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::•::@parameter::f
+ substitution: {T: dynamic}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1214,6 +1255,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: ParameterMember
+ base: self::@class::B::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1258,6 +1302,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: ParameterMember
+ base: self::@class::B::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1299,6 +1346,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: ParameterMember
+ base: self::@class::B::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1339,6 +1389,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: ParameterMember
+ base: self::@class::B::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1380,6 +1433,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: ParameterMember
+ base: self::@class::B::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1423,6 +1479,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: ParameterMember
+ base: self::@class::B::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1474,6 +1533,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: ParameterMember
+ base: self::@class::B::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1663,6 +1725,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: package:test/a.dart::@class::A::@constructor::named::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1718,6 +1783,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: package:test/a.dart::@class::A::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1790,6 +1858,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: package:test/a.dart::@class::A::@constructor::named::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1855,6 +1926,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: package:test/a.dart::@class::A::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -1952,9 +2026,15 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::named::@parameter::t
+ substitution: {T: int, U: double}
staticType: int
DoubleLiteral
literal: 1.2
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::named::@parameter::u
+ substitution: {T: int, U: double}
staticType: double
rightParenthesis: )
element: ConstructorMember
@@ -2017,9 +2097,15 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::•::@parameter::t
+ substitution: {T: int, U: double}
staticType: int
DoubleLiteral
literal: 1.2
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::•::@parameter::u
+ substitution: {T: int, U: double}
staticType: double
rightParenthesis: )
element: ConstructorMember
@@ -2083,6 +2169,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::named::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -2127,6 +2216,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -2188,6 +2280,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::named::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -2242,6 +2337,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -2298,6 +2396,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::named::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -2342,6 +2443,9 @@
arguments
IntegerLiteral
literal: 42
+ parameter: FieldFormalParameterMember
+ base: self::@class::A::@constructor::•::@parameter::f
+ substitution: {T: int}
staticType: int
rightParenthesis: )
element: ConstructorMember
@@ -2394,6 +2498,7 @@
arguments
IntegerLiteral
literal: 42
+ parameter: self::@class::A::@constructor::named::@parameter::f
staticType: int
rightParenthesis: )
element: self::@class::A::@constructor::named
@@ -2435,6 +2540,7 @@
arguments
IntegerLiteral
literal: 42
+ parameter: self::@class::A::@constructor::•::@parameter::f
staticType: int
rightParenthesis: )
element: self::@class::A::@constructor::•
diff --git a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
index 8179271..342e26d 100644
--- a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
@@ -187,6 +187,7 @@
arguments
SimpleIdentifier
token: c
+ parameter: root::@parameter::
staticElement: self::@function::f::@parameter::c
staticType: C
rightParenthesis: )
@@ -534,6 +535,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -571,6 +573,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -679,6 +682,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@function::foo::@parameter::a
staticInvokeType: A Function()
staticType: A
typeArgumentTypes
@@ -698,6 +702,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: <null>
staticInvokeType: C? Function()
staticType: C?
typeArgumentTypes
@@ -710,6 +715,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@function::foo::@parameter::b
staticInvokeType: B Function()
staticType: B
typeArgumentTypes
@@ -729,6 +735,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: <null>
staticInvokeType: D? Function()
staticType: D?
typeArgumentTypes
@@ -915,6 +922,9 @@
arguments
SimpleIdentifier
token: o
+ parameter: ParameterMember
+ base: root::@parameter::value
+ substitution: {T: Object}
staticElement: self::@function::f::@parameter::o
staticType: dynamic
rightParenthesis: )
@@ -946,6 +956,9 @@
arguments
SimpleIdentifier
token: o
+ parameter: ParameterMember
+ base: root::@parameter::value
+ substitution: {T: Object}
staticElement: self::@function::f::@parameter::o
staticType: List<void>
rightParenthesis: )
@@ -999,6 +1012,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticInvokeType: double Function()
staticType: double
typeArgumentTypes
@@ -1011,11 +1025,13 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticInvokeType: double Function()
staticType: double
typeArgumentTypes
double
rightParenthesis: )
+ parameter: self::@function::h::@parameter::x
staticInvokeType: num Function(num, num)
staticType: double
rightParenthesis: )
@@ -1055,6 +1071,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::lowerLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -1067,11 +1084,13 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::upperLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
num*
rightParenthesis: )
+ parameter: self::@function::h::@parameter::x
staticInvokeType: num* Function(num*, num*)*
staticType: num*
rightParenthesis: )
@@ -1126,6 +1145,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -1138,11 +1158,13 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
num
rightParenthesis: )
+ parameter: self::@function::h::@parameter::x
staticInvokeType: num Function(num, num)
staticType: num
rightParenthesis: )
@@ -1182,6 +1204,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::lowerLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -1194,11 +1217,13 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::upperLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
num*
rightParenthesis: )
+ parameter: self::@function::h::@parameter::x
staticInvokeType: num* Function(num*, num*)*
staticType: num*
rightParenthesis: )
@@ -1240,6 +1265,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -1252,6 +1278,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -1285,6 +1312,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::lowerLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -1297,6 +1325,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::upperLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -1333,10 +1362,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: double
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: double
rightParenthesis: )
@@ -1362,10 +1393,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: double*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: double*
rightParenthesis: )
@@ -1400,10 +1433,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: double
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -1429,10 +1464,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: double*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -1467,10 +1504,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: double
rightParenthesis: )
@@ -1496,10 +1535,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: double*
rightParenthesis: )
@@ -1534,10 +1575,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -1563,10 +1606,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -1621,6 +1666,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -1633,11 +1679,13 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
num
rightParenthesis: )
+ parameter: self::@function::h::@parameter::x
staticInvokeType: num Function(num, num)
staticType: num
rightParenthesis: )
@@ -1677,6 +1725,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::lowerLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -1689,11 +1738,13 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::upperLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
num*
rightParenthesis: )
+ parameter: self::@function::h::@parameter::x
staticInvokeType: num* Function(num*, num*)*
staticType: num*
rightParenthesis: )
@@ -1744,6 +1795,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticInvokeType: int Function()
staticType: int
typeArgumentTypes
@@ -1756,11 +1808,13 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticInvokeType: int Function()
staticType: int
typeArgumentTypes
int
rightParenthesis: )
+ parameter: self::@function::h::@parameter::x
staticInvokeType: num Function(num, num)
staticType: int
rightParenthesis: )
@@ -1800,6 +1854,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::lowerLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -1812,11 +1867,13 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::upperLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
num*
rightParenthesis: )
+ parameter: self::@function::h::@parameter::x
staticInvokeType: num* Function(num*, num*)*
staticType: num*
rightParenthesis: )
@@ -1858,6 +1915,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -1870,6 +1928,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -1903,6 +1962,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::lowerLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -1915,6 +1975,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::upperLimit
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -1951,10 +2012,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: double
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: double
rightParenthesis: )
@@ -1980,10 +2043,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: double*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: double*
rightParenthesis: )
@@ -2018,10 +2083,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: double
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: dynamic
rightParenthesis: )
@@ -2047,10 +2114,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: double*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: dynamic
rightParenthesis: )
@@ -2085,10 +2154,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: double
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -2114,10 +2185,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: double*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -2152,10 +2225,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: dynamic
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: double
rightParenthesis: )
@@ -2181,10 +2256,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: dynamic
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: double*
rightParenthesis: )
@@ -2219,10 +2296,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: dynamic
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -2248,10 +2327,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: dynamic
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -2286,10 +2367,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: double
rightParenthesis: )
@@ -2315,10 +2398,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: double*
rightParenthesis: )
@@ -2353,10 +2438,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: dynamic
rightParenthesis: )
@@ -2382,10 +2469,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: dynamic
rightParenthesis: )
@@ -2420,10 +2509,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -2449,10 +2540,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -2487,10 +2580,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -2512,10 +2607,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -2549,6 +2646,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: int
rightParenthesis: )
@@ -2564,10 +2662,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: self::@extension::E::@method::clamp::@parameter::x
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: self::@extension::E::@method::clamp::@parameter::y
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -2587,6 +2687,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: int*
rightParenthesis: )
@@ -2602,10 +2703,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: self::@extension::E::@method::clamp::@parameter::x
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: self::@extension::E::@method::clamp::@parameter::y
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -2640,10 +2743,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: Never
rightParenthesis: )
@@ -2669,10 +2774,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: Null*
rightParenthesis: )
@@ -2711,10 +2818,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::clamp::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: Never
SimpleIdentifier
token: c
+ parameter: dart:core::@class::num::@method::clamp::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -2740,10 +2849,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::lowerLimit
staticElement: self::@function::f::@parameter::b
staticType: Null*
SimpleIdentifier
token: c
+ parameter: root::@parameter::upperLimit
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -2785,10 +2896,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -2812,10 +2925,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -2873,6 +2988,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@class::A::@method::clamp::@parameter::x
staticInvokeType: String Function()
staticType: String
typeArgumentTypes
@@ -2885,11 +3001,13 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@class::A::@method::clamp::@parameter::y
staticInvokeType: String Function()
staticType: String
typeArgumentTypes
String
rightParenthesis: )
+ parameter: self::@function::h::@parameter::x
staticInvokeType: num Function(String, String)
staticType: num
rightParenthesis: )
@@ -2927,6 +3045,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@class::A::@method::clamp::@parameter::x
staticInvokeType: String* Function()*
staticType: String*
typeArgumentTypes
@@ -2939,11 +3058,13 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@class::A::@method::clamp::@parameter::y
staticInvokeType: String* Function()*
staticType: String*
typeArgumentTypes
String*
rightParenthesis: )
+ parameter: self::@function::h::@parameter::x
staticInvokeType: num* Function(String*, String*)*
staticType: num*
rightParenthesis: )
@@ -2981,10 +3102,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: self::@class::A::@method::clamp::@parameter::x
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: self::@class::A::@method::clamp::@parameter::y
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -3008,10 +3131,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: self::@class::A::@method::clamp::@parameter::x
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: self::@class::A::@method::clamp::@parameter::y
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -3046,6 +3171,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -3061,10 +3187,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: self::@extension::E::@method::clamp::@parameter::x
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: self::@extension::E::@method::clamp::@parameter::y
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -3084,6 +3212,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -3099,10 +3228,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: self::@extension::E::@method::clamp::@parameter::x
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: self::@extension::E::@method::clamp::@parameter::y
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -3141,10 +3272,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: self::@extension::E::@method::clamp::@parameter::x
staticElement: self::@function::f::@parameter::b
staticType: int
SimpleIdentifier
token: c
+ parameter: self::@extension::E::@method::clamp::@parameter::y
staticElement: self::@function::f::@parameter::c
staticType: int
rightParenthesis: )
@@ -3168,10 +3301,12 @@
arguments
SimpleIdentifier
token: b
+ parameter: self::@extension::E::@method::clamp::@parameter::x
staticElement: self::@function::f::@parameter::b
staticType: int*
SimpleIdentifier
token: c
+ parameter: self::@extension::E::@method::clamp::@parameter::y
staticElement: self::@function::f::@parameter::c
staticType: int*
rightParenthesis: )
@@ -3206,6 +3341,9 @@
arguments
SimpleIdentifier
token: s
+ parameter: ParameterMember
+ base: root::@parameter::t
+ substitution: {T: S}
staticElement: self::@function::f::@parameter::s
staticType: S & int
rightParenthesis: )
@@ -3226,6 +3364,9 @@
arguments
SimpleIdentifier
token: s
+ parameter: ParameterMember
+ base: root::@parameter::t
+ substitution: {T: S*}
staticElement: self::@function::f::@parameter::s
staticType: S* & int*
rightParenthesis: )
@@ -3269,6 +3410,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: package:test/a.dart::@function::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -3286,6 +3428,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: package:test/a.dart::@function::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -3331,6 +3474,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: package:test/a.dart::@function::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -3353,6 +3497,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: package:test/a.dart::@function::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -3392,6 +3537,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -3414,6 +3560,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -3632,9 +3779,11 @@
arguments
IntegerLiteral
literal: 1
+ parameter: <null>
staticType: int
IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -3653,9 +3802,11 @@
arguments
IntegerLiteral
literal: 1
+ parameter: <null>
staticType: int*
IntegerLiteral
literal: 2
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -3693,6 +3844,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::_
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -3713,6 +3865,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::_
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -4138,6 +4291,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -4155,6 +4309,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -4192,6 +4347,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -4214,6 +4370,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -4249,6 +4406,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -4271,6 +4429,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -4307,6 +4466,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -4329,6 +4489,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -4367,6 +4528,7 @@
arguments
SimpleIdentifier
token: x
+ parameter: <null>
staticElement: self::@getter::x
staticType: int
rightParenthesis: )
@@ -4390,6 +4552,7 @@
arguments
SimpleIdentifier
token: x
+ parameter: <null>
staticElement: self::@getter::x
staticType: int*
rightParenthesis: )
@@ -4433,6 +4596,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -4455,6 +4619,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -4613,6 +4778,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -4634,6 +4800,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -4670,6 +4837,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -4692,6 +4860,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -4724,6 +4893,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -4741,6 +4911,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -4840,6 +5011,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -4857,6 +5029,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -4922,6 +5095,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -4943,6 +5117,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -4983,6 +5158,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: void Function()
@@ -5000,6 +5176,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: void Function()*
@@ -5041,6 +5218,7 @@
arguments
IntegerLiteral
literal: 1
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -5063,6 +5241,7 @@
arguments
IntegerLiteral
literal: 1
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -5099,6 +5278,7 @@
arguments
IntegerLiteral
literal: 1
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -5116,6 +5296,7 @@
arguments
IntegerLiteral
literal: 1
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -5617,6 +5798,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -5642,6 +5824,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -5680,6 +5863,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::C::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -5702,6 +5886,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::C::@method::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -5799,7 +5984,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: <null>
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -5831,7 +6018,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: root::@parameter::other
staticType: int*
+ parameter: <null>
staticElement: MethodMember
base: dart:core::@class::num::@method::+
isLegacy: true
@@ -5869,9 +6058,11 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
IntegerLiteral
literal: 1
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -5894,9 +6085,11 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
IntegerLiteral
literal: 1
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -5932,6 +6125,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@function::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -5954,6 +6148,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@function::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -5989,6 +6184,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: root::@parameter::_
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -6013,6 +6211,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: root::@parameter::_
+ substitution: {T: int*}
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -6054,9 +6255,15 @@
arguments
IntegerLiteral
literal: 1
+ parameter: ParameterMember
+ base: root::@parameter::a
+ substitution: {T: int}
staticType: int
IntegerLiteral
literal: 2
+ parameter: ParameterMember
+ base: root::@parameter::b
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticInvokeType: int Function(int, int)
@@ -6081,9 +6288,15 @@
arguments
IntegerLiteral
literal: 1
+ parameter: ParameterMember
+ base: root::@parameter::a
+ substitution: {T: int*}
staticType: int*
IntegerLiteral
literal: 2
+ parameter: ParameterMember
+ base: root::@parameter::b
+ substitution: {T: int*}
staticType: int*
rightParenthesis: )
staticInvokeType: int* Function(int*, int*)*
@@ -6128,9 +6341,15 @@
arguments
IntegerLiteral
literal: 1
+ parameter: ParameterMember
+ base: root::@parameter::a
+ substitution: {T: int}
staticType: int
IntegerLiteral
literal: 2
+ parameter: ParameterMember
+ base: root::@parameter::b
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -6159,9 +6378,15 @@
arguments
IntegerLiteral
literal: 1
+ parameter: ParameterMember
+ base: root::@parameter::a
+ substitution: {T: int*}
staticType: int*
IntegerLiteral
literal: 2
+ parameter: ParameterMember
+ base: root::@parameter::b
+ substitution: {T: int*}
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -6200,6 +6425,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -6222,6 +6448,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -6257,6 +6484,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: dynamic
@@ -6279,6 +6507,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: dynamic
@@ -6318,6 +6547,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -6343,6 +6573,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -6383,6 +6614,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -6401,6 +6633,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -6499,6 +6732,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::C::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -6521,6 +6755,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::C::@method::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -6560,6 +6795,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: root::@parameter::a
+ substitution: {T: int}
staticType: int
rightParenthesis: )
staticInvokeType: int Function(int)
@@ -6584,6 +6822,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: root::@parameter::a
+ substitution: {T: int*}
staticType: int*
rightParenthesis: )
staticInvokeType: int* Function(int*)*
@@ -6695,6 +6936,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -6717,6 +6959,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -6768,6 +7011,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -6801,6 +7045,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -6851,6 +7096,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: package:test/a.dart::@class::C::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -6881,6 +7127,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: package:test/a.dart::@class::C::@method::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -6921,6 +7168,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -6945,6 +7193,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -6984,6 +7233,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -7005,6 +7255,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -7133,6 +7384,7 @@
colon: :
expression: BooleanLiteral
literal: false
+ parameter: <null>
staticType: bool
NamedExpression
name: Label
@@ -7143,6 +7395,7 @@
colon: :
expression: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightParenthesis: )
staticInvokeType: void Function({int? a, bool? b})
@@ -7167,6 +7420,7 @@
colon: :
expression: BooleanLiteral
literal: false
+ parameter: <null>
staticType: bool*
NamedExpression
name: Label
@@ -7177,6 +7431,7 @@
colon: :
expression: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int*
rightParenthesis: )
staticInvokeType: void Function({int* a, bool* b})*
@@ -7211,6 +7466,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -7229,6 +7485,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -7262,6 +7519,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -7280,6 +7538,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -7352,6 +7611,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: foo@16::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -7369,6 +7629,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: foo@16::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -7401,6 +7662,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::C::@method::call::@parameter::_
staticType: int
rightParenthesis: )
staticElement: self::@class::C::@method::call
@@ -7419,6 +7681,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::C::@method::call::@parameter::_
staticType: int*
rightParenthesis: )
staticElement: self::@class::C::@method::call
@@ -7451,6 +7714,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: @-1
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -7469,6 +7733,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: @-1
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -7504,6 +7769,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -7521,6 +7787,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -7553,6 +7820,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::C::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -7570,6 +7838,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::C::@method::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -7598,6 +7867,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -7616,6 +7886,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -7653,6 +7924,7 @@
arguments
IntegerLiteral
literal: 1
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticInvokeType: double Function(int)
@@ -7675,6 +7947,7 @@
arguments
IntegerLiteral
literal: 1
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticInvokeType: double* Function(int*)*
@@ -7750,6 +8023,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@function::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -7767,6 +8041,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@function::foo::@parameter::_
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
@@ -7797,6 +8072,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -7815,6 +8091,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -7846,6 +8123,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int
rightParenthesis: )
staticElement: <null>
@@ -7864,6 +8142,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: root::@parameter::
staticType: int*
rightParenthesis: )
staticElement: <null>
@@ -7898,6 +8177,7 @@
arguments
SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: int
rightParenthesis: )
@@ -7921,6 +8201,7 @@
arguments
SimpleIdentifier
token: b
+ parameter: <null>
staticElement: self::@function::f::@parameter::b
staticType: int*
rightParenthesis: )
@@ -8050,6 +8331,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::remainder::@parameter::other
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -8065,6 +8347,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::other
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -8093,6 +8376,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::remainder::@parameter::other
staticInvokeType: int Function()
staticType: int
typeArgumentTypes
@@ -8108,6 +8392,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::other
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -8136,6 +8421,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::remainder::@parameter::other
staticInvokeType: int Function()
staticType: int
typeArgumentTypes
@@ -8151,6 +8437,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::other
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -8184,6 +8471,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@extension::E::@method::remainder::@parameter::x
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -8199,6 +8487,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@extension::E::@method::remainder::@parameter::x
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -8226,6 +8515,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: dart:core::@class::num::@method::remainder::@parameter::other
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -8241,6 +8531,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: root::@parameter::other
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -8274,6 +8565,7 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::remainder::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: double
rightParenthesis: )
@@ -8299,6 +8591,7 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: double*
rightParenthesis: )
@@ -8333,6 +8626,7 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::remainder::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
rightParenthesis: )
@@ -8358,6 +8652,7 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int*
rightParenthesis: )
@@ -8399,6 +8694,7 @@
arguments
SimpleIdentifier
token: b
+ parameter: dart:core::@class::num::@method::remainder::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int
rightParenthesis: )
@@ -8431,6 +8727,7 @@
arguments
SimpleIdentifier
token: b
+ parameter: root::@parameter::other
staticElement: self::@function::f::@parameter::b
staticType: int*
rightParenthesis: )
@@ -8466,6 +8763,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@extension::E::@method::remainder::@parameter::x
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -8481,6 +8779,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@extension::E::@method::remainder::@parameter::x
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -8515,6 +8814,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@extension::E::@method::remainder::@parameter::x
staticInvokeType: num Function()
staticType: num
typeArgumentTypes
@@ -8530,6 +8830,7 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: self::@extension::E::@method::remainder::@parameter::x
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -8569,7 +8870,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: <null>
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -8580,6 +8883,7 @@
literal: 0
staticType: int
rightBracket: ]
+ parameter: <null>
staticType: List<int>
rightParenthesis: )
staticInvokeType: dynamic
@@ -8602,7 +8906,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: root::@parameter::other
staticType: int*
+ parameter: <null>
staticElement: MethodMember
base: dart:core::@class::num::@method::+
isLegacy: true
@@ -8615,6 +8921,7 @@
literal: 0
staticType: int*
rightBracket: ]
+ parameter: <null>
staticType: List<int*>*
rightParenthesis: )
staticInvokeType: dynamic
@@ -8650,6 +8957,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: root::@parameter::a
+ substitution: {T: int, U: bool}
staticType: int
rightParenthesis: )
staticInvokeType: bool Function(int)
@@ -8670,6 +8980,9 @@
arguments
IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: root::@parameter::a
+ substitution: {T: int*, U: bool*}
staticType: int*
rightParenthesis: )
staticInvokeType: bool* Function(int*)*
@@ -8888,6 +9201,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@function::foo::@parameter::a
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -8905,6 +9219,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@function::foo::@parameter::a
staticType: int*
rightParenthesis: )
staticInvokeType: void Function(int*)*
diff --git a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
index d74ef96..0820f8c 100644
--- a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
@@ -430,6 +430,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart
index b5bc19b..4a8fd19 100644
--- a/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart
@@ -189,6 +189,9 @@
arguments
NullLiteral
literal: null
+ parameter: ParameterMember
+ base: root::@parameter::t
+ substitution: {T: int?}
staticType: Null
rightParenthesis: )
staticInvokeType: int? Function(int?)
@@ -411,6 +414,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -434,6 +438,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
@@ -476,6 +481,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -498,6 +504,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
@@ -538,6 +545,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -560,6 +568,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
diff --git a/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart
index d196a4a..dd07c0b 100644
--- a/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart
@@ -320,6 +320,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -343,6 +344,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
@@ -385,6 +387,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -407,6 +410,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
@@ -447,6 +451,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int
rightBracket: ]
staticElement: <null>
@@ -469,6 +474,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::[]=::@parameter::index
staticType: int*
rightBracket: ]
staticElement: <null>
@@ -552,6 +558,7 @@
arguments
SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: C
rightParenthesis: )
@@ -578,6 +585,7 @@
arguments
SimpleIdentifier
token: c
+ parameter: <null>
staticElement: self::@function::f::@parameter::c
staticType: C*
rightParenthesis: )
diff --git a/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart b/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart
index 1fd8874..828f515 100644
--- a/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart
@@ -107,6 +107,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@enum::E::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -363,6 +364,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::foo
readType: int
@@ -389,6 +391,9 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: ParameterMember
+ base: dart:core::@class::num::@method::+::@parameter::other
+ isLegacy: true
staticType: int*
readElement: self::@class::A::@getter::foo
readType: int*
@@ -432,6 +437,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::A::@setter::foo::@parameter::_foo
staticType: int
readElement: <null>
readType: null
@@ -458,6 +464,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::A::@setter::foo::@parameter::_foo
staticType: int*
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/dart/resolution/property_access_test.dart b/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
index ed2065a..9daf0fe 100644
--- a/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
@@ -259,6 +259,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@enum::E::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -327,6 +328,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -341,6 +343,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@extension::E::@getter::foo
readType: int
@@ -363,6 +366,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -377,6 +381,9 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: ParameterMember
+ base: dart:core::@class::num::@method::+::@parameter::other
+ isLegacy: true
staticType: int*
readElement: self::@extension::E::@getter::foo
readType: int*
@@ -418,6 +425,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A
rightParenthesis: )
@@ -432,6 +440,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -454,6 +463,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A*
rightParenthesis: )
@@ -468,6 +478,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@setter::foo::@parameter::_
staticType: int*
readElement: <null>
readType: null
@@ -556,6 +567,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::foo
readType: int
@@ -590,6 +602,9 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: ParameterMember
+ base: dart:core::@class::num::@method::+::@parameter::other
+ isLegacy: true
staticType: int*
readElement: self::@class::A::@getter::foo
readType: int*
@@ -641,6 +656,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::A::@setter::foo::@parameter::_foo
staticType: int
readElement: <null>
readType: null
@@ -675,6 +691,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::A::@setter::foo::@parameter::_foo
staticType: int*
readElement: <null>
readType: null
@@ -889,6 +906,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@extension::E::@getter::foo
readType: int
@@ -923,6 +941,9 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: ParameterMember
+ base: dart:core::@class::num::@method::+::@parameter::other
+ isLegacy: true
staticType: int*
readElement: self::@extension::E::@getter::foo
readType: int*
@@ -976,6 +997,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -1010,6 +1032,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@extension::E::@setter::foo::@parameter::_
staticType: int*
readElement: <null>
readType: null
@@ -1082,6 +1105,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::foo
readType: int
@@ -1106,6 +1130,9 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: ParameterMember
+ base: dart:core::@class::num::@method::+::@parameter::other
+ isLegacy: true
staticType: int*
readElement: self::@class::A::@getter::foo
readType: int*
@@ -1154,6 +1181,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::A::@setter::foo::@parameter::_foo
staticType: int
readElement: <null>
readType: null
@@ -1178,6 +1206,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::A::@setter::foo::@parameter::_foo
staticType: int*
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
index 579a3d4..a79316f 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
@@ -199,6 +199,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@extension::E::@setter::foo::@parameter::value
+ substitution: {T: int}
staticType: int
readElement: <null>
readType: null
@@ -227,6 +230,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@extension::E::@setter::foo::@parameter::value
+ substitution: {T: int*}
staticType: int*
readElement: <null>
readType: null
@@ -368,6 +374,9 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: ParameterMember
+ base: self::@extension::Test::@setter::test::@parameter::_
+ substitution: {T: S}
staticInvokeType: S Function()
staticType: S
typeArgumentTypes
@@ -408,6 +417,9 @@
argumentList: ArgumentList
leftParenthesis: (
rightParenthesis: )
+ parameter: ParameterMember
+ base: self::@extension::Test::@setter::test::@parameter::_
+ substitution: {T: num*}
staticInvokeType: num* Function()*
staticType: num*
typeArgumentTypes
@@ -586,6 +598,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A<int>
rightParenthesis: )
@@ -602,6 +615,9 @@
operator: =
rightHandSide: DoubleLiteral
literal: 1.2
+ parameter: ParameterMember
+ base: self::@extension::E::@setter::foo::@parameter::value
+ substitution: {T: num}
staticType: double
readElement: <null>
readType: null
@@ -636,6 +652,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A<int*>*
rightParenthesis: )
@@ -652,6 +669,9 @@
operator: =
rightHandSide: DoubleLiteral
literal: 1.2
+ parameter: ParameterMember
+ base: self::@extension::E::@setter::foo::@parameter::value
+ substitution: {T: num*}
staticType: double*
readElement: <null>
readType: null
@@ -793,6 +813,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A<int>
rightParenthesis: )
@@ -809,6 +830,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@extension::E::@setter::foo::@parameter::value
+ substitution: {T: int}
staticType: int
readElement: <null>
readType: null
@@ -833,6 +857,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::f::@parameter::a
staticType: A<int*>*
rightParenthesis: )
@@ -849,6 +874,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: self::@extension::E::@setter::foo::@parameter::value
+ substitution: {T: int*}
staticType: int*
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
index fd9aae8..a56ac84 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
@@ -38,6 +38,9 @@
arguments
NullLiteral
literal: null
+ parameter: ParameterMember
+ base: root::@parameter::t
+ substitution: {T: Iterable<int>?}
staticType: Null
rightParenthesis: )
staticInvokeType: Iterable<int>? Function(Iterable<int>?)
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
index d081d5f..c304f28 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
@@ -53,6 +53,9 @@
arguments
NullLiteral
literal: null
+ parameter: ParameterMember
+ base: root::@parameter::t
+ substitution: {T: Map<int, double>?}
staticType: Null
rightParenthesis: )
staticInvokeType: Map<int, double>? Function(Map<int, double>?)
diff --git a/pkg/analyzer/test/src/diagnostics/abstract_super_member_reference_test.dart b/pkg/analyzer/test/src/diagnostics/abstract_super_member_reference_test.dart
index d743a92..d736578 100644
--- a/pkg/analyzer/test/src/diagnostics/abstract_super_member_reference_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/abstract_super_member_reference_test.dart
@@ -46,6 +46,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -156,6 +157,7 @@
arguments
IntegerLiteral
literal: 0
+ parameter: self::@class::A::@method::foo::@parameter::_
staticType: int
rightParenthesis: )
staticInvokeType: void Function(int)
@@ -452,6 +454,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -494,6 +497,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -536,6 +540,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: a
+ parameter: self::@class::A::@setter::foo::@parameter::a
staticElement: self::@class::B::@setter::foo::@parameter::a
staticType: int
readElement: <null>
@@ -577,6 +582,7 @@
operator: =
rightHandSide: SimpleIdentifier
token: a
+ parameter: self::@class::A::@setter::foo::@parameter::a
staticElement: self::@class::B::@setter::foo::@parameter::a
staticType: int
readElement: <null>
@@ -622,6 +628,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: self::@class::A::@setter::foo::@parameter::_
staticType: int
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart b/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
index 616f384..4838d2a 100644
--- a/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
@@ -358,6 +358,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 3
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/diagnostics/duplicate_import_test.dart b/pkg/analyzer/test/src/diagnostics/duplicate_import_test.dart
index a403bd1..494f159 100644
--- a/pkg/analyzer/test/src/diagnostics/duplicate_import_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/duplicate_import_test.dart
@@ -16,20 +16,48 @@
@reflectiveTest
class DuplicateImportTest extends PubPackageResolutionTest {
- test_duplicateImport() async {
- newFile('$testPackageLibPath/lib1.dart', r'''
-library lib1;
-class A {}''');
+ test_duplicateImport_absolute_absolute() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+class A {}
+''');
- newFile('$testPackageLibPath/lib2.dart', r'''
-library L;
-import 'lib1.dart';
-import 'lib1.dart';
-A a = A();''');
+ await assertErrorsInCode(r'''
+import 'package:test/a.dart';
+import 'package:test/a.dart';
- await _resolveFile('$testPackageLibPath/lib1.dart');
- await _resolveFile('$testPackageLibPath/lib2.dart', [
- error(HintCode.DUPLICATE_IMPORT, 38, 11),
+final a = A();
+''', [
+ error(HintCode.DUPLICATE_IMPORT, 37, 21),
+ ]);
+ }
+
+ test_duplicateImport_relative_absolute() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+class A {}
+''');
+
+ await assertErrorsInCode(r'''
+import 'a.dart';
+import 'package:test/a.dart';
+
+final a = A();
+''', [
+ error(HintCode.DUPLICATE_IMPORT, 24, 21),
+ ]);
+ }
+
+ test_duplicateImport_relative_relative() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+class A {}
+''');
+
+ await assertErrorsInCode(r'''
+import 'a.dart';
+import 'a.dart';
+
+final a = A();
+''', [
+ error(HintCode.DUPLICATE_IMPORT, 24, 8),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart b/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart
index d06b020..a691893 100644
--- a/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart
@@ -177,6 +177,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@extension::E::@setter::a::@parameter::v
staticType: int
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/diagnostics/non_constant_default_value_test.dart b/pkg/analyzer/test/src/diagnostics/non_constant_default_value_test.dart
index 5398b86..98e12ec 100644
--- a/pkg/analyzer/test/src/diagnostics/non_constant_default_value_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_constant_default_value_test.dart
@@ -98,6 +98,25 @@
]);
}
+ test_enum_issue49097() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+class A {
+ static const foo = A();
+ static const bar = A();
+ const A();
+}
+''');
+ await assertNoErrorsInCode(r'''
+import 'a.dart';
+
+enum E {
+ v(f: A.foo);
+ final A f;
+ const E({this.f = A.bar});
+}
+''');
+ }
+
test_function_named() async {
await assertErrorsInCode(r'''
int y = 0;
diff --git a/pkg/analyzer/test/src/diagnostics/non_null_opt_out_test.dart b/pkg/analyzer/test/src/diagnostics/non_null_opt_out_test.dart
index ab85796..4f2c5af 100644
--- a/pkg/analyzer/test/src/diagnostics/non_null_opt_out_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_null_opt_out_test.dart
@@ -49,6 +49,9 @@
leftBracket: [
index: NullLiteral
literal: null
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@method::[]=::@parameter::a
+ isLegacy: true
staticType: Null*
rightBracket: ]
staticElement: <null>
@@ -56,6 +59,9 @@
operator: =
rightHandSide: NullLiteral
literal: null
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@method::[]=::@parameter::b
+ isLegacy: true
staticType: Null*
readElement: <null>
readType: null
@@ -101,6 +107,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@setter::foo::@parameter::_foo
+ isLegacy: true
staticType: int*
readElement: <null>
readType: null
@@ -147,6 +156,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@extension::E::@setter::foo::@parameter::_
+ isLegacy: true
staticType: int*
readElement: <null>
readType: null
@@ -192,6 +204,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@setter::foo::@parameter::_foo
+ isLegacy: true
staticType: int*
readElement: <null>
readType: null
@@ -237,6 +252,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@extension::E::@setter::foo::@parameter::_foo
+ isLegacy: true
staticType: int*
readElement: <null>
readType: null
@@ -280,6 +298,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@setter::foo::@parameter::_foo
+ isLegacy: true
staticType: int*
readElement: <null>
readType: null
@@ -335,6 +356,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@setter::foo::@parameter::_foo
+ isLegacy: true
staticType: int*
readElement: <null>
readType: null
@@ -391,6 +415,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@extension::E::@setter::foo::@parameter::a
+ isLegacy: true
staticType: int*
readElement: <null>
readType: null
@@ -433,6 +460,7 @@
arguments
SimpleIdentifier
token: a
+ parameter: <null>
staticElement: self::@function::main::@parameter::a
staticType: A*
rightParenthesis: )
@@ -447,6 +475,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@extension::E::@setter::foo::@parameter::a
+ isLegacy: true
staticType: int*
readElement: <null>
readType: null
@@ -492,6 +523,9 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: ParameterMember
+ base: package:test/a.dart::@class::A::@setter::foo::@parameter::_foo
+ isLegacy: true
staticType: int*
readElement: <null>
readType: null
@@ -527,6 +561,9 @@
operator: =
rightHandSide: NullLiteral
literal: null
+ parameter: ParameterMember
+ base: package:test/a.dart::@setter::foo::@parameter::_foo
+ isLegacy: true
staticType: Null*
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/diagnostics/private_setter_test.dart b/pkg/analyzer/test/src/diagnostics/private_setter_test.dart
index e0163e8..be2b945 100644
--- a/pkg/analyzer/test/src/diagnostics/private_setter_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/private_setter_test.dart
@@ -49,6 +49,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: package:test/a.dart::@class::A::@setter::_foo::@parameter::__foo
staticType: int
readElement: <null>
readType: null
@@ -108,6 +109,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: package:test/a.dart::@class::A::@setter::_foo::@parameter::_
staticType: int
readElement: <null>
readType: null
@@ -152,6 +154,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: package:test/a.dart::@class::A::@setter::_foo::@parameter::_
staticType: int
readElement: <null>
readType: null
diff --git a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
index 8e202b1..2b705e8 100644
--- a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
@@ -40,7 +40,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: <null>
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -76,11 +78,13 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
rightParenthesis: )
+ parameter: <null>
staticType: int
staticElement: <null>
staticInvokeType: null
@@ -109,7 +113,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: dart:core::@class::Object::@method::==::@parameter::other
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -147,11 +153,13 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
rightParenthesis: )
+ parameter: <null>
staticType: int
staticElement: <null>
staticInvokeType: null
@@ -215,6 +223,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightBracket: ]
staticElement: <null>
@@ -243,6 +252,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightBracket: ]
staticElement: <null>
@@ -255,7 +265,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: <null>
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -288,6 +300,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightBracket: ]
staticElement: <null>
@@ -300,7 +313,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: <null>
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -332,6 +347,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightBracket: ]
staticElement: <null>
@@ -360,6 +376,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightBracket: ]
staticElement: <null>
@@ -372,7 +389,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: <null>
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -405,6 +424,7 @@
leftBracket: [
index: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
rightBracket: ]
staticElement: <null>
@@ -417,7 +437,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: <null>
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -470,7 +492,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: <null>
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -512,7 +536,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: <null>
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -553,7 +579,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
+ parameter: <null>
staticElement: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
@@ -721,6 +749,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
readElement: <null>
readType: dynamic
@@ -772,6 +801,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -857,7 +887,9 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: root::@parameter::other
staticType: int*
+ parameter: root::@parameter::other
staticElement: MethodMember
base: dart:core::@class::num::@method::+
isLegacy: true
@@ -899,6 +931,7 @@
operator: +
rightOperand: IntegerLiteral
literal: 2
+ parameter: root::@parameter::other
staticType: int*
staticElement: MethodMember
base: dart:core::@class::num::@method::+
@@ -906,6 +939,7 @@
staticInvokeType: num* Function(num*)*
staticType: int*
rightParenthesis: )
+ parameter: <null>
staticType: int*
staticElement: <null>
staticInvokeType: null
diff --git a/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart b/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart
index 14711e9..b6cbd94 100644
--- a/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart
@@ -436,6 +436,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 1
+ parameter: self::@class::A::@setter::x::@parameter::_x
staticType: int
readElement: <null>
readType: null
@@ -473,6 +474,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 2
+ parameter: self::@class::A::@setter::x::@parameter::_x
staticType: int
readElement: <null>
readType: null
@@ -504,6 +506,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -526,6 +529,7 @@
operator: =
rightHandSide: IntegerLiteral
literal: 0
+ parameter: <null>
staticType: int
readElement: <null>
readType: null
@@ -586,6 +590,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::x
readType: int
@@ -623,6 +628,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::y
readType: int?
@@ -682,6 +688,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 1
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::x
readType: int
@@ -715,6 +722,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 2
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@class::A::@getter::x
readType: int
@@ -746,6 +754,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@function::m::@parameter::x
readType: int
@@ -768,6 +777,7 @@
operator: +=
rightHandSide: IntegerLiteral
literal: 0
+ parameter: dart:core::@class::num::@method::+::@parameter::other
staticType: int
readElement: self::@function::m::@parameter::y
readType: int?
diff --git a/pkg/analyzer/test/src/summary/element_text.dart b/pkg/analyzer/test/src/summary/element_text.dart
index e162fb4..7400c6d 100644
--- a/pkg/analyzer/test/src/summary/element_text.dart
+++ b/pkg/analyzer/test/src/summary/element_text.dart
@@ -214,6 +214,8 @@
selfUriStr: selfUriStr,
sink: buffer,
indent: indent,
+ // TODO(scheglov) https://github.com/dart-lang/sdk/issues/49101
+ withParameterElements: false,
withOffsets: true,
);
}
diff --git a/pkg/analyzer/test/src/summary/elements_base.dart b/pkg/analyzer/test/src/summary/elements_base.dart
index 3fd14b1..87eff04 100644
--- a/pkg/analyzer/test/src/summary/elements_base.dart
+++ b/pkg/analyzer/test/src/summary/elements_base.dart
@@ -2,127 +2,20 @@
// 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:_fe_analyzer_shared/src/macros/executor/multi_executor.dart'
- as macro;
-import 'package:analyzer/dart/analysis/declared_variables.dart';
-import 'package:analyzer/dart/analysis/features.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/context/context.dart';
-import 'package:analyzer/src/context/packages.dart';
-import 'package:analyzer/src/dart/analysis/session.dart';
-import 'package:analyzer/src/dart/ast/ast.dart';
-import 'package:analyzer/src/dart/element/class_hierarchy.dart';
+import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/src/dart/element/element.dart';
-import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
-import 'package:analyzer/src/dart/sdk/sdk.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/utilities_dart.dart';
-import 'package:analyzer/src/source/package_map_resolver.dart';
-import 'package:analyzer/src/summary2/bundle_reader.dart';
-import 'package:analyzer/src/summary2/informative_data.dart';
-import 'package:analyzer/src/summary2/kernel_compilation_service.dart';
-import 'package:analyzer/src/summary2/link.dart';
-import 'package:analyzer/src/summary2/linked_element_factory.dart';
-import 'package:analyzer/src/summary2/macro.dart';
-import 'package:analyzer/src/summary2/reference.dart';
-import 'package:analyzer/src/test_utilities/mock_sdk.dart';
-import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
-import 'package:analyzer/src/util/performance/operation_performance.dart';
-import 'package:analyzer/src/util/uri.dart';
-import 'package:meta/meta.dart';
-import 'package:path/path.dart' as package_path;
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import '../../util/feature_sets.dart';
-import 'test_strategies.dart';
+import '../dart/resolution/context_collection_resolution.dart';
/// A base for testing building elements.
@reflectiveTest
-abstract class ElementsBaseTest with ResourceProviderMixin {
- /// The shared SDK bundle, computed once and shared among test invocations.
- static _SdkBundle? _sdkBundle;
-
- /// The instance of macro executor that is used for all macros.
- final macro.MultiMacroExecutor _macroExecutor = macro.MultiMacroExecutor();
-
- /// The set of features enabled in this test.
- FeatureSet featureSet = FeatureSets.latestWithExperiments;
-
- DeclaredVariables declaredVariables = DeclaredVariables();
- late final SourceFactory sourceFactory;
- late final FolderBasedDartSdk sdk;
-
- ElementsBaseTest() {
- var sdkRoot = newFolder('/sdk');
- createMockSdk(
- resourceProvider: resourceProvider,
- root: sdkRoot,
- );
- sdk = FolderBasedDartSdk(resourceProvider, sdkRoot);
- }
-
+abstract class ElementsBaseTest extends PubPackageResolutionTest {
/// We need to test both cases - when we keep linking libraries (happens for
/// new or invalidated libraries), and when we load libraries from bytes
/// (happens internally in Blaze or when we have cached summaries).
bool get keepLinkingLibraries;
- Future<_SdkBundle> get sdkBundle async {
- if (_sdkBundle != null) {
- return _sdkBundle!;
- }
-
- var featureSet = FeatureSet.latestLanguageVersion();
- var inputLibraries = <LinkInputLibrary>[];
- for (var sdkLibrary in sdk.sdkLibraries) {
- var source = sourceFactory.resolveUri(null, sdkLibrary.shortName)!;
- var text = getFile(source.fullName).readAsStringSync();
- var unit = parseText(source, text, featureSet);
-
- var inputUnits = <LinkInputUnit>[];
- _addLibraryUnits(source, unit, inputUnits, featureSet);
- inputLibraries.add(
- LinkInputLibrary(
- source: source,
- units: inputUnits,
- ),
- );
- }
-
- var elementFactory = LinkedElementFactory(
- AnalysisContextImpl(
- SynchronousSession(
- AnalysisOptionsImpl(),
- declaredVariables,
- ),
- sourceFactory,
- ),
- _AnalysisSessionForLinking(),
- Reference.root(),
- );
-
- var sdkLinkResult = await link2(
- elementFactory: elementFactory,
- inputLibraries: inputLibraries,
- performance: OperationPerformanceImpl('link'),
- );
-
- return _sdkBundle = _SdkBundle(
- resolutionBytes: sdkLinkResult.resolutionBytes,
- );
- }
-
- String get testFilePath => '$testPackageLibPath/test.dart';
-
- String get testPackageLibPath => '$testPackageRootPath/lib';
-
- String get testPackageRootPath => '$workspaceRootPath/test';
-
- String get workspaceRootPath => '/home';
-
void addSource(String path, String contents) {
newFile(path, contents);
}
@@ -133,404 +26,24 @@
bool dumpSummaries = false,
List<Set<String>>? preBuildSequence,
}) async {
- final performance = OperationPerformanceImpl('<root>');
- final result = await performance.runAsync(
- 'buildLibrary',
- (performance) async {
- _buildSourceFactory();
+ final file = newFile(testFilePath, text);
+ final analysisContext = contextFor(file.path);
+ final analysisSession = analysisContext.currentSession;
- var testFile = newFile(testFilePath, text);
- var testUri = sourceFactory.pathToUri(testFile.path)!;
- var testSource = sourceFactory.forUri2(testUri)!;
+ final uriStr = 'package:test/test.dart';
+ final libraryResult = await analysisSession.getLibraryByUri(uriStr);
+ libraryResult as LibraryElementResult;
- var inputLibraries = <LinkInputLibrary>[];
- _addNonDartLibraries({}, inputLibraries, testSource);
-
- var unitsInformativeBytes = <Uri, Uint8List>{};
- for (var inputLibrary in inputLibraries) {
- for (var inputUnit in inputLibrary.units) {
- var informativeBytes = writeUnitInformative(inputUnit.unit);
- unitsInformativeBytes[inputUnit.uri] = informativeBytes;
- }
- }
-
- var analysisContext = AnalysisContextImpl(
- SynchronousSession(
- AnalysisOptionsImpl()..contextFeatures = featureSet,
- declaredVariables,
- ),
- sourceFactory,
- );
-
- var elementFactory = LinkedElementFactory(
- analysisContext,
- _AnalysisSessionForLinking(),
- Reference.root(),
- );
- elementFactory.addBundle(
- BundleReader(
- elementFactory: elementFactory,
- unitsInformativeBytes: {},
- resolutionBytes: (await sdkBundle).resolutionBytes,
- ),
- );
-
- await performance.runAsync(
- 'linkConfiguredLibraries',
- (performance) async {
- await _linkConfiguredLibraries(
- elementFactory,
- inputLibraries,
- preBuildSequence,
- performance,
- );
- },
- );
-
- var linkResult = await performance.runAsync(
- 'link',
- (performance) async {
- return await link2(
- elementFactory: elementFactory,
- inputLibraries: inputLibraries,
- macroExecutor: _macroExecutor,
- performance: performance,
- );
- },
- );
-
- for (var macroUnit in linkResult.macroGeneratedUnits) {
- var informativeBytes = writeUnitInformative(macroUnit.unit);
- unitsInformativeBytes[macroUnit.uri] = informativeBytes;
- }
-
- if (!keepLinkingLibraries) {
- elementFactory.removeBundle(
- inputLibraries.map((e) => e.uriStr).toSet(),
- );
- elementFactory.addBundle(
- BundleReader(
- elementFactory: elementFactory,
- unitsInformativeBytes: unitsInformativeBytes,
- resolutionBytes: linkResult.resolutionBytes,
- ),
- );
- }
-
- return elementFactory.libraryOfUri2('$testUri');
- },
- );
-
- // final performanceBuffer = StringBuffer();
- // performance.children.single.write(buffer: performanceBuffer);
- // print(performanceBuffer);
-
- return result;
- }
-
- @mustCallSuper
- Future<void> setUp() async {}
-
- @mustCallSuper
- Future<void> tearDown() async {
- await _macroExecutor.close();
- KernelCompilationService.disposeDelayed(
- const Duration(milliseconds: 100),
- );
- }
-
- void _addLibraryUnits(
- Source definingSource,
- CompilationUnit definingUnit,
- List<LinkInputUnit> units,
- FeatureSet featureSet,
- ) {
- units.add(
- LinkInputUnit(
- partDirectiveIndex: null,
- source: definingSource,
- isSynthetic: false,
- unit: definingUnit,
- ),
- );
-
- var partDirectiveIndex = -1;
- for (var directive in definingUnit.directives) {
- if (directive is PartDirective) {
- ++partDirectiveIndex;
- var relativeUriStr = directive.uri.stringValue;
-
- var partSource = sourceFactory.resolveUri(
- definingSource,
- relativeUriStr,
- );
-
- if (partSource != null) {
- var text = _readSafely(partSource.fullName);
- var unit = parseText(partSource, text, featureSet);
- units.add(
- LinkInputUnit(
- partDirectiveIndex: partDirectiveIndex,
- partUriStr: relativeUriStr,
- source: partSource,
- isSynthetic: false,
- unit: unit,
- ),
- );
- }
- }
+ if (keepLinkingLibraries) {
+ return libraryResult.element as LibraryElementImpl;
+ } else {
+ analysisContext.changeFile(file.path);
+ await analysisContext.applyPendingFileChanges();
+ // Ask again, should be read from bytes.
+ final analysisSession = analysisContext.currentSession;
+ final libraryResult = await analysisSession.getLibraryByUri(uriStr);
+ libraryResult as LibraryElementResult;
+ return libraryResult.element as LibraryElementImpl;
}
}
-
- void _addNonDartLibraries(
- Set<Source> addedLibraries,
- List<LinkInputLibrary> libraries,
- Source source,
- ) {
- if (source.uri.isScheme('dart') || !addedLibraries.add(source)) {
- return;
- }
-
- var text = _readSafely(source.fullName);
- var unit = parseText(source, text, featureSet);
-
- var units = <LinkInputUnit>[];
- _addLibraryUnits(source, unit, units, featureSet);
- libraries.add(
- LinkInputLibrary(
- source: source,
- units: units,
- ),
- );
-
- void addRelativeUriStr(StringLiteral uriNode) {
- var relativeUriStr = uriNode.stringValue;
- if (relativeUriStr == null) {
- return;
- }
-
- Uri relativeUri;
- try {
- relativeUri = Uri.parse(relativeUriStr);
- } on FormatException {
- return;
- }
-
- var absoluteUri = resolveRelativeUri(source.uri, relativeUri);
- var rewrittenUri = rewriteToCanonicalUri(sourceFactory, absoluteUri);
- if (rewrittenUri == null) {
- return;
- }
-
- var uriSource = sourceFactory.forUri2(rewrittenUri);
- if (uriSource == null) {
- return;
- }
-
- _addNonDartLibraries(addedLibraries, libraries, uriSource);
- }
-
- for (var directive in unit.directives) {
- if (directive is NamespaceDirective) {
- addRelativeUriStr(directive.uri);
- for (var configuration in directive.configurations) {
- addRelativeUriStr(configuration.uri);
- }
- }
- }
- }
-
- /// If there are any [macroLibraries], build the kernel and prepare for
- /// execution.
- Future<void> _buildMacroLibraries(
- LinkedElementFactory elementFactory,
- List<MacroLibrary> macroLibraries,
- ) async {
- if (macroLibraries.isEmpty) {
- return;
- }
-
- final macroKernelBuilder = const MacroKernelBuilder();
- var macroKernelBytes = await macroKernelBuilder.build(
- fileSystem: _MacroFileSystem(resourceProvider),
- libraries: macroLibraries,
- );
-
- var bundleMacroExecutor = BundleMacroExecutor(
- macroExecutor: _macroExecutor,
- kernelBytes: macroKernelBytes,
- libraries: macroLibraries.map((e) => e.uri).toSet(),
- );
-
- for (var macroLibrary in macroLibraries) {
- var uriStr = macroLibrary.uriStr;
- var element = elementFactory.libraryOfUri2(uriStr);
- element.bundleMacroExecutor = bundleMacroExecutor;
- }
- }
-
- void _buildSourceFactory() {
- final packages = parsePackageConfigJsonFile(
- resourceProvider,
- getFile('$testPackageRootPath/.dart_tool/package_config.json'),
- );
-
- // TODO(scheglov) Can we use Packages instead?
- final packageMap = <String, List<Folder>>{};
- for (final package in packages.packages) {
- packageMap[package.name] = [package.libFolder];
- }
-
- sourceFactory = SourceFactory([
- DartUriResolver(sdk),
- PackageMapUriResolver(resourceProvider, packageMap),
- ResourceUriResolver(resourceProvider),
- ]);
- }
-
- /// If there are any libraries in the [uriStrSetList], link these subsets
- /// of [inputLibraries] (and remove from it), build macro kernels, prepare
- /// for executing macros.
- Future<void> _linkConfiguredLibraries(
- LinkedElementFactory elementFactory,
- List<LinkInputLibrary> inputLibraries,
- List<Set<String>>? uriStrSetList,
- OperationPerformanceImpl performance,
- ) async {
- if (uriStrSetList == null) {
- return;
- }
-
- for (var uriStrSet in uriStrSetList) {
- var cycleInputLibraries = <LinkInputLibrary>[];
- var macroLibraries = <MacroLibrary>[];
- for (var inputLibrary in inputLibraries) {
- if (uriStrSet.contains(inputLibrary.uriStr)) {
- cycleInputLibraries.add(inputLibrary);
- _addMacroLibrary(macroLibraries, inputLibrary);
- }
- }
-
- await performance.runAsync('link', (performance) async {
- await link2(
- elementFactory: elementFactory,
- inputLibraries: cycleInputLibraries,
- macroExecutor: _macroExecutor,
- performance: performance,
- );
- performance.collapse();
- });
-
- await performance.runAsync('buildMacroLibraries', (_) async {
- await _buildMacroLibraries(elementFactory, macroLibraries);
- });
-
- // Remove libraries that we just linked.
- cycleInputLibraries.forEach(inputLibraries.remove);
- }
- }
-
- String _readSafely(String path) {
- try {
- var file = resourceProvider.getFile(path);
- return file.readAsStringSync();
- } catch (_) {
- return '';
- }
- }
-
- /// If there are any macros in the [inputLibrary], add it.
- static void _addMacroLibrary(
- List<MacroLibrary> macroLibraries,
- LinkInputLibrary inputLibrary,
- ) {
- var macroClasses = <MacroClass>[];
- for (var inputUnit in inputLibrary.units) {
- for (var declaration in inputUnit.unit.declarations) {
- if (declaration is ClassDeclarationImpl &&
- declaration.macroKeyword != null) {
- var constructors =
- declaration.members.whereType<ConstructorDeclaration>().toList();
- if (constructors.isEmpty) {
- macroClasses.add(
- MacroClass(
- name: declaration.name.name,
- constructors: [''],
- ),
- );
- } else {
- var constructorNames = constructors
- .map((e) => e.name?.name ?? '')
- .where((e) => !e.startsWith('_'))
- .toList();
- if (constructorNames.isNotEmpty) {
- macroClasses.add(
- MacroClass(
- name: declaration.name.name,
- constructors: constructorNames,
- ),
- );
- }
- }
- }
- }
- }
- if (macroClasses.isNotEmpty) {
- macroLibraries.add(
- MacroLibrary(
- uri: inputLibrary.uri,
- path: inputLibrary.source.fullName,
- classes: macroClasses,
- ),
- );
- }
- }
-}
-
-class _AnalysisSessionForLinking implements AnalysisSessionImpl {
- @override
- final ClassHierarchy classHierarchy = ClassHierarchy();
-
- @override
- InheritanceManager3 inheritanceManager = InheritanceManager3();
-
- @override
- noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
-}
-
-/// [MacroFileEntry] adapter for [File].
-class _MacroFileEntry implements MacroFileEntry {
- final File file;
-
- _MacroFileEntry(this.file);
-
- @override
- String get content => file.readAsStringSync();
-
- @override
- bool get exists => file.exists;
-}
-
-/// [MacroFileSystem] adapter for [ResourceProvider].
-class _MacroFileSystem implements MacroFileSystem {
- final ResourceProvider resourceProvider;
-
- _MacroFileSystem(this.resourceProvider);
-
- @override
- package_path.Context get pathContext => resourceProvider.pathContext;
-
- @override
- MacroFileEntry getFile(String path) {
- var file = resourceProvider.getFile(path);
- return _MacroFileEntry(file);
- }
-}
-
-class _SdkBundle {
- final Uint8List resolutionBytes;
-
- _SdkBundle({
- required this.resolutionBytes,
- });
}
diff --git a/pkg/analyzer/test/src/summary/elements_test.dart b/pkg/analyzer/test/src/summary/elements_test.dart
index 1d82985..331a9ab 100644
--- a/pkg/analyzer/test/src/summary/elements_test.dart
+++ b/pkg/analyzer/test/src/summary/elements_test.dart
@@ -2,16 +2,13 @@
// 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 'package:analyzer/dart/analysis/declared_variables.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/src/dart/element/element.dart';
-import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import '../../util/feature_sets.dart';
import 'element_text.dart';
import 'elements_base.dart';
@@ -43,15 +40,6 @@
}
abstract class ElementsTest extends ElementsBaseTest {
- @override
- Future<void> setUp() async {
- await super.setUp();
-
- _writeTestPackageConfig(
- PackageConfigFileBuilder(),
- );
- }
-
test_class_abstract() async {
var library = await buildLibrary('abstract class C {}');
checkElementText(library, r'''
@@ -5554,17 +5542,17 @@
}
test_class_notSimplyBounded_function_typed_bound_complex_via_parameter_type_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary('''
+// @dart = 2.9
class C<T extends void Function(T)> {}
''');
checkElementText(library, r'''
library
definingUnit
classes
- notSimplyBounded class C @6
+ notSimplyBounded class C @21
typeParameters
- covariant T @8
+ covariant T @23
bound: void Function(T*)*
defaultType: void Function(Null*)*
constructors
@@ -5924,8 +5912,8 @@
}
test_class_ref_nullability_star() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary('''
+// @dart = 2.9
class C {}
C c;
''');
@@ -5933,11 +5921,11 @@
library
definingUnit
classes
- class C @6
+ class C @21
constructors
synthetic @-1
topLevelVariables
- static c @13
+ static c @28
type: C*
accessors
synthetic static get c @-1
@@ -6611,8 +6599,8 @@
}
test_class_typeParameters_defaultType_functionTypeAlias_contravariant_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary(r'''
+// @dart = 2.9
typedef F<X> = void Function(X);
class A<X extends F<X>> {}
@@ -6621,9 +6609,9 @@
library
definingUnit
classes
- notSimplyBounded class A @40
+ notSimplyBounded class A @55
typeParameters
- covariant X @42
+ covariant X @57
bound: void Function(X*)*
alias: self::@typeAlias::F
typeArguments
@@ -6635,9 +6623,9 @@
constructors
synthetic @-1
typeAliases
- F @8
+ F @23
typeParameters
- contravariant X @10
+ contravariant X @25
defaultType: dynamic
aliasedType: void Function(X*)*
aliasedElement: GenericFunctionTypeElement
@@ -6794,17 +6782,17 @@
}
test_class_typeParameters_defaultType_genericFunctionType_both_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary(r'''
+// @dart = 2.9
class A<X extends X Function(X)> {}
''');
checkElementText(library, r'''
library
definingUnit
classes
- notSimplyBounded class A @6
+ notSimplyBounded class A @21
typeParameters
- covariant X @8
+ covariant X @23
bound: X* Function(X*)*
defaultType: dynamic Function(Null*)*
constructors
@@ -6831,17 +6819,17 @@
}
test_class_typeParameters_defaultType_genericFunctionType_contravariant_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary(r'''
+// @dart = 2.9
class A<X extends void Function(X)> {}
''');
checkElementText(library, r'''
library
definingUnit
classes
- notSimplyBounded class A @6
+ notSimplyBounded class A @21
typeParameters
- covariant X @8
+ covariant X @23
bound: void Function(X*)*
defaultType: void Function(Null*)*
constructors
@@ -9915,17 +9903,11 @@
test_compilationUnit_nnbd_disabled_via_dart_directive() async {
var library = await buildLibrary('''
-// @dart=2.2
+// @dart = 2.9
''');
expect(library.isNonNullableByDefault, isFalse);
}
- test_compilationUnit_nnbd_disabled_via_feature_set() async {
- featureSet = FeatureSets.language_2_9;
- var library = await buildLibrary('');
- expect(library.isNonNullableByDefault, isFalse);
- }
-
test_compilationUnit_nnbd_enabled() async {
var library = await buildLibrary('');
expect(library.isNonNullableByDefault, isTrue);
@@ -15280,21 +15262,21 @@
}
test_const_topLevel_throw_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary(r'''
+// @dart = 2.9
const c = throw 42;
''');
checkElementText(library, r'''
library
definingUnit
topLevelVariables
- static const c @6
+ static const c @21
type: dynamic
constantInitializer
ThrowExpression
- throwKeyword: throw @10
+ throwKeyword: throw @25
expression: IntegerLiteral
- literal: 42 @16
+ literal: 42 @31
staticType: int*
staticType: Never*
accessors
@@ -16248,8 +16230,8 @@
}
test_defaultValue_eliminateTypeParameters_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary('''
+// @dart = 2.9
class A<T> {
const X({List<T> a = const []});
}
@@ -16258,22 +16240,22 @@
library
definingUnit
classes
- class A @6
+ class A @21
typeParameters
- covariant T @8
+ covariant T @23
defaultType: dynamic
constructors
synthetic @-1
methods
- abstract X @21
+ abstract X @36
parameters
- optionalNamed a @32
+ optionalNamed a @47
type: List<T*>*
constantInitializer
ListLiteral
- constKeyword: const @36
- leftBracket: [ @42
- rightBracket: ] @43
+ constKeyword: const @51
+ leftBracket: [ @57
+ rightBracket: ] @58
staticType: List<Null*>*
returnType: dynamic
''');
@@ -16442,17 +16424,17 @@
}
test_defaultValue_methodMember_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary('''
+// @dart = 2.9
void f([Comparator<T> compare = Comparable.compare]) {}
''');
checkElementText(library, r'''
library
definingUnit
functions
- f @5
+ f @20
parameters
- optionalPositional compare @22
+ optionalPositional compare @37
type: int* Function(dynamic, dynamic)*
alias: dart:core::@typeAlias::Comparator
typeArguments
@@ -16460,12 +16442,12 @@
constantInitializer
PrefixedIdentifier
prefix: SimpleIdentifier
- token: Comparable @32
+ token: Comparable @47
staticElement: dart:core::@class::Comparable
staticType: null
- period: . @42
+ period: . @57
identifier: SimpleIdentifier
- token: compare @43
+ token: compare @58
staticElement: MethodMember
base: dart:core::@class::Comparable::@method::compare
isLegacy: true
@@ -16670,8 +16652,8 @@
}
test_defaultValue_refersToGenericClass_constructor2_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary('''
+// @dart = 2.9
abstract class A<T> {}
class B<T> implements A<T> {
const B();
@@ -16684,38 +16666,38 @@
library
definingUnit
classes
- abstract class A @15
+ abstract class A @30
typeParameters
- covariant T @17
+ covariant T @32
defaultType: dynamic
constructors
synthetic @-1
- class B @29
+ class B @44
typeParameters
- covariant T @31
+ covariant T @46
defaultType: dynamic
interfaces
A<T*>*
constructors
- const @60
- class C @73
+ const @75
+ class C @88
typeParameters
- covariant T @75
+ covariant T @90
defaultType: dynamic
interfaces
A<Iterable<T*>*>*
constructors
- const @114
+ const @129
parameters
- optionalPositional a @122
+ optionalPositional a @137
type: A<T*>*
constantInitializer
InstanceCreationExpression
- keyword: const @126
+ keyword: const @141
constructorName: ConstructorName
type: NamedType
name: SimpleIdentifier
- token: B @132
+ token: B @147
staticElement: self::@class::B
staticType: null
type: B<Null*>*
@@ -16723,15 +16705,15 @@
base: self::@class::B::@constructor::•
substitution: {T: Null*}
argumentList: ArgumentList
- leftParenthesis: ( @133
- rightParenthesis: ) @134
+ leftParenthesis: ( @148
+ rightParenthesis: ) @149
staticType: B<Null*>*
''');
}
test_defaultValue_refersToGenericClass_constructor_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary('''
+// @dart = 2.9
class B<T> {
const B();
}
@@ -16743,28 +16725,28 @@
library
definingUnit
classes
- class B @6
+ class B @21
typeParameters
- covariant T @8
+ covariant T @23
defaultType: dynamic
constructors
- const @21
- class C @34
+ const @36
+ class C @49
typeParameters
- covariant T @36
+ covariant T @51
defaultType: dynamic
constructors
- const @49
+ const @64
parameters
- optionalPositional b @57
+ optionalPositional b @72
type: B<T*>*
constantInitializer
InstanceCreationExpression
- keyword: const @61
+ keyword: const @76
constructorName: ConstructorName
type: NamedType
name: SimpleIdentifier
- token: B @67
+ token: B @82
staticElement: self::@class::B
staticType: null
type: B<Null*>*
@@ -16772,8 +16754,8 @@
base: self::@class::B::@constructor::•
substitution: {T: Null*}
argumentList: ArgumentList
- leftParenthesis: ( @68
- rightParenthesis: ) @69
+ leftParenthesis: ( @83
+ rightParenthesis: ) @84
staticType: B<Null*>*
''');
}
@@ -18004,6 +17986,79 @@
''');
}
+ test_enum_constructor_fieldFormal_optionalNamed_defaultValue() async {
+ var library = await buildLibrary(r'''
+enum E {
+ v;
+ final int x;
+ const E({this.x = 1 + 2});
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ enums
+ enum E @5
+ supertype: Enum
+ fields
+ static const enumConstant v @11
+ type: E
+ constantInitializer
+ InstanceCreationExpression
+ constructorName: ConstructorName
+ type: NamedType
+ name: SimpleIdentifier
+ token: E @-1
+ staticElement: self::@enum::E
+ staticType: null
+ type: E
+ staticElement: self::@enum::E::@constructor::•
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticType: E
+ synthetic static const values @-1
+ type: List<E>
+ constantInitializer
+ ListLiteral
+ leftBracket: [ @0
+ elements
+ SimpleIdentifier
+ token: v @-1
+ staticElement: self::@enum::E::@getter::v
+ staticType: E
+ rightBracket: ] @0
+ staticType: List<E>
+ final x @26
+ type: int
+ constructors
+ const @37
+ parameters
+ optionalNamed final this.x @45
+ type: int
+ constantInitializer
+ BinaryExpression
+ leftOperand: IntegerLiteral
+ literal: 1 @49
+ staticType: int
+ operator: + @51
+ rightOperand: IntegerLiteral
+ literal: 2 @53
+ staticType: int
+ staticElement: dart:core::@class::num::@method::+
+ staticInvokeType: num Function(num)
+ staticType: int
+ field: self::@enum::E::@field::x
+ accessors
+ synthetic static get v @-1
+ returnType: E
+ synthetic static get values @-1
+ returnType: List<E>
+ synthetic get x @-1
+ returnType: int
+''');
+ }
+
test_enum_constructor_fieldFormal_typed_typed() async {
var library = await buildLibrary('''
enum E {
@@ -19955,9 +20010,9 @@
}
test_export_configurations_useDefault() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'false',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -19981,10 +20036,10 @@
}
test_export_configurations_useFirst() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'true',
'dart.library.html': 'true',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -20008,10 +20063,10 @@
}
test_export_configurations_useSecond() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'false',
'dart.library.html': 'true',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -20251,9 +20306,9 @@
}
test_exportImport_configurations_useDefault() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'false',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -20283,10 +20338,10 @@
}
test_exportImport_configurations_useFirst() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'true',
'dart.library.html': 'false',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -20316,10 +20371,10 @@
}
test_exportImport_configurations_useSecond() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'false',
'dart.library.html': 'true',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -21287,15 +21342,15 @@
}
test_generic_function_type_nullability_star() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary('''
+// @dart = 2.9
void Function() f;
''');
checkElementText(library, r'''
library
definingUnit
topLevelVariables
- static f @16
+ static f @31
type: void Function()*
accessors
synthetic static get f @-1
@@ -22365,9 +22420,9 @@
}
test_import_configurations_useDefault() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'false',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -22395,10 +22450,10 @@
}
test_import_configurations_useFirst() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'true',
'dart.library.html': 'true',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -22426,10 +22481,10 @@
}
test_import_configurations_useFirst_eqTrue() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'true',
'dart.library.html': 'true',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -22457,10 +22512,10 @@
}
test_import_configurations_useSecond() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'false',
'dart.library.html': 'true',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -22488,10 +22543,10 @@
}
test_import_configurations_useSecond_eqTrue() async {
- declaredVariables = DeclaredVariables.fromMap({
+ declaredVariables = {
'dart.library.io': 'false',
'dart.library.html': 'true',
- });
+ };
addSource('$testPackageLibPath/foo.dart', 'class A {}');
addSource('$testPackageLibPath/foo_io.dart', 'class A {}');
addSource('$testPackageLibPath/foo_html.dart', 'class A {}');
@@ -24284,9 +24339,8 @@
}
test_instanceInference_operator_equal_legacy_from_legacy() async {
- featureSet = FeatureSets.language_2_9;
addSource('$testPackageLibPath/legacy.dart', r'''
-// @dart = 2.7
+// @dart = 2.9
class LegacyDefault {
bool operator==(other) => false;
}
@@ -24298,6 +24352,7 @@
}
''');
var library = await buildLibrary(r'''
+// @dart = 2.9
import 'legacy.dart';
class X1 extends LegacyDefault {
bool operator==(other) => false;
@@ -24315,37 +24370,37 @@
package:test/legacy.dart
definingUnit
classes
- class X1 @28
+ class X1 @43
supertype: LegacyDefault*
constructors
synthetic @-1
superConstructor: package:test/legacy.dart::@class::LegacyDefault::@constructor::•
methods
- == @71
+ == @86
parameters
- requiredPositional other @74
+ requiredPositional other @89
type: dynamic
returnType: bool*
- class X2 @99
+ class X2 @114
supertype: LegacyObject*
constructors
synthetic @-1
superConstructor: package:test/legacy.dart::@class::LegacyObject::@constructor::•
methods
- == @140
+ == @155
parameters
- requiredPositional other @143
+ requiredPositional other @158
type: Object*
returnType: bool*
- class X3 @168
+ class X3 @183
supertype: LegacyInt*
constructors
synthetic @-1
superConstructor: package:test/legacy.dart::@class::LegacyInt::@constructor::•
methods
- == @206
+ == @221
parameters
- requiredPositional other @209
+ requiredPositional other @224
type: int*
returnType: bool*
''');
@@ -24595,8 +24650,8 @@
}
test_instantiateToBounds_boundRefersToItself_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary('''
+// @dart = 2.9
class C<T extends C<T>> {}
C c;
var c2 = new C();
@@ -24608,16 +24663,16 @@
library
definingUnit
classes
- notSimplyBounded class C @6
+ notSimplyBounded class C @21
typeParameters
- covariant T @8
+ covariant T @23
bound: C<T*>*
defaultType: C<dynamic>*
constructors
synthetic @-1
- class B @56
+ class B @71
fields
- c3 @66
+ c3 @81
type: C<C<dynamic>*>*
constructors
synthetic @-1
@@ -24630,9 +24685,9 @@
type: C<C<dynamic>*>*
returnType: void
topLevelVariables
- static c @29
+ static c @44
type: C<C<dynamic>*>*
- static c2 @36
+ static c2 @51
type: C<C<dynamic>*>*
accessors
synthetic static get c @-1
@@ -25212,7 +25267,7 @@
<unresolved>
definingUnit
parts
- a3.dart
+ :[invaliduri]
''');
}
@@ -30517,8 +30572,8 @@
}
test_mixin_inference_legacy() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary(r'''
+// @dart = 2.9
class A<T> {}
mixin M<U> on A<U> {}
class B extends A<int> with M {}
@@ -30527,13 +30582,13 @@
library
definingUnit
classes
- class A @6
+ class A @21
typeParameters
- covariant T @8
+ covariant T @23
defaultType: dynamic
constructors
synthetic @-1
- class B @42
+ class B @57
supertype: A<int*>*
mixins
M<int*>*
@@ -30543,9 +30598,9 @@
base: self::@class::A::@constructor::•
substitution: {T: int*}
mixins
- mixin M @20
+ mixin M @35
typeParameters
- covariant U @22
+ covariant U @37
defaultType: dynamic
superclassConstraints
A<U*>*
@@ -32350,12 +32405,6 @@
class B @15
constructors
synthetic @-1
- parts
-
- classes
- class B @15
- constructors
- synthetic @-1
''');
}
@@ -33467,13 +33516,15 @@
}
test_type_never_disableNnbd() async {
- featureSet = FeatureSets.language_2_9;
- var library = await buildLibrary('Never d;');
+ var library = await buildLibrary('''
+// @dart = 2.9
+Never d;
+''');
checkElementText(library, r'''
library
definingUnit
topLevelVariables
- static d @6
+ static d @21
type: Null*
accessors
synthetic static get d @-1
@@ -33566,8 +33617,8 @@
}
test_type_param_ref_nullability_star() async {
- featureSet = FeatureSets.language_2_9;
var library = await buildLibrary('''
+// @dart = 2.9
class C<T> {
T t;
}
@@ -33576,12 +33627,12 @@
library
definingUnit
classes
- class C @6
+ class C @21
typeParameters
- covariant T @8
+ covariant T @23
defaultType: dynamic
fields
- t @17
+ t @32
type: T*
constructors
synthetic @-1
@@ -35327,24 +35378,25 @@
}
test_typedef_function_typeParameters_f_bound_simple_legacy() async {
- featureSet = FeatureSets.language_2_9;
- var library =
- await buildLibrary('typedef F<T extends U, U> = U Function(T t);');
+ var library = await buildLibrary('''
+// @dart = 2.9
+typedef F<T extends U, U> = U Function(T t);
+''');
checkElementText(library, r'''
library
definingUnit
typeAliases
- notSimplyBounded F @8
+ notSimplyBounded F @23
typeParameters
- contravariant T @10
+ contravariant T @25
bound: U*
defaultType: Null*
- covariant U @23
+ covariant U @38
defaultType: dynamic
aliasedType: U* Function(T*)*
aliasedElement: GenericFunctionTypeElement
parameters
- requiredPositional t @41
+ requiredPositional t @56
type: T*
returnType: U*
''');
@@ -35784,23 +35836,25 @@
}
test_typedef_legacy_typeParameters_f_bound_complex_legacy() async {
- featureSet = FeatureSets.language_2_9;
- var library = await buildLibrary('typedef U F<T extends List<U>, U>(T t);');
+ var library = await buildLibrary('''
+// @dart = 2.9
+typedef U F<T extends List<U>, U>(T t);
+''');
checkElementText(library, r'''
library
definingUnit
typeAliases
- functionTypeAliasBased notSimplyBounded F @10
+ functionTypeAliasBased notSimplyBounded F @25
typeParameters
- contravariant T @12
+ contravariant T @27
bound: List<U*>*
defaultType: List<Null*>*
- covariant U @31
+ covariant U @46
defaultType: dynamic
aliasedType: U* Function(T*)*
aliasedElement: GenericFunctionTypeElement
parameters
- requiredPositional t @36
+ requiredPositional t @51
type: T*
returnType: U*
''');
@@ -35829,23 +35883,25 @@
}
test_typedef_legacy_typeParameters_f_bound_simple_legacy() async {
- featureSet = FeatureSets.language_2_9;
- var library = await buildLibrary('typedef U F<T extends U, U>(T t);');
+ var library = await buildLibrary('''
+// @dart = 2.9
+typedef U F<T extends U, U>(T t);
+''');
checkElementText(library, r'''
library
definingUnit
typeAliases
- functionTypeAliasBased notSimplyBounded F @10
+ functionTypeAliasBased notSimplyBounded F @25
typeParameters
- contravariant T @12
+ contravariant T @27
bound: U*
defaultType: Null*
- covariant U @25
+ covariant U @40
defaultType: dynamic
aliasedType: U* Function(T*)*
aliasedElement: GenericFunctionTypeElement
parameters
- requiredPositional t @30
+ requiredPositional t @45
type: T*
returnType: U*
''');
@@ -36550,8 +36606,8 @@
}
test_typedef_nonFunction_using_interface_disabled() async {
- featureSet = FeatureSets.language_2_12;
var library = await buildLibrary(r'''
+// @dart = 2.12
typedef A = int;
void f(A a) {}
''');
@@ -36563,12 +36619,12 @@
library
definingUnit
typeAliases
- A @8
+ A @24
aliasedType: dynamic Function()
functions
- f @22
+ f @38
parameters
- requiredPositional a @26
+ requiredPositional a @42
type: dynamic Function()
alias: self::@typeAlias::A
returnType: void
@@ -38107,20 +38163,4 @@
var elementFactory = library.linkedData!.elementFactory;
return elementFactory.elementOfReference(reference)!;
}
-
- void _writeTestPackageConfig(PackageConfigFileBuilder config) {
- config = config.copy();
-
- config.add(
- name: 'test',
- rootPath: testPackageRootPath,
- );
-
- newPackageConfigJsonFile(
- testPackageRootPath,
- config.toContent(
- toUriStr: toUriStr,
- ),
- );
- }
}
diff --git a/pkg/analyzer/test/src/summary/macro_test.dart b/pkg/analyzer/test/src/summary/macro_test.dart
index e883e47..0d65812 100644
--- a/pkg/analyzer/test/src/summary/macro_test.dart
+++ b/pkg/analyzer/test/src/summary/macro_test.dart
@@ -45,9 +45,6 @@
@override
bool get keepLinkingLibraries => false;
- /// The path for external packages.
- String get packagesRootPath => '/packages';
-
/// Return the code for `DeclarationTextMacro`.
String get _declarationTextCode {
var code = MacrosEnvironment.instance.packageAnalyzerFolder
@@ -79,7 +76,8 @@
@override
Future<void> setUp() async {
- await super.setUp();
+ super.setUp();
+
writeTestPackageConfig(
PackageConfigFileBuilder(),
macrosEnvironment: MacrosEnvironment.instance,
@@ -92,6 +90,8 @@
import 'package:_fe_analyzer_shared/src/macros/api.dart';
macro class MyMacro implements ClassTypesMacro {
+ const MyMacro();
+
FutureOr<void> buildTypesForClass(clazz, builder) {
builder.declareType(
'MyClass',
@@ -135,7 +135,7 @@
parts
package:test/_macro_types.dart
classes
- class MyClass @6
+ class MyClass @-1
constructors
synthetic @-1
exportScope
@@ -196,7 +196,7 @@
parts
package:test/_macro_types.dart
classes
- class MyClass @6
+ class MyClass @-1
constructors
synthetic @-1
exportScope
@@ -212,6 +212,8 @@
import 'package:_fe_analyzer_shared/src/macros/api.dart';
macro class MyMacro implements ClassTypesMacro {
+ const MyMacro();
+
FutureOr<void> buildTypesForClass(clazz, builder) {
builder.declareType(
'MyClass',
@@ -263,7 +265,7 @@
parts
package:test/_macro_types.dart
classes
- class MyClass @6
+ class MyClass @-1
constructors
synthetic @-1
exportScope
@@ -332,7 +334,7 @@
parts
package:test/_macro_types.dart
classes
- class MyClass @6
+ class MyClass @-1
constructors
synthetic @-1
exportScope
@@ -348,6 +350,8 @@
import 'package:_fe_analyzer_shared/src/macros/api.dart';
macro class MyMacro implements ClassTypesMacro {
+ const MyMacro();
+
FutureOr<void> buildTypesForClass(clazz, builder) {
builder.declareType(
'MyClass',
@@ -392,7 +396,7 @@
parts
package:test/_macro_types.dart
classes
- class MyClass @6
+ class MyClass @-1
constructors
synthetic @-1
exportScope
@@ -462,7 +466,7 @@
parts
package:test/_macro_types.dart
classes
- class MyClass @6
+ class MyClass @-1
constructors
synthetic @-1
exportScope
@@ -477,6 +481,8 @@
import 'package:_fe_analyzer_shared/src/macros/api.dart';
macro class MyMacro implements ClassTypesMacro {
+ const MyMacro();
+
buildTypesForClass(clazz, builder) {
builder.declareType(
'MyClass',
@@ -529,7 +535,7 @@
parts
package:test/_macro_types.dart
classes
- class MyClass @6
+ class MyClass @-1
constructors
synthetic @-1
exportScope
@@ -603,7 +609,7 @@
parts
package:test/_macro_types.dart
classes
- class MyClass @6
+ class MyClass @-1
constructors
synthetic @-1
exportScope
@@ -1612,6 +1618,8 @@
import 'package:_fe_analyzer_shared/src/macros/api.dart';
macro class MyMacro implements ClassTypesMacro {
+ const MyMacro();
+
buildTypesForClass(clazz, builder) {
unresolved;
}
@@ -1642,6 +1650,8 @@
import 'package:_fe_analyzer_shared/src/macros/api.dart';
macro class MyMacro implements ClassTypesMacro {
+ const MyMacro();
+
buildTypesForClass(clazz, builder) {
throw 'foo bar';
}
@@ -1710,34 +1720,6 @@
''');
}
- void writeTestPackageConfig(
- PackageConfigFileBuilder config, {
- MacrosEnvironment? macrosEnvironment,
- }) {
- config = config.copy();
-
- config.add(
- name: 'test',
- rootPath: testPackageRootPath,
- );
-
- if (macrosEnvironment != null) {
- var packagesRootFolder = getFolder(packagesRootPath);
- macrosEnvironment.packageSharedFolder.copyTo(packagesRootFolder);
- config.add(
- name: '_fe_analyzer_shared',
- rootPath: getFolder('$packagesRootPath/_fe_analyzer_shared').path,
- );
- }
-
- newPackageConfigJsonFile(
- testPackageRootPath,
- config.toContent(
- toUriStr: toUriStr,
- ),
- );
- }
-
/// Assert that the textual dump of the introspection information for
/// annotated declarations is the same as [expected].
Future<void> _assertIntrospectDeclarationsText(
diff --git a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
index 638d321..39f28cb 100644
--- a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
+++ b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
@@ -29,6 +29,9 @@
/// TODO(scheglov) Remove after https://github.com/dart-lang/sdk/issues/48380
final bool withCheckingLinking;
+ /// If `true`, [Expression.staticParameterElement] should be printed.
+ final bool withParameterElements;
+
/// If `true`, selected tokens and nodes should be printed with offsets.
final bool _withOffsets;
@@ -43,6 +46,7 @@
required String indent,
this.skipArgumentList = false,
this.withCheckingLinking = false,
+ this.withParameterElements = true,
bool withOffsets = false,
bool withResolution = true,
}) : _selfUriStr = selfUriStr,
@@ -56,6 +60,7 @@
_writeln('AdjacentStrings');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
_writeRaw('stringValue', node.stringValue);
});
@@ -83,6 +88,7 @@
_writeln('AsExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -108,6 +114,7 @@
_writeln('AssignmentExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeElement('readElement', node.readElement);
_writeType('readType', node.readType);
_writeElement('writeElement', node.writeElement);
@@ -122,6 +129,7 @@
_writeln('AwaitExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -131,6 +139,7 @@
_writeln('BinaryExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeElement('staticElement', node.staticElement);
_writeType('staticInvokeType', node.staticInvokeType);
_writeType('staticType', node.staticType);
@@ -158,6 +167,7 @@
_writeln('BooleanLiteral');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -175,6 +185,7 @@
_writeln('CascadeExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -238,6 +249,7 @@
_writeln('ConditionalExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -275,6 +287,7 @@
_writeln('ConstructorReference');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -332,6 +345,7 @@
_writeln('DoubleLiteral');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -526,6 +540,7 @@
if (_withResolution) {
_writeElement('declaredElement', node.declaredElement);
}
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -547,6 +562,7 @@
_writeln('FunctionReference');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
_writeTypeList('typeArgumentTypes', node.typeArgumentTypes);
});
@@ -638,6 +654,7 @@
_writeln('ImplicitCallReference');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeElement('staticElement', node.staticElement);
_writeType('staticType', node.staticType);
_writeTypeList('typeArgumentTypes', node.typeArgumentTypes);
@@ -663,6 +680,7 @@
_writeln('IndexExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeElement('staticElement', node.staticElement);
_writeType('staticType', node.staticType);
});
@@ -673,6 +691,7 @@
_writeln('InstanceCreationExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -682,6 +701,7 @@
_writeln('IntegerLiteral');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -707,6 +727,7 @@
_writeln('IsExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -756,6 +777,7 @@
_writeln('ListLiteral');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -785,6 +807,7 @@
_writeln('MethodInvocation');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticInvokeType', node.staticInvokeType);
_writeType('staticType', node.staticType);
_writeTypeList('typeArgumentTypes', node.typeArgumentTypes);
@@ -824,6 +847,7 @@
_writeln('NullLiteral');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -841,6 +865,7 @@
_writeln('ParenthesizedExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -871,6 +896,7 @@
_writeln('PostfixExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
if (node.operator.type.isIncrementOperator) {
_writeElement('readElement', node.readElement);
_writeType('readType', node.readType);
@@ -887,6 +913,7 @@
_writeln('PrefixedIdentifier');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeElement('staticElement', node.staticElement);
_writeType('staticType', node.staticType);
});
@@ -897,6 +924,7 @@
_writeln('PrefixExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
if (node.operator.type.isIncrementOperator) {
_writeElement('readElement', node.readElement);
_writeType('readType', node.readType);
@@ -913,6 +941,7 @@
_writeln('PropertyAccess');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -942,6 +971,7 @@
_withIndent(() {
_writeNamedChildEntities(node);
_writeRaw('isMap', node.isMap);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -971,6 +1001,7 @@
_writeln('SimpleIdentifier');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeElement('staticElement', node.staticElement);
_writeType('staticType', node.staticType);
_writeTypeList(
@@ -1001,6 +1032,7 @@
_writeln('StringInterpolation');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
_writeRaw('stringValue', node.stringValue);
});
@@ -1068,6 +1100,7 @@
_writeln('SymbolLiteral');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
});
}
@@ -1076,6 +1109,7 @@
_writeln('ThisExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -1085,6 +1119,7 @@
_writeln('ThrowExpression');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -1121,6 +1156,7 @@
_writeln('TypeLiteral');
_withIndent(() {
_writeNamedChildEntities(node);
+ _writeParameterElement(node);
_writeType('staticType', node.staticType);
});
}
@@ -1417,6 +1453,21 @@
_writelnWithIndent('$name: $offset');
}
+ /// If [node] is at a position where it is an argument for an invocation,
+ /// writes the corresponding parameter element.
+ void _writeParameterElement(Expression node) {
+ if (withParameterElements) {
+ final parent = node.parent;
+ if (parent is ArgumentList ||
+ parent is AssignmentExpression && parent.rightHandSide == node ||
+ parent is BinaryExpression && parent.rightOperand == node ||
+ parent is IndexExpression && parent.index == node ||
+ parent is NamedExpression && parent.expression == node) {
+ _writeElement('parameter', node.staticParameterElement);
+ }
+ }
+ }
+
void _writeParameterElements(List<ParameterElement> parameters) {
_writelnWithIndent('parameters');
_withIndent(() {
diff --git a/pkg/analyzer_cli/pubspec.yaml b/pkg/analyzer_cli/pubspec.yaml
index 6007114..2eb61ca 100644
--- a/pkg/analyzer_cli/pubspec.yaml
+++ b/pkg/analyzer_cli/pubspec.yaml
@@ -7,6 +7,7 @@
environment:
sdk: "^2.14.0"
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
analyzer: any
args: any
@@ -16,6 +17,7 @@
pub_semver: any
yaml: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
lints: any
test_reflective_loader: any
diff --git a/pkg/analyzer_plugin/doc/api.html b/pkg/analyzer_plugin/doc/api.html
index 442a175..859796d 100644
--- a/pkg/analyzer_plugin/doc/api.html
+++ b/pkg/analyzer_plugin/doc/api.html
@@ -2003,6 +2003,12 @@
The position that should be selected after the edits have been
applied.
</p>
+ </dd><dt class="field"><b>selectionLength: int<span style="color:#999999"> (optional)</span></b></dt><dd>
+
+ <p>
+ The length of the selection (starting at Position) that should be selected after
+ the edits have been applied.
+ </p>
</dd><dt class="field"><b>id: String<span style="color:#999999"> (optional)</span></b></dt><dd>
<p>
diff --git a/pkg/analyzer_plugin/lib/protocol/protocol_common.dart b/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
index 2192ee4..80f2449 100644
--- a/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
+++ b/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
@@ -4276,6 +4276,7 @@
/// "edits": List<SourceFileEdit>
/// "linkedEditGroups": List<LinkedEditGroup>
/// "selection": optional Position
+/// "selectionLength": optional int
/// "id": optional String
/// }
///
@@ -4294,6 +4295,10 @@
/// The position that should be selected after the edits have been applied.
Position? selection;
+ /// The length of the selection (starting at Position) that should be
+ /// selected after the edits have been applied.
+ int? selectionLength;
+
/// The optional identifier of the change kind. The identifier remains stable
/// even if the message changes, or is parameterized.
String? id;
@@ -4302,6 +4307,7 @@
{List<SourceFileEdit>? edits,
List<LinkedEditGroup>? linkedEditGroups,
this.selection,
+ this.selectionLength,
this.id})
: edits = edits ?? <SourceFileEdit>[],
linkedEditGroups = linkedEditGroups ?? <LinkedEditGroup>[];
@@ -4342,6 +4348,11 @@
selection = Position.fromJson(
jsonDecoder, jsonPath + '.selection', json['selection']);
}
+ int? selectionLength;
+ if (json.containsKey('selectionLength')) {
+ selectionLength = jsonDecoder.decodeInt(
+ jsonPath + '.selectionLength', json['selectionLength']);
+ }
String? id;
if (json.containsKey('id')) {
id = jsonDecoder.decodeString(jsonPath + '.id', json['id']);
@@ -4350,6 +4361,7 @@
edits: edits,
linkedEditGroups: linkedEditGroups,
selection: selection,
+ selectionLength: selectionLength,
id: id);
} else {
throw jsonDecoder.mismatch(jsonPath, 'SourceChange', json);
@@ -4369,6 +4381,10 @@
if (selection != null) {
result['selection'] = selection.toJson();
}
+ var selectionLength = this.selectionLength;
+ if (selectionLength != null) {
+ result['selectionLength'] = selectionLength;
+ }
var id = this.id;
if (id != null) {
result['id'] = id;
@@ -4411,6 +4427,7 @@
listEqual(linkedEditGroups, other.linkedEditGroups,
(LinkedEditGroup a, LinkedEditGroup b) => a == b) &&
selection == other.selection &&
+ selectionLength == other.selectionLength &&
id == other.id;
}
return false;
@@ -4422,6 +4439,7 @@
edits,
linkedEditGroups,
selection,
+ selectionLength,
id,
);
}
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
index dca43e9..0f6f1db 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
@@ -109,6 +109,10 @@
var selection = _selection;
if (selection != null) {
change.selection = selection;
+ var selectionRange = _selectionRange;
+ if (selectionRange != null) {
+ change.selectionLength = selectionRange.length;
+ }
}
return change;
}
diff --git a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
index 38053a2..38b8304 100644
--- a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
+++ b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
@@ -386,7 +386,7 @@
@override
void visitPartOfDirective(PartOfDirective node) {
- computer._addRegionForNode(node.libraryName, node.element);
+ computer._addRegionForNode(node.libraryName ?? node.uri, node.element);
super.visitPartOfDirective(node);
}
diff --git a/pkg/analyzer_plugin/pubspec.yaml b/pkg/analyzer_plugin/pubspec.yaml
index 946fd7e..0115b6f 100644
--- a/pkg/analyzer_plugin/pubspec.yaml
+++ b/pkg/analyzer_plugin/pubspec.yaml
@@ -13,10 +13,13 @@
pub_semver: ^2.0.0
yaml: ^3.1.0
+# We use 'any' version constraints here as we get our package versions from
+# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
+# best practice for packages is to specify their compatible version ranges.
+# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
- analyzer_utilities:
- path: ../analyzer_utilities
- html: ^0.15.0
- path: ^1.8.0
- test_reflective_loader: ^0.2.0
- test: ^1.16.6
+ analyzer_utilities: any
+ html: any
+ path: any
+ test_reflective_loader: any
+ test: any
diff --git a/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart b/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
index 04226f7..1e5770b 100644
--- a/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
+++ b/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
@@ -867,6 +867,7 @@
/// "edits": List<SourceFileEdit>
/// "linkedEditGroups": List<LinkedEditGroup>
/// "selection": optional Position
+/// "selectionLength": optional int
/// "id": optional String
/// }
final Matcher isSourceChange =
@@ -876,6 +877,7 @@
'linkedEditGroups': isListOf(isLinkedEditGroup)
}, optionalFields: {
'selection': isPosition,
+ 'selectionLength': isInt,
'id': isString
}));
diff --git a/pkg/analyzer_plugin/tool/spec/common_types_spec.html b/pkg/analyzer_plugin/tool/spec/common_types_spec.html
index ca100b9..96bdae9 100644
--- a/pkg/analyzer_plugin/tool/spec/common_types_spec.html
+++ b/pkg/analyzer_plugin/tool/spec/common_types_spec.html
@@ -6,7 +6,7 @@
</head>
<body>
<h1>Common Types</h1>
-<version>1.4.4</version>
+<version>1.4.5</version>
<p>
This document contains a specification of the types that are common between
the analysis server wire protocol and the analysis server plugin wire
@@ -1566,6 +1566,13 @@
applied.
</p>
</field>
+ <field name="selectionLength" optional="true">
+ <ref>int</ref>
+ <p>
+ The length of the selection (starting at Position) that should be selected after
+ the edits have been applied.
+ </p>
+ </field>
<field name="id" optional="true">
<ref>String</ref>
<p>
diff --git a/pkg/analyzer_utilities/pubspec.yaml b/pkg/analyzer_utilities/pubspec.yaml
index e974be1..a7c634c 100644
--- a/pkg/analyzer_utilities/pubspec.yaml
+++ b/pkg/analyzer_utilities/pubspec.yaml
@@ -5,6 +5,7 @@
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
analyzer: any
html: any
@@ -12,5 +13,6 @@
path: any
test: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
lints: any
diff --git a/pkg/async_helper/pubspec.yaml b/pkg/async_helper/pubspec.yaml
index 55bc80d..dc909f9 100644
--- a/pkg/async_helper/pubspec.yaml
+++ b/pkg/async_helper/pubspec.yaml
@@ -3,14 +3,14 @@
publish_to: none
description: >-
- Async_helper is used for asynchronous tests that do not want to
- make use of the Dart unittest library - for example, the core
- language tests.
- Third parties are discouraged from using this, and should use
- the facilities provided in package:test.
+ Async_helper is used for asynchronous tests that do not want to make use of
+ the Dart unittest library - for example, the core language tests. Third
+ parties are discouraged from using this, and should use the facilities
+ provided in package:test.
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
expect: any
diff --git a/pkg/build_integration/pubspec.yaml b/pkg/build_integration/pubspec.yaml
index 2286f3e..fbb8715 100644
--- a/pkg/build_integration/pubspec.yaml
+++ b/pkg/build_integration/pubspec.yaml
@@ -8,8 +8,10 @@
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
front_end: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
test: any
diff --git a/pkg/compiler/lib/src/common/ram_usage.dart b/pkg/compiler/lib/src/common/ram_usage.dart
index 76c5c2d..ade3c7b 100644
--- a/pkg/compiler/lib/src/common/ram_usage.dart
+++ b/pkg/compiler/lib/src/common/ram_usage.dart
@@ -18,10 +18,11 @@
import 'dart:developer';
import 'package:vm_service/vm_service_io.dart' as vm_service_io;
-Future<int> _currentHeapCapacity() async {
+Future<int?> _currentHeapCapacity() async {
final info =
await Service.controlWebServer(enable: true, silenceOutput: true);
- final observatoryUri = info.serverUri!;
+ final observatoryUri = info.serverUri;
+ if (observatoryUri == null) return null;
final wsUri = 'ws://${observatoryUri.authority}${observatoryUri.path}ws';
final vmService = await vm_service_io.vmServiceConnectUri(wsUri);
int sum = 0;
@@ -35,5 +36,6 @@
Future<String> currentHeapCapacityInMb() async {
final capacity = await _currentHeapCapacity();
+ if (capacity == null) return "N/A MB";
return "${(capacity / (1024 * 1024)).toStringAsFixed(3)} MB";
}
diff --git a/pkg/compiler/lib/src/common/tasks.dart b/pkg/compiler/lib/src/common/tasks.dart
index 52f6a99..19b6749 100644
--- a/pkg/compiler/lib/src/common/tasks.dart
+++ b/pkg/compiler/lib/src/common/tasks.dart
@@ -2,8 +2,6 @@
// 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.10
-
library dart2js.common.tasks;
import 'dart:async'
@@ -19,15 +17,15 @@
// TODO(sigmund): rename to MeasurableTask
abstract class CompilerTask {
final Measurer _measurer;
- final Stopwatch _watch;
+ final Stopwatch? _watch;
final Map<String, GenericTask> _subtasks = {};
int _asyncCount = 0;
// Each task has a fixed, lazily computed, ZoneSpecification and zoneValues
// for [_measureZoned].
- ZoneSpecification _zoneSpecification;
- Map _zoneValues;
+ ZoneSpecification? _zoneSpecification;
+ Map? _zoneValues;
CompilerTask(this._measurer)
: _watch = _measurer.enableTaskMeasurements ? Stopwatch() : null;
@@ -46,7 +44,7 @@
int get timing {
if (_isDisabled) return 0;
- int total = _watch.elapsedMilliseconds;
+ int total = _watch!.elapsedMilliseconds;
for (GenericTask subtask in _subtasks.values) {
total += subtask.timing;
}
@@ -55,7 +53,7 @@
Duration get duration {
if (_isDisabled) return Duration.zero;
- Duration total = _watch.elapsed;
+ Duration total = _watch!.elapsed;
for (GenericTask subtask in _subtasks.values) {
total += subtask.duration;
}
@@ -69,25 +67,25 @@
/// Helper method that starts measuring with this [CompilerTask], that is,
/// make this task the currently measured task.
- CompilerTask _start() {
+ CompilerTask? _start() {
if (_isDisabled) return null;
- CompilerTask previous = _measurer._currentTask;
+ CompilerTask? previous = _measurer._currentTask;
_measurer._currentTask = this;
- if (previous != null) previous._watch.stop();
+ if (previous != null) previous._watch!.stop();
// Regardless of whether [previous] is `null` we've returned from the
// eventloop.
_measurer.stopAsyncWallClock();
- _watch.start();
+ _watch!.start();
return previous;
}
/// Helper method that stops measuring with this [CompilerTask], that is,
/// make [previous] the currently measured task.
- void _stop(CompilerTask previous) {
+ void _stop(CompilerTask? previous) {
if (_isDisabled) return;
- _watch.stop();
+ _watch!.stop();
if (previous != null) {
- previous._watch.start();
+ previous._watch!.start();
} else {
// If there's no previous task, we're about to return control to the
// event loop. Start counting that as waiting asynchronous I/O.
@@ -122,7 +120,7 @@
/// we should measure or not when delegating.
R _run<R>(Zone self, ZoneDelegate parent, Zone zone, R f()) {
if (zone[_measurer] != this) return parent.run(zone, f);
- CompilerTask previous = _start();
+ CompilerTask? previous = _start();
try {
return parent.run(zone, f);
} finally {
@@ -134,7 +132,7 @@
R _runUnary<R, T>(
Zone self, ZoneDelegate parent, Zone zone, R f(T arg), T arg) {
if (zone[_measurer] != this) return parent.runUnary(zone, f, arg);
- CompilerTask previous = _start();
+ CompilerTask? previous = _start();
try {
return parent.runUnary(zone, f, arg);
} finally {
@@ -146,7 +144,7 @@
R _runBinary<R, T1, T2>(Zone self, ZoneDelegate parent, Zone zone,
R f(T1 a1, T2 a2), T1 a1, T2 a2) {
if (zone[_measurer] != this) return parent.runBinary(zone, f, a1, a2);
- CompilerTask previous = _start();
+ CompilerTask? previous = _start();
try {
return parent.runBinary(zone, f, a1, a2);
} finally {
@@ -168,7 +166,7 @@
_measurer._currentAsyncTask = this;
} else if (_measurer._currentAsyncTask != this) {
throw "Cannot track async task '$name' because"
- " '${_measurer._currentAsyncTask.name}' is already being tracked.";
+ " '${_measurer._currentAsyncTask?.name}' is already being tracked.";
}
_asyncCount++;
return measure(action).whenComplete(() {
@@ -208,9 +206,9 @@
Iterable<String> get subtasks => _subtasks.keys;
- int getSubtaskTime(String subtask) => _subtasks[subtask].timing;
+ int getSubtaskTime(String subtask) => _subtasks[subtask]!.timing;
- bool getSubtaskIsRunning(String subtask) => _subtasks[subtask].isRunning;
+ bool getSubtaskIsRunning(String subtask) => _subtasks[subtask]!.isRunning;
/// Returns the metrics for this task.
Metrics get metrics => Metrics.none();
@@ -247,10 +245,10 @@
/// The currently running task, that is, the task whose [Stopwatch] is
/// currently running.
- CompilerTask _currentTask;
+ CompilerTask? _currentTask;
/// The current task which should be charged for asynchronous gaps.
- CompilerTask _currentAsyncTask;
+ CompilerTask? _currentAsyncTask;
/// Start counting the total elapsed time since the compiler started.
void startWallClock() {
@@ -265,7 +263,7 @@
/// Call this before returning to the eventloop.
void startAsyncWallClock() {
if (_currentAsyncTask != null) {
- _currentAsyncTask._watch.start();
+ _currentAsyncTask!._watch?.start();
} else {
_asyncWallClock.start();
}
@@ -274,7 +272,7 @@
/// Call this when the eventloop returns control to us.
void stopAsyncWallClock() {
if (_currentAsyncTask != null) {
- _currentAsyncTask._watch.stop();
+ _currentAsyncTask!._watch?.stop();
}
_asyncWallClock.stop();
}
diff --git a/pkg/compiler/lib/src/constants/values.dart b/pkg/compiler/lib/src/constants/values.dart
index 07fc1d5..4018c93 100644
--- a/pkg/compiler/lib/src/constants/values.dart
+++ b/pkg/compiler/lib/src/constants/values.dart
@@ -1041,7 +1041,7 @@
DeferredGlobalConstantValue(this.referenced, this.unit);
final ConstantValue referenced;
- final OutputUnit? unit;
+ final OutputUnit unit;
bool get isReference => true;
diff --git a/pkg/compiler/lib/src/deferred_load/entity_data.dart b/pkg/compiler/lib/src/deferred_load/entity_data.dart
index 0751f58..bfb81f2 100644
--- a/pkg/compiler/lib/src/deferred_load/entity_data.dart
+++ b/pkg/compiler/lib/src/deferred_load/entity_data.dart
@@ -2,8 +2,6 @@
// 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.10
-
import '../constants/values.dart' show ConstantValue;
import '../elements/entities.dart';
diff --git a/pkg/compiler/lib/src/io/source_map_builder.dart b/pkg/compiler/lib/src/io/source_map_builder.dart
index fd0a930..2fc0f46 100644
--- a/pkg/compiler/lib/src/io/source_map_builder.dart
+++ b/pkg/compiler/lib/src/io/source_map_builder.dart
@@ -2,8 +2,6 @@
// 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.10
-
library dart2js.source_map_builder;
import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
@@ -19,10 +17,10 @@
final String version;
/// The URI of the source map file.
- final Uri sourceMapUri;
+ final Uri? sourceMapUri;
/// The URI of the target language file.
- final Uri targetFileUri;
+ final Uri? targetFileUri;
final LocationProvider locationProvider;
final List<SourceMapEntry> entries = [];
@@ -70,12 +68,12 @@
int column = kernelLocation.column - 1;
lineColumnMap.add(line, column, sourceMapEntry);
- SourceLocation location = sourceMapEntry.sourceLocation;
+ SourceLocation? location = sourceMapEntry.sourceLocation;
if (location != null) {
if (location.sourceUri != null) {
LineColumnMap<SourceMapEntry> sourceLineColumnMap =
sourceLocationMap.putIfAbsent(
- location.sourceUri, () => LineColumnMap<SourceMapEntry>());
+ location.sourceUri!, () => LineColumnMap<SourceMapEntry>());
sourceLineColumnMap.add(
location.line - 1, location.column - 1, sourceMapEntry);
}
@@ -89,12 +87,12 @@
IndexMap<Uri> uriMap = IndexMap<Uri>();
IndexMap<String> nameMap = IndexMap<String>();
- void registerLocation(SourceLocation sourceLocation) {
+ void registerLocation(SourceLocation? sourceLocation) {
if (sourceLocation != null) {
if (sourceLocation.sourceUri != null) {
- uriMap.register(sourceLocation.sourceUri);
+ uriMap.register(sourceLocation.sourceUri!);
if (sourceLocation.sourceName != null) {
- nameMap.register(sourceLocation.sourceName);
+ nameMap.register(sourceLocation.sourceName!);
}
}
}
@@ -110,7 +108,7 @@
for (var frame in entries) {
registerLocation(frame.pushLocation);
if (frame.inlinedMethodName != null) {
- nameMap.register(frame.inlinedMethodName);
+ nameMap.register(frame.inlinedMethodName!);
}
}
}
@@ -124,14 +122,14 @@
buffer.write(' "engine": "$version",\n');
if (sourceMapUri != null && targetFileUri != null) {
buffer.write(' "file": '
- '"${fe.relativizeUri(sourceMapUri, targetFileUri, false)}",\n');
+ '"${fe.relativizeUri(sourceMapUri!, targetFileUri!, false)}",\n');
}
buffer.write(' "sourceRoot": "",\n');
buffer.write(' "sources": ');
Iterable<String> relativeSourceUriList = const <String>[];
if (sourceMapUri != null) {
relativeSourceUriList =
- uriMap.elements.map((u) => fe.relativizeUri(sourceMapUri, u, false));
+ uriMap.elements.map((u) => fe.relativizeUri(sourceMapUri!, u, false));
}
printStringListOn(relativeSourceUriList, buffer);
buffer.write(',\n');
@@ -157,7 +155,7 @@
void writeEntries(LineColumnMap<SourceMapEntry> entries, IndexMap<Uri> uriMap,
IndexMap<String> nameMap, StringBuffer output) {
- SourceLocation previousSourceLocation;
+ SourceLocation? previousSourceLocation;
int previousTargetLine = 0;
DeltaEncoder targetColumnEncoder = DeltaEncoder();
bool firstEntryInLine = true;
@@ -167,7 +165,7 @@
DeltaEncoder sourceNameIndexEncoder = DeltaEncoder();
entries.forEach((int targetLine, int targetColumn, SourceMapEntry entry) {
- SourceLocation sourceLocation = entry.sourceLocation;
+ SourceLocation? sourceLocation = entry.sourceLocation;
if (sourceLocation == previousSourceLocation) {
return;
}
@@ -193,16 +191,16 @@
return;
}
- Uri sourceUri = sourceLocation.sourceUri;
+ Uri? sourceUri = sourceLocation.sourceUri;
if (sourceUri != null) {
- sourceUriIndexEncoder.encode(output, uriMap[sourceUri]);
+ sourceUriIndexEncoder.encode(output, uriMap[sourceUri]!);
sourceLineEncoder.encode(output, sourceLocation.line - 1);
sourceColumnEncoder.encode(output, sourceLocation.column - 1);
}
- String sourceName = sourceLocation.sourceName;
+ String? sourceName = sourceLocation.sourceName;
if (sourceName != null) {
- sourceNameIndexEncoder.encode(output, nameMap[sourceName]);
+ sourceNameIndexEncoder.encode(output, nameMap[sourceName]!);
}
previousSourceLocation = sourceLocation;
@@ -236,11 +234,11 @@
for (var entry in entries) {
offsetEncoder.encode(buffer, offset);
if (entry.isPush) {
- SourceLocation location = entry.pushLocation;
- uriEncoder.encode(buffer, uriMap[location.sourceUri]);
+ SourceLocation location = entry.pushLocation!;
+ uriEncoder.encode(buffer, uriMap[location.sourceUri!]!);
lineEncoder.encode(buffer, location.line - 1);
columnEncoder.encode(buffer, location.column - 1);
- nameEncoder.encode(buffer, nameMap[entry.inlinedMethodName]);
+ nameEncoder.encode(buffer, nameMap[entry.inlinedMethodName!]!);
} else {
// ; and , are not used by VLQ so we can distinguish them in the
// encoding, this is the same reason they are used in the mappings
@@ -254,7 +252,7 @@
/// Returns the source map tag to put at the end a .js file in [fileUri] to
/// make it point to the source map file in [sourceMapUri].
- static String generateSourceMapTag(Uri sourceMapUri, Uri fileUri) {
+ static String generateSourceMapTag(Uri? sourceMapUri, Uri? fileUri) {
if (sourceMapUri != null && fileUri != null) {
String sourceMapFileName = fe.relativizeUri(fileUri, sourceMapUri, false);
return '''
@@ -277,7 +275,7 @@
Map<String, String> minifiedInstanceNames,
String name,
Uri sourceMapUri,
- Uri fileUri,
+ Uri? fileUri,
api.CompilerOutput compilerOutput) {
// Create a source file for the compilation output. This allows using
// [:getLine:] to transform offsets to line numbers in [SourceMapBuilder].
@@ -357,7 +355,7 @@
}
class SourceMapEntry {
- SourceLocation sourceLocation;
+ SourceLocation? sourceLocation;
int targetOffset;
SourceMapEntry(this.sourceLocation, this.targetOffset);
@@ -395,8 +393,8 @@
/// Returns the elements for the first the column in [line] that has
/// associated elements.
- List<T> getFirstElementsInLine(int line) {
- Map<int, List<T>> lineMap = _map[line];
+ List<T>? getFirstElementsInLine(int line) {
+ Map<int, List<T>>? lineMap = _map[line];
if (lineMap == null) return null;
List<int> columns = lineMap.keys.toList()..sort();
return lineMap[columns.first];
@@ -406,11 +404,11 @@
///
/// [f] is called in increasing column order.
void forEachColumn(int line, f(int column, List<T> elements)) {
- Map<int, List<T>> lineMap = _map[line];
+ Map<int, List<T>>? lineMap = _map[line];
if (lineMap != null) {
List<int> columns = lineMap.keys.toList()..sort();
columns.forEach((int column) {
- f(column, lineMap[column]);
+ f(column, lineMap[column]!);
});
}
}
@@ -421,10 +419,10 @@
void forEach(f(int line, int column, T element)) {
List<int> lines = _map.keys.toList()..sort();
for (int line in lines) {
- Map<int, List<T>> lineMap = _map[line];
+ Map<int, List<T>> lineMap = _map[line]!;
List<int> columns = lineMap.keys.toList()..sort();
for (int column in columns) {
- lineMap[column].forEach((e) => f(line, column, e));
+ lineMap[column]!.forEach((e) => f(line, column, e));
}
}
}
@@ -447,7 +445,7 @@
}
/// Returns the index of [element].
- int operator [](T element) => map[element];
+ int? operator [](T element) => map[element];
/// Returns the indexed elements.
Iterable<T> get elements => map.keys;
diff --git a/pkg/compiler/lib/src/ir/runtime_type_analysis.dart b/pkg/compiler/lib/src/ir/runtime_type_analysis.dart
index 06ffbfb..b6ba6c1 100644
--- a/pkg/compiler/lib/src/ir/runtime_type_analysis.dart
+++ b/pkg/compiler/lib/src/ir/runtime_type_analysis.dart
@@ -2,8 +2,6 @@
// 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.10
-
import 'package:kernel/ast.dart' as ir;
import '../common/names.dart';
@@ -40,20 +38,20 @@
/// The static type of the receiver expression. This is set in the static type
/// visitor.
- ir.DartType receiverType;
+ ir.DartType? receiverType;
/// The property get for the right occurrence of `.runtimeType` when [kind]
/// is `RuntimeTypeUseKind.equals`.
// TODO(johnniwinther): Change this to `InstanceGet` when the old method
// invocation encoding is no longer used.
- final ir.Expression rightRuntimeTypeExpression;
+ final ir.Expression? rightRuntimeTypeExpression;
/// The argument expression if [kind] is `RuntimeTypeUseKind.equals`.
- final ir.Expression argument;
+ final ir.Expression? argument;
/// The static type of the argument expression. This is set in the static type
/// visitor.
- ir.DartType argumentType;
+ ir.DartType? argumentType;
RuntimeTypeUseData(this.kind, this.leftRuntimeTypeExpression, this.receiver,
this.rightRuntimeTypeExpression, this.argument);
@@ -66,7 +64,6 @@
case RuntimeTypeUseKind.equals:
return receiverType != null && argumentType != null;
}
- throw UnsupportedError("Unexpected RuntimeTypeUseKind $kind.");
}
@override
@@ -87,7 +84,7 @@
// old method invocation encoding is no longer used.
RuntimeTypeUseData computeRuntimeTypeUse(
Map<ir.Expression, RuntimeTypeUseData> cache, ir.Expression node) {
- RuntimeTypeUseData receiverData = cache[node];
+ RuntimeTypeUseData? receiverData = cache[node];
if (receiverData != null) return receiverData;
/// Returns `true` if [node] is of the form `e.runtimeType`.
@@ -98,29 +95,30 @@
}
/// Returns `true` if [node] is of the form `e.toString()`.
- bool isInvokeToString(ir.TreeNode node) {
+ bool isInvokeToString(ir.TreeNode? node) {
return node is ir.InstanceInvocation && node.name.text == 'toString';
}
assert(isGetRuntimeType(node));
// TODO(johnniwinther): Replace this with `node.receiver` when the old method
// invocation encoding is no longer used.
- _RuntimeTypeAccess runtimeTypeAccess = _getRuntimeTypeAccess(node);
- assert(runtimeTypeAccess != null);
+ _RuntimeTypeAccess runtimeTypeAccess = _getRuntimeTypeAccess(node)!;
// TODO(johnniwinther): Change [receiverGet] and [argumentGet] to
// `InstanceGet` when the old method invocation encoding is no longer used.
// TODO(johnniwinther): Special-case `this.runtimeType`.
- ir.Expression receiverGet;
- ir.Expression receiver;
- ir.Expression argumentGet;
- ir.Expression argument;
- RuntimeTypeUseKind kind;
+ late final ir.Expression receiverGet;
+ late final ir.Expression receiver;
+ ir.Expression? argumentGet;
+ ir.Expression? argument;
+ RuntimeTypeUseKind? kind;
+ final nodeParent = node.parent;
+ final nodeParentParent = nodeParent?.parent;
if (runtimeTypeAccess.receiver is ir.VariableGet &&
- node.parent is ir.ConditionalExpression &&
- node.parent.parent is ir.Let) {
- NullAwareExpression nullAware = getNullAwareExpression(node.parent.parent);
+ nodeParent is ir.ConditionalExpression &&
+ nodeParentParent is ir.Let) {
+ NullAwareExpression? nullAware = getNullAwareExpression(nodeParentParent);
if (nullAware != null) {
// The node is of the form:
//
@@ -129,8 +127,8 @@
if (nullAware.parent is ir.VariableDeclaration &&
nullAware.parent.parent is ir.Let) {
- NullAwareExpression outer =
- getNullAwareExpression(nullAware.parent.parent);
+ NullAwareExpression? outer =
+ getNullAwareExpression(nullAware.parent.parent!);
if (outer != null &&
outer.receiver == nullAware.let &&
isInvokeToString(outer.expression)) {
@@ -149,14 +147,14 @@
receiverGet = node;
}
} else if (_isObjectMethodInvocation(nullAware.parent)) {
- _EqualsInvocation equalsInvocation =
+ _EqualsInvocation? equalsInvocation =
_getEqualsInvocation(nullAware.parent);
if (equalsInvocation != null &&
equalsInvocation.left == nullAware.let) {
// Detected
//
// e0?.runtimeType == other
- _RuntimeTypeAccess otherGetRuntimeType =
+ _RuntimeTypeAccess? otherGetRuntimeType =
_getRuntimeTypeAccess(equalsInvocation.right);
if (otherGetRuntimeType != null) {
// Detected
@@ -175,7 +173,7 @@
argumentGet = otherGetRuntimeType.node;
}
- NullAwareExpression otherNullAware =
+ NullAwareExpression? otherNullAware =
getNullAwareExpression(equalsInvocation.right);
if (otherNullAware != null &&
isGetRuntimeType(otherNullAware.expression)) {
@@ -212,15 +210,15 @@
}
} else if (nullAware.parent is ir.Arguments &&
_isObjectMethodInvocation(nullAware.parent.parent)) {
- _EqualsInvocation equalsInvocation =
+ _EqualsInvocation? equalsInvocation =
_getEqualsInvocation(nullAware.parent.parent);
if (equalsInvocation != null &&
equalsInvocation.right == nullAware.let) {
// [nullAware] is the right hand side of ==.
- _RuntimeTypeAccess otherGetRuntimeType =
+ _RuntimeTypeAccess? otherGetRuntimeType =
_getRuntimeTypeAccess(equalsInvocation.left);
- NullAwareExpression otherNullAware =
+ NullAwareExpression? otherNullAware =
getNullAwareExpression(equalsInvocation.left);
if (otherGetRuntimeType != null) {
@@ -284,9 +282,9 @@
receiverGet = node;
}
}
- } else if (node.parent is ir.VariableDeclaration &&
- node.parent.parent is ir.Let) {
- NullAwareExpression nullAware = getNullAwareExpression(node.parent.parent);
+ } else if (nodeParent is ir.VariableDeclaration &&
+ nodeParentParent is ir.Let) {
+ NullAwareExpression? nullAware = getNullAwareExpression(nodeParentParent);
if (nullAware != null && isInvokeToString(nullAware.expression)) {
// Detected
//
@@ -300,14 +298,14 @@
receiver = runtimeTypeAccess.receiver;
receiverGet = node;
}
- } else if (_isObjectMethodInvocation(node.parent)) {
- _EqualsInvocation equalsInvocation = _getEqualsInvocation(node.parent);
+ } else if (_isObjectMethodInvocation(nodeParent)) {
+ _EqualsInvocation? equalsInvocation = _getEqualsInvocation(nodeParent);
if (equalsInvocation != null && equalsInvocation.left == node) {
// [node] is the left hand side of ==.
- _RuntimeTypeAccess otherGetRuntimeType =
+ _RuntimeTypeAccess? otherGetRuntimeType =
_getRuntimeTypeAccess(equalsInvocation.right);
- NullAwareExpression nullAware =
+ NullAwareExpression? nullAware =
getNullAwareExpression(equalsInvocation.right);
if (otherGetRuntimeType != null) {
// Detected
@@ -339,7 +337,7 @@
argument = nullAware.receiver;
argumentGet = nullAware.expression;
}
- } else if (isInvokeToString(node.parent)) {
+ } else if (isInvokeToString(nodeParent)) {
// Detected
//
// e.runtimeType.toString()
@@ -348,15 +346,15 @@
receiver = runtimeTypeAccess.receiver;
receiverGet = node;
}
- } else if (node.parent is ir.Arguments &&
- _isObjectMethodInvocation(node.parent.parent)) {
- _EqualsInvocation _equalsInvocation =
- _getEqualsInvocation(node.parent.parent);
+ } else if (nodeParent is ir.Arguments &&
+ _isObjectMethodInvocation(nodeParentParent)) {
+ _EqualsInvocation? _equalsInvocation =
+ _getEqualsInvocation(nodeParentParent);
if (_equalsInvocation != null && _equalsInvocation.right == node) {
// [node] is the right hand side of ==.
- _RuntimeTypeAccess otherGetRuntimeType =
+ _RuntimeTypeAccess? otherGetRuntimeType =
_getRuntimeTypeAccess(_equalsInvocation.left);
- NullAwareExpression nullAware =
+ NullAwareExpression? nullAware =
getNullAwareExpression(_equalsInvocation.left);
if (otherGetRuntimeType != null) {
@@ -390,7 +388,7 @@
argumentGet = node;
}
}
- } else if (node.parent is ir.StringConcatenation) {
+ } else if (nodeParent is ir.StringConcatenation) {
// Detected
//
// '${e.runtimeType}'
@@ -417,7 +415,6 @@
cache[argumentGet] = data;
}
- assert(receiverGet != null, "Missing receiverGet in $data for $node.");
assert(!(argument != null && argumentGet == null),
"Missing argumentGet in $data for $node.");
assert(
@@ -426,13 +423,13 @@
}
/// Returns `true` if [node] is a potential invocation of an Object method.
-bool _isObjectMethodInvocation(ir.TreeNode node) {
+bool _isObjectMethodInvocation(ir.TreeNode? node) {
return node is ir.InstanceInvocation || node is ir.EqualsCall;
}
/// Returns the [_RuntimeTypeAccess] corresponding to [node] if it is an access
/// of `.runtimeType`, and `null` otherwise.
-_RuntimeTypeAccess _getRuntimeTypeAccess(ir.TreeNode node) {
+_RuntimeTypeAccess? _getRuntimeTypeAccess(ir.TreeNode node) {
if (node is ir.InstanceGet && node.name.text == 'runtimeType') {
return _RuntimeTypeAccess(node, node.receiver);
} else if (node is ir.DynamicGet && node.name.text == 'runtimeType') {
@@ -450,7 +447,7 @@
/// Returns the [_EqualsInvocation] corresponding to [node] if it is a call to
/// of `==`, and `null` otherwise.
-_EqualsInvocation _getEqualsInvocation(ir.TreeNode node) {
+_EqualsInvocation? _getEqualsInvocation(ir.TreeNode? node) {
if (node is ir.EqualsCall) {
return _EqualsInvocation(node, node.left, node.right);
}
diff --git a/pkg/compiler/lib/src/ir/static_type_base.dart b/pkg/compiler/lib/src/ir/static_type_base.dart
index f32ff54..79ed5f4 100644
--- a/pkg/compiler/lib/src/ir/static_type_base.dart
+++ b/pkg/compiler/lib/src/ir/static_type_base.dart
@@ -2,8 +2,6 @@
// 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.10
-
import 'package:kernel/ast.dart' as ir;
import 'package:kernel/type_environment.dart' as ir;
@@ -21,10 +19,10 @@
/// has precision of a this-expression.
class ThisInterfaceType extends ir.InterfaceType {
ThisInterfaceType(ir.Class classNode, ir.Nullability nullability,
- [List<ir.DartType> typeArguments])
+ [List<ir.DartType>? typeArguments])
: super(classNode, nullability, typeArguments);
- factory ThisInterfaceType.from(ir.InterfaceType type) => type != null
+ static from(ir.InterfaceType? type) => type != null
? ThisInterfaceType(type.classNode, type.nullability, type.typeArguments)
: null;
@@ -36,10 +34,10 @@
/// is exact, i.e. the runtime type is not a subtype or subclass of the type.
class ExactInterfaceType extends ir.InterfaceType {
ExactInterfaceType(ir.Class classNode, ir.Nullability nullability,
- [List<ir.DartType> typeArguments])
+ [List<ir.DartType>? typeArguments])
: super(classNode, nullability, typeArguments);
- factory ExactInterfaceType.from(ir.InterfaceType type) => type != null
+ static from(ir.InterfaceType? type) => type != null
? ExactInterfaceType(type.classNode, type.nullability, type.typeArguments)
: null;
@@ -57,7 +55,7 @@
/// expression kind. For instance method invocations whose static type depend
/// on the static types of the receiver and type arguments and the signature
/// of the targeted procedure.
-abstract class StaticTypeBase extends ir.Visitor<ir.DartType>
+abstract class StaticTypeBase extends ir.Visitor<ir.DartType?>
with ir.VisitorNullMixin<ir.DartType> {
final ir.TypeEnvironment _typeEnvironment;
@@ -72,11 +70,11 @@
ThisInterfaceType get thisType;
@override
- ir.DartType defaultNode(ir.Node node) {
+ ir.DartType? defaultNode(ir.Node node) {
return null;
}
- ir.DartType visitNode(ir.Node node) {
+ ir.DartType? visitNode(ir.Node? node) {
return node?.accept(this);
}
@@ -98,7 +96,7 @@
@override
ir.DartType visitAwaitExpression(ir.AwaitExpression node) {
- return typeEnvironment.flatten(visitNode(node.operand));
+ return typeEnvironment.flatten(visitNode(node.operand)!);
}
@override
@@ -152,7 +150,7 @@
}
@override
- ir.DartType visitVariableSet(ir.VariableSet node) {
+ ir.DartType? visitVariableSet(ir.VariableSet node) {
return visitNode(node.value);
}
@@ -163,12 +161,12 @@
ir.DartType visitStaticGet(ir.StaticGet node) => node.target.getterType;
@override
- ir.DartType visitStaticSet(ir.StaticSet node) {
+ ir.DartType? visitStaticSet(ir.StaticSet node) {
return visitNode(node.value);
}
@override
- ir.DartType visitSuperPropertySet(ir.SuperPropertySet node) {
+ ir.DartType? visitSuperPropertySet(ir.SuperPropertySet node) {
return visitNode(node.value);
}
@@ -207,12 +205,12 @@
}
@override
- ir.DartType visitLet(ir.Let node) {
+ ir.DartType? visitLet(ir.Let node) {
return visitNode(node.body);
}
@override
- ir.DartType visitBlockExpression(ir.BlockExpression node) {
+ ir.DartType? visitBlockExpression(ir.BlockExpression node) {
return visitNode(node.value);
}
diff --git a/pkg/compiler/lib/src/js/rewrite_async.dart b/pkg/compiler/lib/src/js/rewrite_async.dart
index ecc0cd2..a1b5bb2 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -2,8 +2,6 @@
// 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.10
-
library rewrite_async;
import 'dart:collection';
@@ -12,7 +10,6 @@
import 'package:js_runtime/synced/async_await_error_codes.dart' as error_codes;
import '../common.dart';
-import '../io/source_information.dart' show SourceInformation;
import '../util/util.dart' show Pair;
import 'js.dart' as js;
@@ -49,8 +46,8 @@
/// catch-handler.
Map<js.Node, int> handlerLabels = {};
- int exitLabel;
- int rethrowLabel;
+ int? exitLabel;
+ late int rethrowLabel;
/// A stack of all (surrounding) jump targets.
///
@@ -68,15 +65,11 @@
/// are on the way to target (i.e. more nested than the jump target).
List<js.Node> jumpTargets = [];
- List<int> continueStack = [];
- List<int> breakStack = [];
- List<int> returnStack = [];
-
List<Pair<String, String>> variableRenamings = [];
- PreTranslationAnalysis analysis;
+ late final PreTranslationAnalysis analysis;
- final Function safeVariableName;
+ final String Function(String) safeVariableName;
// All the <x>Name variables are names of Javascript variables used in the
// transformed code.
@@ -97,6 +90,7 @@
/// case thenLabel:
/// result = [[a]];
/// goto = joinLabel;
+ /// break;
/// case elseLabel:
/// result = [[b]];
/// case joinLabel:
@@ -108,26 +102,26 @@
/// It is a parameter to the [body] function, so that [awaitStatement] can
/// call [body] with the result of an awaited Future.
js.VariableUse get result => js.VariableUse(resultName);
- String resultName;
+ late final String resultName;
/// A parameter to the [bodyName] function. Indicating if we are in success
/// or error case.
- String errorCodeName;
+ late final String errorCodeName;
/// The inner function that is scheduled to do each await/yield,
/// and called to do a new iteration for sync*.
- js.Name bodyName;
+ final js.Name bodyName;
/// Used to simulate a goto.
///
/// To "goto" a label, the label is assigned to this variable, and break out
/// of the switch to take another iteration in the while loop. See [addGoto]
js.VariableUse get goto => js.VariableUse(gotoName);
- String gotoName;
+ late final String gotoName;
/// Variable containing the label of the current error handler.
js.VariableUse get handler => js.VariableUse(handlerName);
- String handlerName;
+ late final String handlerName;
/// Set to `true` if any of the switch statement labels is a handler. At the
/// end of rewriting this is used to see if a shorter form of error handling
@@ -140,35 +134,34 @@
/// A stack of labels of finally blocks to visit, and the label to go to after
/// the last.
js.VariableUse get next => js.VariableUse(nextName);
- String nextName;
+ late final String nextName;
/// The current returned value (a finally block may overwrite it).
js.VariableUse get returnValue => js.VariableUse(returnValueName);
- String returnValueName;
+ late final String returnValueName;
/// Stores the current error when we are in the process of handling an error.
js.VariableUse get currentError => js.VariableUse(currentErrorName);
- String currentErrorName;
+ late final String currentErrorName;
/// The label of the outer loop.
///
/// Used if there are untransformed loops containing break or continues to
/// targets outside the loop.
- String outerLabelName;
+ late final String outerLabelName;
/// If javascript `this` is used, it is accessed via this variable, in the
/// [bodyName] function.
js.VariableUse get self => js.VariableUse(selfName);
- String selfName;
+ late final String selfName;
/// The rewritten code can take type arguments. These are added if needed.
- List<String> typeArgumentNames = [];
+ final List<String> typeArgumentNames = [];
final DiagnosticReporter reporter;
// For error reporting only.
Spannable get spannable => _spannable ?? NO_LOCATION_SPANNABLE;
-
- Spannable _spannable;
+ final Spannable? _spannable;
int _currentLabel = 0;
@@ -176,7 +169,7 @@
int currentTempVarIndex = 0;
// The highest temporary variable index ever in use in this function.
int tempVarHighWaterMark = 0;
- Map<int, js.Expression> tempVarNames = {};
+ Map<int, js.VariableUse> tempVarNames = {};
bool get isAsync => false;
bool get isSyncStar => false;
@@ -192,11 +185,10 @@
/// Rewrites a sync*/async/async* function to an equivalent normal function.
///
/// [spannable] can be passed to have a location for error messages.
- js.Fun rewrite(js.Fun node, SourceInformation bodySourceInformation,
- SourceInformation exitSourceInformation,
- [Spannable spannable]) {
- _spannable = spannable;
-
+ js.Fun rewrite(
+ js.Fun node,
+ js.JavaScriptNodeSourceInformation? bodySourceInformation,
+ js.JavaScriptNodeSourceInformation? exitSourceInformation) {
analysis = PreTranslationAnalysis(unsupported);
analysis.analyze(node);
@@ -219,7 +211,7 @@
js.Expression get currentErrorHandler {
return js.number(handlerLabels[
- jumpTargets.lastWhere((node) => handlerLabels[node] != null)]);
+ jumpTargets.lastWhere((node) => handlerLabels[node] != null)]!);
}
int allocateTempVar() {
@@ -230,8 +222,7 @@
}
js.VariableUse useTempVar(int i) {
- return tempVarNames.putIfAbsent(
- i, () => js.VariableUse(freshName("temp$i")));
+ return tempVarNames[i] ??= js.VariableUse(freshName("temp$i"));
}
/// Generates a variable name with [safeVariableName] based on [originalName]
@@ -248,7 +239,7 @@
return result;
}
- List<js.Expression> processTypeArguments(List<js.Expression> types) {
+ List<js.Expression> processTypeArguments(List<js.Expression>? types) {
if (types == null) {
String name = freshName('type');
typeArgumentNames.add(name);
@@ -260,9 +251,9 @@
/// All the pieces are collected in this map, to create a switch with a case
/// for each label.
///
- /// The order is important, therefore the type is explicitly LinkedHashMap.
- LinkedHashMap<int, List<js.Statement>> labelledParts =
- LinkedHashMap<int, List<js.Statement>>();
+ /// The order is important due to fall-through control flow, therefore the
+ /// type is explicitly LinkedHashMap.
+ Map<int, List<js.Statement>> labelledParts = LinkedHashMap();
/// Description of each label for readability of the non-minified output.
Map<int, String> labelComments = {};
@@ -283,18 +274,15 @@
/// Buffer for collecting translated statements belonging to the same switch
/// case.
- List<js.Statement> currentStatementBuffer;
+ List<js.Statement> currentStatementBuffer = [];
// Labels will become cases in the big switch expression, and `goto label`
// is expressed by assigning to the switch key [gotoName] and breaking out of
// the switch.
- int newLabel([String comment]) {
- int result = _currentLabel;
- _currentLabel++;
- if (comment != null) {
- labelComments[result] = comment;
- }
+ int newLabel(String comment) {
+ int result = _currentLabel++;
+ labelComments[result] = comment;
return result;
}
@@ -305,13 +293,14 @@
assert(!labelledParts.containsKey(label));
currentStatementBuffer = [];
labelledParts[label] = currentStatementBuffer;
- addStatement(js.Comment(labelComments[label]));
+ addStatement(js.Comment(labelComments[label]!));
}
/// Returns a statement assigning to the variable named [gotoName].
/// This should be followed by a break for the goto to be executed. Use
/// [gotoWithBreak] or [addGoto] for this.
- js.Statement setGotoVariable(int label, SourceInformation sourceInformation) {
+ js.Statement setGotoVariable(
+ int label, js.JavaScriptNodeSourceInformation? sourceInformation) {
return js.ExpressionStatement(js.js('# = #',
[goto, js.number(label)]).withSourceInformation(sourceInformation));
}
@@ -319,7 +308,8 @@
/// Returns a block that has a goto to [label] including the break.
///
/// Also inserts a comment describing the label if available.
- js.Block gotoAndBreak(int label, SourceInformation sourceInformation) {
+ js.Block gotoAndBreak(
+ int label, js.JavaScriptNodeSourceInformation? sourceInformation) {
List<js.Statement> statements = [];
if (labelComments.containsKey(label)) {
statements.add(js.Comment("goto ${labelComments[label]}"));
@@ -338,7 +328,8 @@
/// Adds a goto to [label] including the break.
///
/// Also inserts a comment describing the label if available.
- void addGoto(int label, SourceInformation sourceInformation) {
+ void addGoto(
+ int label, js.JavaScriptNodeSourceInformation? sourceInformation) {
if (labelComments.containsKey(label)) {
addStatement(js.Comment("goto ${labelComments[label]}"));
}
@@ -356,11 +347,11 @@
}
/// True if there is an await or yield in [node] or some subexpression.
- bool shouldTransform(js.Node node) {
+ bool shouldTransform(js.Node? node) {
return analysis.hasAwaitOrYield.contains(node);
}
- void unsupported(js.Node node) {
+ Never unsupported(js.Node node) {
throw UnsupportedError(
"Node $node cannot be transformed by the await-sync transformer");
}
@@ -380,7 +371,7 @@
/// no side effect, it is dropped.
void visitExpressionIgnoreResult(js.Expression node) {
// TODO(28763): Remove `<dynamic>` when issue 28763 is fixed.
- js.Expression result = node.accept<dynamic>(this);
+ js.Expression result = node.accept<dynamic>(this)!;
if (!(result is js.Literal || result is js.VariableUse)) {
addExpressionStatement(result);
}
@@ -423,9 +414,10 @@
return tempVar;
}
- // TODO(sigurdm): This is obsolete - all calls use store: false. Replace with
- // visitExpression(node);
- withExpression(js.Expression node, fn(js.Expression result), {bool store}) {
+ // TODO(sra): Many calls to this method use `store: false`, and could be
+ // replaced with calls to `visitExpression`.
+ withExpression(js.Expression node, fn(js.Expression result),
+ {required bool store}) {
int oldTempVarIndex = currentTempVarIndex;
js.Expression visited = visitExpression(node);
if (store) {
@@ -450,10 +442,10 @@
/// temp = <receiver>;
/// temp.m();
withCallTargetExpression(js.Expression node, fn(js.Expression result),
- {bool store}) {
+ {required bool store}) {
int oldTempVarIndex = currentTempVarIndex;
js.Expression visited = visitExpression(node);
- js.Expression selector;
+ js.Expression? selector;
js.Expression storedIfNeeded;
if (store) {
if (visited is js.PropertyAccess) {
@@ -484,8 +476,8 @@
/// because the evaluation of an await or yield cannot be expressed as
/// an expression, visiting node2 it will output statements that
/// might have an influence on the value of node1.
- withExpression2(js.Expression node1, js.Expression node2,
- fn(js.Expression result1, js.Expression result2)) {
+ js.Expression withExpression2(js.Expression node1, js.Expression node2,
+ js.Expression fn(js.Expression result1, js.Expression result2)) {
int oldTempVarIndex = currentTempVarIndex;
js.Expression r1 = visitExpression(node1);
if (shouldTransform(node2)) {
@@ -503,11 +495,30 @@
/// in temporary variables.
///
/// See more explanation on [withExpression2].
- ///
- /// If any of the nodes are null, they are ignored, and a null is passed to
- /// [fn] in that place.
- withExpressions(List<js.Expression> nodes, fn(List<js.Expression> results)) {
+ T withExpressions<T>(
+ List<js.Expression> nodes, T fn(List<js.Expression> results)) {
int oldTempVarIndex = currentTempVarIndex;
+ List<js.Expression> visited = [];
+ _collectVisited(nodes, visited);
+ final result = fn(visited);
+ currentTempVarIndex = oldTempVarIndex;
+ return result;
+ }
+
+ /// Like [withExpressions], but permitting `null` nodes. If any of the nodes
+ /// are null, they are ignored, and a null is passed to [fn] in that place.
+ T withNullableExpressions<T>(
+ List<js.Expression?> nodes, T fn(List<js.Expression?> results)) {
+ int oldTempVarIndex = currentTempVarIndex;
+ List<js.Expression?> visited = [];
+ _collectVisited(nodes, visited);
+ final result = fn(visited);
+ currentTempVarIndex = oldTempVarIndex;
+ return result;
+ }
+
+ void _collectVisited(
+ List<js.Expression?> nodes, List<js.Expression?> visited) {
// Find last occurrence of a 'transform' expression in [nodes].
// All expressions before that must be stored in temp-vars.
int lastTransformIndex = 0;
@@ -518,28 +529,28 @@
break;
}
}
- List<js.Node> visited = nodes.take(lastTransformIndex).map((js.Node node) {
- return (node == null) ? null : _storeIfNecessary(visitExpression(node));
- }).toList();
- visited.addAll(
- nodes.skip(lastTransformIndex).map<js.Expression>((js.Node node) {
- return (node == null) ? null : visitExpression(node);
- }));
- var result = fn(visited);
- currentTempVarIndex = oldTempVarIndex;
- return result;
+ for (int i = 0; i < nodes.length; i++) {
+ js.Expression? node = nodes[i];
+ if (node != null) {
+ node = visitExpression(node);
+ if (i < lastTransformIndex) {
+ node = _storeIfNecessary(node);
+ }
+ }
+ visited.add(node);
+ }
}
/// Emits the return block that all returns jump to (after going
/// through all the enclosing finally blocks). The jump to here is made in
/// [visitReturn].
- void addSuccessExit(SourceInformation sourceInformation);
+ void addSuccessExit(js.JavaScriptNodeSourceInformation? sourceInformation);
/// Emits the block that control flows to if an error has been thrown
/// but not caught. (after going through all the enclosing finally blocks).
- void addErrorExit(SourceInformation sourceInformation);
+ void addErrorExit(js.JavaScriptNodeSourceInformation? sourceInformation);
- void addFunctionExits(SourceInformation sourceInformation) {
+ void addFunctionExits(js.JavaScriptNodeSourceInformation? sourceInformation) {
addSuccessExit(sourceInformation);
addErrorExit(sourceInformation);
}
@@ -550,11 +561,11 @@
List<js.Parameter> typeParameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations,
- SourceInformation functionSourceInformation,
- SourceInformation bodySourceInformation);
+ js.JavaScriptNodeSourceInformation? functionSourceInformation,
+ js.JavaScriptNodeSourceInformation? bodySourceInformation);
Iterable<js.VariableInitialization> variableInitializations(
- SourceInformation sourceInformation);
+ js.JavaScriptNodeSourceInformation? sourceInformation);
/// Rewrites an async/sync*/async* function to a normal Javascript function.
///
@@ -694,27 +705,27 @@
/// [bodySourceInformation] is used on code generated to execute the function
/// body and [exitSourceInformation] is used on code generated to exit the
/// function.
- js.Expression rewriteFunction(
+ js.Fun rewriteFunction(
js.Fun node,
- SourceInformation bodySourceInformation,
- SourceInformation exitSourceInformation) {
+ js.JavaScriptNodeSourceInformation? bodySourceInformation,
+ js.JavaScriptNodeSourceInformation? exitSourceInformation) {
beginLabel(newLabel("Function start"));
// AsyncStar needs a return label for its handling of cancellation. See
// [visitDartYield].
exitLabel = (analysis.hasExplicitReturns || isAsyncStar)
? newLabel("return")
: null;
- rethrowLabel = newLabel("rethrow");
- handlerLabels[node] = rethrowLabel;
+ handlerLabels[node] = rethrowLabel = newLabel("rethrow");
js.Statement body = node.body;
jumpTargets.add(node);
visitStatement(body);
jumpTargets.removeLast();
addFunctionExits(exitSourceInformation);
- List<js.SwitchClause> clauses = labelledParts.keys.map((label) {
- return js.Case(js.number(label), js.Block(labelledParts[label]));
- }).toList();
+ List<js.SwitchClause> clauses = [
+ for (final entry in labelledParts.entries)
+ js.Case(js.number(entry.key), js.Block(entry.value))
+ ];
js.Statement rewrittenBody =
js.Switch(goto, clauses).withSourceInformation(bodySourceInformation);
if (hasJumpThoughOuterLabel) {
@@ -829,8 +840,8 @@
}
}
- js.Statement awaitStatement(
- js.Expression value, SourceInformation sourceInformation);
+ js.Statement awaitStatement(js.Expression value,
+ js.JavaScriptNodeSourceInformation? sourceInformation);
/// An await is translated to an [awaitStatement].
///
@@ -907,7 +918,7 @@
@override
void visitBreak(js.Break node) {
- js.Node target = analysis.targets[node];
+ js.Node target = analysis.targets[node]!;
if (!shouldTransform(target)) {
addStatement(node);
return;
@@ -977,16 +988,16 @@
@override
void visitContinue(js.Continue node) {
- js.Node target = analysis.targets[node];
+ js.Node? target = analysis.targets[node];
if (!shouldTransform(target)) {
addStatement(node);
return;
}
- translateJump(target, continueLabels[target], node.sourceInformation);
+ translateJump(target, continueLabels[target!], node.sourceInformation);
}
/// Emits a break statement that exits the big switch statement.
- void addBreak(SourceInformation sourceInformation) {
+ void addBreak(js.JavaScriptNodeSourceInformation? sourceInformation) {
if (insideUntranslatedBreakable) {
hasJumpThoughOuterLabel = true;
addStatement(
@@ -1002,17 +1013,17 @@
/// the target. For that [next] is used as a stack of places to go.
///
/// See also [rewriteFunction].
- void translateJump(
- js.Node target, int targetLabel, SourceInformation sourceInformation) {
+ void translateJump(js.Node? target, int? targetLabel,
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
// Compute a stack of all the 'finally' nodes that must be visited before
// the jump.
// The bottom of the stack is the label where the jump goes to.
List<int> jumpStack = [];
for (js.Node node in jumpTargets.reversed) {
if (finallyLabels[node] != null) {
- jumpStack.add(finallyLabels[node]);
+ jumpStack.add(finallyLabels[node]!);
} else if (node == target) {
- jumpStack.add(targetLabel);
+ jumpStack.add(targetLabel!);
break;
}
// Ignore other nodes.
@@ -1081,9 +1092,9 @@
bool oldInsideUntranslated = insideUntranslatedBreakable;
insideUntranslatedBreakable = true;
// Note that node.init, node.condition, node.update all can be null, but
- // withExpressions handles that.
- withExpressions([node.init, node.condition, node.update],
- (List<js.Expression> transformed) {
+ // withNullableExpressions handles that.
+ withNullableExpressions([node.init, node.condition, node.update],
+ (List<js.Expression?> transformed) {
addStatement(js.For(transformed[0], transformed[1], transformed[2],
translateToStatement(node.body)));
});
@@ -1092,7 +1103,7 @@
}
if (node.init != null) {
- visitExpressionIgnoreResult(node.init);
+ visitExpressionIgnoreResult(node.init!);
}
int startLabel = newLabel("for condition");
// If there is no update, continuing the loop is the same as going to the
@@ -1103,7 +1114,7 @@
int afterLabel = newLabel("after for");
breakLabels[node] = afterLabel;
beginLabel(startLabel);
- js.Expression condition = node.condition;
+ js.Expression? condition = node.condition;
if (condition == null ||
(condition is js.LiteralBool && condition.value == true)) {
addStatement(js.Comment("trivial condition"));
@@ -1118,7 +1129,7 @@
jumpTargets.removeLast();
if (node.update != null) {
beginLabel(continueLabel);
- visitExpressionIgnoreResult(node.update);
+ visitExpressionIgnoreResult(node.update!);
}
addGoto(startLabel, node.sourceInformation);
beginLabel(afterLabel);
@@ -1189,30 +1200,32 @@
@override
visitInterpolatedExpression(js.InterpolatedExpression node) {
- return unsupported(node);
+ unsupported(node);
}
@override
visitInterpolatedDeclaration(js.InterpolatedDeclaration node) {
- return unsupported(node);
+ unsupported(node);
}
@override
- visitInterpolatedLiteral(js.InterpolatedLiteral node) => unsupported(node);
+ visitInterpolatedLiteral(js.InterpolatedLiteral node) {
+ unsupported(node);
+ }
@override
visitInterpolatedParameter(js.InterpolatedParameter node) {
- return unsupported(node);
+ unsupported(node);
}
@override
visitInterpolatedSelector(js.InterpolatedSelector node) {
- return unsupported(node);
+ unsupported(node);
}
@override
visitInterpolatedStatement(js.InterpolatedStatement node) {
- return unsupported(node);
+ unsupported(node);
}
@override
@@ -1261,7 +1274,6 @@
@override
js.Parentheses visitParentheses(js.Parentheses node) {
unsupported(node);
- return null;
}
@override
@@ -1293,13 +1305,13 @@
@override
js.Expression visitObjectInitializer(js.ObjectInitializer node) {
- // throw Exception("NOOOOOOOOOOOOOOOO");
return withExpressions(
node.properties.map((js.Property property) => property.value).toList(),
- (List<js.Node> values) {
+ (List<js.Expression> values) {
List<js.Property> properties = List.generate(values.length, (int i) {
if (node.properties[i] is js.MethodDefinition) {
- return js.MethodDefinition(node.properties[i].name, values[i]);
+ return js.MethodDefinition(
+ node.properties[i].name, values[i] as js.Fun);
}
return js.Property(node.properties[i].name, values[i]);
});
@@ -1365,8 +1377,10 @@
@override
js.MethodDefinition visitMethodDefinition(js.MethodDefinition node) {
- return withExpression(node.function,
- (js.Expression value) => js.MethodDefinition(node.name, value),
+ return withExpression(
+ node.function,
+ (js.Expression value) =>
+ js.MethodDefinition(node.name, value as js.Fun),
store: false);
}
@@ -1375,17 +1389,18 @@
@override
void visitReturn(js.Return node) {
- js.Node target = analysis.targets[node];
- if (node.value != null) {
+ js.Node? target = analysis.targets[node];
+ final expression = node.value;
+ if (expression != null) {
if (isSyncStar || isAsyncStar) {
// Even though `return expr;` is not allowed in the dart sync* and
// async* code, the backend sometimes generates code like this, but
// only when it is known that the 'expr' throws, and the return is just
// to tell the JavaScript VM that the code won't continue here.
// It is therefore interpreted as `expr; return;`
- visitExpressionIgnoreResult(node.value);
+ visitExpressionIgnoreResult(expression);
} else {
- withExpression(node.value, (js.Expression value) {
+ withExpression(expression, (js.Expression value) {
addStatement(js.js
.statement("# = #;", [returnValue, value]).withSourceInformation(
node.sourceInformation));
@@ -1419,12 +1434,12 @@
breakLabels[node] = after;
beginLabel(before);
- List<int> labels = List<int>.filled(node.cases.length, null);
+ List<int> labels = List<int>.filled(node.cases.length, -1);
bool anyCaseExpressionTransformed = node.cases.any(
(js.SwitchClause x) => x is js.Case && shouldTransform(x.expression));
if (anyCaseExpressionTransformed) {
- int defaultIndex = null; // Null means no default was found.
+ int? defaultIndex = null; // Null means no default was found.
// If there is an await in one of the keys, a chain of ifs has to be used.
withExpression(node.key, (js.Expression key) {
@@ -1450,7 +1465,7 @@
if (defaultIndex == null) {
addGoto(after, node.sourceInformation);
} else {
- addGoto(labels[defaultIndex], node.sourceInformation);
+ addGoto(labels[defaultIndex!], node.sourceInformation);
}
} else {
bool hasDefault = false;
@@ -1503,7 +1518,7 @@
}, store: false);
}
- setErrorHandler([int errorHandler]) {
+ setErrorHandler([int? errorHandler]) {
hasHandlerLabels = true; // TODO(sra): Add short form error handler.
js.Expression label =
(errorHandler == null) ? currentErrorHandler : js.number(errorHandler);
@@ -1514,12 +1529,12 @@
List<int> result = [];
for (int i = jumpTargets.length - 1; i >= 0; i--) {
js.Node node = jumpTargets[i];
- int handlerLabel = handlerLabels[node];
+ int? handlerLabel = handlerLabels[node];
if (handlerLabel != null) {
result.add(handlerLabel);
break;
}
- int finallyLabel = finallyLabels[node];
+ int? finallyLabel = finallyLabels[node];
if (finallyLabel != null) {
result.add(finallyLabel);
}
@@ -1530,29 +1545,29 @@
/// See the comments of [rewriteFunction] for more explanation.
@override
void visitTry(js.Try node) {
+ final catchPart = node.catchPart;
+ final finallyPart = node.finallyPart;
+
if (!shouldTransform(node)) {
js.Block body = translateToBlock(node.body);
- js.Catch catchPart = (node.catchPart == null)
+ js.Catch? translatedCatchPart = (catchPart == null)
? null
- : js.Catch(node.catchPart.declaration,
- translateToBlock(node.catchPart.body));
- js.Block finallyPart = (node.finallyPart == null)
- ? null
- : translateToBlock(node.finallyPart);
- addStatement(js.Try(body, catchPart, finallyPart));
+ : js.Catch(catchPart.declaration, translateToBlock(catchPart.body));
+ js.Block? translatedFinallyPart =
+ (finallyPart == null) ? null : translateToBlock(finallyPart);
+ addStatement(js.Try(body, translatedCatchPart, translatedFinallyPart));
return;
}
hasTryBlocks = true;
int uncaughtLabel = newLabel("uncaught");
- int handlerLabel =
- (node.catchPart == null) ? uncaughtLabel : newLabel("catch");
+ int handlerLabel = (catchPart == null) ? uncaughtLabel : newLabel("catch");
int finallyLabel = newLabel("finally");
int afterFinallyLabel = newLabel("after finally");
- if (node.finallyPart != null) {
- finallyLabels[node.finallyPart] = finallyLabel;
- jumpTargets.add(node.finallyPart);
+ if (finallyPart != null) {
+ finallyLabels[finallyPart] = finallyLabel;
+ jumpTargets.add(finallyPart);
}
handlerLabels[node] = handlerLabel;
@@ -1567,7 +1582,7 @@
js.Node last = jumpTargets.removeLast();
assert(last == node);
- if (node.finallyPart == null) {
+ if (finallyPart == null) {
setErrorHandler();
addGoto(afterFinallyLabel, node.sourceInformation);
} else {
@@ -1577,23 +1592,23 @@
addGoto(finallyLabel, node.sourceInformation);
}
- if (node.catchPart != null) {
+ if (catchPart != null) {
beginLabel(handlerLabel);
// [uncaughtLabel] is the handler for the code in the catch-part.
// It ensures that [nextName] is set up to run the right finally blocks.
- handlerLabels[node.catchPart] = uncaughtLabel;
- jumpTargets.add(node.catchPart);
+ handlerLabels[catchPart] = uncaughtLabel;
+ jumpTargets.add(catchPart);
setErrorHandler();
// The catch declaration name can shadow outer variables, so a fresh name
// is needed to avoid collisions. See Ecma 262, 3rd edition,
// section 12.14.
- String errorRename = freshName(node.catchPart.declaration.name);
+ String errorRename = freshName(catchPart.declaration.name);
localVariables.add(js.VariableDeclaration(errorRename));
- variableRenamings.add(Pair(node.catchPart.declaration.name, errorRename));
+ variableRenamings.add(Pair(catchPart.declaration.name, errorRename));
addStatement(js.js.statement("# = #;", [errorRename, currentError]));
- visitStatement(node.catchPart.body);
+ visitStatement(catchPart.body);
variableRenamings.removeLast();
- if (node.finallyPart != null) {
+ if (finallyPart != null) {
// The error has been caught, so after the finally, continue after the
// try.
addStatement(js.js
@@ -1603,7 +1618,7 @@
addGoto(afterFinallyLabel, node.sourceInformation);
}
js.Node last = jumpTargets.removeLast();
- assert(last == node.catchPart);
+ assert(last == catchPart);
}
// The "uncaught"-handler tells the finally-block to continue with
@@ -1621,18 +1636,18 @@
js.ArrayInitializer(enclosingFinallies.map(js.number).toList())
]));
}
- if (node.finallyPart == null) {
+ if (finallyPart == null) {
// The finally-block belonging to [node] will be visited because of
// fallthrough. If it does not exist, add an explicit goto.
addGoto(nextLabel, node.sourceInformation);
}
- if (node.finallyPart != null) {
+ if (finallyPart != null) {
js.Node last = jumpTargets.removeLast();
- assert(last == node.finallyPart);
+ assert(last == finallyPart);
beginLabel(finallyLabel);
setErrorHandler();
- visitStatement(node.finallyPart);
+ visitStatement(finallyPart);
addStatement(js.Comment("// goto the next finally handler"));
addStatement(js.js.statement("# = #.pop();", [goto, next]));
addBreak(node.sourceInformation);
@@ -1648,10 +1663,11 @@
@override
js.Expression visitVariableDeclarationList(js.VariableDeclarationList node) {
for (js.VariableInitialization initialization in node.declarations) {
- js.VariableDeclaration declaration = initialization.declaration;
+ js.VariableDeclaration declaration =
+ initialization.declaration as js.VariableDeclaration;
localVariables.add(declaration);
if (initialization.value != null) {
- withExpression(initialization.value, (js.Expression value) {
+ withExpression(initialization.value!, (js.Expression value) {
addExpressionStatement(
js.Assignment(js.VariableUse(declaration.name), value));
}, store: false);
@@ -1667,11 +1683,10 @@
@override
js.Expression visitVariableUse(js.VariableUse node) {
- Pair<String, String> renaming = variableRenamings.lastWhere(
- (Pair renaming) => renaming.a == node.name,
- orElse: () => null);
- if (renaming == null) return node;
- return js.VariableUse(renaming.b);
+ for (final renaming in variableRenamings.reversed) {
+ if (renaming.a == node.name) return js.VariableUse(renaming.b);
+ }
+ return node;
}
@override
@@ -1707,7 +1722,7 @@
}
addYield(js.DartYield node, js.Expression expression,
- SourceInformation sourceInformation);
+ js.JavaScriptNodeSourceInformation? sourceInformation);
@override
void visitDartYield(js.DartYield node) {
@@ -1723,8 +1738,10 @@
}
}
-js.VariableInitialization _makeVariableInitializer(dynamic variable,
- js.Expression initValue, SourceInformation sourceInformation) {
+js.VariableInitialization _makeVariableInitializer(
+ dynamic variable,
+ js.Expression? initValue,
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
js.VariableDeclaration declaration;
if (variable is js.VariableUse) {
declaration = js.VariableDeclaration(variable.name);
@@ -1735,7 +1752,7 @@
declaration = variable;
}
return js.VariableInitialization(declaration, initValue)
- .withSourceInformation(sourceInformation);
+ .withSourceInformation(sourceInformation) as js.VariableInitialization;
}
class AsyncRewriter extends AsyncRewriterBase {
@@ -1745,7 +1762,7 @@
/// The Completer that will finish an async function.
///
/// Not used for sync* or async* functions.
- String completerName;
+ late final String completerName;
js.VariableUse get completer => js.VariableUse(completerName);
/// The function called by an async function to initiate asynchronous
@@ -1784,30 +1801,30 @@
///
/// Specific to async methods.
final js.Expression completerFactory;
- List<js.Expression> completerFactoryTypeArguments;
+ List<js.Expression>? completerFactoryTypeArguments;
final js.Expression wrapBody;
AsyncRewriter(DiagnosticReporter reporter, Spannable spannable,
- {this.asyncStart,
- this.asyncAwait,
- this.asyncReturn,
- this.asyncRethrow,
- this.completerFactory,
- this.completerFactoryTypeArguments,
- this.wrapBody,
- String safeVariableName(String proposedName),
- js.Name bodyName})
+ {required this.asyncStart,
+ required this.asyncAwait,
+ required this.asyncReturn,
+ required this.asyncRethrow,
+ required this.completerFactory,
+ required this.completerFactoryTypeArguments,
+ required this.wrapBody,
+ required String safeVariableName(String proposedName),
+ required js.Name bodyName})
: super(reporter, spannable, safeVariableName, bodyName);
@override
void addYield(js.DartYield node, js.Expression expression,
- SourceInformation sourceInformation) {
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
reporter.internalError(spannable, "Yield in non-generating async function");
}
@override
- void addErrorExit(SourceInformation sourceInformation) {
+ void addErrorExit(js.JavaScriptNodeSourceInformation? sourceInformation) {
if (!hasHandlerLabels) return; // rethrow handled in method boilerplate.
beginLabel(rethrowLabel);
js.Expression thenHelperCall = js.js(
@@ -1824,9 +1841,9 @@
/// (the result might have been stored in [returnValue] by some finally
/// block).
@override
- void addSuccessExit(SourceInformation sourceInformation) {
+ void addSuccessExit(js.JavaScriptNodeSourceInformation? sourceInformation) {
if (analysis.hasExplicitReturns) {
- beginLabel(exitLabel);
+ beginLabel(exitLabel!);
} else {
addStatement(js.Comment("implicit return"));
}
@@ -1844,7 +1861,7 @@
@override
Iterable<js.VariableInitialization> variableInitializations(
- SourceInformation sourceInformation) {
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
List<js.VariableInitialization> variables = [];
variables.add(_makeVariableInitializer(
completer,
@@ -1868,8 +1885,8 @@
}
@override
- js.Statement awaitStatement(
- js.Expression value, SourceInformation sourceInformation) {
+ js.Statement awaitStatement(js.Expression value,
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
js.Expression asyncHelperCall = js.js("#asyncHelper(#value, #bodyName)", {
"asyncHelper": asyncAwait,
"value": value,
@@ -1884,15 +1901,15 @@
List<js.Parameter> typeParameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations,
- SourceInformation functionSourceInformation,
- SourceInformation bodySourceInformation) {
+ js.JavaScriptNodeSourceInformation? functionSourceInformation,
+ js.JavaScriptNodeSourceInformation? bodySourceInformation) {
js.Expression asyncRethrowCall =
js.js("#asyncRethrow(#result, #completer)", {
"result": resultName,
"asyncRethrow": asyncRethrow,
"completer": completer,
}).withSourceInformation(bodySourceInformation);
- js.Return returnAsyncRethrow = js.Return(asyncRethrowCall)
+ js.Statement returnAsyncRethrow = js.Return(asyncRethrowCall)
.withSourceInformation(bodySourceInformation);
js.Statement errorCheck = js.js.statement("""
if (#errorCode === #ERROR) {
@@ -1911,7 +1928,7 @@
"handler": handler,
"returnAsyncRethrow": returnAsyncRethrow,
}).withSourceInformation(bodySourceInformation);
- js.Fun innerFunction = js.js("""
+ js.Expression innerFunction = js.js("""
function (#errorCode, #result) {
#errorCheck;
#rewrittenBody;
@@ -1926,7 +1943,7 @@
"bodyName": bodyName,
"completer": completer,
}).withSourceInformation(bodySourceInformation);
- js.Return returnAsyncStart =
+ js.Statement returnAsyncStart =
js.Return(asyncStartCall).withSourceInformation(bodySourceInformation);
js.Expression wrapBodyCall = js.js("#wrapBody(#innerFunction)", {
"wrapBody": wrapBody,
@@ -1944,7 +1961,7 @@
"bodyName": bodyName,
"wrapBodyCall": wrapBodyCall,
"returnAsyncStart": returnAsyncStart,
- }).withSourceInformation(functionSourceInformation);
+ }).withSourceInformation(functionSourceInformation) as js.Fun;
}
}
@@ -1955,7 +1972,7 @@
/// Constructor creating the Iterable for a sync* method. Called with
/// [bodyName].
final js.Expression iterableFactory;
- List<js.Expression> iterableFactoryTypeArguments;
+ List<js.Expression>? iterableFactoryTypeArguments;
/// A JS Expression that creates a marker showing that iteration is over.
///
@@ -1971,13 +1988,13 @@
final js.Expression uncaughtErrorExpression;
SyncStarRewriter(DiagnosticReporter diagnosticListener, spannable,
- {this.endOfIteration,
- this.iterableFactory,
- this.iterableFactoryTypeArguments,
- this.yieldStarExpression,
- this.uncaughtErrorExpression,
- String safeVariableName(String proposedName),
- js.Name bodyName})
+ {required this.endOfIteration,
+ required this.iterableFactory,
+ required this.iterableFactoryTypeArguments,
+ required this.yieldStarExpression,
+ required this.uncaughtErrorExpression,
+ required String safeVariableName(String proposedName),
+ required js.Name bodyName})
: super(diagnosticListener, spannable, safeVariableName, bodyName);
/// Translates a yield/yield* in an sync*.
@@ -1986,7 +2003,7 @@
/// `yield*` wraps [value] in a [yieldStarExpression] and returns it.
@override
void addYield(js.DartYield node, js.Expression expression,
- SourceInformation sourceInformation) {
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
if (node.hasStar) {
addStatement(js.Return(js.Call(yieldStarExpression, [expression])
.withSourceInformation(sourceInformation))
@@ -2003,8 +2020,8 @@
List<js.Parameter> typeParameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations,
- SourceInformation functionSourceInformation,
- SourceInformation bodySourceInformation) {
+ js.JavaScriptNodeSourceInformation? functionSourceInformation,
+ js.JavaScriptNodeSourceInformation? bodySourceInformation) {
// Each iterator invocation on the iterable should work on its own copy of
// the parameters.
// TODO(sigurdm): We only need to do this copying for parameters that are
@@ -2039,7 +2056,7 @@
"setCurrentError": setCurrentError,
"setGoto": setGoto,
}).withSourceInformation(bodySourceInformation);
- js.NamedFunction innerInnerFunction = js.js("""
+ js.Expression innerInnerFunction = js.js("""
function #body(#errorCode, #result) {
#checkErrorCode;
#helperBody;
@@ -2050,9 +2067,9 @@
"result": resultName,
"checkErrorCode": checkErrorCode,
}).withSourceInformation(functionSourceInformation);
- js.Return returnInnerInnerFunction = js.Return(innerInnerFunction)
+ js.Statement returnInnerInnerFunction = js.Return(innerInnerFunction)
.withSourceInformation(bodySourceInformation);
- js.Fun innerFunction = js.js("""
+ js.Expression innerFunction = js.js("""
function () {
if (#hasParameters) {
#copyParameters;
@@ -2085,11 +2102,11 @@
"needsThis": analysis.hasThis,
"self": selfName,
"returnCallIterableFactory": returnCallIterableFactory,
- }).withSourceInformation(functionSourceInformation);
+ }).withSourceInformation(functionSourceInformation) as js.Fun;
}
@override
- void addErrorExit(SourceInformation sourceInformation) {
+ void addErrorExit(js.JavaScriptNodeSourceInformation? sourceInformation) {
hasHandlerLabels = true; // TODO(sra): Add short form error handler.
beginLabel(rethrowLabel);
js.Expression uncaughtErrorExpressionCall = js.js('#(#)', [
@@ -2102,9 +2119,9 @@
/// Returning from a sync* function returns an [endOfIteration] marker.
@override
- void addSuccessExit(SourceInformation sourceInformation) {
+ void addSuccessExit(js.JavaScriptNodeSourceInformation? sourceInformation) {
if (analysis.hasExplicitReturns) {
- beginLabel(exitLabel);
+ beginLabel(exitLabel!);
} else {
addStatement(js.Comment("implicit return"));
}
@@ -2116,14 +2133,14 @@
@override
Iterable<js.VariableInitialization> variableInitializations(
- SourceInformation sourceInformation) {
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
List<js.VariableInitialization> variables = [];
return variables;
}
@override
- js.Statement awaitStatement(
- js.Expression value, SourceInformation sourceInformation) {
+ js.Statement awaitStatement(js.Expression value,
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
throw reporter.internalError(
spannable, "Sync* functions cannot contain await statements.");
}
@@ -2145,10 +2162,10 @@
return js.VariableUse(nextWhenCanceledName);
}
- String nextWhenCanceledName;
+ late final String nextWhenCanceledName;
/// The StreamController that controls an async* function.
- String controllerName;
+ late final String controllerName;
js.VariableUse get controller => js.VariableUse(controllerName);
/// The function called by an async* function to simulate an await, yield or
@@ -2173,7 +2190,7 @@
///
/// Specific to async* methods.
final js.Expression newController;
- List<js.Expression> newControllerTypeArguments;
+ List<js.Expression>? newControllerTypeArguments;
/// Used to get the `Stream` out of the [controllerName] variable.
final js.Expression streamOfController;
@@ -2191,15 +2208,15 @@
final js.Expression wrapBody;
AsyncStarRewriter(DiagnosticReporter reporter, Spannable spannable,
- {this.asyncStarHelper,
- this.streamOfController,
- this.newController,
- this.newControllerTypeArguments,
- this.yieldExpression,
- this.yieldStarExpression,
- this.wrapBody,
- String safeVariableName(String proposedName),
- js.Name bodyName})
+ {required this.asyncStarHelper,
+ required this.streamOfController,
+ required this.newController,
+ required this.newControllerTypeArguments,
+ required this.yieldExpression,
+ required this.yieldStarExpression,
+ required this.wrapBody,
+ required String safeVariableName(String proposedName),
+ required js.Name bodyName})
: super(reporter, spannable, safeVariableName, bodyName);
/// Translates a yield/yield* in an async* function.
@@ -2212,14 +2229,16 @@
/// must be run in case the stream was canceled.
@override
void addYield(js.DartYield node, js.Expression expression,
- SourceInformation sourceInformation) {
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
// Find all the finally blocks that should be performed if the stream is
// canceled during the yield.
- // At the bottom of the stack is the return label.
- List<int> enclosingFinallyLabels = [exitLabel];
- enclosingFinallyLabels.addAll(jumpTargets
- .where((js.Node node) => finallyLabels[node] != null)
- .map((js.Node node) => finallyLabels[node]));
+ List<int> enclosingFinallyLabels = [
+ // At the bottom of the stack is the return label.
+ exitLabel!,
+ for (final node in jumpTargets)
+ if (finallyLabels[node] != null) finallyLabels[node]!
+ ];
+
addStatement(js.js.statement("# = #;", [
nextWhenCanceled,
js.ArrayInitializer(enclosingFinallyLabels.map(js.number).toList())
@@ -2245,8 +2264,8 @@
List<js.Parameter> typeParameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations,
- SourceInformation functionSourceInformation,
- SourceInformation bodySourceInformation) {
+ js.JavaScriptNodeSourceInformation? functionSourceInformation,
+ js.JavaScriptNodeSourceInformation? bodySourceInformation) {
js.Expression updateNext = js.js("#next = #nextWhenCanceled", {
"next": next,
"nextWhenCanceled": nextWhenCanceled,
@@ -2308,7 +2327,7 @@
"switchCase": switchCase,
"ifError": ifError,
}).withSourceInformation(bodySourceInformation);
- js.Fun innerFunction = js.js("""
+ js.Expression innerFunction = js.js("""
function (#errorCode, #result) {
#ifHasYield;
#rewrittenBody;
@@ -2332,8 +2351,9 @@
"streamOfController": streamOfController,
"controller": controllerName,
}).withSourceInformation(bodySourceInformation);
- js.Return returnStreamOfControllerCall = js.Return(streamOfControllerCall)
- .withSourceInformation(bodySourceInformation);
+ js.Statement returnStreamOfControllerCall =
+ js.Return(streamOfControllerCall)
+ .withSourceInformation(bodySourceInformation);
return js.js("""
function (#parameters, #typeParameters) {
#declareBodyName;
@@ -2345,11 +2365,11 @@
"declareBodyName": declareBodyName,
"variableDeclarations": variableDeclarations,
"returnStreamOfControllerCall": returnStreamOfControllerCall,
- }).withSourceInformation(functionSourceInformation);
+ }).withSourceInformation(functionSourceInformation) as js.Fun;
}
@override
- void addErrorExit(SourceInformation sourceInformation) {
+ void addErrorExit(js.JavaScriptNodeSourceInformation? sourceInformation) {
hasHandlerLabels = true;
beginLabel(rethrowLabel);
js.Expression asyncHelperCall =
@@ -2366,8 +2386,8 @@
/// Returning from an async* function calls the [streamHelper] with an
/// [endOfIteration] marker.
@override
- void addSuccessExit(SourceInformation sourceInformation) {
- beginLabel(exitLabel);
+ void addSuccessExit(js.JavaScriptNodeSourceInformation? sourceInformation) {
+ beginLabel(exitLabel!);
js.Expression streamHelperCall =
js.js("#streamHelper(null, #successCode, #controller)", {
@@ -2381,7 +2401,7 @@
@override
Iterable<js.VariableInitialization> variableInitializations(
- SourceInformation sourceInformation) {
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
List<js.VariableInitialization> variables = [];
variables.add(_makeVariableInitializer(
controller,
@@ -2407,8 +2427,8 @@
}
@override
- js.Statement awaitStatement(
- js.Expression value, SourceInformation sourceInformation) {
+ js.Statement awaitStatement(js.Expression value,
+ js.JavaScriptNodeSourceInformation? sourceInformation) {
js.Expression asyncHelperCall =
js.js("#asyncHelper(#value, #bodyName, #controller)", {
"asyncHelper": asyncStarHelper,
@@ -2443,12 +2463,12 @@
bool hasFinally = false;
// The function currently being analyzed.
- js.Fun currentFunction;
+ late final js.Fun currentFunction;
// For error messages.
- final Function unsupported;
+ final Never Function(js.Node) unsupported;
- PreTranslationAnalysis(void this.unsupported(js.Node node));
+ PreTranslationAnalysis(this.unsupported);
bool visit(js.Node node) {
bool containsAwait = node.accept(this);
@@ -2573,14 +2593,13 @@
if (node.targetLabel != null) {
js.LabeledStatement targetLabel = labelledStatements.lastWhere(
(js.LabeledStatement stm) => stm.label == node.targetLabel);
- js.Loop targetStatement = targetLabel.body;
- targets[node] = targetStatement;
+ targets[node] = targetLabel.body;
} else {
targets[node] =
loopsAndSwitches.lastWhere((js.Node node) => node is! js.Switch);
}
assert(() {
- js.Node target = targets[node];
+ js.Node? target = targets[node];
return target is js.Loop ||
(target is js.LabeledStatement && target.body is js.Loop);
}());
@@ -2613,9 +2632,9 @@
@override
bool visitFor(js.For node) {
- bool init = (node.init == null) ? false : visit(node.init);
- bool condition = (node.condition == null) ? false : visit(node.condition);
- bool update = (node.update == null) ? false : visit(node.update);
+ bool init = (node.init == null) ? false : visit(node.init!);
+ bool condition = (node.condition == null) ? false : visit(node.condition!);
+ bool update = (node.update == null) ? false : visit(node.update!);
loopsAndSwitches.add(node);
bool body = visit(node.body);
loopsAndSwitches.removeLast();
@@ -2661,32 +2680,32 @@
@override
bool visitInterpolatedExpression(js.InterpolatedExpression node) {
- return unsupported(node);
+ unsupported(node);
}
@override
bool visitInterpolatedDeclaration(js.InterpolatedDeclaration node) {
- return unsupported(node);
+ unsupported(node);
}
@override
bool visitInterpolatedLiteral(js.InterpolatedLiteral node) {
- return unsupported(node);
+ unsupported(node);
}
@override
bool visitInterpolatedParameter(js.InterpolatedParameter node) {
- return unsupported(node);
+ unsupported(node);
}
@override
bool visitInterpolatedSelector(js.InterpolatedSelector node) {
- return unsupported(node);
+ unsupported(node);
}
@override
bool visitInterpolatedStatement(js.InterpolatedStatement node) {
- return unsupported(node);
+ unsupported(node);
}
@override
@@ -2705,7 +2724,7 @@
@override
bool visitDeferredStatement(js.DeferredStatement node) {
- return unsupported(node);
+ unsupported(node);
}
@override
@@ -2725,7 +2744,7 @@
@override
bool visitLiteralExpression(js.LiteralExpression node) {
- return unsupported(node);
+ unsupported(node);
}
@override
@@ -2740,7 +2759,7 @@
@override
bool visitLiteralStatement(js.LiteralStatement node) {
- return unsupported(node);
+ unsupported(node);
}
@override
@@ -2823,7 +2842,7 @@
hasExplicitReturns = true;
targets[node] = currentFunction;
if (node.value == null) return false;
- return visit(node.value);
+ return visit(node.value!);
}
@override
@@ -2854,9 +2873,9 @@
bool visitTry(js.Try node) {
if (node.finallyPart != null) hasFinally = true;
bool body = visit(node.body);
- bool catchPart = (node.catchPart == null) ? false : visit(node.catchPart);
+ bool catchPart = (node.catchPart == null) ? false : visit(node.catchPart!);
bool finallyPart =
- (node.finallyPart == null) ? false : visit(node.finallyPart);
+ (node.finallyPart == null) ? false : visit(node.finallyPart!);
return body || catchPart || finallyPart;
}
@@ -2878,7 +2897,7 @@
@override
bool visitVariableInitialization(js.VariableInitialization node) {
bool leftHandSide = visit(node.declaration);
- bool value = (node.value == null) ? false : visit(node.value);
+ bool value = (node.value == null) ? false : visit(node.value!);
return leftHandSide || value;
}
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart b/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart
index 260e94b..6c462aa 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart
@@ -2,8 +2,6 @@
// 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.10
-
library js_backend.runtime_types_codegen;
import '../elements/entities.dart';
@@ -47,7 +45,7 @@
class ClassChecks {
final Map<ClassEntity, TypeCheck> _map;
- final ClassFunctionType functionType;
+ final ClassFunctionType? functionType;
ClassChecks(this.functionType) : _map = {};
@@ -63,7 +61,7 @@
checks.forEach(add);
}
- TypeCheck operator [](ClassEntity cls) => _map[cls];
+ TypeCheck? operator [](ClassEntity cls) => _map[cls];
Iterable<TypeCheck> get checks => _map.values;
@@ -94,7 +92,7 @@
final bool isFunction;
final List<DartType> arguments;
final List<DartType> parameters;
- final int length;
+ final int? length;
const Substitution.trivial()
: isTrivial = true,
diff --git a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
index 3103cb2..e6ad47a 100644
--- a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
+++ b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
@@ -182,8 +182,7 @@
DeferredGlobalConstantValue a, DeferredGlobalConstantValue b) {
int r = compareValues(a.referenced, b.referenced);
if (r != 0) return r;
- // TODO(48820): Should unit be non-nullable?
- return a.unit!.compareTo(b.unit!);
+ return a.unit.compareTo(b.unit);
}
@override
diff --git a/pkg/compiler/lib/src/js_model/type_recipe.dart b/pkg/compiler/lib/src/js_model/type_recipe.dart
index f503312..5a31add 100644
--- a/pkg/compiler/lib/src/js_model/type_recipe.dart
+++ b/pkg/compiler/lib/src/js_model/type_recipe.dart
@@ -2,8 +2,6 @@
// 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.10
-
library dart2js.js_model.type_recipe;
import '../elements/entities.dart' show ClassEntity;
@@ -39,7 +37,7 @@
/// having structure [environmentStructure].
///
/// May return `null` if the evaluation is too complex.
- TypeRecipe foldLoadEval(TypeRecipe environmentRecipe,
+ TypeRecipe? foldLoadEval(TypeRecipe environmentRecipe,
TypeEnvironmentStructure environmentStructure, TypeRecipe recipe);
/// Partial constant folding of a type expression when the environment is
@@ -53,7 +51,7 @@
/// evaluates against that structure to produce the same result.
///
/// [bindArgument] must be a ground term, i.e. have no type variables.
- TypeRecipeAndEnvironmentStructure foldBindLoadEval(
+ TypeRecipeAndEnvironmentStructure? foldBindLoadEval(
TypeRecipe bindArgument,
TypeEnvironmentStructure environmentStructure,
TypeRecipe recipe,
@@ -63,7 +61,7 @@
/// evaluated against [environmentStructure1]. ([recipe1] produces an
/// intermediate type or environment value that conforms to the layout
/// described by [environmentStructure2].)
- TypeRecipeAndEnvironmentStructure foldEvalEval(
+ TypeRecipeAndEnvironmentStructure? foldEvalEval(
TypeEnvironmentStructure environmentStructure1,
TypeRecipe recipe1,
TypeEnvironmentStructure environmentStructure2,
@@ -95,7 +93,8 @@
}
return false;
}
- return _sameFullStructure(a, b);
+ return _sameFullStructure(
+ a as FullTypeEnvironmentStructure, b as FullTypeEnvironmentStructure);
}
static bool _sameFullStructure(
@@ -124,7 +123,7 @@
/// A type environment containing an interface type and/or a tuple of function
/// type parameters.
class FullTypeEnvironmentStructure extends TypeEnvironmentStructure {
- final InterfaceType classType;
+ final InterfaceType? classType;
final List<TypeVariableType> bindings;
FullTypeEnvironmentStructure({this.classType, this.bindings = const []});
@@ -140,12 +139,10 @@
/// data stream.
static const String tag = 'type-recipe';
- int /*?*/ _hashCode;
-
TypeRecipe();
@override
- int get hashCode => _hashCode ??= _computeHashCode();
+ late final hashCode = _computeHashCode();
int _computeHashCode();
@@ -273,7 +270,7 @@
/// environments outside a class scope or a class scope where no supertype is
/// generic, or where optimization has determined that no use of the
/// environment requires any of the class type variables.
- final InterfaceType classType;
+ final InterfaceType? classType;
// Type expressions for the tuple of function type arguments.
final List<DartType> types;
@@ -282,8 +279,7 @@
static FullTypeEnvironmentRecipe _readFromDataSource(
DataSourceReader source) {
- InterfaceType /*?*/ classType =
- source.readDartTypeOrNull() as InterfaceType /*?*/;
+ final classType = source.readDartTypeOrNull() as InterfaceType?;
List<DartType> types = source.readDartTypes();
return FullTypeEnvironmentRecipe(classType: classType, types: types);
}
@@ -341,7 +337,7 @@
TypeEnvironmentStructure environmentStructure, TypeRecipe recipe) {
if (environmentStructure is FullTypeEnvironmentStructure &&
environmentStructure.bindings.isEmpty) {
- InterfaceType classType = environmentStructure.classType;
+ InterfaceType classType = environmentStructure.classType!;
if (classType.element == classEntity) {
if (recipe is TypeExpressionRecipe && recipe.type == classType) {
return true;
@@ -352,7 +348,7 @@
}
@override
- TypeRecipe foldLoadEval(TypeRecipe environmentRecipe,
+ TypeRecipe? foldLoadEval(TypeRecipe environmentRecipe,
TypeEnvironmentStructure environmentStructure, TypeRecipe recipe) {
if (environmentStructure is SingletonTypeEnvironmentStructure) {
if (environmentRecipe is TypeExpressionRecipe) {
@@ -371,7 +367,7 @@
if (environmentRecipe is TypeExpressionRecipe) {
assert(environmentStructure.bindings.isEmpty);
return _Substitution(_dartTypes, environmentStructure.classType,
- environmentRecipe.type, null, null)
+ environmentRecipe.type as InterfaceType, null, null)
.substituteRecipe(recipe);
}
return null;
@@ -398,14 +394,14 @@
}
@override
- TypeRecipeAndEnvironmentStructure foldBindLoadEval(TypeRecipe bindArgument,
+ TypeRecipeAndEnvironmentStructure? foldBindLoadEval(TypeRecipe bindArgument,
TypeEnvironmentStructure environmentStructure, TypeRecipe recipe) {
// 'Bind' adds variables to the environment. We fold 'bind' of a ground type
// by removing the added variables and replacing them in the recipe with the
// constant type values.
if (environmentStructure is FullTypeEnvironmentStructure) {
- List<DartType> replacements;
+ late final List<DartType> replacements;
if (bindArgument is TypeExpressionRecipe) {
// Bind call adds a single binding.
replacements = [bindArgument.type];
@@ -419,7 +415,7 @@
int index = bindings.length - replacements.length;
List<TypeVariableType> replacedVariables = bindings.sublist(index);
List<TypeVariableType> remainingVariables = bindings.sublist(0, index);
- TypeRecipe newRecipe =
+ TypeRecipe? newRecipe =
_Substitution(_dartTypes, null, null, replacedVariables, replacements)
.substituteRecipe(recipe);
if (newRecipe == null) return null;
@@ -437,14 +433,14 @@
}
@override
- TypeRecipeAndEnvironmentStructure foldEvalEval(
+ TypeRecipeAndEnvironmentStructure? foldEvalEval(
TypeEnvironmentStructure environmentStructure1,
TypeRecipe recipe1,
TypeEnvironmentStructure environmentStructure2,
TypeRecipe recipe2) {
if (environmentStructure2 is SingletonTypeEnvironmentStructure &&
recipe1 is TypeExpressionRecipe) {
- TypeRecipe newRecipe = _Substitution(
+ TypeRecipe? newRecipe = _Substitution(
_dartTypes,
null,
null,
@@ -458,8 +454,12 @@
if (environmentStructure2 is FullTypeEnvironmentStructure &&
recipe1 is TypeExpressionRecipe) {
assert(environmentStructure2.bindings.isEmpty);
- TypeRecipe newRecipe = _Substitution(_dartTypes,
- environmentStructure2.classType, recipe1.type, null, null)
+ TypeRecipe? newRecipe = _Substitution(
+ _dartTypes,
+ environmentStructure2.classType,
+ recipe1.type as InterfaceType,
+ null,
+ null)
.substituteRecipe(recipe2);
if (newRecipe == null) return null;
return TypeRecipeAndEnvironmentStructure(
@@ -468,7 +468,7 @@
if (environmentStructure2 is FullTypeEnvironmentStructure &&
recipe1 is FullTypeEnvironmentRecipe) {
- TypeRecipe newRecipe = _Substitution(
+ TypeRecipe? newRecipe = _Substitution(
_dartTypes,
environmentStructure2.classType,
recipe1.classType,
@@ -497,28 +497,29 @@
class _Substitution extends DartTypeSubstitutionVisitor<Null> {
@override
final DartTypes dartTypes;
- final Map<DartType, DartType> _lookupCache = {};
+ final Map<DartType, DartType?> _lookupCache = {};
final Map<DartType, int> _counts = {};
bool _failed = false;
- final InterfaceType _classEnvironment;
- final InterfaceType _classValue;
- final List<TypeVariableType> _variables;
- final List<DartType> _replacements;
+ final InterfaceType? _classEnvironment;
+ final InterfaceType? _classValue;
+ final List<TypeVariableType>? _variables;
+ final List<DartType>? _replacements;
_Substitution(this.dartTypes, this._classEnvironment, this._classValue,
this._variables, this._replacements)
: assert(_variables?.length == _replacements?.length);
// Returns `null` if declined.
- TypeRecipe substituteRecipe(TypeRecipe recipe) {
+ TypeRecipe? substituteRecipe(TypeRecipe recipe) {
if (recipe is TypeExpressionRecipe) {
DartType result = _substituteType(recipe.type);
if (_failed) return null;
return TypeExpressionRecipe(result);
}
if (recipe is FullTypeEnvironmentRecipe) {
- DartType newClass = _substitutePossiblyNullType(recipe.classType);
+ final newClass =
+ _substitutePossiblyNullType(recipe.classType) as InterfaceType?;
List<DartType> newTypes = recipe.types.map(_substituteType).toList();
if (_failed) return null;
return FullTypeEnvironmentRecipe(classType: newClass, types: newTypes);
@@ -530,20 +531,20 @@
DartType _substituteType(DartType type) => visit(type, null);
- DartType _substitutePossiblyNullType(DartType type) =>
+ DartType? _substitutePossiblyNullType(DartType? type) =>
type == null ? null : visit(type, null);
// Returns `null` if not bound.
- DartType _lookupTypeVariableType(TypeVariableType type) {
+ DartType? _lookupTypeVariableType(TypeVariableType type) {
if (_variables != null) {
- int index = _variables.indexOf(type);
- if (index >= 0) return _replacements[index];
+ int index = _variables!.indexOf(type);
+ if (index >= 0) return _replacements![index];
}
if (_classEnvironment == null) return null;
- if (_classEnvironment.element == _classValue.element) {
- int index = _classEnvironment.typeArguments.indexOf(type);
- if (index >= 0) return _classValue.typeArguments[index];
+ if (_classEnvironment!.element == _classValue?.element) {
+ int index = _classEnvironment!.typeArguments.indexOf(type);
+ if (index >= 0) return _classValue!.typeArguments[index];
return null;
}
// TODO(sra): Lookup type variable of supertype (e.g. ListMixin.E of
@@ -555,7 +556,7 @@
@override
DartType substituteTypeVariableType(
TypeVariableType variable, Null argument, bool freshReference) {
- DartType replacement =
+ DartType? replacement =
_lookupCache[variable] ??= _lookupTypeVariableType(variable);
if (replacement == null) return variable; // not substituted.
if (!freshReference) return replacement;
diff --git a/pkg/compiler/lib/src/kernel/front_end_adapter.dart b/pkg/compiler/lib/src/kernel/front_end_adapter.dart
index e86e6d3..26742da 100644
--- a/pkg/compiler/lib/src/kernel/front_end_adapter.dart
+++ b/pkg/compiler/lib/src/kernel/front_end_adapter.dart
@@ -2,8 +2,6 @@
// 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.10
-
/// Helper classes and methods to adapt between `package:compiler` and
/// `package:front_end` APIs.
library compiler.kernel.front_end_adapter;
@@ -49,7 +47,6 @@
} catch (e) {
throw fe.FileSystemException(uri, '$e');
}
- if (input == null) throw fe.FileSystemException(uri, "File not found");
// TODO(sigmund): technically someone could provide dart2js with an input
// that is not a SourceFile. Note that this assumption is also done in the
// (non-kernel) ScriptLoader.
@@ -66,7 +63,6 @@
} catch (e) {
throw fe.FileSystemException(uri, '$e');
}
- if (input == null) throw fe.FileSystemException(uri, "File not found");
return input.data;
}
@@ -76,9 +72,8 @@
@override
Future<bool> exists() async {
try {
- api.Input input = await fs.inputProvider
- .readFromUri(uri, inputKind: api.InputKind.binary);
- return input != null;
+ await fs.inputProvider.readFromUri(uri, inputKind: api.InputKind.binary);
+ return true;
} catch (e) {
return false;
}
@@ -93,9 +88,9 @@
void reportFrontEndMessage(
DiagnosticReporter reporter, fe.DiagnosticMessage message) {
Spannable _getSpannable(fe.DiagnosticMessage message) {
- Uri uri = fe.getMessageUri(message);
- int offset = fe.getMessageCharOffset(message);
- int length = fe.getMessageLength(message);
+ Uri? uri = fe.getMessageUri(message);
+ int offset = fe.getMessageCharOffset(message)!;
+ int length = fe.getMessageLength(message)!;
if (uri != null && offset != -1) {
return SourceSpan(uri, offset, offset + length);
} else {
@@ -105,11 +100,12 @@
DiagnosticMessage _convertMessage(fe.DiagnosticMessage message) {
Spannable span = _getSpannable(message);
- String text = fe.getMessageHeaderText(message);
- return reporter.createMessage(span, MessageKind.GENERIC, {'text': text});
+ String? text = fe.getMessageHeaderText(message);
+ return reporter
+ .createMessage(span, MessageKind.GENERIC, {'text': text ?? ''});
}
- List<fe.DiagnosticMessage> relatedInformation =
+ Iterable<fe.DiagnosticMessage>? relatedInformation =
fe.getMessageRelatedInformation(message);
DiagnosticMessage mainMessage = _convertMessage(message);
List<DiagnosticMessage> infos = relatedInformation != null
diff --git a/pkg/compiler/lib/src/kernel/kelements.dart b/pkg/compiler/lib/src/kernel/kelements.dart
index 1731db7..b2a7409 100644
--- a/pkg/compiler/lib/src/kernel/kelements.dart
+++ b/pkg/compiler/lib/src/kernel/kelements.dart
@@ -2,8 +2,6 @@
// 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.10
-
/// Entity model for elements derived from Kernel IR.
import 'package:kernel/ast.dart' as ir;
@@ -35,9 +33,9 @@
@override
final String name;
@override
- final bool /*!*/ isAbstract;
+ final bool isAbstract;
- KClass(this.library, this.name, {/*required*/ this.isAbstract});
+ KClass(this.library, this.name, {required this.isAbstract});
@override
bool get isClosure => false;
@@ -50,7 +48,7 @@
@override
final KLibrary library;
@override
- final KClass enclosingClass;
+ final KClass? enclosingClass;
final Name _name;
final bool _isStatic;
@@ -101,7 +99,7 @@
@override
String toString() => '${kElementPrefix}$_kind'
- '(${enclosingClass != null ? '${enclosingClass.name}.' : ''}$name)';
+ '(${enclosingClass != null ? '${enclosingClass!.name}.' : ''}$name)';
}
abstract class KFunction extends KMember
@@ -123,10 +121,12 @@
implements ConstructorEntity, IndexedConstructor {
@override
final bool isConst;
+ @override
+ KClass enclosingClass;
KConstructor(
- KClass enclosingClass, Name name, ParameterStructure parameterStructure,
- {bool isExternal, this.isConst})
+ this.enclosingClass, Name name, ParameterStructure parameterStructure,
+ {required bool isExternal, required this.isConst})
: super(enclosingClass.library, enclosingClass, name, parameterStructure,
AsyncMarker.SYNC,
isExternal: isExternal);
@@ -153,7 +153,7 @@
class KGenerativeConstructor extends KConstructor {
KGenerativeConstructor(
KClass enclosingClass, Name name, ParameterStructure parameterStructure,
- {bool isExternal, bool isConst})
+ {required bool isExternal, required bool isConst})
: super(enclosingClass, name, parameterStructure,
isExternal: isExternal, isConst: isConst);
@@ -166,11 +166,13 @@
class KFactoryConstructor extends KConstructor {
@override
- final bool /*!*/ isFromEnvironmentConstructor;
+ final bool isFromEnvironmentConstructor;
KFactoryConstructor(
KClass enclosingClass, Name name, ParameterStructure parameterStructure,
- {bool isExternal, bool isConst, this.isFromEnvironmentConstructor})
+ {required bool isExternal,
+ required bool isConst,
+ required this.isFromEnvironmentConstructor})
: super(enclosingClass, name, parameterStructure,
isExternal: isExternal, isConst: isConst);
@@ -187,9 +189,9 @@
KMethod(KLibrary library, KClass enclosingClass, Name name,
ParameterStructure parameterStructure, AsyncMarker asyncMarker,
- {/*required*/ bool isStatic,
- /*required*/ bool isExternal,
- /*required*/ this.isAbstract})
+ {required bool isStatic,
+ required bool isExternal,
+ required this.isAbstract})
: super(library, enclosingClass, name, parameterStructure, asyncMarker,
isStatic: isStatic, isExternal: isExternal);
@@ -206,9 +208,9 @@
KGetter(KLibrary library, KClass enclosingClass, Name name,
AsyncMarker asyncMarker,
- {/*required*/ bool isStatic,
- /*required*/ bool isExternal,
- /*required*/ this.isAbstract})
+ {required bool isStatic,
+ required bool isExternal,
+ required this.isAbstract})
: super(library, enclosingClass, name, ParameterStructure.getter,
asyncMarker,
isStatic: isStatic, isExternal: isExternal);
@@ -225,9 +227,9 @@
final bool isAbstract;
KSetter(KLibrary library, KClass enclosingClass, Name name,
- {/*required*/ bool isStatic,
- /*required*/ bool isExternal,
- /*required*/ this.isAbstract})
+ {required bool isStatic,
+ required bool isExternal,
+ required this.isAbstract})
: super(library, enclosingClass, name, ParameterStructure.setter,
AsyncMarker.SYNC,
isStatic: isStatic, isExternal: isExternal);
@@ -249,9 +251,9 @@
final bool isConst;
KField(KLibrary library, KClass enclosingClass, Name name,
- {/*required*/ bool isStatic,
- /*required*/ this.isAssignable,
- /*required*/ this.isConst})
+ {required bool isStatic,
+ required this.isAssignable,
+ required this.isConst})
: super(library, enclosingClass, name, isStatic: isStatic);
@override
@@ -278,11 +280,11 @@
class KLocalFunction implements Local {
@override
- final String name;
+ final String? name;
final MemberEntity memberContext;
final Entity executableContext;
final ir.LocalFunction node;
- /*late final*/ FunctionType functionType;
+ late final FunctionType functionType;
KLocalFunction(
this.name, this.memberContext, this.executableContext, this.node);
@@ -299,8 +301,8 @@
final String name;
@override
final int index;
- /*late final*/ DartType bound;
- /*late final*/ DartType defaultType;
+ late final DartType bound;
+ late final DartType defaultType;
KLocalTypeVariable(this.typeDeclaration, this.name, this.index);
diff --git a/pkg/compiler/lib/src/ordered_typeset.dart b/pkg/compiler/lib/src/ordered_typeset.dart
index 62b0eef..d8e8b07 100644
--- a/pkg/compiler/lib/src/ordered_typeset.dart
+++ b/pkg/compiler/lib/src/ordered_typeset.dart
@@ -2,8 +2,6 @@
// 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.10
-
library ordered_typeset;
import 'package:front_end/src/api_unstable/dart2js.dart'
@@ -35,9 +33,9 @@
static const String tag = 'ordered-type-set';
final List<Link<InterfaceType>> _levels;
- final Link<InterfaceType> types;
+ final LinkEntry<InterfaceType> types;
- OrderedTypeSet.internal(this._levels, this.types);
+ OrderedTypeSet._(this._levels, this.types);
/// Deserializes a [OrderedTypeSet] object from [source].
factory OrderedTypeSet.readFromDataSource(DataSourceReader source) {
@@ -48,20 +46,19 @@
LinkBuilder<InterfaceType> typeLinkBuilder = LinkBuilder<InterfaceType>();
List<Link<InterfaceType>> links = [];
for (int i = 0; i < typesCount; i++) {
- links.add(typeLinkBuilder.addLast(source.readDartType()));
+ links
+ .add(typeLinkBuilder.addLast(source.readDartType() as InterfaceType));
}
- Link<InterfaceType> types =
- typeLinkBuilder.toLink(const Link<InterfaceType>());
+ final types = typeLinkBuilder.toLink(const Link<InterfaceType>())
+ as LinkEntry<InterfaceType>;
links.add(const Link<InterfaceType>());
int levelCount = source.readInt();
- List<Link<InterfaceType>> levels =
- List<Link<InterfaceType>>.filled(levelCount, null);
- for (int i = 0; i < levelCount; i++) {
- levels[i] = links[source.readInt()];
- }
+ List<Link<InterfaceType>> levels = List<Link<InterfaceType>>.generate(
+ levelCount, (index) => links[source.readInt()],
+ growable: false);
source.end(tag);
- return OrderedTypeSet.internal(levels, types);
+ return OrderedTypeSet._(levels, types);
}
/// Serializes this [OrderedTypeSet] to [sink].
@@ -73,7 +70,7 @@
sink.writeDartType(type);
}
List<int> levelList = [];
- Link<InterfaceType> link = types;
+ Link<InterfaceType>? link = types;
while (link != null) {
int index = _levels.indexOf(link);
if (index != -1) {
@@ -89,11 +86,9 @@
}
factory OrderedTypeSet.singleton(InterfaceType type) {
- Link<InterfaceType> types =
- LinkEntry<InterfaceType>(type, const Link<InterfaceType>());
- List<Link<InterfaceType>> list = List<Link<InterfaceType>>.filled(1, null);
- list[0] = types;
- return OrderedTypeSet.internal(list, types);
+ final types = LinkEntry<InterfaceType>(type, const Link<InterfaceType>());
+ List<Link<InterfaceType>> list = List<Link<InterfaceType>>.filled(1, types);
+ return OrderedTypeSet._(list, types);
}
/// Creates a new [OrderedTypeSet] for [type] when it directly extends the
@@ -106,17 +101,13 @@
type.element,
'Cannot extend generic class ${types.head} using '
'OrderedTypeSet.extendClass'));
- Link<InterfaceType> extendedTypes = LinkEntry<InterfaceType>(type, types);
+ final extendedTypes = LinkEntry<InterfaceType>(type, types);
List<Link<InterfaceType>> list =
- List<Link<InterfaceType>>.filled(levels + 1, null);
- for (int i = 0; i < levels; i++) {
- list[i] = _levels[i];
- }
- list[levels] = extendedTypes;
- return OrderedTypeSet.internal(list, extendedTypes);
+ _levels.followedBy([extendedTypes]).toList(growable: false);
+ return OrderedTypeSet._(list, extendedTypes);
}
- Link<InterfaceType> get supertypes => types.tail;
+ Link<InterfaceType>? get supertypes => types.tail;
int get levels => _levels.length;
@@ -136,7 +127,7 @@
Link<InterfaceType> pointer = types;
for (int depth = maxDepth; depth >= 0; depth--) {
while (!identical(pointer, _levels[depth])) {
- pointer = pointer.tail;
+ pointer = pointer.tail!;
offset++;
}
offsets[depth] = offset;
@@ -153,12 +144,12 @@
// constants are properly canonicalized
while (pointer.isNotEmpty && !identical(pointer, end)) {
f(pointer.head);
- pointer = pointer.tail;
+ pointer = pointer.tail!;
}
}
}
- InterfaceType asInstanceOf(ClassEntity cls, int hierarchyDepth) {
+ InterfaceType? asInstanceOf(ClassEntity cls, int hierarchyDepth) {
int level = hierarchyDepth;
if (level < levels) {
Link<InterfaceType> pointer = _levels[level];
@@ -170,7 +161,7 @@
if (cls == pointer.head.element) {
return pointer.head;
}
- pointer = pointer.tail;
+ pointer = pointer.tail!;
}
}
return null;
@@ -231,20 +222,19 @@
}
void _addAtDepth(InterfaceType type, int depth) {
- LinkEntry<InterfaceType> prev = null;
- LinkEntry<InterfaceType> link = map[depth];
- while (link != null) {
+ LinkEntry<InterfaceType>? prev;
+ Link<InterfaceType>? link = map[depth];
+ while (link != null && link is LinkEntry) {
InterfaceType existingType = link.head;
if (existingType == type) return;
if (existingType.element == type.element) {
assert(false, failedAt(cls, 'Invalid ordered typeset for $cls'));
return;
}
- prev = link;
+ prev = link as LinkEntry<InterfaceType>;
link = link.tail;
}
LinkEntry<InterfaceType> next = LinkEntry<InterfaceType>(type);
- next.tail = null;
if (prev == null) {
map[depth] = next;
} else {
@@ -256,27 +246,26 @@
}
OrderedTypeSet toTypeSet() {
- List<Link<InterfaceType>> levels =
- List<Link<InterfaceType>>.filled(maxDepth + 1, null);
- if (maxDepth < 0) {
- return OrderedTypeSet.internal(levels, const Link<InterfaceType>());
- }
+ assert(maxDepth >= 0);
Link<InterfaceType> next = const Link<InterfaceType>();
- for (int depth = 0; depth <= maxDepth; depth++) {
- LinkEntry<InterfaceType> first = map[depth];
+
+ List<Link<InterfaceType>> levels =
+ List<Link<InterfaceType>>.generate(maxDepth + 1, (depth) {
+ LinkEntry<InterfaceType>? first = map[depth];
if (first == null) {
- levels[depth] = next;
+ return next;
} else {
- levels[depth] = first;
+ final value = first;
LinkEntry<InterfaceType> last = first;
- while (last.tail != null) {
- last = last.tail;
+ while (last.tail != const Link<Never>()) {
+ last = last.tail as LinkEntry<InterfaceType>;
}
last.tail = next;
next = first;
+ return value;
}
- }
- return OrderedTypeSet.internal(levels, levels.last);
+ });
+ return OrderedTypeSet._(levels, levels.last as LinkEntry<InterfaceType>);
}
@override
@@ -284,7 +273,7 @@
StringBuffer sb = StringBuffer();
for (int depth = 0; depth <= maxDepth; depth++) {
sb.write('$depth: ');
- LinkEntry<InterfaceType> first = map[depth];
+ LinkEntry<InterfaceType> first = map[depth]!;
first.printOn(sb, ", ");
sb.write('\n');
}
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index dda60e0..03d96d5 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -599,7 +599,7 @@
field, parameter, type);
// TODO(sra): Pass source information to
// [potentiallyCheckOrTrustTypeOfParameter].
- // TODO(sra): The source information should indiciate the field and
+ // TODO(sra): The source information should indicate the field and
// possibly its type but not the initializer.
value.sourceInformation ??= _sourceInformationBuilder.buildSet(node);
value = _potentiallyAssertNotNull(field, node, value, type);
@@ -1812,7 +1812,7 @@
_handleInTryStatement();
if (_inliningStack.isEmpty && targetElement.isSetter) {
if (node.parent is ir.FunctionNode) {
- // An arrow function definition of a setter has a ReturnStatemnt as a
+ // An arrow function definition of a setter has a ReturnStatement as a
// body, e.g. "set foo(x) => this._x = x;". There is no way to access
// the returned value, so don't emit a return.
return;
@@ -1964,7 +1964,7 @@
// moved to the loop update.
// Find a type for the element. Use the element type of the indexer of the
- // array, as this is stronger than the iterator's `get current` type, for
+ // array, as this is stronger than the Iterator's `get current` type, for
// example, `get current` includes null.
// TODO(sra): The element type of a container type mask might be better.
AbstractValue type = _typeInferenceMap.inferredIndexType(node);
@@ -3021,7 +3021,7 @@
localsHandler = savedLocals.mergeMultiple(caseHandlers, joinBlock);
}
} else {
- // The joinblock is not used.
+ // The joinBlock is not used.
joinBlock = null;
}
@@ -4313,7 +4313,7 @@
} else {
reporter.internalError(
computeSourceSpanFromTreeNode(invocation),
- "Unexpected named arguments value in createInvocationMirrror: "
+ "Unexpected named arguments value in createInvocationMirror: "
"${namedArgumentsLiteral}.");
}
CallStructure callStructure = CallStructure(
@@ -5669,10 +5669,6 @@
void _pushIsTest(ir.DartType type, HInstruction expression,
SourceInformation sourceInformation) {
- // Note: The call to "unalias" this type like in the original SSA builder is
- // unnecessary in kernel because Kernel has no notion of typedef.
- // TODO(efortuna): Add test for this.
-
if (type is ir.InvalidType) {
// TODO(sra): Make InvalidType carry a message.
_generateTypeError('invalid type', sourceInformation);
@@ -7638,7 +7634,7 @@
// In addition to the initializer expressions and body calls, there is an
// allocator call.
if (hasCallToSomeConstructorBody) {
- // A temporary is requried so we have
+ // A temporary is required so we have
//
// t=new ...;
// ...;
@@ -7646,7 +7642,7 @@
//
// I'm guessing it takes about 4 nodes to introduce the temporary and
// assign it.
- registerRegularNode(4); // A temporary is requried.
+ registerRegularNode(4); // A temporary is required.
}
// The initial field values are passed to the allocator.
registerRegularNode(
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 442efaf..10bb620 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -1887,7 +1887,7 @@
List<js.Expression> arguments = visitArguments(node.inputs);
MemberEntity target = node.element;
- // TODO(herhut): The namer should return the appropriate backendname here.
+ // TODO(herhut): The namer should return the appropriate backend name here.
if (target != null && !node.isInterceptedCall) {
if (target == _commonElements.jsArrayAdd) {
methodName = 'push';
@@ -2120,7 +2120,7 @@
if (_commonElements.isCheckConcurrentModificationError(element)) {
// Manually inline the [checkConcurrentModificationError] function. This
// function is only called from a for-loop update. Ideally we would just
- // generate the conditionalcontrol flow in the builder but it adds basic
+ // generate the conditional control flow in the builder but it adds basic
// blocks in the loop update that interfere with other optimizations and
// confuses loop recognition.
@@ -2384,16 +2384,16 @@
}
if (target.isStatic || target.isTopLevel) {
var arguments = visitArguments(inputs, start: 0);
- js.Expression targeExpression =
+ js.Expression targetExpression =
js.js.uncachedExpressionTemplate(targetName).instantiate([]);
js.Expression expression;
if (target.isGetter) {
- expression = targeExpression;
+ expression = targetExpression;
} else if (target.isSetter) {
- expression = js.js('# = #', [targeExpression, inputs.single]);
+ expression = js.js('# = #', [targetExpression, inputs.single]);
} else {
assert(target.isFunction);
- expression = js.js('#(#)', [targeExpression, arguments]);
+ expression = js.js('#(#)', [targetExpression, arguments]);
}
push(expression.withSourceInformation(node.sourceInformation));
_registry.registerNativeMethod(target);
@@ -3186,7 +3186,7 @@
case IsTestSpecialization.instanceof:
DartType dartType = node.dartType;
- // We don't generate instancof specializations for Never* and Object*.
+ // We don't generate instanceof specializations for Never* and Object*.
assert(dartType is InterfaceType ||
(dartType is LegacyType &&
!dartType.baseType.isObject &&
diff --git a/pkg/compiler/lib/src/universe/class_set.dart b/pkg/compiler/lib/src/universe/class_set.dart
index a527f69..e5ccc33 100644
--- a/pkg/compiler/lib/src/universe/class_set.dart
+++ b/pkg/compiler/lib/src/universe/class_set.dart
@@ -2,8 +2,6 @@
// 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.10
-
library dart2js.world.class_set;
import 'dart:collection' show IterableBase, MapBase;
@@ -99,14 +97,14 @@
return mask;
}
- final ClassHierarchyNode parentNode;
+ final ClassHierarchyNode? parentNode;
final EnumSet<Instantiation> _mask =
EnumSet.fromValues(const [Instantiation.UNINSTANTIATED]);
final IndexedClass cls;
final int hierarchyDepth;
- ClassEntity _leastUpperInstantiatedSubclass;
+ ClassEntity? _leastUpperInstantiatedSubclass;
int _instantiatedSubclassCount = 0;
/// `true` if [cls] has been directly instantiated.
@@ -152,8 +150,8 @@
isDirectlyInstantiated || isAbstractlyInstantiated;
void _updateParentInstantiatedSubclassCount(Instantiation instantiation,
- {bool add}) {
- ClassHierarchyNode parent = parentNode;
+ {required bool add}) {
+ ClassHierarchyNode? parent = parentNode;
if (add) {
_mask.remove(Instantiation.UNINSTANTIATED);
_mask.add(instantiation);
@@ -209,7 +207,7 @@
ClassHierarchyNode(this.parentNode, this.cls, this.hierarchyDepth) {
if (parentNode != null) {
- parentNode.addDirectSubclass(this);
+ parentNode!.addDirectSubclass(this);
}
}
@@ -217,13 +215,11 @@
factory ClassHierarchyNode.readFromDataSource(
DataSourceReader source, Map<ClassEntity, ClassHierarchyNode> nodeMap) {
source.begin(tag);
- IndexedClass cls = source.readClass();
- ClassHierarchyNode parentNode;
- IndexedClass superclass = source.readClassOrNull();
+ IndexedClass cls = source.readClass() as IndexedClass;
+ ClassHierarchyNode? parentNode;
+ final superclass = source.readClassOrNull() as IndexedClass?;
if (superclass != null) {
- parentNode = nodeMap[superclass];
- assert(parentNode != null,
- "No ClassHierarchyNode for superclass $superclass.");
+ parentNode = nodeMap[superclass]!;
}
int maskValue = source.readInt();
int hierarchyDepth = source.readInt();
@@ -256,7 +252,7 @@
/// Returns `true` if [other] is contained in the subtree of this node.
///
/// This means that [other] is a subclass of [cls].
- bool contains(ClassHierarchyNode other) {
+ bool contains(ClassHierarchyNode? other) {
while (other != null) {
if (cls == other.cls) return true;
if (hierarchyDepth >= other.hierarchyDepth) return false;
@@ -314,9 +310,9 @@
/// continues. The return value of the function is either [ForEach.STOP], if
/// visitation was stopped, or [ForEach.CONTINUE] if visitation continued to
/// the end.
- IterationStep forEachSubclass(ForEachFunction f, EnumSet<Instantiation> mask,
+ IterationStep? forEachSubclass(ForEachFunction f, EnumSet<Instantiation> mask,
{bool strict = false}) {
- IterationStep nextStep;
+ IterationStep? nextStep;
if (!strict && mask.intersects(_mask)) {
nextStep = f(cls);
}
@@ -326,7 +322,7 @@
if (nextStep == IterationStep.CONTINUE) {
if (mask.contains(Instantiation.UNINSTANTIATED) || isInstantiated) {
for (ClassHierarchyNode subclass in _directSubclasses) {
- IterationStep subForEach = subclass.forEachSubclass(f, mask);
+ IterationStep? subForEach = subclass.forEachSubclass(f, mask);
if (subForEach == IterationStep.STOP) {
return subForEach;
}
@@ -342,7 +338,7 @@
/// Returns the most specific subclass of [cls] (including [cls]) that is
/// directly instantiated or a superclass of all directly instantiated
/// subclasses. If [cls] is not instantiated, `null` is returned.
- ClassEntity getLubOfInstantiatedSubclasses() {
+ ClassEntity? getLubOfInstantiatedSubclasses() {
if (!isInstantiated) return null;
if (_leastUpperInstantiatedSubclass == null) {
_leastUpperInstantiatedSubclass =
@@ -351,14 +347,14 @@
return _leastUpperInstantiatedSubclass;
}
- ClassEntity _computeLeastUpperInstantiatedSubclass() {
+ ClassEntity? _computeLeastUpperInstantiatedSubclass() {
if (isExplicitlyInstantiated) {
return cls;
}
if (!isInstantiated) {
return null;
}
- ClassHierarchyNode subclass;
+ ClassHierarchyNode? subclass;
for (ClassHierarchyNode node in _directSubclasses) {
if (node.isInstantiated) {
if (subclass == null) {
@@ -377,7 +373,7 @@
void printOn(StringBuffer sb, String indentation,
{bool instantiatedOnly = false,
bool sorted = true,
- ClassEntity withRespectTo}) {
+ ClassEntity? withRespectTo}) {
bool isRelatedTo(ClassEntity _subclass) {
return true;
// TODO(johnniwinther): Support this for kernel based elements:
@@ -442,7 +438,7 @@
String dump(
{String indentation = '',
bool instantiatedOnly = false,
- ClassEntity withRespectTo}) {
+ ClassEntity? withRespectTo}) {
StringBuffer sb = StringBuffer();
printOn(sb, indentation,
instantiatedOnly: instantiatedOnly, withRespectTo: withRespectTo);
@@ -503,7 +499,7 @@
static const String tag = 'class-set';
final ClassHierarchyNode node;
- ClassEntity _leastUpperInstantiatedSubtype;
+ ClassEntity? _leastUpperInstantiatedSubtype;
/// A list of the class hierarchy nodes for the subtypes that declare a
/// subtype relationship to [cls] either directly or indirectly.
@@ -521,7 +517,7 @@
/// directly. `E` also implements `A` through its extension of `D` and it is
/// therefore included through the class hierarchy node for `D`.
///
- List<ClassHierarchyNode> _subtypes;
+ List<ClassHierarchyNode>? _subtypes;
/// A list of the class hierarchy nodes for the class that directly mix in
/// [cls].
@@ -537,7 +533,7 @@
/// The class hierarchy nodes for the unnamed mixin application `Object+A` and
/// the named mixin application `C` are in [_mixinApplications].
///
- List<ClassHierarchyNode> _mixinApplications;
+ List<ClassHierarchyNode>? _mixinApplications;
ClassSet(this.node);
@@ -545,12 +541,12 @@
factory ClassSet.readFromDataSource(
DataSourceReader source, Map<ClassEntity, ClassHierarchyNode> nodeMap) {
source.begin(tag);
- ClassHierarchyNode node = nodeMap[source.readClass()];
- List<ClassHierarchyNode> subtypes = source.readListOrNull(() {
- return nodeMap[source.readClass()];
+ ClassHierarchyNode node = nodeMap[source.readClass()]!;
+ List<ClassHierarchyNode>? subtypes = source.readListOrNull(() {
+ return nodeMap[source.readClass()]!;
});
- List<ClassHierarchyNode> mixinApplications = source.readListOrNull(() {
- return nodeMap[source.readClass()];
+ List<ClassHierarchyNode>? mixinApplications = source.readListOrNull(() {
+ return nodeMap[source.readClass()]!;
});
source.end(tag);
return ClassSet(node)
@@ -580,7 +576,7 @@
bool hasSubtype(ClassHierarchyNode other) {
if (hasSubclass(other)) return true;
if (_subtypes != null) {
- for (ClassHierarchyNode subtypeNode in _subtypes) {
+ for (ClassHierarchyNode subtypeNode in _subtypes!) {
if (subtypeNode.hasSubclass(other)) return true;
}
}
@@ -591,7 +587,7 @@
int get instantiatedSubtypeCount {
int count = node.instantiatedSubclassCount;
if (_subtypes != null) {
- for (ClassHierarchyNode subtypeNode in _subtypes) {
+ for (ClassHierarchyNode subtypeNode in _subtypes!) {
if (subtypeNode.isExplicitlyInstantiated) {
count++;
}
@@ -605,7 +601,7 @@
/// [cls].
bool get hasOnlyInstantiatedSubclasses {
if (_subtypes != null) {
- for (ClassHierarchyNode subtypeNode in _subtypes) {
+ for (ClassHierarchyNode subtypeNode in _subtypes!) {
if (subtypeNode.isInstantiated) {
return false;
}
@@ -696,7 +692,7 @@
/// continues. The return value of the function is either [ForEach.STOP], if
/// visitation was stopped, or [ForEach.CONTINUE] if visitation continued to
/// the end.
- IterationStep forEachSubclass(ForEachFunction f, EnumSet<Instantiation> mask,
+ IterationStep? forEachSubclass(ForEachFunction f, EnumSet<Instantiation> mask,
{bool strict = false}) {
return node.forEachSubclass(f, mask, strict: strict);
}
@@ -731,13 +727,13 @@
/// continues. The return value of the function is either [ForEach.STOP], if
/// visitation was stopped, or [ForEach.CONTINUE] if visitation continued to
/// the end.
- IterationStep forEachSubtype(ForEachFunction f, EnumSet<Instantiation> mask,
+ IterationStep? forEachSubtype(ForEachFunction f, EnumSet<Instantiation> mask,
{bool strict = false}) {
IterationStep nextStep =
node.forEachSubclass(f, mask, strict: strict) ?? IterationStep.CONTINUE;
if (nextStep == IterationStep.CONTINUE && _subtypes != null) {
- for (ClassHierarchyNode subclass in _subtypes) {
- IterationStep subForEach = subclass.forEachSubclass(f, mask);
+ for (ClassHierarchyNode subclass in _subtypes!) {
+ IterationStep? subForEach = subclass.forEachSubclass(f, mask);
if (subForEach == IterationStep.STOP) {
return subForEach;
}
@@ -758,7 +754,7 @@
int hierarchyDepth = subtype.hierarchyDepth;
List<ClassHierarchyNode> newSubtypes = [];
bool added = false;
- for (ClassHierarchyNode otherSubtype in _subtypes) {
+ for (ClassHierarchyNode otherSubtype in _subtypes!) {
int otherHierarchyDepth = otherSubtype.hierarchyDepth;
if (hierarchyDepth == otherHierarchyDepth) {
if (subtype == otherSubtype) {
@@ -805,23 +801,23 @@
/// Returns the most specific subtype of [cls] (including [cls]) that is
/// directly instantiated or a superclass of all directly instantiated
/// subtypes. If no subtypes of [cls] are instantiated, `null` is returned.
- ClassEntity getLubOfInstantiatedSubtypes() {
+ ClassEntity? getLubOfInstantiatedSubtypes() {
return _leastUpperInstantiatedSubtype ??=
_computeLeastUpperInstantiatedSubtype();
}
- ClassEntity _computeLeastUpperInstantiatedSubtype() {
+ ClassEntity? _computeLeastUpperInstantiatedSubtype() {
if (node.isExplicitlyInstantiated) {
return cls;
}
if (_subtypes == null) {
return node.getLubOfInstantiatedSubclasses();
}
- ClassHierarchyNode subtype;
+ ClassHierarchyNode? subtype;
if (node.isInstantiated) {
subtype = node;
}
- for (ClassHierarchyNode subnode in _subtypes) {
+ for (ClassHierarchyNode subnode in _subtypes!) {
if (subnode.isInstantiated) {
if (subtype == null) {
subtype = subnode;
@@ -844,14 +840,14 @@
sb.write('\n');
if (_subtypes != null) {
sb.write(' subtypes:\n');
- for (ClassHierarchyNode node in _subtypes) {
+ for (ClassHierarchyNode node in _subtypes!) {
node.printOn(sb, ' ');
sb.write('\n');
}
}
if (_mixinApplications != null) {
sb.write(' mixin-applications:\n');
- for (ClassHierarchyNode node in _mixinApplications) {
+ for (ClassHierarchyNode node in _mixinApplications!) {
node.printOn(sb, ' ');
sb.write('\n');
}
@@ -867,9 +863,7 @@
final EnumSet<Instantiation> mask;
final bool includeRoot;
- ClassHierarchyNodeIterable(this.root, this.mask, {this.includeRoot = true}) {
- if (root == null) throw StateError("No root for iterable.");
- }
+ ClassHierarchyNodeIterable(this.root, this.mask, {this.includeRoot = true});
@override
Iterator<ClassEntity> get iterator {
@@ -887,12 +881,12 @@
///
/// This is `null` before the first call to [moveNext] and at the end of
/// iteration, i.e. after [moveNext] has returned `false`.
- ClassHierarchyNode currentNode;
+ ClassHierarchyNode? currentNode;
/// Stack of pending class nodes.
///
/// This is `null` before the first call to [moveNext].
- List<ClassHierarchyNode> stack;
+ List<ClassHierarchyNode>? stack;
ClassHierarchyNodeIterator(this.iterable);
@@ -908,7 +902,10 @@
@override
ClassEntity get current {
- return currentNode?.cls;
+ // The [Iterator] spec allows for any behavior if current is not set yet
+ // (i.e. the iterator is in an invalid state). Therefore we can assert not
+ // null and allow this to throw.
+ return currentNode!.cls;
}
@override
@@ -927,24 +924,24 @@
/// Find the next class using the [stack].
bool _findNext() {
while (true) {
- if (stack.isEmpty) {
+ if (stack!.isEmpty) {
// No more classes. Set [currentNode] to `null` to signal the end of
// iteration.
currentNode = null;
return false;
}
- currentNode = stack.removeLast();
- if (!includeUninstantiated && !currentNode.isInstantiated) {
+ currentNode = stack!.removeLast();
+ if (!includeUninstantiated && !currentNode!.isInstantiated) {
// We're only iterating instantiated classes so there is no use in
// visiting the current node and its subtree.
continue;
}
// Add direct subclasses in reverse order so will visit them in the list
// order.
- for (int i = currentNode._directSubclasses.length - 1; i >= 0; i--) {
- stack.add(currentNode._directSubclasses[i]);
+ for (int i = currentNode!._directSubclasses.length - 1; i >= 0; i--) {
+ stack!.add(currentNode!._directSubclasses[i]);
}
- if (_isValid(currentNode)) {
+ if (_isValid(currentNode!)) {
return true;
}
}
@@ -973,8 +970,8 @@
/// Iterator for the subtypes in a [ClassSet].
class SubtypesIterator extends Iterator<ClassEntity> {
final SubtypesIterable iterable;
- Iterator<ClassEntity> elements;
- Iterator<ClassHierarchyNode> hierarchyNodes;
+ Iterator<ClassEntity>? elements;
+ Iterator<ClassHierarchyNode>? hierarchyNodes;
SubtypesIterator(this.iterable);
@@ -984,10 +981,9 @@
@override
ClassEntity get current {
- if (elements != null) {
- return elements.current;
- }
- return null;
+ // The [Iterator] spec says that the behavior is unspecified if current is
+ // unset because moveNext() has been called 0 times or too many times.
+ return elements!.current;
}
@override
@@ -998,16 +994,16 @@
.subclassesByMask(mask, strict: !includeRoot)
.iterator;
}
- if (elements != null && elements.moveNext()) {
+ if (elements != null && elements!.moveNext()) {
return true;
}
if (hierarchyNodes == null) {
// Start iterating through subtypes.
- hierarchyNodes = iterable.subtypeSet._subtypes.iterator;
+ hierarchyNodes = iterable.subtypeSet._subtypes!.iterator;
}
- while (hierarchyNodes.moveNext()) {
- elements = hierarchyNodes.current.subclassesByMask(mask).iterator;
- if (elements.moveNext()) {
+ while (hierarchyNodes!.moveNext()) {
+ elements = hierarchyNodes!.current.subclassesByMask(mask).iterator;
+ if (elements!.moveNext()) {
return true;
}
}
@@ -1037,7 +1033,7 @@
/// Singleton map implemented as a field on the key.
class ClassHierarchyNodesMap extends MapBase<ClassEntity, ClassHierarchyNode> {
@override
- ClassHierarchyNode operator [](Object cls) {
+ ClassHierarchyNode? operator [](Object? cls) {
// TODO(sra): Change the key type to `covariant ClassHierarchyNodesMapKey`.
if (cls is ClassHierarchyNodesMapKey) {
return cls._classHierarchyNode;
@@ -1067,7 +1063,7 @@
}
@override
- ClassHierarchyNode remove(Object key) {
+ ClassHierarchyNode remove(Object? key) {
throw UnimplementedError('ClassHierarchyNodesMap.remove');
}
@@ -1078,5 +1074,5 @@
}
abstract class ClassHierarchyNodesMapKey implements ClassEntity {
- ClassHierarchyNode _classHierarchyNode;
+ ClassHierarchyNode? _classHierarchyNode;
}
diff --git a/pkg/compiler/lib/src/universe/function_set.dart b/pkg/compiler/lib/src/universe/function_set.dart
index 13f48fc..2c723a3 100644
--- a/pkg/compiler/lib/src/universe/function_set.dart
+++ b/pkg/compiler/lib/src/universe/function_set.dart
@@ -2,8 +2,6 @@
// 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.10
-
library universe.function_set;
import '../common/names.dart' show Identifiers, Selectors;
@@ -21,7 +19,7 @@
factory FunctionSet(Iterable<MemberEntity> liveInstanceMembers) {
Map<String, FunctionSetNode> nodes = {};
for (MemberEntity member in liveInstanceMembers) {
- String name = member.name;
+ String name = member.name!;
(nodes[name] ??= FunctionSetNode(name)).add(member);
}
return FunctionSet.internal(nodes);
@@ -32,8 +30,8 @@
bool contains(MemberEntity element) {
assert(element.isInstanceMember);
assert(!element.isAbstract);
- String name = element.name;
- FunctionSetNode node = _nodes[name];
+ String name = element.name!;
+ FunctionSetNode? node = _nodes[name];
return (node != null) ? node.contains(element) : false;
}
@@ -58,7 +56,7 @@
}
SelectorMask _createSelectorMask(
- Selector selector, AbstractValue receiver, AbstractValueDomain domain) {
+ Selector selector, AbstractValue? receiver, AbstractValueDomain domain) {
return receiver != null
? SelectorMask(selector, receiver)
: SelectorMask(selector, domain.dynamicType);
@@ -73,8 +71,8 @@
SelectorMask selectorMask = _createSelectorMask(selector, receiver, domain);
SelectorMask noSuchMethodMask =
SelectorMask(Selectors.noSuchMethod_, selectorMask.receiver);
- FunctionSetNode node = _nodes[name];
- FunctionSetNode noSuchMethods = _nodes[Identifiers.noSuchMethod_];
+ FunctionSetNode? node = _nodes[name];
+ FunctionSetNode? noSuchMethods = _nodes[Identifiers.noSuchMethod_];
if (node != null) {
return node.query(selectorMask, domain, noSuchMethods, noSuchMethodMask);
}
@@ -103,9 +101,7 @@
SelectorMask(this.selector, this.receiver)
: this.hashCode =
- Hashing.mixHashCodeBits(selector.hashCode, receiver.hashCode) {
- assert(receiver != null);
- }
+ Hashing.mixHashCodeBits(selector.hashCode, receiver.hashCode);
String get name => selector.name;
@@ -160,10 +156,10 @@
isList = false;
}
if (isList) {
- List<MemberEntity> list = elements;
+ final list = elements as List<MemberEntity>;
list.add(element);
} else {
- Set<MemberEntity> set = elements;
+ final set = elements as Set<MemberEntity>;
set.add(element);
}
if (!cache.isEmpty) cache.clear();
@@ -173,7 +169,7 @@
void remove(MemberEntity element) {
assert(element.name == name);
if (isList) {
- List<MemberEntity> list = elements;
+ final list = elements as List<MemberEntity>;
int index = list.indexOf(element);
if (index < 0) return;
MemberEntity last = list.removeLast();
@@ -182,7 +178,7 @@
}
if (!cache.isEmpty) cache.clear();
} else {
- Set<MemberEntity> set = elements;
+ final set = elements as List<MemberEntity>;
if (set.remove(element)) {
// To avoid wobbling between the two representations, we do
// not transition back to the list representation even if we
@@ -204,12 +200,12 @@
/// Returns the set of functions that can be the target of [selectorMask]
/// including no such method handling where applicable.
FunctionSetQuery query(SelectorMask selectorMask, AbstractValueDomain domain,
- [FunctionSetNode noSuchMethods, SelectorMask noSuchMethodMask]) {
+ [FunctionSetNode? noSuchMethods, SelectorMask? noSuchMethodMask]) {
assert(selectorMask.name == name);
- FunctionSetQuery result = cache[selectorMask];
+ FunctionSetQuery? result = cache[selectorMask];
if (result != null) return result;
- Setlet<MemberEntity> functions;
+ Setlet<MemberEntity>? functions;
for (MemberEntity element in elements) {
if (selectorMask.applies(element, domain)) {
// Defer the allocation of the functions set until we are
@@ -225,8 +221,10 @@
// potential targets.
if (noSuchMethods != null &&
selectorMask.needsNoSuchMethodHandling(domain)) {
+ // If [noSuchMethods] was provided then [noSuchMethodMask] should also
+ // have been provided.
FunctionSetQuery noSuchMethodQuery =
- noSuchMethods.query(noSuchMethodMask, domain);
+ noSuchMethods.query(noSuchMethodMask!, domain);
if (!noSuchMethodQuery.functions.isEmpty) {
functions ??= Setlet();
functions.addAll(noSuchMethodQuery.functions);
@@ -282,7 +280,7 @@
@override
final Iterable<MemberEntity> functions;
- AbstractValue _receiver;
+ AbstractValue? _receiver;
FullFunctionSetQuery(this.functions);
diff --git a/pkg/compiler/lib/src/universe/side_effects.dart b/pkg/compiler/lib/src/universe/side_effects.dart
index 9533a2b..a269f63 100644
--- a/pkg/compiler/lib/src/universe/side_effects.dart
+++ b/pkg/compiler/lib/src/universe/side_effects.dart
@@ -2,8 +2,6 @@
// 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.10
-
library universe.side_effects;
import '../elements/entities.dart';
@@ -259,7 +257,7 @@
final MemberEntity _member;
final SideEffects _sideEffects = SideEffects.empty();
final bool _free;
- Set<SideEffectsBuilder> _depending;
+ Set<SideEffectsBuilder>? _depending;
SideEffectsBuilder(this._member) : _free = false;
diff --git a/pkg/compiler/pubspec.yaml b/pkg/compiler/pubspec.yaml
index 071e5e1..ff1ae62 100644
--- a/pkg/compiler/pubspec.yaml
+++ b/pkg/compiler/pubspec.yaml
@@ -6,8 +6,7 @@
environment:
sdk: '>=2.16.0 <3.0.0'
-# NOTE: `pub get / pub upgrade` are generally not needed when working on this
-# package. The `.packages` file in the repository root will be used by default.
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
_fe_analyzer_shared: any
_js_interop_checks: any
@@ -21,6 +20,7 @@
kernel: any
vm_service: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
args: any
dart_style: any
diff --git a/pkg/compiler/test/model/class_set_test.dart b/pkg/compiler/test/model/class_set_test.dart
index 31e538e..b5614fb 100644
--- a/pkg/compiler/test/model/class_set_test.dart
+++ b/pkg/compiler/test/model/class_set_test.dart
@@ -144,7 +144,7 @@
checkState(G, currentNode: G, stack: []);
Expect.isFalse(iterator.moveNext());
checkState(G, currentNode: null, stack: []);
- Expect.isNull(iterator.current);
+ Expect.throws(() => iterator.current);
iterator = new ClassHierarchyNodeIterable(
world.classHierarchy.getClassHierarchyNode(G), ClassHierarchyNode.ALL,
diff --git a/pkg/compiler/test/static_type/static_type_test.dart b/pkg/compiler/test/static_type/static_type_test.dart
index 0498952..dcaea02 100644
--- a/pkg/compiler/test/static_type/static_type_test.dart
+++ b/pkg/compiler/test/static_type/static_type_test.dart
@@ -61,7 +61,7 @@
new CachedStaticType(
getStaticTypeContext(elementMap, node),
staticTypeCache,
- new ThisInterfaceType.from(node.enclosingClass?.getThisType(
+ ThisInterfaceType.from(node.enclosingClass?.getThisType(
_typeEnvironment.coreTypes,
node.enclosingLibrary.nonNullable))))
.run(node);
diff --git a/pkg/dart2js_info/bin/src/code_deps.dart b/pkg/dart2js_info/bin/src/code_deps.dart
index 056e08b..5a57686 100644
--- a/pkg/dart2js_info/bin/src/code_deps.dart
+++ b/pkg/dart2js_info/bin/src/code_deps.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Command to query for code dependencies. Currently this tool only
/// supports the `some_path` query, which gives you the shortest path for how
/// one function depends on another.
@@ -59,7 +61,6 @@
if (args.length < 3) {
usageException("Missing arguments for some_path, expected: "
"info.data <element-regexp-1> <element-regexp-2>");
- return;
}
var info = await infoFromFile(args.first);
diff --git a/pkg/dart2js_info/bin/src/common_command.dart b/pkg/dart2js_info/bin/src/common_command.dart
index 8719b11..e8cba55 100644
--- a/pkg/dart2js_info/bin/src/common_command.dart
+++ b/pkg/dart2js_info/bin/src/common_command.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'package:args/command_runner.dart';
import 'package:dart2js_info/info.dart';
@@ -35,7 +37,6 @@
if (args.length < 2) {
usageException(
'Missing arguments, expected two dump-info files to compare');
- return;
}
var oldInfo = await infoFromFile(args[0]);
diff --git a/pkg/dart2js_info/bin/src/convert.dart b/pkg/dart2js_info/bin/src/convert.dart
index 7439957..e698029 100644
--- a/pkg/dart2js_info/bin/src/convert.dart
+++ b/pkg/dart2js_info/bin/src/convert.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'package:args/command_runner.dart';
import 'to_json.dart' show ToJsonCommand;
diff --git a/pkg/dart2js_info/bin/src/coverage_log_server.dart b/pkg/dart2js_info/bin/src/coverage_log_server.dart
index f86654a..375731a 100644
--- a/pkg/dart2js_info/bin/src/coverage_log_server.dart
+++ b/pkg/dart2js_info/bin/src/coverage_log_server.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// A tool to gather coverage data from an app generated with dart2js. This
/// depends on code that has been landed in the bleeding_edge version of dart2js
/// and that we expect to become publicly visible in version 0.13.0 of the Dart
diff --git a/pkg/dart2js_info/bin/src/debug_info.dart b/pkg/dart2js_info/bin/src/debug_info.dart
index 51a8c99..24b2298 100644
--- a/pkg/dart2js_info/bin/src/debug_info.dart
+++ b/pkg/dart2js_info/bin/src/debug_info.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Tool used mainly by dart2js developers to debug the generated info and check
/// that it is consistent and that it covers all the data we expect it to cover.
library dart2js_info.bin.debug_info;
diff --git a/pkg/dart2js_info/bin/src/deferred_library_check.dart b/pkg/dart2js_info/bin/src/deferred_library_check.dart
index a54bdeb..2aba53c 100644
--- a/pkg/dart2js_info/bin/src/deferred_library_check.dart
+++ b/pkg/dart2js_info/bin/src/deferred_library_check.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// A command that verifies that deferred libraries split the code as expected.
///
/// This tool checks that the output from dart2js meets a given specification,
diff --git a/pkg/dart2js_info/bin/src/deferred_library_layout.dart b/pkg/dart2js_info/bin/src/deferred_library_layout.dart
index 95f20a5..7dc279a 100644
--- a/pkg/dart2js_info/bin/src/deferred_library_layout.dart
+++ b/pkg/dart2js_info/bin/src/deferred_library_layout.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// This tool reports how code is divided among deferred chunks.
library dart2js_info.bin.deferred_library_layout;
diff --git a/pkg/dart2js_info/bin/src/deferred_library_size.dart b/pkg/dart2js_info/bin/src/deferred_library_size.dart
index 353d8ed..78f94c9 100644
--- a/pkg/dart2js_info/bin/src/deferred_library_size.dart
+++ b/pkg/dart2js_info/bin/src/deferred_library_size.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// This tool gives a breakdown of code size by deferred part in the program.
library dart2js_info.bin.deferred_library_size;
diff --git a/pkg/dart2js_info/bin/src/diff.dart b/pkg/dart2js_info/bin/src/diff.dart
index b811071..dfa4b34 100644
--- a/pkg/dart2js_info/bin/src/diff.dart
+++ b/pkg/dart2js_info/bin/src/diff.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'package:args/command_runner.dart';
import 'package:dart2js_info/info.dart';
@@ -31,7 +33,6 @@
if (args.length < 2) {
usageException(
'Missing arguments, expected two dump-info files to compare');
- return;
}
var oldInfo = await infoFromFile(args[0]);
diff --git a/pkg/dart2js_info/bin/src/function_size_analysis.dart b/pkg/dart2js_info/bin/src/function_size_analysis.dart
index 704155d..a856f2e 100644
--- a/pkg/dart2js_info/bin/src/function_size_analysis.dart
+++ b/pkg/dart2js_info/bin/src/function_size_analysis.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Tool presenting how much each function contributes to the total code.
library compiler.tool.function_size_analysis;
diff --git a/pkg/dart2js_info/bin/src/inject_text.dart b/pkg/dart2js_info/bin/src/inject_text.dart
index 18bd5bd..ea245ad 100644
--- a/pkg/dart2js_info/bin/src/inject_text.dart
+++ b/pkg/dart2js_info/bin/src/inject_text.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'dart:io';
import 'package:dart2js_info/info.dart';
diff --git a/pkg/dart2js_info/bin/src/library_size_split.dart b/pkg/dart2js_info/bin/src/library_size_split.dart
index 3246d1e..a4e2483 100644
--- a/pkg/dart2js_info/bin/src/library_size_split.dart
+++ b/pkg/dart2js_info/bin/src/library_size_split.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Command-line tool to show the size distribution of generated code among
/// libraries. Libraries can be grouped using regular expressions. You can
/// specify what regular expressions to use by providing a `grouping.yaml` file.
@@ -87,9 +89,6 @@
var args = argResults.rest;
if (args.isEmpty) {
usageException('Missing argument: info.data');
- print('usage: dart tool/library_size_split.dart '
- 'path-to-info.json [grouping.yaml]');
- exit(1);
}
var info = await infoFromFile(args.first);
diff --git a/pkg/dart2js_info/bin/src/live_code_size_analysis.dart b/pkg/dart2js_info/bin/src/live_code_size_analysis.dart
index 23d4e32..3e02b7a 100644
--- a/pkg/dart2js_info/bin/src/live_code_size_analysis.dart
+++ b/pkg/dart2js_info/bin/src/live_code_size_analysis.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Command-line tool presenting combined information from dump-info and
/// coverage data.
///
diff --git a/pkg/dart2js_info/bin/src/runtime_coverage_analysis.dart b/pkg/dart2js_info/bin/src/runtime_coverage_analysis.dart
index 44429e0..6f8183f 100644
--- a/pkg/dart2js_info/bin/src/runtime_coverage_analysis.dart
+++ b/pkg/dart2js_info/bin/src/runtime_coverage_analysis.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Command-line tool presenting combined information from dump-info and
/// runtime coverage data.
///
diff --git a/pkg/dart2js_info/bin/src/show_inferred_types.dart b/pkg/dart2js_info/bin/src/show_inferred_types.dart
index 9c3b119..7c43318 100644
--- a/pkg/dart2js_info/bin/src/show_inferred_types.dart
+++ b/pkg/dart2js_info/bin/src/show_inferred_types.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Simple script that shows the inferred types of a function.
library compiler.tool.show_inferred_types;
diff --git a/pkg/dart2js_info/bin/src/text_print.dart b/pkg/dart2js_info/bin/src/text_print.dart
index 3615b4d..95ad015 100644
--- a/pkg/dart2js_info/bin/src/text_print.dart
+++ b/pkg/dart2js_info/bin/src/text_print.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'dart:io';
import 'package:args/command_runner.dart';
diff --git a/pkg/dart2js_info/bin/src/to_binary.dart b/pkg/dart2js_info/bin/src/to_binary.dart
index e1170f3..3061c3e 100644
--- a/pkg/dart2js_info/bin/src/to_binary.dart
+++ b/pkg/dart2js_info/bin/src/to_binary.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'dart:io';
import 'package:args/command_runner.dart';
@@ -24,7 +26,6 @@
void run() async {
if (argResults.rest.isEmpty) {
usageException('Missing argument: <input-info>');
- exit(1);
}
String filename = argResults.rest[0];
diff --git a/pkg/dart2js_info/bin/src/to_json.dart b/pkg/dart2js_info/bin/src/to_json.dart
index 15e2722..38a909c 100644
--- a/pkg/dart2js_info/bin/src/to_json.dart
+++ b/pkg/dart2js_info/bin/src/to_json.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'dart:io';
import 'dart:convert';
diff --git a/pkg/dart2js_info/bin/src/to_proto.dart b/pkg/dart2js_info/bin/src/to_proto.dart
index 5af4503..89ed41d 100644
--- a/pkg/dart2js_info/bin/src/to_proto.dart
+++ b/pkg/dart2js_info/bin/src/to_proto.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Command-line tool to convert an info.json file ouputted by dart2js to the
/// alternative protobuf format.
@@ -26,7 +28,6 @@
void run() async {
if (argResults.rest.isEmpty) {
usageException('Missing argument: <input-info>');
- exit(1);
}
String filename = argResults.rest[0];
diff --git a/pkg/dart2js_info/bin/src/usage_exception.dart b/pkg/dart2js_info/bin/src/usage_exception.dart
index 3065100..3222ef4 100644
--- a/pkg/dart2js_info/bin/src/usage_exception.dart
+++ b/pkg/dart2js_info/bin/src/usage_exception.dart
@@ -6,10 +6,8 @@
import 'package:args/command_runner.dart';
abstract class PrintUsageException implements Command<void> {
- // TODO(rnystrom): Use "Never" for the return type when this package is
- // migrated to null safety.
@override
- usageException(String message) {
+ Never usageException(String message) {
print(message);
printUsage();
exit(1);
diff --git a/pkg/dart2js_info/bin/tools.dart b/pkg/dart2js_info/bin/tools.dart
index 7dc64bd..785e00c 100644
--- a/pkg/dart2js_info/bin/tools.dart
+++ b/pkg/dart2js_info/bin/tools.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'package:args/command_runner.dart';
import 'src/code_deps.dart';
diff --git a/pkg/dart2js_info/lib/binary_serialization.dart b/pkg/dart2js_info/lib/binary_serialization.dart
index 23b626d..043c93b 100644
--- a/pkg/dart2js_info/lib/binary_serialization.dart
+++ b/pkg/dart2js_info/lib/binary_serialization.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Info serialization to a binary form.
///
/// Unlike the JSON codec, this serialization is designed to be streamed.
diff --git a/pkg/dart2js_info/lib/deferred_library_check.dart b/pkg/dart2js_info/lib/deferred_library_check.dart
index 3b5c365c..111cb10 100644
--- a/pkg/dart2js_info/lib/deferred_library_check.dart
+++ b/pkg/dart2js_info/lib/deferred_library_check.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// This tool checks that the output from dart2js meets a given specification,
/// given in a YAML file. The format of the YAML file is:
///
diff --git a/pkg/dart2js_info/lib/info.dart b/pkg/dart2js_info/lib/info.dart
index 132e13b..d274125 100644
--- a/pkg/dart2js_info/lib/info.dart
+++ b/pkg/dart2js_info/lib/info.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Data produced by dart2js when run with the `--dump-info` flag.
library dart2js_info.info;
diff --git a/pkg/dart2js_info/lib/json_info_codec.dart b/pkg/dart2js_info/lib/json_info_codec.dart
index 647559f..a6a4a71 100644
--- a/pkg/dart2js_info/lib/json_info_codec.dart
+++ b/pkg/dart2js_info/lib/json_info_codec.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Converters and codecs for converting between JSON and [Info] classes.
import 'dart:collection';
import 'dart:convert';
diff --git a/pkg/dart2js_info/lib/proto_info_codec.dart b/pkg/dart2js_info/lib/proto_info_codec.dart
index 4d42457..60bd5fa 100644
--- a/pkg/dart2js_info/lib/proto_info_codec.dart
+++ b/pkg/dart2js_info/lib/proto_info_codec.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Converters and codecs for converting between Protobuf and [Info] classes.
import 'dart:convert';
diff --git a/pkg/dart2js_info/lib/src/binary/sink.dart b/pkg/dart2js_info/lib/src/binary/sink.dart
index 4905b49..7c1f821 100644
--- a/pkg/dart2js_info/lib/src/binary/sink.dart
+++ b/pkg/dart2js_info/lib/src/binary/sink.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'dart:convert';
import 'dart:typed_data';
diff --git a/pkg/dart2js_info/lib/src/binary/source.dart b/pkg/dart2js_info/lib/src/binary/source.dart
index d423f3f..ef68784 100644
--- a/pkg/dart2js_info/lib/src/binary/source.dart
+++ b/pkg/dart2js_info/lib/src/binary/source.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'dart:convert';
import 'dart:typed_data';
diff --git a/pkg/dart2js_info/lib/src/common_element.dart b/pkg/dart2js_info/lib/src/common_element.dart
index 788d6f2..c2b94e5 100644
--- a/pkg/dart2js_info/lib/src/common_element.dart
+++ b/pkg/dart2js_info/lib/src/common_element.dart
@@ -1,3 +1,5 @@
+// @dart = 2.11
+
import 'package:dart2js_info/info.dart';
import 'package:dart2js_info/src/util.dart';
diff --git a/pkg/dart2js_info/lib/src/diff.dart b/pkg/dart2js_info/lib/src/diff.dart
index 29dd698..4093dac 100644
--- a/pkg/dart2js_info/lib/src/diff.dart
+++ b/pkg/dart2js_info/lib/src/diff.dart
@@ -1,3 +1,5 @@
+// @dart = 2.11
+
import 'package:dart2js_info/info.dart';
import 'package:dart2js_info/src/util.dart';
diff --git a/pkg/dart2js_info/lib/src/graph.dart b/pkg/dart2js_info/lib/src/graph.dart
index 9233d9f..3c80ba2 100644
--- a/pkg/dart2js_info/lib/src/graph.dart
+++ b/pkg/dart2js_info/lib/src/graph.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// A library to work with graphs. It contains a couple algorithms, including
/// Tarjan's algorithm to compute strongly connected components in a graph and
/// Cooper et al's dominator algorithm.
diff --git a/pkg/dart2js_info/lib/src/io.dart b/pkg/dart2js_info/lib/src/io.dart
index affc8de..f006e87 100644
--- a/pkg/dart2js_info/lib/src/io.dart
+++ b/pkg/dart2js_info/lib/src/io.dart
@@ -1,3 +1,5 @@
+// @dart = 2.11
+
import 'dart:convert';
import 'dart:io';
diff --git a/pkg/dart2js_info/lib/src/string_edit_buffer.dart b/pkg/dart2js_info/lib/src/string_edit_buffer.dart
index 7630bf2..4f552c0 100644
--- a/pkg/dart2js_info/lib/src/string_edit_buffer.dart
+++ b/pkg/dart2js_info/lib/src/string_edit_buffer.dart
@@ -2,6 +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.
+// @dart = 2.11
+
/// Defines [StringEditBuffer], a buffer that can be used to apply edits on a
/// string.
// TODO(sigmund): this should move to a separate package.
diff --git a/pkg/dart2js_info/lib/src/table.dart b/pkg/dart2js_info/lib/src/table.dart
index 23f44f0..b092ec8 100644
--- a/pkg/dart2js_info/lib/src/table.dart
+++ b/pkg/dart2js_info/lib/src/table.dart
@@ -2,6 +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.
+// @dart = 2.11
+
library dart2js_info.src.table;
import 'dart:math' show max;
diff --git a/pkg/dart2js_info/lib/src/util.dart b/pkg/dart2js_info/lib/src/util.dart
index c90b09f..ec8245a 100644
--- a/pkg/dart2js_info/lib/src/util.dart
+++ b/pkg/dart2js_info/lib/src/util.dart
@@ -2,6 +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.
+// @dart = 2.11
+
library dart2js_info.src.util;
import 'package:dart2js_info/info.dart';
diff --git a/pkg/dart2js_info/pubspec.yaml b/pkg/dart2js_info/pubspec.yaml
index 2d8ff24..04e3c7b 100644
--- a/pkg/dart2js_info/pubspec.yaml
+++ b/pkg/dart2js_info/pubspec.yaml
@@ -6,8 +6,9 @@
--dump-info.
environment:
- sdk: '>=2.11.99 <3.0.0'
+ sdk: '>=2.16.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
args: any
collection: any
@@ -17,6 +18,7 @@
shelf: any
yaml: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
lints: any
test: any
diff --git a/pkg/dart2js_info/test/binary_serialization_test.dart b/pkg/dart2js_info/test/binary_serialization_test.dart
index b622d04..3abdf36 100644
--- a/pkg/dart2js_info/test/binary_serialization_test.dart
+++ b/pkg/dart2js_info/test/binary_serialization_test.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'dart:convert';
import 'dart:io';
diff --git a/pkg/dart2js_info/test/graph_test.dart b/pkg/dart2js_info/test/graph_test.dart
index 71afc23..017a90e 100644
--- a/pkg/dart2js_info/test/graph_test.dart
+++ b/pkg/dart2js_info/test/graph_test.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'package:dart2js_info/src/graph.dart';
import 'package:test/test.dart';
diff --git a/pkg/dart2js_info/test/json_to_proto_deferred_test.dart b/pkg/dart2js_info/test/json_to_proto_deferred_test.dart
index fc0af00..190b005 100644
--- a/pkg/dart2js_info/test/json_to_proto_deferred_test.dart
+++ b/pkg/dart2js_info/test/json_to_proto_deferred_test.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'dart:convert';
import 'dart:io';
diff --git a/pkg/dart2js_info/test/json_to_proto_test.dart b/pkg/dart2js_info/test/json_to_proto_test.dart
index 1975ca1..72d4e7b 100644
--- a/pkg/dart2js_info/test/json_to_proto_test.dart
+++ b/pkg/dart2js_info/test/json_to_proto_test.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'dart:convert';
import 'dart:io';
diff --git a/pkg/dart2js_info/test/parse_test.dart b/pkg/dart2js_info/test/parse_test.dart
index 40709b9..80a0870 100644
--- a/pkg/dart2js_info/test/parse_test.dart
+++ b/pkg/dart2js_info/test/parse_test.dart
@@ -2,6 +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.
+// @dart = 2.11
+
import 'dart:convert';
import 'dart:io';
diff --git a/pkg/dart2js_runtime_metrics/pubspec.yaml b/pkg/dart2js_runtime_metrics/pubspec.yaml
index 8db9891..57a2179 100644
--- a/pkg/dart2js_runtime_metrics/pubspec.yaml
+++ b/pkg/dart2js_runtime_metrics/pubspec.yaml
@@ -11,5 +11,6 @@
# a later version of the SDK without it being a breaking change.
sdk: ">=2.14.0 <2.15.0"
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
expect: any
diff --git a/pkg/dart2js_tools/pubspec.yaml b/pkg/dart2js_tools/pubspec.yaml
index ec4d63b..ce67a9b 100644
--- a/pkg/dart2js_tools/pubspec.yaml
+++ b/pkg/dart2js_tools/pubspec.yaml
@@ -8,6 +8,7 @@
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
path: any
source_maps: any
diff --git a/pkg/dart2native/pubspec.yaml b/pkg/dart2native/pubspec.yaml
index 6cd6814..80bf3ee 100644
--- a/pkg/dart2native/pubspec.yaml
+++ b/pkg/dart2native/pubspec.yaml
@@ -9,8 +9,10 @@
executables:
dart2native:
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
path: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
lints: any
diff --git a/pkg/dart2wasm/pubspec.yaml b/pkg/dart2wasm/pubspec.yaml
index 2c0f711..f4ed37e 100644
--- a/pkg/dart2wasm/pubspec.yaml
+++ b/pkg/dart2wasm/pubspec.yaml
@@ -4,6 +4,7 @@
environment:
sdk: '>=2.12.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
_js_interop_checks: any
front_end: any
diff --git a/pkg/dartdev/pubspec.yaml b/pkg/dartdev/pubspec.yaml
index 2e71998..58afb2a 100644
--- a/pkg/dartdev/pubspec.yaml
+++ b/pkg/dartdev/pubspec.yaml
@@ -6,6 +6,7 @@
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
analysis_server: any
analysis_server_client: any
@@ -25,6 +26,7 @@
telemetry: any
usage: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
expect: any
lints: any
diff --git a/pkg/dartdev/test/commands/analyze_test.dart b/pkg/dartdev/test/commands/analyze_test.dart
index 31a4dd4..065d607 100644
--- a/pkg/dartdev/test/commands/analyze_test.dart
+++ b/pkg/dartdev/test/commands/analyze_test.dart
@@ -53,6 +53,10 @@
}
''';
+/// The exit code of the analysis server when the highest severity issue is a
+/// warning.
+const int _warningExitCode = 2;
+
void defineAnalysisError() {
group('contextMessages', () {
test('none', () {
@@ -389,7 +393,7 @@
);
var result = await p.run(['analyze', p.dirPath]);
- expect(result.exitCode, equals(0));
+ expect(result.exitCode, equals(_warningExitCode));
expect(result.stderr, isEmpty);
expect(result.stdout, contains('lib/main.dart:2:6 '));
expect(result.stdout, contains('TODO: Implement this - todo'));
diff --git a/pkg/dds/pubspec.yaml b/pkg/dds/pubspec.yaml
index e2ca11c..40e8453 100644
--- a/pkg/dds/pubspec.yaml
+++ b/pkg/dds/pubspec.yaml
@@ -19,18 +19,22 @@
json_rpc_2: ^3.0.0
meta: ^1.1.8
path: ^1.8.0
- shelf: ^1.0.0
shelf_proxy: ^1.0.0
shelf_static: ^1.0.0
shelf_web_socket: ^1.0.0
- stack_trace: ^1.10.0
+ shelf: ^1.0.0
sse: ^4.0.0
+ stack_trace: ^1.10.0
stream_channel: ^2.0.0
vm_service: ^8.1.0
web_socket_channel: ^2.0.0
+# We use 'any' version constraints here as we get our package versions from
+# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
+# best practice for packages is to specify their compatible version ranges.
+# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
- http: ^0.13.0
+ http: any
lints: any
- test: ^1.0.0
- webdriver: ^3.0.0
+ test: any
+ webdriver: any
diff --git a/pkg/dds_service_extensions/pubspec.yaml b/pkg/dds_service_extensions/pubspec.yaml
index f26c41ba..f42ed22 100644
--- a/pkg/dds_service_extensions/pubspec.yaml
+++ b/pkg/dds_service_extensions/pubspec.yaml
@@ -12,5 +12,9 @@
async: ^2.4.1
vm_service: ^8.1.0
+# We use 'any' version constraints here as we get our package versions from
+# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
+# best practice for packages is to specify their compatible version ranges.
+# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
lints: any
diff --git a/pkg/dev_compiler/lib/src/compiler/js_metalet.dart b/pkg/dev_compiler/lib/src/compiler/js_metalet.dart
index afca760..0e143ed 100644
--- a/pkg/dev_compiler/lib/src/compiler/js_metalet.dart
+++ b/pkg/dev_compiler/lib/src/compiler/js_metalet.dart
@@ -2,8 +2,6 @@
// 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
-
// TODO(jmesserly): import from its own package
import '../js_ast/js_ast.dart';
import 'js_names.dart' show TemporaryId;
@@ -27,7 +25,6 @@
/// Because this deals with JS AST nodes, it is not aware of any Dart semantics
/// around statelessness (such as `final` variables). [variables] should not
/// be created for these Dart expressions.
-///
class MetaLet extends Expression {
/// Creates a temporary to contain the value of [expr]. The temporary can be
/// used multiple times in the resulting expression. For example:
@@ -49,7 +46,7 @@
/// We run [toExpression] implicitly when the JS AST is visited, to get the
/// transformation to happen before the tree is printed.
/// This happens multiple times, so ensure the expression form is cached.
- Expression _expression;
+ Expression? _expression;
MetaLet(this.variables, this.body, {this.statelessResult = false});
@@ -68,7 +65,7 @@
}
@override
- Expression toAssignExpression(Expression left, [String op]) {
+ Expression toAssignExpression(Expression left, [String? op]) {
if (left is Identifier) {
return _simplifyAssignment(left, op: op) ?? _toAssign(left, op);
} else if (left is PropertyAccess &&
@@ -79,7 +76,7 @@
return super.toAssignExpression(left, op);
}
- Expression _toAssign(Expression left, [String op]) {
+ Expression _toAssign(Expression left, [String? op]) {
var exprs = body.toList();
exprs.add(exprs.removeLast().toAssignExpression(left, op));
return MetaLet(variables, exprs);
@@ -111,11 +108,11 @@
}
Expression toExpression() {
- if (_expression != null) return _expression;
+ if (_expression != null) return _expression!;
var block = toReturn();
var s = block.statements;
if (s.length == 1 && s.first is Return) {
- return _expression = (s.first as Return).value;
+ return (_expression = (s.first as Return).value)!;
}
// Wrap it in an immediately called function to get in expression context.
return _expression = _toInvokedFunction(block);
@@ -148,8 +145,8 @@
@override
T accept<T>(NodeVisitor<T> visitor) {
- // TODO(jmesserly): we special case vistors from js_ast.Template, because it
- // doesn't know about MetaLet. Should we integrate directly?
+ // TODO(jmesserly): we special case visitors from js_ast.Template, because
+ // it doesn't know about MetaLet. Should we integrate directly?
NodeVisitor v = visitor;
if (v is InstantiatorGeneratorVisitor) {
return _templateVisitMetaLet(v) as T;
@@ -162,8 +159,8 @@
@override
void visitChildren(NodeVisitor visitor) {
- // TODO(jmesserly): we special case vistors from js_ast.Template, because it
- // doesn't know about MetaLet. Should we integrate directly?
+ // TODO(jmesserly): we special case visitors from js_ast.Template, because
+ // it doesn't know about MetaLet. Should we integrate directly?
if (visitor is InterpolatedNodeAnalysis ||
visitor is InstantiatorGeneratorVisitor) {
variables.values.forEach((v) => v.accept(visitor));
@@ -236,7 +233,7 @@
var first = initializers[0];
node = Block([
initializers.length == 1
- ? first.value.toVariableDeclaration(first.declaration)
+ ? first.value!.toVariableDeclaration(first.declaration)
: VariableDeclarationList('let', initializers).toStatement(),
node
]);
@@ -257,8 +254,8 @@
///
/// result = ((_) => _.addAll(result), _.add(2), _)([])
///
- MetaLet _simplifyAssignment(Identifier left,
- {String op, bool isDeclaration = false}) {
+ MetaLet? _simplifyAssignment(Identifier left,
+ {String? op, bool isDeclaration = false}) {
// See if the result value is a let* temporary variable.
var result = body.last;
if (result is MetaLetVariable && variables.containsKey(result)) {
@@ -267,7 +264,7 @@
if (!isDeclaration && _IdentFinder.foundIn(left.name, body)) return null;
var vars = Map<MetaLetVariable, Expression>.from(variables);
- var value = vars.remove(result);
+ var value = vars.remove(result)!;
Expression assign;
if (isDeclaration) {
// Technically, putting one of these in a comma expression is not
diff --git a/pkg/dev_compiler/lib/src/compiler/js_names.dart b/pkg/dev_compiler/lib/src/compiler/js_names.dart
index f884331..985496d 100644
--- a/pkg/dev_compiler/lib/src/compiler/js_names.dart
+++ b/pkg/dev_compiler/lib/src/compiler/js_names.dart
@@ -9,6 +9,22 @@
/// The ES6 name for the Dart SDK. All dart:* libraries are in this module.
const String dartSdkModule = 'dart_sdk';
+/// Names expected to be used without renaming.
+///
+/// These are fixed by the dart:_rti library and are accessed through the
+/// `JsGetName` enum.
+abstract class FixedNames {
+ static const operatorIsPrefix = r'$is';
+ static const operatorSignature = r'$signature';
+ static const rtiName = r'$ti';
+ // TODO(48585) Fix this name.
+ static const futureClassName = 'TODO';
+ // TODO(48585) Fix this name.
+ static const listClassName = 'TODO';
+ static const rtiAsField = '_as';
+ static const rtiIsField = '_is';
+}
+
/// Unique instance for temporary variables. Will be renamed consistently
/// across the entire file. Different instances will be named differently
/// even if they have the same name, this makes it safe to use in code
diff --git a/pkg/dev_compiler/lib/src/compiler/js_utils.dart b/pkg/dev_compiler/lib/src/compiler/js_utils.dart
index aaecf7f..57adce8 100644
--- a/pkg/dev_compiler/lib/src/compiler/js_utils.dart
+++ b/pkg/dev_compiler/lib/src/compiler/js_utils.dart
@@ -2,6 +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 'package:js_shared/synced/embedded_names.dart'
+ show RtiUniverseFieldNames;
+
import '../js_ast/js_ast.dart';
/// Simplify `(args) => (() => { ... })()` to `(args) => { ... }`.
@@ -51,3 +54,21 @@
node.sourceInformation = null;
}
}
+
+/// Returns an expression that creates the initial Rti Universe.
+///
+/// This needs to be kept in sync with `_Universe.create` in `dart:_rti`.
+Expression createRtiUniverse() {
+ Property initField(String name, String value) =>
+ Property(js.string(name), js(value));
+
+ var universeFields = [
+ initField(RtiUniverseFieldNames.evalCache, 'new Map()'),
+ initField(RtiUniverseFieldNames.typeRules, '{}'),
+ initField(RtiUniverseFieldNames.erasedTypes, '{}'),
+ initField(RtiUniverseFieldNames.typeParameterVariances, '{}'),
+ initField(RtiUniverseFieldNames.sharedEmptyArray, '[]'),
+ ];
+
+ return ObjectInitializer(universeFields);
+}
diff --git a/pkg/dev_compiler/lib/src/compiler/module_builder.dart b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
index 9e89dc5..eeb78ea 100644
--- a/pkg/dev_compiler/lib/src/compiler/module_builder.dart
+++ b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
@@ -2,8 +2,6 @@
// 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 'package:args/args.dart' show ArgParser, ArgResults;
import 'package:path/path.dart' as p;
@@ -104,7 +102,7 @@
/// structure as possible with the original. The transformation is a shallow one
/// that affects the [ImportDeclaration]s from [items].
///
-/// Returns a new function that combines all statements from tranformed imports
+/// Returns a new function that combines all statements from transformed imports
/// from [items] and the body of the [function].
Fun transformFunctionModuleFormat(
List<ModuleItem> items, Fun function, ModuleFormat format) {
@@ -191,11 +189,11 @@
Identifier moduleVar, ImportDeclaration import, bool deferModules) {
var items = <Statement>[];
- for (var importName in import.namedImports) {
+ for (var importName in import.namedImports!) {
// import * is not emitted by the compiler, so we don't handle it here.
assert(!importName.isStar);
var asName = importName.asName ?? importName.name;
- var fromName = importName.name.name;
+ var fromName = importName.name!.name;
// Load non-SDK modules on demand (i.e., deferred).
if (deferModules && import.from.valueWithoutQuotes != dartSdkModule) {
items.add(js.statement(
@@ -220,10 +218,11 @@
items.add(js.comment('Exports:'));
// TODO(jmesserly): make these immutable in JS?
for (var export in exports) {
- var names = export.exportedNames;
- assert(names != null); // export * not supported in ddc modules.
+ // export * (exportedNames is null) is not emitted by the compiler, so
+ // we don't handle it here.
+ var names = export.exportedNames!;
for (var name in names) {
- var alias = name.asName ?? name.name;
+ var alias = name.asName ?? name.name!;
items.add(
js.statement('#.# = #;', [exportsVar, alias.name, name.name]));
}
@@ -238,7 +237,7 @@
/// compilation, in order to include all the context needed for evaluation
/// inside it.
///
- /// Returns a new function that combines all statements from tranformed
+ /// Returns a new function that combines all statements from transformed
/// imports from [items] and the body of the [function].
Fun buildFunctionWithImports(List<ModuleItem> items, Fun function) {
clear();
@@ -279,19 +278,20 @@
importStatements.addAll(buildImports(moduleVar, import, true));
}
- // Prepend import statetements.
+ // Prepend import statements.
statements.insertAll(0, importStatements);
// Append export statements.
statements.addAll(buildExports(exportsVar, exports));
+ var moduleName = module.name!;
var resultModule = NamedFunction(
- loadFunctionIdentifier(module.name),
+ loadFunctionIdentifier(moduleName),
js.fun("function(#) { 'use strict'; #; }", [parameters, statements]),
true);
var moduleDef = js.statement('dart_library.library(#, #, #, #, #)', [
- js.string(module.name, "'"),
+ js.string(moduleName, "'"),
LiteralNull(),
js.commentExpression(
'Imports', ArrayInitializer(importNames, multiline: true)),
@@ -320,12 +320,12 @@
.add(js.statement('const # = require(#);', [moduleVar, import.from]));
// TODO(jmesserly): optimize for the common case of a single import.
- for (var importName in import.namedImports) {
+ for (var importName in import.namedImports!) {
// import * is not emitted by the compiler, so we don't support it here.
assert(!importName.isStar);
var asName = importName.asName ?? importName.name;
importStatements.add(js.statement(
- 'const # = #.#', [asName, moduleVar, importName.name.name]));
+ 'const # = #.#', [asName, moduleVar, importName.name!.name]));
}
}
statements.insertAll(0, importStatements);
@@ -334,11 +334,11 @@
var exportsVar = Identifier('exports');
statements.add(js.comment('Exports:'));
for (var export in exports) {
- var names = export.exportedNames;
- // export * is not emitted by the compiler, so we don't handle it here.
- assert(names != null);
+ // export * (exportedNames is null) is not emitted by the compiler, so
+ // we don't handle it here.
+ var names = export.exportedNames!;
for (var name in names) {
- var alias = name.asName ?? name.name;
+ var alias = name.asName ?? name.name!;
statements.add(
js.statement('#.# = #;', [exportsVar, alias.name, name.name]));
}
@@ -366,12 +366,12 @@
Identifier moduleVar, ImportDeclaration import) {
var items = <Statement>[];
- for (var importName in import.namedImports) {
+ for (var importName in import.namedImports!) {
// import * is not emitted by the compiler, so we don't handle it here.
assert(!importName.isStar);
var asName = importName.asName ?? importName.name;
items.add(js.statement(
- 'const # = #.#', [asName, moduleVar, importName.name.name]));
+ 'const # = #.#', [asName, moduleVar, importName.name!.name]));
}
return items;
}
@@ -383,12 +383,12 @@
if (exports.isNotEmpty) {
var exportedProps = <Property>[];
for (var export in exports) {
- var names = export.exportedNames;
- // export * is not emitted by the compiler, so we don't handle it here.
- assert(names != null);
+ // export * (exportedNames is null) is not emitted by the compiler, so
+ // we don't handle it here.
+ var names = export.exportedNames!;
for (var name in names) {
- var alias = name.asName ?? name.name;
- exportedProps.add(Property(js.string(alias.name), name.name));
+ var alias = name.asName ?? name.name!;
+ exportedProps.add(Property(js.string(alias.name), name.name!));
}
}
items.add(js.comment('Exports:'));
@@ -403,7 +403,7 @@
/// compilation, in order to include all the context needed for evaluation
/// inside it.
///
- /// Returns a new function that combines all statements from tranformed
+ /// Returns a new function that combines all statements from transformed
/// imports from [items] and the body of the [function].
Fun buildFunctionWithImports(List<ModuleItem> items, Fun function) {
clear();
@@ -442,14 +442,14 @@
importStatements.addAll(buildImports(moduleVar, import));
}
- // Prepend import statetements.
+ // Prepend import statements.
statements.insertAll(0, importStatements);
// Append export statements.
statements.addAll(buildExports(exports));
var resultModule = NamedFunction(
- loadFunctionIdentifier(module.name),
+ loadFunctionIdentifier(module.name!),
js.fun("function(#) { 'use strict'; #; }", [fnParams, statements]),
true);
var block = js.statement(
diff --git a/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart b/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart
index fd2b9c8..924057d0 100644
--- a/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart
+++ b/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart
@@ -2,9 +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.
-// @dart = 2.9
-
import 'dart:collection';
+
import 'package:meta/meta.dart';
import '../compiler/js_names.dart' as js_ast;
@@ -16,12 +15,13 @@
///
/// This class should only implement functionality that depends purely on JS
/// classes, rather than on Analyzer/Kernel types.
-abstract class SharedCompiler<Library, Class, InterfaceType, FunctionNode> {
+abstract class SharedCompiler<Library extends Object, Class extends Object,
+ InterfaceType extends Object, FunctionNode extends Object> {
/// When inside a `[]=` operator, this will be a non-null value that should be
/// returned by any `return;` statement.
///
/// This lets DDC use the setter method's return value directly.
- final List<js_ast.Identifier> _operatorSetResultStack = [];
+ final List<js_ast.Identifier?> _operatorSetResultStack = [];
/// Private member names in this module, organized by their library.
final _privateNames = HashMap<Library, HashMap<String, js_ast.TemporaryId>>();
@@ -48,7 +48,7 @@
/// Incremental mode for expression compilation.
///
- /// If set to true, triggers emitting tall used ypes, symbols, libraries,
+ /// If set to true, triggers emitting all used types, symbols, libraries,
/// constants, urs inside the generated function.
bool _incrementalMode = false;
@@ -75,27 +75,27 @@
@protected
void setEmitIfIncrementalLibrary(Library library) {
- if (incrementalMode && library != null) {
+ if (incrementalMode) {
setEmitIfIncremental(libraryToModule(library), jsLibraryName(library));
}
}
@protected
void setEmitIfIncremental(String module, String library) {
- if (incrementalMode && library != null) {
+ if (incrementalMode) {
incrementalModules.putIfAbsent(module, () => {}).add(library);
}
}
/// The identifier used to reference DDC's core "dart:_runtime" library from
/// generated JS code, typically called "dart" e.g. `dart.dcall`.
- js_ast.Identifier runtimeModule;
+ late js_ast.Identifier runtimeModule;
/// The identifier used to reference DDC's "extension method" symbols, used to
/// safely add Dart-specific member names to JavaScript classes, such as
/// primitive types (e.g. String) or DOM types in "dart:html".
@protected
- js_ast.Identifier extensionSymbolsModule;
+ late js_ast.Identifier extensionSymbolsModule;
/// Whether we're currently building the SDK, which may require special
/// bootstrapping logic.
@@ -103,14 +103,14 @@
/// This is initialized by [emitModule], which must be called before
/// accessing this field.
@protected
- bool isBuildingSdk;
+ bool isBuildingSdk = false;
/// Whether or not to move top level symbols into top-level containers.
///
/// This is set in both [emitModule] and [emitLibrary].
/// Depends on [isBuildingSdk].
@protected
- bool containerizeSymbols;
+ bool containerizeSymbols = false;
/// The temporary variable that stores named arguments (these are passed via a
/// JS object literal, to match JS conventions).
@@ -138,7 +138,7 @@
/// The current library being compiled.
@protected
- Library get currentLibrary;
+ Library? get currentLibrary;
/// The library for dart:core in the SDK.
@protected
@@ -150,7 +150,7 @@
/// The current function being compiled, if any.
@protected
- FunctionNode get currentFunction;
+ FunctionNode? get currentFunction;
/// Choose a canonical name from the [library] element.
@protected
@@ -164,7 +164,7 @@
/// This never uses the library's name (the identifier in the `library`
/// declaration) as it doesn't have any meaningful rules enforced.
@protected
- String jsLibraryAlias(Library library);
+ String? jsLibraryAlias(Library library);
/// Debugger friendly name for a Dart [library].
@protected
@@ -178,6 +178,10 @@
@protected
String libraryToModule(Library library);
+ /// Returns true if [library] is identified by [name].
+ @protected
+ bool isDartLibrary(Library library, String name);
+
/// Returns true if the library [l] is "dart:_runtime".
@protected
bool isSdkInternalRuntime(Library l);
@@ -193,7 +197,7 @@
/// When compiling the body of a `operator []=` method, this will be non-null
/// and will indicate the value that should be returned from any `return;`
/// statements.
- js_ast.Identifier get _operatorSetResult {
+ js_ast.Identifier? get _operatorSetResult {
var stack = _operatorSetResultStack;
return stack.isEmpty ? null : stack.last;
}
@@ -203,7 +207,7 @@
///
/// See also [exitFunction] and [emitReturnStatement].
@protected
- void enterFunction(String name, List<js_ast.Parameter> formals,
+ void enterFunction(String? name, List<js_ast.Parameter> formals,
bool Function() isLastParamMutated) {
if (name == '[]=') {
_operatorSetResultStack.add(isLastParamMutated()
@@ -217,8 +221,7 @@
/// Called when finished emitting methods/functions, and must correspond to a
/// previous [enterFunction] call.
@protected
- js_ast.Block exitFunction(
- String name, List<js_ast.Parameter> formals, js_ast.Block code) {
+ js_ast.Block exitFunction(List<js_ast.Parameter> formals, js_ast.Block code) {
var setOperatorResult = _operatorSetResultStack.removeLast();
if (setOperatorResult != null) {
// []= methods need to return the value. We could also address this at
@@ -242,7 +245,7 @@
/// Emits a return statement `return <value>;`, handling special rules for
/// the `operator []=` method.
@protected
- js_ast.Statement emitReturnStatement(js_ast.Expression value) {
+ js_ast.Statement emitReturnStatement(js_ast.Expression? value) {
if (_operatorSetResult != null) {
var result = js_ast.Return(_operatorSetResult);
return value != null
@@ -264,7 +267,7 @@
/// dart.asInt(<expr>)
///
@protected
- js_ast.Expression runtimeCall(String code, [List<Object> args]) {
+ js_ast.Expression runtimeCall(String code, [List<Object>? args]) {
setEmitIfIncremental(libraryToModule(coreLibrary), runtimeModule.name);
return js.call('#.$code', <Object>[runtimeModule, ...?args]);
}
@@ -272,7 +275,7 @@
/// Calls [runtimeCall] and uses `toStatement()` to convert the resulting
/// expression into a statement.
@protected
- js_ast.Statement runtimeStatement(String code, [List<Object> args]) =>
+ js_ast.Statement runtimeStatement(String code, [List<Object>? args]) =>
runtimeCall(code, args).toStatement();
/// Emits a private name JS Symbol for [name] scoped to the Dart [library].
@@ -290,7 +293,7 @@
/// top-level variables (see callers to this method).
@protected
js_ast.TemporaryId emitPrivateNameSymbol(Library library, String name,
- [js_ast.TemporaryId id]) {
+ [js_ast.TemporaryId? id]) {
/// Initializes the JS `Symbol` for the private member [name] in [library].
///
/// If the library is in the current JS module ([_libraries] contains it),
@@ -307,21 +310,21 @@
js_ast.TemporaryId initPrivateNameSymbol() {
var idName = name.endsWith('=') ? name.replaceAll('=', '_') : name;
idName = idName.replaceAll(js_ast.invalidCharInIdentifier, '_');
- id ??= js_ast.TemporaryId(idName);
+ var identifier = id ?? js_ast.TemporaryId(idName);
addSymbol(
- id,
+ identifier,
runtimeCall('privateName(#, #)',
[emitLibraryName(library), js.string(name)]));
if (!containerizeSymbols) {
// TODO(vsm): Change back to `const`.
// See https://github.com/dart-lang/sdk/issues/40380.
moduleItems.add(js.statement('var # = #', [
- id,
+ identifier,
runtimeCall(
'privateName(#, #)', [emitLibraryName(library), js.string(name)])
]));
}
- return id;
+ return identifier;
}
var privateNames = _privateNames.putIfAbsent(library, () => HashMap());
@@ -339,7 +342,7 @@
///
/// This will use `className.name = value` if possible, otherwise it will use
/// `dart.defineValue(className, name, value)`. This is required when
- /// `FunctionNode.prototype` already defins a getters with the same name.
+ /// `FunctionNode.prototype` already defines a getters with the same name.
@protected
js_ast.Expression defineValueOnClass(Class c, js_ast.Expression className,
js_ast.Expression nameExpr, js_ast.Expression value) {
@@ -372,10 +375,10 @@
/// [canonicalizeConstObject] can be used for class instances; it will wrap
/// the expression in `dart.const` and then call this method.
///
- /// If the same consant is used elsewhere (in this module, or another module),
- /// that will require a second canonicalization. In general it is uncommon
- /// to define the same large constant (such as lists, maps) in different
- /// locations, because that requires copy+paste, so in practice this
+ /// If the same constant is used elsewhere (in this module, or another
+ /// module), that will require a second canonicalization. In general it is
+ /// uncommon to define the same large constant (such as lists, maps) in
+ /// different locations, because that requires copy+paste, so in practice this
/// optimization is rather effective (we should consider caching once
/// per-module, though, as that would be relatively easy for the compiler to
/// implement once we have a single Kernel backend).
@@ -400,7 +403,7 @@
js_ast.Expression result;
if (last.startsWith('_')) {
var nativeSymbolAccessor =
- getSymbol(emitPrivateNameSymbol(currentLibrary, last));
+ getSymbol(emitPrivateNameSymbol(currentLibrary!, last));
result = js.call('new #.new(#, #)', [
emitConstructorAccess(privateSymbolType),
name,
@@ -531,7 +534,7 @@
modules.putIfAbsent(libraryToModule(import), () => []).add(import);
}
- String coreModuleName;
+ String? coreModuleName;
if (!_libraries.containsKey(coreLibrary)) {
coreModuleName = libraryToModule(coreLibrary);
}
@@ -552,7 +555,7 @@
var imports = <js_ast.NameSpecifier>[];
for (var library in libraries) {
if (!incrementalMode ||
- usedLibraries.contains(jsLibraryName(library))) {
+ usedLibraries!.contains(jsLibraryName(library))) {
var alias = jsLibraryAlias(library);
if (alias != null) {
var aliasId = js_ast.TemporaryId(alias);
@@ -565,11 +568,11 @@
}
if (module == coreModuleName) {
- if (!incrementalMode || usedLibraries.contains(runtimeModule.name)) {
+ if (!incrementalMode || usedLibraries!.contains(runtimeModule.name)) {
imports.add(js_ast.NameSpecifier(runtimeModule));
}
if (!incrementalMode ||
- usedLibraries.contains(extensionSymbolsModule.name)) {
+ usedLibraries!.contains(extensionSymbolsModule.name)) {
imports.add(js_ast.NameSpecifier(extensionSymbolsModule));
}
}
@@ -709,7 +712,7 @@
/// Returns the raw JS value associated with [id].
js_ast.Expression getSymbolValue(js_ast.Identifier id) {
_symbolContainer.setEmitIfIncremental(id);
- return _symbolContainer[id];
+ return _symbolContainer[id]!;
}
/// Inserts a symbol into the symbol table.
@@ -719,10 +722,10 @@
if (!containerizeSymbols) {
_symbolContainer.setNoEmit(id);
}
- return _symbolContainer[id];
+ return _symbolContainer[id]!;
}
- /// Finishes the module created by [startModule], by combining the preable
+ /// Finishes the module created by [startModule], by combining the preamble
/// [items] with the [moduleItems] that have been emitted.
///
/// The [moduleName] should specify the module's name, and the items should
@@ -759,7 +762,7 @@
for (var item in items) {
if (item is js_ast.Block && !item.isScope) {
_copyAndFlattenBlocks(result, item.statements);
- } else if (item != null) {
+ } else {
result.add(item);
}
}
@@ -779,7 +782,7 @@
_extensionSymbols[name] = id;
addSymbol(id, id);
}
- var symbolId = _extensionSymbols[name];
+ var symbolId = _extensionSymbols[name]!;
_symbolContainer.setEmitIfIncremental(symbolId);
return symbolId;
}
@@ -806,9 +809,7 @@
/// Whether a variable with [name] is referenced in the [node].
bool variableIsReferenced(String name, js_ast.Node node) {
- var finder = _IdentifierFinder.instance;
- finder.nameToFind = name;
- finder.found = false;
+ var finder = _IdentifierFinder.instance(name);
node.accept(finder);
return finder.found;
}
@@ -817,7 +818,13 @@
String nameToFind;
bool found = false;
- static final instance = _IdentifierFinder();
+ _IdentifierFinder(this.nameToFind);
+
+ static final _instance = _IdentifierFinder('');
+
+ factory _IdentifierFinder.instance(String nameToFind) => _instance
+ ..nameToFind = nameToFind
+ ..found = false;
@override
void visitIdentifier(node) {
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index 506b32d..2b3a91d 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -9,6 +9,7 @@
import 'dart:math' show max, min;
import 'package:front_end/src/api_unstable/ddc.dart';
+import 'package:js_shared/synced/embedded_names.dart' show JsGetName, JsBuiltin;
import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/core_types.dart';
import 'package:kernel/kernel.dart';
@@ -368,6 +369,17 @@
// Initialize library variables.
isBuildingSdk = libraries.any(isSdkInternalRuntime);
+ // TODO(48585) Remove after new type system has landed.
+ if (isBuildingSdk && !_options.newRuntimeTypes) {
+ libraries.removeWhere((library) {
+ var path = library.importUri.path;
+ return path == '_js_shared_embedded_names' ||
+ path == '_js_names' ||
+ path == '_recipe_syntax' ||
+ path == '_rti';
+ });
+ }
+
// For runtime performance reasons, we only containerize SDK symbols in web
// libraries. Otherwise, we use a 600-member cutoff before a module is
// containerized. This is somewhat arbitrary but works promisingly for the
@@ -475,6 +487,8 @@
if (!isBuildingSdk) {
items.add(
runtimeStatement('_checkModuleNullSafetyMode(#)', [soundNullSafety]));
+ items.add(runtimeStatement('_checkModuleRuntimeTypes(#)',
+ [js_ast.LiteralBool(_options.newRuntimeTypes)]));
}
// Emit the hoisted type table cache variables
@@ -519,9 +533,16 @@
library.parts.map((part) => part.partUri);
/// True when [library] is the sdk internal library 'dart:_internal'.
- bool _isDartInternal(Library library) {
+ bool _isDartInternal(Library library) => isDartLibrary(library, '_internal');
+
+ /// True when [library] is the sdk internal library 'dart:_internal'.
+ bool _isDartForeignHelper(Library library) =>
+ isDartLibrary(library, '_foreign_helper');
+
+ @override
+ bool isDartLibrary(Library library, String name) {
var importUri = library.importUri;
- return importUri.isScheme('dart') && importUri.path == '_internal';
+ return importUri.isScheme('dart') && importUri.path == name;
}
@override
@@ -559,6 +580,12 @@
}
if (isSdkInternalRuntime(library)) {
+ if (_options.newRuntimeTypes) {
+ // Add embedded globals.
+ moduleItems.add(
+ runtimeCall('typeUniverse = #', [js_ast.createRtiUniverse()])
+ .toStatement());
+ }
// `dart:_runtime` uses a different order for bootstrapping.
//
// Functions are first because we use them to associate type info
@@ -625,7 +652,11 @@
_currentLibrary = c.enclosingLibrary;
_currentUri = c.fileUri;
- moduleItems.add(_emitClassDeclaration(c));
+ // Mixins are unrolled in _defineClass.
+ // If this class is annotated with `@JS`, then there is nothing to emit.
+ if (!c.isAnonymousMixin && !hasJSInteropAnnotation(c)) {
+ moduleItems.add(_emitClassDeclaration(c));
+ }
// The const table depends on dart.defineLazy, so emit it after the SDK.
if (isSdkInternalRuntime(_currentLibrary)) {
@@ -660,12 +691,6 @@
js_ast.TemporaryId(js_ast.toJSIdentifier(name));
js_ast.Statement _emitClassDeclaration(Class c) {
- // Mixins are unrolled in _defineClass.
- if (c.isAnonymousMixin) return null;
-
- // If this class is annotated with `@JS`, then there is nothing to emit.
- if (findAnnotation(c, isPublicJSAnnotation) != null) return null;
-
// Generic classes will be defined inside a function that closes over the
// type parameter. So we can use their local variable name directly.
//
@@ -3406,7 +3431,7 @@
? _emitSyncFunctionBody(f, name)
: _emitGeneratorFunctionBody(f, name);
- block = super.exitFunction(name, formals, block);
+ block = super.exitFunction(formals, block);
return js_ast.Fun(formals, block);
}
@@ -5535,17 +5560,45 @@
if (isInlineJS(target)) return _emitInlineJSCode(node) as js_ast.Expression;
if (target.isFactory) return _emitFactoryInvocation(node);
- // Optimize some internal SDK calls.
- if (_isDartInternal(target.enclosingLibrary)) {
+ var enclosingLibrary = target.enclosingLibrary;
+ if (_isDartInternal(enclosingLibrary)) {
var args = node.arguments;
if (args.positional.length == 1 &&
args.types.length == 1 &&
args.named.isEmpty &&
target.name.text == 'unsafeCast') {
+ // Optimize some internal SDK calls by avoiding the insertion of a
+ // runtime cast.
return args.positional.single.accept(this);
}
}
- if (isSdkInternalRuntime(target.enclosingLibrary)) {
+
+ if (_isDartForeignHelper(enclosingLibrary)) {
+ var args = node.arguments.positional;
+ var name = target.name.text;
+
+ if (args.length == 1) {
+ if (name == 'JS_GET_NAME') {
+ var staticGet = args.single as StaticGet;
+ var enumField = staticGet.target as Field;
+ return _emitNameForJsGetName(asJsGetName(enumField));
+ }
+ } else if (args.length == 2) {
+ if (name == 'JS_EMBEDDED_GLOBAL') return _emitEmbeddedGlobal(node);
+ if (name == 'JS_STRING_CONCAT') {
+ var left = _visitExpression(args.first);
+ var right = _visitExpression(args.last);
+ return js.call('# + #', [left, right]);
+ }
+ }
+ if (name == 'JS_BUILTIN') {
+ var staticGet = args[1] as StaticGet;
+ var enumField = staticGet.target as Field;
+ return _emitOperationForJsBuiltIn(asJsBuiltin(enumField));
+ }
+ }
+
+ if (isSdkInternalRuntime(enclosingLibrary)) {
var name = target.name.text;
if (node.arguments.positional.isEmpty &&
node.arguments.types.length == 1) {
@@ -5577,6 +5630,9 @@
if (flagName == 'soundNullSafety') {
return js.boolean(_options.soundNullSafety);
}
+ if (flagName == 'newRuntimeTypes') {
+ return js.boolean(_options.newRuntimeTypes);
+ }
throw UnsupportedError('Invalid flag in call to $name: $flagName');
}
} else if (node.arguments.positional.length == 2) {
@@ -5762,6 +5818,62 @@
return result.withSourceInformation(_nodeStart(node));
}
+ js_ast.Expression _emitEmbeddedGlobal(StaticInvocation node) {
+ var constantExpression = node.arguments.positional[1] as ConstantExpression;
+ var name = constantExpression.constant as StringConstant;
+ return runtimeCall('#', [name.value]);
+ }
+
+ /// Returns the string literal that is to be used as the result of a call to
+ /// [JS_GET_NAME] for [name].
+ js_ast.LiteralString _emitNameForJsGetName(JsGetName name) {
+ switch (name) {
+ case JsGetName.OPERATOR_IS_PREFIX:
+ return js.string(js_ast.FixedNames.operatorIsPrefix);
+ case JsGetName.SIGNATURE_NAME:
+ return js.string(js_ast.FixedNames.operatorSignature);
+ case JsGetName.RTI_NAME:
+ return js.string(js_ast.FixedNames.rtiName);
+ case JsGetName.FUTURE_CLASS_TYPE_NAME:
+ return js.string(js_ast.FixedNames.futureClassName);
+ case JsGetName.LIST_CLASS_TYPE_NAME:
+ return js.string(js_ast.FixedNames.listClassName);
+ case JsGetName.RTI_FIELD_AS:
+ return js.string(js_ast.FixedNames.rtiAsField);
+ case JsGetName.RTI_FIELD_IS:
+ return js.string(js_ast.FixedNames.rtiIsField);
+ default:
+ throw UnsupportedError('JsGetName has no name for "$name".');
+ }
+ }
+
+ /// Returns the expression that is to be used as the result of a call to
+ /// [JS_BUILTIN] for [builtin].
+ js_ast.Expression _emitOperationForJsBuiltIn(JsBuiltin builtin) {
+ switch (builtin) {
+ case JsBuiltin.dartClosureConstructor:
+ // TODO(48585) How to get constructor for a Dart Function?
+ return js.call('TODO');
+ case JsBuiltin.dartObjectConstructor:
+ // TODO(48585) How to get constructor for a Dart Object?
+ return js.call('TODO');
+ default:
+ throw UnsupportedError('JsBuiltin has no operation for "$builtin".');
+ }
+ }
+
+ String _enumValueName(Field field) {
+ var enumName = field.enclosingClass.name;
+ var valueName = field.name.text;
+ return '$enumName.$valueName';
+ }
+
+ JsGetName asJsGetName(Field field) => JsGetName.values
+ .firstWhere((val) => val.toString() == _enumValueName(field));
+
+ JsBuiltin asJsBuiltin(Field field) => JsBuiltin.values
+ .firstWhere((val) => val.toString() == _enumValueName(field));
+
bool _isWebLibrary(Uri importUri) =>
importUri != null &&
importUri.isScheme('dart') &&
diff --git a/pkg/dev_compiler/lib/src/kernel/kernel_helpers.dart b/pkg/dev_compiler/lib/src/kernel/kernel_helpers.dart
index fa868d9..0576c6f 100644
--- a/pkg/dev_compiler/lib/src/kernel/kernel_helpers.dart
+++ b/pkg/dev_compiler/lib/src/kernel/kernel_helpers.dart
@@ -203,9 +203,13 @@
}
bool isInlineJS(Member e) =>
- e is Procedure &&
- e.name.text == 'JS' &&
- e.enclosingLibrary.importUri.toString() == 'dart:_foreign_helper';
+ e is Procedure && _isProcedureFromForeignHelper('JS', e);
+
+/// Returns `true` if [p] is the procedure named [name] from the
+/// 'dart:_foreign_helper' library.
+bool _isProcedureFromForeignHelper(String name, Procedure p) =>
+ p.name.text == name &&
+ p.enclosingLibrary.importUri.toString() == 'dart:_foreign_helper';
/// Whether the parameter [p] is covariant (either explicitly `covariant` or
/// implicitly due to generics) and needs a check for soundness.
diff --git a/pkg/dev_compiler/lib/src/kernel/target.dart b/pkg/dev_compiler/lib/src/kernel/target.dart
index 9bddfc7..0a3e3ff 100644
--- a/pkg/dev_compiler/lib/src/kernel/target.dart
+++ b/pkg/dev_compiler/lib/src/kernel/target.dart
@@ -57,6 +57,9 @@
@override
List<String> get extraRequiredLibraries => const [
'dart:_runtime',
+ 'dart:_js_shared_embedded_names',
+ 'dart:_recipe_syntax',
+ 'dart:_rti',
'dart:_dart2js_runtime_metrics',
'dart:_debugger',
'dart:_foreign_helper',
@@ -64,6 +67,7 @@
'dart:_internal',
'dart:_isolate_helper',
'dart:_js_helper',
+ 'dart:_js_names',
'dart:_js_primitives',
'dart:_metadata',
'dart:_native_typed_data',
@@ -103,6 +107,7 @@
'dart:_js_helper',
'dart:_native_typed_data',
'dart:_runtime',
+ 'dart:_rti',
];
@override
diff --git a/pkg/dev_compiler/pubspec.yaml b/pkg/dev_compiler/pubspec.yaml
index 5ec84aa..1acbb51 100644
--- a/pkg/dev_compiler/pubspec.yaml
+++ b/pkg/dev_compiler/pubspec.yaml
@@ -5,6 +5,7 @@
environment:
sdk: '>=2.15.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
_fe_analyzer_shared: any
_js_interop_checks: any
@@ -14,12 +15,14 @@
build_integration: any
collection: any
front_end: any
+ js_shared: any
kernel: any
meta: any
path: any
source_maps: any
source_span: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
browser_launcher: any
expect: any
diff --git a/pkg/dev_compiler/test/sourcemap/ddc_common.dart b/pkg/dev_compiler/test/sourcemap/ddc_common.dart
index b090d76..6653e57 100644
--- a/pkg/dev_compiler/test/sourcemap/ddc_common.dart
+++ b/pkg/dev_compiler/test/sourcemap/ddc_common.dart
@@ -104,8 +104,7 @@
var result = name;
if (result.startsWith('new ')) result = result.substring(4);
if (result.startsWith('Object.')) result = result.substring(7);
- var inputName =
- INPUT_FILE_NAME.substring(0, INPUT_FILE_NAME.indexOf('.') + 1);
+ var inputName = inputFileName.substring(0, inputFileName.indexOf('.') + 1);
if (result.startsWith(inputName)) {
result = result.substring(inputName.length);
}
diff --git a/pkg/expect/pubspec.yaml b/pkg/expect/pubspec.yaml
index e231d0c..5f045c2 100644
--- a/pkg/expect/pubspec.yaml
+++ b/pkg/expect/pubspec.yaml
@@ -11,6 +11,7 @@
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
meta: any
smith: any
diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
index 3bfd9d3..bc70279 100644
--- a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
+++ b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
@@ -125,7 +125,7 @@
static const ExperimentalFlag inferenceUpdate1 = const ExperimentalFlag(
name: 'inference-update-1',
- isEnabledByDefault: false,
+ isEnabledByDefault: true,
isExpired: false,
enabledVersion: const Version(2, 18),
experimentEnabledVersion: const Version(2, 18),
diff --git a/pkg/front_end/lib/src/fasta/util/outline_extractor.dart b/pkg/front_end/lib/src/fasta/util/outline_extractor.dart
index d1f5d0a..011171f 100644
--- a/pkg/front_end/lib/src/fasta/util/outline_extractor.dart
+++ b/pkg/front_end/lib/src/fasta/util/outline_extractor.dart
@@ -78,9 +78,18 @@
..packagesFileUri = packages
..sdkSummary = platform
..sdkRoot = sdk;
- ProcessedOptions pOptions =
+ ProcessedOptions processedOptions =
new ProcessedOptions(options: options, inputs: entryPointUris);
- return CompilerContext.runWithOptions(pOptions, (CompilerContext c) async {
+ return extractOutlineWithProcessedOptions(entryPointUris,
+ verbosityLevel: verbosityLevel, processedOptions: processedOptions);
+}
+
+Future<Map<Uri, String>> extractOutlineWithProcessedOptions(
+ List<Uri> entryPointUris,
+ {int verbosityLevel: 0,
+ required ProcessedOptions processedOptions}) {
+ return CompilerContext.runWithOptions(processedOptions,
+ (CompilerContext c) async {
FileSystem fileSystem = c.options.fileSystem;
UriTranslator uriTranslator = await c.options.getUriTranslator();
_Processor processor =
@@ -208,17 +217,26 @@
await _premarkTopLevel(worklist, closed, partTopLevel);
}
} else if (child is Export) {
- for (Uri importedUri in child.uris) {
- if (!importedUri.isScheme("dart")) {
- TopLevel exportTopLevel =
- parsed[importedUri] ?? await preprocessUri(importedUri);
- await _premarkTopLevel(worklist, closed, exportTopLevel);
- }
+ for (Uri exportedUri in child.uris) {
+ if (exportedUri.isScheme("dart")) continue;
+ // E.g. conditional exports could point to non-existing files.
+ if (!await _exists(exportedUri)) continue;
+ TopLevel exportTopLevel =
+ parsed[exportedUri] ?? await preprocessUri(exportedUri);
+ await _premarkTopLevel(worklist, closed, exportTopLevel);
}
}
}
}
+ Future<bool> _exists(Uri uri) {
+ Uri fileUri = uri;
+ if (fileUri.isScheme("package")) {
+ fileUri = uriTranslator.translate(fileUri)!;
+ }
+ return fileSystem.entityForUri(fileUri).exists();
+ }
+
Future<List<TopLevel>> _preprocessImportsAsNeeded(
Map<TopLevel, List<TopLevel>> imports, TopLevel topLevel) async {
List<TopLevel>? imported = imports[topLevel];
@@ -230,11 +248,13 @@
if (child is Import) {
child.marked = Coloring.Marked;
for (Uri importedUri in child.uris) {
- if (!importedUri.isScheme("dart")) {
- TopLevel importedTopLevel =
- parsed[importedUri] ?? await preprocessUri(importedUri);
- imported.add(importedTopLevel);
- }
+ if (importedUri.isScheme("dart")) continue;
+ // E.g. conditional imports could point to non-existing files.
+ if (!await _exists(importedUri)) continue;
+
+ TopLevel importedTopLevel =
+ parsed[importedUri] ?? await preprocessUri(importedUri);
+ imported.add(importedTopLevel);
}
} else if (child is PartOf) {
child.marked = Coloring.Marked;
@@ -399,10 +419,11 @@
} else if (child is Export) {
child.marked = Coloring.Marked;
// do stuff to export.
- for (Uri importedUri in child.uris) {
- if (!importedUri.isScheme("dart")) {
- other = parsed[importedUri] ?? await preprocessUri(importedUri);
- }
+ for (Uri exportedUri in child.uris) {
+ if (exportedUri.isScheme("dart")) continue;
+ // E.g. conditional exports could point to non-existing files.
+ if (!await _exists(exportedUri)) continue;
+ other = parsed[exportedUri] ?? await preprocessUri(exportedUri);
}
} else if (child is Extension) {
// TODO: Maybe put on a list to process later and only include if
@@ -645,16 +666,12 @@
currentContainer.addChild(classFactoryMethod, map);
log("Hello from factory method ${ids.first.token}.${ids.last.token}");
} else {
- Container findTopLevel = currentContainer;
- while (findTopLevel is! TopLevel) {
- findTopLevel = findTopLevel.parent!;
- }
- String src = findTopLevel.sourceText
- .substring(startInclusive.charOffset, endInclusive.charEnd);
- throw "Unexpected identifiers in class factory method: $ids "
- "(${ids.map((e) => e.token.lexeme).toList()}) --- "
- "error on source ${src} --- "
- "${node.children}";
+ debugDumpSource(
+ startInclusive,
+ endInclusive,
+ node,
+ "Unexpected identifiers in class factory method: $ids "
+ "(${ids.map((e) => e.token.lexeme).toList()}).");
}
super.visitClassFactoryMethod(node, startInclusive, endInclusive);
@@ -678,20 +695,7 @@
ClassMethodEnd node, Token startInclusive, Token endInclusive) {
assert(currentContainer is Class);
- String identifier;
- try {
- identifier = node.getNameIdentifier();
- } catch (e) {
- Container findTopLevel = currentContainer;
- while (findTopLevel is! TopLevel) {
- findTopLevel = findTopLevel.parent!;
- }
- String src = findTopLevel.sourceText
- .substring(startInclusive.charOffset, endInclusive.charEnd);
- throw "Unexpected identifiers in visitClassMethod --- "
- "error on source ${src} --- "
- "${node.children}";
- }
+ String identifier = node.getNameIdentifier();
ClassMethod classMethod =
new ClassMethod(node, identifier, startInclusive, endInclusive);
currentContainer.addChild(classMethod, map);
@@ -701,18 +705,16 @@
@override
void visitEnum(EnumEnd node, Token startInclusive, Token endInclusive) {
+ TopLevelDeclarationEnd parent = node.parent! as TopLevelDeclarationEnd;
+ IdentifierHandle identifier = parent.getIdentifier();
List<IdentifierHandle> ids = node.getIdentifiers();
- Enum e = new Enum(
- node,
- ids.first.token.lexeme,
- ids.skip(1).map((e) => e.token.lexeme).toList(),
- startInclusive,
- endInclusive);
+ Enum e = new Enum(node, identifier.token.lexeme,
+ ids.map((e) => e.token.lexeme).toList(), startInclusive, endInclusive);
currentContainer.addChild(e, map);
- log("Hello from enum ${ids.first.token} with content "
- "${ids.skip(1).map((e) => e.token).join(", ")}");
+ log("Hello from enum ${identifier.token} with content "
+ "${ids.map((e) => e.token).join(", ")}");
super.visitEnum(node, startInclusive, endInclusive);
}
@@ -790,6 +792,19 @@
super.visitExtensionMethod(node, startInclusive, endInclusive);
}
+ void debugDumpSource(Token startInclusive, Token endInclusive,
+ ParserAstNode node, String message) {
+ Container findTopLevel = currentContainer;
+ while (findTopLevel is! TopLevel) {
+ findTopLevel = findTopLevel.parent!;
+ }
+ String src = findTopLevel.sourceText
+ .substring(startInclusive.charOffset, endInclusive.charEnd);
+ throw "Error on source ${src} --- \n\n"
+ "$message ---\n\n"
+ "${node.children}";
+ }
+
@override
void visitImport(ImportEnd node, Token startInclusive, Token? endInclusive) {
IdentifierHandle? prefix = node.getImportPrefix();
@@ -904,6 +919,7 @@
void visitPartOf(PartOfEnd node, Token startInclusive, Token endInclusive) {
// We'll assume we've gotten here via a "part" so we'll ignore that for now.
// TODO: partOfUri could - in an error case - be null.
+ if (partOfUri == null) throw "partOfUri is null -- uri $uri";
PartOf partof = new PartOf(node, partOfUri!, startInclusive, endInclusive);
partof.marked = Coloring.Marked;
currentContainer.addChild(partof, map);
diff --git a/pkg/front_end/lib/src/fasta/util/parser_ast.dart b/pkg/front_end/lib/src/fasta/util/parser_ast.dart
index 3b131cf..f30a4a8 100644
--- a/pkg/front_end/lib/src/fasta/util/parser_ast.dart
+++ b/pkg/front_end/lib/src/fasta/util/parser_ast.dart
@@ -1293,7 +1293,8 @@
for (ParserAstNode child in children!) {
if (child is TypeHandle ||
child is NoTypeHandle ||
- child is VoidKeywordHandle) {
+ child is VoidKeywordHandle ||
+ child is FunctionTypeEnd) {
foundType = true;
}
if (foundType && child is IdentifierHandle) {
@@ -1312,7 +1313,8 @@
for (ParserAstNode child in children!) {
if (child is TypeHandle ||
child is NoTypeHandle ||
- child is VoidKeywordHandle) {
+ child is VoidKeywordHandle ||
+ child is FunctionTypeEnd) {
foundType = true;
}
if (foundType && child is IdentifierHandle) {
diff --git a/pkg/front_end/outline_extraction_testcases/.packages b/pkg/front_end/outline_extraction_testcases/.packages
new file mode 100644
index 0000000..68325fa
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/.packages
@@ -0,0 +1 @@
+# dummy
\ No newline at end of file
diff --git a/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/exists.dart b/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/exists.dart
new file mode 100644
index 0000000..45a8112
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/exists.dart
@@ -0,0 +1,3 @@
+export 'nonexisting.dart' if (dart.library.io) 'exists2.dart';
+
+class Foo {}
diff --git a/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/exists2.dart b/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/exists2.dart
new file mode 100644
index 0000000..8c26988
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/exists2.dart
@@ -0,0 +1 @@
+class Foo2 {}
diff --git a/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/main.dart b/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/main.dart
new file mode 100644
index 0000000..90e030f
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/main.dart
@@ -0,0 +1,8 @@
+import 'nonexisting.dart' if (dart.library.io) 'exists.dart';
+export 'nonexisting.dart'
+ if (dart.library.html) 'exists2.dart'
+ if (dart.library.io) 'exists.dart';
+
+Foo x() {
+ return new Foo();
+}
diff --git a/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/main.dart.outline_extracted b/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/main.dart.outline_extracted
new file mode 100644
index 0000000..b26416d
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/conditional_imports_exports_2/main.dart.outline_extracted
@@ -0,0 +1,17 @@
+org-dartlang-testcase:///main.dart:
+import 'nonexisting.dart' if (dart.library.io) 'exists.dart';
+export 'nonexisting.dart' if (dart.library.html) 'exists2.dart' if (dart.library.io) 'exists.dart';
+Foo x() {}
+
+
+
+
+org-dartlang-testcase:///exists2.dart:
+class Foo2 {}
+
+
+
+
+org-dartlang-testcase:///exists.dart:
+export 'nonexisting.dart' if (dart.library.io) 'exists2.dart';
+class Foo {}
diff --git a/pkg/front_end/outline_extraction_testcases/factories/.packages b/pkg/front_end/outline_extraction_testcases/factories/.packages
new file mode 100644
index 0000000..6607aec
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/factories/.packages
@@ -0,0 +1 @@
+foo:.
\ No newline at end of file
diff --git a/pkg/front_end/outline_extraction_testcases/named_import_with_export_and_named_constructor_and_class_type_parameter/.packages b/pkg/front_end/outline_extraction_testcases/named_import_with_export_and_named_constructor_and_class_type_parameter/.packages
new file mode 100644
index 0000000..6607aec
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/named_import_with_export_and_named_constructor_and_class_type_parameter/.packages
@@ -0,0 +1 @@
+foo:.
\ No newline at end of file
diff --git a/pkg/front_end/outline_extraction_testcases/split_import_export_part/.packages b/pkg/front_end/outline_extraction_testcases/split_import_export_part/.packages
new file mode 100644
index 0000000..d19a7e0
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/split_import_export_part/.packages
@@ -0,0 +1 @@
+foobar:.
\ No newline at end of file
diff --git a/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_2/foo.dart b/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_2/foo.dart
index bd036e7..e48bd35 100644
--- a/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_2/foo.dart
+++ b/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_2/foo.dart
@@ -10,6 +10,8 @@
int get giveInt => 42;
}
+// The below doesn't have to be included.
+
extension BarExtension on Bar {
int get giveInt => 42;
}
diff --git a/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_3/foo.dart b/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_3/foo.dart
new file mode 100644
index 0000000..b6168cc
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_3/foo.dart
@@ -0,0 +1,19 @@
+enum Foo {
+ a,
+ b,
+ c,
+ d,
+ e,
+}
+
+extension FooExtension on Foo {
+ Function(int) get foobar => (int value) => 42;
+}
+
+// The below doesn't have to be included.
+
+extension BarExtension on Bar {
+ Function(int) get foobar => (int value) => 42;
+}
+
+class Bar {}
diff --git a/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_3/main.dart b/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_3/main.dart
new file mode 100644
index 0000000..cf29838
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_3/main.dart
@@ -0,0 +1,5 @@
+import "foo.dart";
+
+final foo = [Foo.d, Foo.b];
+
+final foo2 = foo.map((f) => f.foobar).toList();
diff --git a/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_3/main.dart.outline_extracted b/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_3/main.dart.outline_extracted
new file mode 100644
index 0000000..29e4991
--- /dev/null
+++ b/pkg/front_end/outline_extraction_testcases/use_of_imported_extension_3/main.dart.outline_extracted
@@ -0,0 +1,17 @@
+org-dartlang-testcase:///main.dart:
+import "foo.dart";
+final foo = [Foo.d, Foo.b];
+final foo2 = foo.map((f) => f.foobar).toList();
+
+
+
+
+org-dartlang-testcase:///foo.dart:
+enum Foo { a, b, c, d, e, }
+extension FooExtension on Foo {
+ Function(int) get foobar => (int value) => 42;
+}
+extension BarExtension on Bar {
+ Function(int) get foobar => (int value) => 42;
+}
+class Bar {}
diff --git a/pkg/front_end/pubspec.yaml b/pkg/front_end/pubspec.yaml
index 780e0c6..aedd3be 100644
--- a/pkg/front_end/pubspec.yaml
+++ b/pkg/front_end/pubspec.yaml
@@ -8,27 +8,29 @@
environment:
sdk: '>=2.13.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
_fe_analyzer_shared: any
kernel: any
package_config: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
analyzer: any
args: any
async_helper: any
build_integration: any
compiler: any
- dart2wasm: any
dart_style: any
+ dart2wasm: any
dev_compiler: any
expect: any
json_rpc_2: any
path: any
- test: any
test_reflective_loader: any
+ test: any
testing: any
- vm: any
vm_service: any
+ vm: any
web_socket_channel: any
yaml: any
diff --git a/pkg/front_end/test/outline_extractor_suite.dart b/pkg/front_end/test/outline_extractor_suite.dart
index 02be7f5..4548f0c 100644
--- a/pkg/front_end/test/outline_extractor_suite.dart
+++ b/pkg/front_end/test/outline_extractor_suite.dart
@@ -100,13 +100,12 @@
@override
Future<Result<TestDescription>> run(
TestDescription description, Context context) async {
- Uri? packages = description.uri.resolve(".dart_tool/package_config.json");
+ Uri? packages = description.uri.resolve(".packages");
if (!new File.fromUri(packages).existsSync()) {
packages = null;
}
Map<Uri, String> result =
await extractOutline([description.uri], packages: packages);
-
StringBuffer sb = new StringBuffer();
Uri uri = description.uri;
Uri base = uri.resolve(".");
@@ -142,7 +141,7 @@
@override
Future<Result<TestDescription>> run(
TestDescription description, Context context) async {
- Uri? packages = description.uri.resolve(".dart_tool/package_config.json");
+ Uri? packages = description.uri.resolve(".packages");
if (!new File.fromUri(packages).existsSync()) {
packages = null;
}
diff --git a/pkg/front_end/test/unit_test_suites.dart b/pkg/front_end/test/unit_test_suites.dart
index c9acb09..20fd455 100644
--- a/pkg/front_end/test/unit_test_suites.dart
+++ b/pkg/front_end/test/unit_test_suites.dart
@@ -31,9 +31,10 @@
show createContext;
import 'incremental_suite.dart' as incremental show createContext;
import 'lint_suite.dart' as lint show createContext;
-import 'parser_suite.dart' as parser show createContext;
-import 'parser_equivalence_suite.dart' as parserEquivalence show createContext;
+import 'outline_extractor_suite.dart' as outline_extractor show createContext;
import 'parser_all_suite.dart' as parserAll show createContext;
+import 'parser_equivalence_suite.dart' as parserEquivalence show createContext;
+import 'parser_suite.dart' as parser show createContext;
import 'spelling_test_not_src_suite.dart' as spelling_not_src
show createContext;
import 'spelling_test_src_suite.dart' as spelling_src show createContext;
@@ -473,6 +474,12 @@
"../../testing.json",
shardCount: 1,
),
+ const Suite(
+ "outline_extractor",
+ outline_extractor.createContext,
+ "../testing.json",
+ shardCount: 1,
+ ),
];
const Duration timeoutDuration = Duration(minutes: 30);
diff --git a/pkg/frontend_server/pubspec.yaml b/pkg/frontend_server/pubspec.yaml
index 9ce3011..93b3740 100644
--- a/pkg/frontend_server/pubspec.yaml
+++ b/pkg/frontend_server/pubspec.yaml
@@ -6,6 +6,7 @@
environment:
sdk: "^2.15.0"
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
_fe_analyzer_shared: any
args: any
@@ -19,6 +20,7 @@
usage: any
vm: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
mockito: any
test: any
diff --git a/pkg/js/pubspec.yaml b/pkg/js/pubspec.yaml
index c8d12d3..25acfba 100644
--- a/pkg/js/pubspec.yaml
+++ b/pkg/js/pubspec.yaml
@@ -9,5 +9,9 @@
dependencies:
meta: ^1.7.0
+# We use 'any' version constraints here as we get our package versions from
+# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
+# best practice for packages is to specify their compatible version ranges.
+# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
lints: any
diff --git a/pkg/js_ast/lib/src/nodes.dart b/pkg/js_ast/lib/src/nodes.dart
index 4e7acf0..fb2c480 100644
--- a/pkg/js_ast/lib/src/nodes.dart
+++ b/pkg/js_ast/lib/src/nodes.dart
@@ -642,6 +642,18 @@
}
abstract class Statement extends Node {
+ // Override for refined return type.
+ @override
+ Statement _clone();
+
+ // Override for refined return type.
+ @override
+ Statement withSourceInformation(
+ JavaScriptNodeSourceInformation? sourceInformation) {
+ if (sourceInformation == _sourceInformation) return this;
+ return _clone().._sourceInformation = sourceInformation;
+ }
+
@override
Statement toStatement() => this;
}
@@ -1277,6 +1289,18 @@
// have precedence depending on how the deferred node is resolved.
int get precedenceLevel;
+ // Override for refined return type.
+ @override
+ Expression _clone();
+
+ // Override for refined return type.
+ @override
+ Expression withSourceInformation(
+ JavaScriptNodeSourceInformation? sourceInformation) {
+ if (sourceInformation == _sourceInformation) return this;
+ return _clone().._sourceInformation = sourceInformation;
+ }
+
@override
Statement toStatement() => ExpressionStatement(this);
}
diff --git a/pkg/js_ast/pubspec.yaml b/pkg/js_ast/pubspec.yaml
index 7d23ea0..f630c01 100644
--- a/pkg/js_ast/pubspec.yaml
+++ b/pkg/js_ast/pubspec.yaml
@@ -5,6 +5,7 @@
environment:
sdk: '>=2.16.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
expect: any
lints: any
diff --git a/pkg/js_runtime/lib/synced/async_await_error_codes.dart b/pkg/js_runtime/lib/synced/async_await_error_codes.dart
index 1708230..f87406b 100644
--- a/pkg/js_runtime/lib/synced/async_await_error_codes.dart
+++ b/pkg/js_runtime/lib/synced/async_await_error_codes.dart
@@ -2,8 +2,6 @@
// 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.12
-
/// Contains error codes that transformed async/async* functions use to
/// communicate with js_helper functions.
diff --git a/pkg/js_runtime/lib/synced/embedded_names.dart b/pkg/js_runtime/lib/synced/embedded_names.dart
index 0c99f47..bbb7001 100644
--- a/pkg/js_runtime/lib/synced/embedded_names.dart
+++ b/pkg/js_runtime/lib/synced/embedded_names.dart
@@ -2,8 +2,6 @@
// 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.12
-
/// Contains the names of globals that are embedded into the output by the
/// compiler.
///
diff --git a/pkg/js_runtime/pubspec.yaml b/pkg/js_runtime/pubspec.yaml
index 14f07a4..a452bc9 100644
--- a/pkg/js_runtime/pubspec.yaml
+++ b/pkg/js_runtime/pubspec.yaml
@@ -5,6 +5,7 @@
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
- expect: any
_fe_analyzer_shared: any
+ expect: any
diff --git a/pkg/js_runtime/test/in_sync_test.dart b/pkg/js_runtime/test/in_sync_test.dart
index 5dab586..be8828d 100644
--- a/pkg/js_runtime/test/in_sync_test.dart
+++ b/pkg/js_runtime/test/in_sync_test.dart
@@ -2,8 +2,6 @@
// 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
-
/// Test to verify that this package is in-sync with dart2js runtime libraries.
import 'dart:io';
diff --git a/pkg/js_shared/lib/synced/embedded_names.dart b/pkg/js_shared/lib/synced/embedded_names.dart
index c2f6307..1e3317e 100644
--- a/pkg/js_shared/lib/synced/embedded_names.dart
+++ b/pkg/js_shared/lib/synced/embedded_names.dart
@@ -2,8 +2,6 @@
// 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.12
-
/// A 'Universe' object used by 'dart:_rti'.
const RTI_UNIVERSE = 'typeUniverse';
diff --git a/pkg/js_shared/lib/synced/recipe_syntax.dart b/pkg/js_shared/lib/synced/recipe_syntax.dart
index 3ccec60..b24e7c2 100644
--- a/pkg/js_shared/lib/synced/recipe_syntax.dart
+++ b/pkg/js_shared/lib/synced/recipe_syntax.dart
@@ -2,8 +2,6 @@
// 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.12
-
/// Constants and predicates used for encoding and decoding type recipes.
///
/// This library is synchronized between the compiler and the runtime system.
diff --git a/pkg/js_shared/pubspec.yaml b/pkg/js_shared/pubspec.yaml
index 6424aac..3503f25 100644
--- a/pkg/js_shared/pubspec.yaml
+++ b/pkg/js_shared/pubspec.yaml
@@ -5,6 +5,7 @@
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
- expect: any
_fe_analyzer_shared: any
+ expect: any
diff --git a/pkg/kernel/pubspec.yaml b/pkg/kernel/pubspec.yaml
index 31ec688..2fb1c7d 100644
--- a/pkg/kernel/pubspec.yaml
+++ b/pkg/kernel/pubspec.yaml
@@ -8,6 +8,7 @@
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
args: any
expect: any
diff --git a/pkg/language_versioning_2.7_test/pubspec.yaml b/pkg/language_versioning_2.7_test/pubspec.yaml
index 3245f03..5ee0691 100644
--- a/pkg/language_versioning_2.7_test/pubspec.yaml
+++ b/pkg/language_versioning_2.7_test/pubspec.yaml
@@ -11,4 +11,3 @@
environment:
sdk: '>=2.7.0 <3.0.0'
-
diff --git a/pkg/modular_test/pubspec.yaml b/pkg/modular_test/pubspec.yaml
index 538c555..1a20237 100644
--- a/pkg/modular_test/pubspec.yaml
+++ b/pkg/modular_test/pubspec.yaml
@@ -2,18 +2,20 @@
# This package is not intended for consumption on pub.dev. DO NOT publish.
publish_to: none
description: >
- Small framework to test modular pipelines.
- This is used within the Dart SDK to define and validate modular tests, and to
- execute them using the modular pipeline of different SDK tools.
+ Small framework to test modular pipelines. This is used within the Dart SDK to
+ define and validate modular tests, and to execute them using the modular
+ pipeline of different SDK tools.
environment:
sdk: '>=2.16.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
args: any
package_config: any
yaml: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
async_helper: any
expect: any
diff --git a/pkg/native_stack_traces/pubspec.yaml b/pkg/native_stack_traces/pubspec.yaml
index 50320e5..ad5add0 100644
--- a/pkg/native_stack_traces/pubspec.yaml
+++ b/pkg/native_stack_traces/pubspec.yaml
@@ -13,5 +13,9 @@
args: ^2.0.0
path: ^1.8.0
+# We use 'any' version constraints here as we get our package versions from
+# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
+# best practice for packages is to specify their compatible version ranges.
+# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
lints: any
diff --git a/pkg/nnbd_migration/pubspec.yaml b/pkg/nnbd_migration/pubspec.yaml
index 67f287b..381567b 100644
--- a/pkg/nnbd_migration/pubspec.yaml
+++ b/pkg/nnbd_migration/pubspec.yaml
@@ -6,10 +6,11 @@
environment:
sdk: '>=2.14.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
_fe_analyzer_shared: any
- analyzer: any
analyzer_plugin: any
+ analyzer: any
args: any
cli_util: any
collection: any
@@ -20,9 +21,10 @@
source_span: any
yaml: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
analyzer_utilities: any
http: any
lints: any
- test: any
test_reflective_loader: any
+ test: any
diff --git a/pkg/nnbd_migration/test/api_test.dart b/pkg/nnbd_migration/test/api_test.dart
index 68359b0..c920737 100644
--- a/pkg/nnbd_migration/test/api_test.dart
+++ b/pkg/nnbd_migration/test/api_test.dart
@@ -6497,6 +6497,27 @@
await _checkSingleFileChanges(content, expected);
}
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/49106')
+ Future<void> test_map_read_does_not_require_index_cast() async {
+ var content = '''
+int f(Map<String, int> m, Object o) => m[o];
+''';
+ var expected = '''
+int? f(Map<String, int> m, Object o) => m[o];
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
+ Future<void> test_map_write_requires_index_cast() async {
+ var content = '''
+void f(Map<String, int> m, Object o, int i) => m[o] = i;
+''';
+ var expected = '''
+void f(Map<String, int> m, Object o, int i) => m[o as String] = i;
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
Future<void> test_methodInvocation_extension_invocation() async {
var content = '''
extension on bool {
@@ -9466,6 +9487,52 @@
await _checkSingleFileChanges(content, expected);
}
+ Future<void> test_whereNotNull_iterable_dynamic() async {
+ var content = '''
+f(Iterable<dynamic> it) => it.where((s) => s != null);
+''';
+ var expected = '''
+import 'package:collection/collection.dart' show IterableNullableExtension;
+
+f(Iterable<dynamic> it) => it.whereNotNull();
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/49103')
+ Future<void> test_whereNotNull_iterable_U() async {
+ var content = '''
+f<U>(Iterable<U> it) => it.where((s) => s != null);
+''';
+ // whereNotNull cannot be used in this case, because its signature is:
+ //
+ // extension IterableNullableExtension<T extends Object> on Iterable<T?> {
+ // Iterable<T> whereNotNull() => ...;
+ // }
+ //
+ // When the type system tries to solve for a substitution T=... that makes
+ // the extension apply, it gets T=U, but that doesn't work because U is not
+ // a subtype of Object.
+ //
+ // So the migration tool shouldn't change the `where` to `whereNotNull`.
+ var expected = '''
+f<U>(Iterable<U> it) => it.where((s) => s != null);
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
+ Future<void> test_whereNotNull_iterable_U_extends_object() async {
+ var content = '''
+f<U extends Object>(Iterable<U> it) => it.where((s) => s != null);
+''';
+ var expected = '''
+import 'package:collection/collection.dart' show IterableNullableExtension;
+
+f<U extends Object>(Iterable<U> it) => it.whereNotNull();
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
Future<void> test_whereNotNull_noContext() async {
var content = '''
f(Iterable<String/*?*/> it) => it.where((s) => s != null);
diff --git a/pkg/scrape/pubspec.yaml b/pkg/scrape/pubspec.yaml
index ca3cee5..ccfb019 100644
--- a/pkg/scrape/pubspec.yaml
+++ b/pkg/scrape/pubspec.yaml
@@ -6,10 +6,12 @@
environment:
sdk: ^2.13.0
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
- args: any
analyzer: any
+ args: any
path: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
lints: any
diff --git a/pkg/smith/pubspec.yaml b/pkg/smith/pubspec.yaml
index 4dfeaea..e92131c 100644
--- a/pkg/smith/pubspec.yaml
+++ b/pkg/smith/pubspec.yaml
@@ -2,7 +2,10 @@
description: Shared code for working with the Dart SDK's tests and test runner.
# This package is not intended for consumption on pub.dev. DO NOT publish.
publish_to: none
+
environment:
- sdk: "^2.12.0"
+ sdk: '^2.12.0'
+
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
expect: any
diff --git a/pkg/sourcemap_testing/analysis_options.yaml b/pkg/sourcemap_testing/analysis_options.yaml
new file mode 100644
index 0000000..a7b9b01
--- /dev/null
+++ b/pkg/sourcemap_testing/analysis_options.yaml
@@ -0,0 +1,18 @@
+# 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.
+
+include: package:lints/recommended.yaml
+
+analyzer:
+ errors:
+ implementation_imports: ignore
+
+linter:
+ rules:
+ # Not enforced by the lints package at any version.
+ - always_declare_return_types
+ - depend_on_referenced_packages
+ - directives_ordering
+ - prefer_single_quotes
+ - prefer_relative_imports
diff --git a/pkg/sourcemap_testing/lib/src/stacktrace_helper.dart b/pkg/sourcemap_testing/lib/src/stacktrace_helper.dart
index 8c545e2..43c9fa9 100644
--- a/pkg/sourcemap_testing/lib/src/stacktrace_helper.dart
+++ b/pkg/sourcemap_testing/lib/src/stacktrace_helper.dart
@@ -3,17 +3,18 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
import 'dart:convert' show jsonDecode;
+import 'dart:io';
import 'package:_fe_analyzer_shared/src/testing/annotated_code_helper.dart';
+import 'package:dart2js_tools/src/dart2js_mapping.dart';
+import 'package:dart2js_tools/src/util.dart';
import 'package:expect/expect.dart';
import 'package:source_maps/source_maps.dart';
import 'package:source_maps/src/utils.dart';
import 'package:source_span/source_span.dart';
-import 'package:dart2js_tools/src/dart2js_mapping.dart';
-const String INPUT_FILE_NAME = 'input.dart';
+const String inputFileName = 'input.dart';
class Test {
final String code;
@@ -33,7 +34,7 @@
/// the annotations by prefix.
Test processTestCode(String code, Iterable<String> configs) {
AnnotatedCode annotatedCode =
- new AnnotatedCode.fromText(code, commentStart, commentEnd);
+ AnnotatedCode.fromText(code, commentStart, commentEnd);
Map<String, Expectations> expectationMap = <String, Expectations>{};
@@ -47,8 +48,8 @@
int colonIndex = text.indexOf(':');
String indexText = text.substring(0, colonIndex);
String methodName = text.substring(colonIndex + 1);
- StackTraceLine stackTraceLine = new StackTraceLine(
- methodName, INPUT_FILE_NAME, annotation.lineNo, annotation.columnNo);
+ StackTraceLine stackTraceLine = StackTraceLine(
+ methodName, inputFileName, annotation.lineNo, annotation.columnNo);
if (indexText == '') {
unexpectedLines.add(stackTraceLine);
} else {
@@ -58,24 +59,24 @@
}
}
- List<StackTraceLine> expectedLines = <StackTraceLine>[];
+ List<StackTraceLine> expectedLines = [];
for (int stackTraceIndex
in (stackTraceMap.keys.toList()..sort()).reversed) {
- expectedLines.add(stackTraceMap[stackTraceIndex]);
+ expectedLines.add(stackTraceMap[stackTraceIndex]!);
}
- expectationMap[config] = new Expectations(expectedLines, unexpectedLines);
+ expectationMap[config] = Expectations(expectedLines, unexpectedLines);
});
- return new Test(annotatedCode.sourceCode, expectationMap);
+ return Test(annotatedCode.sourceCode, expectationMap);
}
/// Compile function used in [testStackTrace]. [input] is the name of the input
/// Dart file and [output] is the name of the generated JavaScript file. The
/// function returns `true` if the compilation succeeded.
-typedef Future<bool> CompileFunc(String input, String output);
+typedef CompileFunc = Future<bool> Function(String, String);
List<String> emptyPreamble(input, output) => const <String>[];
-String identityConverter(String name) => name;
+String? identityConverter(String? name) => name;
/// Tests the stack trace of [test] using the expectations for [config].
///
@@ -97,45 +98,45 @@
/// will not be cleaned up. Note that if *not* giving a temporary directory and
/// the test fails the directory will not be cleaned up.
Future testStackTrace(Test test, String config, CompileFunc compile,
- {bool printJs: false,
- bool writeJs: false,
- bool verbose: false,
- List<String> Function(String input, String output) jsPreambles:
+ {bool printJs = false,
+ bool writeJs = false,
+ bool verbose = false,
+ List<String> Function(String input, String output) jsPreambles =
emptyPreamble,
- List<LineException> beforeExceptions: const <LineException>[],
- List<LineException> afterExceptions: const <LineException>[],
- bool useJsMethodNamesOnAbsence: false,
- String Function(String name) jsNameConverter: identityConverter,
- Directory forcedTmpDir: null,
- int stackTraceLimit: 10,
- expandDart2jsInliningData: false}) async {
+ List<LineException> beforeExceptions = const <LineException>[],
+ List<LineException> afterExceptions = const <LineException>[],
+ bool useJsMethodNamesOnAbsence = false,
+ String? Function(String? name) jsNameConverter = identityConverter,
+ Directory? forcedTmpDir,
+ int stackTraceLimit = 10,
+ expandDart2jsInliningData = false}) async {
Expect.isTrue(test.expectationMap.keys.contains(config),
"No expectations found for '$config' in ${test.expectationMap.keys}");
Directory tmpDir =
forcedTmpDir ?? await Directory.systemTemp.createTemp('stacktrace-test');
- String input = '${tmpDir.path}/$INPUT_FILE_NAME';
- new File(input).writeAsStringSync(test.code);
+ String input = '${tmpDir.path}/$inputFileName';
+ File(input).writeAsStringSync(test.code);
String output = '${tmpDir.path}/out.js';
Expect.isTrue(await compile(input, output),
- "Unsuccessful compilation of test:\n${test.code}");
- File sourceMapFile = new File('$output.map');
+ 'Unsuccessful compilation of test:\n${test.code}');
+ File sourceMapFile = File('$output.map');
Expect.isTrue(
- sourceMapFile.existsSync(), "Source map not generated for $input");
+ sourceMapFile.existsSync(), 'Source map not generated for $input');
String sourceMapText = sourceMapFile.readAsStringSync();
- SingleMapping sourceMap = parse(sourceMapText);
- String jsOutput = new File(output).readAsStringSync();
+ SingleMapping sourceMap = parseSingleMapping(jsonDecode(sourceMapText));
+ String jsOutput = File(output).readAsStringSync();
if (printJs) {
print('JavaScript output:');
print(jsOutput);
}
if (writeJs) {
- new File('out.js').writeAsStringSync(jsOutput);
- new File('out.js.map').writeAsStringSync(sourceMapText);
+ File('out.js').writeAsStringSync(jsOutput);
+ File('out.js.map').writeAsStringSync(sourceMapText);
}
- print("Running d8 $output");
+ print('Running d8 $output');
List<String> d8Arguments = <String>[];
d8Arguments.add('--stack-trace-limit');
d8Arguments.add('$stackTraceLimit');
@@ -147,11 +148,11 @@
print('d8 output:');
print(out);
}
- List<String> lines = out.split(new RegExp(r'(\r|\n|\r\n)'));
+ List<String> lines = out.split(RegExp(r'(\r|\n|\r\n)'));
List<StackTraceLine> jsStackTrace = <StackTraceLine>[];
for (String line in lines) {
if (line.startsWith(' at ')) {
- StackTraceLine stackTraceLine = new StackTraceLine.fromText(line);
+ StackTraceLine stackTraceLine = StackTraceLine.fromText(line);
if (stackTraceLine.lineNo != null && stackTraceLine.columnNo != null) {
jsStackTrace.add(stackTraceLine);
}
@@ -160,21 +161,18 @@
List<StackTraceLine> dartStackTrace = <StackTraceLine>[];
for (StackTraceLine line in jsStackTrace) {
- TargetEntry targetEntry = _findColumn(
- line.lineNo - 1, line.columnNo - 1, _findLine(sourceMap, line));
+ TargetEntry? targetEntry = _findColumn(
+ line.lineNo! - 1, line.columnNo! - 1, _findLine(sourceMap, line));
if (targetEntry == null || targetEntry.sourceUrlId == null) {
dartStackTrace.add(line);
} else {
- String fileName;
- if (targetEntry.sourceUrlId != null) {
- fileName = sourceMap.urls[targetEntry.sourceUrlId];
- }
- int targetLine = targetEntry.sourceLine + 1;
- int targetColumn = targetEntry.sourceColumn + 1;
+ String fileName = sourceMap.urls[targetEntry.sourceUrlId!];
+ int targetLine = targetEntry.sourceLine! + 1;
+ int targetColumn = targetEntry.sourceColumn! + 1;
if (expandDart2jsInliningData) {
- SourceFile file = new SourceFile.fromString(jsOutput);
- int offset = file.getOffset(line.lineNo - 1, line.columnNo - 1);
+ SourceFile file = SourceFile.fromString(jsOutput);
+ int offset = file.getOffset(line.lineNo! - 1, line.columnNo! - 1);
Map<int, List<FrameEntry>> frames =
_loadInlinedFrameData(sourceMap, sourceMapText);
List<int> indices = frames.keys.toList()..sort();
@@ -182,19 +180,19 @@
int depth = 0;
outer:
while (key >= 0) {
- for (var frame in frames[indices[key]].reversed) {
+ for (var frame in frames[indices[key]]!.reversed) {
if (frame.isEmpty) break outer;
if (frame.isPush) {
if (depth <= 0) {
- dartStackTrace.add(new StackTraceLine(
- frame.inlinedMethodName + "(inlined)",
+ dartStackTrace.add(StackTraceLine(
+ '${frame.inlinedMethodName}(inlined)',
fileName,
targetLine,
targetColumn,
isMapped: true));
- fileName = frame.callUri;
- targetLine = frame.callLine + 1;
- targetColumn = frame.callColumn + 1;
+ fileName = frame.callUri!;
+ targetLine = frame.callLine! + 1;
+ targetColumn = frame.callColumn! + 1;
} else {
depth--;
}
@@ -208,20 +206,20 @@
targetEntry = findEnclosingFunction(jsOutput, file, offset, sourceMap);
}
- String methodName;
- if (targetEntry.sourceNameId != null) {
- methodName = sourceMap.names[targetEntry.sourceNameId];
+ String? methodName;
+ if (targetEntry!.sourceNameId != null) {
+ methodName = sourceMap.names[targetEntry.sourceNameId!];
} else if (useJsMethodNamesOnAbsence) {
methodName = jsNameConverter(line.methodName);
}
- dartStackTrace.add(new StackTraceLine(
+ dartStackTrace.add(StackTraceLine(
methodName, fileName, targetLine, targetColumn,
isMapped: true));
}
}
- Expectations expectations = test.expectationMap[config];
+ Expectations expectations = test.expectationMap[config]!;
int expectedIndex = 0;
List<StackTraceLine> unexpectedLines = <StackTraceLine>[];
@@ -251,7 +249,7 @@
for (LineException exception in exceptions) {
String fileName = exception.fileName;
if (line.methodName == exception.methodName &&
- line.fileName.endsWith(fileName)) {
+ line.fileName!.endsWith(fileName)) {
found = true;
}
}
@@ -273,20 +271,20 @@
Expect.equals(
expectedIndex,
expectations.expectedLines.length,
- "Missing stack trace lines for test:\n${test.code}\n"
- "Actual:\n${dartStackTrace.join('\n')}\n\n"
- "Expected:\n${expectations.expectedLines.join('\n')}\n");
+ 'Missing stack trace lines for test:\n${test.code}\n'
+ 'Actual:\n${dartStackTrace.join('\n')}\n\n'
+ 'Expected:\n${expectations.expectedLines.join('\n')}\n');
Expect.isTrue(
unexpectedLines.isEmpty,
- "Unexpected stack trace lines for test:\n${test.code}\n"
- "Actual:\n${dartStackTrace.join('\n')}\n\n"
- "Unexpected:\n${expectations.unexpectedLines.join('\n')}\n");
+ 'Unexpected stack trace lines for test:\n${test.code}\n'
+ 'Actual:\n${dartStackTrace.join('\n')}\n\n'
+ 'Unexpected:\n${expectations.unexpectedLines.join('\n')}\n');
Expect.isTrue(
unexpectedBeforeLines.isEmpty && unexpectedAfterLines.isEmpty,
- "Unexpected stack trace lines:\n${test.code}\n"
- "Actual:\n${dartStackTrace.join('\n')}\n\n"
- "Unexpected before:\n${unexpectedBeforeLines.join('\n')}\n\n"
- "Unexpected after:\n${unexpectedAfterLines.join('\n')}\n");
+ 'Unexpected stack trace lines:\n${test.code}\n'
+ 'Actual:\n${dartStackTrace.join('\n')}\n\n'
+ 'Unexpected before:\n${unexpectedBeforeLines.join('\n')}\n\n'
+ 'Unexpected after:\n${unexpectedAfterLines.join('\n')}\n');
if (forcedTmpDir == null) {
print("Deleting '${tmpDir.path}'.");
@@ -295,14 +293,14 @@
}
class StackTraceLine {
- String methodName;
- String fileName;
- int lineNo;
- int columnNo;
+ String? methodName;
+ String? fileName;
+ int? lineNo;
+ int? columnNo;
bool isMapped;
StackTraceLine(this.methodName, this.fileName, this.lineNo, this.columnNo,
- {this.isMapped: false});
+ {this.isMapped = false});
/// Creates a [StackTraceLine] by parsing a d8 stack trace line [text]. The
/// expected formats are
@@ -318,22 +316,22 @@
text = text.trim();
assert(text.startsWith('at '));
text = text.substring('at '.length);
- String methodName;
+ String? methodName;
if (text.endsWith(')')) {
int nameEnd = text.indexOf(' (');
methodName = text.substring(0, nameEnd);
text = text.substring(nameEnd + 2, text.length - 1);
}
- int lineNo;
- int columnNo;
+ int? lineNo;
+ int? columnNo;
String fileName;
int lastColon = text.lastIndexOf(':');
if (lastColon != -1) {
- int lastValue = int.tryParse(text.substring(lastColon + 1));
+ int? lastValue = int.tryParse(text.substring(lastColon + 1));
if (lastValue != null) {
int secondToLastColon = text.lastIndexOf(':', lastColon - 1);
if (secondToLastColon != -1) {
- int secondToLastValue =
+ int? secondToLastValue =
int.tryParse(text.substring(secondToLastColon + 1, lastColon));
if (secondToLastValue != null) {
lineNo = secondToLastValue;
@@ -353,11 +351,12 @@
} else {
fileName = text;
}
- return new StackTraceLine(methodName, fileName, lineNo, columnNo);
+ return StackTraceLine(methodName, fileName, lineNo, columnNo);
}
+ @override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write(' at ');
if (methodName != null) {
sb.write(methodName);
@@ -384,14 +383,14 @@
/// number is lower or equal to [line].
///
/// Copied from [SingleMapping._findLine].
-TargetLineEntry _findLine(SingleMapping sourceMap, StackTraceLine stLine) {
- String filename = stLine.fileName
- .substring(stLine.fileName.lastIndexOf(new RegExp("[\\\/]")) + 1);
+TargetLineEntry? _findLine(SingleMapping sourceMap, StackTraceLine stLine) {
+ String filename = stLine.fileName!
+ .substring(stLine.fileName!.lastIndexOf(RegExp('[\\/]')) + 1);
if (sourceMap.targetUrl != filename) return null;
- return _findLineInternal(sourceMap, stLine.lineNo - 1);
+ return _findLineInternal(sourceMap, stLine.lineNo! - 1);
}
-TargetLineEntry _findLineInternal(SingleMapping sourceMap, int line) {
+TargetLineEntry? _findLineInternal(SingleMapping sourceMap, int line) {
int index = binarySearch(sourceMap.lines, (e) => e.line > line);
return (index <= 0) ? null : sourceMap.lines[index - 1];
}
@@ -403,8 +402,8 @@
/// the very last entry on that line.
///
/// Copied from [SingleMapping._findColumn].
-TargetEntry _findColumn(int line, int column, TargetLineEntry lineEntry) {
- if (lineEntry == null || lineEntry.entries.length == 0) return null;
+TargetEntry? _findColumn(int line, int column, TargetLineEntry? lineEntry) {
+ if (lineEntry == null || lineEntry.entries.isEmpty) return null;
if (lineEntry.line != line) return lineEntry.entries.last;
var entries = lineEntry.entries;
int index = binarySearch(entries, (e) => e.column > column);
@@ -420,7 +419,7 @@
} else if (Platform.isMacOS) {
return 'third_party/d8/macos/d8';
}
- throw new UnsupportedError('Unsupported platform.');
+ throw UnsupportedError('Unsupported platform.');
}
/// A line allowed in the mapped stack trace.
@@ -433,9 +432,8 @@
/// Search backwards in [sources] for a function declaration that includes the
/// [start] offset.
-TargetEntry findEnclosingFunction(
+TargetEntry? findEnclosingFunction(
String sources, SourceFile file, int start, SingleMapping mapping) {
- if (sources == null) return null;
var index = start;
while (true) {
index = nextDeclarationCandidate(sources, index);
diff --git a/pkg/sourcemap_testing/lib/src/stepping_helper.dart b/pkg/sourcemap_testing/lib/src/stepping_helper.dart
index 5468af7..9392f77 100644
--- a/pkg/sourcemap_testing/lib/src/stepping_helper.dart
+++ b/pkg/sourcemap_testing/lib/src/stepping_helper.dart
@@ -1,77 +1,76 @@
+import 'dart:convert' show jsonDecode;
import 'dart:io';
import 'package:_fe_analyzer_shared/src/testing/annotated_code_helper.dart';
+import 'package:collection/collection.dart' show IterableNullableExtension;
+import 'package:dart2js_tools/src/util.dart';
import 'package:expect/minitest.dart';
import 'package:path/path.dart' as path;
import 'package:source_maps/source_maps.dart';
-/**
- * Runs D8 and steps as the AnnotatedCode dictates.
- *
- * Note that the compiled javascript is expected to be called "js.js" inside the
- * outputPath directory. It is also expected that there is a "js.js.map" file.
- * It is furthermore expected that the js has been compiled from a file in the
- * same folder called test.dart.
- */
+/// Runs D8 and steps as the AnnotatedCode dictates.
+///
+/// Note that the compiled javascript is expected to be called "js.js" inside
+/// the outputPath directory. It is also expected that there is a "js.js.map"
+/// file. It is furthermore expected that the js has been compiled from a file
+/// in the same folder called test.dart.
ProcessResult runD8AndStep(String outputPath, String testFileName,
AnnotatedCode code, List<String> scriptD8Command) {
- var outputFile = path.join(outputPath, "js.js");
- SingleMapping sourceMap =
- parse(new File("${outputFile}.map").readAsStringSync());
+ var outputFile = path.join(outputPath, 'js.js');
+ var sourcemapText = File('$outputFile.map').readAsStringSync();
+ SingleMapping sourceMap = parseSingleMapping(jsonDecode(sourcemapText));
- Set<int> mappedToLines = sourceMap.lines
+ Set<int?> mappedToLines = sourceMap.lines
.map((entry) => entry.entries.map((entry) => entry.sourceLine).toSet())
- .fold(new Set<int>(), (prev, e) => prev..addAll(e));
+ .fold(<int?>{}, (prev, e) => prev..addAll(e));
for (Annotation annotation
- in code.annotations.where((a) => a.text.trim() == "nm")) {
+ in code.annotations.where((a) => a.text.trim() == 'nm')) {
if (mappedToLines.contains(annotation.lineNo - 1)) {
- fail("Was not allowed to have a mapping to line "
- "${annotation.lineNo}, but did.\n"
- "Sourcemap looks like this (note 0-indexed):\n"
- "${sourceMap.debugString}");
+ fail('Was not allowed to have a mapping to line '
+ '${annotation.lineNo}, but did.\n'
+ 'Sourcemap looks like this (note 0-indexed):\n'
+ '${sourceMap.debugString}');
}
}
- List<String> breakpoints = [];
+ List<String?> breakpoints = [];
// Annotations are 1-based, js breakpoints are 0-based.
for (Annotation breakAt
- in code.annotations.where((a) => a.text.trim() == "bl")) {
+ in code.annotations.where((a) => a.text.trim() == 'bl')) {
breakpoints
.add(_getJsBreakpointLine(testFileName, sourceMap, breakAt.lineNo - 1));
}
for (Annotation breakAt
- in code.annotations.where((a) => a.text.trim().startsWith("bc:"))) {
+ in code.annotations.where((a) => a.text.trim().startsWith('bc:'))) {
breakpoints.add(_getJsBreakpointLineAndColumn(
testFileName, sourceMap, breakAt.lineNo - 1, breakAt.columnNo - 1));
}
- File inspectorFile = new File.fromUri(
- sdkRoot.uri.resolve("pkg/sourcemap_testing/lib/src/js/inspector.js"));
+ File inspectorFile = File.fromUri(
+ sdkRoot!.uri.resolve('pkg/sourcemap_testing/lib/src/js/inspector.js'));
if (!inspectorFile.existsSync()) throw "Couldn't find 'inspector.js'";
- var outInspectorPath = path.join(outputPath, "inspector.js");
+ var outInspectorPath = path.join(outputPath, 'inspector.js');
inspectorFile.copySync(outInspectorPath);
- String debugAction = "Debugger.stepInto";
- if (code.annotations.any((a) => a.text.trim() == "Debugger:stepOver")) {
- debugAction = "Debugger.stepOver";
+ String debugAction = 'Debugger.stepInto';
+ if (code.annotations.any((a) => a.text.trim() == 'Debugger:stepOver')) {
+ debugAction = 'Debugger.stepOver';
}
return _runD8(outInspectorPath, scriptD8Command, debugAction, breakpoints);
}
-/**
- * Translates the D8 js steps and checks against expectations.
- *
- * Note that the compiled javascript is expected to be called "js.js" inside the
- * outputPath directory. It is also expected that there is a "js.js.map" file.
- * It is furthermore expected that the js has been compiled from a file in the
- * same folder called test.dart.
- */
+/// Translates the D8 js steps and checks against expectations.
+///
+/// Note that the compiled javascript is expected to be called "js.js" inside
+/// the outputPath directory. It is also expected that there is a "js.js.map"
+/// file. It is furthermore expected that the js has been compiled from a file
+/// in the same folder called test.dart.
void checkD8Steps(String outputPath, List<String> d8Output, AnnotatedCode code,
- {bool debug: false}) {
- var outputFilename = "js.js";
+ {bool debug = false}) {
+ var outputFilename = 'js.js';
var outputFile = path.join(outputPath, outputFilename);
- SingleMapping sourceMap =
- parse(new File("${outputFile}.map").readAsStringSync());
+ var sourcemapText = File('$outputFile.map').readAsStringSync();
+ SingleMapping sourceMap = parseSingleMapping(jsonDecode(sourcemapText));
List<List<_DartStackTraceDataEntry>> result =
_extractStackTraces(d8Output, sourceMap, outputFilename);
@@ -81,71 +80,68 @@
if (debug) _debugPrint(trace, outputPath);
List<String> recordStops =
- trace.where((entry) => !entry.isError).map((entry) => "$entry").toList();
+ trace.where((entry) => !entry.isError).map((entry) => '$entry').toList();
Set<int> recordStopLines =
trace.where((entry) => !entry.isError).map((entry) => entry.line).toSet();
Set<String> recordStopLineColumns = trace
.where((entry) => !entry.isError)
- .map((entry) => "${entry.line}:${entry.column}")
+ .map((entry) => '${entry.line}:${entry.column}')
.toSet();
List<String> expectedStops = [];
for (Annotation annotation in code.annotations.where((annotation) =>
- annotation.text.trim().startsWith("s:") ||
- annotation.text.trim().startsWith("sl:") ||
- annotation.text.trim().startsWith("bc:"))) {
+ annotation.text.trim().startsWith('s:') ||
+ annotation.text.trim().startsWith('sl:') ||
+ annotation.text.trim().startsWith('bc:'))) {
String text = annotation.text.trim();
- int stopNum = int.parse(text.substring(text.indexOf(":") + 1));
+ int stopNum = int.parse(text.substring(text.indexOf(':') + 1));
if (expectedStops.length < stopNum) expectedStops.length = stopNum;
- if (text.startsWith("sl:")) {
- expectedStops[stopNum - 1] = "test.dart:${annotation.lineNo}:";
+ if (text.startsWith('sl:')) {
+ expectedStops[stopNum - 1] = 'test.dart:${annotation.lineNo}:';
} else {
expectedStops[stopNum - 1] =
- "test.dart:${annotation.lineNo}:${annotation.columnNo}:";
+ 'test.dart:${annotation.lineNo}:${annotation.columnNo}:';
}
}
- List<List<String>> noBreaksStart = [];
- List<List<String>> noBreaksEnd = [];
+ List<List<String>?> noBreaksStart = [];
+ List<List<String>?> noBreaksEnd = [];
for (Annotation annotation in code.annotations
- .where((annotation) => annotation.text.trim().startsWith("nbb:"))) {
+ .where((annotation) => annotation.text.trim().startsWith('nbb:'))) {
String text = annotation.text.trim();
- var split = text.split(":");
+ var split = text.split(':');
int stopNum1 = int.parse(split[1]);
int stopNum2 = int.parse(split[2]);
if (noBreaksStart.length <= stopNum1) noBreaksStart.length = stopNum1 + 1;
- noBreaksStart[stopNum1] ??= [];
+ (noBreaksStart[stopNum1] ??= []).add('test.dart:${annotation.lineNo}:');
if (noBreaksEnd.length <= stopNum2) noBreaksEnd.length = stopNum2 + 1;
- noBreaksEnd[stopNum2] ??= [];
-
- noBreaksStart[stopNum1].add("test.dart:${annotation.lineNo}:");
- noBreaksEnd[stopNum2].add("test.dart:${annotation.lineNo}:");
+ (noBreaksEnd[stopNum2] ??= []).add('test.dart:${annotation.lineNo}:');
}
_checkRecordedStops(
recordStops, expectedStops, noBreaksStart, noBreaksEnd, debug);
for (Annotation annotation in code.annotations
- .where((annotation) => annotation.text.trim() == "nb")) {
+ .where((annotation) => annotation.text.trim() == 'nb')) {
// Check that we didn't break where we're not allowed to.
if (recordStopLines.contains(annotation.lineNo)) {
- fail("Was not allowed to stop on line ${annotation.lineNo}, but did!"
- " Actual line stops: $recordStopLines${_debugHint(debug)}");
+ fail('Was not allowed to stop on line ${annotation.lineNo}, but did!'
+ ' Actual line stops: $recordStopLines${_debugHint(debug)}');
}
}
for (Annotation annotation in code.annotations
- .where((annotation) => annotation.text.trim() == "nbc")) {
+ .where((annotation) => annotation.text.trim() == 'nbc')) {
// Check that we didn't break where we're not allowed to.
if (recordStopLineColumns
- .contains("${annotation.lineNo}:${annotation.columnNo}")) {
- fail("Was not allowed to stop on line ${annotation.lineNo} "
- "column ${annotation.columnNo}, but did!"
- " Actual line stops: $recordStopLineColumns${_debugHint(debug)}");
+ .contains('${annotation.lineNo}:${annotation.columnNo}')) {
+ fail('Was not allowed to stop on line ${annotation.lineNo} '
+ 'column ${annotation.columnNo}, but did!'
+ ' Actual line stops: $recordStopLineColumns${_debugHint(debug)}');
}
}
- if (code.annotations.any((a) => a.text.trim() == "fail")) {
+ if (code.annotations.any((a) => a.text.trim() == 'fail')) {
fail("Test contains 'fail' annotation.");
}
}
@@ -153,8 +149,8 @@
void _checkRecordedStops(
List<String> recordStops,
List<String> expectedStops,
- List<List<String>> noBreaksStart,
- List<List<String>> noBreaksEnd,
+ List<List<String>?> noBreaksStart,
+ List<List<String>?> noBreaksEnd,
bool debug) {
// We want to find all expected lines in recorded lines in order, but allow
// more in between in the recorded lines.
@@ -162,23 +158,23 @@
// to be between those points though.
int expectedIndex = 0;
- Set<String> aliveNoBreaks = new Set<String>();
- if (noBreaksStart.length > 0 && noBreaksStart[0] != null) {
- aliveNoBreaks.addAll(noBreaksStart[0]);
+ Set<String> aliveNoBreaks = {};
+ if (noBreaksStart.isNotEmpty && noBreaksStart[0] != null) {
+ aliveNoBreaks.addAll(noBreaksStart[0]!);
}
int stopNumber = 0;
for (String recorded in recordStops) {
stopNumber++;
if (expectedIndex == expectedStops.length) break;
- if ("$recorded:".contains(expectedStops[expectedIndex])) {
+ if ('$recorded:'.contains(expectedStops[expectedIndex])) {
++expectedIndex;
if (noBreaksStart.length > expectedIndex &&
noBreaksStart[expectedIndex] != null) {
- aliveNoBreaks.addAll(noBreaksStart[expectedIndex]);
+ aliveNoBreaks.addAll(noBreaksStart[expectedIndex]!);
}
if (noBreaksEnd.length > expectedIndex &&
noBreaksEnd[expectedIndex] != null) {
- aliveNoBreaks.removeAll(noBreaksEnd[expectedIndex]);
+ aliveNoBreaks.removeAll(noBreaksEnd[expectedIndex]!);
}
} else {
if (debug) {
@@ -191,27 +187,27 @@
// Both failures are difficult to debug without seeing the stops that
// didn't match. No breaks failures are misleading (the problem isn't
// an incorrect break, but we missed a stop, so the aliveNoBreaks is
- // wrong), and the normal failure list dumps the enitre stop list,
+ // wrong), and the normal failure list dumps the entire stop list,
// making it difficult to see where the mismatch was.
//
// Also we add 1 to expectedIndex, because the stop annotations are
// 1-based in the source files (e.g. `/*s:1*/` is expectedIndex 0)
print("Skipping stop `$recorded` that didn't match expected stop "
- "${expectedIndex + 1} `${expectedStops[expectedIndex]}`");
+ '${expectedIndex + 1} `${expectedStops[expectedIndex]}`');
}
if (aliveNoBreaks
.contains("${(recorded.split(":")..removeLast()).join(":")}:")) {
fail("Break '$recorded' was found when it wasn't allowed "
- "(js step $stopNumber, after stop ${expectedIndex + 1}). "
- "This can happen when an expected stop was not matched"
- "${_debugHint(debug)}.");
+ '(js step $stopNumber, after stop ${expectedIndex + 1}). '
+ 'This can happen when an expected stop was not matched'
+ '${_debugHint(debug)}.');
}
}
}
if (expectedIndex != expectedStops.length) {
// Didn't find everything.
- fail("Expected to find $expectedStops but found $recordStops"
- "${_debugHint(debug)}");
+ fail('Expected to find $expectedStops but found $recordStops'
+ '${_debugHint(debug)}');
}
}
@@ -223,15 +219,14 @@
}
void _debugPrint(List<_DartStackTraceDataEntry> trace, String outputPath) {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
var jsFile =
- new File(path.join(outputPath, "js.js")).readAsStringSync().split("\n");
- var dartFile = new File(path.join(outputPath, "test.dart"))
- .readAsStringSync()
- .split("\n");
+ File(path.join(outputPath, 'js.js')).readAsStringSync().split('\n');
+ var dartFile =
+ File(path.join(outputPath, 'test.dart')).readAsStringSync().split('\n');
List<String> getSnippet(List<String> data, int line, int column) {
- List<String> result = new List<String>.filled(5, "");
+ List<String> result = List<String>.filled(5, '');
if (line < 0 || column < 0) return result;
for (int i = 0; i < 5; ++i) {
@@ -240,48 +235,48 @@
result[i] = data[j];
}
if (result[2].length >= column) {
- result[2] = result[2].substring(0, column) +
- "/*STOP*/" +
- result[2].substring(column);
+ var before = result[2].substring(0, column);
+ var after = result[2].substring(column);
+ result[2] = '$before/*STOP*/$after';
}
return result;
}
List<String> sideBySide(List<String> a, List<String> b, int columns) {
- List<String> result = new List<String>.filled(a.length, null);
+ List<String> result = List<String>.filled(a.length, '');
for (int i = 0; i < a.length; ++i) {
String left = a[i].padRight(columns).substring(0, columns);
String right = b[i].padRight(columns).substring(0, columns);
- result[i] = left + " | " + right;
+ result[i] = '$left | $right';
}
return result;
}
for (int i = 0; i < trace.length; ++i) {
- sb.write("\n\nStop #${i + 1}\n\n");
+ sb.write('\n\nStop #${i + 1}\n\n');
if (trace[i].isError && trace[i].jsLine < 0) {
- sb.write("${trace[i].errorString}\n");
+ sb.write('${trace[i].errorString}\n');
continue;
}
var jsSnippet = getSnippet(jsFile, trace[i].jsLine, trace[i].jsColumn);
var dartSnippet =
getSnippet(dartFile, trace[i].line - 1, trace[i].column - 1);
var view = sideBySide(jsSnippet, dartSnippet, 50);
- sb.writeAll(view, "\n");
+ sb.writeAll(view, '\n');
}
print(sb.toString());
}
List<List<_DartStackTraceDataEntry>> _extractStackTraces(
- lines, SingleMapping sourceMap, String outputFilename) {
+ List<String> lines, SingleMapping sourceMap, String outputFilename) {
List<List<_DartStackTraceDataEntry>> result = [];
bool inStackTrace = false;
List<String> currentStackTrace = <String>[];
for (var line in lines) {
- if (line.trim() == "--- Debugger stacktrace start ---") {
+ if (line.trim() == '--- Debugger stacktrace start ---') {
inStackTrace = true;
- } else if (line.trim() == "--- Debugger stacktrace end ---") {
+ } else if (line.trim() == '--- Debugger stacktrace end ---') {
result.add(
_extractStackTrace(currentStackTrace, sourceMap, outputFilename));
currentStackTrace.clear();
@@ -297,36 +292,35 @@
List<String> js, SingleMapping sourceMap, String wantedFile) {
List<_DartStackTraceDataEntry> result = [];
for (String line in js) {
- if (!line.contains("$wantedFile:")) {
- result.add(
- new _DartStackTraceDataEntry.error("Not correct file @ '$line'"));
+ if (!line.contains('$wantedFile:')) {
+ result.add(_DartStackTraceDataEntry.error("Not correct file @ '$line'"));
continue;
}
- Iterable<Match> ms = new RegExp(r"(\d+):(\d+)").allMatches(line);
+ Iterable<Match> ms = RegExp(r'(\d+):(\d+)').allMatches(line);
if (ms.isEmpty) {
- result.add(new _DartStackTraceDataEntry.error(
+ result.add(_DartStackTraceDataEntry.error(
"Line and column not found for '$line'"));
continue;
}
Match m = ms.first;
- int l = int.parse(m.group(1));
- int c = int.parse(m.group(2));
- SourceMapSpan span = _getColumnOrPredecessor(sourceMap, l, c);
+ int l = int.parse(m.group(1)!);
+ int c = int.parse(m.group(2)!);
+ SourceMapSpan? span = _getColumnOrPredecessor(sourceMap, l, c);
if (span?.start == null) {
- result.add(new _DartStackTraceDataEntry.errorWithJsPosition(
+ result.add(_DartStackTraceDataEntry.errorWithJsPosition(
"Source map not found for '$line'", l, c));
continue;
}
- var file = span.sourceUrl?.pathSegments?.last ?? "(unknown file)";
- result.add(new _DartStackTraceDataEntry(
+ var file = span!.sourceUrl?.pathSegments.last ?? '(unknown file)';
+ result.add(_DartStackTraceDataEntry(
file, span.start.line + 1, span.start.column + 1, l, c));
}
return result;
}
-SourceMapSpan _getColumnOrPredecessor(
+SourceMapSpan? _getColumnOrPredecessor(
SingleMapping sourceMap, int line, int column) {
- SourceMapSpan span = sourceMap.spanFor(line, column);
+ SourceMapSpan? span = sourceMap.spanFor(line, column);
if (span == null && line > 0) {
span = sourceMap.spanFor(line - 1, 999999);
}
@@ -334,10 +328,10 @@
}
class _DartStackTraceDataEntry {
- final String file;
+ final String? file;
final int line;
final int column;
- final errorString;
+ final String? errorString;
final int jsLine;
final int jsColumn;
@@ -356,9 +350,10 @@
line = -1,
column = -1;
- get isError => errorString != null;
+ bool get isError => errorString != null;
- String toString() => isError ? errorString : "$file:$line:$column";
+ @override
+ String toString() => isError ? errorString! : '$file:$line:$column';
}
class _PointMapping {
@@ -370,25 +365,25 @@
_PointMapping(this.fromLine, this.fromColumn, this.toLine, this.toColumn);
}
-/**
- * Input and output is expected to be 0-based.
- *
- * The "magic 4" below is taken from https://github.com/ChromeDevTools/devtools-
- * frontend/blob/fa18d70a995f06cb73365b2e5b8ae974cf60bd3a/front_end/sources/
- * JavaScriptSourceFrame.js#L1520-L1523
- */
-String _getJsBreakpointLine(
+/// Input and output is expected to be 0-based.
+///
+/// The "magic 4" below is taken from
+/// https://github.com/ChromeDevTools/devtools-frontend/blob/fa18d70a995f06cb73365b2e5b8ae974cf60bd3a/front_end/sources/JavaScriptSourceFrame.js#L1520-L1523
+String? _getJsBreakpointLine(
String testFileName, SingleMapping sourceMap, int breakOnLine) {
List<_PointMapping> mappingsOnLines = [];
for (var line in sourceMap.lines) {
for (var entry in line.entries) {
- if (entry.sourceLine == null) continue;
- if (entry.sourceLine >= breakOnLine &&
- entry.sourceLine < breakOnLine + 4 &&
- entry.sourceUrlId != null &&
- sourceMap.urls[entry.sourceUrlId] == testFileName) {
- mappingsOnLines.add(new _PointMapping(
- entry.sourceLine, entry.sourceColumn, line.line, entry.column));
+ final sourceLine = entry.sourceLine;
+ if (sourceLine == null) continue;
+ final sourceColumn = entry.sourceColumn!;
+ final sourceUrlId = entry.sourceUrlId;
+ if (sourceLine >= breakOnLine &&
+ sourceLine < breakOnLine + 4 &&
+ sourceUrlId != null &&
+ sourceMap.urls[sourceUrlId] == testFileName) {
+ mappingsOnLines.add(
+ _PointMapping(sourceLine, sourceColumn, line.line, entry.column));
}
}
}
@@ -405,65 +400,66 @@
mappingsOnLines.retainWhere((p) => p.toLine >= first.toLine);
_PointMapping last = mappingsOnLines.last;
- return "${first.toLine}:${first.toColumn}:${last.toLine}:${first.toColumn}";
+ return '${first.toLine}:${first.toColumn}:${last.toLine}:${first.toColumn}';
}
-/**
- * Input and output is expected to be 0-based.
- */
-String _getJsBreakpointLineAndColumn(String testFileName,
+/// Input and output is expected to be 0-based.
+String? _getJsBreakpointLineAndColumn(String testFileName,
SingleMapping sourceMap, int breakOnLine, int breakOnColumn) {
for (var line in sourceMap.lines) {
for (var entry in line.entries) {
if (entry.sourceLine == breakOnLine &&
entry.sourceColumn == breakOnColumn &&
entry.sourceUrlId != null &&
- sourceMap.urls[entry.sourceUrlId] == testFileName)
- return "${line.line}:${entry.column}";
+ sourceMap.urls[entry.sourceUrlId!] == testFileName) {
+ return '${line.line}:${entry.column}';
+ }
}
}
return null;
}
ProcessResult _runD8(String outInspectorPath, List<String> scriptD8Command,
- String debugAction, List<String> breakpoints) {
+ String debugAction, List<String?> breakpoints) {
var outInspectorPathRelative = path.relative(outInspectorPath);
- ProcessResult runResult = Process.runSync(
- d8Executable,
- ['--enable-inspector', outInspectorPathRelative]
- ..addAll(scriptD8Command)
- ..addAll(["--", debugAction])
- ..addAll(breakpoints.where((s) => s != null)));
+ ProcessResult runResult = Process.runSync(d8Executable, [
+ '--enable-inspector',
+ outInspectorPathRelative,
+ ...scriptD8Command,
+ '--',
+ debugAction,
+ ...breakpoints.whereNotNull()
+ ]);
if (runResult.exitCode != 0) {
print(runResult.stderr);
print(runResult.stdout);
- throw "Exit code: ${runResult.exitCode} from d8";
+ throw 'Exit code: ${runResult.exitCode} from d8';
}
return runResult;
}
-File _cachedD8File;
-Directory _cachedSdkRoot;
+File? _cachedD8File;
+Directory? _cachedSdkRoot;
File getD8File() {
File attemptFileFromDir(Directory dir) {
if (Platform.isWindows) {
- return new File(dir.path + Platform.pathSeparator + "d8/windows/d8.exe");
+ return File('${dir.path}${Platform.pathSeparator}d8/windows/d8.exe');
} else if (Platform.isLinux) {
- return new File(dir.path + Platform.pathSeparator + "d8/linux/d8");
+ return File('${dir.path}${Platform.pathSeparator}d8/linux/d8');
} else if (Platform.isMacOS) {
- return new File(dir.path + Platform.pathSeparator + "d8/macos/d8");
+ return File('${dir.path}${Platform.pathSeparator}d8/macos/d8');
}
- throw new UnsupportedError('Unsupported platform.');
+ throw UnsupportedError('Unsupported platform.');
}
File search() {
- Directory dir = new File.fromUri(Platform.script).parent;
+ Directory dir = File.fromUri(Platform.script).parent;
while (dir.path.length > 1) {
for (var entry in dir.listSync()) {
if (entry is! Directory) continue;
- if (entry.path.endsWith("third_party")) {
+ if (entry.path.endsWith('third_party')) {
List<String> segments = entry.uri.pathSegments;
- if (segments[segments.length - 2] == "third_party") {
+ if (segments[segments.length - 2] == 'third_party') {
File possibleD8 = attemptFileFromDir(entry);
if (possibleD8.existsSync()) {
_cachedSdkRoot = dir;
@@ -475,13 +471,13 @@
dir = dir.parent;
}
- throw "Cannot find D8 directory.";
+ throw 'Cannot find D8 directory.';
}
return _cachedD8File ??= search();
}
-Directory get sdkRoot {
+Directory? get sdkRoot {
getD8File();
return _cachedSdkRoot;
}
diff --git a/pkg/sourcemap_testing/pubspec.yaml b/pkg/sourcemap_testing/pubspec.yaml
index 95dada8..d739276 100644
--- a/pkg/sourcemap_testing/pubspec.yaml
+++ b/pkg/sourcemap_testing/pubspec.yaml
@@ -4,12 +4,18 @@
publish_to: none
environment:
- sdk: '>=2.1.0 <3.0.0'
+ sdk: '>=2.16.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
_fe_analyzer_shared: any
- dart2js_tools: any
- expect: any
+ collection: any
+ dart2js_tools: any
+ expect: any
path: any
source_maps: any
source_span: any
+
+# Use 'any' constraints here; we get our versions from the DEPS file.
+dev_dependencies:
+ lints: any
diff --git a/pkg/status_file/pubspec.yaml b/pkg/status_file/pubspec.yaml
index 27e76b2..70c564c 100644
--- a/pkg/status_file/pubspec.yaml
+++ b/pkg/status_file/pubspec.yaml
@@ -5,9 +5,11 @@
environment:
sdk: "^2.12.0"
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
- path: any
args: any
+ path: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
expect: any
diff --git a/pkg/telemetry/pubspec.yaml b/pkg/telemetry/pubspec.yaml
index 12acecc..d1b687c 100644
--- a/pkg/telemetry/pubspec.yaml
+++ b/pkg/telemetry/pubspec.yaml
@@ -6,6 +6,7 @@
environment:
sdk: '>=2.12.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
http: any
meta: any
@@ -13,5 +14,6 @@
stack_trace: any
usage: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
test: any
diff --git a/pkg/test_runner/pubspec.yaml b/pkg/test_runner/pubspec.yaml
index 017aba9..26f868f 100644
--- a/pkg/test_runner/pubspec.yaml
+++ b/pkg/test_runner/pubspec.yaml
@@ -5,8 +5,11 @@
name: test_runner
# This package is not intended for consumption on pub.dev. DO NOT publish.
publish_to: none
+
environment:
sdk: "^2.9.0"
+
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
args: any
dart2js_tools: any
@@ -17,8 +20,8 @@
status_file: any
webdriver: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
analyzer: any
expect: any
- file: any
glob: any
diff --git a/pkg/test_runner/tool/update_static_error_tests.dart b/pkg/test_runner/tool/update_static_error_tests.dart
index 23be296..7ebda75 100644
--- a/pkg/test_runner/tool/update_static_error_tests.dart
+++ b/pkg/test_runner/tool/update_static_error_tests.dart
@@ -7,11 +7,9 @@
import 'dart:io';
import 'package:args/args.dart';
-import 'package:file/file.dart' as pkg_file;
import 'package:glob/glob.dart';
import 'package:glob/list_local_fs.dart';
import 'package:path/path.dart' as p;
-
import 'package:test_runner/src/command_output.dart';
import 'package:test_runner/src/feature.dart' show Feature;
import 'package:test_runner/src/path.dart';
@@ -123,16 +121,17 @@
// or relative to the current directory.
var root = result.startsWith("tests") ? "." : "tests";
var glob = Glob(result, recursive: true);
- for (var entry in glob.listSync(root: root)) {
- if (!entry.path.endsWith(".dart")) continue;
-
- if (entry is pkg_file.File) {
- await _processFile(entry,
- dryRun: dryRun,
- includeContext: includeContext,
- remove: removeSources,
- insert: insertSources);
- }
+ for (var entry in glob
+ .listSync(root: root)
+ .whereType<File>()
+ .where((file) => file.path.endsWith('.dart'))) {
+ await _processFile(
+ entry,
+ dryRun: dryRun,
+ includeContext: includeContext,
+ remove: removeSources,
+ insert: insertSources,
+ );
}
}
}
diff --git a/pkg/vm/pubspec.yaml b/pkg/vm/pubspec.yaml
index ca8bf35..009cfeba 100644
--- a/pkg/vm/pubspec.yaml
+++ b/pkg/vm/pubspec.yaml
@@ -6,6 +6,7 @@
environment:
sdk: '>=2.15.0 <3.0.0'
+# Use 'any' constraints here; we get our versions from the DEPS file.
dependencies:
args: any
build_integration: any
@@ -15,6 +16,7 @@
kernel: any
package_config: any
+# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
expect: any
json_rpc_2: any
diff --git a/pkg/vm_service/pubspec.yaml b/pkg/vm_service/pubspec.yaml
index 9eda722..7f9470e 100644
--- a/pkg/vm_service/pubspec.yaml
+++ b/pkg/vm_service/pubspec.yaml
@@ -11,6 +11,10 @@
dependencies:
+# We use 'any' version constraints here as we get our package versions from
+# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
+# best practice for packages is to specify their compatible version ranges.
+# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
async: any
expect: any
@@ -19,5 +23,5 @@
mockito: any
path: any
pub_semver: any
- test: any
test_package: any
+ test: any
diff --git a/pkg/vm_snapshot_analysis/pubspec.yaml b/pkg/vm_snapshot_analysis/pubspec.yaml
index 10816d4..b38740a 100644
--- a/pkg/vm_snapshot_analysis/pubspec.yaml
+++ b/pkg/vm_snapshot_analysis/pubspec.yaml
@@ -14,6 +14,10 @@
collection: ^1.15.0
path: ^1.8.0
+# We use 'any' version constraints here as we get our package versions from
+# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
+# best practice for packages is to specify their compatible version ranges.
+# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
lints: any
- test: ^1.16.8
+ test: any
diff --git a/pkg/wasm_builder/pubspec.yaml b/pkg/wasm_builder/pubspec.yaml
index af4d545..a4286a4 100644
--- a/pkg/wasm_builder/pubspec.yaml
+++ b/pkg/wasm_builder/pubspec.yaml
@@ -5,5 +5,3 @@
environment:
sdk: '>=2.12.0'
-
-dependencies:
diff --git a/runtime/vm/app_snapshot.cc b/runtime/vm/app_snapshot.cc
index 2b20b44..da71473 100644
--- a/runtime/vm/app_snapshot.cc
+++ b/runtime/vm/app_snapshot.cc
@@ -1873,12 +1873,12 @@
// in the current loading unit).
ObjectPoolPtr pool = code->untag()->object_pool_;
if (s->kind() == Snapshot::kFullAOT) {
- TracePool(s, pool, /*only_code=*/is_deferred);
+ TracePool(s, pool, /*only_call_targets=*/is_deferred);
} else {
if (s->InCurrentLoadingUnitOrRoot(pool)) {
s->Push(pool);
} else {
- TracePool(s, pool, /*only_code=*/true);
+ TracePool(s, pool, /*only_call_targets=*/true);
}
}
@@ -1946,7 +1946,7 @@
#endif
}
- void TracePool(Serializer* s, ObjectPoolPtr pool, bool only_code) {
+ void TracePool(Serializer* s, ObjectPoolPtr pool, bool only_call_targets) {
if (pool == ObjectPool::null()) {
return;
}
@@ -1957,8 +1957,18 @@
auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
if (entry_type == ObjectPool::EntryType::kTaggedObject) {
const ObjectPtr target = pool->untag()->data()[i].raw_obj_;
- if (!only_code || target->IsCode()) {
+ // A field is a call target because its initializer may be called
+ // indirectly by passing the field to the runtime. A const closure
+ // is a call target because its function may be called indirectly
+ // via a closure call.
+ if (!only_call_targets || target->IsCode() || target->IsFunction() ||
+ target->IsField() || target->IsClosure()) {
s->Push(target);
+ } else {
+ intptr_t cid = target->GetClassIdMayBeSmi();
+ if (cid >= kNumPredefinedCids) {
+ s->Push(s->isolate_group()->class_table()->At(cid));
+ }
}
}
}
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index ee450a6..6c6a023 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -424,6 +424,7 @@
typeparams_to_retain_(),
consts_to_retain_(),
seen_table_selectors_(),
+ api_uses_(),
error_(Error::Handle()),
get_runtime_type_is_unique_(false) {
ASSERT(Precompiler::singleton_ == NULL);
@@ -662,6 +663,8 @@
ProgramVisitor::Dedup(T);
}
+ PruneDictionaries();
+
if (retained_reasons_writer_ != nullptr) {
reasons_writer.Write();
retained_reasons_writer_ = nullptr;
@@ -752,6 +755,7 @@
}
}
if (!main.IsNull()) {
+ AddApiUse(main);
if (lib.LookupLocalFunction(name) == Function::null()) {
retain_root_library_caches_ = true;
}
@@ -1464,6 +1468,14 @@
return seen_table_selectors_.HasKey(selector_id);
}
+void Precompiler::AddApiUse(const Object& obj) {
+ api_uses_.Insert(&Object::ZoneHandle(Z, obj.ptr()));
+}
+
+bool Precompiler::HasApiUse(const Object& obj) {
+ return api_uses_.HasKey(&obj);
+}
+
void Precompiler::AddInstantiatedClass(const Class& cls) {
if (is_tracing()) {
tracer_->WriteClassInstantiationRef(cls);
@@ -1523,6 +1535,7 @@
&reusable_object_handle) ==
EntryPointPragma::kAlways) {
AddInstantiatedClass(cls);
+ AddApiUse(cls);
}
}
@@ -1541,6 +1554,7 @@
if (pragma == EntryPointPragma::kNever) continue;
AddField(field);
+ AddApiUse(field);
if (!field.is_static()) {
if (pragma != EntryPointPragma::kSetterOnly) {
@@ -1569,6 +1583,7 @@
type == EntryPointPragma::kCallOnly) {
functions_with_entry_point_pragmas_.Insert(function);
AddFunction(function, RetainReasons::kEntryPointPragma);
+ AddApiUse(function);
}
if ((type == EntryPointPragma::kAlways ||
@@ -1578,10 +1593,16 @@
function2 = function.ImplicitClosureFunction();
functions_with_entry_point_pragmas_.Insert(function2);
AddFunction(function2, RetainReasons::kEntryPointPragma);
+
+ // Not `function2`: Dart_GetField will lookup the regular function
+ // and get the implicit closure function from that.
+ AddApiUse(function);
}
if (function.IsGenerativeConstructor()) {
AddInstantiatedClass(cls);
+ AddApiUse(function);
+ AddApiUse(cls);
}
}
if (function.kind() == UntaggedFunction::kImplicitGetter &&
@@ -1591,6 +1612,7 @@
if (function.accessor_field() == field.ptr()) {
functions_with_entry_point_pragmas_.Insert(function);
AddFunction(function, RetainReasons::kImplicitGetter);
+ AddApiUse(function);
}
}
}
@@ -1601,6 +1623,7 @@
if (function.accessor_field() == field.ptr()) {
functions_with_entry_point_pragmas_.Insert(function);
AddFunction(function, RetainReasons::kImplicitSetter);
+ AddApiUse(function);
}
}
}
@@ -1611,9 +1634,15 @@
if (function.accessor_field() == field.ptr()) {
functions_with_entry_point_pragmas_.Insert(function);
AddFunction(function, RetainReasons::kImplicitStaticGetter);
+ AddApiUse(function);
}
}
}
+ if (function.is_native()) {
+ // The embedder will need to lookup this library to provide the native
+ // resolver, even if there are no embedder calls into the library.
+ AddApiUse(lib);
+ }
}
implicit_getters = GrowableObjectArray::null();
@@ -3069,6 +3098,166 @@
}
}
+void Precompiler::PruneDictionaries() {
+ // PRODUCT-only: pruning interferes with various uses of the service protocol,
+ // including heap analysis tools.
+#if defined(PRODUCT)
+ class PruneDictionariesVisitor {
+ public:
+ GrowableObjectArrayPtr PruneLibraries(
+ const GrowableObjectArray& libraries) {
+ for (intptr_t i = 0; i < libraries.Length(); i++) {
+ lib_ ^= libraries.At(i);
+ bool retain = PruneLibrary(lib_);
+ if (retain) {
+ lib_.set_index(retained_libraries_.Length());
+ retained_libraries_.Add(lib_);
+ } else {
+ lib_.set_index(-1);
+ lib_.set_private_key(null_string_);
+ }
+ }
+
+ Library::RegisterLibraries(Thread::Current(), retained_libraries_);
+ return retained_libraries_.ptr();
+ }
+
+ bool PruneLibrary(const Library& lib) {
+ dict_ = lib.dictionary();
+ intptr_t dict_size = dict_.Length() - 1;
+ intptr_t used = 0;
+ for (intptr_t i = 0; i < dict_size; i++) {
+ entry_ = dict_.At(i);
+ if (entry_.IsNull()) continue;
+
+ bool retain = false;
+ if (entry_.IsClass()) {
+ // dart:async: Fix async stack trace lookups in dart:async to annotate
+ // entry points or fail gracefully.
+ // dart:core, dart:collection, dart:typed_data: Isolate messaging
+ // between groups allows any class in these libraries.
+ retain = PruneClass(Class::Cast(entry_)) ||
+ (lib.url() == Symbols::DartAsync().ptr()) ||
+ (lib.url() == Symbols::DartCore().ptr()) ||
+ (lib.url() == Symbols::DartCollection().ptr()) ||
+ (lib.url() == Symbols::DartTypedData().ptr());
+ } else if (entry_.IsFunction() || entry_.IsField()) {
+ retain = precompiler_->HasApiUse(entry_);
+ } else {
+ FATAL("Unexpected library entry: %s", entry_.ToCString());
+ }
+ if (retain) {
+ used++;
+ } else {
+ dict_.SetAt(i, Object::null_object());
+ }
+ }
+ lib.RehashDictionary(dict_, used * 4 / 3 + 1);
+
+ bool retain = used > 0;
+ cls_ = lib.toplevel_class();
+ if (PruneClass(cls_)) {
+ retain = true;
+ }
+ if (lib.is_dart_scheme()) {
+ retain = true;
+ }
+ if (lib.ptr() == root_lib_.ptr()) {
+ retain = true;
+ }
+ if (precompiler_->HasApiUse(lib)) {
+ retain = true;
+ }
+ return retain;
+ }
+
+ bool PruneClass(const Class& cls) {
+ bool retain = precompiler_->HasApiUse(cls);
+
+ functions_ = cls.functions();
+ retained_functions_ = GrowableObjectArray::New();
+ for (intptr_t i = 0; i < functions_.Length(); i++) {
+ function_ ^= functions_.At(i);
+ if (precompiler_->HasApiUse(function_)) {
+ retained_functions_.Add(function_);
+ retain = true;
+ } else if (precompiler_->functions_called_dynamically_.ContainsKey(
+ function_)) {
+ retained_functions_.Add(function_);
+ // No `retain = true`: the function must appear in the method
+ // dictionary for lookup, but the class may still be removed from the
+ // library.
+ }
+ }
+ if (retained_functions_.Length() > 0) {
+ functions_ = Array::MakeFixedLength(retained_functions_);
+ cls.SetFunctions(functions_);
+ } else {
+ cls.SetFunctions(Object::empty_array());
+ }
+
+ fields_ = cls.fields();
+ retained_fields_ = GrowableObjectArray::New();
+ for (intptr_t i = 0; i < fields_.Length(); i++) {
+ field_ ^= fields_.At(i);
+ if (precompiler_->HasApiUse(field_)) {
+ retained_fields_.Add(field_);
+ retain = true;
+ }
+ }
+ if (retained_fields_.Length() > 0) {
+ fields_ = Array::MakeFixedLength(retained_fields_);
+ cls.SetFields(fields_);
+ } else {
+ cls.SetFields(Object::empty_array());
+ }
+
+ return retain;
+ }
+
+ explicit PruneDictionariesVisitor(Precompiler* precompiler, Zone* zone)
+ : precompiler_(precompiler),
+ lib_(Library::Handle(zone)),
+ dict_(Array::Handle(zone)),
+ entry_(Object::Handle(zone)),
+ cls_(Class::Handle(zone)),
+ functions_(Array::Handle(zone)),
+ fields_(Array::Handle(zone)),
+ function_(Function::Handle(zone)),
+ field_(Field::Handle(zone)),
+ retained_functions_(GrowableObjectArray::Handle(zone)),
+ retained_fields_(GrowableObjectArray::Handle(zone)),
+ retained_libraries_(
+ GrowableObjectArray::Handle(zone, GrowableObjectArray::New())),
+ root_lib_(Library::Handle(
+ zone,
+ precompiler->isolate_group()->object_store()->root_library())),
+ null_string_(String::Handle(zone)) {}
+
+ private:
+ Precompiler* const precompiler_;
+ Library& lib_;
+ Array& dict_;
+ Object& entry_;
+ Class& cls_;
+ Array& functions_;
+ Array& fields_;
+ Function& function_;
+ Field& field_;
+ GrowableObjectArray& retained_functions_;
+ GrowableObjectArray& retained_fields_;
+ const GrowableObjectArray& retained_libraries_;
+ const Library& root_lib_;
+ const String& null_string_;
+ };
+
+ HANDLESCOPE(T);
+ SafepointWriteRwLocker ml(T, T->isolate_group()->program_lock());
+ PruneDictionariesVisitor visitor(this, Z);
+ libraries_ = visitor.PruneLibraries(libraries_);
+#endif // defined(PRODUCT)
+}
+
// Traits for the HashTable template.
struct CodeKeyTraits {
static uint32_t Hash(const Object& key) { return Code::Cast(key).Size(); }
diff --git a/runtime/vm/compiler/aot/precompiler.h b/runtime/vm/compiler/aot/precompiler.h
index 4e0d211..50df9e7 100644
--- a/runtime/vm/compiler/aot/precompiler.h
+++ b/runtime/vm/compiler/aot/precompiler.h
@@ -210,6 +210,37 @@
typedef DirectChainedHashMap<TypeArgumentsKeyValueTrait> TypeArgumentsSet;
+class ProgramElementKeyValueTrait {
+ public:
+ // Typedefs needed for the DirectChainedHashMap template.
+ typedef const Object* Key;
+ typedef const Object* Value;
+ typedef const Object* Pair;
+
+ static Key KeyOf(Pair kv) { return kv; }
+
+ static Value ValueOf(Pair kv) { return kv; }
+
+ static inline uword Hash(Key key) {
+ if (key->IsFunction()) {
+ return Function::Cast(*key).Hash();
+ } else if (key->IsField()) {
+ return Field::Cast(*key).kernel_offset();
+ } else if (key->IsClass()) {
+ return Class::Cast(*key).kernel_offset();
+ } else if (key->IsLibrary()) {
+ return Library::Cast(*key).index();
+ }
+ FATAL("Unexpected type: %s\n", key->ToCString());
+ }
+
+ static inline bool IsKeyEqual(Pair pair, Key key) {
+ return pair->ptr() == key->ptr();
+ }
+};
+
+typedef DirectChainedHashMap<ProgramElementKeyValueTrait> ProgramElementSet;
+
class InstanceKeyValueTrait {
public:
// Typedefs needed for the DirectChainedHashMap template.
@@ -321,6 +352,8 @@
bool IsHitByTableSelector(const Function& function);
// Returns the reason if the function must be retained, otherwise nullptr.
const char* MustRetainFunction(const Function& function);
+ void AddApiUse(const Object& obj);
+ bool HasApiUse(const Object& obj);
void ProcessFunction(const Function& function);
void CheckForNewDynamicFunctions();
@@ -343,6 +376,7 @@
void DropClasses();
void DropLibraries();
void DiscardCodeObjects();
+ void PruneDictionaries();
DEBUG_ONLY(FunctionPtr FindUnvisitedRetainedFunction());
@@ -393,6 +427,7 @@
TypeParameterSet typeparams_to_retain_;
InstanceSet consts_to_retain_;
TableSelectorSet seen_table_selectors_;
+ ProgramElementSet api_uses_;
Error& error_;
compiler::DispatchTableGenerator* dispatch_table_generator_;
diff --git a/runtime/vm/compiler/asm_intrinsifier_riscv.cc b/runtime/vm/compiler/asm_intrinsifier_riscv.cc
index 39b610c..f172608 100644
--- a/runtime/vm/compiler/asm_intrinsifier_riscv.cc
+++ b/runtime/vm/compiler/asm_intrinsifier_riscv.cc
@@ -151,8 +151,19 @@
void AsmIntrinsifier::Smi_bitLength(Assembler* assembler,
Label* normal_ir_body) {
- // TODO(riscv)
- __ Bind(normal_ir_body);
+ __ lx(A0, Address(SP, 0 * target::kWordSize));
+ __ SmiUntag(A0);
+
+ // XOR with sign bit to complement bits if value is negative.
+ __ srai(A1, A0, XLEN - 1);
+ __ xor_(A0, A0, A1);
+
+ __ CountLeadingZeroes(A0, A0);
+
+ __ li(TMP, XLEN);
+ __ sub(A0, TMP, A0);
+ __ SmiTag(A0);
+ __ ret();
}
void AsmIntrinsifier::Bigint_lsh(Assembler* assembler, Label* normal_ir_body) {
@@ -234,11 +245,12 @@
__ andi(T5, T2, target::kBitsPerWord - 1); // T5 = bit shift
__ li(T6, target::kBitsPerWord);
__ sub(T6, T6, T5); // T6 = carry bit shift
+ __ sub(T1, T1, T4); // T1 = words to process
__ slli(TMP, T4, target::kWordSizeLog2);
__ add(T0, T0, TMP); // T0 = &src_digits[word_shift]
- __ li(T2, 0); // carry
+ // T2 = carry
__ lx(T2, FieldAddress(T0, target::TypedData::payload_offset()));
__ srl(T2, T2, T5);
__ addi(T0, T0, target::kWordSize);
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.cc b/runtime/vm/compiler/assembler/assembler_arm64.cc
index 9a3c611..e282fcb 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm64.cc
@@ -574,18 +574,13 @@
void Assembler::CompareObject(Register reg, const Object& object) {
ASSERT(IsOriginalObject(object));
- word offset = 0;
if (IsSameObject(compiler::NullObject(), object)) {
CompareObjectRegisters(reg, NULL_REG);
- } else if (target::CanLoadFromThread(object, &offset)) {
- ldr(TMP, Address(THR, offset));
- CompareObjectRegisters(reg, TMP);
- } else if (CanLoadFromObjectPool(object)) {
+ } else if (target::IsSmi(object)) {
+ CompareImmediate(reg, target::ToRawSmi(object), kObjectBytes);
+ } else {
LoadObject(TMP, object);
CompareObjectRegisters(reg, TMP);
- } else {
- ASSERT(target::IsSmi(object));
- CompareImmediate(reg, target::ToRawSmi(object), kObjectBytes);
}
}
@@ -678,7 +673,9 @@
if (fmovdi(vd, immd)) return;
int64_t imm64 = bit_cast<int64_t, double>(immd);
- if (constant_pool_allowed()) {
+ if (imm64 == 0) {
+ veor(vd, vd, vd);
+ } else if (constant_pool_allowed()) {
intptr_t index = object_pool_builder().FindImmediate64(imm64);
intptr_t offset = target::ObjectPool::element_offset(index);
LoadDFromOffset(vd, PP, offset);
@@ -1309,6 +1306,8 @@
// No store buffer update.
if (IsSameObject(compiler::NullObject(), value)) {
str(NULL_REG, dest);
+ } else if (target::IsSmi(value) && (target::ToRawSmi(value) == 0)) {
+ str(ZR, dest);
} else {
LoadObject(TMP2, value);
str(TMP2, dest);
@@ -1326,6 +1325,8 @@
// No store buffer update.
if (IsSameObject(compiler::NullObject(), value)) {
str(NULL_REG, dest, kObjectBytes);
+ } else if (target::IsSmi(value) && (target::ToRawSmi(value) == 0)) {
+ str(ZR, dest, kObjectBytes);
} else {
LoadObject(TMP2, value);
str(TMP2, dest, kObjectBytes);
@@ -1340,6 +1341,8 @@
Register value_reg = TMP2;
if (IsSameObject(compiler::NullObject(), value)) {
value_reg = NULL_REG;
+ } else if (target::IsSmi(value) && (target::ToRawSmi(value) == 0)) {
+ value_reg = ZR;
} else {
LoadObject(value_reg, value);
}
@@ -1361,6 +1364,8 @@
if (memory_order == kRelease) {
if (IsSameObject(compiler::NullObject(), value)) {
value_reg = NULL_REG;
+ } else if (target::IsSmi(value) && (target::ToRawSmi(value) == 0)) {
+ value_reg = ZR;
} else {
LoadObject(value_reg, value);
}
diff --git a/runtime/vm/compiler/assembler/assembler_arm64_test.cc b/runtime/vm/compiler/assembler/assembler_arm64_test.cc
index 9daefc3..7e36b4b 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64_test.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm64_test.cc
@@ -969,10 +969,8 @@
"fmovd v1, 3.000000\n"
"fmovd v2, 4.000000\n"
"fstpd v1, v2, [sp, #-16]!\n"
- "movz tmp, #0x0\n"
- "fmovdr v1, tmp\n"
- "movz tmp, #0x0\n"
- "fmovdr v2, tmp\n"
+ "veor v1, v1, v1\n"
+ "veor v2, v2, v2\n"
"fldpd v1, v2, [sp], #16 !\n"
"fsubd v0, v2, v1\n"
"mov csp, sp\n"
@@ -1001,10 +999,8 @@
"fmovd v1, 3.000000\n"
"fmovd v2, 4.000000\n"
"fstpq v1, v2, [sp, #-32]!\n"
- "movz tmp, #0x0\n"
- "fmovdr v1, tmp\n"
- "movz tmp, #0x0\n"
- "fmovdr v2, tmp\n"
+ "veor v1, v1, v1\n"
+ "veor v2, v2, v2\n"
"fldpq v1, v2, [sp], #32 !\n"
"fsubd v0, v2, v1\n"
"mov csp, sp\n"
@@ -2598,9 +2594,8 @@
"movk tmp, #0x406d lsl 48\n"
"fmovdr v2, tmp\n"
"fcmpd v1, v2\n"
- "beq +12\n"
- "movz tmp, #0x0\n"
- "fmovdr v0, tmp\n"
+ "beq +8\n"
+ "veor v0, v0, v0\n"
"ret\n");
}
@@ -2696,8 +2691,7 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz tmp, #0x0\n"
- "fmovdr v0, tmp\n"
+ "veor v0, v0, v0\n"
"movz tmp, #0x2000 lsl 32\n"
"movk tmp, #0x406d lsl 48\n"
"fmovdr v1, tmp\n"
@@ -2748,8 +2742,7 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz tmp, #0x0\n"
- "fmovdr v0, tmp\n"
+ "veor v0, v0, v0\n"
"movz tmp, #0x6000 lsl 32\n"
"movk tmp, #0x406d lsl 48\n"
"fmovdr v1, tmp\n"
@@ -2789,9 +2782,8 @@
"movk tmp, #0x406d lsl 48\n"
"fmovdr v1, tmp\n"
"fcmpd v1, #0.0\n"
- "bgt +16\n"
- "movz tmp, #0x0\n"
- "fmovdr v0, tmp\n"
+ "bgt +12\n"
+ "veor v0, v0, v0\n"
"ret\n"
"movz tmp, #0x4045 lsl 48\n"
"fmovdr v0, tmp\n"
@@ -5608,8 +5600,7 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(12.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz tmp, #0x0\n"
- "fmovdr v0, tmp\n"
+ "veor v0, v0, v0\n"
"fmovd v1, 1.000000\n"
"fmovd v2, 2.000000\n"
"fmovd v3, 3.000000\n"
@@ -5675,14 +5666,11 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(-6.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- ""
- "movz tmp, #0x0\n"
- "fmovdr v0, tmp\n"
+ "veor v0, v0, v0\n"
"fmovd v1, 1.000000\n"
"fmovd v2, 2.000000\n"
"fmovd v3, 3.000000\n"
- "movz tmp, #0x0\n"
- "fmovdr v5, tmp\n"
+ "veor v5, v5, v5\n"
"fcvtsd v0, v0\n"
"fcvtsd v1, v1\n"
"fcvtsd v2, v2\n"
@@ -5744,9 +5732,7 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(14.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- ""
- "movz tmp, #0x0\n"
- "fmovdr v0, tmp\n"
+ "veor v0, v0, v0\n"
"fmovd v1, 1.000000\n"
"fmovd v2, 2.000000\n"
"fmovd v3, 3.000000\n"
@@ -5811,9 +5797,7 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(4.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- ""
- "movz tmp, #0x0\n"
- "fmovdr v0, tmp\n"
+ "veor v0, v0, v0\n"
"fmovd v1, 1.000000\n"
"fmovd v2, 2.000000\n"
"fmovd v3, 3.000000\n"
@@ -5895,8 +5879,7 @@
EXPECT_DISASSEMBLY(
"fmovd v0, 2.000000\n"
"fmovd v1, 3.000000\n"
- "movz tmp, #0x0\n"
- "fmovdr v5, tmp\n"
+ "veor v5, v5, v5\n"
"vinsd v4[0], v0[0]\n"
"vinsd v4[1], v1[0]\n"
"vsubd v5, v5, v4\n"
@@ -6151,8 +6134,7 @@
"fcvtsd v0, v0\n"
"vinss v1[3], v0[0]\n"
"vinss v1[1], v0[0]\n"
- "movz tmp, #0x0\n"
- "fmovdr v0, tmp\n"
+ "veor v0, v0, v0\n"
"fcvtsd v0, v0\n"
"vinss v1[2], v0[0]\n"
"vinss v1[0], v0[0]\n"
diff --git a/runtime/vm/compiler/assembler/assembler_riscv.cc b/runtime/vm/compiler/assembler/assembler_riscv.cc
index 094182f..863adf4 100644
--- a/runtime/vm/compiler/assembler/assembler_riscv.cc
+++ b/runtime/vm/compiler/assembler/assembler_riscv.cc
@@ -3205,7 +3205,7 @@
// No store buffer update.
if (IsSameObject(compiler::NullObject(), value)) {
sx(NULL_REG, dest);
- } else if (target::IsSmi(object) && (target::ToRawSmi(object) == 0)) {
+ } else if (target::IsSmi(value) && (target::ToRawSmi(value) == 0)) {
sx(ZR, dest);
} else {
LoadObject(TMP2, value);
@@ -3226,7 +3226,7 @@
Register value_reg = TMP2;
if (IsSameObject(compiler::NullObject(), value)) {
value_reg = NULL_REG;
- } else if (target::IsSmi(object) && (target::ToRawSmi(object) == 0)) {
+ } else if (target::IsSmi(value) && (target::ToRawSmi(value) == 0)) {
value_reg = ZR;
} else {
LoadObject(value_reg, value);
@@ -3392,7 +3392,7 @@
if (IsSameObject(compiler::NullObject(), object)) {
CompareObjectRegisters(reg, NULL_REG);
} else if (target::IsSmi(object)) {
- CompareImmediate(reg, target::ToRawSmi(object));
+ CompareImmediate(reg, target::ToRawSmi(object), kObjectBytes);
} else {
LoadObject(TMP, object);
CompareObjectRegisters(reg, TMP);
@@ -4470,6 +4470,56 @@
bne(TMP, TMP2, overflow);
}
+void Assembler::CountLeadingZeroes(Register rd, Register rs) {
+ // Note: clz will appear in the Zbb extension.
+ // if (Supports(RV_Zbb)) {
+ // clz(rd, rs);
+ // }
+
+ // n = XLEN
+ // y = x >>32; if (y != 0) { n = n - 32; x = y; }
+ // y = x >>16; if (y != 0) { n = n - 16; x = y; }
+ // y = x >> 8; if (y != 0) { n = n - 8; x = y; }
+ // y = x >> 4; if (y != 0) { n = n - 4; x = y; }
+ // y = x >> 2; if (y != 0) { n = n - 2; x = y; }
+ // y = x >> 1; if (y != 0) { return n - 2; }
+ // return n - x;
+ Label l0, l1, l2, l3, l4, l5;
+ li(TMP2, XLEN);
+#if XLEN == 64
+ srli(TMP, rs, 32);
+ beqz(TMP, &l0, Assembler::kNearJump);
+ subi(TMP2, TMP2, 32);
+ mv(rs, TMP);
+ Bind(&l0);
+#endif
+ srli(TMP, rs, 16);
+ beqz(TMP, &l1, Assembler::kNearJump);
+ subi(TMP2, TMP2, 16);
+ mv(rs, TMP);
+ Bind(&l1);
+ srli(TMP, rs, 8);
+ beqz(TMP, &l2, Assembler::kNearJump);
+ subi(TMP2, TMP2, 8);
+ mv(rs, TMP);
+ Bind(&l2);
+ srli(TMP, rs, 4);
+ beqz(TMP, &l3, Assembler::kNearJump);
+ subi(TMP2, TMP2, 4);
+ mv(rs, TMP);
+ Bind(&l3);
+ srli(TMP, rs, 2);
+ beqz(TMP, &l4, Assembler::kNearJump);
+ subi(TMP2, TMP2, 2);
+ mv(rs, TMP);
+ Bind(&l4);
+ srli(TMP, rs, 1);
+ sub(rd, TMP2, rs);
+ beqz(TMP, &l5, Assembler::kNearJump);
+ subi(rd, TMP2, 2);
+ Bind(&l5);
+}
+
} // namespace compiler
} // namespace dart
diff --git a/runtime/vm/compiler/assembler/assembler_riscv.h b/runtime/vm/compiler/assembler/assembler_riscv.h
index dfb57fe..ac1e920 100644
--- a/runtime/vm/compiler/assembler/assembler_riscv.h
+++ b/runtime/vm/compiler/assembler/assembler_riscv.h
@@ -1412,6 +1412,9 @@
Register rs2,
Label* overflow);
+ // Clobbers [rs].
+ void CountLeadingZeroes(Register rd, Register rs);
+
private:
bool constant_pool_allowed_;
diff --git a/runtime/vm/compiler/assembler/disassembler_arm64.cc b/runtime/vm/compiler/assembler/disassembler_arm64.cc
index c16ca8e..d3d7b2c 100644
--- a/runtime/vm/compiler/assembler/disassembler_arm64.cc
+++ b/runtime/vm/compiler/assembler/disassembler_arm64.cc
@@ -1085,7 +1085,7 @@
void ARM64Decoder::DecodeAddSubShiftExt(Instr* instr) {
switch (instr->Bit(30)) {
case 0: {
- if ((instr->RdField() == R31) && (instr->SFField())) {
+ if (instr->RdField() == R31) {
Format(instr, "cmn'sf 'rn, 'shift_op");
} else {
Format(instr, "add'sf's 'rd, 'rn, 'shift_op");
@@ -1093,7 +1093,7 @@
break;
}
case 1: {
- if ((instr->RdField() == R31) && (instr->SFField())) {
+ if (instr->RdField() == R31) {
Format(instr, "cmp'sf 'rn, 'shift_op");
} else {
if (instr->RnField() == R31) {
@@ -1158,7 +1158,11 @@
Format(instr, "eon'sf 'rd, 'rn, 'shift_op");
break;
case 6:
- Format(instr, "and'sfs 'rd, 'rn, 'shift_op");
+ if (instr->RdField() == R31) {
+ Format(instr, "tst'sf 'rn, 'shift_op");
+ } else {
+ Format(instr, "and'sfs 'rd, 'rn, 'shift_op");
+ }
break;
case 7:
Format(instr, "bic'sfs 'rd, 'rn, 'shift_op");
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index 44c61f9..98a44f1 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -6822,12 +6822,6 @@
void EnterHandleScopeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
ASSERT(kEnterHandleScopeRuntimeEntry.is_leaf());
- if (kind_ == Kind::kGetTopHandleScope) {
- __ LoadMemoryValue(CallingConventions::kReturnReg, THR,
- compiler::target::Thread::api_top_scope_offset());
- return;
- }
-
Location arg_loc = FirstArgumentLocation();
__ EnterCFrame(arg_loc.IsRegister() ? 0 : compiler::target::kWordSize);
NoTemporaryAllocator no_temp;
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 08971e8..c4192ba 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -3674,6 +3674,23 @@
bool IsSmi() const { return compiler::target::IsSmi(value()); }
+ bool HasZeroRepresentation() const {
+ switch (representation()) {
+ case kTagged:
+ case kUnboxedUint8:
+ case kUnboxedUint16:
+ case kUnboxedUint32:
+ case kUnboxedInt32:
+ case kUnboxedInt64:
+ return IsSmi() && compiler::target::SmiValue(value()) == 0;
+ case kUnboxedDouble:
+ return compiler::target::IsDouble(value()) &&
+ bit_cast<uint64_t>(compiler::target::DoubleValue(value())) == 0;
+ default:
+ return false;
+ }
+ }
+
virtual bool ComputeCanDeoptimize() const { return false; }
virtual void InferRange(RangeAnalysis* analysis, Range* range);
@@ -5334,9 +5351,7 @@
class EnterHandleScopeInstr : public TemplateDefinition<0, NoThrow> {
public:
- enum class Kind { kEnterHandleScope = 0, kGetTopHandleScope = 1 };
-
- explicit EnterHandleScopeInstr(Kind kind) : kind_(kind) {}
+ EnterHandleScopeInstr() {}
DECLARE_INSTRUCTION(EnterHandleScope)
@@ -5347,8 +5362,6 @@
PRINT_OPERANDS_TO_SUPPORT
private:
- Kind kind_;
-
DISALLOW_COPY_AND_ASSIGN(EnterHandleScopeInstr);
};
diff --git a/runtime/vm/compiler/backend/il_arm.cc b/runtime/vm/compiler/backend/il_arm.cc
index 0f1784c..8794fb4 100644
--- a/runtime/vm/compiler/backend/il_arm.cc
+++ b/runtime/vm/compiler/backend/il_arm.cc
@@ -2184,11 +2184,13 @@
locs->set_temp(0, Location::RegisterLocation(kWriteBarrierSlotReg));
}
break;
- case kExternalTypedDataUint8ArrayCid:
case kExternalTypedDataUint8ClampedArrayCid:
+ case kTypedDataUint8ClampedArrayCid:
+ locs->set_in(2, LocationRegisterOrConstant(value()));
+ break;
+ case kExternalTypedDataUint8ArrayCid:
case kTypedDataInt8ArrayCid:
case kTypedDataUint8ArrayCid:
- case kTypedDataUint8ClampedArrayCid:
case kOneByteStringCid:
case kTwoByteStringCid:
case kTypedDataInt16ArrayCid:
diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc
index ac442ee..6c1cc4f 100644
--- a/runtime/vm/compiler/backend/il_arm64.cc
+++ b/runtime/vm/compiler/backend/il_arm64.cc
@@ -287,11 +287,15 @@
const intptr_t kNumTemps = 0;
LocationSummary* locs = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
- if (representation() == kUnboxedDouble) {
+ ConstantInstr* constant = value()->definition()->AsConstant();
+ if (constant != nullptr && constant->HasZeroRepresentation()) {
+ locs->set_in(0, Location::Constant(constant));
+ } else if (representation() == kUnboxedDouble) {
locs->set_in(0, Location::RequiresFpuRegister());
} else if (representation() == kUnboxedInt64) {
locs->set_in(0, Location::RequiresRegister());
} else {
+ ASSERT(representation() == kTagged);
locs->set_in(0, LocationAnyOrConstant(value()));
}
return locs;
@@ -354,11 +358,17 @@
if (value.IsRegister()) {
reg = value.reg();
} else if (value.IsConstant()) {
- if (compiler::IsSameObject(compiler::NullObject(), value.constant())) {
- reg = NULL_REG;
+ if (value.constant_instruction()->HasZeroRepresentation()) {
+ reg = ZR;
} else {
- reg = pusher.GetFreeTempRegister(compiler);
- __ LoadObject(reg, value.constant());
+ ASSERT(push_arg->representation() == kTagged);
+ const Object& constant = value.constant();
+ if (constant.IsNull()) {
+ reg = NULL_REG;
+ } else {
+ reg = pusher.GetFreeTempRegister(compiler);
+ __ LoadObject(reg, value.constant());
+ }
}
} else if (value.IsFpuRegister()) {
pusher.Flush(compiler);
@@ -613,19 +623,15 @@
}
} else if (destination.IsFpuRegister()) {
const VRegister dst = destination.fpu_reg();
- if (Utils::DoublesBitEqual(Double::Cast(value_).value(), 0.0)) {
- __ veor(dst, dst, dst);
- } else {
- __ LoadDImmediate(dst, Double::Cast(value_).value());
- }
+ __ LoadDImmediate(dst, Double::Cast(value_).value());
} else if (destination.IsDoubleStackSlot()) {
+ const intptr_t dest_offset = destination.ToStackSlotOffset();
if (Utils::DoublesBitEqual(Double::Cast(value_).value(), 0.0)) {
- __ veor(VTMP, VTMP, VTMP);
+ __ StoreToOffset(ZR, destination.base_reg(), dest_offset);
} else {
__ LoadDImmediate(VTMP, Double::Cast(value_).value());
+ __ StoreDToOffset(VTMP, destination.base_reg(), dest_offset);
}
- const intptr_t dest_offset = destination.ToStackSlotOffset();
- __ StoreDToOffset(VTMP, destination.base_reg(), dest_offset);
} else {
ASSERT(destination.IsStackSlot());
ASSERT(tmp != kNoRegister);
@@ -634,10 +640,20 @@
representation() == kUnboxedUint32 ||
representation() == kUnboxedInt64) {
const int64_t value = Integer::Cast(value_).AsInt64Value();
- __ LoadImmediate(tmp, value);
+ if (value == 0) {
+ tmp = ZR;
+ } else {
+ __ LoadImmediate(tmp, value);
+ }
} else {
ASSERT(representation() == kTagged);
- __ LoadObject(tmp, value_);
+ if (value_.IsNull()) {
+ tmp = NULL_REG;
+ } else if (value_.IsSmi() && Smi::Cast(value_).Value() == 0) {
+ tmp = ZR;
+ } else {
+ __ LoadObject(tmp, value_);
+ }
}
__ StoreToOffset(tmp, destination.base_reg(), dest_offset);
}
@@ -1940,11 +1956,13 @@
locs->set_temp(0, Location::RegisterLocation(kWriteBarrierSlotReg));
}
break;
- case kExternalTypedDataUint8ArrayCid:
case kExternalTypedDataUint8ClampedArrayCid:
+ case kTypedDataUint8ClampedArrayCid:
+ locs->set_in(2, LocationRegisterOrConstant(value()));
+ break;
+ case kExternalTypedDataUint8ArrayCid:
case kTypedDataInt8ArrayCid:
case kTypedDataUint8ArrayCid:
- case kTypedDataUint8ClampedArrayCid:
case kOneByteStringCid:
case kTwoByteStringCid:
case kTypedDataInt16ArrayCid:
@@ -1952,13 +1970,25 @@
case kTypedDataInt32ArrayCid:
case kTypedDataUint32ArrayCid:
case kTypedDataInt64ArrayCid:
- case kTypedDataUint64ArrayCid:
- locs->set_in(2, Location::RequiresRegister());
+ case kTypedDataUint64ArrayCid: {
+ ConstantInstr* constant = value()->definition()->AsConstant();
+ if (constant != nullptr && constant->HasZeroRepresentation()) {
+ locs->set_in(2, Location::Constant(constant));
+ } else {
+ locs->set_in(2, Location::RequiresRegister());
+ }
break;
+ }
case kTypedDataFloat32ArrayCid:
- case kTypedDataFloat64ArrayCid: // TODO(srdjan): Support Float64 constants.
- locs->set_in(2, Location::RequiresFpuRegister());
+ case kTypedDataFloat64ArrayCid: {
+ ConstantInstr* constant = value()->definition()->AsConstant();
+ if (constant != nullptr && constant->HasZeroRepresentation()) {
+ locs->set_in(2, Location::Constant(constant));
+ } else {
+ locs->set_in(2, Location::RequiresFpuRegister());
+ }
break;
+ }
case kTypedDataInt32x4ArrayCid:
case kTypedDataFloat32x4ArrayCid:
case kTypedDataFloat64x2ArrayCid:
@@ -2016,18 +2046,15 @@
case kTypedDataInt8ArrayCid:
case kTypedDataUint8ArrayCid:
case kExternalTypedDataUint8ArrayCid:
- case kOneByteStringCid: {
+ case kOneByteStringCid:
ASSERT(RequiredInputRepresentation(2) == kUnboxedIntPtr);
if (locs()->in(2).IsConstant()) {
- const Smi& constant = Smi::Cast(locs()->in(2).constant());
- __ LoadImmediate(TMP, static_cast<int8_t>(constant.Value()));
- __ str(TMP, element_address, compiler::kUnsignedByte);
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ str(ZR, element_address, compiler::kUnsignedByte);
} else {
- const Register value = locs()->in(2).reg();
- __ str(value, element_address, compiler::kUnsignedByte);
+ __ str(locs()->in(2).reg(), element_address, compiler::kUnsignedByte);
}
break;
- }
case kTypedDataUint8ClampedArrayCid:
case kExternalTypedDataUint8ClampedArrayCid: {
ASSERT(RequiredInputRepresentation(2) == kUnboxedIntPtr);
@@ -2040,8 +2067,12 @@
} else if (value < 0) {
value = 0;
}
- __ LoadImmediate(TMP, static_cast<int8_t>(value));
- __ str(TMP, element_address, compiler::kUnsignedByte);
+ if (value == 0) {
+ __ str(ZR, element_address, compiler::kUnsignedByte);
+ } else {
+ __ LoadImmediate(TMP, static_cast<int8_t>(value));
+ __ str(TMP, element_address, compiler::kUnsignedByte);
+ }
} else {
const Register value = locs()->in(2).reg();
// Clamp to 0x00 or 0xFF respectively.
@@ -2054,32 +2085,50 @@
}
case kTwoByteStringCid:
case kTypedDataInt16ArrayCid:
- case kTypedDataUint16ArrayCid: {
+ case kTypedDataUint16ArrayCid:
ASSERT(RequiredInputRepresentation(2) == kUnboxedIntPtr);
- const Register value = locs()->in(2).reg();
- __ str(value, element_address, compiler::kUnsignedTwoBytes);
+ if (locs()->in(2).IsConstant()) {
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ str(ZR, element_address, compiler::kUnsignedTwoBytes);
+ } else {
+ __ str(locs()->in(2).reg(), element_address,
+ compiler::kUnsignedTwoBytes);
+ }
break;
- }
case kTypedDataInt32ArrayCid:
- case kTypedDataUint32ArrayCid: {
- const Register value = locs()->in(2).reg();
- __ str(value, element_address, compiler::kUnsignedFourBytes);
+ case kTypedDataUint32ArrayCid:
+ if (locs()->in(2).IsConstant()) {
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ str(ZR, element_address, compiler::kUnsignedFourBytes);
+ } else {
+ __ str(locs()->in(2).reg(), element_address,
+ compiler::kUnsignedFourBytes);
+ }
break;
- }
case kTypedDataInt64ArrayCid:
- case kTypedDataUint64ArrayCid: {
- const Register value = locs()->in(2).reg();
- __ str(value, element_address, compiler::kEightBytes);
+ case kTypedDataUint64ArrayCid:
+ if (locs()->in(2).IsConstant()) {
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ str(ZR, element_address, compiler::kEightBytes);
+ } else {
+ __ str(locs()->in(2).reg(), element_address, compiler::kEightBytes);
+ }
break;
- }
- case kTypedDataFloat32ArrayCid: {
- const VRegister value_reg = locs()->in(2).fpu_reg();
- __ fstrs(value_reg, element_address);
+ case kTypedDataFloat32ArrayCid:
+ if (locs()->in(2).IsConstant()) {
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ str(ZR, element_address, compiler::kFourBytes);
+ } else {
+ __ fstrs(locs()->in(2).fpu_reg(), element_address);
+ }
break;
- }
case kTypedDataFloat64ArrayCid: {
- const VRegister value_reg = locs()->in(2).fpu_reg();
- __ fstrd(value_reg, element_address);
+ if (locs()->in(2).IsConstant()) {
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ str(ZR, element_address, compiler::kEightBytes);
+ } else {
+ __ fstrd(locs()->in(2).fpu_reg(), element_address);
+ }
break;
}
case kTypedDataFloat64x2ArrayCid:
@@ -2410,7 +2459,12 @@
summary->set_in(kValuePos, Location::RequiresRegister());
} else if (IsUnboxedDartFieldStore() && opt) {
summary->set_in(kValuePos, Location::RequiresFpuRegister());
- if (!FLAG_precompiled_mode) {
+ if (FLAG_precompiled_mode) {
+ ConstantInstr* constant = value()->definition()->AsConstant();
+ if (constant != nullptr && constant->HasZeroRepresentation()) {
+ summary->set_in(kValuePos, Location::Constant(constant));
+ }
+ } else {
summary->set_temp(0, Location::RequiresRegister());
summary->set_temp(1, Location::RequiresRegister());
}
@@ -2453,22 +2507,33 @@
if (IsUnboxedDartFieldStore() && compiler->is_optimizing()) {
ASSERT(memory_order_ != compiler::AssemblerBase::kRelease);
- const VRegister value = locs()->in(kValuePos).fpu_reg();
const intptr_t cid = slot().field().UnboxedFieldCid();
if (FLAG_precompiled_mode) {
switch (cid) {
case kDoubleCid:
__ Comment("UnboxedDoubleStoreInstanceFieldInstr");
- __ StoreDFieldToOffset(value, instance_reg, offset_in_bytes);
+ if (locs()->in(kValuePos).IsConstant()) {
+ ASSERT(locs()
+ ->in(kValuePos)
+ .constant_instruction()
+ ->HasZeroRepresentation());
+ __ StoreFieldToOffset(ZR, instance_reg, offset_in_bytes,
+ compiler::kEightBytes);
+ } else {
+ __ StoreDFieldToOffset(locs()->in(kValuePos).fpu_reg(),
+ instance_reg, offset_in_bytes);
+ }
return;
case kFloat32x4Cid:
__ Comment("UnboxedFloat32x4StoreInstanceFieldInstr");
- __ StoreQFieldToOffset(value, instance_reg, offset_in_bytes);
+ __ StoreQFieldToOffset(locs()->in(kValuePos).fpu_reg(), instance_reg,
+ offset_in_bytes);
return;
case kFloat64x2Cid:
__ Comment("UnboxedFloat64x2StoreInstanceFieldInstr");
- __ StoreQFieldToOffset(value, instance_reg, offset_in_bytes);
+ __ StoreQFieldToOffset(locs()->in(kValuePos).fpu_reg(), instance_reg,
+ offset_in_bytes);
return;
default:
UNREACHABLE();
@@ -2501,6 +2566,8 @@
} else {
__ LoadCompressedFieldFromOffset(temp, instance_reg, offset_in_bytes);
}
+
+ const VRegister value = locs()->in(kValuePos).fpu_reg();
switch (cid) {
case kDoubleCid:
__ Comment("UnboxedDoubleStoreInstanceFieldInstr");
diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc
index 76b1c00..f901a37f 100644
--- a/runtime/vm/compiler/backend/il_printer.cc
+++ b/runtime/vm/compiler/backend/il_printer.cc
@@ -1287,11 +1287,7 @@
}
void EnterHandleScopeInstr::PrintOperandsTo(BaseTextBuffer* f) const {
- if (kind_ == Kind::kEnterHandleScope) {
- f->AddString("<enter handle scope>");
- } else {
- f->AddString("<get top api scope>");
- }
+ f->AddString("<enter handle scope>");
}
void NativeReturnInstr::PrintOperandsTo(BaseTextBuffer* f) const {
diff --git a/runtime/vm/compiler/backend/il_riscv.cc b/runtime/vm/compiler/backend/il_riscv.cc
index 674370e..00b0cdb 100644
--- a/runtime/vm/compiler/backend/il_riscv.cc
+++ b/runtime/vm/compiler/backend/il_riscv.cc
@@ -322,7 +322,10 @@
const intptr_t kNumTemps = 0;
LocationSummary* locs = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
- if (representation() == kUnboxedDouble) {
+ ConstantInstr* constant = value()->definition()->AsConstant();
+ if (constant != nullptr && constant->HasZeroRepresentation()) {
+ locs->set_in(0, Location::Constant(constant));
+ } else if (representation() == kUnboxedDouble) {
locs->set_in(0, Location::RequiresFpuRegister());
} else if (representation() == kUnboxedInt64) {
#if XLEN == 32
@@ -332,6 +335,7 @@
locs->set_in(0, Location::RequiresRegister());
#endif
} else {
+ ASSERT(representation() == kTagged);
locs->set_in(0, LocationAnyOrConstant(value()));
}
return locs;
@@ -359,7 +363,14 @@
size += 2 * compiler::target::kWordSize;
#endif
} else if (value.IsConstant()) {
- size += compiler::target::kWordSize;
+ if (push_arg->representation() == kUnboxedDouble) {
+ size += sizeof(double);
+ } else if (push_arg->representation() == kUnboxedInt64) {
+ size += sizeof(int64_t);
+ } else {
+ ASSERT(push_arg->representation() == kTagged);
+ size += compiler::target::kWordSize;
+ }
} else if (value.IsFpuRegister()) {
size += sizeof(double);
} else if (value.IsStackSlot()) {
@@ -385,18 +396,39 @@
__ StoreToOffset(value.AsPairLocation()->At(0).reg(), SP, offset);
#endif
} else if (value.IsConstant()) {
- const Object& constant = value.constant();
- Register reg;
- if (constant.IsNull()) {
- reg = NULL_REG;
- } else if (constant.IsSmi() && Smi::Cast(constant).Value() == 0) {
- reg = ZR;
+ if (push_arg->representation() == kUnboxedDouble) {
+ ASSERT(value.constant_instruction()->HasZeroRepresentation());
+ offset -= sizeof(double);
+#if XLEN == 32
+ __ StoreToOffset(ZR, SP, offset + 4);
+ __ StoreToOffset(ZR, SP, offset);
+#else
+ __ StoreToOffset(ZR, SP, offset);
+#endif
+ } else if (push_arg->representation() == kUnboxedInt64) {
+ ASSERT(value.constant_instruction()->HasZeroRepresentation());
+ offset -= sizeof(int64_t);
+#if XLEN == 32
+ __ StoreToOffset(ZR, SP, offset + 4);
+ __ StoreToOffset(ZR, SP, offset);
+#else
+ __ StoreToOffset(ZR, SP, offset);
+#endif
} else {
- reg = TMP;
- __ LoadObject(TMP, constant);
+ ASSERT(push_arg->representation() == kTagged);
+ const Object& constant = value.constant();
+ Register reg;
+ if (constant.IsNull()) {
+ reg = NULL_REG;
+ } else if (constant.IsSmi() && Smi::Cast(constant).Value() == 0) {
+ reg = ZR;
+ } else {
+ reg = TMP;
+ __ LoadObject(TMP, constant);
+ }
+ offset -= compiler::target::kWordSize;
+ __ StoreToOffset(reg, SP, offset);
}
- offset -= compiler::target::kWordSize;
- __ StoreToOffset(reg, SP, offset);
} else if (value.IsFpuRegister()) {
offset -= sizeof(double);
__ StoreDToOffset(value.fpu_reg(), SP, offset);
@@ -684,24 +716,33 @@
const FRegister dst = destination.fpu_reg();
__ LoadDImmediate(dst, Double::Cast(value_).value());
} else if (destination.IsDoubleStackSlot()) {
- __ LoadDImmediate(FTMP, Double::Cast(value_).value());
const intptr_t dest_offset = destination.ToStackSlotOffset();
- __ StoreDToOffset(FTMP, destination.base_reg(), dest_offset);
+#if XLEN == 32
+ if (false) {
+#else
+ if (Utils::DoublesBitEqual(Double::Cast(value_).value(), 0.0)) {
+#endif
+ __ StoreToOffset(ZR, destination.base_reg(), dest_offset);
+ } else {
+ __ LoadDImmediate(FTMP, Double::Cast(value_).value());
+ __ StoreDToOffset(FTMP, destination.base_reg(), dest_offset);
+ }
} else {
ASSERT(destination.IsStackSlot());
ASSERT(tmp != kNoRegister);
const intptr_t dest_offset = destination.ToStackSlotOffset();
if (RepresentationUtils::IsUnboxedInteger(representation())) {
- int64_t v;
- const bool ok = compiler::HasIntegerValue(value_, &v);
- RELEASE_ASSERT(ok);
+ int64_t val = Integer::Cast(value_).AsInt64Value();
#if XLEN == 32
- __ LoadImmediate(
- tmp, pair_index == 0 ? Utils::Low32Bits(v) : Utils::High32Bits(v));
+ val = pair_index == 0 ? Utils::Low32Bits(val) : Utils::High32Bits(val);
#else
ASSERT(pair_index == 0); // No pair representation needed on 64-bit.
- __ LoadImmediate(tmp, v);
#endif
+ if (val == 0) {
+ tmp = ZR;
+ } else {
+ __ LoadImmediate(tmp, val);
+ }
} else {
ASSERT(representation() == kTagged);
if (value_.IsNull()) {
@@ -2159,32 +2200,64 @@
locs->set_temp(0, Location::RegisterLocation(kWriteBarrierSlotReg));
}
break;
- case kExternalTypedDataUint8ArrayCid:
case kExternalTypedDataUint8ClampedArrayCid:
+ case kTypedDataUint8ClampedArrayCid:
+ locs->set_in(2, LocationRegisterOrConstant(value()));
+ break;
+ case kExternalTypedDataUint8ArrayCid:
case kTypedDataInt8ArrayCid:
case kTypedDataUint8ArrayCid:
- case kTypedDataUint8ClampedArrayCid:
case kOneByteStringCid:
case kTwoByteStringCid:
case kTypedDataInt16ArrayCid:
case kTypedDataUint16ArrayCid:
case kTypedDataInt32ArrayCid:
- case kTypedDataUint32ArrayCid:
- locs->set_in(2, Location::RequiresRegister());
+ case kTypedDataUint32ArrayCid: {
+ ConstantInstr* constant = value()->definition()->AsConstant();
+ if (constant != nullptr && constant->HasZeroRepresentation()) {
+ locs->set_in(2, Location::Constant(constant));
+ } else {
+ locs->set_in(2, Location::RequiresRegister());
+ }
break;
+ }
case kTypedDataInt64ArrayCid:
- case kTypedDataUint64ArrayCid:
+ case kTypedDataUint64ArrayCid: {
#if XLEN == 32
locs->set_in(2, Location::Pair(Location::RequiresRegister(),
Location::RequiresRegister()));
#else
- locs->set_in(2, Location::RequiresRegister());
+ ConstantInstr* constant = value()->definition()->AsConstant();
+ if (constant != nullptr && constant->HasZeroRepresentation()) {
+ locs->set_in(2, Location::Constant(constant));
+ } else {
+ locs->set_in(2, Location::RequiresRegister());
+ }
#endif
break;
- case kTypedDataFloat32ArrayCid:
- case kTypedDataFloat64ArrayCid: // TODO(srdjan): Support Float64 constants.
- locs->set_in(2, Location::RequiresFpuRegister());
+ }
+ case kTypedDataFloat32ArrayCid: {
+ ConstantInstr* constant = value()->definition()->AsConstant();
+ if (constant != nullptr && constant->HasZeroRepresentation()) {
+ locs->set_in(2, Location::Constant(constant));
+ } else {
+ locs->set_in(2, Location::RequiresFpuRegister());
+ }
break;
+ }
+ case kTypedDataFloat64ArrayCid: {
+#if XLEN == 32
+ locs->set_in(2, Location::RequiresFpuRegister());
+#else
+ ConstantInstr* constant = value()->definition()->AsConstant();
+ if (constant != nullptr && constant->HasZeroRepresentation()) {
+ locs->set_in(2, Location::Constant(constant));
+ } else {
+ locs->set_in(2, Location::RequiresFpuRegister());
+ }
+#endif
+ break;
+ }
case kTypedDataInt32x4ArrayCid:
case kTypedDataFloat32x4ArrayCid:
case kTypedDataFloat64x2ArrayCid:
@@ -2245,9 +2318,8 @@
case kOneByteStringCid: {
ASSERT(RequiredInputRepresentation(2) == kUnboxedIntPtr);
if (locs()->in(2).IsConstant()) {
- const Smi& constant = Smi::Cast(locs()->in(2).constant());
- __ LoadImmediate(TMP, static_cast<int8_t>(constant.Value()));
- __ sb(TMP, element_address);
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ sb(ZR, element_address);
} else {
const Register value = locs()->in(2).reg();
__ sb(value, element_address);
@@ -2266,8 +2338,12 @@
} else if (value < 0) {
value = 0;
}
- __ LoadImmediate(TMP, static_cast<int8_t>(value));
- __ sb(TMP, element_address);
+ if (value == 0) {
+ __ sb(ZR, element_address);
+ } else {
+ __ LoadImmediate(TMP, static_cast<int8_t>(value));
+ __ sb(TMP, element_address);
+ }
} else {
const Register value = locs()->in(2).reg();
@@ -2294,21 +2370,33 @@
case kTypedDataInt16ArrayCid:
case kTypedDataUint16ArrayCid: {
ASSERT(RequiredInputRepresentation(2) == kUnboxedIntPtr);
- const Register value = locs()->in(2).reg();
- __ sh(value, element_address);
+ if (locs()->in(2).IsConstant()) {
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ sh(ZR, element_address);
+ } else {
+ __ sh(locs()->in(2).reg(), element_address);
+ }
break;
}
case kTypedDataInt32ArrayCid:
case kTypedDataUint32ArrayCid: {
- const Register value = locs()->in(2).reg();
- __ sw(value, element_address);
+ if (locs()->in(2).IsConstant()) {
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ sw(ZR, element_address);
+ } else {
+ __ sw(locs()->in(2).reg(), element_address);
+ }
break;
}
case kTypedDataInt64ArrayCid:
case kTypedDataUint64ArrayCid: {
#if XLEN >= 64
- const Register value = locs()->in(2).reg();
- __ sd(value, element_address);
+ if (locs()->in(2).IsConstant()) {
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ sd(ZR, element_address);
+ } else {
+ __ sd(locs()->in(2).reg(), element_address);
+ }
#else
PairLocation* value_pair = locs()->in(2).AsPairLocation();
Register value_lo = value_pair->At(0).reg();
@@ -2320,13 +2408,25 @@
break;
}
case kTypedDataFloat32ArrayCid: {
- const FRegister value_reg = locs()->in(2).fpu_reg();
- __ fsw(value_reg, element_address);
+ if (locs()->in(2).IsConstant()) {
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ sw(ZR, element_address);
+ } else {
+ __ fsw(locs()->in(2).fpu_reg(), element_address);
+ }
break;
}
case kTypedDataFloat64ArrayCid: {
- const FRegister value_reg = locs()->in(2).fpu_reg();
- __ fsd(value_reg, element_address);
+#if XLEN >= 64
+ if (locs()->in(2).IsConstant()) {
+ ASSERT(locs()->in(2).constant_instruction()->HasZeroRepresentation());
+ __ sd(ZR, element_address);
+ } else {
+ __ fsd(locs()->in(2).fpu_reg(), element_address);
+ }
+#else
+ __ fsd(locs()->in(2).fpu_reg(), element_address);
+#endif
break;
}
case kTypedDataFloat64x2ArrayCid:
@@ -2663,7 +2763,14 @@
}
} else if (IsUnboxedDartFieldStore() && opt) {
summary->set_in(kValuePos, Location::RequiresFpuRegister());
- if (!FLAG_precompiled_mode) {
+ if (FLAG_precompiled_mode) {
+#if XLEN >= 64
+ ConstantInstr* constant = value()->definition()->AsConstant();
+ if (constant != nullptr && constant->HasZeroRepresentation()) {
+ summary->set_in(kValuePos, Location::Constant(constant));
+ }
+#endif
+ } else {
summary->set_temp(0, Location::RequiresRegister());
summary->set_temp(1, Location::RequiresRegister());
}
@@ -2721,14 +2828,24 @@
if (IsUnboxedDartFieldStore() && compiler->is_optimizing()) {
ASSERT(memory_order_ != compiler::AssemblerBase::kRelease);
- const FRegister value = locs()->in(kValuePos).fpu_reg();
const intptr_t cid = slot().field().UnboxedFieldCid();
-
if (FLAG_precompiled_mode) {
switch (cid) {
case kDoubleCid:
__ Comment("UnboxedDoubleStoreInstanceFieldInstr");
- __ StoreDFieldToOffset(value, instance_reg, offset_in_bytes);
+#if XLEN >= 64
+ if (locs()->in(kValuePos).IsConstant()) {
+ ASSERT(locs()
+ ->in(kValuePos)
+ .constant_instruction()
+ ->HasZeroRepresentation());
+ __ StoreFieldToOffset(ZR, instance_reg, offset_in_bytes,
+ compiler::kEightBytes);
+ return;
+ }
+#endif
+ __ StoreDFieldToOffset(locs()->in(kValuePos).fpu_reg(), instance_reg,
+ offset_in_bytes);
return;
case kFloat32x4Cid:
__ Comment("UnboxedFloat32x4StoreInstanceFieldInstr");
@@ -2769,6 +2886,8 @@
} else {
__ LoadCompressedFieldFromOffset(temp, instance_reg, offset_in_bytes);
}
+
+ const FRegister value = locs()->in(kValuePos).fpu_reg();
switch (cid) {
case kDoubleCid:
__ Comment("UnboxedDoubleStoreInstanceFieldInstr");
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index fe6b416..fda2a9b 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -3982,17 +3982,17 @@
}
Fragment FlowGraphBuilder::EnterHandleScope() {
- auto* instr = new (Z)
- EnterHandleScopeInstr(EnterHandleScopeInstr::Kind::kEnterHandleScope);
+ auto* instr = new (Z) EnterHandleScopeInstr();
Push(instr);
return Fragment(instr);
}
Fragment FlowGraphBuilder::GetTopHandleScope() {
- auto* instr = new (Z)
- EnterHandleScopeInstr(EnterHandleScopeInstr::Kind::kGetTopHandleScope);
- Push(instr);
- return Fragment(instr);
+ Fragment body;
+ body += LoadThread();
+ body += LoadUntagged(compiler::target::Thread::api_top_scope_offset());
+ body += ConvertUntaggedToUnboxed(kUnboxedIntPtr);
+ return body;
}
Fragment FlowGraphBuilder::ExitHandleScope() {
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.h b/runtime/vm/compiler/frontend/kernel_to_il.h
index 4a4966f..697be82 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.h
+++ b/runtime/vm/compiler/frontend/kernel_to_il.h
@@ -380,7 +380,7 @@
// Generates a call to `Thread::EnterApiScope`.
Fragment EnterHandleScope();
- // Generates a call to `Thread::api_top_scope`.
+ // Generates a load of `Thread::api_top_scope`.
Fragment GetTopHandleScope();
// Generates a call to `Thread::ExitApiScope`.
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index d52cc58..7dba48a 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -1891,9 +1891,11 @@
Zone* zone = thread->zone();
intptr_t unit_count = helper_->ReadUInt();
Array& loading_units = Array::Handle(zone, Array::New(unit_count + 1));
+ Array& loading_unit_uris = Array::Handle(zone, Array::New(unit_count + 1));
LoadingUnit& unit = LoadingUnit::Handle(zone);
LoadingUnit& parent = LoadingUnit::Handle(zone);
Library& lib = Library::Handle(zone);
+ Array& uris = Array::Handle(zone);
for (int i = 0; i < unit_count; i++) {
intptr_t id = helper_->ReadUInt();
@@ -1907,6 +1909,7 @@
unit.set_parent(parent);
intptr_t library_count = helper_->ReadUInt();
+ uris = Array::New(library_count);
for (intptr_t j = 0; j < library_count; j++) {
const String& uri =
translation_helper_.DartSymbolPlain(helper_->ReadStringReference());
@@ -1915,14 +1918,18 @@
FATAL1("Missing library: %s\n", uri.ToCString());
}
lib.set_loading_unit(unit);
+ uris.SetAt(j, uri);
}
loading_units.SetAt(id, unit);
+ loading_unit_uris.SetAt(id, uris);
}
ObjectStore* object_store = IG->object_store();
ASSERT(object_store->loading_units() == Array::null());
object_store->set_loading_units(loading_units);
+ ASSERT(object_store->loading_unit_uris() == Array::null());
+ object_store->set_loading_unit_uris(loading_unit_uris);
}
CallSiteAttributesMetadataHelper::CallSiteAttributesMetadataHelper(
diff --git a/runtime/vm/compiler/runtime_api.cc b/runtime/vm/compiler/runtime_api.cc
index 6ccecf7..abf5464 100644
--- a/runtime/vm/compiler/runtime_api.cc
+++ b/runtime/vm/compiler/runtime_api.cc
@@ -931,6 +931,15 @@
return static_cast<word>(dart::Smi::Cast(a).Value());
}
+bool IsDouble(const dart::Object& a) {
+ return a.IsDouble();
+}
+
+double DoubleValue(const dart::Object& a) {
+ RELEASE_ASSERT(IsDouble(a));
+ return dart::Double::Cast(a).value();
+}
+
#if defined(TARGET_ARCH_IA32)
uword Code::EntryPointOf(const dart::Code& code) {
static_assert(kHostWordSize == kWordSize,
diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h
index 39752bc..3ce510e 100644
--- a/runtime/vm/compiler/runtime_api.h
+++ b/runtime/vm/compiler/runtime_api.h
@@ -373,6 +373,9 @@
word SmiValue(const dart::Object& a);
+bool IsDouble(const dart::Object& a);
+double DoubleValue(const dart::Object& a);
+
// If the given object can be loaded from the thread on the target then
// return true and set offset (if provided) to the offset from the
// thread pointer to a field that contains the object.
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 4f03fb7a..f8b05d2 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -6728,24 +6728,12 @@
DARTSCOPE(Thread::Current());
API_TIMELINE_DURATION(T);
- const GrowableObjectArray& result =
- GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
- const GrowableObjectArray& libs = GrowableObjectArray::Handle(
- Z, T->isolate_group()->object_store()->libraries());
- Library& lib = Library::Handle(Z);
- LoadingUnit& unit = LoadingUnit::Handle(Z);
- String& uri = String::Handle(Z);
- for (intptr_t i = 0; i < libs.Length(); i++) {
- lib ^= libs.At(i);
- unit = lib.loading_unit();
- if (unit.IsNull() || (unit.id() != loading_unit_id)) {
- continue;
- }
- uri = lib.url();
- result.Add(uri);
+ const Array& loading_units =
+ Array::Handle(Z, T->isolate_group()->object_store()->loading_unit_uris());
+ if (loading_unit_id >= 0 && loading_unit_id < loading_units.Length()) {
+ return Api::NewHandle(T, loading_units.At(loading_unit_id));
}
-
- return Api::NewHandle(T, Array::MakeFixedLength(result));
+ return Api::NewError("Invalid loading_unit_id");
#endif
}
diff --git a/runtime/vm/experimental_features.cc b/runtime/vm/experimental_features.cc
index 6ac7812..c776db0f 100644
--- a/runtime/vm/experimental_features.cc
+++ b/runtime/vm/experimental_features.cc
@@ -18,19 +18,8 @@
bool GetExperimentalFeatureDefault(ExperimentalFeature feature) {
constexpr bool kFeatureValues[] = {
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
+ true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true,
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureValues));
return kFeatureValues[static_cast<int>(feature)];
@@ -38,19 +27,20 @@
const char* GetExperimentalFeatureName(ExperimentalFeature feature) {
constexpr const char* kFeatureNames[] = {
- "nonfunction-type-aliases",
- "non-nullable",
- "extension-methods",
- "constant-update-2018",
- "control-flow-collections",
- "generic-metadata",
- "set-literals",
- "spread-collections",
- "triple-shift",
- "constructor-tearoffs",
- "enhanced-enums",
- "named-arguments-anywhere",
- "super-parameters",
+ "nonfunction-type-aliases",
+ "non-nullable",
+ "extension-methods",
+ "constant-update-2018",
+ "control-flow-collections",
+ "generic-metadata",
+ "set-literals",
+ "spread-collections",
+ "triple-shift",
+ "constructor-tearoffs",
+ "enhanced-enums",
+ "named-arguments-anywhere",
+ "super-parameters",
+ "inference-update-1",
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureNames));
return kFeatureNames[static_cast<int>(feature)];
diff --git a/runtime/vm/experimental_features.h b/runtime/vm/experimental_features.h
index c32ef01..be9be59 100644
--- a/runtime/vm/experimental_features.h
+++ b/runtime/vm/experimental_features.h
@@ -27,6 +27,7 @@
enhanced_enums,
named_arguments_anywhere,
super_parameters,
+ inference_update_1,
};
bool GetExperimentalFeatureDefault(ExperimentalFeature feature);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index deae310..0b5f8bc 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -12452,8 +12452,12 @@
untag()->set_name(name.ptr());
}
-void Library::set_url(const String& name) const {
- untag()->set_url(name.ptr());
+void Library::set_url(const String& url) const {
+ untag()->set_url(url.ptr());
+}
+
+void Library::set_private_key(const String& key) const {
+ untag()->set_private_key(key.ptr());
}
void Library::set_kernel_data(const ExternalTypedData& data) const {
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 6f226c3..dd1699a 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -5109,6 +5109,7 @@
// the name and url.
void set_name(const String& name) const;
void set_url(const String& url) const;
+ void set_private_key(const String& key) const;
void set_num_imports(intptr_t value) const;
void set_flags(uint8_t flags) const;
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index 674d1b4..718e61d 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -261,6 +261,7 @@
RW(Array, dispatch_table_code_entries) \
RW(GrowableObjectArray, instructions_tables) \
RW(Array, obfuscation_map) \
+ RW(Array, loading_unit_uris) \
RW(GrowableObjectArray, ffi_callback_functions) \
RW(Class, ffi_pointer_class) \
RW(Class, ffi_native_type_class) \
diff --git a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart
index b798adf..f028cb7 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart
@@ -44,6 +44,21 @@
}
}
+/// Throws if [useNewTypes] does not match the version of the type
+/// representation of this SDK.
+///
+/// The call to this method is inserted into every module at compile time.
+void _checkModuleRuntimeTypes(@notNull bool useNewTypes) {
+ if (useNewTypes != compileTimeFlag('newRuntimeTypes')) {
+ var sdkTypes = compileTimeFlag('newRuntimeTypes') ? 'new' : 'old';
+ var moduleTypes = useNewTypes ? 'new' : 'old';
+
+ throw AssertionError('The Dart SDK module is using the $sdkTypes runtime '
+ 'type representation and is incompatible with the $moduleTypes '
+ 'representation used in this module.');
+ }
+}
+
final _nullFailedSet = JS('!', 'new Set()');
String _nullFailedMessage(variableName) =>
diff --git a/sdk/lib/_internal/js_dev_runtime/private/foreign_helper.dart b/sdk/lib/_internal/js_dev_runtime/private/foreign_helper.dart
index 6551c93..354f448 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/foreign_helper.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/foreign_helper.dart
@@ -4,6 +4,9 @@
library dart._foreign_helper;
+import 'dart:_js_shared_embedded_names' show JsBuiltin, JsGetName;
+import 'dart:_rti' show Rti;
+
/**
* Emits a JavaScript code fragment parameterized by arguments.
*
@@ -221,7 +224,7 @@
external String JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG();
/// Returns the JS name for [name] from the Namer.
-external String JS_GET_NAME(String name);
+external String JS_GET_NAME(JsGetName name);
/// Returns the state of a flag that is determined by the state of the compiler
/// when the program has been analyzed.
@@ -274,3 +277,52 @@
throw StateError('The spread function cannot be called, '
'it should be compiled away.');
}
+
+/// Reads an embedded global.
+///
+/// The [name] should be a constant defined in the `_js_shared_embedded_names`
+/// library.
+external JS_EMBEDDED_GLOBAL(String typeDescription, String name);
+
+/// Instructs the compiler to execute the [builtinName] action at the call-site.
+///
+/// The [builtin] should be a constant defined in the
+/// `_js_shared_embedded_names` library.
+// Add additional optional arguments if needed. The method is treated internally
+// as a variable argument method.
+external JS_BUILTIN(String typeDescription, JsBuiltin builtin,
+ [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11]);
+
+/// Returns the interceptor for [object].
+///
+// TODO(nshahan) Replace calls at compile time?
+external getInterceptor(object);
+
+/// Returns the Rti object for the type for JavaScript arrays via JS-interop.
+///
+// TODO(nshahan) Replace calls at compile time?
+external Object getJSArrayInteropRti();
+
+/// Returns a raw reference to the JavaScript function which implements
+/// [function].
+///
+/// Warning: this is dangerous, you should probably use
+/// [DART_CLOSURE_TO_JS] instead. The returned object is not a valid
+/// Dart closure, does not store the isolate context or arity.
+///
+/// A valid example of where this can be used is as the second argument
+/// to V8's Error.captureStackTrace. See
+/// https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi.
+// TODO(nshahan) Replace calls at compile time?
+external RAW_DART_FUNCTION_REF(Function function);
+
+/// Returns a TypeReference to [T].
+// TODO(nshahan) Replace calls at compile time?
+external Rti TYPE_REF<T>();
+
+/// Returns a TypeReference to [T]*.
+// TODO(nshahan) Replace calls at compile time?
+external Rti LEGACY_TYPE_REF<T>();
+
+/// JavaScript string concatenation. Inputs must be Strings.
+external String JS_STRING_CONCAT(String a, String b);
diff --git a/sdk/lib/_internal/js_dev_runtime/private/interceptors.dart b/sdk/lib/_internal/js_dev_runtime/private/interceptors.dart
index 8e700e5..8bbd911 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/interceptors.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/interceptors.dart
@@ -23,9 +23,6 @@
String toString() => JS<String>('!', '#.toString()', this);
}
-// TODO(jmesserly): remove
-getInterceptor(obj) => obj;
-
/**
* The interceptor class for [bool].
*/
@@ -296,3 +293,6 @@
// TODO(sigmund): revisit whether this method is still needed after reoganizing
// all web tests.
findInterceptorForType(Type? type) {}
+
+// TODO(nshahan) Find a correct representation for JS functions.
+typedef JavaScriptFunction = dart.FunctionType;
diff --git a/sdk/lib/_internal/js_dev_runtime/private/js_names.dart b/sdk/lib/_internal/js_dev_runtime/private/js_names.dart
new file mode 100644
index 0000000..93e5e0d
--- /dev/null
+++ b/sdk/lib/_internal/js_dev_runtime/private/js_names.dart
@@ -0,0 +1,9 @@
+// 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.
+
+library dart._js_names;
+
+String? unmangleGlobalNameIfPreservedAnyways(String name) {
+ throw ('Unimplemented');
+}
diff --git a/sdk/lib/_internal/js_runtime/lib/synced/async_await_error_codes.dart b/sdk/lib/_internal/js_runtime/lib/synced/async_await_error_codes.dart
index 1708230..f87406b 100644
--- a/sdk/lib/_internal/js_runtime/lib/synced/async_await_error_codes.dart
+++ b/sdk/lib/_internal/js_runtime/lib/synced/async_await_error_codes.dart
@@ -2,8 +2,6 @@
// 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.12
-
/// Contains error codes that transformed async/async* functions use to
/// communicate with js_helper functions.
diff --git a/sdk/lib/_internal/js_runtime/lib/synced/embedded_names.dart b/sdk/lib/_internal/js_runtime/lib/synced/embedded_names.dart
index 0c99f47..bbb7001 100644
--- a/sdk/lib/_internal/js_runtime/lib/synced/embedded_names.dart
+++ b/sdk/lib/_internal/js_runtime/lib/synced/embedded_names.dart
@@ -2,8 +2,6 @@
// 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.12
-
/// Contains the names of globals that are embedded into the output by the
/// compiler.
///
diff --git a/sdk/lib/_internal/js_shared/lib/js_util_patch.dart b/sdk/lib/_internal/js_shared/lib/js_util_patch.dart
new file mode 100644
index 0000000..f67886e
--- /dev/null
+++ b/sdk/lib/_internal/js_shared/lib/js_util_patch.dart
@@ -0,0 +1,416 @@
+// 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:_foreign_helper' show JS;
+import 'dart:_js_helper'
+ show convertDartClosureToJS, assertInterop, assertInteropArgs, patch;
+import 'dart:collection' show HashMap;
+import 'dart:async' show Completer;
+import 'dart:js_util';
+
+@patch
+dynamic jsify(Object object) {
+ if ((object is! Map) && (object is! Iterable)) {
+ throw ArgumentError("object must be a Map or Iterable");
+ }
+ return _convertDataTree(object);
+}
+
+Object _convertDataTree(Object data) {
+ var _convertedObjects = HashMap.identity();
+
+ Object? _convert(Object? o) {
+ if (_convertedObjects.containsKey(o)) {
+ return _convertedObjects[o];
+ }
+ if (o is Map) {
+ final convertedMap = JS('=Object', '{}');
+ _convertedObjects[o] = convertedMap;
+ for (var key in o.keys) {
+ JS('=Object', '#[#]=#', convertedMap, key, _convert(o[key]));
+ }
+ return convertedMap;
+ } else if (o is Iterable) {
+ var convertedList = [];
+ _convertedObjects[o] = convertedList;
+ convertedList.addAll(o.map(_convert));
+ return convertedList;
+ } else {
+ return o;
+ }
+ }
+
+ return _convert(data)!;
+}
+
+@patch
+@pragma('dart2js:tryInline')
+Object get globalThis => JS('', 'globalThis');
+
+@patch
+T newObject<T>() => JS('=Object', '{}');
+
+@patch
+bool hasProperty(Object o, Object name) => JS('bool', '# in #', name, o);
+
+@patch
+T getProperty<T>(Object o, Object name) =>
+ JS<dynamic>('Object|Null', '#[#]', o, name);
+
+/// Similar to [getProperty] but introduces an unsound implicit cast to `T`.
+T _getPropertyTrustType<T>(Object o, Object name) =>
+ JS<T>('Object|Null', '#[#]', o, name);
+
+@patch
+T setProperty<T>(Object o, Object name, T? value) {
+ assertInterop(value);
+ return JS('', '#[#]=#', o, name, value);
+}
+
+/// Unchecked version of setProperty, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _setPropertyUnchecked<T>(Object o, Object name, T? value) {
+ return JS('', '#[#]=#', o, name, value);
+}
+
+@patch
+T callMethod<T>(Object o, String method, List<Object?> args) {
+ assertInteropArgs(args);
+ return JS<dynamic>('Object|Null', '#[#].apply(#, #)', o, method, o, args);
+}
+
+/// Similar to [callMethod] but introduces an unsound implicit cast to `T`.
+T _callMethodTrustType<T>(Object o, String method, List<Object?> args) {
+ assertInteropArgs(args);
+ return JS<T>('Object|Null', '#[#].apply(#, #)', o, method, o, args);
+}
+
+/// Unchecked version for 0 arguments, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _callMethodUnchecked0<T>(Object o, String method) {
+ return JS<dynamic>('Object|Null', '#[#]()', o, method);
+}
+
+/// Similar to [_callMethodUnchecked] but introduces an unsound implicit cast
+/// to `T`.
+@pragma('dart2js:tryInline')
+T _callMethodUncheckedTrustType0<T>(Object o, String method) {
+ return JS<T>('Object|Null', '#[#]()', o, method);
+}
+
+/// Unchecked version for 1 argument, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _callMethodUnchecked1<T>(Object o, String method, Object? arg1) {
+ return JS<dynamic>('Object|Null', '#[#](#)', o, method, arg1);
+}
+
+/// Similar to [_callMethodUnchecked1] but introduces an unsound implicit cast
+/// to `T`.
+@pragma('dart2js:tryInline')
+T _callMethodUncheckedTrustType1<T>(Object o, String method, Object? arg1) {
+ return JS<T>('Object|Null', '#[#](#)', o, method, arg1);
+}
+
+/// Unchecked version for 2 arguments, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _callMethodUnchecked2<T>(
+ Object o, String method, Object? arg1, Object? arg2) {
+ return JS<dynamic>('Object|Null', '#[#](#, #)', o, method, arg1, arg2);
+}
+
+/// Similar to [_callMethodUnchecked2] but introduces an unsound implicit cast
+/// to `T`.
+@pragma('dart2js:tryInline')
+T _callMethodUncheckedTrustType2<T>(
+ Object o, String method, Object? arg1, Object? arg2) {
+ return JS<T>('Object|Null', '#[#](#, #)', o, method, arg1, arg2);
+}
+
+/// Unchecked version for 3 arguments, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _callMethodUnchecked3<T>(
+ Object o, String method, Object? arg1, Object? arg2, Object? arg3) {
+ return JS<dynamic>(
+ 'Object|Null', '#[#](#, #, #)', o, method, arg1, arg2, arg3);
+}
+
+/// Similar to [_callMethodUnchecked3] but introduces an unsound implicit cast
+/// to `T`.
+@pragma('dart2js:tryInline')
+T _callMethodUncheckedTrustType3<T>(
+ Object o, String method, Object? arg1, Object? arg2, Object? arg3) {
+ return JS<T>('Object|Null', '#[#](#, #, #)', o, method, arg1, arg2, arg3);
+}
+
+/// Unchecked version for 4 arguments, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _callMethodUnchecked4<T>(Object o, String method, Object? arg1, Object? arg2,
+ Object? arg3, Object? arg4) {
+ return JS<dynamic>(
+ 'Object|Null', '#[#](#, #, #, #)', o, method, arg1, arg2, arg3, arg4);
+}
+
+/// Similar to [_callMethodUnchecked4] but introduces an unsound implicit cast
+/// to `T`.
+@pragma('dart2js:tryInline')
+T _callMethodUncheckedTrustType4<T>(Object o, String method, Object? arg1,
+ Object? arg2, Object? arg3, Object? arg4) {
+ return JS<T>(
+ 'Object|Null', '#[#](#, #, #, #)', o, method, arg1, arg2, arg3, arg4);
+}
+
+@patch
+bool instanceof(Object? o, Object type) =>
+ JS('bool', '# instanceof #', o, type);
+
+@patch
+T callConstructor<T>(Object constr, List<Object?>? arguments) {
+ if (arguments == null) {
+ return JS<dynamic>('Object', 'new #()', constr);
+ } else {
+ assertInteropArgs(arguments);
+ }
+
+ if (JS('bool', '# instanceof Array', arguments)) {
+ int argumentCount = JS('int', '#.length', arguments);
+ switch (argumentCount) {
+ case 0:
+ return JS<dynamic>('Object', 'new #()', constr);
+
+ case 1:
+ var arg0 = JS('', '#[0]', arguments);
+ return JS<dynamic>('Object', 'new #(#)', constr, arg0);
+
+ case 2:
+ var arg0 = JS('', '#[0]', arguments);
+ var arg1 = JS('', '#[1]', arguments);
+ return JS<dynamic>('Object', 'new #(#, #)', constr, arg0, arg1);
+
+ case 3:
+ var arg0 = JS('', '#[0]', arguments);
+ var arg1 = JS('', '#[1]', arguments);
+ var arg2 = JS('', '#[2]', arguments);
+ return JS<dynamic>(
+ 'Object', 'new #(#, #, #)', constr, arg0, arg1, arg2);
+
+ case 4:
+ var arg0 = JS('', '#[0]', arguments);
+ var arg1 = JS('', '#[1]', arguments);
+ var arg2 = JS('', '#[2]', arguments);
+ var arg3 = JS('', '#[3]', arguments);
+ return JS<dynamic>(
+ 'Object', 'new #(#, #, #, #)', constr, arg0, arg1, arg2, arg3);
+ }
+ }
+
+ // The following code solves the problem of invoking a JavaScript
+ // constructor with an unknown number arguments.
+ // First bind the constructor to the argument list using bind.apply().
+ // The first argument to bind() is the binding of 't', so add 'null' to
+ // the arguments list passed to apply().
+ // After that, use the JavaScript 'new' operator which overrides any binding
+ // of 'this' with the new instance.
+ var args = <dynamic>[null]..addAll(arguments);
+ var factoryFunction = JS('', '#.bind.apply(#, #)', constr, constr, args);
+ // Without this line, calling factoryFunction as a constructor throws
+ JS('String', 'String(#)', factoryFunction);
+ // This could return an UnknownJavaScriptObject, or a native
+ // object for which there is an interceptor
+ return JS<dynamic>('Object', 'new #()', factoryFunction);
+
+ // TODO(sra): Investigate:
+ //
+ // var jsObj = JS('', 'Object.create(#.prototype)', constr);
+ // JS('', '#.apply(#, #)', constr, jsObj,
+ // []..addAll(arguments.map(_convertToJS)));
+ // return _wrapToDart(jsObj);
+}
+
+/// Unchecked version for 0 arguments, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _callConstructorUnchecked0<T>(Object constr) {
+ return JS<dynamic>('Object', 'new #()', constr);
+}
+
+/// Unchecked version for 1 argument, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _callConstructorUnchecked1<T>(Object constr, Object? arg1) {
+ return JS<dynamic>('Object', 'new #(#)', constr, arg1);
+}
+
+/// Unchecked version for 2 arguments, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _callConstructorUnchecked2<T>(Object constr, Object? arg1, Object? arg2) {
+ return JS<dynamic>('Object', 'new #(#, #)', constr, arg1, arg2);
+}
+
+/// Unchecked version for 3 arguments, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _callConstructorUnchecked3<T>(
+ Object constr, Object? arg1, Object? arg2, Object? arg3) {
+ return JS<dynamic>('Object', 'new #(#, #, #)', constr, arg1, arg2, arg3);
+}
+
+/// Unchecked version for 4 arguments, only used in a CFE transformation.
+@pragma('dart2js:tryInline')
+T _callConstructorUnchecked4<T>(
+ Object constr, Object? arg1, Object? arg2, Object? arg3, Object? arg4) {
+ return JS<dynamic>(
+ 'Object', 'new #(#, #, #, #)', constr, arg1, arg2, arg3, arg4);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+T add<T>(Object? first, Object? second) {
+ return JS<dynamic>('Object', '# + #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+T subtract<T>(Object? first, Object? second) {
+ return JS<dynamic>('Object', '# - #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+T multiply<T>(Object? first, Object? second) {
+ return JS<dynamic>('Object', '# * #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+T divide<T>(Object? first, Object? second) {
+ return JS<dynamic>('Object', '# / #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+T exponentiate<T>(Object? first, Object? second) {
+ return JS<dynamic>('Object', '# ** #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+T modulo<T>(Object? first, Object? second) {
+ return JS<dynamic>('Object', '# % #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+bool equal<T>(Object? first, Object? second) {
+ return JS<bool>('bool', '# == #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+bool strictEqual<T>(Object? first, Object? second) {
+ return JS<bool>('bool', '# === #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+bool notEqual<T>(Object? first, Object? second) {
+ return JS<bool>('bool', '# != #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+bool strictNotEqual<T>(Object? first, Object? second) {
+ return JS<bool>('bool', '# !== #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+bool greaterThan<T>(Object? first, Object? second) {
+ return JS<bool>('bool', '# > #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+bool greaterThanOrEqual<T>(Object? first, Object? second) {
+ return JS<bool>('bool', '# >= #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+bool lessThan<T>(Object? first, Object? second) {
+ return JS<bool>('bool', '# < #', first, second);
+}
+
+@patch
+@pragma('dart2js:tryInline')
+bool lessThanOrEqual<T>(Object? first, Object? second) {
+ return JS<bool>('bool', '# <= #', first, second);
+}
+
+@patch
+Future<T> promiseToFuture<T>(Object jsPromise) {
+ final completer = Completer<T>();
+
+ final success = convertDartClosureToJS((r) => completer.complete(r), 1);
+ final error = convertDartClosureToJS((e) {
+ // Note that `completeError` expects a non-nullable error regardless of
+ // whether null-safety is enabled, so a `NullRejectionException` is always
+ // provided if the error is `null` or `undefined`.
+ if (e == null) {
+ return completer.completeError(
+ NullRejectionException._(JS('bool', '# === undefined', e)));
+ }
+ return completer.completeError(e);
+ }, 1);
+
+ JS('', '#.then(#, #)', jsPromise, success, error);
+ return completer.future;
+}
+
+@patch
+Object? objectGetPrototypeOf(Object? object) =>
+ JS('', 'Object.getPrototypeOf(#)', object);
+
+@patch
+Object? get objectPrototype => JS('', 'Object.prototype');
+
+@patch
+List<Object?> objectKeys(Object? object) => JS('', 'Object.keys(#)', object);
+
+@patch
+Object? dartify(Object? o) {
+ var _convertedObjects = HashMap.identity();
+ Object? convert() {
+ if (_convertedObjects.containsKey(o)) {
+ return _convertedObjects[o];
+ }
+ if (o == null || o is bool || o is num || o is String) return o;
+ if (isJavaScriptSimpleObject(o)) {
+ Map<Object?, Object?> dartObject = {};
+ _convertedObjects[o] = dartObject;
+ List<Object?> originalKeys = objectKeys(o);
+ List<Object?> dartKeys = [];
+ for (Object? key in originalKeys) {
+ dartKeys.add(dartify(key));
+ }
+ for (int i = 0; i < originalKeys.length; i++) {
+ Object? jsKey = originalKeys[i];
+ Object? dartKey = dartKeys[i];
+ if (jsKey != null) {
+ dartObject[dartKey] = dartify(getProperty(o, jsKey));
+ }
+ }
+ return dartObject;
+ }
+ if (isJavaScriptArray(o)) {
+ List<Object?> dartObject = [];
+ _convertedObjects[o] = dartObject;
+ int length = getProperty(o, 'length');
+ for (int i = 0; i < length; i++) {
+ dartObject.add(dartify(getProperty(o, i)));
+ }
+ return dartObject;
+ }
+ throw ArgumentError(
+ "JavaScriptObject $o must be a primitive, simple object, or array");
+ }
+
+ return convert();
+}
diff --git a/sdk/lib/_internal/js_shared/lib/synced/embedded_names.dart b/sdk/lib/_internal/js_shared/lib/synced/embedded_names.dart
index c2f6307..1e3317e 100644
--- a/sdk/lib/_internal/js_shared/lib/synced/embedded_names.dart
+++ b/sdk/lib/_internal/js_shared/lib/synced/embedded_names.dart
@@ -2,8 +2,6 @@
// 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.12
-
/// A 'Universe' object used by 'dart:_rti'.
const RTI_UNIVERSE = 'typeUniverse';
diff --git a/sdk/lib/_internal/js_shared/lib/synced/recipe_syntax.dart b/sdk/lib/_internal/js_shared/lib/synced/recipe_syntax.dart
index 3ccec60..b24e7c2 100644
--- a/sdk/lib/_internal/js_shared/lib/synced/recipe_syntax.dart
+++ b/sdk/lib/_internal/js_shared/lib/synced/recipe_syntax.dart
@@ -2,8 +2,6 @@
// 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.12
-
/// Constants and predicates used for encoding and decoding type recipes.
///
/// This library is synchronized between the compiler and the runtime system.
diff --git a/sdk/lib/_internal/vm/bin/socket_patch.dart b/sdk/lib/_internal/vm/bin/socket_patch.dart
index d0bddf8..a70896e 100644
--- a/sdk/lib/_internal/vm/bin/socket_patch.dart
+++ b/sdk/lib/_internal/vm/bin/socket_patch.dart
@@ -2543,6 +2543,7 @@
}
@patch
+@pragma("vm:entry-point")
class ResourceHandle {
factory ResourceHandle.fromFile(RandomAccessFile file) {
int fd = (file as _RandomAccessFile).fd;
diff --git a/sdk/lib/js_util/js_util.dart b/sdk/lib/js_util/js_util.dart
index 0f57f47..301f486 100644
--- a/sdk/lib/js_util/js_util.dart
+++ b/sdk/lib/js_util/js_util.dart
@@ -11,12 +11,6 @@
/// {@category Web}
library dart.js_util;
-import 'dart:_foreign_helper' show JS;
-import 'dart:collection' show HashMap;
-import 'dart:async' show Completer;
-import 'dart:_js_helper'
- show convertDartClosureToJS, assertInterop, assertInteropArgs;
-
// Examples can assume:
// class JS { const JS(); }
// class Promise<T> {}
@@ -34,340 +28,74 @@
/// converted into arrays. Strings, numbers, bools, and `@JS()` annotated
/// objects are passed through unmodified. Dart objects are also passed through
/// unmodified, but their members aren't usable from JavaScript.
-dynamic jsify(Object object) {
- if ((object is! Map) && (object is! Iterable)) {
- throw ArgumentError("object must be a Map or Iterable");
- }
- return _convertDataTree(object);
-}
+external dynamic jsify(Object object);
-Object _convertDataTree(Object data) {
- var _convertedObjects = HashMap.identity();
+external Object get globalThis;
- Object? _convert(Object? o) {
- if (_convertedObjects.containsKey(o)) {
- return _convertedObjects[o];
- }
- if (o is Map) {
- final convertedMap = JS('=Object', '{}');
- _convertedObjects[o] = convertedMap;
- for (var key in o.keys) {
- JS('=Object', '#[#]=#', convertedMap, key, _convert(o[key]));
- }
- return convertedMap;
- } else if (o is Iterable) {
- var convertedList = [];
- _convertedObjects[o] = convertedList;
- convertedList.addAll(o.map(_convert));
- return convertedList;
- } else {
- return o;
- }
- }
+external T newObject<T>();
- return _convert(data)!;
-}
+external bool hasProperty(Object o, Object name);
-@pragma('dart2js:tryInline')
-Object get globalThis => JS('', 'globalThis');
-
-T newObject<T>() => JS('=Object', '{}');
-
-bool hasProperty(Object o, Object name) => JS('bool', '# in #', name, o);
-
-T getProperty<T>(Object o, Object name) =>
- JS<dynamic>('Object|Null', '#[#]', o, name);
-
-/// Similar to [getProperty] but introduces an unsound implicit cast to `T`.
-T _getPropertyTrustType<T>(Object o, Object name) =>
- JS<T>('Object|Null', '#[#]', o, name);
+external T getProperty<T>(Object o, Object name);
// A CFE transformation may optimize calls to `setProperty`, when [value] is
// statically known to be a non-function.
-T setProperty<T>(Object o, Object name, T? value) {
- assertInterop(value);
- return JS('', '#[#]=#', o, name, value);
-}
-
-/// Unchecked version of setProperty, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _setPropertyUnchecked<T>(Object o, Object name, T? value) {
- return JS('', '#[#]=#', o, name, value);
-}
+external T setProperty<T>(Object o, Object name, T? value);
// A CFE transformation may optimize calls to `callMethod` when [args] is a
// a list literal or const list containing at most 4 values, all of which are
// statically known to be non-functions.
-T callMethod<T>(Object o, String method, List<Object?> args) {
- assertInteropArgs(args);
- return JS<dynamic>('Object|Null', '#[#].apply(#, #)', o, method, o, args);
-}
-
-/// Similar to [callMethod] but introduces an unsound implicit cast to `T`.
-T _callMethodTrustType<T>(Object o, String method, List<Object?> args) {
- assertInteropArgs(args);
- return JS<T>('Object|Null', '#[#].apply(#, #)', o, method, o, args);
-}
-
-/// Unchecked version for 0 arguments, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _callMethodUnchecked0<T>(Object o, String method) {
- return JS<dynamic>('Object|Null', '#[#]()', o, method);
-}
-
-/// Similar to [_callMethodUnchecked] but introduces an unsound implicit cast
-/// to `T`.
-@pragma('dart2js:tryInline')
-T _callMethodUncheckedTrustType0<T>(Object o, String method) {
- return JS<T>('Object|Null', '#[#]()', o, method);
-}
-
-/// Unchecked version for 1 argument, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _callMethodUnchecked1<T>(Object o, String method, Object? arg1) {
- return JS<dynamic>('Object|Null', '#[#](#)', o, method, arg1);
-}
-
-/// Similar to [_callMethodUnchecked1] but introduces an unsound implicit cast
-/// to `T`.
-@pragma('dart2js:tryInline')
-T _callMethodUncheckedTrustType1<T>(Object o, String method, Object? arg1) {
- return JS<T>('Object|Null', '#[#](#)', o, method, arg1);
-}
-
-/// Unchecked version for 2 arguments, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _callMethodUnchecked2<T>(
- Object o, String method, Object? arg1, Object? arg2) {
- return JS<dynamic>('Object|Null', '#[#](#, #)', o, method, arg1, arg2);
-}
-
-/// Similar to [_callMethodUnchecked2] but introduces an unsound implicit cast
-/// to `T`.
-@pragma('dart2js:tryInline')
-T _callMethodUncheckedTrustType2<T>(
- Object o, String method, Object? arg1, Object? arg2) {
- return JS<T>('Object|Null', '#[#](#, #)', o, method, arg1, arg2);
-}
-
-/// Unchecked version for 3 arguments, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _callMethodUnchecked3<T>(
- Object o, String method, Object? arg1, Object? arg2, Object? arg3) {
- return JS<dynamic>(
- 'Object|Null', '#[#](#, #, #)', o, method, arg1, arg2, arg3);
-}
-
-/// Similar to [_callMethodUnchecked3] but introduces an unsound implicit cast
-/// to `T`.
-@pragma('dart2js:tryInline')
-T _callMethodUncheckedTrustType3<T>(
- Object o, String method, Object? arg1, Object? arg2, Object? arg3) {
- return JS<T>('Object|Null', '#[#](#, #, #)', o, method, arg1, arg2, arg3);
-}
-
-/// Unchecked version for 4 arguments, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _callMethodUnchecked4<T>(Object o, String method, Object? arg1, Object? arg2,
- Object? arg3, Object? arg4) {
- return JS<dynamic>(
- 'Object|Null', '#[#](#, #, #, #)', o, method, arg1, arg2, arg3, arg4);
-}
-
-/// Similar to [_callMethodUnchecked4] but introduces an unsound implicit cast
-/// to `T`.
-@pragma('dart2js:tryInline')
-T _callMethodUncheckedTrustType4<T>(Object o, String method, Object? arg1,
- Object? arg2, Object? arg3, Object? arg4) {
- return JS<T>(
- 'Object|Null', '#[#](#, #, #, #)', o, method, arg1, arg2, arg3, arg4);
-}
+external T callMethod<T>(Object o, String method, List<Object?> args);
/// Check whether [o] is an instance of [type].
///
/// The value in [type] is expected to be a JS-interop object that
/// represents a valid JavaScript constructor function.
-bool instanceof(Object? o, Object type) =>
- JS('bool', '# instanceof #', o, type);
+external bool instanceof(Object? o, Object type);
-T callConstructor<T>(Object constr, List<Object?>? arguments) {
- if (arguments == null) {
- return JS<dynamic>('Object', 'new #()', constr);
- } else {
- assertInteropArgs(arguments);
- }
-
- if (JS('bool', '# instanceof Array', arguments)) {
- int argumentCount = JS('int', '#.length', arguments);
- switch (argumentCount) {
- case 0:
- return JS<dynamic>('Object', 'new #()', constr);
-
- case 1:
- var arg0 = JS('', '#[0]', arguments);
- return JS<dynamic>('Object', 'new #(#)', constr, arg0);
-
- case 2:
- var arg0 = JS('', '#[0]', arguments);
- var arg1 = JS('', '#[1]', arguments);
- return JS<dynamic>('Object', 'new #(#, #)', constr, arg0, arg1);
-
- case 3:
- var arg0 = JS('', '#[0]', arguments);
- var arg1 = JS('', '#[1]', arguments);
- var arg2 = JS('', '#[2]', arguments);
- return JS<dynamic>(
- 'Object', 'new #(#, #, #)', constr, arg0, arg1, arg2);
-
- case 4:
- var arg0 = JS('', '#[0]', arguments);
- var arg1 = JS('', '#[1]', arguments);
- var arg2 = JS('', '#[2]', arguments);
- var arg3 = JS('', '#[3]', arguments);
- return JS<dynamic>(
- 'Object', 'new #(#, #, #, #)', constr, arg0, arg1, arg2, arg3);
- }
- }
-
- // The following code solves the problem of invoking a JavaScript
- // constructor with an unknown number arguments.
- // First bind the constructor to the argument list using bind.apply().
- // The first argument to bind() is the binding of 't', so add 'null' to
- // the arguments list passed to apply().
- // After that, use the JavaScript 'new' operator which overrides any binding
- // of 'this' with the new instance.
- var args = <dynamic>[null]..addAll(arguments);
- var factoryFunction = JS('', '#.bind.apply(#, #)', constr, constr, args);
- // Without this line, calling factoryFunction as a constructor throws
- JS('String', 'String(#)', factoryFunction);
- // This could return an UnknownJavaScriptObject, or a native
- // object for which there is an interceptor
- return JS<dynamic>('Object', 'new #()', factoryFunction);
-
- // TODO(sra): Investigate:
- //
- // var jsObj = JS('', 'Object.create(#.prototype)', constr);
- // JS('', '#.apply(#, #)', constr, jsObj,
- // []..addAll(arguments.map(_convertToJS)));
- // return _wrapToDart(jsObj);
-}
-
-/// Unchecked version for 0 arguments, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _callConstructorUnchecked0<T>(Object constr) {
- return JS<dynamic>('Object', 'new #()', constr);
-}
-
-/// Unchecked version for 1 argument, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _callConstructorUnchecked1<T>(Object constr, Object? arg1) {
- return JS<dynamic>('Object', 'new #(#)', constr, arg1);
-}
-
-/// Unchecked version for 2 arguments, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _callConstructorUnchecked2<T>(Object constr, Object? arg1, Object? arg2) {
- return JS<dynamic>('Object', 'new #(#, #)', constr, arg1, arg2);
-}
-
-/// Unchecked version for 3 arguments, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _callConstructorUnchecked3<T>(
- Object constr, Object? arg1, Object? arg2, Object? arg3) {
- return JS<dynamic>('Object', 'new #(#, #, #)', constr, arg1, arg2, arg3);
-}
-
-/// Unchecked version for 4 arguments, only used in a CFE transformation.
-@pragma('dart2js:tryInline')
-T _callConstructorUnchecked4<T>(
- Object constr, Object? arg1, Object? arg2, Object? arg3, Object? arg4) {
- return JS<dynamic>(
- 'Object', 'new #(#, #, #, #)', constr, arg1, arg2, arg3, arg4);
-}
+external T callConstructor<T>(Object constr, List<Object?>? arguments);
/// Perform JavaScript addition (`+`) on two values.
-@pragma('dart2js:tryInline')
-T add<T>(Object? first, Object? second) {
- return JS<dynamic>('Object', '# + #', first, second);
-}
+external T add<T>(Object? first, Object? second);
/// Perform JavaScript subtraction (`-`) on two values.
-@pragma('dart2js:tryInline')
-T subtract<T>(Object? first, Object? second) {
- return JS<dynamic>('Object', '# - #', first, second);
-}
+external T subtract<T>(Object? first, Object? second);
/// Perform JavaScript multiplication (`*`) on two values.
-@pragma('dart2js:tryInline')
-T multiply<T>(Object? first, Object? second) {
- return JS<dynamic>('Object', '# * #', first, second);
-}
+external T multiply<T>(Object? first, Object? second);
/// Perform JavaScript division (`/`) on two values.
-@pragma('dart2js:tryInline')
-T divide<T>(Object? first, Object? second) {
- return JS<dynamic>('Object', '# / #', first, second);
-}
+external T divide<T>(Object? first, Object? second);
/// Perform JavaScript exponentiation (`**`) on two values.
-@pragma('dart2js:tryInline')
-T exponentiate<T>(Object? first, Object? second) {
- return JS<dynamic>('Object', '# ** #', first, second);
-}
+external T exponentiate<T>(Object? first, Object? second);
/// Perform JavaScript remainder (`%`) on two values.
-@pragma('dart2js:tryInline')
-T modulo<T>(Object? first, Object? second) {
- return JS<dynamic>('Object', '# % #', first, second);
-}
+external T modulo<T>(Object? first, Object? second);
/// Perform JavaScript equality comparison (`==`) on two values.
-@pragma('dart2js:tryInline')
-bool equal<T>(Object? first, Object? second) {
- return JS<bool>('bool', '# == #', first, second);
-}
+external bool equal<T>(Object? first, Object? second);
/// Perform JavaScript strict equality comparison (`===`) on two values.
-@pragma('dart2js:tryInline')
-bool strictEqual<T>(Object? first, Object? second) {
- return JS<bool>('bool', '# === #', first, second);
-}
+external bool strictEqual<T>(Object? first, Object? second);
/// Perform JavaScript inequality comparison (`!=`) on two values.
-@pragma('dart2js:tryInline')
-bool notEqual<T>(Object? first, Object? second) {
- return JS<bool>('bool', '# != #', first, second);
-}
+external bool notEqual<T>(Object? first, Object? second);
/// Perform JavaScript strict inequality comparison (`!==`) on two values.
-@pragma('dart2js:tryInline')
-bool strictNotEqual<T>(Object? first, Object? second) {
- return JS<bool>('bool', '# !== #', first, second);
-}
+external bool strictNotEqual<T>(Object? first, Object? second);
/// Perform JavaScript greater than comparison (`>`) of two values.
-@pragma('dart2js:tryInline')
-bool greaterThan<T>(Object? first, Object? second) {
- return JS<bool>('bool', '# > #', first, second);
-}
+external bool greaterThan<T>(Object? first, Object? second);
/// Perform JavaScript greater than or equal comparison (`>=`) of two values.
-@pragma('dart2js:tryInline')
-bool greaterThanOrEqual<T>(Object? first, Object? second) {
- return JS<bool>('bool', '# >= #', first, second);
-}
+external bool greaterThanOrEqual<T>(Object? first, Object? second);
/// Perform JavaScript less than comparison (`<`) of two values.
-@pragma('dart2js:tryInline')
-bool lessThan<T>(Object? first, Object? second) {
- return JS<bool>('bool', '# < #', first, second);
-}
+external bool lessThan<T>(Object? first, Object? second);
/// Perform JavaScript less than or equal comparison (`<=`) of two values.
-@pragma('dart2js:tryInline')
-bool lessThanOrEqual<T>(Object? first, Object? second) {
- return JS<bool>('bool', '# <= #', first, second);
-}
+external bool lessThanOrEqual<T>(Object? first, Object? second);
/// Exception for when the promise is rejected with a `null` or `undefined`
/// value.
@@ -399,24 +127,7 @@
/// final three = await threeFuture; // == 3
/// }
/// ```
-Future<T> promiseToFuture<T>(Object jsPromise) {
- final completer = Completer<T>();
-
- final success = convertDartClosureToJS((r) => completer.complete(r), 1);
- final error = convertDartClosureToJS((e) {
- // Note that `completeError` expects a non-nullable error regardless of
- // whether null-safety is enabled, so a `NullRejectionException` is always
- // provided if the error is `null` or `undefined`.
- if (e == null) {
- return completer.completeError(
- NullRejectionException._(JS('bool', '# === undefined', e)));
- }
- return completer.completeError(e);
- }, 1);
-
- JS('', '#.then(#, #)', jsPromise, success, error);
- return completer.future;
-}
+external Future<T> promiseToFuture<T>(Object jsPromise);
Object? _getConstructor(String constructorName) =>
getProperty(globalThis, constructorName);
@@ -430,14 +141,13 @@
/// Returns the prototype of a given object. Equivalent to
/// `Object.getPrototypeOf`.
-Object? objectGetPrototypeOf(Object? object) =>
- JS('', 'Object.getPrototypeOf(#)', object);
+external Object? objectGetPrototypeOf(Object? object);
/// Returns the `Object` prototype. Equivalent to `Object.prototype`.
-Object? get objectPrototype => JS('', 'Object.prototype');
+external Object? get objectPrototype;
/// Returns the keys for a given object. Equivalent to `Object.keys(object)`.
-List<Object?> objectKeys(Object? object) => JS('', 'Object.keys(#)', object);
+external List<Object?> objectKeys(Object? object);
/// Returns `true` if a given object is a JavaScript array.
bool isJavaScriptArray(value) => instanceOfString(value, 'Array');
@@ -451,42 +161,4 @@
/// Effectively the inverse of [jsify], [dartify] Takes a JavaScript object, and
/// converts it to a Dart based object. Only JS primitives, arrays, or 'map'
/// like JS objects are supported.
-Object? dartify(Object? o) {
- var _convertedObjects = HashMap.identity();
- Object? convert() {
- if (_convertedObjects.containsKey(o)) {
- return _convertedObjects[o];
- }
- if (o == null || o is bool || o is num || o is String) return o;
- if (isJavaScriptSimpleObject(o)) {
- Map<Object?, Object?> dartObject = {};
- _convertedObjects[o] = dartObject;
- List<Object?> originalKeys = objectKeys(o);
- List<Object?> dartKeys = [];
- for (Object? key in originalKeys) {
- dartKeys.add(dartify(key));
- }
- for (int i = 0; i < originalKeys.length; i++) {
- Object? jsKey = originalKeys[i];
- Object? dartKey = dartKeys[i];
- if (jsKey != null) {
- dartObject[dartKey] = dartify(getProperty(o, jsKey));
- }
- }
- return dartObject;
- }
- if (isJavaScriptArray(o)) {
- List<Object?> dartObject = [];
- _convertedObjects[o] = dartObject;
- int length = getProperty(o, 'length');
- for (int i = 0; i < length; i++) {
- dartObject.add(dartify(getProperty(o, i)));
- }
- return dartObject;
- }
- throw ArgumentError(
- "JavaScriptObject $o must be a primitive, simple object, or array");
- }
-
- return convert();
-}
+external Object? dartify(Object? o);
diff --git a/sdk/lib/libraries.json b/sdk/lib/libraries.json
index 4c5eb19..8da8878 100644
--- a/sdk/lib/libraries.json
+++ b/sdk/lib/libraries.json
@@ -342,7 +342,8 @@
"uri": "js/_js_annotations.dart"
},
"js_util": {
- "uri": "js_util/js_util.dart"
+ "uri": "js_util/js_util.dart",
+ "patches": "_internal/js_shared/lib/js_util_patch.dart"
},
"math": {
"uri": "math/math.dart",
@@ -424,9 +425,15 @@
"_js_annotations": {
"uri": "js/_js_annotations.dart"
},
+ "_js_shared_embedded_names": {
+ "uri": "_internal/js_shared/lib/synced/embedded_names.dart"
+ },
"_js_helper": {
"uri": "_internal/js_dev_runtime/private/js_helper.dart"
},
+ "_js_names": {
+ "uri": "_internal/js_dev_runtime/private/js_names.dart"
+ },
"_js_primitives": {
"uri": "_internal/js_dev_runtime/private/js_primitives.dart"
},
@@ -439,6 +446,12 @@
"_dart2js_runtime_metrics": {
"uri": "_internal/js_dev_runtime/private/runtime_metrics.dart"
},
+ "_rti": {
+ "uri": "_internal/js_shared/lib/rti.dart"
+ },
+ "_recipe_syntax": {
+ "uri": "_internal/js_shared/lib/synced/recipe_syntax.dart"
+ },
"async": {
"uri": "async/async.dart",
"patches": "_internal/js_dev_runtime/patch/async_patch.dart"
@@ -491,7 +504,8 @@
"patches": "_internal/js_dev_runtime/patch/js_patch.dart"
},
"js_util": {
- "uri": "js_util/js_util.dart"
+ "uri": "js_util/js_util.dart",
+ "patches": "_internal/js_shared/lib/js_util_patch.dart"
},
"svg": {
"uri": "svg/dart2js/svg_dart2js.dart"
diff --git a/sdk/lib/libraries.yaml b/sdk/lib/libraries.yaml
index c09c34e..fea4da3 100644
--- a/sdk/lib/libraries.yaml
+++ b/sdk/lib/libraries.yaml
@@ -311,6 +311,7 @@
js_util:
uri: "js_util/js_util.dart"
+ patches: "_internal/js_shared/lib/js_util_patch.dart"
math:
uri: "math/math.dart"
@@ -390,9 +391,15 @@
_js_annotations:
uri: "js/_js_annotations.dart"
+ _js_shared_embedded_names:
+ uri: "_internal/js_shared/lib/synced/embedded_names.dart"
+
_js_helper:
uri: "_internal/js_dev_runtime/private/js_helper.dart"
+ _js_names:
+ uri: "_internal/js_dev_runtime/private/js_names.dart"
+
_js_primitives:
uri: "_internal/js_dev_runtime/private/js_primitives.dart"
@@ -405,6 +412,12 @@
_dart2js_runtime_metrics:
uri: "_internal/js_dev_runtime/private/runtime_metrics.dart"
+ _rti:
+ uri: "_internal/js_shared/lib/rti.dart"
+
+ _recipe_syntax:
+ uri: "_internal/js_shared/lib/synced/recipe_syntax.dart"
+
async:
uri: "async/async.dart"
patches: "_internal/js_dev_runtime/patch/async_patch.dart"
@@ -458,6 +471,7 @@
js_util:
uri: "js_util/js_util.dart"
+ patches: "_internal/js_shared/lib/js_util_patch.dart"
svg:
uri: "svg/dart2js/svg_dart2js.dart"
diff --git a/tests/corelib/bigint_sll_test.dart b/tests/corelib/bigint_sll_test.dart
index 082c810..05be056 100644
--- a/tests/corelib/bigint_sll_test.dart
+++ b/tests/corelib/bigint_sll_test.dart
@@ -39,6 +39,12 @@
"d87becaa3701c97b31b5b8084f2b5b34e78570920000000000000000");
expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 65,
"1b0f7d9546e0392f6636b70109e56b669cf0ae1240000000000000000");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 127,
+ "6c3df6551b80e4bd98dadc042795ad9a73c2b84900000000000000000000000000000000");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 128,
+ "d87becaa3701c97b31b5b8084f2b5b34e785709200000000000000000000000000000000");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 129,
+ "1b0f7d9546e0392f6636b70109e56b669cf0ae12400000000000000000000000000000000");
expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 0,
"-d87becaa3701c97b31b5b8084f2b5b34e7857092");
@@ -58,4 +64,10 @@
"-d87becaa3701c97b31b5b8084f2b5b34e78570920000000000000000");
expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 65,
"-1b0f7d9546e0392f6636b70109e56b669cf0ae1240000000000000000");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 127,
+ "-6c3df6551b80e4bd98dadc042795ad9a73c2b84900000000000000000000000000000000");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 128,
+ "-d87becaa3701c97b31b5b8084f2b5b34e785709200000000000000000000000000000000");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 129,
+ "-1b0f7d9546e0392f6636b70109e56b669cf0ae12400000000000000000000000000000000");
}
diff --git a/tests/corelib/bigint_sra_test.dart b/tests/corelib/bigint_sra_test.dart
index a7d073a..dafe197 100644
--- a/tests/corelib/bigint_sra_test.dart
+++ b/tests/corelib/bigint_sra_test.dart
@@ -39,6 +39,9 @@
"d87becaa3701c97b31b5b808");
expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 65,
"6c3df6551b80e4bd98dadc04");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 127, "1b0f7d954");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 128, "d87becaa");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 129, "6c3df655");
expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 0,
"-d87becaa3701c97b31b5b8084f2b5b34e7857092");
@@ -58,4 +61,7 @@
"-d87becaa3701c97b31b5b809");
expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 65,
"-6c3df6551b80e4bd98dadc05");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 127, "-1b0f7d955");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 128, "-d87becab");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 129, "-6c3df656");
}
diff --git a/tests/corelib/iterable_empty_test.dart b/tests/corelib/iterable_empty_test.dart
index 7d26088..84749ce 100644
--- a/tests/corelib/iterable_empty_test.dart
+++ b/tests/corelib/iterable_empty_test.dart
@@ -18,7 +18,7 @@
Expect.throwsRangeError(() => it.elementAt(0), name);
Expect.throwsStateError(() => it.reduce((a, b) => a), name);
Expect.throwsStateError(() => it.singleWhere((_) => true), name);
- Expect.equals(42, it.fold(42, (a, b) => "not 42"), name);
+ Expect.equals(42, it.fold<dynamic>(42, (a, b) => "not 42"), name);
Expect.equals(42, it.firstWhere((v) => true, orElse: () => 42), name);
Expect.equals(42, it.lastWhere((v) => true, orElse: () => 42), name);
Expect.equals("", it.join("separator"), name);
diff --git a/tests/corelib_2/bigint_sll_test.dart b/tests/corelib_2/bigint_sll_test.dart
index 551f85f..9f00fd4 100644
--- a/tests/corelib_2/bigint_sll_test.dart
+++ b/tests/corelib_2/bigint_sll_test.dart
@@ -41,6 +41,12 @@
"d87becaa3701c97b31b5b8084f2b5b34e78570920000000000000000");
expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 65,
"1b0f7d9546e0392f6636b70109e56b669cf0ae1240000000000000000");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 127,
+ "6c3df6551b80e4bd98dadc042795ad9a73c2b84900000000000000000000000000000000");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 128,
+ "d87becaa3701c97b31b5b8084f2b5b34e785709200000000000000000000000000000000");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 129,
+ "1b0f7d9546e0392f6636b70109e56b669cf0ae12400000000000000000000000000000000");
expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 0,
"-d87becaa3701c97b31b5b8084f2b5b34e7857092");
@@ -60,4 +66,10 @@
"-d87becaa3701c97b31b5b8084f2b5b34e78570920000000000000000");
expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 65,
"-1b0f7d9546e0392f6636b70109e56b669cf0ae1240000000000000000");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 127,
+ "-6c3df6551b80e4bd98dadc042795ad9a73c2b84900000000000000000000000000000000");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 128,
+ "-d87becaa3701c97b31b5b8084f2b5b34e785709200000000000000000000000000000000");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 129,
+ "-1b0f7d9546e0392f6636b70109e56b669cf0ae12400000000000000000000000000000000");
}
diff --git a/tests/corelib_2/bigint_sra_test.dart b/tests/corelib_2/bigint_sra_test.dart
index 84f35f3..e4d8966 100644
--- a/tests/corelib_2/bigint_sra_test.dart
+++ b/tests/corelib_2/bigint_sra_test.dart
@@ -41,6 +41,9 @@
"d87becaa3701c97b31b5b808");
expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 65,
"6c3df6551b80e4bd98dadc04");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 127, "1b0f7d954");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 128, "d87becaa");
+ expectShifted("d87becaa3701c97b31b5b8084f2b5b34e7857092", 129, "6c3df655");
expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 0,
"-d87becaa3701c97b31b5b8084f2b5b34e7857092");
@@ -60,4 +63,7 @@
"-d87becaa3701c97b31b5b809");
expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 65,
"-6c3df6551b80e4bd98dadc05");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 127, "-1b0f7d955");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 128, "-d87becab");
+ expectShifted("-d87becaa3701c97b31b5b8084f2b5b34e7857092", 129, "-6c3df656");
}
diff --git a/tools/FAKE_COMMITS b/tools/FAKE_COMMITS
index b709239..b75d4b3 100644
--- a/tools/FAKE_COMMITS
+++ b/tools/FAKE_COMMITS
@@ -34,6 +34,7 @@
Trigger builds to check recipe changes
Trigger builds to check recipe changes
Trigger builds to test builder configuration change
+Trigger mac builds now that the snoopy service is installed
Analyzer branch commits:
Force build on new analyzer-branch linux build with new workflow
diff --git a/tools/VERSION b/tools/VERSION
index 9bcf7ac..e8c8999 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 149
+PRERELEASE 150
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml
index cea81af..dec610c 100644
--- a/tools/experimental_features.yaml
+++ b/tools/experimental_features.yaml
@@ -125,9 +125,6 @@
macros:
help: "Static meta-programming"
- inference-update-1:
- help: "Horizontal type inference for function expressions passed to generic invocations."
-
inference-update-2:
help: "Type promotion for fields"
@@ -264,3 +261,20 @@
void main(){
print(C('feature enabled').foo);
}
+
+ inference-update-1:
+ help: "Horizontal type inference for function expressions passed to generic invocations."
+ enabledIn: '2.18.0'
+ validation: |
+ void test(List<int> list) {
+ var a = list.fold(0, (x, y) => x + y);
+ f(a);
+ }
+ void f<T>(T t) {
+ if (T == int) {
+ print('feature enabled');
+ }
+ }
+ void main() {
+ test([1, 2, 3]);
+ }
diff --git a/tools/package_deps/bin/package_deps.dart b/tools/package_deps/bin/package_deps.dart
index 48bf5b0..3cf437c 100644
--- a/tools/package_deps/bin/package_deps.dart
+++ b/tools/package_deps/bin/package_deps.dart
@@ -1,7 +1,6 @@
import 'dart:io';
import 'package:cli_util/cli_logging.dart';
-import 'package:collection/collection.dart';
import 'package:path/path.dart' as path;
import 'package:pub_semver/pub_semver.dart';
import 'package:yaml/yaml.dart' as yaml;
@@ -252,41 +251,39 @@
fail = true;
}
- // Validate that we don't have relative deps into third_party.
- // TODO(devoncarew): This is currently just enforced for publishable
- // packages.
if (publishable) {
- for (PubDep dep in [..._declaredPubDeps, ..._declaredDevPubDeps]) {
- if (dep is PathPubDep) {
- var path = dep.path;
-
- if (path.contains('third_party/pkg_tested/') ||
- path.contains('third_party/pkg/')) {
- out(' Prefer a semver dependency for packages brought in via DEPS:');
- out(' $dep');
- fail = true;
- }
- }
- }
- }
-
- // Validate that published packages don't use path deps.
- if (publishable) {
+ // Validate that deps for published packages use semver (but not any).
for (PubDep dep in _declaredPubDeps) {
- if (dep is PathPubDep) {
- out(' Published packages should use semver deps:');
- out(' $dep');
- fail = true;
- }
+ if (dep is SemverPubDep) continue;
+
+ out(' Published packages should use semver deps:');
+ out(' $dep');
+ fail = true;
+ }
+
+ // Validate that dev deps for published packages use an 'any' constraint.
+ for (PubDep dep in _declaredDevPubDeps) {
+ if (dep is AnyPubDep) continue;
+
+ out(' Prefer an `any` constraint for dev dependencies');
+ out(' $dep');
+ fail = true;
+ }
+ } else {
+ // Validate that non-publishable packages use an 'any' constraint.
+ for (PubDep dep in [..._declaredPubDeps, ..._declaredDevPubDeps]) {
+ if (dep is AnyPubDep) continue;
+
+ out(' Prefer an `any` constraint for unpublished packages');
+ out(' $dep');
+ fail = true;
}
}
// Validate that the version of any package dep'd in works with our declared
// version ranges.
for (PubDep dep in [..._declaredPubDeps, ..._declaredDevPubDeps]) {
- if (dep is! SemverPubDep) {
- continue;
- }
+ if (dep is! SemverPubDep) continue;
ResolvedDep? resolvedDep = sdkDeps.resolve(dep.name);
if (resolvedDep == null) {
@@ -323,17 +320,6 @@
}
}
- // Validate that non-published packages use relative a (relative) path dep
- // for pkg/ packages.
- if (!publishable) {
- for (PubDep dep in [..._declaredPubDeps, ..._declaredDevPubDeps]) {
- if (dep is AnyPubDep) continue;
- out(' Prefer `any` dependencies for unpublished packages');
- out(' $dep');
- fail = true;
- }
- }
-
if (!fail) {
print(' No issues.');
}
diff --git a/tools/rev_sdk_deps.dart b/tools/rev_sdk_deps.dart
new file mode 100644
index 0000000..c9cbb5e
--- /dev/null
+++ b/tools/rev_sdk_deps.dart
@@ -0,0 +1,227 @@
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:path/path.dart' as path;
+
+// These packages are effectively pinned - they often require manual work when
+// rolling.
+// TODO(devoncarew): Keep this metadata in the DEPS file.
+const Set<String> pinned = {
+ 'dart_style',
+ 'linter',
+ 'pub',
+};
+
+void main(List<String> args) async {
+ // Validate we're running from the repo root.
+ if (!File('README.dart-sdk').existsSync() || !File('DEPS').existsSync()) {
+ stderr.writeln('Please run this script from the root of the SDK repo.');
+ exit(1);
+ }
+
+ final gclient = GClientHelper();
+
+ final deps = await gclient.getPackageDependencies();
+ print('${deps.length} non-pinned package dependencies found.');
+ print('');
+
+ deps.sort((a, b) => a.name.compareTo(b.name));
+
+ for (var dep in deps) {
+ final git = GitHelper(dep.relativePath);
+
+ await git.fetch();
+
+ var commit = await git.findLatestUnsyncedCommit();
+ if (commit.isNotEmpty) {
+ var gitLog = await git.calculateUnsyncedCommits();
+ var currentHash = await gclient.getHash(dep);
+
+ // Construct the github diff URL.
+ print('${dep.name} (${dep.getGithubDiffUrl(currentHash, commit)}):');
+
+ // Print out the new commits.
+ print(gitLog.split('\n').map((l) => ' $l').join('\n').trimRight());
+
+ // Update the DEPS file.
+ await gclient.setHash(dep, commit);
+
+ print('');
+ }
+ }
+}
+
+class GitHelper {
+ final String dir;
+
+ GitHelper(this.dir);
+
+ Future<String> fetch() {
+ return exec(['git', 'fetch'], cwd: dir);
+ }
+
+ Future<String> findLatestUnsyncedCommit() async {
+ // git log HEAD..origin --format=%H -1
+
+ var result = await exec(
+ [
+ 'git',
+ 'log',
+ 'HEAD..origin',
+ '--format=%H',
+ '-1',
+ ],
+ cwd: dir,
+ );
+ return result.trim();
+ }
+
+ Future<String> calculateUnsyncedCommits() async {
+ // git log HEAD..origin --format="%h %ad %aN %s" -1
+ var result = await exec(
+ [
+ 'git',
+ 'log',
+ 'HEAD..origin',
+ '--format=%h %ad %aN %s',
+ ],
+ cwd: dir,
+ );
+ return result.trim();
+ }
+}
+
+class GClientHelper {
+ Future<List<PackageDependency>> getPackageDependencies() async {
+ // gclient revinfo --output-json=<file> --ignore-dep-type=cipd
+
+ final tempDir = Directory.systemTemp.createTempSync();
+ final outFile = File(path.join(tempDir.path, 'deps.json'));
+
+ await exec([
+ 'gclient',
+ 'revinfo',
+ '--output-json=${outFile.path}',
+ '--ignore-dep-type=cipd',
+ ]);
+ Map<String, dynamic> m = jsonDecode(outFile.readAsStringSync());
+ tempDir.deleteSync(recursive: true);
+
+ return m.entries.map((entry) {
+ return PackageDependency(
+ entry: entry.key,
+ url: (entry.value as Map)['url'],
+ rev: (entry.value as Map)['rev'],
+ );
+ }).where((PackageDependency deps) {
+ return deps.entry.startsWith('sdk/third_party/pkg/') ||
+ deps.entry.startsWith('sdk/third_party/pkg_tested/');
+ }).where((PackageDependency deps) {
+ return !pinned.contains(deps.name);
+ }).toList();
+ }
+
+ Future<String> getHash(PackageDependency dep) async {
+ // DEPOT_TOOLS_UPDATE=0 gclient getdep --var=path_rev
+ var depName = dep.name;
+ var result = await exec(
+ [
+ 'gclient',
+ 'getdep',
+ '--var=${depName}_rev',
+ ],
+ environment: {
+ 'DEPOT_TOOLS_UPDATE': '0',
+ },
+ );
+ return result.trim();
+ }
+
+ Future<String> setHash(PackageDependency dep, String hash) async {
+ // gclient setdep --var=args_rev=9879dsf7g9d87d9f8g7
+ var depName = dep.name;
+ return await exec(
+ [
+ 'gclient',
+ 'setdep',
+ '--var=${depName}_rev=$hash',
+ ],
+ environment: {
+ 'DEPOT_TOOLS_UPDATE': '0',
+ },
+ );
+ }
+}
+
+class PackageDependency {
+ final String entry;
+ final String url;
+ final String? rev;
+
+ PackageDependency({
+ required this.entry,
+ required this.url,
+ required this.rev,
+ });
+
+ String get name => entry.substring(entry.lastIndexOf('/') + 1);
+
+ String get relativePath => entry.substring('sdk/'.length);
+
+ String getGithubDiffUrl(String fromCommit, String toCommit) {
+ // https://github.com/dart-lang/<repo>/compare/<old>..<new>
+ final from = fromCommit.substring(0, 7);
+ final to = toCommit.substring(0, 7);
+
+ var repo = url.substring(url.lastIndexOf('/') + 1);
+ if (repo.endsWith('git')) {
+ repo = repo.substring(0, repo.length - '.git'.length);
+ }
+
+ var org = 'dart-lang';
+ if (url.contains('/external/')) {
+ // https://dart.googlesource.com/external/github.com/google/webdriver.dart.git
+ final parts = url.split('/');
+ org = parts[parts.length - 2];
+ }
+
+ // TODO(devoncarew): Eliminate this special-casing; see #48830.
+ const orgOverrides = {
+ 'platform.dart': 'google',
+ };
+ if (orgOverrides.containsKey(repo)) {
+ org = orgOverrides[repo]!;
+ }
+
+ return 'https://github.com/$org/$repo/compare/$from..$to';
+ }
+
+ @override
+ String toString() => '${rev?.substring(0, 8)} $relativePath';
+}
+
+Future<String> exec(
+ List<String> cmd, {
+ String? cwd,
+ Map<String, String>? environment,
+}) async {
+ var result = await Process.run(
+ cmd.first,
+ cmd.sublist(1),
+ workingDirectory: cwd,
+ environment: environment,
+ );
+ if (result.exitCode != 0) {
+ var cwdLocation = cwd == null ? '' : ' ($cwd)';
+ print('${cmd.join(' ')}$cwdLocation');
+
+ if ((result.stdout as String).isNotEmpty) {
+ stdout.write(result.stdout);
+ }
+ if ((result.stderr as String).isNotEmpty) {
+ stderr.write(result.stderr);
+ }
+ exit(1);
+ }
+ return result.stdout;
+}
diff --git a/tools/verify_docs/README.md b/tools/verify_docs/README.md
index 41be863..f2adb28 100644
--- a/tools/verify_docs/README.md
+++ b/tools/verify_docs/README.md
@@ -123,4 +123,3 @@
// final BuildContext context;
// final String userAvatarUrl;
```
-
diff --git a/utils/dartdevc/BUILD.gn b/utils/dartdevc/BUILD.gn
index 5d93e80..d2bcd69 100644
--- a/utils/dartdevc/BUILD.gn
+++ b/utils/dartdevc/BUILD.gn
@@ -8,6 +8,11 @@
import("../application_snapshot.gni")
import("../create_timestamp.gni")
+declare_args() {
+ # Enables DDC canary features during compilation to Javascript.
+ ddc_canary = false
+}
+
patched_sdk_dir = "$target_gen_dir/patched_sdk"
sdk_summary = "$target_gen_dir/ddc_sdk.sum"
@@ -30,6 +35,10 @@
rebase_path("../../pkg/dev_compiler/bin/dartdevc.dart"),
]
+ if (ddc_canary) {
+ training_args += [ "--canary" ]
+ }
+
deps = [
":dartdevc_kernel_sdk",
":dartdevc_platform",
@@ -186,6 +195,10 @@
"package:$module/$module.dart",
]
+ if (ddc_canary) {
+ args += [ "--canary" ]
+ }
+
if (defined(invoker.extra_libraries)) {
foreach(lib, invoker.extra_libraries) {
args += [ "package:$module/$lib.dart" ]
@@ -356,6 +369,10 @@
if (invoker.sound_null_safety) {
args += [ "--sound-null-safety" ]
}
+
+ if (ddc_canary) {
+ args += [ "--canary" ]
+ }
}
}