Version 2.14.0-147.0.dev
Merge commit '89996356b58566264d7411ab15b2dec47ca7997d' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index b402bc7..079d7fe 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -11,7 +11,7 @@
"constraint, update this by running tools/generate_package_config.dart."
],
"configVersion": 2,
- "generated": "2021-05-21T16:08:02.444059",
+ "generated": "2021-05-24T09:58:37.618570",
"generator": "tools/generate_package_config.dart",
"packages": [
{
@@ -253,16 +253,10 @@
"languageVersion": "2.3"
},
{
- "name": "devtools_server",
- "rootUri": "../third_party/devtools/devtools_server",
- "packageUri": "lib/",
- "languageVersion": "2.6"
- },
- {
"name": "devtools_shared",
"rootUri": "../third_party/devtools/devtools_shared",
"packageUri": "lib/",
- "languageVersion": "2.3"
+ "languageVersion": "2.12"
},
{
"name": "diagnostic",
diff --git a/DEPS b/DEPS
index a3188c5..871d214 100644
--- a/DEPS
+++ b/DEPS
@@ -107,7 +107,7 @@
"chromedriver_tag": "83.0.4103.39",
"dartdoc_rev" : "e6a9b7c536a85e49233c97bb892bbb0ab778e425",
- "devtools_rev" : "12ad5341ae0a275042c84a4e7be9a6c98db65612",
+ "devtools_rev" : "e138d55437a59838607415ef21f20bd6c4955dbc",
"jsshell_tag": "version:88.0",
"ffi_rev": "f3346299c55669cc0db48afae85b8110088bf8da",
"fixnum_rev": "16d3890c6dc82ca629659da1934e412292508bba",
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index 9fcb9a9..bddbd61 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -236,6 +236,11 @@
ignoring the item or treating it with some default/fallback handling.
</p>
<h3>Changelog</h3>
+<h4>1.32.6</h4>
+<ul>
+ <li>Added <tt>FoldingKind.PARAMETERS</tt> for folding regions for parameters
+ that span multiple lines.</li>
+</ul>
<h4>1.32.5</h4>
<ul>
<li>Added optional <tt>replacementOffset</tt> and <tt>replacementLength</tt> on
@@ -4277,7 +4282,7 @@
An enumeration of the kinds of folding regions.
</p>
- <dl><dt class="value">ANNOTATIONS</dt><dt class="value">BLOCK</dt><dt class="value">CLASS_BODY</dt><dt class="value">COMMENT</dt><dt class="value">DIRECTIVES</dt><dt class="value">DOCUMENTATION_COMMENT</dt><dt class="value">FILE_HEADER</dt><dt class="value">FUNCTION_BODY</dt><dt class="value">INVOCATION</dt><dt class="value">LITERAL</dt></dl></dd><dt class="typeDefinition"><a name="type_FoldingRegion">FoldingRegion: object</a></dt><dd>
+ <dl><dt class="value">ANNOTATIONS</dt><dt class="value">BLOCK</dt><dt class="value">CLASS_BODY</dt><dt class="value">COMMENT</dt><dt class="value">DIRECTIVES</dt><dt class="value">DOCUMENTATION_COMMENT</dt><dt class="value">FILE_HEADER</dt><dt class="value">FUNCTION_BODY</dt><dt class="value">INVOCATION</dt><dt class="value">LITERAL</dt><dt class="value">PARAMETERS</dt></dl></dd><dt class="typeDefinition"><a name="type_FoldingRegion">FoldingRegion: object</a></dt><dd>
<p>
A description of a region that can be folded.
</p>
diff --git a/pkg/analysis_server/lib/src/computer/computer_folding.dart b/pkg/analysis_server/lib/src/computer/computer_folding.dart
index 4170ab6..be1efd5 100644
--- a/pkg/analysis_server/lib/src/computer/computer_folding.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_folding.dart
@@ -261,6 +261,13 @@
}
@override
+ void visitFormalParameterList(FormalParameterList node) {
+ _computer._addRegion(node.leftParenthesis.end, node.rightParenthesis.offset,
+ FoldingKind.PARAMETERS);
+ super.visitFormalParameterList(node);
+ }
+
+ @override
void visitFunctionDeclaration(FunctionDeclaration node) {
_computer._addRegionForAnnotations(node.metadata);
super.visitFunctionDeclaration(node);
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
index e9be86a..e4b55f8 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
@@ -86,8 +86,8 @@
}
// prepare location
- var targetLocation =
- CorrectionUtils(targetUnit).prepareNewConstructorLocation(targetNode);
+ var targetLocation = CorrectionUtils(targetUnit)
+ .prepareNewConstructorLocation(resolvedResult.session, targetNode);
if (targetLocation == null) {
return;
}
@@ -141,8 +141,8 @@
}
// prepare location
- var targetLocation =
- CorrectionUtils(targetUnit).prepareNewConstructorLocation(targetNode);
+ var targetLocation = CorrectionUtils(targetUnit)
+ .prepareNewConstructorLocation(resolvedResult.session, targetNode);
if (targetLocation == null) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart
index f8788d4..94e26f2 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart
@@ -46,7 +46,8 @@
}
}
// prepare location for a new constructor
- var targetLocation = utils.prepareNewConstructorLocation(classDeclaration);
+ var targetLocation = utils.prepareNewConstructorLocation(
+ resolvedResult.session, classDeclaration);
if (targetLocation == null) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart
index e4acc52..a40ed18 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart
@@ -28,8 +28,8 @@
for (var constructor in superType.constructors) {
// Only propose public constructors.
if (!Identifier.isPrivateName(constructor.name)) {
- var targetLocation =
- utils.prepareNewConstructorLocation(targetClassNode);
+ var targetLocation = utils.prepareNewConstructorLocation(
+ resolvedResult.session, targetClassNode);
if (targetLocation != null) {
yield _CreateConstructor(
constructor, targetLocation, targetClassElement.name);
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index c170b01..0fd70b7 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -7,6 +7,7 @@
import 'package:_fe_analyzer_shared/src/scanner/token.dart';
import 'package:analysis_server/src/protocol_server.dart'
show doSourceChange_addElementEdit;
+import 'package:analysis_server/src/services/linter/lint_names.dart';
import 'package:analysis_server/src/utilities/extensions/ast.dart';
import 'package:analysis_server/src/utilities/strings.dart';
import 'package:analyzer/dart/analysis/features.dart';
@@ -937,11 +938,16 @@
}
ClassMemberLocation? prepareNewConstructorLocation(
- ClassDeclaration classDeclaration) {
- return prepareNewClassMemberLocation(
- classDeclaration,
- (member) =>
- member is FieldDeclaration || member is ConstructorDeclaration);
+ AnalysisSession session, ClassDeclaration classDeclaration) {
+ final sortConstructorsFirst = session.analysisContext.analysisOptions
+ .isLintEnabled(LintNames.sort_constructors_first);
+ // If sort_constructors_first is enabled, don't skip over the fields.
+ final shouldSkip = sortConstructorsFirst
+ ? (member) => member is ConstructorDeclaration
+ : (member) =>
+ member is FieldDeclaration || member is ConstructorDeclaration;
+
+ return prepareNewClassMemberLocation(classDeclaration, shouldSkip);
}
ClassMemberLocation? prepareNewFieldLocation(
diff --git a/pkg/analysis_server/lib/src/services/linter/lint_names.dart b/pkg/analysis_server/lib/src/services/linter/lint_names.dart
index 15a8e7a..2f20834 100644
--- a/pkg/analysis_server/lib/src/services/linter/lint_names.dart
+++ b/pkg/analysis_server/lib/src/services/linter/lint_names.dart
@@ -89,6 +89,7 @@
static const String prefer_spread_collections = 'prefer_spread_collections';
static const String slash_for_doc_comments = 'slash_for_doc_comments';
static const String sort_child_properties_last = 'sort_child_properties_last';
+ static const String sort_constructors_first = 'sort_constructors_first';
static const String type_annotate_public_apis = 'type_annotate_public_apis';
static const String type_init_formals = 'type_init_formals';
static const String unawaited_futures = 'unawaited_futures';
diff --git a/pkg/analysis_server/lib/src/services/refactoring/rename_constructor.dart b/pkg/analysis_server/lib/src/services/refactoring/rename_constructor.dart
index dd17e71..9940c90 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/rename_constructor.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/rename_constructor.dart
@@ -124,7 +124,8 @@
}
var utils = CorrectionUtils(resolvedUnit);
- var location = utils.prepareNewConstructorLocation(classNode);
+ var location =
+ utils.prepareNewConstructorLocation(resolvedUnit.session, classNode);
if (location == null) {
return;
}
diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
index 4a8e453..4ad56ae 100644
--- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart
+++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
@@ -738,6 +738,7 @@
/// FUNCTION_BODY
/// INVOCATION
/// LITERAL
+/// PARAMETERS
/// }
final Matcher isFoldingKind = MatchesEnum('FoldingKind', [
'ANNOTATIONS',
@@ -749,7 +750,8 @@
'FILE_HEADER',
'FUNCTION_BODY',
'INVOCATION',
- 'LITERAL'
+ 'LITERAL',
+ 'PARAMETERS'
]);
/// FoldingRegion
diff --git a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
index 97c6102..5057c74 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
@@ -2,6 +2,7 @@
// 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:analysis_server/src/services/linter/lint_names.dart';
import 'package:analysis_server/src/services/refactoring/refactoring.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
@@ -128,6 +129,7 @@
await indexTestUnit('''
/// Documentation for [new A]
class A {
+ int field = 0;
}
class B extends A {
B() : super() {}
@@ -146,6 +148,8 @@
return assertSuccessfulRefactoring('''
/// Documentation for [new A.newName]
class A {
+ int field = 0;
+
A.newName();
}
class B extends A {
@@ -193,6 +197,35 @@
''');
}
+ Future<void> test_createChange_lint_sortConstructorsFirst() async {
+ createAnalysisOptionsFile(lints: [LintNames.sort_constructors_first]);
+ await indexTestUnit('''
+class A {
+ int field = 0;
+}
+main() {
+ new A();
+}
+''');
+ // configure refactoring
+ _createConstructorInvocationRefactoring('new A();');
+ expect(refactoring.refactoringName, 'Rename Constructor');
+ expect(refactoring.elementKindName, 'constructor');
+ expect(refactoring.oldName, '');
+ // validate change
+ refactoring.newName = 'newName';
+ return assertSuccessfulRefactoring('''
+class A {
+ A.newName();
+
+ int field = 0;
+}
+main() {
+ new A.newName();
+}
+''');
+ }
+
Future<void> test_createChange_remove() async {
await indexTestUnit('''
/// Documentation for [A.test] and [new A.test]
diff --git a/pkg/analysis_server/test/src/computer/folding_computer_test.dart b/pkg/analysis_server/test/src/computer/folding_computer_test.dart
index 94372c5..d4ed8df 100644
--- a/pkg/analysis_server/test/src/computer/folding_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/folding_computer_test.dart
@@ -496,6 +496,31 @@
_compareRegions(regions, content);
}
+ Future<void> test_parameters_function() async {
+ var content = '''
+foo(/*1:INC*/
+ String aaaaa,
+ String bbbbb, {
+ String ccccc,
+ }/*1:INC:PARAMETERS*/) {}
+''';
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ Future<void> test_parameters_method() async {
+ var content = '''
+class C {/*1:INC*/
+ C(/*2:INC*/
+ String aaaaa,
+ String bbbbb,
+ /*2:INC:PARAMETERS*/) : super();
+/*1:INC:CLASS_BODY*/}
+''';
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
Future<void> test_single_import_directives() async {
var content = """
import 'dart:async';
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_for_final_fields_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_for_final_fields_test.dart
index 32efaed..887c9fd 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_for_final_fields_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_for_final_fields_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analysis_server/src/services/linter/lint_names.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -109,6 +110,28 @@
await assertNoFix();
}
+ Future<void> test_lint_sortConstructorsFirst() async {
+ createAnalysisOptionsFile(lints: [LintNames.sort_constructors_first]);
+ await resolveTestCode('''
+class Test {
+ final int a;
+ final int b = 2;
+ final int c;
+}
+''');
+ await assertHasFix('''
+class Test {
+ Test(this.a, this.c);
+
+ final int a;
+ final int b = 2;
+ final int c;
+}
+''', errorFilter: (error) {
+ return error.message.contains("'a'");
+ });
+ }
+
Future<void> test_simple() async {
await resolveTestCode('''
class Test {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
index 19af80e..a75e7a9 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analysis_server/src/services/linter/lint_names.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -75,6 +76,34 @@
''');
}
+ Future<void> test_lint_sortConstructorsFirst() async {
+ createAnalysisOptionsFile(lints: [LintNames.sort_constructors_first]);
+ await resolveTestCode('''
+class A {
+ A(this.field);
+
+ int field;
+}
+class B extends A {
+ int existingField;
+ void existingMethod() {}
+}
+''');
+ await assertHasFix('''
+class A {
+ A(this.field);
+
+ int field;
+}
+class B extends A {
+ B(int field) : super(field);
+
+ int existingField;
+ void existingMethod() {}
+}
+''');
+ }
+
Future<void> test_named() async {
await resolveTestCode('''
class A {
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/FoldingKind.java b/pkg/analysis_server/tool/spec/generated/java/types/FoldingKind.java
index 3b8b236..f8087a6 100644
--- a/pkg/analysis_server/tool/spec/generated/java/types/FoldingKind.java
+++ b/pkg/analysis_server/tool/spec/generated/java/types/FoldingKind.java
@@ -35,4 +35,6 @@
public static final String LITERAL = "LITERAL";
+ public static final String PARAMETERS = "PARAMETERS";
+
}
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index df3cadf..f86815d 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -134,6 +134,11 @@
ignoring the item or treating it with some default/fallback handling.
</p>
<h3>Changelog</h3>
+<h4>1.32.6</h4>
+<ul>
+ <li>Added <tt>FoldingKind.PARAMETERS</tt> for folding regions for parameters
+ that span multiple lines.</li>
+</ul>
<h4>1.32.5</h4>
<ul>
<li>Added optional <tt>replacementOffset</tt> and <tt>replacementLength</tt> on
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 69c55bc..dfbd44c 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart
@@ -1586,6 +1586,7 @@
/// FUNCTION_BODY
/// INVOCATION
/// LITERAL
+/// PARAMETERS
/// }
///
/// Clients may not extend, implement or mix-in this class.
@@ -1611,6 +1612,8 @@
static const FoldingKind LITERAL = FoldingKind._('LITERAL');
+ static const FoldingKind PARAMETERS = FoldingKind._('PARAMETERS');
+
/// A list containing all of the enum values that are defined.
static const List<FoldingKind> VALUES = <FoldingKind>[
ANNOTATIONS,
@@ -1622,7 +1625,8 @@
FILE_HEADER,
FUNCTION_BODY,
INVOCATION,
- LITERAL
+ LITERAL,
+ PARAMETERS
];
@override
@@ -1652,6 +1656,8 @@
return INVOCATION;
case 'LITERAL':
return LITERAL;
+ case 'PARAMETERS':
+ return PARAMETERS;
}
throw Exception('Illegal enum value: $name');
}
diff --git a/pkg/analyzer/lib/src/dart/micro/library_graph.dart b/pkg/analyzer/lib/src/dart/micro/library_graph.dart
index 99083b7..0947549 100644
--- a/pkg/analyzer/lib/src/dart/micro/library_graph.dart
+++ b/pkg/analyzer/lib/src/dart/micro/library_graph.dart
@@ -91,8 +91,13 @@
Uint8List? informativeBytes;
LibraryCycle? _libraryCycle;
- /// id of the cache entry.
- late int id;
+ /// id of the cache entry with unlinked data.
+ late int unlinkedId;
+
+ /// id of the cache entry with informative data.
+ /// We use a separate entry because there is no good way to efficiently
+ /// store a raw byte array.
+ late int informativeId;
FileState._(
this._fsState,
@@ -225,16 +230,23 @@
_exists = _digest.isNotEmpty;
});
- String unlinkedKey = path;
+ String unlinkedKey = '$path.unlinked';
+ String informativeKey = '$path.informative';
// Prepare bytes of the unlinked bundle - existing or new.
// TODO(migration): should not be nullable
- List<int>? bytes;
+ List<int>? unlinkedBytes;
+ List<int>? informativeBytes;
{
- var cacheData = _fsState._byteStore.get(unlinkedKey, _digest);
- bytes = cacheData?.bytes;
+ var unlinkedData = _fsState._byteStore.get(unlinkedKey, _digest);
+ var informativeData = _fsState._byteStore.get(informativeKey, _digest);
+ unlinkedBytes = unlinkedData?.bytes;
+ informativeBytes = informativeData?.bytes;
- if (bytes == null || bytes.isEmpty) {
+ if (unlinkedBytes == null ||
+ unlinkedBytes.isEmpty ||
+ informativeBytes == null ||
+ informativeBytes.isEmpty) {
var content = performance.run('content', (_) {
return getContent();
});
@@ -245,26 +257,36 @@
return parse(AnalysisErrorListener.NULL_LISTENER, content);
});
- informativeBytes = writeUnitInformative(unit);
-
performance.run('unlinked', (performance) {
var unlinkedBuilder = serializeAstCiderUnlinked(_digest, unit);
- bytes = unlinkedBuilder.toBuffer();
- performance.getDataInt('length').add(bytes!.length);
- cacheData = _fsState._byteStore.putGet(unlinkedKey, _digest, bytes!);
- bytes = cacheData!.bytes;
+ unlinkedBytes = unlinkedBuilder.toBuffer();
+ performance.getDataInt('length').add(unlinkedBytes!.length);
+ unlinkedData =
+ _fsState._byteStore.putGet(unlinkedKey, _digest, unlinkedBytes!);
+ unlinkedBytes = unlinkedData!.bytes;
+ });
+
+ performance.run('informative', (performance) {
+ informativeBytes = writeUnitInformative(unit);
+ performance.getDataInt('length').add(informativeBytes!.length);
+ informativeData = _fsState._byteStore
+ .putGet(informativeKey, _digest, informativeBytes!);
+ informativeBytes = informativeData!.bytes;
});
performance.run('prefetch', (_) {
- unlinked2 = CiderUnlinkedUnit.fromBuffer(bytes!).unlinkedUnit!;
+ var decoded = CiderUnlinkedUnit.fromBuffer(unlinkedBytes!);
+ unlinked2 = decoded.unlinkedUnit!;
_prefetchDirectReferences(unlinked2);
});
}
- id = cacheData!.id;
+ unlinkedId = unlinkedData!.id;
+ informativeId = informativeData!.id;
+ this.informativeBytes = Uint8List.fromList(informativeBytes!);
}
// Read the unlinked bundle.
- unlinked2 = CiderUnlinkedUnit.fromBuffer(bytes!).unlinkedUnit!;
+ unlinked2 = CiderUnlinkedUnit.fromBuffer(unlinkedBytes!).unlinkedUnit!;
_apiSignature = Uint8List.fromList(unlinked2.apiSignature);
// Build the graph.
@@ -570,8 +592,12 @@
/// Clears all the cached files. Returns the list of ids of all the removed
/// files.
Set<int> collectSharedDataIdentifiers() {
- var files = _pathToFile.values.map((file) => file.id).toSet();
- return files;
+ var result = <int>{};
+ for (var file in _pathToFile.values) {
+ result.add(file.unlinkedId);
+ result.add(file.informativeId);
+ }
+ return result;
}
FeatureSet contextFeatureSet(
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
index c646953..a175010 100644
--- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
+++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -167,7 +167,8 @@
// Schedule disposing references to cached unlinked data.
for (var removedFile in removedFiles) {
- removedCacheIds.add(removedFile.id);
+ removedCacheIds.add(removedFile.unlinkedId);
+ removedCacheIds.add(removedFile.informativeId);
}
// Remove libraries represented by removed files.
@@ -406,7 +407,8 @@
void removeFilesNotNecessaryForAnalysisOf(List<String> files) {
var removedFiles = fsState!.removeUnusedFiles(files);
for (var removedFile in removedFiles) {
- removedCacheIds.add(removedFile.id);
+ removedCacheIds.add(removedFile.unlinkedId);
+ removedCacheIds.add(removedFile.informativeId);
}
}
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
index a994e7d..e1646c9 100644
--- a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
+++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -792,6 +792,63 @@
expect(result.lineInfo.lineStarts, [0, 11, 24]);
}
+ test_nameOffset_class_method_fromBytes() async {
+ newFile('/workspace/dart/test/lib/a.dart', content: r'''
+class A {
+ void foo() {}
+}
+''');
+
+ addTestFile(r'''
+import 'a.dart';
+
+void f(A a) {
+ a.foo();
+}
+''');
+
+ await resolveTestFile();
+ {
+ var element = findNode.simple('foo();').staticElement!;
+ expect(element.nameOffset, 17);
+ }
+
+ // New resolver.
+ // Element models will be loaded from the cache.
+ createFileResolver();
+ await resolveTestFile();
+ {
+ var element = findNode.simple('foo();').staticElement!;
+ expect(element.nameOffset, 17);
+ }
+ }
+
+ test_nameOffset_unit_variable_fromBytes() async {
+ newFile('/workspace/dart/test/lib/a.dart', content: r'''
+var a = 0;
+''');
+
+ addTestFile(r'''
+import 'a.dart';
+var b = a;
+''');
+
+ await resolveTestFile();
+ {
+ var element = findNode.simple('a;').staticElement!;
+ expect(element.nameOffset, 4);
+ }
+
+ // New resolver.
+ // Element models will be loaded from the cache.
+ createFileResolver();
+ await resolveTestFile();
+ {
+ var element = findNode.simple('a;').staticElement!;
+ expect(element.nameOffset, 4);
+ }
+ }
+
test_nullSafety_enabled() async {
typeToStringWithNullability = true;
diff --git a/pkg/analyzer/test/src/diagnostics/inconsistent_inheritance_test.dart b/pkg/analyzer/test/src/diagnostics/inconsistent_inheritance_test.dart
index 0820fb8..5d374e08 100644
--- a/pkg/analyzer/test/src/diagnostics/inconsistent_inheritance_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/inconsistent_inheritance_test.dart
@@ -18,38 +18,130 @@
test_class_parameterType() async {
await assertErrorsInCode(r'''
abstract class A {
- void foo(int i);
+ void m(int i);
}
abstract class B {
- void foo(String s);
+ void m(String s);
}
abstract class C implements A, B {}
''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 98, 1),
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 94, 1),
+ ]);
+ }
+
+ test_class_parameterType_inheritedFromBase() async {
+ await assertErrorsInCode(r'''
+abstract class A {
+ void m(int i);
+}
+abstract class B {
+ void m(String s);
+}
+abstract class C extends B implements A {}
+''', [
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 94, 1),
+ ]);
+ }
+
+ test_class_parameterType_inheritedInInterface() async {
+ await assertErrorsInCode(r'''
+abstract class A {
+ void m(int i);
+}
+abstract class B {
+ void m(String s);
+}
+abstract class B2 extends B {}
+abstract class C implements A, B2 {}
+''', [
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 125, 1),
+ ]);
+ }
+
+ test_class_parameterType_inheritedInInterface_andMixin() async {
+ await assertErrorsInCode(r'''
+abstract class A {
+ void m(int i);
+}
+abstract class B {
+ void m(String s);
+}
+abstract class B2 extends B {}
+abstract class C extends Object with A implements B2 {}
+''', [
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 125, 1),
+ ]);
+ }
+
+ test_class_parameterType_inheritedInInterface_andMixinApplication() async {
+ await assertErrorsInCode(r'''
+abstract class A {
+ void m(int i);
+}
+abstract class B {
+ void m(String s);
+}
+abstract class B2 extends B {}
+abstract class C = Object with A implements B2;
+''', [
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 125, 1),
+ ]);
+ }
+
+ test_class_parameterType_mixedIntoInterface() async {
+ await assertErrorsInCode(r'''
+abstract class A {
+ void m(int i);
+}
+abstract class B {
+ void m(String s);
+}
+abstract class B2 extends Object with B {}
+abstract class C implements A, B2 {}
+''', [
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 137, 1),
+ ]);
+ }
+
+ test_class_parameterType_mixedIntoInterface_andMixin() async {
+ await assertErrorsInCode(r'''
+abstract class A {
+ void m(int i);
+}
+abstract class B {
+ void m(String s);
+}
+abstract class B2 extends Object with B {}
+abstract class C extends Object with A implements B2 {}
+''', [
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 137, 1),
+ ]);
+ }
+
+ test_class_parameterType_twoConflictingInterfaces() async {
+ await assertErrorsInCode(r'''
+abstract class A {
+ void m(int i);
+}
+abstract class B {
+ void m(String s);
+}
+abstract class C {
+ void n(String s);
+}
+abstract class D implements A, B, C {}
+''', [
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 135, 1),
]);
}
test_class_requiredParameters() async {
await assertErrorsInCode(r'''
abstract class A {
- void foo();
+ void m();
}
abstract class B {
- void foo(int y);
-}
-abstract class C implements A, B {}
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 90, 1),
- ]);
- }
-
- test_class_returnType() async {
- await assertErrorsInCode(r'''
-abstract class A {
- int foo();
-}
-abstract class B {
- String foo();
+ void m(int y);
}
abstract class C implements A, B {}
''', [
@@ -57,87 +149,133 @@
]);
}
+ test_class_returnType() async {
+ await assertErrorsInCode(r'''
+abstract class A {
+ int m();
+}
+abstract class B {
+ String m();
+}
+abstract class C implements A, B {}
+''', [
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 82, 1),
+ ]);
+ }
+
test_mixin_implements_parameterType() async {
await assertErrorsInCode(r'''
abstract class A {
- void foo(int i);
+ void m(int i);
}
abstract class B {
- void foo(String s);
+ void m(String s);
}
mixin M implements A, B {}
''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 89, 1),
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 85, 1),
]);
}
test_mixin_implements_requiredParameters() async {
await assertErrorsInCode(r'''
abstract class A {
- void foo();
+ void m();
}
abstract class B {
- void foo(int y);
+ void m(int y);
}
mixin M implements A, B {}
''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 81, 1),
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 77, 1),
]);
}
test_mixin_implements_returnType() async {
await assertErrorsInCode(r'''
abstract class A {
- int foo();
+ int m();
}
abstract class B {
- String foo();
+ String m();
}
mixin M implements A, B {}
''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 77, 1),
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 73, 1),
]);
}
test_mixin_on_parameterType() async {
await assertErrorsInCode(r'''
abstract class A {
- void foo(int i);
+ void m(int i);
}
abstract class B {
- void foo(String s);
+ void m(String s);
}
mixin M on A, B {}
''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 89, 1),
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 85, 1),
]);
}
test_mixin_on_requiredParameters() async {
await assertErrorsInCode(r'''
abstract class A {
- void foo();
+ void m();
}
abstract class B {
- void foo(int y);
+ void m(int y);
}
mixin M on A, B {}
''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 81, 1),
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 77, 1),
]);
}
test_mixin_on_returnType() async {
await assertErrorsInCode(r'''
abstract class A {
- int foo();
+ int m();
}
abstract class B {
- String foo();
+ String m();
}
mixin M on A, B {}
''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 77, 1),
+ error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 73, 1),
]);
}
+
+ test_overrideWithDynamicParameterType_inheritsAndInterface() async {
+ await assertNoErrorsInCode('''
+class B {
+ void m(int i) {}
+}
+
+class I {
+ void m(String s) {}
+}
+
+class C extends B implements I {
+ void m(dynamic d) {}
+}
+''');
+ }
+
+ test_overrideWithDynamicParameterType_mixinAndInterface() async {
+ await assertNoErrorsInCode('''
+class B {
+ void m(int i) {}
+}
+
+class I {
+ void m(String s) {}
+}
+
+class C extends Object with B implements I {
+ void m(dynamic d) {}
+}
+''');
+ }
}
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
index 02a7d81..d70bd51 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -2083,25 +2083,6 @@
]);
}
- test_invalidOverrides_baseClassOverrideToChildInterface() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I {
- m(A a);
-}
-
-class Base {
- m(B a) {}
-}
-
-class T1 extends Base implements I {}
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 89, 2),
- ]);
- }
-
test_invalidOverrides_childOverride() async {
await assertErrorsInCode('''
class A {}
@@ -2274,28 +2255,6 @@
]);
}
- test_invalidOverrides_mixinOverrideOfInterface() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I {
- m(A a);
-}
-
-class M {
- m(B a) {}
-}
-
-class T1 extends Object with M implements I {}
-
-class U1 = Object with M implements I;
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 86, 2),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 134, 2),
- ]);
- }
-
test_invalidOverrides_mixinOverrideToBase() async {
await assertErrorsInCode('''
class A {}
@@ -2389,41 +2348,6 @@
''');
}
- test_invalidOverrides_noErrorsIfSubclassCorrectlyOverrideBaseAndInterface() async {
- // This is a case were it is incorrect to say that the base class
- // incorrectly overrides the interface.
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-class Base {
- void m(A a) {}
-}
-
-class I1 {
- void m(B a) {}
-}
-
-class T1 extends Base implements I1 {}
-
-class T2 extends Base implements I1 {
- void m(dynamic a) {}
-}
-
-class T3 extends Object with Base implements I1 {}
-
-class U3 = Object with Base implements I1;
-
-class T4 extends Object with Base implements I1 {
- void m(dynamic a) {}
-}
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 93, 2),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 197, 2),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 249, 2),
- ]);
- }
-
test_invalidRuntimeChecks() async {
await assertErrorsInCode('''
typedef int I2I(int x);
@@ -2680,209 +2604,6 @@
]);
}
- test_mixinOverrideOfGrandInterface_interfaceOfInterfaceOfChild() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I1 {
- m(A a);
-}
-
-abstract class I2 implements I1 {}
-
-class M {
- m(B a) {}
-}
-
-class T1 extends Object with M implements I2 {}
-
-class U1 = Object with M implements I2;
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 123, 2),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 172, 2),
- ]);
- }
-
- test_mixinOverrideOfGrandInterface_mixinOfInterfaceOfChild() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class M1 {
- m(A a);
-}
-
-abstract class I2 extends Object with M1 {}
-
-class M {
- m(B a) {}
-}
-
-class T1 extends Object with M implements I2 {}
-
-class U1 = Object with M implements I2;
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 134, 2),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 183, 2),
- ]);
- }
-
- test_mixinOverrideOfGrandInterface_superclassOfInterfaceOfChild() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I1 {
- m(A a);
-}
-
-abstract class I2 extends I1 {}
-
-class M {
- m(B a) {}
-}
-
-class T1 extends Object with M implements I2 {}
-
-class U1 = Object with M implements I2;
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 120, 2),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 169, 2),
- ]);
- }
-
- test_noDuplicateReports_baseTypeAndMixinOverrideSameMethodInInterface() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I1 {
- m(A a);
-}
-
-class Base {
- m(B a) {}
-}
-
-class M {
- m(B a) {}
-}
-
-// TODO(jmesserly): the `INCONSISTENT_METHOD_INHERITANCE` message is from the
-// Dart 1 checking logic (using strong mode type system), it is not produced
-// by the strong mode OverrideChecker.
-class T1 extends Base with M implements I1 {}
-
-class U1 = Base with M implements I1;
-''', [
- error(TodoCode.TODO, 112, 74),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 309, 2),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 356, 2),
- ]);
- }
-
- test_noDuplicateReports_twoGrandTypesOverrideSameMethodInInterface() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I1 {
- m(A a);
-}
-
-class Grandparent {
- m(B a) {}
-}
-
-class Parent1 extends Grandparent {
- m(B a) {}
-}
-class Parent2 extends Grandparent {}
-
-// Note: otherwise both errors would be reported on this line
-class T1 extends Parent1 implements I1 {}
-class T2 extends Parent2 implements I1 {}
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 247, 2),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 289, 2),
- ]);
- }
-
- test_noDuplicateReports_twoMixinsOverrideSameMethodInInterface() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I1 {
- m(A a);
-}
-
-class M1 {
- m(B a) {}
-}
-
-class M2 {
- m(B a) {}
-}
-
-class T1 extends Object with M1, M2 implements I1 {}
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 114, 2),
- ]);
- }
-
- test_noDuplicateReports_typeAndBaseTypeOverrideSameMethodInInterface() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I1 {
- void m(A a);
-}
-
-class Base {
- void m(B a) {}
-}
-
-class T1 extends Base implements I1 {
- void m(B a) {}
-}
-
-class T2 extends Base implements I1 {}
-''', [
- error(CompileTimeErrorCode.INVALID_OVERRIDE, 139, 1),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 158, 2),
- ]);
- }
-
- test_noDuplicateReports_typeAndMixinOverrideSameMethodInInterface() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I1 {
- void m(A a);
-}
-
-class M {
- void m(B a) {}
-}
-
-class T1 extends Object with M implements I1 {
- void m(B a) {}
-}
-
-class T2 extends Object with M implements I1 {}
-
-class U2 = Object with M implements I1;
-''', [
- error(CompileTimeErrorCode.INVALID_OVERRIDE, 145, 1),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 164, 2),
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 213, 2),
- ]);
- }
-
test_noDuplicateReports_typeOverridesSomeMethodInMultipleInterfaces() async {
await assertErrorsInCode('''
class A {}
@@ -3373,69 +3094,6 @@
]);
}
- test_superclassOverrideOfGrandInterface_interfaceOfInterfaceOfChild() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I1 {
- m(A a);
-}
-
-abstract class I2 implements I1 {}
-
-class Base {
- m(B a) {}
-}
-
-class T1 extends Base implements I2 {}
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 126, 2),
- ]);
- }
-
- test_superclassOverrideOfGrandInterface_mixinOfInterfaceOfChild() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class M1 {
- m(A a);
-}
-
-abstract class I2 extends Object with M1 {}
-
-class Base {
- m(B a) {}
-}
-
-class T1 extends Base implements I2 {}
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 135, 2),
- ]);
- }
-
- test_superclassOverrideOfGrandInterface_superclassOfInterfaceOfChild() async {
- await assertErrorsInCode('''
-class A {}
-class B {}
-
-abstract class I1 {
- m(A a);
-}
-
-abstract class I2 extends I1 {}
-
-class Base {
- m(B a) {}
-}
-
-class T1 extends Base implements I2 {}
-''', [
- error(CompileTimeErrorCode.INCONSISTENT_INHERITANCE, 123, 2),
- ]);
- }
-
test_superConstructor() async {
await assertErrorsInCode('''
class A { A(A x) {} }
diff --git a/pkg/analyzer_plugin/doc/api.html b/pkg/analyzer_plugin/doc/api.html
index 52db9f4..dbe9f26 100644
--- a/pkg/analyzer_plugin/doc/api.html
+++ b/pkg/analyzer_plugin/doc/api.html
@@ -1339,7 +1339,7 @@
An enumeration of the kinds of folding regions.
</p>
- <dl><dt class="value">ANNOTATIONS</dt><dt class="value">BLOCK</dt><dt class="value">CLASS_BODY</dt><dt class="value">COMMENT</dt><dt class="value">DIRECTIVES</dt><dt class="value">DOCUMENTATION_COMMENT</dt><dt class="value">FILE_HEADER</dt><dt class="value">FUNCTION_BODY</dt><dt class="value">INVOCATION</dt><dt class="value">LITERAL</dt></dl></dd><dt class="typeDefinition"><a name="type_FoldingRegion">FoldingRegion: object</a></dt><dd>
+ <dl><dt class="value">ANNOTATIONS</dt><dt class="value">BLOCK</dt><dt class="value">CLASS_BODY</dt><dt class="value">COMMENT</dt><dt class="value">DIRECTIVES</dt><dt class="value">DOCUMENTATION_COMMENT</dt><dt class="value">FILE_HEADER</dt><dt class="value">FUNCTION_BODY</dt><dt class="value">INVOCATION</dt><dt class="value">LITERAL</dt><dt class="value">PARAMETERS</dt></dl></dd><dt class="typeDefinition"><a name="type_FoldingRegion">FoldingRegion: object</a></dt><dd>
<p>
A description of a region that can be folded.
</p>
diff --git a/pkg/analyzer_plugin/lib/protocol/protocol_common.dart b/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
index 1132b0a..691c48d 100644
--- a/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
+++ b/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
@@ -1586,6 +1586,7 @@
/// FUNCTION_BODY
/// INVOCATION
/// LITERAL
+/// PARAMETERS
/// }
///
/// Clients may not extend, implement or mix-in this class.
@@ -1611,6 +1612,8 @@
static const FoldingKind LITERAL = FoldingKind._('LITERAL');
+ static const FoldingKind PARAMETERS = FoldingKind._('PARAMETERS');
+
/// A list containing all of the enum values that are defined.
static const List<FoldingKind> VALUES = <FoldingKind>[
ANNOTATIONS,
@@ -1622,7 +1625,8 @@
FILE_HEADER,
FUNCTION_BODY,
INVOCATION,
- LITERAL
+ LITERAL,
+ PARAMETERS
];
@override
@@ -1652,6 +1656,8 @@
return INVOCATION;
case 'LITERAL':
return LITERAL;
+ case 'PARAMETERS':
+ return PARAMETERS;
}
throw Exception('Illegal enum value: $name');
}
diff --git a/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart b/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
index 308bad8..5c52f19 100644
--- a/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
+++ b/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
@@ -320,6 +320,7 @@
/// FUNCTION_BODY
/// INVOCATION
/// LITERAL
+/// PARAMETERS
/// }
final Matcher isFoldingKind = MatchesEnum('FoldingKind', [
'ANNOTATIONS',
@@ -331,7 +332,8 @@
'FILE_HEADER',
'FUNCTION_BODY',
'INVOCATION',
- 'LITERAL'
+ 'LITERAL',
+ 'PARAMETERS'
]);
/// FoldingRegion
diff --git a/pkg/analyzer_plugin/tool/spec/common_types_spec.html b/pkg/analyzer_plugin/tool/spec/common_types_spec.html
index adadbe5..1ec7a90 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.3</version>
+<version>1.4.4</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
@@ -616,6 +616,7 @@
<value><code>FUNCTION_BODY</code></value>
<value><code>INVOCATION</code></value>
<value><code>LITERAL</code></value>
+ <value><code>PARAMETERS</code></value>
</enum>
</type>
<type name="FoldingRegion">
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index 02b8bab..e4f2604 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -13,7 +13,7 @@
import '../elements/entities.dart';
import '../elements/types.dart';
import '../universe/selector.dart' show Selector;
-import '../util/util.dart' show ImmutableEmptySet, Setlet;
+import '../util/util.dart' show Setlet;
import '../world.dart' show JClosedWorld;
import 'abstract_value_domain.dart';
import 'debug.dart' as debug;
@@ -93,7 +93,7 @@
TypeInformation.untracked(this.type)
: _inputs = const <TypeInformation>[],
- users = const ImmutableEmptySet(),
+ users = const {},
context = null;
TypeInformation.withInputs(this.type, this.context, this._inputs)
@@ -170,7 +170,7 @@
void clear() {
_inputs = STOP_TRACKING_INPUTS_MARKER;
- users = const ImmutableEmptySet();
+ users = const {};
}
/// Reset the analysis of this node by making its type empty.
@@ -2182,9 +2182,7 @@
/// The set of [TypeInformation] nodes where values from the traced node could
/// flow in.
Set<TypeInformation> get flowsInto {
- return (_flowsInto == null)
- ? const ImmutableEmptySet<TypeInformation>()
- : _flowsInto;
+ return _flowsInto ?? const {};
}
/// Adds [nodes] to the sets of values this [TracedTypeInformation] flows
diff --git a/pkg/compiler/lib/src/js_backend/frequency_namer.dart b/pkg/compiler/lib/src/js_backend/frequency_namer.dart
index 8cf08c3..11988e9 100644
--- a/pkg/compiler/lib/src/js_backend/frequency_namer.dart
+++ b/pkg/compiler/lib/src/js_backend/frequency_namer.dart
@@ -81,7 +81,7 @@
List<int> _nextName = [$a];
final Set<String> illegalNames;
- TokenScope([this.illegalNames = const ImmutableEmptySet()]);
+ TokenScope([this.illegalNames = const {}]);
/// Increments the letter at [pos] in the current name. Also takes care of
/// overflows to the left. Returns the carry bit, i.e., it returns `true`
diff --git a/pkg/compiler/lib/src/util/emptyset.dart b/pkg/compiler/lib/src/util/emptyset.dart
deleted file mode 100644
index 6fe644c..0000000
--- a/pkg/compiler/lib/src/util/emptyset.dart
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2014, 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 dart2js.util.emptyset;
-
-import 'dart:collection' show IterableBase;
-
-class ImmutableEmptySet<E> extends IterableBase<E> implements Set<E> {
- const ImmutableEmptySet();
-
- @override
- Set<R> cast<R>() => new ImmutableEmptySet<R>();
- @override
- get iterator => const _EmptySetIterator();
- @override
- int get length => 0;
- @override
- bool get isEmpty => true;
-
- get _immutableError => throw new UnsupportedError("EmptySet is immutable");
-
- @override
- bool add(E element) => _immutableError;
- @override
- void addAll(Iterable<E> elements) => _immutableError;
-
- @override
- E lookup(Object element) => null;
- @override
- bool remove(Object element) => false;
- @override
- void removeAll(Iterable<Object> elements) {}
- @override
- void removeWhere(bool test(E element)) {}
- @override
- void retainAll(Iterable<Object> elements) {}
- @override
- void retainWhere(bool test(E element)) {}
- @override
- void forEach(void action(E element)) {}
- @override
- void clear() {}
-
- @override
- bool contains(Object element) => false;
- @override
- bool containsAll(Iterable<Object> other) => other.isEmpty;
-
- @override
- Set<E> union(Set<E> other) => new Set.from(other);
- @override
- Set<E> intersection(Set<Object> other) => this;
- @override
- Set<E> difference(Set<Object> other) => this;
- @override
- Set<E> toSet() => new Set<E>();
-}
-
-class _EmptySetIterator implements Iterator<Null> {
- const _EmptySetIterator();
-
- @override
- Null get current => null;
- @override
- bool moveNext() => false;
-}
diff --git a/pkg/compiler/lib/src/util/util.dart b/pkg/compiler/lib/src/util/util.dart
index 7b5e9fd..3a9949d 100644
--- a/pkg/compiler/lib/src/util/util.dart
+++ b/pkg/compiler/lib/src/util/util.dart
@@ -5,9 +5,8 @@
library dart2js.util;
import 'package:front_end/src/api_unstable/dart2js.dart'
- show $BACKSLASH, $CR, $DEL, $DQ, $LF, $LS, $PS, $TAB, Link, LinkBuilder;
+ show $BACKSLASH, $CR, $DEL, $DQ, $LF, $LS, $PS, $TAB, Link;
-export 'emptyset.dart';
export 'maplet.dart';
export 'setlet.dart';
@@ -88,7 +87,7 @@
/// [existing].
static int unorderedMapHash(Map map, [int existing = 0]) {
if (map.length == 0) return existing;
- List<int> hashCodes = List.filled(map.length, null);
+ List<int> hashCodes = List.filled(map.length, 0);
int i = 0;
for (var entry in map.entries) {
hashCodes[i++] = objectHash(entry.key, objectHash(entry.value));
@@ -243,29 +242,6 @@
0x3fffffff;
}
-String modifiersToString(
- {bool isStatic: false,
- bool isAbstract: false,
- bool isFinal: false,
- bool isVar: false,
- bool isConst: false,
- bool isFactory: false,
- bool isExternal: false,
- bool isCovariant: false}) {
- LinkBuilder<String> builder = new LinkBuilder<String>();
- if (isStatic) builder.addLast('static');
- if (isAbstract) builder.addLast('abstract');
- if (isFinal) builder.addLast('final');
- if (isVar) builder.addLast('var');
- if (isConst) builder.addLast('const');
- if (isFactory) builder.addLast('factory');
- if (isExternal) builder.addLast('external');
- if (isCovariant) builder.addLast('covariant');
- StringBuffer buffer = new StringBuffer();
- builder.toLink(const Link<String>()).printOn(buffer, ', ');
- return buffer.toString();
-}
-
class Pair<A, B> {
final A a;
final B b;
diff --git a/pkg/dds/CHANGELOG.md b/pkg/dds/CHANGELOG.md
index d017347..c899383 100644
--- a/pkg/dds/CHANGELOG.md
+++ b/pkg/dds/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 2.0.0
+- **Breaking change:** add null safety support.
+- **Breaking change:** minimum Dart SDK revision bumped to 2.12.0.
+
# 1.8.0
- Add support for launching DevTools from DDS.
- Fixed issue where two clients subscribing to the same stream in close succession
diff --git a/pkg/dds/bin/dds.dart b/pkg/dds/bin/dds.dart
index 45673f5..b34c090 100644
--- a/pkg/dds/bin/dds.dart
+++ b/pkg/dds/bin/dds.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 'dart:convert';
import 'dart:io';
@@ -28,7 +26,7 @@
final remoteVmServiceUri = Uri.parse(args.first);
// Resolve the address which is potentially provided by the user.
- InternetAddress address;
+ late InternetAddress address;
final addresses = await InternetAddress.lookup(args[1]);
// Prefer IPv4 addresses.
for (int i = 0; i < addresses.length; i++) {
@@ -43,7 +41,7 @@
final disableServiceAuthCodes = args[3] == 'true';
final startDevTools = args[4] == 'true';
- Uri devToolsBuildDirectory;
+ Uri? devToolsBuildDirectory;
if (args[5].isNotEmpty) {
devToolsBuildDirectory = Uri.file(args[5]);
}
@@ -55,7 +53,7 @@
remoteVmServiceUri,
serviceUri: serviceUri,
enableAuthCodes: !disableServiceAuthCodes,
- devToolsConfiguration: startDevTools
+ devToolsConfiguration: startDevTools && devToolsBuildDirectory != null
? DevToolsConfiguration(
enable: startDevTools,
customBuildDirectoryPath: devToolsBuildDirectory,
diff --git a/pkg/dds/example/example.dart b/pkg/dds/example/example.dart
index 561dca9..883c678 100644
--- a/pkg/dds/example/example.dart
+++ b/pkg/dds/example/example.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:dds/dds.dart';
import 'package:vm_service/vm_service_io.dart';
diff --git a/pkg/dds/lib/dds.dart b/pkg/dds/lib/dds.dart
index f0e913b..e8f05bb 100644
--- a/pkg/dds/lib/dds.dart
+++ b/pkg/dds/lib/dds.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
-
/// A library used to spawn the Dart Developer Service, used to communicate
/// with a Dart VM Service instance.
library dds;
@@ -41,15 +39,12 @@
/// default.
static Future<DartDevelopmentService> startDartDevelopmentService(
Uri remoteVmServiceUri, {
- Uri serviceUri,
+ Uri? serviceUri,
bool enableAuthCodes = true,
bool ipv6 = false,
- DevToolsConfiguration devToolsConfiguration = const DevToolsConfiguration(),
+ DevToolsConfiguration? devToolsConfiguration,
bool logRequests = false,
}) async {
- if (remoteVmServiceUri == null) {
- throw ArgumentError.notNull('remoteVmServiceUri');
- }
if (remoteVmServiceUri.scheme != 'http') {
throw ArgumentError(
'remoteVmServiceUri must have an HTTP scheme. Actual: ${remoteVmServiceUri.scheme}',
@@ -65,12 +60,15 @@
// If provided an address to bind to, ensure it uses a protocol consistent
// with that used to spawn DDS.
final addresses = await InternetAddress.lookup(serviceUri.host);
- final address = addresses.firstWhere(
- (a) => (a.type ==
- (ipv6 ? InternetAddressType.IPv6 : InternetAddressType.IPv4)),
- orElse: () => null,
- );
- if (address == null) {
+
+ try {
+ // Check to see if there's a valid address.
+ addresses.firstWhere(
+ (a) => (a.type ==
+ (ipv6 ? InternetAddressType.IPv6 : InternetAddressType.IPv4)),
+ );
+ } on StateError {
+ // Could not find a valid address.
throw ArgumentError(
"serviceUri '$serviceUri' is not an IPv${ipv6 ? "6" : "4"} address.",
);
@@ -115,24 +113,24 @@
/// [DartDevelopmentService] via HTTP.
///
/// Returns `null` if the service is not running.
- Uri get uri;
+ Uri? get uri;
/// The [Uri] VM service clients can use to communicate with this
/// [DartDevelopmentService] via server-sent events (SSE).
///
/// Returns `null` if the service is not running.
- Uri get sseUri;
+ Uri? get sseUri;
/// The [Uri] VM service clients can use to communicate with this
/// [DartDevelopmentService] via a [WebSocket].
///
/// Returns `null` if the service is not running.
- Uri get wsUri;
+ Uri? get wsUri;
/// The HTTP [Uri] of the hosted DevTools instance.
///
/// Returns `null` if DevTools is not running.
- Uri get devToolsUri;
+ Uri? get devToolsUri;
/// Set to `true` if this instance of [DartDevelopmentService] is accepting
/// requests.
@@ -180,8 +178,8 @@
class DevToolsConfiguration {
const DevToolsConfiguration({
+ required this.customBuildDirectoryPath,
this.enable = false,
- this.customBuildDirectoryPath,
});
final bool enable;
diff --git a/pkg/dds/lib/src/binary_compatible_peer.dart b/pkg/dds/lib/src/binary_compatible_peer.dart
index 2e1af84..b701f5e 100644
--- a/pkg/dds/lib/src/binary_compatible_peer.dart
+++ b/pkg/dds/lib/src/binary_compatible_peer.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 'dart:async';
import 'dart:convert';
import 'dart:typed_data';
diff --git a/pkg/dds/lib/src/client.dart b/pkg/dds/lib/src/client.dart
index 9ceb162..1df3a3a 100644
--- a/pkg/dds/lib/src/client.dart
+++ b/pkg/dds/lib/src/client.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 'dart:async';
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
@@ -26,7 +24,7 @@
WebSocketChannel ws,
json_rpc.Peer vmServicePeer,
) : this._(
- dds,
+ dds as DartDevelopmentServiceImpl,
ws,
vmServicePeer,
);
@@ -36,7 +34,7 @@
SseConnection sse,
json_rpc.Peer vmServicePeer,
) : this._(
- dds,
+ dds as DartDevelopmentServiceImpl,
sse,
vmServicePeer,
);
@@ -167,7 +165,8 @@
(parameters) => {
'type': 'Size',
'size': StreamManager
- .loggingRepositories[StreamManager.kLoggingStream].bufferSize,
+ .loggingRepositories[StreamManager.kLoggingStream]!
+ .bufferSize,
});
_clientPeer.registerMethod('setLogHistorySize', (parameters) {
@@ -177,7 +176,7 @@
"'size' must be greater or equal to zero",
);
}
- StreamManager.loggingRepositories[StreamManager.kLoggingStream]
+ StreamManager.loggingRepositories[StreamManager.kLoggingStream]!
.resize(size);
return RPCResponses.success;
});
@@ -193,8 +192,8 @@
});
_clientPeer.registerMethod('getSupportedProtocols', (parameters) async {
- final Map<String, dynamic> supportedProtocols =
- await _vmServicePeer.sendRequest('getSupportedProtocols');
+ final Map<String, dynamic> supportedProtocols = (await _vmServicePeer
+ .sendRequest('getSupportedProtocols')) as Map<String, dynamic>;
final ddsVersion = DartDevelopmentService.protocolVersion.split('.');
final ddsProtocol = {
'protocolName': 'DDS',
@@ -289,17 +288,17 @@
String get defaultClientName => 'client$_id';
/// The current name associated with this client.
- String get name => _name;
+ String? get name => _name;
// NOTE: this should not be called directly except from:
// - `ClientManager._clearClientName`
// - `ClientManager._setClientNameHelper`
- set name(String n) => _name = n ?? defaultClientName;
- String _name;
+ set name(String? n) => _name = n ?? defaultClientName;
+ String? _name;
final DartDevelopmentServiceImpl dds;
final StreamChannel connection;
final Map<String, String> services = {};
final json_rpc.Peer _vmServicePeer;
- json_rpc.Peer _clientPeer;
+ late json_rpc.Peer _clientPeer;
}
diff --git a/pkg/dds/lib/src/client_manager.dart b/pkg/dds/lib/src/client_manager.dart
index c911c51..807e5fd 100644
--- a/pkg/dds/lib/src/client_manager.dart
+++ b/pkg/dds/lib/src/client_manager.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:json_rpc_2/json_rpc_2.dart' as json_rpc;
import 'client.dart';
@@ -98,7 +96,7 @@
pauseTypeMask |= PauseTypeMasks.pauseOnExitMask;
}
- clientResumePermissions[client.name].permissionsMask = pauseTypeMask;
+ clientResumePermissions[client.name!]!.permissionsMask = pauseTypeMask;
return RPCResponses.success;
}
@@ -111,10 +109,10 @@
_clearClientName(client);
client.name = name.isEmpty ? client.defaultClientName : name;
clientResumePermissions.putIfAbsent(
- client.name,
+ client.name!,
() => _ClientResumePermissions(),
);
- clientResumePermissions[client.name].clients.add(client);
+ clientResumePermissions[client.name!]!.clients.add(client);
}
/// Resets the client's name while also cleaning up resume permissions and
@@ -155,7 +153,7 @@
}
}
- DartDevelopmentServiceClient findFirstClientThatHandlesService(
+ DartDevelopmentServiceClient? findFirstClientThatHandlesService(
String service) {
for (final client in clients) {
if (client.services.containsKey(service)) {
@@ -173,7 +171,7 @@
/// Mapping of client names to all clients of that name and their resume
/// permissions.
- final Map<String, _ClientResumePermissions> clientResumePermissions = {};
+ final Map<String?, _ClientResumePermissions> clientResumePermissions = {};
final DartDevelopmentServiceImpl dds;
}
diff --git a/pkg/dds/lib/src/constants.dart b/pkg/dds/lib/src/constants.dart
index b69ae7c..63f2b7f 100644
--- a/pkg/dds/lib/src/constants.dart
+++ b/pkg/dds/lib/src/constants.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
-
abstract class RPCResponses {
static const success = <String, dynamic>{
'type': 'Success',
diff --git a/pkg/dds/lib/src/dds_impl.dart b/pkg/dds/lib/src/dds_impl.dart
index c28523d..c65ba5d 100644
--- a/pkg/dds/lib/src/dds_impl.dart
+++ b/pkg/dds/lib/src/dds_impl.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 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -172,13 +170,13 @@
}
_shuttingDown = true;
// Don't accept any more HTTP requests.
- await _server?.close();
+ await _server.close();
// Close connections to clients.
await clientManager.shutdown();
// Close connection to VM service.
- await _vmServiceSocket?.sink?.close();
+ await _vmServiceSocket.sink.close();
_done.complete();
}
@@ -267,16 +265,16 @@
}
Handler _httpHandler() {
- if (_devToolsConfiguration != null && _devToolsConfiguration.enable) {
+ if (_devToolsConfiguration != null && _devToolsConfiguration!.enable) {
// Install the DevTools handlers and forward any unhandled HTTP requests to
// the VM service.
- final buildDir =
- _devToolsConfiguration.customBuildDirectoryPath?.toFilePath();
+ final String buildDir =
+ _devToolsConfiguration!.customBuildDirectoryPath.toFilePath();
return devtoolsHandler(
dds: this,
buildDir: buildDir,
notFoundHandler: proxyHandler(remoteVmServiceUri),
- );
+ ) as FutureOr<Response> Function(Request);
}
return proxyHandler(remoteVmServiceUri);
}
@@ -294,7 +292,7 @@
return pathSegments;
}
- Uri _toWebSocket(Uri uri) {
+ Uri? _toWebSocket(Uri? uri) {
if (uri == null) {
return null;
}
@@ -303,7 +301,7 @@
return uri.replace(scheme: 'ws', pathSegments: pathSegments);
}
- Uri _toSse(Uri uri) {
+ Uri? _toSse(Uri? uri) {
if (uri == null) {
return null;
}
@@ -312,7 +310,7 @@
return uri.replace(scheme: 'sse', pathSegments: pathSegments);
}
- Uri _toDevTools(Uri uri) {
+ Uri? _toDevTools(Uri? uri) {
// The DevTools URI is a bit strange as the query parameters appear after
// the fragment. There's no nice way to encode the query parameters
// properly, so we create another Uri just to grab the formatted query.
@@ -325,7 +323,7 @@
).query;
return Uri(
scheme: 'http',
- host: uri.host,
+ host: uri!.host,
port: uri.port,
pathSegments: [
...uri.pathSegments.where(
@@ -338,56 +336,61 @@
);
}
- String getNamespace(DartDevelopmentServiceClient client) =>
+ String? getNamespace(DartDevelopmentServiceClient client) =>
clientManager.clients.keyOf(client);
bool get authCodesEnabled => _authCodesEnabled;
final bool _authCodesEnabled;
- String get authCode => _authCode;
- String _authCode;
+ String? get authCode => _authCode;
+ String? _authCode;
final bool shouldLogRequests;
Uri get remoteVmServiceUri => _remoteVmServiceUri;
- Uri get remoteVmServiceWsUri => _toWebSocket(_remoteVmServiceUri);
+ @override
+ Uri get remoteVmServiceWsUri => _toWebSocket(_remoteVmServiceUri)!;
Uri _remoteVmServiceUri;
- Uri get uri => _uri;
- Uri _uri;
+ @override
+ Uri? get uri => _uri;
+ Uri? _uri;
- Uri get sseUri => _toSse(_uri);
+ @override
+ Uri? get sseUri => _toSse(_uri);
- Uri get wsUri => _toWebSocket(_uri);
+ @override
+ Uri? get wsUri => _toWebSocket(_uri);
- Uri get devToolsUri =>
- _devToolsConfiguration.enable ? _toDevTools(_uri) : null;
+ @override
+ Uri? get devToolsUri =>
+ _devToolsConfiguration?.enable ?? false ? _toDevTools(_uri) : null;
final bool _ipv6;
bool get isRunning => _uri != null;
- final DevToolsConfiguration _devToolsConfiguration;
+ final DevToolsConfiguration? _devToolsConfiguration;
Future<void> get done => _done.future;
Completer _done = Completer<void>();
bool _shuttingDown = false;
ClientManager get clientManager => _clientManager;
- ClientManager _clientManager;
+ late ClientManager _clientManager;
ExpressionEvaluator get expressionEvaluator => _expressionEvaluator;
- ExpressionEvaluator _expressionEvaluator;
+ late ExpressionEvaluator _expressionEvaluator;
IsolateManager get isolateManager => _isolateManager;
- IsolateManager _isolateManager;
+ late IsolateManager _isolateManager;
StreamManager get streamManager => _streamManager;
- StreamManager _streamManager;
+ late StreamManager _streamManager;
static const _kSseHandlerPath = '\$debugHandler';
- json_rpc.Peer vmServiceClient;
- WebSocketChannel _vmServiceSocket;
- HttpServer _server;
+ late json_rpc.Peer vmServiceClient;
+ late WebSocketChannel _vmServiceSocket;
+ late HttpServer _server;
}
diff --git a/pkg/dds/lib/src/devtools/devtools_client.dart b/pkg/dds/lib/src/devtools/devtools_client.dart
index 5f8670e..8bc3564 100644
--- a/pkg/dds/lib/src/devtools/devtools_client.dart
+++ b/pkg/dds/lib/src/devtools/devtools_client.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 'dart:async';
import 'package:json_rpc_2/src/server.dart' as json_rpc;
@@ -22,7 +20,7 @@
}
@override
- void addError(Object error, [StackTrace stackTrace]) {
+ void addError(Object error, [StackTrace? stackTrace]) {
print('DevTools SSE error response: $error');
sink.addError(error);
}
@@ -59,7 +57,7 @@
}
_server = json_rpc.Server(
- StreamChannel(stream, sink),
+ StreamChannel(stream, sink as StreamSink<String>),
strictProtocolChecks: false,
);
_registerJsonRpcMethods();
@@ -92,5 +90,5 @@
});
}
- json_rpc.Server _server;
+ late json_rpc.Server _server;
}
diff --git a/pkg/dds/lib/src/devtools/devtools_handler.dart b/pkg/dds/lib/src/devtools/devtools_handler.dart
index a0a4bf1..87c4fa6 100644
--- a/pkg/dds/lib/src/devtools/devtools_handler.dart
+++ b/pkg/dds/lib/src/devtools/devtools_handler.dart
@@ -2,12 +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.
-// @dart=2.9
-
import 'dart:async';
import 'package:dds/src/constants.dart';
-import 'package:meta/meta.dart';
import 'package:shelf/shelf.dart';
import 'package:shelf_static/shelf_static.dart';
import 'package:sse/server/sse_handler.dart';
@@ -24,9 +21,9 @@
/// [notFoundHandler] is a [Handler] to which requests that could not be handled
/// by the DevTools handler are forwarded (e.g., a proxy to the VM service).
FutureOr<Handler> devtoolsHandler({
- @required DartDevelopmentServiceImpl dds,
- @required String buildDir,
- @required Handler notFoundHandler,
+ required DartDevelopmentServiceImpl dds,
+ required String buildDir,
+ required Handler notFoundHandler,
}) {
// Serves the web assets for DevTools.
final devtoolsAssetHandler = createStaticHandler(
diff --git a/pkg/dds/lib/src/devtools/file_system.dart b/pkg/dds/lib/src/devtools/file_system.dart
index 9a05de7..d5d6c6a 100644
--- a/pkg/dds/lib/src/devtools/file_system.dart
+++ b/pkg/dds/lib/src/devtools/file_system.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart=2.9
-
// TODO(bkonyi): remove once package:devtools_server_api is available
// See https://github.com/flutter/devtools/issues/2958.
@@ -18,7 +16,7 @@
static String _userHomeDir() {
final String envKey =
Platform.operatingSystem == 'windows' ? 'APPDATA' : 'HOME';
- final String value = Platform.environment[envKey];
+ final String? value = Platform.environment[envKey];
return value == null ? '.' : value;
}
@@ -46,7 +44,7 @@
/// Returns a DevTools file from the given path.
///
/// Only files within ~/.flutter-devtools/ can be accessed.
- static File devToolsFileFromPath(String pathFromDevToolsDir) {
+ static File? devToolsFileFromPath(String pathFromDevToolsDir) {
if (pathFromDevToolsDir.contains('..')) {
// The passed in path should not be able to walk up the directory tree
// outside of the ~/.flutter-devtools/ directory.
@@ -63,7 +61,7 @@
/// Returns a DevTools file from the given path as encoded json.
///
/// Only files within ~/.flutter-devtools/ can be accessed.
- static String devToolsFileAsJson(String pathFromDevToolsDir) {
+ static String? devToolsFileAsJson(String pathFromDevToolsDir) {
final file = devToolsFileFromPath(pathFromDevToolsDir);
if (file == null) return null;
diff --git a/pkg/dds/lib/src/devtools/server_api.dart b/pkg/dds/lib/src/devtools/server_api.dart
index b866f44..5f21a03 100644
--- a/pkg/dds/lib/src/devtools/server_api.dart
+++ b/pkg/dds/lib/src/devtools/server_api.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart=2.9
-
// TODO(bkonyi): remove once package:devtools_server_api is available
// See https://github.com/flutter/devtools/issues/2958.
@@ -33,7 +31,7 @@
/// To override an API call, pass in a subclass of [ServerApi].
static FutureOr<shelf.Response> handle(
shelf.Request request, [
- ServerApi api,
+ ServerApi? api,
]) {
api ??= ServerApi();
switch (request.url.path) {
@@ -42,7 +40,7 @@
// Is Analytics collection enabled?
return api.getCompleted(
request,
- json.encode(FlutterUsage.doesStoreExist ? _usage.enabled : null),
+ json.encode(FlutterUsage.doesStoreExist ? _usage!.enabled : null),
);
case apiGetFlutterGAClientId:
// Flutter Tool GA clientId - ONLY get Flutter's clientId if enabled is
@@ -50,7 +48,7 @@
return (FlutterUsage.doesStoreExist)
? api.getCompleted(
request,
- json.encode(_usage.enabled ? _usage.clientId : null),
+ json.encode(_usage!.enabled ? _usage!.clientId : null),
)
: api.getCompleted(
request,
@@ -76,7 +74,7 @@
final queryParams = request.requestedUri.queryParameters;
if (queryParams.containsKey(devToolsEnabledPropertyName)) {
_devToolsUsage.enabled =
- json.decode(queryParams[devToolsEnabledPropertyName]);
+ json.decode(queryParams[devToolsEnabledPropertyName]!);
}
return api.setCompleted(request, json.encode(_devToolsUsage.enabled));
@@ -92,7 +90,7 @@
final queryParams = request.requestedUri.queryParameters;
if (queryParams.keys.length == 1 &&
queryParams.containsKey(activeSurveyName)) {
- final String theSurveyName = queryParams[activeSurveyName];
+ final String theSurveyName = queryParams[activeSurveyName]!;
// Set the current activeSurvey.
_devToolsUsage.activeSurvey = theSurveyName;
@@ -125,7 +123,7 @@
final queryParams = request.requestedUri.queryParameters;
if (queryParams.containsKey(surveyActionTakenPropertyName)) {
_devToolsUsage.surveyActionTaken =
- json.decode(queryParams[surveyActionTakenPropertyName]);
+ json.decode(queryParams[surveyActionTakenPropertyName]!);
}
return api.setCompleted(
request,
@@ -157,7 +155,7 @@
case apiGetBaseAppSizeFile:
final queryParams = request.requestedUri.queryParameters;
if (queryParams.containsKey(baseAppSizeFilePropertyName)) {
- final filePath = queryParams[baseAppSizeFilePropertyName];
+ final filePath = queryParams[baseAppSizeFilePropertyName]!;
final fileJson = LocalFileSystem.devToolsFileAsJson(filePath);
if (fileJson == null) {
return api.badRequest('No JSON file available at $filePath.');
@@ -170,7 +168,7 @@
case apiGetTestAppSizeFile:
final queryParams = request.requestedUri.queryParameters;
if (queryParams.containsKey(testAppSizeFilePropertyName)) {
- final filePath = queryParams[testAppSizeFilePropertyName];
+ final filePath = queryParams[testAppSizeFilePropertyName]!;
final fileJson = LocalFileSystem.devToolsFileAsJson(filePath);
if (fileJson == null) {
return api.badRequest('No JSON file available at $filePath.');
@@ -188,7 +186,7 @@
// Accessing Flutter usage file e.g., ~/.flutter.
// NOTE: Only access the file if it exists otherwise Flutter Tool hasn't yet
// been run.
- static final FlutterUsage _usage =
+ static final FlutterUsage? _usage =
FlutterUsage.doesStoreExist ? FlutterUsage() : null;
// Accessing DevTools usage file e.g., ~/.devtools
@@ -215,7 +213,7 @@
/// setActiveSurvey not called.
///
/// This is a 400 Bad Request response.
- FutureOr<shelf.Response> badRequest([String logError]) {
+ FutureOr<shelf.Response> badRequest([String? logError]) {
if (logError != null) print(logError);
return shelf.Response(HttpStatus.badRequest);
}
diff --git a/pkg/dds/lib/src/devtools/usage.dart b/pkg/dds/lib/src/devtools/usage.dart
index afa35d7..8e61b90 100644
--- a/pkg/dds/lib/src/devtools/usage.dart
+++ b/pkg/dds/lib/src/devtools/usage.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart=2.9
-
// TODO(bkonyi): remove once package:devtools_server_api is available
// See https://github.com/flutter/devtools/issues/2958.
@@ -21,13 +19,13 @@
/// used for testing.
FlutterUsage({
String settingsName = 'flutter',
- String versionOverride,
- String configDirOverride,
+ String? versionOverride,
+ String? configDirOverride,
}) {
_analytics = AnalyticsIO('', settingsName, '');
}
- Analytics _analytics;
+ late Analytics _analytics;
/// Does the .flutter store exist?
static bool get doesStoreExist {
@@ -48,8 +46,8 @@
/// Create a new Usage instance; [versionOverride] and [configDirOverride] are
/// used for testing.
DevToolsUsage({
- String versionOverride,
- String configDirOverride,
+ String? versionOverride,
+ String? configDirOverride,
}) {
LocalFileSystem.maybeMoveLegacyDevToolsStore();
properties = IOPersistentProperties(
@@ -70,9 +68,9 @@
/// It is a requirement that the API apiSetActiveSurvey must be called before
/// calling any survey method on DevToolsUsage (addSurvey, rewriteActiveSurvey,
/// surveyShownCount, incrementSurveyShownCount, or surveyActionTaken).
- String _activeSurvey;
+ String? _activeSurvey;
- IOPersistentProperties properties;
+ late IOPersistentProperties properties;
static const _surveyActionTaken = 'surveyActionTaken';
static const _surveyShownCount = 'surveyShownCount';
@@ -95,23 +93,21 @@
return properties['enabled'];
}
- set enabled(bool value) {
+ set enabled(bool? value) {
properties['enabled'] = value;
return properties['enabled'];
}
- bool surveyNameExists(String surveyName) => properties[surveyName] != null;
+ bool surveyNameExists(String? surveyName) => properties[surveyName] != null;
- void _addSurvey(String surveyName) {
- assert(activeSurvey != null);
+ void _addSurvey(String? surveyName) {
assert(activeSurvey == surveyName);
rewriteActiveSurvey(false, 0);
}
- String get activeSurvey => _activeSurvey;
+ String? get activeSurvey => _activeSurvey;
- set activeSurvey(String surveyName) {
- assert(surveyName != null);
+ set activeSurvey(String? surveyName) {
_activeSurvey = surveyName;
if (!surveyNameExists(activeSurvey)) {
@@ -121,16 +117,14 @@
}
/// Need to rewrite the entire survey structure for property to be persisted.
- void rewriteActiveSurvey(bool actionTaken, int shownCount) {
- assert(activeSurvey != null);
+ void rewriteActiveSurvey(bool? actionTaken, int? shownCount) {
properties[activeSurvey] = {
_surveyActionTaken: actionTaken,
_surveyShownCount: shownCount,
};
}
- int get surveyShownCount {
- assert(activeSurvey != null);
+ int? get surveyShownCount {
final prop = properties[activeSurvey];
if (prop[_surveyShownCount] == null) {
rewriteActiveSurvey(prop[_surveyActionTaken], 0);
@@ -139,19 +133,16 @@
}
void incrementSurveyShownCount() {
- assert(activeSurvey != null);
surveyShownCount; // Ensure surveyShownCount has been initialized.
final prop = properties[activeSurvey];
rewriteActiveSurvey(prop[_surveyActionTaken], prop[_surveyShownCount] + 1);
}
bool get surveyActionTaken {
- assert(activeSurvey != null);
return properties[activeSurvey][_surveyActionTaken] == true;
}
- set surveyActionTaken(bool value) {
- assert(activeSurvey != null);
+ set surveyActionTaken(bool? value) {
final prop = properties[activeSurvey];
rewriteActiveSurvey(value, prop[_surveyShownCount]);
}
@@ -177,7 +168,7 @@
class IOPersistentProperties extends PersistentProperties {
IOPersistentProperties(
String name, {
- String documentDirPath,
+ String? documentDirPath,
}) : super(name) {
final String fileName = name.replaceAll(' ', '_');
documentDirPath ??= LocalFileSystem.devToolsDir();
@@ -196,22 +187,22 @@
syncSettings();
}
- File _file;
+ late File _file;
- Map _map;
+ Map? _map;
@override
- dynamic operator [](String key) => _map[key];
+ dynamic operator [](String? key) => _map![key];
@override
- void operator []=(String key, dynamic value) {
- if (value == null && !_map.containsKey(key)) return;
- if (_map[key] == value) return;
+ void operator []=(String? key, dynamic value) {
+ if (value == null && !_map!.containsKey(key)) return;
+ if (_map![key] == value) return;
if (value == null) {
- _map.remove(key);
+ _map!.remove(key);
} else {
- _map[key] = value;
+ _map![key] = value;
}
try {
@@ -231,6 +222,6 @@
}
void remove(String propertyName) {
- _map.remove(propertyName);
+ _map!.remove(propertyName);
}
}
diff --git a/pkg/dds/lib/src/expression_evaluator.dart b/pkg/dds/lib/src/expression_evaluator.dart
index 59bbe36..76026b6 100644
--- a/pkg/dds/lib/src/expression_evaluator.dart
+++ b/pkg/dds/lib/src/expression_evaluator.dart
@@ -2,7 +2,7 @@
// 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 'dart:async';
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
@@ -17,16 +17,16 @@
ExpressionEvaluator(this.dds);
Future<Map<String, dynamic>> execute(json_rpc.Parameters parameters) async {
- DartDevelopmentServiceClient externalClient =
+ DartDevelopmentServiceClient? externalClient =
dds.clientManager.findFirstClientThatHandlesService(
'compileExpression',
);
// If no compilation service is registered, just forward to the VM service.
if (externalClient == null) {
- return await dds.vmServiceClient.sendRequest(
+ return (await dds.vmServiceClient.sendRequest(
parameters.method,
parameters.value,
- );
+ )) as Map<String, dynamic>;
}
final isolateId = parameters['isolateId'].asString;
@@ -59,18 +59,18 @@
json_rpc.Parameters parameters) async {
final params = _setupParams(parameters);
params['isolateId'] = parameters['isolateId'].asString;
- if (parameters['scope'].asMapOr(null) != null) {
+ if (parameters['scope'].asMapOr({}).isNotEmpty) {
params['scope'] = parameters['scope'].asMap;
}
- return await dds.vmServiceClient.sendRequest(
+ return (await dds.vmServiceClient.sendRequest(
'_buildExpressionEvaluationScope',
params,
- );
+ )) as Map<String, dynamic>;
}
Future<String> _compileExpression(String isolateId, String expression,
Map<String, dynamic> buildScopeResponseResult) async {
- DartDevelopmentServiceClient externalClient =
+ DartDevelopmentServiceClient? externalClient =
dds.clientManager.findFirstClientThatHandlesService(
'compileExpression',
);
@@ -116,13 +116,13 @@
params['kernelBytes'] = kernelBase64;
params['disableBreakpoints'] =
parameters['disableBreakpoints'].asBoolOr(false);
- if (parameters['scope'].asMapOr(null) != null) {
+ if (parameters['scope'].asMapOr({}).isNotEmpty) {
params['scope'] = parameters['scope'].asMap;
}
- return await dds.vmServiceClient.sendRequest(
+ return (await dds.vmServiceClient.sendRequest(
'_evaluateCompiledExpression',
params,
- );
+ )) as Map<String, dynamic>;
}
Map<String, dynamic> _setupParams(json_rpc.Parameters parameters) {
diff --git a/pkg/dds/lib/src/isolate_manager.dart b/pkg/dds/lib/src/isolate_manager.dart
index a5139d5..e9e14df 100644
--- a/pkg/dds/lib/src/isolate_manager.dart
+++ b/pkg/dds/lib/src/isolate_manager.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:json_rpc_2/json_rpc_2.dart' as json_rpc;
import 'client.dart';
@@ -56,7 +54,7 @@
/// done so. Called when the last client of a given name disconnects or
/// changes name to ensure we don't deadlock waiting for approval to resume
/// from a disconnected client.
- Future<void> maybeResumeAfterClientChange(String clientName) async {
+ Future<void> maybeResumeAfterClientChange(String? clientName) async {
// Remove approvals from the disconnected client.
_resumeApprovalsByName.remove(clientName);
@@ -75,7 +73,7 @@
/// which have provided approval to resume this isolate. If not provided,
/// the existing approvals state will be examined to see if the isolate
/// should resume due to a client disconnect or name change.
- bool shouldResume({DartDevelopmentServiceClient resumingClient}) {
+ bool shouldResume({DartDevelopmentServiceClient? resumingClient}) {
if (resumingClient != null) {
// Mark approval by the client.
_resumeApprovalsByName.add(resumingClient.name);
@@ -85,9 +83,9 @@
isolateManager.dds.clientManager.clientResumePermissions;
// Determine which clients require approval for this pause type.
- permissions.forEach((name, clientNamePermissions) {
+ permissions.forEach((clientName, clientNamePermissions) {
if (clientNamePermissions.permissionsMask & _isolateStateMask != 0) {
- requiredClientApprovals.add(name);
+ requiredClientApprovals.add(clientName!);
}
});
@@ -116,8 +114,8 @@
final IsolateManager isolateManager;
final String name;
final String id;
- final Set<String> _resumeApprovalsByName = {};
- _IsolateState _state;
+ final Set<String?> _resumeApprovalsByName = {};
+ _IsolateState? _state;
}
class IsolateManager {
@@ -152,16 +150,16 @@
final isolate = isolates[id];
switch (eventKind) {
case ServiceEvents.pauseExit:
- isolate.pausedOnExit();
+ isolate!.pausedOnExit();
break;
case ServiceEvents.pausePostRequest:
- isolate.pausedPostRequest();
+ isolate!.pausedPostRequest();
break;
case ServiceEvents.pauseStart:
- isolate.pausedOnStart();
+ isolate!.pausedOnStart();
break;
case ServiceEvents.resume:
- isolate.resumed();
+ isolate!.resumed();
break;
default:
break;
@@ -237,12 +235,13 @@
String isolateId,
json_rpc.Parameters parameters,
) async {
- final step = parameters['step'].asStringOr(null);
- final frameIndex = parameters['frameIndex'].asIntOr(null);
+ const invalidFrameIndex = -1;
+ final step = parameters['step'].asStringOr('');
+ final frameIndex = parameters['frameIndex'].asIntOr(invalidFrameIndex);
final resumeResult = await dds.vmServiceClient.sendRequest('resume', {
'isolateId': isolateId,
- if (step != null) 'step': step,
- if (frameIndex != null) 'frameIndex': frameIndex,
+ if (step.isNotEmpty) 'step': step,
+ if (frameIndex != invalidFrameIndex) 'frameIndex': frameIndex,
});
return resumeResult;
}
diff --git a/pkg/dds/lib/src/logging_repository.dart b/pkg/dds/lib/src/logging_repository.dart
index 0b31ca6..4537d7e 100644
--- a/pkg/dds/lib/src/logging_repository.dart
+++ b/pkg/dds/lib/src/logging_repository.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 'dart:math';
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
@@ -50,9 +48,8 @@
// TODO(bkonyi): move to standalone file if we decide to use this elsewhere.
class _RingBuffer<T> {
- _RingBuffer(int initialSize) {
- _bufferSize = initialSize;
- _buffer = List<T>.filled(
+ _RingBuffer(this._bufferSize) {
+ _buffer = List<T?>.filled(
_bufferSize,
null,
);
@@ -60,7 +57,7 @@
Iterable<T> call() sync* {
for (int i = _size - 1; i >= 0; --i) {
- yield _buffer[(_count - i - 1) % _bufferSize];
+ yield _buffer[(_count - i - 1) % _bufferSize]!;
}
}
@@ -76,7 +73,7 @@
if (size == _bufferSize) {
return;
}
- final resized = List<T>.filled(
+ final resized = List<T?>.filled(
size,
null,
);
@@ -97,5 +94,5 @@
int _bufferSize;
int _count = 0;
- List<T> _buffer;
+ late List<T?> _buffer;
}
diff --git a/pkg/dds/lib/src/named_lookup.dart b/pkg/dds/lib/src/named_lookup.dart
index 8515411..7671d28 100644
--- a/pkg/dds/lib/src/named_lookup.dart
+++ b/pkg/dds/lib/src/named_lookup.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
-
// Originally pulled from dart:_vmservice.
import 'dart:collection';
@@ -25,14 +23,14 @@
}
void remove(E e) {
- final id = _ids.remove(e);
+ final id = _ids.remove(e)!;
_elements.remove(id);
_generator.release(id);
}
- E operator [](String id) => _elements[id];
+ E? operator [](String id) => _elements[id];
- String keyOf(E e) => _ids[e];
+ String? keyOf(E e) => _ids[e];
Iterator<E> get iterator => _ids.keys.iterator;
}
diff --git a/pkg/dds/lib/src/rpc_error_codes.dart b/pkg/dds/lib/src/rpc_error_codes.dart
index 895c07c..74a3723 100644
--- a/pkg/dds/lib/src/rpc_error_codes.dart
+++ b/pkg/dds/lib/src/rpc_error_codes.dart
@@ -2,15 +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.
-// @dart=2.10
-
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
abstract class RpcErrorCodes {
static json_rpc.RpcException buildRpcException(int code, {dynamic data}) {
return json_rpc.RpcException(
code,
- errorMessages[code],
+ errorMessages[code]!,
data: data,
);
}
diff --git a/pkg/dds/lib/src/stream_manager.dart b/pkg/dds/lib/src/stream_manager.dart
index c39ed6a..94f791a 100644
--- a/pkg/dds/lib/src/stream_manager.dart
+++ b/pkg/dds/lib/src/stream_manager.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 'dart:typed_data';
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
@@ -27,10 +25,10 @@
void streamNotify(
String streamId,
data, {
- DartDevelopmentServiceClient excludedClient,
+ DartDevelopmentServiceClient? excludedClient,
}) {
if (streamListeners.containsKey(streamId)) {
- final listeners = streamListeners[streamId];
+ final listeners = streamListeners[streamId]!;
final isBinaryData = data is Uint8List;
for (final listener in listeners) {
if (listener == excludedClient) {
@@ -64,7 +62,7 @@
String service,
String alias,
) {
- final namespace = dds.getNamespace(client);
+ final namespace = dds.getNamespace(client)!;
streamNotify(
kServiceStream,
_buildStreamRegisteredEvent(namespace, service, alias),
@@ -86,7 +84,7 @@
'kind': 'ServiceUnregistered',
'timestamp': DateTime.now().millisecondsSinceEpoch,
'service': service,
- 'method': namespace + '.' + service,
+ 'method': namespace! + '.' + service,
},
},
excludedClient: client,
@@ -120,7 +118,7 @@
// Keep a history of messages to send to clients when they first
// subscribe to a stream with an event history.
if (loggingRepositories.containsKey(streamId)) {
- loggingRepositories[streamId].add(parameters.asMap);
+ loggingRepositories[streamId]!.add(parameters.asMap);
}
streamNotify(streamId, parameters.value);
},
@@ -132,10 +130,10 @@
/// If `client` is the first client to listen to `stream`, DDS will send a
/// `streamListen` request for `stream` to the VM service.
Future<void> streamListen(
- DartDevelopmentServiceClient client,
+ DartDevelopmentServiceClient? client,
String stream,
) async {
- assert(stream != null && stream.isNotEmpty);
+ assert(stream.isNotEmpty);
if (!streamListeners.containsKey(stream)) {
// Initialize the list of clients for the new stream before we do
// anything else to ensure multiple clients registering for the same
@@ -152,13 +150,13 @@
assert(result['type'] == 'Success');
}
}
- if (streamListeners[stream].contains(client)) {
+ if (streamListeners[stream]!.contains(client)) {
throw kStreamAlreadySubscribedException;
}
if (client != null) {
- streamListeners[stream].add(client);
+ streamListeners[stream]!.add(client);
if (loggingRepositories.containsKey(stream)) {
- loggingRepositories[stream].sendHistoricalLogs(client);
+ loggingRepositories[stream]!.sendHistoricalLogs(client);
} else if (stream == kServiceStream) {
// Send all previously registered service extensions when a client
// subscribes to the Service stream.
@@ -171,9 +169,9 @@
client.sendNotification(
'streamNotify',
_buildStreamRegisteredEvent(
- namespace,
+ namespace!,
service,
- c.services[service],
+ c.services[service]!,
),
);
}
@@ -182,12 +180,12 @@
}
}
- List<Map<String, dynamic>> getStreamHistory(String stream) {
+ List<Map<String, dynamic>>? getStreamHistory(String stream) {
if (!loggingRepositories.containsKey(stream)) {
return null;
}
return [
- for (final event in loggingRepositories[stream]()) event['event'],
+ for (final event in loggingRepositories[stream]!()) event['event'],
];
}
@@ -196,13 +194,13 @@
/// If `client` is the last client to unsubscribe from `stream`, DDS will
/// send a `streamCancel` request for `stream` to the VM service.
Future<void> streamCancel(
- DartDevelopmentServiceClient client,
+ DartDevelopmentServiceClient? client,
String stream, {
bool cancelCoreStream = false,
}) async {
- assert(stream != null && stream.isNotEmpty);
+ assert(stream.isNotEmpty);
final listeners = streamListeners[stream];
- if (client != null && (listeners == null || !listeners.contains(client))) {
+ if (listeners == null || client != null && !listeners.contains(client)) {
throw kStreamNotSubscribedException;
}
listeners.remove(client);
diff --git a/pkg/dds/lib/vm_service_extensions.dart b/pkg/dds/lib/vm_service_extensions.dart
index 0b6aaf4..903c14a 100644
--- a/pkg/dds/lib/vm_service_extensions.dart
+++ b/pkg/dds/lib/vm_service_extensions.dart
@@ -2,19 +2,16 @@
// 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 'dart:async';
import 'dart:collection';
import 'package:async/async.dart';
-import 'package:meta/meta.dart';
import 'package:pedantic/pedantic.dart';
import 'package:vm_service/src/vm_service.dart';
extension DdsExtension on VmService {
static bool _factoriesRegistered = false;
- static Version _ddsVersion;
+ static Version? _ddsVersion;
/// The _getDartDevelopmentServiceVersion_ RPC is used to determine what version of
/// the Dart Development Service Protocol is served by a DDS instance.
@@ -25,7 +22,7 @@
_ddsVersion =
await _callHelper<Version>('getDartDevelopmentServiceVersion');
}
- return _ddsVersion;
+ return _ddsVersion!;
}
/// Retrieve the event history for `stream`.
@@ -47,19 +44,19 @@
/// If `stream` does not have event history collected, a parameter error is
/// sent over the returned [Stream].
Stream<Event> onEventWithHistory(String stream) {
- StreamController<Event> controller;
- StreamQueue<Event> streamEvents;
+ late StreamController<Event> controller;
+ late StreamQueue<Event> streamEvents;
controller = StreamController<Event>(onListen: () async {
streamEvents = StreamQueue<Event>(onEvent(stream));
final history = (await getStreamHistory(stream)).history;
- Event firstStreamEvent;
+ Event? firstStreamEvent;
unawaited(streamEvents.peek.then((e) {
firstStreamEvent = e;
}));
for (final event in history) {
if (firstStreamEvent != null &&
- event.timestamp > firstStreamEvent.timestamp) {
+ event.timestamp! > firstStreamEvent!.timestamp!) {
break;
}
controller.sink.add(event);
@@ -109,12 +106,12 @@
if (_ddsVersion == null) {
_ddsVersion = await getDartDevelopmentServiceVersion();
}
- return ((_ddsVersion.major == major && _ddsVersion.minor >= minor) ||
- (_ddsVersion.major > major));
+ return ((_ddsVersion!.major == major && _ddsVersion!.minor! >= minor) ||
+ (_ddsVersion!.major! > major));
}
Future<T> _callHelper<T>(String method,
- {String isolateId, Map args = const {}}) {
+ {String? isolateId, Map args = const {}}) {
if (!_factoriesRegistered) {
_registerFactories();
}
@@ -135,10 +132,10 @@
/// A collection of historical [Event]s from some stream.
class StreamHistory extends Response {
- static StreamHistory parse(Map<String, dynamic> json) =>
+ static StreamHistory? parse(Map<String, dynamic>? json) =>
json == null ? null : StreamHistory._fromJson(json);
- StreamHistory({@required List<Event> history}) : _history = history;
+ StreamHistory({required List<Event> history}) : _history = history;
StreamHistory._fromJson(Map<String, dynamic> json)
: _history = json['history']
diff --git a/pkg/dds/pubspec.yaml b/pkg/dds/pubspec.yaml
index a6c9ed0..9b226bf 100644
--- a/pkg/dds/pubspec.yaml
+++ b/pkg/dds/pubspec.yaml
@@ -3,7 +3,7 @@
A library used to spawn the Dart Developer Service, used to communicate with
a Dart VM Service instance.
-version: 1.8.0
+version: 2.0.0
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/dds
diff --git a/pkg/dds/test/auth_codes_test.dart b/pkg/dds/test/auth_codes_test.dart
index fa8cd44..7e6ce54 100644
--- a/pkg/dds/test/auth_codes_test.dart
+++ b/pkg/dds/test/auth_codes_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.10
-
import 'dart:convert';
import 'dart:io';
@@ -15,18 +13,16 @@
void main() {
group('DDS', () {
- Process process;
- DartDevelopmentService dds;
+ late Process process;
+ late DartDevelopmentService dds;
setUp(() async {
process = await spawnDartProcess('smoke.dart');
});
tearDown(() async {
- await dds?.shutdown();
- process?.kill();
- dds = null;
- process = null;
+ await dds.shutdown();
+ process.kill();
});
test('Bad Auth Code', () async {
@@ -38,8 +34,8 @@
// Ensure basic websocket requests are forwarded correctly to the VM service.
final service = await vmServiceConnectUri(dds.wsUri.toString());
final version = await service.getVersion();
- expect(version.major > 0, true);
- expect(version.minor >= 0, true);
+ expect(version.major! > 0, true);
+ expect(version.minor! >= 0, true);
// Ensure we can still make requests of the VM service via HTTP.
HttpClient client = HttpClient();
diff --git a/pkg/dds/test/common/fakes.dart b/pkg/dds/test/common/fakes.dart
index 663cdd0..7e11f9d 100644
--- a/pkg/dds/test/common/fakes.dart
+++ b/pkg/dds/test/common/fakes.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 'dart:async';
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
diff --git a/pkg/dds/test/common/test_helper.dart b/pkg/dds/test/common/test_helper.dart
index 7cdb204..9fc441b 100644
--- a/pkg/dds/test/common/test_helper.dart
+++ b/pkg/dds/test/common/test_helper.dart
@@ -2,12 +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.
-// @dart=2.10
-
+import 'dart:async';
import 'dart:convert';
import 'dart:io';
-Uri remoteVmServiceUri;
+import 'package:vm_service/vm_service.dart';
+
+late Uri remoteVmServiceUri;
Future<Process> spawnDartProcess(
String script, {
@@ -41,3 +42,20 @@
remoteVmServiceUri = Uri.parse(infoJson['uri']);
return process;
}
+
+Future<void> executeUntilNextPause(VmService service) async {
+ final vm = await service.getVM();
+ final isolate = await service.getIsolate(vm.isolates!.first.id!);
+
+ final completer = Completer<void>();
+ late StreamSubscription sub;
+ sub = service.onDebugEvent.listen((event) async {
+ if (event.kind == EventKind.kPauseBreakpoint) {
+ completer.complete();
+ await sub.cancel();
+ }
+ });
+ await service.streamListen(EventStreams.kDebug);
+ await service.resume(isolate.id!);
+ await completer.future;
+}
diff --git a/pkg/dds/test/external_compilation_service_script.dart b/pkg/dds/test/external_compilation_service_script.dart
index 00c9208..b01ed60 100644
--- a/pkg/dds/test/external_compilation_service_script.dart
+++ b/pkg/dds/test/external_compilation_service_script.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 'dart:developer';
main() {
diff --git a/pkg/dds/test/external_compilation_service_test.dart b/pkg/dds/test/external_compilation_service_test.dart
index f31b9c0..0fa12b6 100644
--- a/pkg/dds/test/external_compilation_service_test.dart
+++ b/pkg/dds/test/external_compilation_service_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.10
-
import 'dart:io';
import 'package:dds/dds.dart';
@@ -13,8 +11,8 @@
void main() {
group('DDS', () {
- Process process;
- DartDevelopmentService dds;
+ late Process process;
+ late DartDevelopmentService dds;
setUp(() async {
process =
@@ -22,10 +20,8 @@
});
tearDown(() async {
- await dds?.shutdown();
- process?.kill();
- dds = null;
- process = null;
+ await dds.shutdown();
+ process.kill();
});
test('evaluate invokes client provided compileExpression RPC', () async {
@@ -44,9 +40,10 @@
throw 'error';
});
final vm = await service.getVM();
- final isolate = await service.getIsolate(vm.isolates.first.id);
+ final isolate = await service.getIsolate(vm.isolates!.first.id!);
try {
- await service.evaluate(isolate.id, isolate.libraries.first.id, '1 + 1');
+ await service.evaluate(
+ isolate.id!, isolate.libraries!.first.id!, '1 + 1');
} catch (_) {
// ignore error
}
@@ -70,11 +67,13 @@
throw 'error';
});
final vm = await service.getVM();
- final isolate = await service.getIsolate(vm.isolates.first.id);
- await service.resume(isolate.id);
+ final isolate = await service.getIsolate(vm.isolates!.first.id!);
+ await service.resume(isolate.id!);
try {
- await service.evaluateInFrame(isolate.id, 0, '1 + 1');
- } catch (_) {
+ await service.evaluateInFrame(isolate.id!, 0, '1 + 1');
+ } catch (e, st) {
+ print(e);
+ print(st);
// ignore error
}
expect(invokedCompileExpression, true);
diff --git a/pkg/dds/test/get_stream_history_script.dart b/pkg/dds/test/get_stream_history_script.dart
index 1f8b820..34f7c67 100644
--- a/pkg/dds/test/get_stream_history_script.dart
+++ b/pkg/dds/test/get_stream_history_script.dart
@@ -1,4 +1,6 @@
-// @dart = 2.10
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
import 'dart:developer';
diff --git a/pkg/dds/test/get_stream_history_test.dart b/pkg/dds/test/get_stream_history_test.dart
index 6631d24..101ae0c 100644
--- a/pkg/dds/test/get_stream_history_test.dart
+++ b/pkg/dds/test/get_stream_history_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.10
-
import 'dart:io';
import 'package:dds/dds.dart';
@@ -13,19 +11,18 @@
import 'common/test_helper.dart';
void main() {
- Process process;
- DartDevelopmentService dds;
+ late Process process;
+ late DartDevelopmentService dds;
setUp(() async {
- process = await spawnDartProcess('get_stream_history_script.dart',
- pauseOnStart: false);
+ process = await spawnDartProcess(
+ 'get_stream_history_script.dart',
+ );
});
tearDown(() async {
- await dds?.shutdown();
- process?.kill();
- dds = null;
- process = null;
+ await dds.shutdown();
+ process.kill();
});
test('getStreamHistory returns log history', () async {
@@ -34,6 +31,10 @@
);
expect(dds.isRunning, true);
final service = await vmServiceConnectUri(dds.wsUri.toString());
+
+ // Wait until the test script has finished writing logs.
+ await executeUntilNextPause(service);
+
final result = await service.getStreamHistory('Logging');
expect(result, isNotNull);
expect(result, isA<StreamHistory>());
diff --git a/pkg/dds/test/handles_client_disconnect_state_error_test.dart b/pkg/dds/test/handles_client_disconnect_state_error_test.dart
index 974814a..816703b 100644
--- a/pkg/dds/test/handles_client_disconnect_state_error_test.dart
+++ b/pkg/dds/test/handles_client_disconnect_state_error_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.10
-
import 'dart:async';
import 'package:dds/dds.dart';
@@ -11,6 +9,7 @@
import 'package:dds/src/rpc_error_codes.dart';
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
import 'package:pedantic/pedantic.dart';
+import 'package:test/fake.dart';
import 'package:test/test.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
@@ -43,15 +42,28 @@
}
}
+class FakeWebSocketSink extends Fake implements WebSocketSink {
+ @override
+ Future close([int? closeCode, String? closeReason]) {
+ // Do nothing.
+ return Future.value();
+ }
+}
+
+class FakeWebSocketChannel extends Fake implements WebSocketChannel {
+ @override
+ WebSocketSink get sink => FakeWebSocketSink();
+}
+
void main() {
- webSocketBuilder = (Uri _) => null;
+ webSocketBuilder = (Uri _) => FakeWebSocketChannel();
peerBuilder =
(WebSocketChannel _, dynamic __) async => StreamCancelDisconnectPeer();
test('StateError handled by _StreamManager.clientDisconnect', () async {
final dds = await DartDevelopmentService.startDartDevelopmentService(
Uri(scheme: 'http'));
- final ws = await WebSocketChannel.connect(dds.uri.replace(scheme: 'ws'));
+ final ws = await WebSocketChannel.connect(dds.uri!.replace(scheme: 'ws'));
// Create a VM service client that connects to DDS.
final client = json_rpc.Client(ws.cast<String>());
@@ -78,7 +90,7 @@
() async {
final dds = await DartDevelopmentService.startDartDevelopmentService(
Uri(scheme: 'http'));
- final ws = await WebSocketChannel.connect(dds.uri.replace(scheme: 'ws'));
+ final ws = await WebSocketChannel.connect(dds.uri!.replace(scheme: 'ws'));
// Create a VM service client that connects to DDS.
final client = json_rpc.Client(ws.cast<String>());
diff --git a/pkg/dds/test/handles_connection_closed_before_full_header.dart b/pkg/dds/test/handles_connection_closed_before_full_header.dart
index 7be1043..5280886 100644
--- a/pkg/dds/test/handles_connection_closed_before_full_header.dart
+++ b/pkg/dds/test/handles_connection_closed_before_full_header.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 'dart:async';
import 'dart:io';
@@ -18,7 +16,7 @@
Future<Uri> startTestServer() async {
final server = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0);
server.listen((Socket request) async {
- await request.destroy();
+ request.destroy();
await server.close();
});
return Uri(scheme: 'http', host: server.address.host, port: server.port);
diff --git a/pkg/dds/test/on_event_with_history_script.dart b/pkg/dds/test/on_event_with_history_script.dart
index e35decc..3f27df0 100644
--- a/pkg/dds/test/on_event_with_history_script.dart
+++ b/pkg/dds/test/on_event_with_history_script.dart
@@ -1,5 +1,3 @@
-// @dart=2.10
-
import 'dart:developer';
void main() {
diff --git a/pkg/dds/test/on_event_with_history_test.dart b/pkg/dds/test/on_event_with_history_test.dart
index 42f25a1..01d2fd3 100644
--- a/pkg/dds/test/on_event_with_history_test.dart
+++ b/pkg/dds/test/on_event_with_history_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.10
-
import 'dart:async';
import 'dart:io';
@@ -14,19 +12,18 @@
import 'common/test_helper.dart';
void main() {
- Process process;
- DartDevelopmentService dds;
+ late Process process;
+ late DartDevelopmentService dds;
setUp(() async {
- process = await spawnDartProcess('on_event_with_history_script.dart',
- pauseOnStart: false);
+ process = await spawnDartProcess(
+ 'on_event_with_history_script.dart',
+ );
});
tearDown(() async {
- await dds?.shutdown();
- process?.kill();
- dds = null;
- process = null;
+ await dds.shutdown();
+ process.kill();
});
test('onEventWithHistory returns stream including log history', () async {
@@ -36,6 +33,9 @@
expect(dds.isRunning, true);
final service = await vmServiceConnectUri(dds.wsUri.toString());
+ // Wait until the test script has finished writing its initial logs.
+ await executeUntilNextPause(service);
+
await service.streamListen('Logging');
final stream = service.onLoggingEventWithHistory;
@@ -43,16 +43,15 @@
int count = 0;
stream.listen((event) {
count++;
- expect(event.logRecord.message.valueAsString, count.toString());
+ expect(event.logRecord!.message!.valueAsString, count.toString());
if (count % 10 == 0) {
completer.complete();
}
});
-
await completer.future;
completer = Completer<void>();
- final isolateId = (await service.getVM()).isolates.first.id;
+ final isolateId = (await service.getVM()).isolates!.first.id!;
await service.resume(isolateId);
await completer.future;
diff --git a/pkg/dds/test/regress_45569_test.dart b/pkg/dds/test/regress_45569_test.dart
index e5afaf1..d08c9c1 100644
--- a/pkg/dds/test/regress_45569_test.dart
+++ b/pkg/dds/test/regress_45569_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.10
-
import 'dart:io';
import 'package:dds/dds.dart';
@@ -12,8 +10,8 @@
import 'common/test_helper.dart';
void main() {
- Process process;
- DartDevelopmentService dds;
+ late Process process;
+ late DartDevelopmentService dds;
setUp(() async {
// We don't care what's actually running in the target process for this
@@ -25,10 +23,8 @@
});
tearDown(() async {
- await dds?.shutdown();
- process?.kill();
- dds = null;
- process = null;
+ await dds.shutdown();
+ process.kill();
});
test('Ensure streamListen and streamCancel calls are handled atomically',
diff --git a/pkg/dds/test/smoke.dart b/pkg/dds/test/smoke.dart
index f1f92a2..f4c4774 100644
--- a/pkg/dds/test/smoke.dart
+++ b/pkg/dds/test/smoke.dart
@@ -1,5 +1,3 @@
-// @dart=2.10
-
void main() {
print('Hello world!');
}
diff --git a/pkg/dds/test/smoke_test.dart b/pkg/dds/test/smoke_test.dart
index 2f59ef0..0f64943 100644
--- a/pkg/dds/test/smoke_test.dart
+++ b/pkg/dds/test/smoke_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.10
-
import 'dart:convert';
import 'dart:io';
@@ -15,18 +13,16 @@
void main() {
group('DDS', () {
- Process process;
- DartDevelopmentService dds;
+ late Process process;
+ late DartDevelopmentService dds;
setUp(() async {
process = await spawnDartProcess('smoke.dart');
});
tearDown(() async {
- await dds?.shutdown();
- process?.kill();
- dds = null;
- process = null;
+ await dds.shutdown();
+ process.kill();
});
void createSmokeTest(bool useAuthCodes, bool ipv6) {
@@ -43,7 +39,7 @@
expect(dds.isRunning, true);
try {
- Uri.parseIPv6Address(dds.uri.host);
+ Uri.parseIPv6Address(dds.uri!.host);
expect(ipv6, true);
} on FormatException {
expect(ipv6, false);
@@ -52,11 +48,11 @@
// Ensure basic websocket requests are forwarded correctly to the VM service.
final service = await vmServiceConnectUri(dds.wsUri.toString());
final version = await service.getVersion();
- expect(version.major > 0, true);
- expect(version.minor >= 0, true);
+ expect(version.major! > 0, true);
+ expect(version.minor! >= 0, true);
expect(
- dds.uri.pathSegments,
+ dds.uri!.pathSegments,
useAuthCodes ? isNotEmpty : isEmpty,
);
@@ -73,7 +69,7 @@
final Map<String, dynamic> jsonResponse = (await response
.transform(utf8.decoder)
.transform(json.decoder)
- .single);
+ .single) as Map<String, dynamic>;
expect(jsonResponse['result']['type'], 'Version');
expect(jsonResponse['result']['major'] > 0, true);
expect(jsonResponse['result']['minor'] >= 0, true);
@@ -87,12 +83,6 @@
});
test('Invalid args test', () async {
- // null VM Service URI
- expect(
- () async =>
- await DartDevelopmentService.startDartDevelopmentService(null),
- throwsA(TypeMatcher<ArgumentError>()));
-
// Non-HTTP VM Service URI scheme
expect(
() async => await DartDevelopmentService.startDartDevelopmentService(
diff --git a/pkg/dds/test/sse_smoke_test.dart b/pkg/dds/test/sse_smoke_test.dart
index 2b5e696..594eb97 100644
--- a/pkg/dds/test/sse_smoke_test.dart
+++ b/pkg/dds/test/sse_smoke_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.10
-
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -23,12 +21,12 @@
// environment variables.
void main() {
- Process chromeDriver;
- DartDevelopmentService dds;
- SseHandler handler;
- Process process;
- HttpServer server;
- WebDriver webdriver;
+ late Process chromeDriver;
+ late DartDevelopmentService dds;
+ late SseHandler handler;
+ Process? process;
+ late HttpServer server;
+ late WebDriver webdriver;
setUpAll(() async {
final chromedriverUri = Platform.script.resolveUri(
@@ -74,11 +72,10 @@
});
tearDown(() async {
- await dds?.shutdown();
+ await dds.shutdown();
process?.kill();
await webdriver.quit();
await server.close();
- dds = null;
process = null;
});
@@ -97,11 +94,11 @@
// Replace the sse scheme with http as sse isn't supported for CORS.
testeeConnection.sink
- .add(dds.sseUri.replace(scheme: 'http').toString());
+ .add(dds.sseUri!.replace(scheme: 'http').toString());
final response = json.decode(await testeeConnection.stream.first);
- final version = service.Version.parse(response);
- expect(version.major > 0, isTrue);
- expect(version.minor >= 0, isTrue);
+ final version = service.Version.parse(response)!;
+ expect(version.major! > 0, isTrue);
+ expect(version.minor! >= 0, isTrue);
},
);
}
diff --git a/pkg/dds/test/uri_test.dart b/pkg/dds/test/uri_test.dart
index dad20f3..522ed6d 100644
--- a/pkg/dds/test/uri_test.dart
+++ b/pkg/dds/test/uri_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.10
-
import 'dart:io';
import 'package:dds/dds.dart';
@@ -12,17 +10,15 @@
import 'common/test_helper.dart';
void main() {
- Process process;
- DartDevelopmentService dds;
+ late Process process;
+ late DartDevelopmentService dds;
setUp(() async {
process = await spawnDartProcess('smoke.dart');
});
tearDown(() async {
- await dds?.shutdown();
- process?.kill();
- dds = null;
- process = null;
+ await dds.shutdown();
+ process.kill();
});
Future<int> getAvailablePort() async {
@@ -71,8 +67,8 @@
// just make sure that it's at the right address and port.
expect(dds.uri.toString().contains(serviceUri.toString()), isTrue);
- expect(dds.uri.pathSegments, isNotEmpty);
- final authCode = dds.uri.pathSegments.first;
+ expect(dds.uri!.pathSegments, isNotEmpty);
+ final authCode = dds.uri!.pathSegments.first;
expect(
dds.sseUri,
serviceUri.replace(
diff --git a/pkg/dds/test/web/sse_smoke_driver.dart b/pkg/dds/test/web/sse_smoke_driver.dart
index f8769f5..4f0ab25 100644
--- a/pkg/dds/test/web/sse_smoke_driver.dart
+++ b/pkg/dds/test/web/sse_smoke_driver.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
-
// This file must be compiled for changes to be picked up.
//
// Run the following command from the root of this package if this file is
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart
index 3143df6d..0369d53 100644
--- a/runtime/observatory/tests/service/test_helper.dart
+++ b/runtime/observatory/tests/service/test_helper.dart
@@ -390,7 +390,7 @@
if (useDds) {
dds = await DartDevelopmentService.startDartDevelopmentService(
serverAddress);
- setupAddresses(dds.uri);
+ setupAddresses(dds.uri!);
} else {
setupAddresses(serverAddress);
}
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index eff5ead..e06b2fa 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -1653,8 +1653,7 @@
for (intptr_t i = 0; i < types.Length(); i++) {
type ^= types.At(i);
bool present = types_table.Insert(type);
- // Two recursive types with different topology (and hashes) may be equal.
- ASSERT(!present || type.IsRecursive());
+ ASSERT(!present);
}
object_store->set_canonical_types(types_table.Release());
@@ -1674,8 +1673,7 @@
for (intptr_t i = 0; i < function_types.Length(); i++) {
function_type ^= function_types.At(i);
bool present = function_types_table.Insert(function_type);
- // Two recursive types with different topology (and hashes) may be equal.
- ASSERT(!present || function_type.IsRecursive());
+ ASSERT(!present);
}
object_store->set_canonical_function_types(function_types_table.Release());
@@ -1695,8 +1693,7 @@
for (intptr_t i = 0; i < typeparams.Length(); i++) {
typeparam ^= typeparams.At(i);
bool present = typeparams_table.Insert(typeparam);
- // Two recursive types with different topology (and hashes) may be equal.
- ASSERT(!present || typeparam.IsRecursive());
+ ASSERT(!present);
}
object_store->set_canonical_type_parameters(typeparams_table.Release());
@@ -1720,8 +1717,7 @@
for (intptr_t i = 0; i < typeargs.Length(); i++) {
typearg ^= typeargs.At(i);
bool present = typeargs_table.Insert(typearg);
- // Two recursive types with different topology (and hashes) may be equal.
- ASSERT(!present || typearg.IsRecursive());
+ ASSERT(!present);
}
object_store->set_canonical_type_arguments(typeargs_table.Release());
}
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index ece6a7e..a7a04be 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -533,14 +533,8 @@
element ^= ptr;
intptr_t entry = -1;
const bool present = table.FindKeyOrDeletedOrUnused(element, &entry);
- if (!present) {
- table.InsertKey(entry, element);
- } else {
- // Two recursive types with different topology (and hashes)
- // may be equal.
- ASSERT(element.IsRecursive());
- objects_[num_occupied++] = ptr;
- }
+ ASSERT(!present);
+ table.InsertKey(entry, element);
} else {
objects_[num_occupied++] = ptr;
}
diff --git a/tools/VERSION b/tools/VERSION
index 75f577f..443649c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 146
+PRERELEASE 147
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart
index 071782f..7b9a07d 100644
--- a/tools/generate_package_config.dart
+++ b/tools/generate_package_config.dart
@@ -57,7 +57,6 @@
packageDirectory(
'runtime/observatory_2/tests/service_2/observatory_test_package_2'),
packageDirectory('sdk/lib/_internal/sdk_library_metadata'),
- packageDirectory('third_party/devtools/devtools_server'),
packageDirectory('third_party/devtools/devtools_shared'),
packageDirectory('third_party/pkg/protobuf/protobuf'),
packageDirectory('third_party/pkg/webdev/frontend_server_client'),