Version 2.11.0-223.0.dev
Merge commit 'a39f93cd4cf12b4f429ce72d83668cda264f590c' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index f280248..e08b11b 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -443,7 +443,7 @@
"name": "observatory",
"rootUri": "../runtime/observatory",
"packageUri": "lib/",
- "languageVersion": "2.2"
+ "languageVersion": "2.10"
},
{
"name": "observatory_2",
@@ -454,7 +454,7 @@
{
"name": "observatory_test_package",
"rootUri": "../runtime/observatory/tests/service/observatory_test_package",
- "languageVersion": "2.7"
+ "languageVersion": "2.10"
},
{
"name": "observatory_test_package_2",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 16ebe91..f0465af 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,7 +27,7 @@
#### Pub
-* New commands `pub add` and `pub remove` that adds and remove new dependencies
+* New commands `pub add` and `pub remove` that adds and remove new dependencies
to your `pubspec.yaml`.
* `pub publish` will check your pubspec keys for likely typos.
* `pub get` will print a warning if the resolution is mixed mode.
@@ -48,7 +48,7 @@
* Fixed `unawaited_futures` to handle `Future` subtypes.
* New lint: `avoid_type_to_string`.
-## 2.10.2 - 2020-10-13
+## 2.10.2 - 2020-10-15
This is a patch release that fixes a DDC compiler crash (issue [#43589]).
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index a7d67b8..52b7f91 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -960,6 +960,29 @@
tip: r"""Try moving the class to the top-level.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(String name)> templateClassInNullAwareReceiver =
+ const Template<Message Function(String name)>(
+ messageTemplate: r"""The class '#name' cannot be null.""",
+ tipTemplate: r"""Try replacing '?.' with '.'""",
+ withArguments: _withArgumentsClassInNullAwareReceiver);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name)> codeClassInNullAwareReceiver =
+ const Code<Message Function(String name)>(
+ "ClassInNullAwareReceiver", templateClassInNullAwareReceiver,
+ severity: Severity.warning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsClassInNullAwareReceiver(String name) {
+ if (name.isEmpty) throw 'No name provided';
+ name = demangleMixinApplicationName(name);
+ return new Message(codeClassInNullAwareReceiver,
+ message: """The class '${name}' cannot be null.""",
+ tip: """Try replacing '?.' with '.'""",
+ arguments: {'name': name});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeColonInPlaceOfIn = messageColonInPlaceOfIn;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -8846,6 +8869,16 @@
message: r"""Expected identifier, but got 'this'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeThisInNullAwareReceiver = messageThisInNullAwareReceiver;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageThisInNullAwareReceiver = const MessageCode(
+ "ThisInNullAwareReceiver",
+ severity: Severity.warning,
+ message: r"""The receiver 'this' cannot be null.""",
+ tip: r"""Try replacing '?.' with '.'""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String string)>
templateThisOrSuperAccessInFieldInitializer =
const Template<Message Function(String string)>(
diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
index a3860dc..3c280ff 100644
--- a/pkg/analysis_server/lib/src/computer/computer_highlights.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
@@ -6,6 +6,7 @@
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
/// A computer for [HighlightRegion]s in a Dart [CompilationUnit].
@@ -111,7 +112,7 @@
}
bool _addIdentifierRegion_class(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! ClassElement) {
return false;
}
@@ -133,7 +134,7 @@
}
bool _addIdentifierRegion_constructor(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! ConstructorElement) {
return false;
}
@@ -141,7 +142,7 @@
}
bool _addIdentifierRegion_dynamicType(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is VariableElement) {
var staticType = element.type;
if (staticType == null || !staticType.isDynamic) {
@@ -153,7 +154,7 @@
}
bool _addIdentifierRegion_field(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is FieldFormalParameterElement) {
element = (element as FieldFormalParameterElement).field;
}
@@ -182,7 +183,7 @@
}
bool _addIdentifierRegion_function(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! FunctionElement) {
return false;
}
@@ -196,7 +197,7 @@
}
bool _addIdentifierRegion_functionTypeAlias(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! FunctionTypeAliasElement) {
return false;
}
@@ -210,7 +211,7 @@
return false;
}
// should be property accessor
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! PropertyAccessorElement) {
return false;
}
@@ -224,7 +225,7 @@
}
bool _addIdentifierRegion_importPrefix(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! PrefixElement) {
return false;
}
@@ -240,7 +241,7 @@
}
bool _addIdentifierRegion_label(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! LabelElement) {
return false;
}
@@ -248,7 +249,7 @@
}
bool _addIdentifierRegion_localVariable(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! LocalVariableElement) {
return false;
}
@@ -263,7 +264,7 @@
}
bool _addIdentifierRegion_method(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! MethodElement) {
return false;
}
@@ -288,7 +289,7 @@
}
bool _addIdentifierRegion_parameter(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! ParameterElement) {
return false;
}
@@ -296,7 +297,7 @@
}
bool _addIdentifierRegion_typeParameter(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! TypeParameterElement) {
return false;
}
diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights2.dart b/pkg/analysis_server/lib/src/computer/computer_highlights2.dart
index 2c677c7..70489fe 100644
--- a/pkg/analysis_server/lib/src/computer/computer_highlights2.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_highlights2.dart
@@ -6,6 +6,7 @@
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
/// A computer for [HighlightRegion]s in a Dart [CompilationUnit].
@@ -114,7 +115,7 @@
}
bool _addIdentifierRegion_class(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! ClassElement) {
return false;
}
@@ -136,7 +137,7 @@
}
bool _addIdentifierRegion_constructor(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! ConstructorElement) {
return false;
}
@@ -144,7 +145,7 @@
}
bool _addIdentifierRegion_dynamicLocal(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is LocalVariableElement) {
var elementType = element.type;
if (elementType?.isDynamic == true) {
@@ -167,7 +168,7 @@
}
bool _addIdentifierRegion_field(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is FieldFormalParameterElement) {
if (node.parent is FieldFormalParameter) {
element = (element as FieldFormalParameterElement).field;
@@ -216,7 +217,7 @@
}
bool _addIdentifierRegion_function(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! FunctionElement) {
return false;
}
@@ -235,7 +236,7 @@
}
bool _addIdentifierRegion_functionTypeAlias(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! FunctionTypeAliasElement) {
return false;
}
@@ -249,7 +250,7 @@
return false;
}
// should be property accessor
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! PropertyAccessorElement) {
return false;
}
@@ -278,7 +279,7 @@
}
bool _addIdentifierRegion_importPrefix(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! PrefixElement) {
return false;
}
@@ -294,7 +295,7 @@
}
bool _addIdentifierRegion_label(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! LabelElement) {
return false;
}
@@ -302,7 +303,7 @@
}
bool _addIdentifierRegion_localVariable(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! LocalVariableElement) {
return false;
}
@@ -314,7 +315,7 @@
}
bool _addIdentifierRegion_method(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! MethodElement) {
return false;
}
@@ -339,7 +340,7 @@
}
bool _addIdentifierRegion_parameter(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! ParameterElement) {
return false;
}
@@ -350,7 +351,7 @@
}
bool _addIdentifierRegion_typeParameter(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is! TypeParameterElement) {
return false;
}
@@ -360,7 +361,7 @@
bool _addIdentifierRegion_unresolvedInstanceMemberReference(
SimpleIdentifier node) {
// unresolved
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element != null) {
return false;
}
diff --git a/pkg/analysis_server/lib/src/computer/imported_elements_computer.dart b/pkg/analysis_server/lib/src/computer/imported_elements_computer.dart
index 8d9ac7b..e30c41a 100644
--- a/pkg/analysis_server/lib/src/computer/imported_elements_computer.dart
+++ b/pkg/analysis_server/lib/src/computer/imported_elements_computer.dart
@@ -6,6 +6,7 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
/// An object used to compute the list of elements referenced within a given
/// region of a compilation unit that are imported into the compilation unit's
@@ -83,7 +84,7 @@
node.offset <= endOffset &&
node.end >= startOffset &&
!_isConstructorDeclarationReturnType(node)) {
- var nodeElement = node.staticElement;
+ var nodeElement = node.writeOrReadElement;
if (nodeElement != null &&
nodeElement.enclosingElement is CompilationUnitElement) {
var nodeLibrary = nodeElement.library;
diff --git a/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart b/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart
index f09a65d..f263e74 100644
--- a/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart
+++ b/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart
@@ -7,6 +7,7 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/element.dart';
void addDartOccurrences(OccurrencesCollector collector, CompilationUnit unit) {
@@ -25,7 +26,7 @@
@override
void visitSimpleIdentifier(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element != null) {
_addOccurrence(element, node.offset);
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
index 6f1e545..bb8262f 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
@@ -525,7 +525,7 @@
if (node.operator.end <= offset) {
// RHS
if (node.operator.type == TokenType.EQ) {
- return node.leftHandSide.staticType;
+ return node.writeType;
}
var method = node.staticElement;
if (method != null) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart b/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
index b92d1e2..66bd219 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
@@ -129,10 +129,7 @@
if (assignment.rightHandSide == expression) {
if (assignment.operator.type == TokenType.EQ) {
// v = myFunction();
- var lhs = assignment.leftHandSide;
- if (lhs != null) {
- return lhs.staticType;
- }
+ return assignment.writeType;
} else {
// v += myFunction();
var method = assignment.staticElement;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart
index 2af769a..f66b06f 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart
@@ -37,7 +37,7 @@
parent = target.parent;
}
if (parent is AssignmentExpression && target == parent.rightHandSide) {
- toType = parent.leftHandSide.staticType;
+ toType = parent.writeType;
} else if (parent is VariableDeclaration && target == parent.initializer) {
toType = parent.declaredElement.type;
} else {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart
index c66d036..7fcb556 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart
@@ -36,7 +36,7 @@
DartType toType;
var parent = target.parent;
if (parent is AssignmentExpression && target == parent.rightHandSide) {
- toType = parent.leftHandSide.staticType;
+ toType = parent.writeType;
} else if (parent is VariableDeclaration && target == parent.initializer) {
toType = parent.declaredElement.type;
} else if (parent is ArgumentList) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart b/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart
index 93e26de..a12a858 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart
@@ -35,8 +35,8 @@
importedUris.add(Uri.parse(uri));
}
}
- var matcher =
- ElementMatcher(importedUris: importedUris, name: name, kinds: _kinds);
+ var matcher = ElementMatcher(
+ importedUris: importedUris, name: name, kinds: _kindsForNode(node));
for (var set in _availableTransformSetsForLibrary(library)) {
for (var transform
in set.transformsFor(matcher, applyingBulkFixes: applyingBulkFixes)) {
@@ -45,50 +45,6 @@
}
}
- List<ElementKind> get _kinds {
- AstNode child;
- var node = this.node;
- while (node != null) {
- if (node is ConstructorName) {
- return const [ElementKind.constructorKind];
- } else if (node is ExtensionOverride) {
- return const [ElementKind.extensionKind];
- } else if (node is InstanceCreationExpression) {
- return const [ElementKind.constructorKind];
- } else if (node is MethodInvocation) {
- if (node.target == child) {
- return const [
- ElementKind.classKind,
- ElementKind.enumKind,
- ElementKind.mixinKind
- ];
- } else if (node.realTarget != null) {
- return const [ElementKind.constructorKind, ElementKind.methodKind];
- }
- return const [
- ElementKind.classKind,
- ElementKind.extensionKind,
- ElementKind.functionKind,
- ElementKind.methodKind
- ];
- } else if (node is NamedType) {
- var parent = node.parent;
- if (parent is ConstructorName && parent.name == null) {
- return const [ElementKind.classKind, ElementKind.constructorKind];
- }
- return const [
- ElementKind.classKind,
- ElementKind.enumKind,
- ElementKind.mixinKind,
- ElementKind.typedefKind
- ];
- }
- child = node;
- node = node.parent;
- }
- return null;
- }
-
/// Return the name of the element that was changed.
String get _name {
String nameFromParent(AstNode node) {
@@ -138,6 +94,63 @@
return TransformSetManager.instance.forLibrary(library);
}
+ List<ElementKind> _kindsForNode(AstNode node, {AstNode child}) {
+ if (node is ConstructorName) {
+ return const [ElementKind.constructorKind];
+ } else if (node is ExtensionOverride) {
+ return const [ElementKind.extensionKind];
+ } else if (node is InstanceCreationExpression) {
+ return const [ElementKind.constructorKind];
+ } else if (node is MethodInvocation) {
+ if (node.target == child) {
+ return const [
+ ElementKind.classKind,
+ ElementKind.enumKind,
+ ElementKind.mixinKind
+ ];
+ } else if (node.realTarget != null) {
+ return const [ElementKind.constructorKind, ElementKind.methodKind];
+ }
+ return const [
+ ElementKind.classKind,
+ ElementKind.extensionKind,
+ ElementKind.functionKind,
+ ElementKind.methodKind
+ ];
+ } else if (node is NamedType) {
+ var parent = node.parent;
+ if (parent is ConstructorName && parent.name == null) {
+ return const [ElementKind.classKind, ElementKind.constructorKind];
+ }
+ return const [
+ ElementKind.classKind,
+ ElementKind.enumKind,
+ ElementKind.mixinKind,
+ ElementKind.typedefKind
+ ];
+ } else if (node is PrefixedIdentifier) {
+ if (node.prefix == child) {
+ return const [
+ ElementKind.classKind,
+ ElementKind.enumKind,
+ ElementKind.extensionKind,
+ ElementKind.mixinKind,
+ ElementKind.typedefKind
+ ];
+ }
+ return const [
+ ElementKind.fieldKind,
+ ElementKind.getterKind,
+ ElementKind.setterKind
+ ];
+ } else if (node is PropertyAccess) {
+ return const [ElementKind.getterKind, ElementKind.setterKind];
+ } else if (node is SimpleIdentifier) {
+ return _kindsForNode(node.parent, child: node);
+ }
+ return null;
+ }
+
/// Return an instance of this class. Used as a tear-off in `FixProcessor`.
static DataDriven newInstance() => DataDriven();
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
index 21325d1..80aa9ae 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
@@ -9,6 +9,7 @@
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/source/source_range.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
import 'package:analyzer_plugin/utilities/assist/assist.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
@@ -257,7 +258,7 @@
}
}
if (node.inSetterContext()) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is PropertyAccessorElement) {
var field = element.variable;
if (field is FieldElement) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/import_add_show.dart b/pkg/analysis_server/lib/src/services/correction/dart/import_add_show.dart
index b667ed8..306312f 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/import_add_show.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/import_add_show.dart
@@ -10,6 +10,7 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer_plugin/utilities/assist/assist.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
@@ -61,7 +62,7 @@
@override
void visitSimpleIdentifier(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element != null &&
(namespace[node.name] == element ||
(node.name != element.name &&
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_field_not_final.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_field_not_final.dart
index 59e8499..b8db161 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/make_field_not_final.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/make_field_not_final.dart
@@ -7,6 +7,7 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:analyzer_plugin/utilities/range_factory.dart';
@@ -24,8 +25,8 @@
Future<void> compute(ChangeBuilder builder) async {
var node = this.node;
if (node is SimpleIdentifier &&
- node.staticElement is PropertyAccessorElement) {
- PropertyAccessorElement getter = node.staticElement;
+ node.writeOrReadElement is PropertyAccessorElement) {
+ PropertyAccessorElement getter = node.writeOrReadElement;
if (getter.isGetter &&
getter.isSynthetic &&
!getter.variable.isSynthetic &&
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart
index 790b766..156be05 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart
@@ -9,6 +9,7 @@
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/source/source_range.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:analyzer_plugin/utilities/range_factory.dart';
@@ -177,7 +178,7 @@
@override
void visitSimpleIdentifier(SimpleIdentifier node) {
- final staticElement = node.staticElement;
+ final staticElement = node.writeOrReadElement;
if (staticElement == element) {
references.add(node);
} else if (staticElement is PropertyAccessorElement) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart b/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart
index 07a33dc..2f96ebb 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart
@@ -8,6 +8,7 @@
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer_plugin/utilities/assist/assist.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
@@ -20,7 +21,7 @@
if (node is! SimpleIdentifier) {
return;
}
- var element = (node as SimpleIdentifier).staticElement;
+ var element = (node as SimpleIdentifier).writeOrReadElement;
if (element is! PropertyAccessorElement) {
return;
}
@@ -119,7 +120,7 @@
@override
void visitSimpleIdentifier(SimpleIdentifier node) {
- if (node.staticElement == setter) {
+ if (node.writeOrReadElement == setter) {
hasSetterReference = true;
}
}
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
index d626bd2..4370af4 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -23,6 +23,7 @@
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_system.dart';
import 'package:analyzer/src/dart/analysis/session_helper.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/resolver/exit_detector.dart';
import 'package:analyzer/src/generated/java_core.dart';
@@ -32,7 +33,7 @@
const String _TOKEN_SEPARATOR = '\uFFFF';
Element _getLocalElement(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is LocalVariableElement ||
element is ParameterElement ||
element is FunctionElement &&
@@ -964,7 +965,7 @@
invalidSelection('Cannot extract the name part of a declaration.');
}
// method name
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is FunctionElement || element is MethodElement) {
invalidSelection('Cannot extract a single method name.');
}
@@ -1215,7 +1216,7 @@
// add parameter
var parameter = ref._parametersMap[name];
if (parameter == null) {
- var parameterType = node.staticType;
+ var parameterType = node.writeOrReadType;
var parametersBuffer = StringBuffer();
var parameterTypeCode = ref.utils.getTypeSource(
parameterType, ref.librariesToImport,
@@ -1263,7 +1264,7 @@
@override
void visitSimpleIdentifier(SimpleIdentifier node) {
- var nodeElement = node.staticElement;
+ var nodeElement = node.writeOrReadElement;
if (identical(nodeElement, element)) {
var nodeOffset = node.offset;
if (nodeOffset > ref.selectionRange.end) {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
index 09b73f8..389b739 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
@@ -19,6 +19,7 @@
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/analysis/session_helper.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/generated/java_core.dart';
import 'package:analyzer/src/generated/source.dart' show SourceRange;
@@ -591,7 +592,7 @@
@override
void visitSimpleIdentifier(SimpleIdentifier node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element == null) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
index 74b8751..1489cd7 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
@@ -17,6 +17,7 @@
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/analysis/session_helper.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer_plugin/utilities/range_factory.dart';
@@ -322,7 +323,7 @@
}
var identifier = node as SimpleIdentifier;
// prepare selected ExecutableElement
- var element = identifier.staticElement;
+ var element = identifier.writeOrReadElement;
if (element is! ExecutableElement) {
return fatalStatus;
}
@@ -768,7 +769,7 @@
return;
}
// should be a method or field reference
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (!(element is MethodElement || element is PropertyAccessorElement)) {
return;
}
diff --git a/pkg/analysis_server/test/analysis/get_navigation_test.dart b/pkg/analysis_server/test/analysis/get_navigation_test.dart
index 4dbe557..9e2b5d6 100644
--- a/pkg/analysis_server/test/analysis/get_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/get_navigation_test.dart
@@ -190,13 +190,13 @@
Future<void> test_operator_index() async {
addTestFile('''
class A {
- A operator [](index) => null;
- operator []=(index, A value) {}
+ operator [](index) => 0;
+ operator []=(index, int value) {}
}
-main() {
- var a = new A();
- a[0] // [];
- a[1] = 1; // []=;
+
+void f(A a) {
+ a[0]; // []
+ a[1] = 1; // []=
a[2] += 2;
}
''');
@@ -207,7 +207,7 @@
assertHasOperatorRegion(search, 1, '[](index)', 2);
}
{
- var search = '] // []';
+ var search = ']; // []';
await _getNavigation(testFile, testCode.indexOf(search), 1);
assertHasOperatorRegion(search, 1, '[](index)', 2);
}
diff --git a/pkg/analysis_server/test/analysis/notification_navigation_test.dart b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
index 90b007e..5dae7245 100644
--- a/pkg/analysis_server/test/analysis/notification_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
@@ -779,6 +779,34 @@
assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length);
}
+ Future<void> test_propertyAccess_propertyName_read() async {
+ addTestFile('''
+class A {
+ var f = 0;
+}
+
+void f(A a) {
+ a.f;
+}
+''');
+ await prepareNavigation();
+ assertHasRegionTarget('f;', 'f = 0');
+ }
+
+ Future<void> test_propertyAccess_propertyName_write() async {
+ addTestFile('''
+class A {
+ var f = 0;
+}
+
+void f(A a) {
+ a.f = 1;
+}
+''');
+ await prepareNavigation();
+ assertHasRegionTarget('f = 1', 'f = 0');
+ }
+
Future<void> test_redirectingConstructorInvocation() async {
addTestFile('''
class A {
diff --git a/pkg/analysis_server/test/services/refactoring/abstract_rename.dart b/pkg/analysis_server/test/services/refactoring/abstract_rename.dart
index d1bf07c..4b0783f 100644
--- a/pkg/analysis_server/test/services/refactoring/abstract_rename.dart
+++ b/pkg/analysis_server/test/services/refactoring/abstract_rename.dart
@@ -6,6 +6,7 @@
import 'package:analysis_server/src/services/refactoring/refactoring.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
import 'package:test/test.dart';
@@ -38,7 +39,7 @@
/// the [SimpleIdentifier] at the given [search] pattern.
void createRenameRefactoringAtString(String search) {
var identifier = findIdentifier(search);
- var element = identifier.staticElement;
+ var element = identifier.writeOrReadElement;
if (element is PrefixElement) {
element = getImportElement(identifier);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart
index cf8123d..b3d8c35 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart
@@ -790,7 +790,7 @@
await assertNoFix();
}
- Future<void> test_instance_reference_deprecated() async {
+ Future<void> test_instance_reference_direct_deprecated() async {
setPackageContent('''
class C {
@deprecated
@@ -815,7 +815,7 @@
''');
}
- Future<void> test_instance_reference_removed() async {
+ Future<void> test_instance_reference_direct_removed() async {
setPackageContent('''
class C {
int get new => 1;
@@ -838,6 +838,60 @@
''');
}
+ Future<void> test_instance_reference_indirect_deprecated() async {
+ setPackageContent('''
+class C {
+ @deprecated
+ int get old => 0;
+ int get new => 1;
+}
+class D {
+ C c() => C();
+}
+''');
+ setPackageData(_rename(['C', 'old'], 'new'));
+ await resolveTestUnit('''
+import '$importUri';
+
+void f(D d) {
+ print(d.c().old);
+}
+''');
+ await assertHasFix('''
+import '$importUri';
+
+void f(D d) {
+ print(d.c().new);
+}
+''');
+ }
+
+ Future<void> test_instance_reference_indirect_removed() async {
+ setPackageContent('''
+class C {
+ int get new => 1;
+}
+class D {
+ C c() => C();
+}
+''');
+ setPackageData(_rename(['C', 'old'], 'new'));
+ await resolveTestUnit('''
+import '$importUri';
+
+void f(D d) {
+ print(d.c().old);
+}
+''');
+ await assertHasFix('''
+import '$importUri';
+
+void f(D d) {
+ print(d.c().new);
+}
+''');
+ }
+
Future<void> test_topLevel_reference_deprecated() async {
setPackageContent('''
@deprecated
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index ab4089c..aba9652 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -63,7 +63,6 @@
CompileTimeErrorCode.ABSTRACT_FIELD_CONSTRUCTOR_INITIALIZER,
CompileTimeErrorCode.ABSTRACT_FIELD_INITIALIZER,
CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE,
- CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD,
CompileTimeErrorCode.AMBIGUOUS_EXPORT,
CompileTimeErrorCode.AMBIGUOUS_EXTENSION_MEMBER_ACCESS,
CompileTimeErrorCode.AMBIGUOUS_IMPORT,
diff --git a/pkg/analyzer/lib/src/context/source.dart b/pkg/analyzer/lib/src/context/source.dart
index 74a85dc..377fe5e 100644
--- a/pkg/analyzer/lib/src/context/source.dart
+++ b/pkg/analyzer/lib/src/context/source.dart
@@ -13,6 +13,30 @@
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:analyzer/src/workspace/package_build.dart';
+/// Return `true` if the given [source] refers to a file that is assumed to be
+/// generated.
+bool isGeneratedSource(Source source) {
+ if (source == null) {
+ return false;
+ }
+ // TODO(brianwilkerson) Generalize this mechanism.
+ const List<String> suffixes = <String>[
+ '.g.dart',
+ '.pb.dart',
+ '.pbenum.dart',
+ '.pbserver.dart',
+ '.pbjson.dart',
+ '.template.dart'
+ ];
+ String fullName = source.fullName;
+ for (String suffix in suffixes) {
+ if (fullName.endsWith(suffix)) {
+ return true;
+ }
+ }
+ return false;
+}
+
/// Instances of the class `SourceFactory` resolve possibly relative URI's
/// against an existing [Source].
class SourceFactoryImpl implements SourceFactory {
diff --git a/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart b/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
index 71b4b2e2..74a6b93 100644
--- a/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
@@ -213,7 +213,7 @@
assignmentType != TokenType.QUESTION_QUESTION_EQ) {
var operatorType = operatorFromCompoundAssignment(assignmentType);
_recordClassMemberReference(
- targetType: node.leftHandSide.staticType,
+ targetType: node.readType,
name: operatorType.lexeme,
);
}
@@ -576,12 +576,12 @@
var operator = node.operator.type;
if (operator == TokenType.MINUS_MINUS) {
_recordClassMemberReference(
- targetType: node.operand.staticType,
+ targetType: node.readType,
name: '-',
);
} else if (operator == TokenType.PLUS_PLUS) {
_recordClassMemberReference(
- targetType: node.operand.staticType,
+ targetType: node.readType,
name: '+',
);
} else {
diff --git a/pkg/analyzer/lib/src/dart/analysis/index.dart b/pkg/analyzer/lib/src/dart/analysis/index.dart
index 630e395..c664f80 100644
--- a/pkg/analyzer/lib/src/dart/analysis/index.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/index.dart
@@ -7,6 +7,7 @@
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
import 'package:meta/meta.dart';
@@ -648,7 +649,7 @@
@override
void visitIndexExpression(IndexExpression node) {
- MethodElement element = node.staticElement;
+ MethodElement element = node.writeOrReadElement;
if (element is MethodElement) {
Token operator = node.leftBracket;
recordRelationToken(element, IndexRelationKind.IS_INVOKED_BY, operator);
@@ -737,7 +738,7 @@
return;
}
- Element element = node.staticElement;
+ Element element = node.writeOrReadElement;
if (node is SimpleIdentifier && element is ParameterElement) {
element = declaredParameterElement(node, element);
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index 6ea2474..a70c405 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -9,6 +9,7 @@
import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/context/source.dart';
import 'package:analyzer/src/dart/analysis/file_state.dart';
import 'package:analyzer/src/dart/analysis/testing_data.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
@@ -829,7 +830,7 @@
}
StringLiteral uriLiteral = directive.uri;
CompileTimeErrorCode errorCode = CompileTimeErrorCode.URI_DOES_NOT_EXIST;
- if (_isGenerated(source)) {
+ if (isGeneratedSource(source)) {
errorCode = CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED;
}
_getErrorReporter(file)
@@ -845,30 +846,6 @@
}
}
}
-
- /// Return `true` if the given [source] refers to a file that is assumed to be
- /// generated.
- static bool _isGenerated(Source source) {
- if (source == null) {
- return false;
- }
- // TODO(brianwilkerson) Generalize this mechanism.
- const List<String> suffixes = <String>[
- '.g.dart',
- '.pb.dart',
- '.pbenum.dart',
- '.pbserver.dart',
- '.pbjson.dart',
- '.template.dart'
- ];
- String fullName = source.fullName;
- for (String suffix in suffixes) {
- if (fullName.endsWith(suffix)) {
- return true;
- }
- }
- return false;
- }
}
/// Analysis result for single file.
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart
index a2e9ade..d1f7aa3 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -10,6 +10,7 @@
import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/dart/analysis/file_state.dart';
import 'package:analyzer/src/dart/analysis/index.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/summary/idl.dart';
@@ -621,7 +622,7 @@
if (node.staticElement == importElement.prefix) {
AstNode parent = node.parent;
if (parent is PrefixedIdentifier && parent.prefix == node) {
- var element = parent.staticElement?.declaration;
+ var element = parent.writeOrReadElement?.declaration;
if (importedElements.contains(element)) {
_addResultForPrefix(node, parent.identifier);
}
@@ -634,7 +635,7 @@
}
}
} else {
- var element = node.staticElement?.declaration;
+ var element = node.writeOrReadElement?.declaration;
if (importedElements.contains(element)) {
_addResult(node.offset, 0);
}
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index fdce821..d614322 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -691,31 +691,25 @@
/// representing the parameter to which the value of the right operand will be
/// bound. Otherwise, return `null`.
ParameterElement get _staticParameterElementForRightHandSide {
- ExecutableElement executableElement;
- if (staticElement != null) {
+ Element executableElement;
+ if (operator.type != TokenType.EQ) {
executableElement = staticElement;
} else {
- Expression left = _leftHandSide;
- if (left is Identifier) {
- Element leftElement = left.staticElement;
- if (leftElement is ExecutableElement) {
- executableElement = leftElement;
- }
- } else if (left is PropertyAccess) {
- Element leftElement = left.propertyName.staticElement;
- if (leftElement is ExecutableElement) {
- executableElement = leftElement;
- }
+ executableElement = writeElement;
+ }
+
+ if (executableElement is ExecutableElement) {
+ List<ParameterElement> parameters = executableElement.parameters;
+ if (parameters.isEmpty) {
+ return null;
}
+ if (operator.type == TokenType.EQ && leftHandSide is IndexExpression) {
+ return parameters.length == 2 ? parameters[1] : null;
+ }
+ return parameters[0];
}
- if (executableElement == null) {
- return null;
- }
- List<ParameterElement> parameters = executableElement.parameters;
- if (parameters.isEmpty) {
- return null;
- }
- return parameters[0];
+
+ return null;
}
@override
@@ -5926,14 +5920,22 @@
/// representing the parameter to which the value of the index expression will
/// be bound. Otherwise, return `null`.
ParameterElement get _staticParameterElementForIndex {
- if (staticElement == null) {
- return null;
+ Element element = staticElement;
+
+ var parent = this.parent;
+ if (parent is CompoundAssignmentExpression) {
+ var assignment = parent as CompoundAssignmentExpression;
+ element = assignment.writeElement ?? assignment.readElement;
}
- List<ParameterElement> parameters = staticElement.parameters;
- if (parameters.isEmpty) {
- return null;
+
+ if (element is ExecutableElement) {
+ List<ParameterElement> parameters = element.parameters;
+ if (parameters.isEmpty) {
+ return null;
+ }
+ return parameters[0];
}
- return parameters[0];
+ return null;
}
@override
diff --git a/pkg/analyzer/lib/src/dart/ast/element_locator.dart b/pkg/analyzer/lib/src/dart/ast/element_locator.dart
index 4d7d81d..e646c4e 100644
--- a/pkg/analyzer/lib/src/dart/ast/element_locator.dart
+++ b/pkg/analyzer/lib/src/dart/ast/element_locator.dart
@@ -5,6 +5,7 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
/// An object used to locate the [Element] associated with a given [AstNode].
class ElementLocator {
@@ -93,7 +94,7 @@
return grandParent.element;
}
}
- return node.staticElement;
+ return node.writeOrReadElement;
}
@override
diff --git a/pkg/analyzer/lib/src/dart/ast/extensions.dart b/pkg/analyzer/lib/src/dart/ast/extensions.dart
index 0c42457..b683c91 100644
--- a/pkg/analyzer/lib/src/dart/ast/extensions.dart
+++ b/pkg/analyzer/lib/src/dart/ast/extensions.dart
@@ -3,8 +3,56 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
+/// TODO(scheglov) https://github.com/dart-lang/sdk/issues/43608
+Element _writeElement(AstNode node) {
+ var parent = node.parent;
+
+ if (parent is AssignmentExpression && parent.leftHandSide == node) {
+ return parent.writeElement;
+ }
+ if (parent is PostfixExpression && parent.operand == node) {
+ return parent.writeElement;
+ }
+ if (parent is PrefixExpression && parent.operand == node) {
+ return parent.writeElement;
+ }
+
+ if (parent is PrefixedIdentifier && parent.identifier == node) {
+ return _writeElement(parent);
+ }
+ if (parent is PropertyAccess && parent.propertyName == node) {
+ return _writeElement(parent);
+ }
+ return null;
+}
+
+/// TODO(scheglov) https://github.com/dart-lang/sdk/issues/43608
+DartType _writeType(AstNode node) {
+ var parent = node.parent;
+
+ if (parent is AssignmentExpression && parent.leftHandSide == node) {
+ return parent.writeType;
+ }
+ if (parent is PostfixExpression && parent.operand == node) {
+ return parent.writeType;
+ }
+ if (parent is PrefixExpression && parent.operand == node) {
+ return parent.writeType;
+ }
+
+ if (parent is PrefixedIdentifier && parent.identifier == node) {
+ return _writeType(parent);
+ }
+ if (parent is PropertyAccess && parent.propertyName == node) {
+ return _writeType(parent);
+ }
+ return null;
+}
+
extension FormalParameterExtension on FormalParameter {
FormalParameter get notDefault {
var self = this;
@@ -23,6 +71,24 @@
}
}
+/// TODO(scheglov) https://github.com/dart-lang/sdk/issues/43608
+extension IdentifierExtension on Identifier {
+ Element get writeOrReadElement {
+ return _writeElement(this) ?? staticElement;
+ }
+
+ DartType get writeOrReadType {
+ return _writeType(this) ?? staticType;
+ }
+}
+
+/// TODO(scheglov) https://github.com/dart-lang/sdk/issues/43608
+extension IndexExpressionExtension on IndexExpression {
+ Element get writeOrReadElement {
+ return _writeElement(this) ?? staticElement;
+ }
+}
+
extension ListOfFormalParameterExtension on List<FormalParameter> {
Iterable<FormalParameterImpl> get asImpl {
return cast<FormalParameterImpl>();
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 09790fa..b94c4fa 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -1435,6 +1435,14 @@
String get identifier => '${source.uri}';
@override
+ bool get isSynthetic {
+ if (linkedContext != null) {
+ return linkedContext.isSynthetic;
+ }
+ return super.isSynthetic;
+ }
+
+ @override
ElementKind get kind => ElementKind.COMPILATION_UNIT;
@override
diff --git a/pkg/analyzer/lib/src/dart/element/scope.dart b/pkg/analyzer/lib/src/dart/element/scope.dart
index d04ddfa..2bcc9f2 100644
--- a/pkg/analyzer/lib/src/dart/element/scope.dart
+++ b/pkg/analyzer/lib/src/dart/element/scope.dart
@@ -4,6 +4,7 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/scope.dart';
+import 'package:analyzer/src/context/source.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/resolver/scope.dart' as impl;
import 'package:meta/meta.dart';
@@ -148,6 +149,15 @@
}
}
}
+
+ if (name.startsWith(r'_$')) {
+ for (var partElement in _element.parts) {
+ if (partElement.isSynthetic &&
+ isGeneratedSource(partElement.source)) {
+ return true;
+ }
+ }
+ }
}
return false;
diff --git a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
index c61b3c9..32a7b18 100644
--- a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
@@ -10,6 +10,7 @@
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/context/builder.dart';
+import 'package:analyzer/src/context/source.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/constant/compute.dart';
@@ -789,7 +790,7 @@
}
StringLiteral uriLiteral = directive.uri;
CompileTimeErrorCode errorCode = CompileTimeErrorCode.URI_DOES_NOT_EXIST;
- if (_isGenerated(source)) {
+ if (isGeneratedSource(source)) {
errorCode = CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED;
}
_getErrorReporter(file)
@@ -805,30 +806,6 @@
}
}
}
-
- /// Return `true` if the given [source] refers to a file that is assumed to be
- /// generated.
- static bool _isGenerated(Source source) {
- if (source == null) {
- return false;
- }
- // TODO(brianwilkerson) Generalize this mechanism.
- const List<String> suffixes = <String>[
- '.g.dart',
- '.pb.dart',
- '.pbenum.dart',
- '.pbserver.dart',
- '.pbjson.dart',
- '.template.dart'
- ];
- String fullName = source.fullName;
- for (String suffix in suffixes) {
- if (fullName.endsWith(suffix)) {
- return true;
- }
- }
- return false;
- }
}
/// Analysis result for single file.
diff --git a/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
index c3c161a..34ab569 100644
--- a/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
@@ -205,7 +205,7 @@
void _resolve2(PrefixExpressionImpl node) {
TokenType operator = node.operator.type;
- if (identical(node.operand.staticType, NeverTypeImpl.instance)) {
+ if (identical(node.readType, NeverTypeImpl.instance)) {
_recordStaticType(node, NeverTypeImpl.instance);
} else {
// The other cases are equivalent to invoking a method.
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index 7b3407fd..b3f890b 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -13,6 +13,7 @@
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_provider.dart';
import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/extensions.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
@@ -902,7 +903,7 @@
parent is HideCombinator) {
return;
}
- _checkForDeprecatedMemberUse(identifier.staticElement, identifier);
+ _checkForDeprecatedMemberUse(identifier.writeOrReadElement, identifier);
}
/// Check for the passed binary expression for the
@@ -1848,7 +1849,7 @@
var element = grandparent is ConstructorName
? grandparent.staticElement
- : identifier.staticElement;
+ : identifier.writeOrReadElement;
if (element == null || _inCurrentLibrary(element)) {
return;
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 1832823..3ec551f 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -80,16 +80,6 @@
hasPublishedDocs: true);
/**
- * Enum proposal: It is also a compile-time error to explicitly instantiate an
- * enum via 'new' or 'const' or to access its private fields.
- */
- static const CompileTimeErrorCode ACCESS_PRIVATE_ENUM_FIELD =
- CompileTimeErrorCode(
- 'ACCESS_PRIVATE_ENUM_FIELD',
- "The private fields of an enum can't be accessed, even within the "
- "same library.");
-
- /**
* 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported
* by a library <i>L</i> and <i>N</i> is introduced into the export namespace
* of <i>L</i> by more than one export, unless each all exports refer to same
diff --git a/pkg/analyzer/lib/src/error/imports_verifier.dart b/pkg/analyzer/lib/src/error/imports_verifier.dart
index 6c16e25..674e4f5 100644
--- a/pkg/analyzer/lib/src/error/imports_verifier.dart
+++ b/pkg/analyzer/lib/src/error/imports_verifier.dart
@@ -19,6 +19,12 @@
GatherUsedImportedElementsVisitor(this.library);
@override
+ visitAssignmentExpression(AssignmentExpression node) {
+ _recordAssignmentTarget(node, node.leftHandSide);
+ return super.visitAssignmentExpression(node);
+ }
+
+ @override
void visitBinaryExpression(BinaryExpression node) {
_recordIfExtensionMember(node.staticElement);
return super.visitBinaryExpression(node);
@@ -52,7 +58,14 @@
}
@override
+ visitPostfixExpression(PostfixExpression node) {
+ _recordAssignmentTarget(node, node.operand);
+ return super.visitPostfixExpression(node);
+ }
+
+ @override
void visitPrefixExpression(PrefixExpression node) {
+ _recordAssignmentTarget(node, node.operand);
_recordIfExtensionMember(node.staticElement);
return super.visitPrefixExpression(node);
}
@@ -62,6 +75,22 @@
_visitIdentifier(node, node.staticElement);
}
+ void _recordAssignmentTarget(
+ CompoundAssignmentExpression node,
+ Expression target,
+ ) {
+ if (target is PrefixedIdentifier) {
+ _visitIdentifier(target.identifier, node.readElement);
+ _visitIdentifier(target.identifier, node.writeElement);
+ } else if (target is PropertyAccess) {
+ _visitIdentifier(target.propertyName, node.readElement);
+ _visitIdentifier(target.propertyName, node.writeElement);
+ } else if (target is SimpleIdentifier) {
+ _visitIdentifier(target, node.readElement);
+ _visitIdentifier(target, node.writeElement);
+ }
+ }
+
void _recordIfExtensionMember(Element element) {
if (element != null && element.enclosingElement is ExtensionElement) {
_recordUsedExtension(element.enclosingElement);
diff --git a/pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart b/pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart
index fd25c70..ad20eab 100644
--- a/pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart
+++ b/pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart
@@ -10,6 +10,7 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/dart/element/member.dart' show ExecutableMember;
import 'package:analyzer/src/error/codes.dart';
@@ -90,7 +91,7 @@
@override
void visitIndexExpression(IndexExpression node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
usedElements.members.add(element);
super.visitIndexExpression(node);
}
@@ -140,7 +141,7 @@
if (_inCommentReference(node)) {
return;
}
- Element element = node.staticElement;
+ Element element = node.writeOrReadElement;
// Store un-parameterized members.
if (element is ExecutableMember) {
element = element.declaration;
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index dfc4756..6badff5 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -1513,7 +1513,7 @@
/// Check the given node to see whether it was ambiguous because the name was
/// imported from two or more imports.
void _checkForAmbiguousImport(SimpleIdentifier node) {
- Element element = node.staticElement;
+ Element element = node.writeOrReadElement;
if (element is MultiplyDefinedElementImpl) {
String name = element.displayName;
List<Element> conflictingMembers = element.conflictingElements;
@@ -2802,7 +2802,7 @@
return;
}
// prepare element
- Element element = identifier.staticElement;
+ Element element = identifier.writeOrReadElement;
if (!(element is MethodElement || element is PropertyAccessorElement)) {
return;
}
@@ -2895,7 +2895,7 @@
return;
}
// prepare member Element
- Element element = name.staticElement;
+ Element element = name.writeOrReadElement;
if (element is ExecutableElement) {
if (!element.isStatic) {
// OK, instance member
@@ -4490,7 +4490,7 @@
/// [CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER].
void _checkForUnqualifiedReferenceToNonLocalStaticMember(
SimpleIdentifier name) {
- Element element = name.staticElement;
+ Element element = name.writeOrReadElement;
if (element == null || element is TypeParameterElement) {
return;
}
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index a744bab4..fa3349b 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -13,6 +13,7 @@
import 'package:analyzer/dart/element/type_provider.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/dart/element/type.dart';
@@ -346,7 +347,7 @@
@override
void visitIndexExpression(IndexExpression node) {
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
if (element is MethodElement) {
var type = element.type;
// Analyzer should enforce number of parameter types, but check in
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 1e9056d..d1ca7a3 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -458,7 +458,6 @@
await resolveTestCode(code);
assertType(findElement.localVar('v').type, 'int');
assertTypeNull(findNode.simple('v; // declare'));
- assertType(findNode.simple('v = null;'), 'int');
assertType(findNode.simple('v; // return'), 'int');
}
diff --git a/pkg/analyzer/test/generated/resolver_test_case.dart b/pkg/analyzer/test/generated/resolver_test_case.dart
index 63b003e..050de16 100644
--- a/pkg/analyzer/test/generated/resolver_test_case.dart
+++ b/pkg/analyzer/test/generated/resolver_test_case.dart
@@ -130,6 +130,10 @@
if (targetType == null || targetType.isDynamic) {
return;
}
+ AstNode parent = node.parent;
+ if (parent is AssignmentExpression && parent.leftHandSide == node) {
+ return;
+ }
_checkResolved(node, node.staticElement, (node) => node is MethodElement);
}
@@ -199,6 +203,10 @@
if (targetType == null || targetType.isDynamic) {
return;
}
+ AstNode parent = node.parent;
+ if (parent is AssignmentExpression && parent.leftHandSide == node) {
+ return;
+ }
node.propertyName.accept(this);
}
@@ -213,6 +221,9 @@
return;
}
AstNode parent = node.parent;
+ if (parent is AssignmentExpression && parent.leftHandSide == node) {
+ return;
+ }
if (parent is MethodInvocation) {
MethodInvocation invocation = parent;
if (identical(invocation.methodName, node)) {
diff --git a/pkg/analyzer/test/generated/simple_resolver_test.dart b/pkg/analyzer/test/generated/simple_resolver_test.dart
index 147d0ebd..c26ac85 100644
--- a/pkg/analyzer/test/generated/simple_resolver_test.dart
+++ b/pkg/analyzer/test/generated/simple_resolver_test.dart
@@ -1098,28 +1098,6 @@
verifyTestResolved();
}
- test_setter_fromMixins_property_access() async {
- await assertNoErrorsInCode('''
-class B {}
-class M1 {
- set x(value) {}
-}
-class M2 {
- set x(value) {}
-}
-class C extends B with M1, M2 {}
-void main() {
- new C().x = 1;
-}
-''');
- verifyTestResolved();
-
- expect(
- findNode.simple('x = ').staticElement,
- findElement.setter('x', of: 'M2'),
- );
- }
-
test_setter_static() async {
await assertNoErrorsInCode(r'''
set s(x) {
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index 7f232fc..90c2bb1 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -4039,7 +4039,11 @@
v = 3;
v; // marker
}''');
- assertTypeDynamic(findNode.simple('v ='));
+ if (hasAssignmentLeftResolution) {
+ assertTypeDynamic(findNode.simple('v ='));
+ } else {
+ assertTypeNull(findNode.simple('v ='));
+ }
assertTypeDynamic(findNode.simple('v; // marker'));
}
diff --git a/pkg/analyzer/test/id_tests/type_promotion_test.dart b/pkg/analyzer/test/id_tests/type_promotion_test.dart
index 692be35..54d8d09 100644
--- a/pkg/analyzer/test/id_tests/type_promotion_test.dart
+++ b/pkg/analyzer/test/id_tests/type_promotion_test.dart
@@ -52,9 +52,9 @@
@override
DartType computeNodeValue(Id id, AstNode node) {
if (node is SimpleIdentifier && node.inGetterContext()) {
- var element = node.staticElement;
+ var element = _readElement(node);
if (element is LocalVariableElement || element is ParameterElement) {
- TypeImpl promotedType = node.staticType;
+ TypeImpl promotedType = _readType(node);
TypeImpl declaredType = (element as VariableElement).type;
var isPromoted = promotedType != declaredType;
if (isPromoted) {
@@ -64,6 +64,32 @@
}
return null;
}
+
+ static Element _readElement(SimpleIdentifier node) {
+ var parent = node.parent;
+ if (parent is AssignmentExpression && parent.leftHandSide == node) {
+ return parent.readElement;
+ } else if (parent is PostfixExpression) {
+ return parent.readElement;
+ } else if (parent is PrefixExpression) {
+ return parent.readElement;
+ } else {
+ return node.staticElement;
+ }
+ }
+
+ static DartType _readType(SimpleIdentifier node) {
+ var parent = node.parent;
+ if (parent is AssignmentExpression && parent.leftHandSide == node) {
+ return parent.readType;
+ } else if (parent is PostfixExpression) {
+ return parent.readType;
+ } else if (parent is PrefixExpression) {
+ return parent.readType;
+ } else {
+ return node.staticType;
+ }
+ }
}
class _TypePromotionDataInterpreter implements DataInterpreter<DartType> {
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
index 0476a9b..c32e960 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
@@ -1517,14 +1517,24 @@
{
var prefixed = findNode.prefixed('a.v = 1;');
- assertElement(prefixed, v.setter);
- assertType(prefixed, 'int');
+ if (hasAssignmentLeftResolution) {
+ assertElement(prefixed, v.setter);
+ assertType(prefixed, 'int');
+ } else {
+ assertElementNull(prefixed);
+ assertTypeNull(prefixed);
+ }
assertElement(prefixed.prefix, import.prefix);
assertType(prefixed.prefix, null);
- assertElement(prefixed.identifier, v.setter);
- assertType(prefixed.identifier, 'int');
+ if (hasAssignmentLeftResolution) {
+ assertElement(prefixed.identifier, v.setter);
+ assertType(prefixed.identifier, 'int');
+ } else {
+ assertElementNull(prefixed.identifier);
+ assertTypeNull(prefixed.identifier);
+ }
}
}
@@ -1755,8 +1765,13 @@
{
var fRef = findNode.simple('f = 1;');
- assertMember(fRef, findElement.setter('f'), {'T': 'int'});
- assertType(fRef, 'int');
+ if (hasAssignmentLeftResolution) {
+ assertMember(fRef, findElement.setter('f'), {'T': 'int'});
+ assertType(fRef, 'int');
+ } else {
+ assertElementNull(fRef);
+ assertTypeNull(fRef);
+ }
}
}
@@ -5958,8 +5973,13 @@
await resolveTestFile();
var xRef = findNode.simple('x ++');
- assertType(xRef, 'int');
- assertElement(xRef, findElement.parameter('x'));
+ if (hasAssignmentLeftResolution) {
+ assertElement(xRef, findElement.parameter('x'));
+ assertType(xRef, 'int');
+ } else {
+ // assertElementNull(xRef);
+ assertTypeNull(xRef);
+ }
}
test_postfixExpression_local() async {
@@ -5991,8 +6011,13 @@
expect(postfix.staticType, typeProvider.intType);
SimpleIdentifier operand = postfix.operand;
- expect(operand.staticElement, same(v));
- expect(operand.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(operand.staticElement, same(v));
+ expect(operand.staticType, typeProvider.intType);
+ } else {
+ // expect(operand.staticElement, same(v));
+ expect(operand.staticType, isNull);
+ }
}
}
@@ -6025,11 +6050,20 @@
expect(postfix.staticType, typeProvider.intType);
PropertyAccess propertyAccess = postfix.operand;
- expect(propertyAccess.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(propertyAccess.staticType, typeProvider.intType);
+ } else {
+ assertTypeNull(propertyAccess);
+ }
SimpleIdentifier propertyName = propertyAccess.propertyName;
- expect(propertyName.staticElement, same(fElement.setter));
- expect(propertyName.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(propertyName.staticElement, same(fElement.setter));
+ expect(propertyName.staticType, typeProvider.intType);
+ } else {
+ assertElementNull(propertyName);
+ assertTypeNull(propertyName);
+ }
}
}
@@ -6055,8 +6089,13 @@
await resolveTestFile();
var xRef = findNode.simple('x++');
- assertType(xRef, 'int');
- assertElement(xRef, findElement.parameter('x'));
+ if (hasAssignmentLeftResolution) {
+ assertElement(xRef, findElement.parameter('x'));
+ assertType(xRef, 'int');
+ } else {
+ // assertElementNull(xRef);
+ assertTypeNull(xRef);
+ }
}
test_prefix_increment_of_prefix_increment() async {
@@ -6068,8 +6107,13 @@
await resolveTestFile();
var xRef = findNode.simple('x;');
- assertType(xRef, 'int');
- assertElement(xRef, findElement.parameter('x'));
+ if (hasAssignmentLeftResolution) {
+ assertElement(xRef, findElement.parameter('x'));
+ assertType(xRef, 'int');
+ } else {
+ // assertElementNull(xRef);
+ assertTypeNull(xRef);
+ }
}
test_prefixedIdentifier_classInstance_instanceField() async {
@@ -6254,8 +6298,13 @@
PrefixedIdentifier left = assignment.leftHandSide;
assertPrefix(left.prefix);
- expect(left.identifier.staticElement, same(mySetter));
- expect(left.identifier.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(left.identifier.staticElement, same(mySetter));
+ expect(left.identifier.staticType, typeProvider.intType);
+ } else {
+ assertElementNull(left.identifier);
+ assertTypeNull(left.identifier);
+ }
}
}
@@ -6289,8 +6338,13 @@
expect(prefix.staticType, typeProvider.intType);
SimpleIdentifier operand = prefix.operand;
- expect(operand.staticElement, same(v));
- expect(operand.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(operand.staticElement, same(v));
+ expect(operand.staticType, typeProvider.intType);
+ } else {
+ // assertElementNull(operand);
+ assertTypeNull(operand);
+ }
}
{
@@ -6371,11 +6425,20 @@
expect(prefix.staticType, typeProvider.intType);
PropertyAccess propertyAccess = prefix.operand;
- expect(propertyAccess.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(propertyAccess.staticType, typeProvider.intType);
+ } else {
+ assertTypeNull(propertyAccess);
+ }
SimpleIdentifier propertyName = propertyAccess.propertyName;
- expect(propertyName.staticElement, same(fElement.setter));
- expect(propertyName.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(propertyName.staticElement, same(fElement.setter));
+ expect(propertyName.staticType, typeProvider.intType);
+ } else {
+ assertElementNull(propertyName.staticElement);
+ assertTypeNull(propertyName);
+ }
}
{
@@ -6657,8 +6720,13 @@
AssignmentExpression assignment = statement.expression;
SimpleIdentifier identifier = assignment.leftHandSide;
- expect(identifier.staticElement, same(setterElement));
- expect(identifier.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(identifier.staticElement, same(setterElement));
+ expect(identifier.staticType, typeProvider.intType);
+ } else {
+ assertElementNull(identifier);
+ assertTypeNull(identifier);
+ }
}
// this.setter = 4;
@@ -6672,8 +6740,13 @@
expect(
target.staticType, interfaceTypeStar(bNode.declaredElement)); // raw
- expect(propertyAccess.propertyName.staticElement, same(setterElement));
- expect(propertyAccess.propertyName.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(propertyAccess.propertyName.staticElement, same(setterElement));
+ expect(propertyAccess.propertyName.staticType, typeProvider.intType);
+ } else {
+ assertElementNull(propertyAccess.propertyName);
+ assertTypeNull(propertyAccess.propertyName);
+ }
}
// super + 5;
@@ -6774,8 +6847,13 @@
AssignmentExpression assignment = statement.expression;
SimpleIdentifier identifier = assignment.leftHandSide;
- expect(identifier.staticElement, same(setterElement));
- expect(identifier.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(identifier.staticElement, same(setterElement));
+ expect(identifier.staticType, typeProvider.intType);
+ } else {
+ assertElementNull(identifier);
+ assertTypeNull(identifier);
+ }
}
// this.setter = 4;
@@ -6788,8 +6866,13 @@
ThisExpression target = propertyAccess.target;
expect(target.staticType, thisTypeA); // raw
- expect(propertyAccess.propertyName.staticElement, same(setterElement));
- expect(propertyAccess.propertyName.staticType, typeProvider.intType);
+ if (hasAssignmentLeftResolution) {
+ expect(propertyAccess.propertyName.staticElement, same(setterElement));
+ expect(propertyAccess.propertyName.staticType, typeProvider.intType);
+ } else {
+ assertElementNull(propertyAccess.propertyName);
+ assertTypeNull(propertyAccess.propertyName);
+ }
}
// this + 5;
@@ -8204,8 +8287,13 @@
assertTypeDynamic(postfix);
SimpleIdentifier aRef = postfix.operand;
- assertElementNull(aRef);
- assertTypeDynamic(aRef);
+ if (hasAssignmentLeftResolution) {
+ assertElementNull(aRef);
+ assertTypeDynamic(aRef);
+ } else {
+ assertElementNull(aRef);
+ assertTypeNull(aRef);
+ }
}
test_unresolved_postfix_operator() async {
@@ -8224,8 +8312,13 @@
assertType(postfix, 'A');
SimpleIdentifier aRef = postfix.operand;
- assertElement(aRef, findElement.topSet('a'));
- assertType(aRef, 'A');
+ if (hasAssignmentLeftResolution) {
+ assertElement(aRef, findElement.topSet('a'));
+ assertType(aRef, 'A');
+ } else {
+ assertElementNull(aRef);
+ assertTypeNull(aRef);
+ }
}
test_unresolved_prefix_operand() async {
@@ -8242,8 +8335,13 @@
assertTypeDynamic(prefix);
SimpleIdentifier aRef = prefix.operand;
- assertElementNull(aRef);
- assertTypeDynamic(aRef);
+ if (hasAssignmentLeftResolution) {
+ assertElementNull(aRef);
+ assertTypeDynamic(aRef);
+ } else {
+ assertElementNull(aRef);
+ assertTypeNull(aRef);
+ }
}
test_unresolved_prefix_operator() async {
@@ -8262,8 +8360,13 @@
assertTypeDynamic(prefix);
SimpleIdentifier aRef = prefix.operand;
- assertElement(aRef, findElement.topSet('a'));
- assertType(aRef, 'A');
+ if (hasAssignmentLeftResolution) {
+ assertElement(aRef, findElement.topSet('a'));
+ assertType(aRef, 'A');
+ } else {
+ assertElementNull(aRef);
+ assertTypeNull(aRef);
+ }
}
test_unresolved_prefixedIdentifier_identifier() async {
diff --git a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
index 3c5983e..d07c1ac 100644
--- a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
@@ -634,7 +634,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: matcherC,
@@ -666,7 +666,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.class_('C'),
@@ -715,7 +715,7 @@
);
var prefixed = assignment.leftHandSide as PrefixedIdentifier;
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
prefixed.identifier,
readElement: findElement.getter('x'),
writeElement: findElement.setter('x'),
@@ -748,7 +748,7 @@
);
var prefixed = assignment.leftHandSide as PrefixedIdentifier;
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
prefixed.identifier,
readElement: null,
writeElement: findElement.setter('x'),
@@ -783,7 +783,7 @@
);
var prefixed = assignment.leftHandSide as PrefixedIdentifier;
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
prefixed.identifier,
readElement: null,
writeElement: findElement.getter('x'),
@@ -816,7 +816,7 @@
);
var prefixed = assignment.leftHandSide as PrefixedIdentifier;
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
prefixed.identifier,
readElement: null,
writeElement: findElement.setter('x'),
@@ -851,7 +851,7 @@
);
var prefixed = assignment.leftHandSide as PrefixedIdentifier;
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
prefixed.identifier,
readElement: null,
writeElement: findElement.getter('x'),
@@ -893,7 +893,7 @@
var prefixed = assignment.leftHandSide as PrefixedIdentifier;
assertImportPrefix(prefixed.prefix, importFind.prefix);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
prefixed.identifier,
readElement: importFind.topGet('x'),
writeElement: importFind.topSet('x'),
@@ -973,7 +973,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
findNode.simple('b +='),
readElement: null,
writeElement: null,
@@ -1015,7 +1015,7 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
propertyAccess.propertyName,
readElement: findElement.getter('x'),
writeElement: findElement.setter('x'),
@@ -1026,35 +1026,31 @@
}
test_propertyAccess_forwardingStub() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
class A {
- int f;
+ int x = 0;
}
abstract class I<T> {
- T f;
+ T x = throw 0;
}
class B extends A implements I<int> {}
main() {
- new B().f = 1;
+ new B().x = 1;
}
''');
- var assignment = findNode.assignment('f = 1');
- assertElementNull(assignment);
- assertType(assignment, 'int');
- PropertyAccess left = assignment.leftHandSide;
- assertType(left, 'int');
+ var assignment = findNode.assignment('x = 1');
+ assertAssignment(
+ assignment,
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('x', of: 'A'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
- InstanceCreationExpression creation = left.target;
- assertElement(creation, findElement.unnamedConstructor('B'));
- assertType(creation, 'B');
-
- var fRef = left.propertyName;
- assertElement(fRef, findElement.setter('f', of: 'A'));
- assertType(fRef, 'int');
-
- var right = assignment.rightHandSide;
- assertType(right, 'int');
+ assertType(assignment.rightHandSide, 'int');
}
test_propertyAccess_instance_compound() async {
@@ -1084,7 +1080,7 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
propertyAccess.propertyName,
readElement: findElement.getter('x'),
writeElement: findElement.setter('x'),
@@ -1154,7 +1150,7 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
propertyAccess.propertyName,
readElement: null,
writeElement: findElement.setter('x'),
@@ -1197,7 +1193,7 @@
var propertyAccess = assignment.leftHandSide as PropertyAccess;
assertSuperExpression(propertyAccess.target);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
propertyAccess.propertyName,
readElement: findElement.getter('x', of: 'A'),
writeElement: findElement.setter('x', of: 'A'),
@@ -1234,7 +1230,7 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
propertyAccess.propertyName,
readElement: findElement.getter('x'),
writeElement: findElement.setter('x'),
@@ -1350,7 +1346,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.setter('x'),
@@ -1382,7 +1378,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.setter('x'),
@@ -1416,7 +1412,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.getter('x'),
@@ -1450,7 +1446,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.getter('x'),
@@ -1482,7 +1478,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.topGet('x'),
@@ -1521,7 +1517,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.prefix('x'),
@@ -1551,7 +1547,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.prefix('x'),
@@ -1584,7 +1580,7 @@
type: 'num', // num + int = num
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: findElement.localVar('x'),
writeElement: findElement.localVar('x'),
@@ -1707,7 +1703,7 @@
type: 'num',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: findElement.parameter('x'),
writeElement: findElement.parameter('x'),
@@ -1743,7 +1739,7 @@
type: 'A',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: findElement.parameter('x'),
writeElement: findElement.parameter('x'),
@@ -1775,7 +1771,7 @@
type: 'num',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: findElement.parameter('a'),
writeElement: findElement.parameter('a'),
@@ -1979,7 +1975,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.getter('x', of: 'B'),
@@ -2016,7 +2012,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.method('x', of: 'B'),
@@ -2048,7 +2044,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.setter('x'),
@@ -2119,7 +2115,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.setter('x', of: 'A'),
@@ -2155,7 +2151,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: findElement.getter('x'),
writeElement: findElement.setter('x'),
@@ -2198,7 +2194,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: findElement.getter('x', of: 'M2'),
writeElement: findElement.setter('x', of: 'M2'),
@@ -2237,7 +2233,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.topGet('x'),
@@ -2271,7 +2267,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: findElement.topGet('x'),
writeElement: findElement.topSet('x'),
@@ -2309,7 +2305,7 @@
type: 'A',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: findElement.topGet('x'),
writeElement: findElement.topSet('x'),
@@ -2345,7 +2341,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: findElement.topGet('x'),
writeElement: findElement.topSet('x'),
@@ -2375,7 +2371,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.topSet('x'),
@@ -2407,7 +2403,7 @@
type: 'bool',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.topSet('x'),
@@ -2439,7 +2435,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: findElement.topGet('x'),
@@ -2469,7 +2465,7 @@
type: 'dynamic',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: intElement,
@@ -2499,7 +2495,7 @@
type: 'int',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: intElement,
@@ -2529,7 +2525,7 @@
type: 'dynamic',
);
- assertSimpleIdentifier(
+ assertSimpleIdentifierAssignmentTarget(
assignment.leftHandSide,
readElement: null,
writeElement: null,
diff --git a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
index 6c9b81a..f0ee58d 100644
--- a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
@@ -1011,8 +1011,15 @@
c[2] = 1;
}
''');
- var index = findNode.index('c[2]');
- assertElement(index, findElement.method('[]=', of: 'C'));
+ assertAssignment(
+ findNode.assignment('[2] ='),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.method('[]=', of: 'C'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_operator_indexEquals_fromExtension_functionType() async {
@@ -1024,8 +1031,15 @@
f[2] = 3;
}
''');
- var index = findNode.index('f[2]');
- assertElement(index, findElement.method('[]=', of: 'E'));
+ assertAssignment(
+ findNode.assignment('f[2]'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.method('[]=', of: 'E'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_operator_indexEquals_fromExtension_interfaceType() async {
@@ -1038,8 +1052,15 @@
c[2] = 3;
}
''');
- var index = findNode.index('c[2]');
- assertElement(index, findElement.method('[]=', of: 'E'));
+ assertAssignment(
+ findNode.assignment('c[2]'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.method('[]=', of: 'E'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_operator_postfix_fromExtendedType() async {
@@ -1180,8 +1201,15 @@
f.a = 1;
}
''');
- var access = findNode.prefixed('f.a');
- assertElement(access, findElement.setter('a'));
+ assertAssignment(
+ findNode.assignment('a = 1'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('a'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_setter_oneMatch() async {
@@ -1196,8 +1224,15 @@
c.a = 1;
}
''');
- var access = findNode.prefixed('c.a');
- assertElement(access, findElement.setter('a'));
+ assertAssignment(
+ findNode.assignment('a = 1'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('a'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_tearoff_fromExtension_functionType() async {
@@ -1356,9 +1391,16 @@
p.E.a = 3;
}
''');
- var identifier = findNode.simple('a =');
- var import = findElement.importFind('package:test/lib.dart');
- assertElement(identifier, import.extension_('E').getSetter('a'));
+ var importFind = findElement.importFind('package:test/lib.dart');
+ assertAssignment(
+ findNode.assignment('a = 3'),
+ readElement: null,
+ readType: null,
+ writeElement: importFind.setter('a'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_static_setter_local() async {
@@ -1373,8 +1415,15 @@
E.a = 3;
}
''');
- var identifier = findNode.simple('a =');
- assertElement(identifier, findElement.setter('a'));
+ assertAssignment(
+ findNode.assignment('a = 3'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('a'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_static_tearoff() async {
@@ -1662,8 +1711,15 @@
a.foo = 1;
}
''');
- var access = findNode.prefixed('a.foo');
- assertElement(access, findElement.setter('foo'));
+ assertAssignment(
+ findNode.assignment('foo = 1'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('foo'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_setter_fromInstance_nullAware() async {
@@ -1676,8 +1732,15 @@
a?.foo = 1;
}
''');
- var access = findNode.propertyAccess('a?.foo');
- assertElement(access, findElement.setter('foo'));
+ assertAssignment(
+ findNode.assignment('foo = 1'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('foo'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int?',
+ );
}
}
@@ -1848,8 +1911,15 @@
void b() { this[2] = 1; }
}
''');
- var index = findNode.index('this[2]');
- assertElement(index, findElement.method('[]=', of: 'C'));
+ assertAssignment(
+ findNode.assignment('this[2]'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.method('[]=', of: 'C'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_operator_indexEquals_fromThis_fromExtension() async {
@@ -1860,8 +1930,15 @@
void b() { this[2] = 3; }
}
''');
- var index = findNode.index('this[2]');
- assertElement(index, findElement.method('[]=', of: 'E'));
+ assertAssignment(
+ findNode.assignment('this[2]'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.method('[]=', of: 'E'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_operator_unary_fromThis_fromExtendedType() async {
@@ -1893,35 +1970,49 @@
test_instance_setter_fromInstance() async {
await assertNoErrorsInCode('''
class C {
- set a(int) {}
+ set a(int _) {}
}
extension E on C {
- set a(int) {}
+ set a(int _) {}
void m() {
a = 3;
}
}
''');
- var identifier = findNode.simple('a =');
- assertElement(identifier, findElement.setter('a', of: 'E'));
+ assertAssignment(
+ findNode.assignment('a = 3'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('a', of: 'E'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_setter_fromThis_fromExtendedType() async {
await assertNoErrorsInCode('''
class C {
- set a(int) {}
+ set a(int _) {}
}
extension E on C {
- set a(int) {}
+ set a(int _) {}
void m() {
this.a = 3;
}
}
''');
- var access = findNode.propertyAccess('this.a');
- assertElement(access, findElement.setter('a', of: 'C'));
+ assertAssignment(
+ findNode.assignment('a = 3'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('a', of: 'C'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_setter_fromThis_fromExtension() async {
@@ -1929,14 +2020,21 @@
class C {}
extension E on C {
- set a(int) {}
+ set a(int _) {}
void m() {
this.a = 3;
}
}
''');
- var access = findNode.propertyAccess('this.a');
- assertElement(access, findElement.setter('a', of: 'E'));
+ assertAssignment(
+ findNode.assignment('a = 3'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('a', of: 'E'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_instance_tearoff_fromInstance() async {
@@ -2060,8 +2158,15 @@
}
}
''');
- var identifier = findNode.simple('a =');
- assertElement(identifier, findElement.setter('a'));
+ assertAssignment(
+ findNode.assignment('a = 3'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('a'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_static_setter_fromStatic() async {
@@ -2075,8 +2180,15 @@
}
}
''');
- var identifier = findNode.simple('a =');
- assertElement(identifier, findElement.setter('a'));
+ assertAssignment(
+ findNode.assignment('a = 3'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('a'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_static_tearoff_fromInstance() async {
@@ -2197,8 +2309,15 @@
}
}
''');
- var identifier = findNode.simple('a = 0;');
- assertElement(identifier, findElement.topSet('a'));
+ assertAssignment(
+ findNode.assignment('a = 0'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.topSet('a'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_topLevel_setter_fromStatic() async {
@@ -2215,8 +2334,15 @@
}
}
''');
- var identifier = findNode.simple('a = 0;');
- assertElement(identifier, findElement.topSet('a'));
+ assertAssignment(
+ findNode.assignment('a = 0'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.topSet('a'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
}
diff --git a/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart
index ddcd447..806ada7 100644
--- a/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart
@@ -125,7 +125,12 @@
''');
findDeclarationAndOverride(declarationName: 'E ', overrideSearch: 'E(a)');
validateOverride();
- validatePropertyAccess();
+
+ assertPropertyAccess2(
+ findNode.propertyAccess('.g'),
+ element: findElement.getter('g'),
+ type: 'int',
+ );
}
test_getter_noPrefix_noTypeArguments_functionExpressionInvocation() async {
@@ -165,7 +170,15 @@
''');
findDeclarationAndOverride(declarationName: 'E', overrideSearch: 'E<int>');
validateOverride(typeArguments: [intType]);
- validatePropertyAccess();
+
+ assertPropertyAccess2(
+ findNode.propertyAccess('.g'),
+ element: elementMatcher(
+ findElement.getter('g'),
+ substitution: {'T': 'int'},
+ ),
+ type: 'int',
+ );
}
test_getter_prefix_noTypeArguments() async {
@@ -186,7 +199,13 @@
declarationUri: 'package:test/lib.dart',
overrideSearch: 'E(a)');
validateOverride();
- validatePropertyAccess();
+
+ var importFind = findElement.importFind('package:test/lib.dart');
+ assertPropertyAccess2(
+ findNode.propertyAccess('.g'),
+ element: importFind.getter('g'),
+ type: 'int',
+ );
}
test_getter_prefix_typeArguments() async {
@@ -207,7 +226,16 @@
declarationUri: 'package:test/lib.dart',
overrideSearch: 'E<int>');
validateOverride(typeArguments: [intType]);
- validatePropertyAccess();
+
+ var importFind = findElement.importFind('package:test/lib.dart');
+ assertPropertyAccess2(
+ findNode.propertyAccess('.g'),
+ element: elementMatcher(
+ importFind.getter('g'),
+ substitution: {'T': 'int'},
+ ),
+ type: 'int',
+ );
}
test_method_noPrefix_noTypeArguments() async {
@@ -383,7 +411,16 @@
''');
findDeclarationAndOverride(declarationName: 'E ', overrideSearch: 'E(a)');
validateOverride();
- validatePropertyAccess();
+
+ assertAssignment(
+ findNode.assignment('s ='),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('s', of: 'E'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_setter_noPrefix_typeArguments() async {
@@ -398,7 +435,19 @@
''');
findDeclarationAndOverride(declarationName: 'E', overrideSearch: 'E<int>');
validateOverride(typeArguments: [intType]);
- validatePropertyAccess();
+
+ assertAssignment(
+ findNode.assignment('s ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ findElement.setter('s', of: 'E'),
+ substitution: {'T': 'int'},
+ ),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_setter_prefix_noTypeArguments() async {
@@ -419,7 +468,17 @@
declarationUri: 'package:test/lib.dart',
overrideSearch: 'E(a)');
validateOverride();
- validatePropertyAccess();
+
+ var importFind = findElement.importFind('package:test/lib.dart');
+ assertAssignment(
+ findNode.assignment('s ='),
+ readElement: null,
+ readType: null,
+ writeElement: importFind.setter('s', of: 'E'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_setter_prefix_typeArguments() async {
@@ -440,7 +499,20 @@
declarationUri: 'package:test/lib.dart',
overrideSearch: 'E<int>');
validateOverride(typeArguments: [intType]);
- validatePropertyAccess();
+
+ var importFind = findElement.importFind('package:test/lib.dart');
+ assertAssignment(
+ findNode.assignment('s ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ importFind.setter('s', of: 'E'),
+ substitution: {'T': 'int'},
+ ),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
test_setterAndGetter_noPrefix_noTypeArguments() async {
@@ -456,7 +528,19 @@
''');
findDeclarationAndOverride(declarationName: 'E ', overrideSearch: 'E(a)');
validateOverride();
- validatePropertyAccess();
+
+ assertAssignment(
+ findNode.assignment('s +='),
+ readElement: findElement.getter('s', of: 'E'),
+ readType: 'int',
+ writeElement: findElement.setter('s', of: 'E'),
+ writeType: 'int',
+ operatorElement: elementMatcher(
+ numElement.getMethod('+'),
+ isLegacy: isNullSafetySdkAndLegacyLibrary,
+ ),
+ type: 'int',
+ );
}
test_setterAndGetter_noPrefix_typeArguments() async {
@@ -472,7 +556,25 @@
''');
findDeclarationAndOverride(declarationName: 'E', overrideSearch: 'E<int>');
validateOverride(typeArguments: [intType]);
- validatePropertyAccess();
+
+ assertAssignment(
+ findNode.assignment('s +='),
+ readElement: elementMatcher(
+ findElement.getter('s', of: 'E'),
+ substitution: {'T': 'int'},
+ ),
+ readType: 'int',
+ writeElement: elementMatcher(
+ findElement.setter('s', of: 'E'),
+ substitution: {'T': 'int'},
+ ),
+ writeType: 'int',
+ operatorElement: elementMatcher(
+ numElement.getMethod('+'),
+ isLegacy: isNullSafetySdkAndLegacyLibrary,
+ ),
+ type: 'int',
+ );
}
test_setterAndGetter_prefix_noTypeArguments() async {
@@ -494,7 +596,20 @@
declarationUri: 'package:test/lib.dart',
overrideSearch: 'E(a)');
validateOverride();
- validatePropertyAccess();
+
+ var importFind = findElement.importFind('package:test/lib.dart');
+ assertAssignment(
+ findNode.assignment('s +='),
+ readElement: importFind.getter('s', of: 'E'),
+ readType: 'int',
+ writeElement: importFind.setter('s', of: 'E'),
+ writeType: 'int',
+ operatorElement: elementMatcher(
+ numElement.getMethod('+'),
+ isLegacy: isNullSafetySdkAndLegacyLibrary,
+ ),
+ type: 'int',
+ );
}
test_setterAndGetter_prefix_typeArguments() async {
@@ -516,7 +631,26 @@
declarationUri: 'package:test/lib.dart',
overrideSearch: 'E<int>');
validateOverride(typeArguments: [intType]);
- validatePropertyAccess();
+
+ var importFind = findElement.importFind('package:test/lib.dart');
+ assertAssignment(
+ findNode.assignment('s +='),
+ readElement: elementMatcher(
+ importFind.getter('s', of: 'E'),
+ substitution: {'T': 'int'},
+ ),
+ readType: 'int',
+ writeElement: elementMatcher(
+ importFind.setter('s', of: 'E'),
+ substitution: {'T': 'int'},
+ ),
+ writeType: 'int',
+ operatorElement: elementMatcher(
+ numElement.getMethod('+'),
+ isLegacy: isNullSafetySdkAndLegacyLibrary,
+ ),
+ type: 'int',
+ );
}
test_tearOff() async {
@@ -583,25 +717,6 @@
}
expect(extensionOverride.argumentList.arguments, hasLength(1));
}
-
- void validatePropertyAccess() {
- PropertyAccess access = extensionOverride.parent as PropertyAccess;
- Element resolvedElement = access.propertyName.staticElement;
- PropertyAccessorElement expectedElement;
- if (access.propertyName.inSetterContext()) {
- expectedElement = extension.getSetter('s');
- if (access.propertyName.inGetterContext()) {
- PropertyAccessorElement expectedGetter = extension.getGetter('s');
- Element actualGetter =
- // ignore: deprecated_member_use_from_same_package
- access.propertyName.auxiliaryElements.staticElement;
- expect(actualGetter, expectedGetter);
- }
- } else {
- expectedElement = extension.getGetter('g');
- }
- expect(resolvedElement, expectedElement);
- }
}
@reflectiveTest
@@ -637,10 +752,13 @@
}
''');
- assertIndexExpression(
- findNode.index('[0]'),
+ assertAssignment(
+ findNode.assignment('[0] ='),
readElement: null,
+ readType: null,
writeElement: findElement.method('[]=', of: 'E'),
+ writeType: 'int',
+ operatorElement: null,
type: 'int?',
);
}
diff --git a/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart
index 77238af..9652773 100644
--- a/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart
@@ -88,12 +88,14 @@
var numPlusElement = numElement.getMethod('+');
var indexExpression = findNode.index('a[0]');
- assertIndexExpression(
- indexExpression,
- readElement: indexElement,
- writeElement: indexEqElement,
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertIndexExpression(
+ indexExpression,
+ readElement: indexElement,
+ writeElement: indexEqElement,
+ type: 'num',
+ );
+ }
assertParameterElement(
indexExpression.index,
indexEqElement.parameters[0],
@@ -135,18 +137,20 @@
var doublePlusElement = doubleElement.getMethod('+');
var indexExpression = findNode.index('a[0]');
- assertIndexExpression(
- indexExpression,
- readElement: elementMatcher(
- indexElement,
- substitution: {'T': 'double'},
- ),
- writeElement: elementMatcher(
- indexEqElement,
- substitution: {'T': 'double'},
- ),
- type: 'double',
- );
+ if (hasAssignmentLeftResolution) {
+ assertIndexExpression(
+ indexExpression,
+ readElement: elementMatcher(
+ indexElement,
+ substitution: {'T': 'double'},
+ ),
+ writeElement: elementMatcher(
+ indexEqElement,
+ substitution: {'T': 'double'},
+ ),
+ type: 'double',
+ );
+ }
assertParameterElement(
indexExpression.index,
indexEqElement.parameters[0],
@@ -191,12 +195,14 @@
var indexEqElement = findElement.method('[]=');
var indexExpression = findNode.index('a[0]');
- assertIndexExpression(
- indexExpression,
- readElement: null,
- writeElement: indexEqElement,
- type: null,
- );
+ if (hasAssignmentLeftResolution) {
+ assertIndexExpression(
+ indexExpression,
+ readElement: null,
+ writeElement: indexEqElement,
+ type: null,
+ );
+ }
assertParameterElement(
indexExpression.index,
indexEqElement.parameters[0],
@@ -212,7 +218,10 @@
operatorElement: null,
type: 'double',
);
- assertParameterElement(assignment.rightHandSide, null);
+ assertParameterElement(
+ assignment.rightHandSide,
+ indexEqElement.parameters[1],
+ );
}
test_write_generic() async {
@@ -229,15 +238,17 @@
var indexEqElement = findElement.method('[]=');
var indexExpression = findNode.index('a[0]');
- assertIndexExpression(
- indexExpression,
- readElement: null,
- writeElement: elementMatcher(
- indexEqElement,
- substitution: {'T': 'double'},
- ),
- type: null,
- );
+ if (hasAssignmentLeftResolution) {
+ assertIndexExpression(
+ indexExpression,
+ readElement: null,
+ writeElement: elementMatcher(
+ indexEqElement,
+ substitution: {'T': 'double'},
+ ),
+ type: null,
+ );
+ }
assertParameterElement(
indexExpression.index,
indexEqElement.parameters[0],
@@ -256,7 +267,10 @@
operatorElement: null,
type: 'double',
);
- assertParameterElement(assignment.rightHandSide, null);
+ assertParameterElement(
+ assignment.rightHandSide,
+ indexEqElement.parameters[1],
+ );
}
}
@@ -332,12 +346,14 @@
var numPlusElement = numElement.getMethod('+');
var indexExpression = findNode.index('a?[0]');
- assertIndexExpression(
- indexExpression,
- readElement: indexElement,
- writeElement: indexEqElement,
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertIndexExpression(
+ indexExpression,
+ readElement: indexElement,
+ writeElement: indexEqElement,
+ type: 'num',
+ );
+ }
assertParameterElement(
indexExpression.index,
indexEqElement.parameters[0],
@@ -372,20 +388,42 @@
var indexEqElement = findElement.method('[]=');
- assertIndexExpression(
- findNode.index('..[0]'),
+ assertAssignment(
+ findNode.assignment('[0]'),
readElement: null,
- writeElement: indexEqElement,
- type: null,
+ readType: null,
+ writeElement: findElement.method('[]='),
+ writeType: 'A',
+ operatorElement: null,
+ type: 'A',
);
- assertIndexExpression(
- findNode.index('..[1]'),
+ assertAssignment(
+ findNode.assignment('[1]'),
readElement: null,
- writeElement: indexEqElement,
- type: null,
+ readType: null,
+ writeElement: findElement.method('[]='),
+ writeType: 'A',
+ operatorElement: null,
+ type: 'A',
);
+ if (hasAssignmentLeftResolution) {
+ assertIndexExpression(
+ findNode.index('..[0]'),
+ readElement: null,
+ writeElement: indexEqElement,
+ type: null,
+ );
+
+ assertIndexExpression(
+ findNode.index('..[1]'),
+ readElement: null,
+ writeElement: indexEqElement,
+ type: null,
+ );
+ }
+
assertType(findNode.cascade('a?'), 'A?');
}
@@ -403,12 +441,14 @@
var indexEqElement = findElement.method('[]=');
var indexExpression = findNode.index('a?[0]');
- assertIndexExpression(
- indexExpression,
- readElement: null,
- writeElement: indexEqElement,
- type: null,
- );
+ if (hasAssignmentLeftResolution) {
+ assertIndexExpression(
+ indexExpression,
+ readElement: null,
+ writeElement: indexEqElement,
+ type: null,
+ );
+ }
assertParameterElement(
indexExpression.index,
indexEqElement.parameters[0],
@@ -424,6 +464,9 @@
operatorElement: null,
type: 'double?',
);
- assertParameterElement(assignment.rightHandSide, null);
+ assertParameterElement(
+ assignment.rightHandSide,
+ indexEqElement.parameters[1],
+ );
}
}
diff --git a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
index 75bd0f7..bd227a0 100644
--- a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
@@ -1200,7 +1200,7 @@
test_superInvocation_setter() async {
await assertNoErrorsInCode(r'''
class A {
- void set foo(_) {}
+ void set foo(int _) {}
}
mixin M on A {
@@ -1212,9 +1212,14 @@
class X extends A with M {}
''');
- var access = findNode.propertyAccess('super.foo = 0');
- assertElement(access, findElement.setter('foo'));
- // Hm... Does it need any type?
- assertTypeDynamic(access);
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('foo'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
}
}
diff --git a/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart
index 61a0e67..add8f6f 100644
--- a/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart
@@ -179,12 +179,14 @@
type: 'dynamic',
);
- assertSimpleIdentifier(
- postfix.operand,
- readElement: findElement.typeParameter('T'),
- writeElement: findElement.typeParameter('T'),
- type: 'dynamic',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ postfix.operand,
+ readElement: findElement.typeParameter('T'),
+ writeElement: findElement.typeParameter('T'),
+ type: 'dynamic',
+ );
+ }
}
test_inc_prefixedIdentifier_instance() async {
@@ -417,12 +419,14 @@
type: 'int',
);
- assertSimpleIdentifier(
- postfix.operand,
- readElement: findElement.getter('x'),
- writeElement: findElement.setter('x'),
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ postfix.operand,
+ readElement: findElement.getter('x'),
+ writeElement: findElement.setter('x'),
+ type: 'num',
+ );
+ }
}
test_inc_simpleIdentifier_topGetter_topSetter() async {
@@ -450,12 +454,14 @@
type: 'int',
);
- assertSimpleIdentifier(
- postfix.operand,
- readElement: findElement.topGet('x'),
- writeElement: findElement.topSet('x'),
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ postfix.operand,
+ readElement: findElement.topGet('x'),
+ writeElement: findElement.topSet('x'),
+ type: 'num',
+ );
+ }
}
test_inc_simpleIdentifier_topGetter_topSetter_fromClass() async {
@@ -485,12 +491,14 @@
type: 'int',
);
- assertSimpleIdentifier(
- postfix.operand,
- readElement: findElement.topGet('x'),
- writeElement: findElement.topSet('x'),
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ postfix.operand,
+ readElement: findElement.topGet('x'),
+ writeElement: findElement.topSet('x'),
+ type: 'num',
+ );
+ }
}
}
@@ -533,7 +541,9 @@
}
''');
- assertType(findNode.simple('x++;'), 'A');
+ if (hasAssignmentLeftResolution) {
+ assertType(findNode.simple('x++;'), 'A');
+ }
assertPostfixExpression(
findNode.postfix('x++'),
diff --git a/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart
index b6b4dec..671e345 100644
--- a/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart
@@ -491,12 +491,14 @@
type: 'int',
);
- assertSimpleIdentifier(
- prefix.operand,
- readElement: findElement.getter('x'),
- writeElement: findElement.setter('x'),
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ prefix.operand,
+ readElement: findElement.getter('x'),
+ writeElement: findElement.setter('x'),
+ type: 'num',
+ );
+ }
}
test_plusPlus_simpleIdentifier_thisGetter_thisSetter() async {
@@ -524,12 +526,14 @@
type: 'int',
);
- assertSimpleIdentifier(
- prefix.operand,
- readElement: findElement.getter('x'),
- writeElement: findElement.setter('x'),
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ prefix.operand,
+ readElement: findElement.getter('x'),
+ writeElement: findElement.setter('x'),
+ type: 'num',
+ );
+ }
}
test_plusPlus_simpleIdentifier_topGetter_topSetter() async {
@@ -557,12 +561,14 @@
type: 'int',
);
- assertSimpleIdentifier(
- prefix.operand,
- readElement: findElement.topGet('x'),
- writeElement: findElement.topSet('x'),
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ prefix.operand,
+ readElement: findElement.topGet('x'),
+ writeElement: findElement.topSet('x'),
+ type: 'num',
+ );
+ }
}
test_plusPlus_simpleIdentifier_topGetter_topSetter_fromClass() async {
@@ -592,12 +598,14 @@
type: 'int',
);
- assertSimpleIdentifier(
- prefix.operand,
- readElement: findElement.topGet('x'),
- writeElement: findElement.topSet('x'),
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ prefix.operand,
+ readElement: findElement.topGet('x'),
+ writeElement: findElement.topSet('x'),
+ type: 'num',
+ );
+ }
}
/// Verify that we get all necessary types when building the dependencies
@@ -721,7 +729,9 @@
type: 'Object',
);
- assertType(findNode.simple('x;'), 'A');
+ if (hasAssignmentLeftResolution) {
+ assertType(findNode.simple('x;'), 'A');
+ }
}
test_plusPlus_nullShorting() async {
diff --git a/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart b/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart
index a6aa5f6..679ec1a 100644
--- a/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart
@@ -116,11 +116,13 @@
);
var prefixed = assignment.leftHandSide as PrefixedIdentifier;
- assertPrefixedIdentifier(
- prefixed,
- element: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertPrefixedIdentifier(
+ prefixed,
+ element: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
assertSimpleIdentifier(
prefixed.prefix,
@@ -129,12 +131,14 @@
type: 'A',
);
- assertSimpleIdentifier(
- prefixed.identifier,
- readElement: null,
- writeElement: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ prefixed.identifier,
+ readElement: null,
+ writeElement: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
}
test_write() async {
@@ -160,11 +164,13 @@
);
var prefixed = assignment.leftHandSide as PrefixedIdentifier;
- assertPrefixedIdentifier(
- prefixed,
- element: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertPrefixedIdentifier(
+ prefixed,
+ element: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
assertSimpleIdentifier(
prefixed.prefix,
@@ -173,12 +179,14 @@
type: 'A',
);
- assertSimpleIdentifier(
- prefixed.identifier,
- readElement: null,
- writeElement: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ prefixed.identifier,
+ readElement: null,
+ writeElement: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
}
}
diff --git a/pkg/analyzer/test/src/dart/resolution/property_access_test.dart b/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
index 2d0516f..308f02f 100644
--- a/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
@@ -74,11 +74,13 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertPropertyAccess2(
- propertyAccess,
- element: findElement.setter('foo'),
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess2(
+ propertyAccess,
+ element: findElement.setter('foo'),
+ type: 'num',
+ );
+ }
}
test_extensionOverride_write() async {
@@ -106,18 +108,20 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertPropertyAccess2(
- propertyAccess,
- element: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess2(
+ propertyAccess,
+ element: findElement.setter('foo'),
+ type: 'int',
+ );
- assertSimpleIdentifier(
- propertyAccess.propertyName,
- readElement: null,
- writeElement: findElement.setter('foo'),
- type: 'int',
- );
+ assertSimpleIdentifier(
+ propertyAccess.propertyName,
+ readElement: null,
+ writeElement: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
}
test_instanceCreation_read() async {
@@ -172,11 +176,13 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertPropertyAccess2(
- propertyAccess,
- element: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess2(
+ propertyAccess,
+ element: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
}
test_instanceCreation_write() async {
@@ -202,18 +208,20 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertPropertyAccess2(
- propertyAccess,
- element: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess2(
+ propertyAccess,
+ element: findElement.setter('foo'),
+ type: 'int',
+ );
- assertSimpleIdentifier(
- propertyAccess.propertyName,
- readElement: null,
- writeElement: findElement.setter('foo'),
- type: 'int',
- );
+ assertSimpleIdentifier(
+ propertyAccess.propertyName,
+ readElement: null,
+ writeElement: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
}
test_ofExtension_read() async {
@@ -273,11 +281,13 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertPropertyAccess2(
- propertyAccess,
- element: findElement.setter('foo'),
- type: 'num',
- );
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess2(
+ propertyAccess,
+ element: findElement.setter('foo'),
+ type: 'num',
+ );
+ }
}
test_ofExtension_write() async {
@@ -305,18 +315,20 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertPropertyAccess2(
- propertyAccess,
- element: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess2(
+ propertyAccess,
+ element: findElement.setter('foo'),
+ type: 'int',
+ );
- assertSimpleIdentifier(
- propertyAccess.propertyName,
- readElement: null,
- writeElement: findElement.setter('foo'),
- type: 'int',
- );
+ assertSimpleIdentifier(
+ propertyAccess.propertyName,
+ readElement: null,
+ writeElement: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
}
test_super_read() async {
@@ -379,22 +391,26 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertPropertyAccess2(
- propertyAccess,
- element: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess2(
+ propertyAccess,
+ element: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
assertSuperExpression(
propertyAccess.target,
);
- assertSimpleIdentifier(
- propertyAccess.propertyName,
- readElement: findElement.getter('foo'),
- writeElement: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ propertyAccess.propertyName,
+ readElement: findElement.getter('foo'),
+ writeElement: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
}
test_super_write() async {
@@ -422,22 +438,26 @@
);
var propertyAccess = assignment.leftHandSide as PropertyAccess;
- assertPropertyAccess2(
- propertyAccess,
- element: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess2(
+ propertyAccess,
+ element: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
assertSuperExpression(
propertyAccess.target,
);
- assertSimpleIdentifier(
- propertyAccess.propertyName,
- readElement: null,
- writeElement: findElement.setter('foo'),
- type: 'int',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ propertyAccess.propertyName,
+ readElement: null,
+ writeElement: findElement.setter('foo'),
+ type: 'int',
+ );
+ }
}
test_targetTypeParameter_dynamicBounded() async {
diff --git a/pkg/analyzer/test/src/dart/resolution/resolution.dart b/pkg/analyzer/test/src/dart/resolution/resolution.dart
index 2fdf8ba..e4d6162 100644
--- a/pkg/analyzer/test/src/dart/resolution/resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/resolution.dart
@@ -50,6 +50,9 @@
ClassElement get futureElement => typeProvider.futureElement;
+ /// TODO(scheglov) https://github.com/dart-lang/sdk/issues/43608
+ bool get hasAssignmentLeftResolution => true;
+
ClassElement get intElement => typeProvider.intType.element;
InterfaceType get intType => typeProvider.intType;
@@ -672,6 +675,29 @@
}
}
+ /// TODO(scheglov) https://github.com/dart-lang/sdk/issues/43608
+ /// TODO(scheglov) rename this method
+ void assertSimpleIdentifierAssignmentTarget(
+ SimpleIdentifier node, {
+ @required Object readElement,
+ @required Object writeElement,
+ @required String type,
+ }) {
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ node,
+ readElement: readElement,
+ writeElement: writeElement,
+ type: type,
+ );
+ } else {
+ // TODO(scheglov) Enforce maybe?
+ // Currently VariableResolverVisitor sets it.
+ // expect(node.staticElement, isNull);
+ expect(node.staticType, isNull);
+ }
+ }
+
void assertSubstitution(
MapSubstitution substitution,
Map<String, String> expected,
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
index 43c92f8..86b728d 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
@@ -148,11 +148,27 @@
}
''');
var propertyAccess = findNode.prefixed('.foo =');
- assertMember(
- propertyAccess,
- findElement.setter('foo', of: 'E'),
- {'T': 'int'},
+
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ findElement.setter('foo', of: 'E'),
+ substitution: {'T': 'int'},
+ ),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
);
+
+ if (hasAssignmentLeftResolution) {
+ assertMember(
+ propertyAccess,
+ findElement.setter('foo', of: 'E'),
+ {'T': 'int'},
+ );
+ }
}
test_implicit_targetTypeParameter_hasBound_methodInvocation() async {
@@ -237,29 +253,59 @@
''');
if (result.libraryElement.isNonNullableByDefault) {
- assertPropertyAccess2(
- findNode.propertyAccess('.test'),
- element: elementMatcher(
+ assertAssignment(
+ findNode.assignment('(x).test'),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
findElement.setter('test'),
substitution: {'T': 'S'},
),
+ writeType: 'S',
+ operatorElement: null,
type: 'S',
);
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess2(
+ findNode.propertyAccess('.test'),
+ element: elementMatcher(
+ findElement.setter('test'),
+ substitution: {'T': 'S'},
+ ),
+ type: 'S',
+ );
+ }
+
assertTypeArgumentTypes(
findNode.methodInvocation('g()'),
['S'],
);
} else {
- assertPropertyAccess2(
- findNode.propertyAccess('.test'),
- element: elementMatcher(
+ assertAssignment(
+ findNode.assignment('(x).test'),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
findElement.setter('test'),
substitution: {'T': 'num'},
),
+ writeType: 'num',
+ operatorElement: null,
type: 'num',
);
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess2(
+ findNode.propertyAccess('.test'),
+ element: elementMatcher(
+ findElement.setter('test'),
+ substitution: {'T': 'num'},
+ ),
+ type: 'num',
+ );
+ }
+
assertTypeArgumentTypes(
findNode.methodInvocation('g()'),
['num'],
@@ -408,12 +454,27 @@
assertElementTypeStrings(override.typeArgumentTypes, ['num']);
assertType(override.extendedType, 'A<num>');
- var propertyAccess = findNode.propertyAccess('.foo =');
- assertMember(
- propertyAccess,
- findElement.setter('foo', of: 'E'),
- {'T': 'num'},
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ findElement.setter('foo', of: 'E'),
+ substitution: {'T': 'num'},
+ ),
+ writeType: 'num',
+ operatorElement: null,
+ type: 'double',
);
+
+ if (hasAssignmentLeftResolution) {
+ var propertyAccess = findNode.propertyAccess('.foo =');
+ assertMember(
+ propertyAccess,
+ findElement.setter('foo', of: 'E'),
+ {'T': 'num'},
+ );
+ }
}
test_override_inferTypeArguments_error_couldNotInfer() async {
@@ -534,12 +595,27 @@
assertElementTypeStrings(override.typeArgumentTypes, ['int']);
assertType(override.extendedType, 'A<int>');
- var propertyAccess = findNode.propertyAccess('.foo =');
- assertMember(
- propertyAccess,
- findElement.setter('foo', of: 'E'),
- {'T': 'int'},
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ findElement.setter('foo', of: 'E'),
+ substitution: {'T': 'int'},
+ ),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
);
+
+ if (hasAssignmentLeftResolution) {
+ var propertyAccess = findNode.propertyAccess('.foo =');
+ assertMember(
+ propertyAccess,
+ findElement.setter('foo', of: 'E'),
+ {'T': 'int'},
+ );
+ }
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/abstract_super_member_reference_test.dart b/pkg/analyzer/test/src/diagnostics/abstract_super_member_reference_test.dart
index 63131c6..4a78f7c 100644
--- a/pkg/analyzer/test/src/diagnostics/abstract_super_member_reference_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/abstract_super_member_reference_test.dart
@@ -357,11 +357,25 @@
error(CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE, 94, 3),
]);
- assertPropertyAccess(
- findNode.propertyAccess('super.foo'),
- findElement.setter('foo', of: 'A'),
- 'int',
+ assertSuperExpression(findNode.super_('super.foo'));
+
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('foo'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
);
+
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess(
+ findNode.propertyAccess('super.foo'),
+ findElement.setter('foo', of: 'A'),
+ 'int',
+ );
+ }
}
test_propertyAccess_setter_mixinHasNoSuchMethod() async {
@@ -379,11 +393,25 @@
error(CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE, 111, 3),
]);
- assertPropertyAccess(
- findNode.propertyAccess('super.foo'),
- findElement.setter('foo', of: 'A'),
- 'int',
+ assertSuperExpression(findNode.super_('super.foo'));
+
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('foo', of: 'A'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
);
+
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess(
+ findNode.propertyAccess('super.foo'),
+ findElement.setter('foo', of: 'A'),
+ 'int',
+ );
+ }
}
test_propertyAccess_setter_superHasNoSuchMethod() async {
@@ -399,11 +427,25 @@
}
''');
- assertPropertyAccess(
- findNode.propertyAccess('super.foo'),
- findElement.setter('foo', of: 'A'),
- 'int',
+ assertSuperExpression(findNode.super_('super.foo'));
+
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('foo', of: 'A'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
);
+
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess(
+ findNode.propertyAccess('super.foo'),
+ findElement.setter('foo', of: 'A'),
+ 'int',
+ );
+ }
}
test_propertyAccess_setter_superSuperHasConcrete() async {
@@ -423,10 +465,24 @@
}
''');
- assertPropertyAccess(
- findNode.propertyAccess('super.foo'),
- findElement.setter('foo', of: 'A'),
- 'int',
+ assertSuperExpression(findNode.super_('super.foo'));
+
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('foo', of: 'A'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
);
+
+ if (hasAssignmentLeftResolution) {
+ assertPropertyAccess(
+ findNode.propertyAccess('super.foo'),
+ findElement.setter('foo', of: 'A'),
+ 'int',
+ );
+ }
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/access_private_enum_field_test.dart b/pkg/analyzer/test/src/diagnostics/access_private_enum_field_test.dart
deleted file mode 100644
index 3ea6c65..0000000
--- a/pkg/analyzer/test/src/diagnostics/access_private_enum_field_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/src/error/codes.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../dart/resolution/context_collection_resolution.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(AccessPrivateEnumFieldTest);
- });
-}
-
-@reflectiveTest
-class AccessPrivateEnumFieldTest extends PubPackageResolutionTest {
- @failingTest
- test_name() async {
- await assertErrorsInCode(r'''
-enum E { ONE }
-String name(E e) {
- return e._name;
-}
-''', [
- error(CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD, 45, 5),
- ]);
- }
-}
diff --git a/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart b/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
index d4bc4a4..eb82661 100644
--- a/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
@@ -253,6 +253,8 @@
]);
var access = findNode.propertyAccess('0.a');
assertElementNull(access);
- assertTypeDynamic(access);
+ if (hasAssignmentLeftResolution) {
+ assertTypeDynamic(access);
+ }
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/extends_non_class_test.dart b/pkg/analyzer/test/src/diagnostics/extends_non_class_test.dart
index 2658ff5..5313441 100644
--- a/pkg/analyzer/test/src/diagnostics/extends_non_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/extends_non_class_test.dart
@@ -15,7 +15,113 @@
}
@reflectiveTest
-class ExtendsNonClassTest extends PubPackageResolutionTest {}
+class ExtendsNonClassTest extends PubPackageResolutionTest {
+ test_undefined() async {
+ await assertErrorsInCode(r'''
+class C extends A {}
+''', [
+ error(CompileTimeErrorCode.EXTENDS_NON_CLASS, 16, 1),
+ ]);
+ }
+
+ test_undefined_ignore_import_prefix() async {
+ await assertErrorsInCode(r'''
+import 'a.dart' as p;
+
+class C extends p.A {}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 8),
+ ]);
+ }
+
+ test_undefined_ignore_import_show_it() async {
+ await assertErrorsInCode(r'''
+import 'a.dart' show A;
+
+class C extends A {}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 8),
+ ]);
+ }
+
+ test_undefined_ignore_import_show_other() async {
+ await assertErrorsInCode(r'''
+import 'a.dart' show B;
+
+class C extends A {}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 8),
+ error(CompileTimeErrorCode.EXTENDS_NON_CLASS, 41, 1),
+ ]);
+ }
+
+ test_undefined_ignore_part_exists_uriGenerated_nameIgnorable() async {
+ newFile('$testPackageLibPath/a.g.dart', content: r'''
+part of 'test.dart';
+''');
+
+ await assertErrorsInCode(r'''
+part 'a.g.dart';
+
+class C extends _$A {}
+''', [
+ error(CompileTimeErrorCode.EXTENDS_NON_CLASS, 34, 3),
+ ]);
+ }
+
+ test_undefined_ignore_part_notExist_uriGenerated_nameIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.g.dart';
+
+class C extends _$A {}
+''', [
+ error(CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED, 5, 10),
+ ]);
+ }
+
+ test_undefined_ignore_part_notExist_uriGenerated_nameNotIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.g.dart';
+
+class C extends A {}
+''', [
+ error(CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED, 5, 10),
+ error(CompileTimeErrorCode.EXTENDS_NON_CLASS, 34, 1),
+ ]);
+ }
+
+ test_undefined_ignore_part_notExist_uriNotGenerated_nameIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.dart';
+
+class C extends _$A {}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 5, 8),
+ error(CompileTimeErrorCode.EXTENDS_NON_CLASS, 32, 3),
+ ]);
+ }
+
+ test_undefined_ignore_part_notExist_uriNotGenerated_nameNotIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.dart';
+
+class C extends A {}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 5, 8),
+ error(CompileTimeErrorCode.EXTENDS_NON_CLASS, 32, 1),
+ ]);
+ }
+
+ test_undefined_import_exists_prefixed() async {
+ await assertErrorsInCode(r'''
+import 'dart:math' as p;
+
+class C extends p.A {}
+''', [
+ error(CompileTimeErrorCode.EXTENDS_NON_CLASS, 42, 3),
+ ]);
+ }
+}
@reflectiveTest
class ExtendsNonClassWithNullSafetyTest extends ExtendsNonClassTest
diff --git a/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart b/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart
index 8644b85..a4f47c8 100644
--- a/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart
@@ -61,19 +61,32 @@
class C {}
extension E on C {
- static set a(v) {}
+ static set a(int v) {}
}
f(C c) {
c.a = 2;
}
''', [
- error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 68, 1),
+ error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 72, 1),
]);
- assertElement(
- findNode.simple('a = 2;'),
- findElement.setter('a'),
+
+ assertAssignment(
+ findNode.assignment('a ='),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('a', of: 'E'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
);
+
+ if (hasAssignmentLeftResolution) {
+ assertElement(
+ findNode.simple('a = 2;'),
+ findElement.setter('a'),
+ );
+ }
}
test_method_reference() async {
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart
index 591d171..f24a3ce 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart
@@ -57,7 +57,7 @@
x = null;
}
''', [
- error(HintCode.DEAD_CODE, 24, 5),
+ if (hasAssignmentLeftResolution) error(HintCode.DEAD_CODE, 24, 5),
error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 24, 4),
]);
}
@@ -70,7 +70,7 @@
x = null;
}
''', [
- error(HintCode.DEAD_CODE, 37, 5),
+ if (hasAssignmentLeftResolution) error(HintCode.DEAD_CODE, 37, 5),
error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 37, 4),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/mixin_of_non_class_test.dart b/pkg/analyzer/test/src/diagnostics/mixin_of_non_class_test.dart
index df4c58b..948a8dd 100644
--- a/pkg/analyzer/test/src/diagnostics/mixin_of_non_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/mixin_of_non_class_test.dart
@@ -55,6 +55,112 @@
error(CompileTimeErrorCode.MIXIN_OF_NON_CLASS, 39, 1),
]);
}
+
+ test_undefined() async {
+ await assertErrorsInCode(r'''
+class C with M {}
+''', [
+ error(CompileTimeErrorCode.MIXIN_OF_NON_CLASS, 13, 1),
+ ]);
+ }
+
+ test_undefined_ignore_import_prefix() async {
+ await assertErrorsInCode(r'''
+import 'a.dart' as p;
+
+class C with p.M {}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 8),
+ ]);
+ }
+
+ test_undefined_ignore_import_show_it() async {
+ await assertErrorsInCode(r'''
+import 'a.dart' show M;
+
+class C with M {}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 8),
+ ]);
+ }
+
+ test_undefined_ignore_import_show_other() async {
+ await assertErrorsInCode(r'''
+import 'a.dart' show N;
+
+class C with M {}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 8),
+ error(CompileTimeErrorCode.MIXIN_OF_NON_CLASS, 38, 1),
+ ]);
+ }
+
+ test_undefined_ignore_part_exists_uriGenerated_nameIgnorable() async {
+ newFile('$testPackageLibPath/a.g.dart', content: r'''
+part of 'test.dart';
+''');
+
+ await assertErrorsInCode(r'''
+part 'a.g.dart';
+
+class C with _$M {}
+''', [
+ error(CompileTimeErrorCode.MIXIN_OF_NON_CLASS, 31, 3),
+ ]);
+ }
+
+ test_undefined_ignore_part_notExist_uriGenerated_nameIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.g.dart';
+
+class C with _$M {}
+''', [
+ error(CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED, 5, 10),
+ ]);
+ }
+
+ test_undefined_ignore_part_notExist_uriGenerated_nameNotIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.g.dart';
+
+class C with M {}
+''', [
+ error(CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED, 5, 10),
+ error(CompileTimeErrorCode.MIXIN_OF_NON_CLASS, 31, 1),
+ ]);
+ }
+
+ test_undefined_ignore_part_notExist_uriNotGenerated_nameIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.dart';
+
+class C with _$M {}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 5, 8),
+ error(CompileTimeErrorCode.MIXIN_OF_NON_CLASS, 29, 3),
+ ]);
+ }
+
+ test_undefined_ignore_part_notExist_uriNotGenerated_nameNotIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.dart';
+
+class C with M {}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 5, 8),
+ error(CompileTimeErrorCode.MIXIN_OF_NON_CLASS, 29, 1),
+ ]);
+ }
+
+ test_undefined_import_exists_prefixed() async {
+ await assertErrorsInCode(r'''
+import 'dart:math' as p;
+
+class C with p.M {}
+''', [
+ error(CompileTimeErrorCode.MIXIN_OF_NON_CLASS, 39, 3),
+ ]);
+ }
}
@reflectiveTest
diff --git a/pkg/analyzer/test/src/diagnostics/non_null_opt_out_test.dart b/pkg/analyzer/test/src/diagnostics/non_null_opt_out_test.dart
index 856103c..699a2a5 100644
--- a/pkg/analyzer/test/src/diagnostics/non_null_opt_out_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_null_opt_out_test.dart
@@ -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.
-//import 'package:analyzer/src/error/codes.dart';
-import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
@@ -40,14 +38,19 @@
a[null] = null;
}
''');
- var assignment = findNode.assignment('= null;');
- assertType(assignment, 'Null*');
- var indexExpression = assignment.leftHandSide as IndexExpression;
- assertType(indexExpression, 'int*');
-
- var element = indexExpression.staticElement;
- _assertLegacyMember(element, _import_a.method('[]='));
+ assertAssignment(
+ findNode.assignment(' = null;'),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.method('[]='),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'Null*',
+ );
}
test_assignment_prefixedIdentifier_instanceTarget_class_field() async {
@@ -64,17 +67,18 @@
a.foo = 0;
}
''');
- var assignment = findNode.assignment('foo = 0');
- assertType(assignment, 'int*');
-
- PrefixedIdentifier prefixedIdentifier = assignment.leftHandSide;
- assertType(prefixedIdentifier, 'int*');
-
- var identifier = prefixedIdentifier.identifier;
- assertType(identifier, 'int*');
-
- PropertyAccessorElement setter = identifier.staticElement;
- _assertLegacyMember(setter, _import_a.setter('foo'));
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.setter('foo'),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'int*',
+ );
}
test_assignment_prefixedIdentifier_instanceTarget_extension_setter() async {
@@ -92,17 +96,18 @@
a.foo = 0;
}
''');
- var assignment = findNode.assignment('foo = 0');
- assertType(assignment, 'int*');
-
- PrefixedIdentifier prefixedIdentifier = assignment.leftHandSide;
- assertType(prefixedIdentifier, 'int*');
-
- var identifier = prefixedIdentifier.identifier;
- assertType(identifier, 'int*');
-
- PropertyAccessorElement setter = identifier.staticElement;
- _assertLegacyMember(setter, _import_a.setter('foo'));
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.setter('foo'),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'int*',
+ );
}
test_assignment_prefixedIdentifier_staticTarget_class_field() async {
@@ -119,17 +124,18 @@
A.foo = 0;
}
''');
- var assignment = findNode.assignment('foo = 0');
- assertType(assignment, 'int*');
-
- PrefixedIdentifier prefixedIdentifier = assignment.leftHandSide;
- assertType(prefixedIdentifier, 'int*');
-
- var identifier = prefixedIdentifier.identifier;
- assertType(identifier, 'int*');
-
- PropertyAccessorElement setter = identifier.staticElement;
- _assertLegacyMember(setter, _import_a.setter('foo'));
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.setter('foo'),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'int*',
+ );
}
test_assignment_prefixedIdentifier_staticTarget_extension_field() async {
@@ -146,17 +152,18 @@
E.foo = 0;
}
''');
- var assignment = findNode.assignment('foo = 0');
- assertType(assignment, 'int*');
-
- PrefixedIdentifier prefixedIdentifier = assignment.leftHandSide;
- assertType(prefixedIdentifier, 'int*');
-
- var identifier = prefixedIdentifier.identifier;
- assertType(identifier, 'int*');
-
- PropertyAccessorElement setter = identifier.staticElement;
- _assertLegacyMember(setter, _import_a.setter('foo'));
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.setter('foo'),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'int*',
+ );
}
test_assignment_prefixedIdentifier_topLevelVariable() async {
@@ -171,14 +178,18 @@
p.foo = 0;
}
''');
- var assignment = findNode.assignment('foo = 0');
- assertType(assignment, 'int*');
-
- PrefixedIdentifier prefixedIdentifier = assignment.leftHandSide;
- assertType(prefixedIdentifier, 'int*');
-
- PropertyAccessorElement setter = prefixedIdentifier.staticElement;
- _assertLegacyMember(setter, _import_a.topSet('foo'));
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.topSet('foo'),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'int*',
+ );
}
test_assignment_propertyAccess_class_field() async {
@@ -195,14 +206,18 @@
A().foo = 0;
}
''');
- var assignment = findNode.assignment('foo = 0');
- assertType(assignment, 'int*');
-
- PropertyAccess propertyAccess = assignment.leftHandSide;
- assertType(propertyAccess, 'int*');
-
- PropertyAccessorElement setter = propertyAccess.propertyName.staticElement;
- _assertLegacyMember(setter, _import_a.setter('foo'));
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.setter('foo'),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'int*',
+ );
}
test_assignment_propertyAccess_extension_setter() async {
@@ -220,14 +235,18 @@
A().foo = 0;
}
''');
- var assignment = findNode.assignment('foo = 0');
- assertType(assignment, 'int*');
-
- PropertyAccess propertyAccess = assignment.leftHandSide;
- assertType(propertyAccess, 'int*');
-
- PropertyAccessorElement setter = propertyAccess.propertyName.staticElement;
- _assertLegacyMember(setter, _import_a.setter('foo'));
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.setter('foo'),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'int*',
+ );
}
test_assignment_propertyAccess_extensionOverride_setter() async {
@@ -245,14 +264,18 @@
E(a).foo = 0;
}
''');
- var assignment = findNode.assignment('foo = 0');
- assertType(assignment, 'int*');
-
- PropertyAccess propertyAccess = assignment.leftHandSide;
- assertType(propertyAccess, 'int*');
-
- PropertyAccessorElement setter = propertyAccess.propertyName.staticElement;
- _assertLegacyMember(setter, _import_a.setter('foo'));
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.setter('foo'),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'int*',
+ );
}
test_assignment_propertyAccess_superTarget() async {
@@ -271,14 +294,18 @@
}
}
''');
- var assignment = findNode.assignment('foo = 0');
- assertType(assignment, 'int*');
-
- PropertyAccess propertyAccess = assignment.leftHandSide;
- assertType(propertyAccess, 'int*');
-
- PropertyAccessorElement setter = propertyAccess.propertyName.staticElement;
- _assertLegacyMember(setter, _import_a.setter('foo'));
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.setter('foo'),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'int*',
+ );
}
test_assignment_simpleIdentifier_topLevelVariable() async {
@@ -293,14 +320,18 @@
foo = null;
}
''');
- var assignment = findNode.assignment('foo =');
- assertType(assignment, 'Null*');
-
- SimpleIdentifier identifier = assignment.leftHandSide;
- assertType(identifier, 'int*');
-
- PropertyAccessorElement setter = identifier.staticElement;
- _assertLegacyMember(setter, _import_a.topSet('foo'));
+ assertAssignment(
+ findNode.assignment('foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: elementMatcher(
+ _import_a.topSet('foo'),
+ isLegacy: true,
+ ),
+ writeType: 'int*',
+ operatorElement: null,
+ type: 'Null*',
+ );
}
test_binaryExpression() async {
diff --git a/pkg/analyzer/test/src/diagnostics/private_setter_test.dart b/pkg/analyzer/test/src/diagnostics/private_setter_test.dart
index 438630b..a173db7 100644
--- a/pkg/analyzer/test/src/diagnostics/private_setter_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/private_setter_test.dart
@@ -32,10 +32,23 @@
]);
var aImport = findElement.importFind('package:test/a.dart');
- assertElement(
- findNode.simple('_foo = 0'),
- aImport.setter('_foo'),
+
+ assertAssignment(
+ findNode.assignment('_foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: aImport.setter('_foo'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
);
+
+ if (hasAssignmentLeftResolution) {
+ assertElement(
+ findNode.simple('_foo = 0'),
+ aImport.setter('_foo'),
+ );
+ }
}
test_typeLiteral_privateField_sameLibrary() async {
@@ -51,18 +64,6 @@
''');
}
- test_typeLiteral_privateSetter__sameLibrary() async {
- await assertNoErrorsInCode(r'''
-class A {
- static set _foo(int _) {}
-}
-
-main() {
- A._foo = 0;
-}
-''');
- }
-
test_typeLiteral_privateSetter_differentLibrary_hasGetter() async {
newFile('$testPackageLibPath/a.dart', content: r'''
class A {
@@ -82,10 +83,23 @@
]);
var aImport = findElement.importFind('package:test/a.dart');
- assertElement(
- findNode.simple('_foo = 0'),
- aImport.setter('_foo'),
+
+ assertAssignment(
+ findNode.assignment('_foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: aImport.setter('_foo'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
);
+
+ if (hasAssignmentLeftResolution) {
+ assertElement(
+ findNode.simple('_foo = 0'),
+ aImport.setter('_foo'),
+ );
+ }
}
test_typeLiteral_privateSetter_differentLibrary_noGetter() async {
@@ -105,9 +119,34 @@
]);
var aImport = findElement.importFind('package:test/a.dart');
- assertElement(
- findNode.simple('_foo = 0'),
- aImport.setter('_foo'),
+
+ assertAssignment(
+ findNode.assignment('_foo ='),
+ readElement: null,
+ readType: null,
+ writeElement: aImport.setter('_foo'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
);
+
+ if (hasAssignmentLeftResolution) {
+ assertElement(
+ findNode.simple('_foo = 0'),
+ aImport.setter('_foo'),
+ );
+ }
+ }
+
+ test_typeLiteral_privateSetter_sameLibrary() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ static set _foo(int _) {}
+}
+
+main() {
+ A._foo = 0;
+}
+''');
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
index 3574235..757d377 100644
--- a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
@@ -153,13 +153,25 @@
error(HintCode.DEAD_CODE, 22, 12),
]);
- assertIndexExpression(
- findNode.index('x[0]'),
+ assertAssignment(
+ findNode.assignment('[0] +='),
readElement: null,
+ readType: 'dynamic',
writeElement: null,
+ writeType: 'dynamic',
+ operatorElement: null,
type: 'dynamic',
);
+ if (hasAssignmentLeftResolution) {
+ assertIndexExpression(
+ findNode.index('x[0]'),
+ readElement: null,
+ writeElement: null,
+ type: 'dynamic',
+ );
+ }
+
assertType(findNode.binary('1 + 2'), 'int');
}
@@ -209,13 +221,25 @@
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 21, 1),
]);
- assertIndexExpression(
- findNode.index('x[0]'),
+ assertAssignment(
+ findNode.assignment('[0] +='),
readElement: null,
+ readType: 'dynamic',
writeElement: null,
+ writeType: 'dynamic',
+ operatorElement: null,
type: 'dynamic',
);
+ if (hasAssignmentLeftResolution) {
+ assertIndexExpression(
+ findNode.index('x[0]'),
+ readElement: null,
+ writeElement: null,
+ type: 'dynamic',
+ );
+ }
+
assertType(findNode.binary('1 + 2'), 'int');
}
@@ -428,12 +452,14 @@
error(HintCode.DEAD_CODE, 29, 2),
]);
- assertSimpleIdentifier(
- findNode.simple('foo'),
- readElement: null,
- writeElement: null,
- type: 'dynamic',
- );
+ if (hasAssignmentLeftResolution) {
+ assertSimpleIdentifier(
+ findNode.simple('foo'),
+ readElement: null,
+ writeElement: null,
+ type: 'dynamic',
+ );
+ }
assertAssignment(
findNode.assignment('foo += 0'),
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index 6d57dca..3258ab3 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -10,7 +10,6 @@
import 'abstract_field_initializer_test.dart' as abstract_field_initializer;
import 'abstract_super_member_reference_test.dart'
as abstract_super_member_reference;
-import 'access_private_enum_field_test.dart' as access_private_enum_field;
import 'ambiguous_export_test.dart' as ambiguous_export;
import 'ambiguous_extension_member_access_test.dart'
as ambiguous_extension_member_access;
@@ -658,7 +657,6 @@
abstract_field_constructor_initializer.main();
abstract_field_initializer.main();
abstract_super_member_reference.main();
- access_private_enum_field.main();
ambiguous_export.main();
ambiguous_extension_member_access.main();
ambiguous_import.main();
diff --git a/pkg/analyzer/test/src/diagnostics/undefined_class_test.dart b/pkg/analyzer/test/src/diagnostics/undefined_class_test.dart
index 518e957..025eb5f 100644
--- a/pkg/analyzer/test/src/diagnostics/undefined_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/undefined_class_test.dart
@@ -36,6 +36,114 @@
]);
}
+ test_ignore_import_prefix() async {
+ await assertErrorsInCode(r'''
+import 'a.dart' as p;
+
+p.A a;
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 8),
+ ]);
+ }
+
+ test_ignore_import_show_it() async {
+ await assertErrorsInCode(r'''
+import 'a.dart' show A;
+
+A a;
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 8),
+ ]);
+ }
+
+ test_ignore_import_show_other() async {
+ await assertErrorsInCode(r'''
+import 'a.dart' show B;
+
+A a;
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 8),
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 25, 1),
+ ]);
+ }
+
+ test_ignore_part_exists_uriGenerated_nameIgnorable() async {
+ newFile('$testPackageLibPath/a.g.dart', content: r'''
+part of 'test.dart';
+''');
+
+ await assertErrorsInCode(r'''
+part 'a.g.dart';
+
+_$A a;
+''', [
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 18, 3),
+ ]);
+ }
+
+ test_ignore_part_notExist_uriGenerated2_nameIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.template.dart';
+
+_$A a;
+''', [
+ error(CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED, 5, 17),
+ ]);
+ }
+
+ test_ignore_part_notExist_uriGenerated_nameIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.g.dart';
+
+_$A a;
+''', [
+ error(CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED, 5, 10),
+ ]);
+ }
+
+ test_ignore_part_notExist_uriGenerated_nameNotIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.g.dart';
+
+A a;
+''', [
+ error(CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED, 5, 10),
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 18, 1),
+ ]);
+ }
+
+ test_ignore_part_notExist_uriNotGenerated_nameIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.dart';
+
+_$A a;
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 5, 8),
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 16, 3),
+ ]);
+ }
+
+ test_ignore_part_notExist_uriNotGenerated_nameNotIgnorable() async {
+ await assertErrorsInCode(r'''
+part 'a.dart';
+
+A a;
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 5, 8),
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 16, 1),
+ ]);
+ }
+
+ test_import_exists_prefixed() async {
+ await assertErrorsInCode(r'''
+import 'dart:math' as p;
+
+p.A a;
+''', [
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 26, 3),
+ ]);
+ }
+
test_instanceCreation() async {
await assertErrorsInCode('''
f() { new C(); }
diff --git a/pkg/analyzer/test/src/diagnostics/unqualified_reference_to_non_local_static_member_test.dart b/pkg/analyzer/test/src/diagnostics/unqualified_reference_to_non_local_static_member_test.dart
index 56a6482..dc4b69e 100644
--- a/pkg/analyzer/test/src/diagnostics/unqualified_reference_to_non_local_static_member_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unqualified_reference_to_non_local_static_member_test.dart
@@ -16,6 +16,9 @@
@reflectiveTest
class UnqualifiedReferenceToNonLocalStaticMemberTest
extends PubPackageResolutionTest {
+ CompileTimeErrorCode get _errorCode =>
+ CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER;
+
test_getter() async {
await assertErrorsInCode(r'''
class A {
@@ -27,10 +30,7 @@
}
}
''', [
- error(
- CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
- 80,
- 1),
+ error(_errorCode, 80, 1),
]);
}
@@ -46,28 +46,29 @@
}
}
''', [
- error(
- CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
- 72,
- 3),
+ error(_errorCode, 72, 3),
]);
}
- test_setter() async {
+ test_readWrite() async {
await assertErrorsInCode(r'''
class A {
- static set a(x) {}
+ static int get x => 0;
+ static set x(int _) {}
}
class B extends A {
- b(y) {
- a = y;
+ void f() {
+ x = 0;
+ x += 1;
+ ++x;
+ x++;
}
}
''', [
- error(
- CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
- 66,
- 1),
+ error(_errorCode, 99, 1),
+ error(_errorCode, 110, 1),
+ error(_errorCode, 124, 1),
+ error(_errorCode, 131, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/unqualified_reference_to_static_member_of_extended_type_test.dart b/pkg/analyzer/test/src/diagnostics/unqualified_reference_to_static_member_of_extended_type_test.dart
index 18a9304..8525aa2 100644
--- a/pkg/analyzer/test/src/diagnostics/unqualified_reference_to_static_member_of_extended_type_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unqualified_reference_to_static_member_of_extended_type_test.dart
@@ -16,6 +16,11 @@
@reflectiveTest
class UnqualifiedReferenceToStaticMemberOfExtendedTypeTest
extends PubPackageResolutionTest {
+ CompileTimeErrorCode get _errorCode {
+ return CompileTimeErrorCode
+ .UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE;
+ }
+
test_getter() async {
await assertErrorsInCode('''
class MyClass {
@@ -27,11 +32,7 @@
}
}
''', [
- error(
- CompileTimeErrorCode
- .UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE,
- 98,
- 4),
+ error(_errorCode, 98, 4),
]);
}
@@ -46,30 +47,30 @@
}
}
''', [
- error(
- CompileTimeErrorCode
- .UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE,
- 92,
- 2),
+ error(_errorCode, 92, 2),
]);
}
- test_setter() async {
+ test_readWrite() async {
await assertErrorsInCode('''
class MyClass {
- static set foo(int i) {}
+ static int get x => 0;
+ static set x(int _) {}
}
+
extension MyExtension on MyClass {
- void m() {
- foo = 3;
+ void f() {
+ x = 0;
+ x += 1;
+ ++x;
+ x++;
}
}
''', [
- error(
- CompileTimeErrorCode
- .UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE,
- 97,
- 3),
+ error(_errorCode, 121, 1),
+ error(_errorCode, 132, 1),
+ error(_errorCode, 146, 1),
+ error(_errorCode, 153, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/unused_element_test.dart b/pkg/analyzer/test/src/diagnostics/unused_element_test.dart
index 4a1a652..3850c62 100644
--- a/pkg/analyzer/test/src/diagnostics/unused_element_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unused_element_test.dart
@@ -686,6 +686,17 @@
''');
}
+ test_method_isUsed_privateExtension_indexEqOperator() async {
+ await assertNoErrorsInCode(r'''
+extension _A on bool {
+ operator []=(int index, int value) {}
+}
+void main() {
+ false[0] = 1;
+}
+''');
+ }
+
test_method_isUsed_privateExtension_indexOperator() async {
await assertNoErrorsInCode(r'''
extension _A on bool {
@@ -809,6 +820,16 @@
// Postfix operators can only be called, not defined. The "notUsed" sibling to
// this test is the test on a binary operator.
+ test_method_notUsed_privateExtension_indexEqOperator() async {
+ await assertErrorsInCode(r'''
+extension _A on bool {
+ operator []=(int index, int value) {}
+}
+''', [
+ error(HintCode.UNUSED_ELEMENT, 34, 3),
+ ]);
+ }
+
test_method_notUsed_privateExtension_indexOperator() async {
await assertErrorsInCode(r'''
extension _A on bool {
diff --git a/pkg/analyzer/test/src/diagnostics/unused_shown_name_test.dart b/pkg/analyzer/test/src/diagnostics/unused_shown_name_test.dart
index 787c6841..81d5b2c 100644
--- a/pkg/analyzer/test/src/diagnostics/unused_shown_name_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unused_shown_name_test.dart
@@ -48,6 +48,90 @@
''');
}
+ test_referenced_prefixed_assignmentExpression() async {
+ newFile('$testPackageLibPath/a.dart', content: r'''
+var a = 0;
+''');
+
+ await assertNoErrorsInCode(r'''
+import 'a.dart' as p show a;
+
+void f() {
+ p.a = 0;
+}
+''');
+ }
+
+ test_referenced_prefixed_postfixExpression() async {
+ newFile('$testPackageLibPath/a.dart', content: r'''
+var a = 0;
+''');
+
+ await assertNoErrorsInCode(r'''
+import 'a.dart' as p show a;
+
+void f() {
+ p.a++;
+}
+''');
+ }
+
+ test_referenced_prefixed_prefixExpression() async {
+ newFile('$testPackageLibPath/a.dart', content: r'''
+var a = 0;
+''');
+
+ await assertNoErrorsInCode(r'''
+import 'a.dart' as p show a;
+
+void f() {
+ ++p.a;
+}
+''');
+ }
+
+ test_referenced_unprefixed_assignmentExpression() async {
+ newFile('$testPackageLibPath/a.dart', content: r'''
+var a = 0;
+''');
+
+ await assertNoErrorsInCode(r'''
+import 'a.dart' show a;
+
+void f() {
+ a = 0;
+}
+''');
+ }
+
+ test_referenced_unprefixed_postfixExpression() async {
+ newFile('$testPackageLibPath/a.dart', content: r'''
+var a = 0;
+''');
+
+ await assertNoErrorsInCode(r'''
+import 'a.dart' show a;
+
+void f() {
+ a++;
+}
+''');
+ }
+
+ test_referenced_unprefixed_prefixExpression() async {
+ newFile('$testPackageLibPath/a.dart', content: r'''
+var a = 0;
+''');
+
+ await assertNoErrorsInCode(r'''
+import 'a.dart' show a;
+
+void f() {
+ ++a;
+}
+''');
+ }
+
test_unreferenced() async {
newFile('$testPackageLibPath/lib1.dart', content: r'''
class A {}
diff --git a/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart b/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart
index a022829..d1acc45 100644
--- a/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart
@@ -399,12 +399,33 @@
''', [
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 100, 3),
]);
- var assignment1 = findNode.assignment('b.a?.x = 1');
- var assignment2 = findNode.assignment('b.a.x = 2');
- assertType(assignment1.leftHandSide, 'int');
- assertType(assignment2.leftHandSide, 'int');
- assertType(assignment1, 'int?');
- assertType(assignment2, 'int');
+
+ assertAssignment(
+ findNode.assignment('x = 1'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('x'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int?',
+ );
+
+ assertAssignment(
+ findNode.assignment('x = 2'),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.setter('x'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
+
+ if (hasAssignmentLeftResolution) {
+ var assignment1 = findNode.assignment('b.a?.x = 1');
+ var assignment2 = findNode.assignment('b.a.x = 2');
+ assertType(assignment1.leftHandSide, 'int');
+ assertType(assignment2.leftHandSide, 'int');
+ }
}
test_assignment_eq_simpleIdentifier() async {
@@ -414,12 +435,33 @@
y = 0;
}
''');
- var assignment1 = findNode.assignment('x =');
- var assignment2 = findNode.assignment('y =');
- assertType(assignment1.leftHandSide, 'int');
- assertType(assignment2.leftHandSide, 'int?');
- assertType(assignment1, 'int');
- assertType(assignment2, 'int');
+
+ assertAssignment(
+ findNode.assignment('x ='),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.parameter('x'),
+ writeType: 'int',
+ operatorElement: null,
+ type: 'int',
+ );
+
+ assertAssignment(
+ findNode.assignment('y ='),
+ readElement: null,
+ readType: null,
+ writeElement: findElement.parameter('y'),
+ writeType: 'int?',
+ operatorElement: null,
+ type: 'int',
+ );
+
+ if (hasAssignmentLeftResolution) {
+ var assignment1 = findNode.assignment('x =');
+ var assignment2 = findNode.assignment('y =');
+ assertType(assignment1.leftHandSide, 'int');
+ assertType(assignment2.leftHandSide, 'int?');
+ }
}
test_assignment_plusEq_propertyAccess3() async {
@@ -442,12 +484,39 @@
''', [
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 109, 5),
]);
- var assignment1 = findNode.assignment('b.a.x +=');
- var assignment2 = findNode.assignment('b.a.y +=');
- assertType(assignment1.leftHandSide, 'int');
- assertType(assignment2.leftHandSide, 'int?');
- assertType(assignment1, 'int');
- assertType(assignment2, 'int');
+
+ assertAssignment(
+ findNode.assignment('x +='),
+ readElement: findElement.getter('x'),
+ readType: 'int',
+ writeElement: findElement.setter('x'),
+ writeType: 'int',
+ operatorElement: elementMatcher(
+ numElement.getMethod('+'),
+ isLegacy: isNullSafetySdkAndLegacyLibrary,
+ ),
+ type: 'int',
+ );
+
+ assertAssignment(
+ findNode.assignment('y +='),
+ readElement: findElement.getter('y'),
+ readType: 'int?',
+ writeElement: findElement.setter('y'),
+ writeType: 'int?',
+ operatorElement: elementMatcher(
+ numElement.getMethod('+'),
+ isLegacy: isNullSafetySdkAndLegacyLibrary,
+ ),
+ type: 'int',
+ );
+
+ if (hasAssignmentLeftResolution) {
+ var assignment1 = findNode.assignment('b.a.x +=');
+ var assignment2 = findNode.assignment('b.a.y +=');
+ assertType(assignment1.leftHandSide, 'int');
+ assertType(assignment2.leftHandSide, 'int?');
+ }
}
test_assignment_plusEq_propertyAccess3_short1() async {
@@ -469,12 +538,39 @@
''', [
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 101, 3),
]);
- var assignment1 = findNode.assignment('b.a?.x += 1');
- var assignment2 = findNode.assignment('b.a.x += 2');
- assertType(assignment1.leftHandSide, 'int');
- assertType(assignment2.leftHandSide, 'int');
- assertType(assignment1, 'int?');
- assertType(assignment2, 'int');
+
+ assertAssignment(
+ findNode.assignment('x += 1'),
+ readElement: findElement.getter('x'),
+ readType: 'int',
+ writeElement: findElement.setter('x'),
+ writeType: 'int',
+ operatorElement: elementMatcher(
+ numElement.getMethod('+'),
+ isLegacy: isNullSafetySdkAndLegacyLibrary,
+ ),
+ type: 'int?',
+ );
+
+ assertAssignment(
+ findNode.assignment('x += 2'),
+ readElement: findElement.getter('x'),
+ readType: 'int',
+ writeElement: findElement.setter('x'),
+ writeType: 'int',
+ operatorElement: elementMatcher(
+ numElement.getMethod('+'),
+ isLegacy: isNullSafetySdkAndLegacyLibrary,
+ ),
+ type: 'int',
+ );
+
+ if (hasAssignmentLeftResolution) {
+ var assignment1 = findNode.assignment('b.a?.x += 1');
+ var assignment2 = findNode.assignment('b.a.x += 2');
+ assertType(assignment1.leftHandSide, 'int');
+ assertType(assignment2.leftHandSide, 'int');
+ }
}
test_assignment_plusEq_simpleIdentifier() async {
@@ -488,10 +584,37 @@
]);
var assignment1 = findNode.assignment('x +=');
var assignment2 = findNode.assignment('y +=');
- assertType(assignment1.leftHandSide, 'int');
- assertType(assignment2.leftHandSide, 'int?');
- assertType(assignment1, 'int');
- assertType(assignment2, 'int');
+
+ assertAssignment(
+ findNode.assignment('x +='),
+ readElement: findElement.parameter('x'),
+ readType: 'int',
+ writeElement: findElement.parameter('x'),
+ writeType: 'int',
+ operatorElement: elementMatcher(
+ numElement.getMethod('+'),
+ isLegacy: isNullSafetySdkAndLegacyLibrary,
+ ),
+ type: 'int',
+ );
+
+ assertAssignment(
+ findNode.assignment('y +='),
+ readElement: findElement.parameter('y'),
+ readType: 'int?',
+ writeElement: findElement.parameter('y'),
+ writeType: 'int?',
+ operatorElement: elementMatcher(
+ numElement.getMethod('+'),
+ isLegacy: isNullSafetySdkAndLegacyLibrary,
+ ),
+ type: 'int',
+ );
+
+ if (hasAssignmentLeftResolution) {
+ assertType(assignment1.leftHandSide, 'int');
+ assertType(assignment2.leftHandSide, 'int?');
+ }
}
test_await_nonNullable() async {
diff --git a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
index cd05675..b5f2d6c 100644
--- a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
+++ b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
@@ -7,6 +7,7 @@
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart' as protocol;
@@ -297,7 +298,7 @@
@override
void visitIndexExpression(IndexExpression node) {
super.visitIndexExpression(node);
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
computer._addRegionForToken(node.leftBracket, element);
computer._addRegionForToken(node.rightBracket, element);
}
@@ -350,7 +351,7 @@
if (node.parent is ConstructorDeclaration) {
return;
}
- var element = node.staticElement;
+ var element = node.writeOrReadElement;
computer._addRegionForNode(node, element);
}
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index 42ced5b..bb9ed2b 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -125,6 +125,7 @@
Map<MemberEntity, WorldImpact> codegenImpactsForTesting;
String getGeneratedCodeForTesting(MemberEntity element) {
+ if (generatedCode[element] == null) return null;
return js.prettyPrint(generatedCode[element],
enableMinification: _compiler.options.enableMinification);
}
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index a4025d8..619683d 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -3977,7 +3977,7 @@
js.Template code = js.js.parseForeignJS('new Array(#)');
var behavior = new NativeBehavior();
- var expectedType = _elementMap.getDartType(invocation.getStaticType(null));
+ DartType expectedType = _getStaticType(invocation).type;
behavior.typesInstantiated.add(expectedType);
behavior.typesReturned.add(expectedType);
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 883aa0e..3386187 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -2055,6 +2055,232 @@
return node;
}
+
+ @override
+ HInstruction visitBitAnd(HBitAnd node) {
+ HInstruction left = node.left;
+ HInstruction right = node.right;
+
+ if (left is HConstant) {
+ if (right is HConstant) {
+ return foldBinary(node.operation(), left, right) ?? node;
+ }
+ // c1 & a --> a & c1
+ return HBitAnd(right, left, node.instructionType);
+ }
+
+ if (right is HConstant) {
+ ConstantValue constant = right.constant;
+ if (constant.isZero) return right; // a & 0 --> 0
+ if (_isFull32BitMask(constant)) {
+ if (left.isUInt32(_abstractValueDomain).isDefinitelyTrue) {
+ // Mask of all '1's has no effect.
+ return left;
+ // TODO(sra): A more advanced version of this would be to see if the
+ // input might have any bits that would be cleared by the mask. Thus
+ // `a >> 24 & 255` is a no-op since `a >> 24` can have only the low 8
+ // bits non-zero. If a bit is must-zero, we can remove it from
+ // mask. e.g. if a is Uint31, then `a >> 24 & 0xF0` becomes `a >> 24 &
+ // 0x70`.
+ }
+
+ // Ensure that the result is still canonicalized to an unsigned 32-bit
+ // integer using `left >>> 0`. This shift is often removed or combined
+ // in subsequent optimization.
+ HConstant zero = _graph.addConstantInt(0, _closedWorld);
+ return HShiftRight(left, zero, node.instructionType);
+ }
+
+ if (left is HBitAnd && left.usedBy.length == 1) {
+ HInstruction operand1 = left.left;
+ HInstruction operand2 = left.right;
+ if (operand2 is HConstant) {
+ // (a & c1) & c2 --> a & (c1 & c2)
+ HInstruction folded =
+ foldBinary(constant_system.bitAnd, operand2, right);
+ if (folded == null) return node;
+ return HBitAnd(operand1, folded, node.instructionType);
+ }
+ // TODO(sra): We don't rewrite (a & c1) & b --> (a & b) & c1. I suspect
+ // that the JavaScript VM might benefit from reducing the value early
+ // (e.g. to a 'Smi'). We could do that, but we should also consider a
+ // variation of the above rule where:
+ //
+ // a & c1 & ... & b & c2 --> a & (c1 & c2) & ... & b
+ //
+ // This would probably be best deferred until after GVN in case (a & c1)
+ // is reused.
+ }
+ }
+
+ return node;
+ }
+
+ bool _isFull32BitMask(ConstantValue constant) {
+ return constant is IntConstantValue && constant.intValue == _mask32;
+ }
+
+ static final _mask32 = BigInt.parse('FFFFFFFF', radix: 16);
+
+ @override
+ HInstruction visitBitOr(HBitOr node) {
+ HInstruction left = node.left;
+ HInstruction right = node.right;
+
+ if (left is HConstant) {
+ if (right is HConstant) {
+ return foldBinary(node.operation(), left, right) ?? node;
+ }
+ // c1 | a --> a | c1
+ return HBitOr(right, left, node.instructionType);
+ }
+
+ // (a | b) | c
+ if (left is HBitOr && left.usedBy.length == 1) {
+ HInstruction operand1 = left.left;
+ HInstruction operand2 = left.right;
+ if (operand2 is HConstant) {
+ if (right is HConstant) {
+ // (a | c1) | c2 --> a | (c1 | c2)
+ HInstruction folded =
+ foldBinary(constant_system.bitOr, operand2, right);
+ if (folded == null) return node;
+ return HBitOr(operand1, folded, node.instructionType);
+ } else {
+ // (a | c1) | b --> (a | b) | c1
+ HInstruction or1 = _makeBitOr(operand1, right)
+ ..sourceInformation = left.sourceInformation;
+ node.block.addBefore(node, or1);
+ // TODO(sra): Restart simplification at 'or1'.
+ return _makeBitOr(or1, operand2);
+ }
+ }
+ }
+
+ // (a & c1) | (a & c2) --> a & (c1 | c2)
+ if (left is HBitAnd &&
+ left.usedBy.length == 1 &&
+ right is HBitAnd &&
+ right.usedBy.length == 1) {
+ HInstruction a1 = left.left;
+ HInstruction a2 = right.left;
+ if (a1 == a2) {
+ HInstruction c1 = left.right;
+ HInstruction c2 = right.right;
+ if (c1 is HConstant && c2 is HConstant) {
+ HInstruction folded = foldBinary(constant_system.bitOr, c1, c2);
+ if (folded != null) {
+ return HBitAnd(a1, folded, node.instructionType);
+ }
+ }
+ }
+ }
+
+ // TODO(sra):
+ //
+ // (e | (a & c1)) | (a & c2) --> e | (a & (c1 | c2))
+
+ return node;
+ }
+
+ HBitOr _makeBitOr(HInstruction operand1, HInstruction operand2) {
+ AbstractValue instructionType = _abstractValueDomainBitOr(
+ operand1.instructionType, operand2.instructionType);
+ return HBitOr(operand1, operand2, instructionType);
+ }
+
+ // TODO(sra): Use a common definition of primitive operations in the
+ // AbstractValueDomain.
+ AbstractValue _abstractValueDomainBitOr(AbstractValue a, AbstractValue b) {
+ return (_abstractValueDomain.isUInt31(a).isDefinitelyTrue &&
+ _abstractValueDomain.isUInt31(b).isDefinitelyTrue)
+ ? _abstractValueDomain.uint31Type
+ : _abstractValueDomain.uint32Type;
+ }
+
+ @override
+ HInstruction visitShiftRight(HShiftRight node) {
+ HInstruction left = node.left;
+ HInstruction count = node.right;
+ if (count is HConstant) {
+ if (left is HConstant) {
+ return foldBinary(node.operation(), left, count) ?? node;
+ }
+ ConstantValue countValue = count.constant;
+ // Shift by zero can convert to 32 bit unsigned, so remove only if no-op.
+ // a >> 0 --> a
+ if (countValue.isZero &&
+ left.isUInt32(_abstractValueDomain).isDefinitelyTrue) {
+ return left;
+ }
+ if (left is HBitAnd && left.usedBy.length == 1) {
+ // TODO(sra): Should this be postponed to after GVN?
+ HInstruction operand = left.left;
+ HInstruction mask = left.right;
+ if (mask is HConstant) {
+ // Reduce mask constant size.
+ // (a & mask) >> count --> (a >> count) & (mask >> count)
+ ConstantValue maskValue = mask.constant;
+
+ ConstantValue shiftedMask =
+ constant_system.shiftRight.fold(maskValue, countValue);
+ if (shiftedMask is IntConstantValue && shiftedMask.isUInt32()) {
+ // TODO(sra): The shift type should be available from the abstract
+ // value domain.
+ AbstractValue shiftType = shiftedMask.isZero
+ ? _abstractValueDomain.uint32Type
+ : _abstractValueDomain.uint31Type;
+ var shift = HShiftRight(operand, count, shiftType)
+ ..sourceInformation = node.sourceInformation;
+
+ node.block.addBefore(node, shift);
+ HConstant shiftedMaskInstruction =
+ _graph.addConstant(shiftedMask, _closedWorld);
+ return HBitAnd(shift, shiftedMaskInstruction, node.instructionType);
+ }
+ }
+ return node;
+ }
+ }
+ return node;
+ }
+
+ @override
+ HInstruction visitShiftLeft(HShiftLeft node) {
+ HInstruction left = node.left;
+ HInstruction count = node.right;
+ if (count is HConstant) {
+ if (left is HConstant) {
+ return foldBinary(node.operation(), left, count) ?? node;
+ }
+ // Shift by zero can convert to 32 bit unsigned, so remove only if no-op.
+ // a << 0 --> a
+ if (count.constant.isZero &&
+ left.isUInt32(_abstractValueDomain).isDefinitelyTrue) {
+ return left;
+ }
+ // Shift-mask-unshift reduction.
+ // ((a >> c1) & c2) << c1 --> a & (c2 << c1);
+ if (left is HBitAnd && left.usedBy.length == 1) {
+ HInstruction operand1 = left.left;
+ HInstruction operand2 = left.right;
+ if (operand2 is HConstant) {
+ if (operand1 is HShiftRight && operand1.usedBy.length == 1) {
+ HInstruction a = operand1.left;
+ HInstruction count2 = operand1.right;
+ if (count2 == count) {
+ HInstruction folded =
+ foldBinary(constant_system.shiftLeft, operand2, count);
+ if (folded != null) {
+ return HBitAnd(a, folded, node.instructionType);
+ }
+ }
+ }
+ }
+ }
+ }
+ return node;
+ }
}
class SsaCheckInserter extends HBaseVisitor implements OptimizationPhase {
diff --git a/pkg/compiler/test/codegen/bitops1_test.dart b/pkg/compiler/test/codegen/bitops1_test.dart
new file mode 100644
index 0000000..a77e35d
--- /dev/null
+++ b/pkg/compiler/test/codegen/bitops1_test.dart
@@ -0,0 +1,138 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart = 2.7
+
+library bitops1_test;
+
+import 'dart:async';
+import 'package:async_helper/async_helper.dart';
+import '../helpers/compiler_helper.dart';
+
+const COMMON = r"""
+int g1 = 0, g2 = 0;
+int sink1 = 0, sink2 = 0;
+
+main() {
+ for (int i = 0; i < 0x100000000; i = i + (i >> 4) + 1) {
+ g1 = g2 = i;
+ sink1 = callFoo(i, 1 - i, i);
+ sink2 = callFoo(2 - i, i, 3 - i);
+ }
+}
+""";
+
+const String TEST1 = r"""
+int foo(int param) {
+ return param & 15;
+ // present: 'return param & 15;'
+}
+""";
+
+const String TEST2 = r"""
+int foo(int param) {
+ return 15 & param;
+ // Constant position canonicalization.
+ // present: 'return param & 15;'
+}
+""";
+
+const String TEST3 = r"""
+int foo(int param) {
+ return param & 0;
+ // present: 'return 0;'
+}
+""";
+
+const String TEST4 = r"""
+int foo(int param) {
+ return param & 12 & 6;
+ // Reassociation and constant folding.
+ // present: 'return param & 4'
+ // absent: '12'
+ // absent: '6'
+}
+""";
+
+const String TEST5 = r"""
+int foo(int param) {
+ return 12 & param & 6;
+ // Reassociation and constant folding.
+ // present: 'return param & 4'
+ // absent: '12'
+ // absent: '6'
+}
+""";
+
+const String TEST6 = r"""
+foo(param) {
+ return 15 | 7 & param;
+ // Constant position canonicalization.
+ // present: 'return param & 7 | 15;'
+}
+""";
+
+const String TEST7 = r"""
+foo(param) {
+ param = toUInt32(param + 1);
+ if (param == 0) return -1;
+ return param & 0xFFFFFFFF | 1;
+ // Removal of identity mask.
+ // present: 'return (param | 1) >>> 0;'
+}
+int toUInt32(int x) => x & 0xFFFFFFFF;
+""";
+
+const String TEST8 = r"""
+int foo(int aaa, int bbb, int ccc) {
+ return 1 | aaa | bbb | 2 | ccc | 4;
+ // Reassociation and constant folding.
+ // present: 'aaa | bbb | ccc | 7'
+}
+int callFoo(int a, int b, int c) => foo(a, b, c);
+""";
+
+const String TEST9 = r"""
+int foo(int aaa, int bbb, int ccc) {
+ return 255 & aaa & bbb & 126 & ccc & 15;
+ // Reassociation and constant folding not yet implemented for '&'.
+ // We want to avoid moving the constants too far right, since masking can
+ // enable a more efficient representation.
+ // TODO(sra): constant-fold later masks into earlier mask.
+ //
+ // present: 'aaa & 255 & bbb & 126 & ccc & 15'
+}
+int callFoo(int a, int b, int c) => foo(a, b, c);
+""";
+
+main() {
+ runTests() async {
+ Future check(String test) {
+ String program = COMMON + '\n\n' + test;
+ if (!test.contains('callFoo')) {
+ program += 'int callFoo(int a, int b, int c) => foo(a);\n';
+ }
+ return compile(program,
+ entry: 'main',
+ methodName: 'foo',
+ disableTypeInference: false,
+ check: checkerForAbsentPresent(test));
+ }
+
+ await check(TEST1);
+ await check(TEST2);
+ await check(TEST3);
+ await check(TEST4);
+ await check(TEST5);
+ await check(TEST6);
+ await check(TEST7);
+ await check(TEST8);
+ await check(TEST9);
+ }
+
+ asyncTest(() async {
+ print('--test from kernel------------------------------------------------');
+ await runTests();
+ });
+}
diff --git a/pkg/compiler/test/codegen/bitops2_test.dart b/pkg/compiler/test/codegen/bitops2_test.dart
new file mode 100644
index 0000000..42ebdf5
--- /dev/null
+++ b/pkg/compiler/test/codegen/bitops2_test.dart
@@ -0,0 +1,98 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart = 2.7
+
+library bitops2_test;
+
+import 'dart:async';
+import 'package:async_helper/async_helper.dart';
+import '../helpers/compiler_helper.dart';
+
+const COMMON = r"""
+int g1 = 0, g2 = 0;
+int sink1 = 0, sink2 = 0;
+
+main() {
+ for (int i = 0; i < 0x100000000; i = i + (i >> 4) + 1) {
+ g1 = g2 = i;
+ sink1 = callFoo(i, 1 - i, i);
+ sink2 = callFoo(2 - i, i, 3 - i);
+ }
+}
+""";
+
+const String TEST1 = r"""
+int foo(int param) {
+ return (param & 0xFF0000) >> 16;
+ // Shift mask reduction.
+ // present: 'return param >>> 16 & 255;'
+ // absent: 'FF0000'
+ // absent: '16711680'
+}
+""";
+
+const String TEST2 = r"""
+int foo(int param) {
+ param &= 0xFFFFFFFF;
+ if (param == 0) return -1;
+ return param << 0;
+ // Shift-by-zero reduction.
+ // present: 'return param;'
+}
+""";
+
+const String TEST3 = r"""
+int foo(int param) {
+ param &= 0xFFFFFFFF;
+ if (param == 0) return -1;
+ return ((param >> 8) & 7) << 8;
+ // Shift-mask-unshift reduction.
+ // present: 'return param & 1792;'
+}
+""";
+
+const String TEST4 = r"""
+foo(int color) {
+ int alpha = 100;
+ int red = (color & 0xFF0000) >> 16;
+ int green = (color & 0xFF00) >> 8;
+ int blue = (color & 0xFF) >> 0;
+
+ return (alpha & 255) << 24 |
+ (red & 255) << 16 |
+ (green & 255) << 8 |
+ (blue & 255) << 0;
+
+ // present: 'color & 16777215 | 1677721600'
+ // absent: '<<'
+ // absent: '>>'
+}
+""";
+
+main() {
+ runTests() async {
+ Future check(String test) {
+ String program = COMMON + '\n\n' + test;
+ if (!test.contains('callFoo')) {
+ program += 'int callFoo(int a, int b, int c) => foo(a);\n';
+ }
+ return compile(program,
+ entry: 'main',
+ methodName: 'foo',
+ disableTypeInference: false,
+ check: checkerForAbsentPresent(test));
+ }
+
+ await check(TEST1);
+ await check(TEST2);
+ await check(TEST3);
+ await check(TEST4);
+ }
+
+ asyncTest(() async {
+ print('--test from kernel------------------------------------------------');
+ await runTests();
+ });
+}
diff --git a/pkg/compiler/test/codegen/codegen_2_shard0_test.dart b/pkg/compiler/test/codegen/codegen_2_shard0_test.dart
new file mode 100644
index 0000000..8fcc121
--- /dev/null
+++ b/pkg/compiler/test/codegen/codegen_2_shard0_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart = 2.7
+
+import 'codegen_test_helper.dart';
+
+main(List<String> args) {
+ runTests2(args, 0);
+}
diff --git a/pkg/compiler/test/codegen/codegen_2_shard1_test.dart b/pkg/compiler/test/codegen/codegen_2_shard1_test.dart
new file mode 100644
index 0000000..8e4bca0
--- /dev/null
+++ b/pkg/compiler/test/codegen/codegen_2_shard1_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart = 2.7
+
+import 'codegen_test_helper.dart';
+
+main(List<String> args) {
+ runTests2(args, 1);
+}
diff --git a/pkg/compiler/test/codegen/codegen_shard0_test.dart b/pkg/compiler/test/codegen/codegen_shard0_test.dart
new file mode 100644
index 0000000..3cea332
--- /dev/null
+++ b/pkg/compiler/test/codegen/codegen_shard0_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart = 2.7
+
+import 'codegen_test_helper.dart';
+
+main(List<String> args) {
+ runTests(args, 0);
+}
diff --git a/pkg/compiler/test/codegen/codegen_shard1_test.dart b/pkg/compiler/test/codegen/codegen_shard1_test.dart
new file mode 100644
index 0000000..8d838c3
--- /dev/null
+++ b/pkg/compiler/test/codegen/codegen_shard1_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart = 2.7
+
+import 'codegen_test_helper.dart';
+
+main(List<String> args) {
+ runTests(args, 1);
+}
diff --git a/pkg/compiler/test/codegen/codegen_test_helper.dart b/pkg/compiler/test/codegen/codegen_test_helper.dart
new file mode 100644
index 0000000..206f5a1
--- /dev/null
+++ b/pkg/compiler/test/codegen/codegen_test_helper.dart
@@ -0,0 +1,159 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart = 2.7
+
+import 'dart:io';
+import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/closure.dart';
+import 'package:compiler/src/common.dart';
+import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
+import 'package:compiler/src/elements/entities.dart';
+import 'package:compiler/src/js_model/element_map.dart';
+import 'package:compiler/src/js_model/js_strategy.dart';
+import 'package:compiler/src/js_model/js_world.dart';
+import 'package:kernel/ast.dart' as ir;
+import '../equivalence/id_equivalence.dart';
+import '../equivalence/id_equivalence_helper.dart';
+
+const List<String> skip = [];
+const List<String> skip2 = [];
+
+main(List<String> args) {
+ runTests(args);
+ runTests2(args);
+}
+
+runTests(List<String> args, [int shardIndex]) {
+ runTestsCommon(args,
+ shardIndex: shardIndex,
+ shards: 2,
+ directory: 'data',
+ skip: skip,
+ options: ['--enable-experiment=non-nullable']);
+}
+
+runTests2(List<String> args, [int shardIndex]) {
+ runTestsCommon(args,
+ shardIndex: shardIndex,
+ shards: 2,
+ directory: 'data_2',
+ skip: skip2,
+ options: []);
+}
+
+runTestsCommon(List<String> args,
+ {int shardIndex,
+ int shards,
+ String directory,
+ List<String> options,
+ List<String> skip}) {
+ asyncTest(() async {
+ Directory dataDir = Directory.fromUri(Platform.script.resolve(directory));
+ await checkTests(dataDir, const CodegenDataComputer(),
+ forUserLibrariesOnly: true,
+ args: args,
+ options: options,
+ testedConfigs: allInternalConfigs,
+ skip: skip,
+ shardIndex: shardIndex ?? 0,
+ shards: shardIndex == null ? 1 : shards);
+ });
+}
+
+class CodegenDataComputer extends DataComputer<String> {
+ const CodegenDataComputer();
+
+ /// Compute generated code for [member].
+ ///
+ /// Fills [actualMap] with the data.
+ @override
+ void computeMemberData(Compiler compiler, MemberEntity member,
+ Map<Id, ActualData<String>> actualMap,
+ {bool verbose: false}) {
+ JsClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
+ JsToElementMap elementMap = closedWorld.elementMap;
+ MemberDefinition definition = elementMap.getMemberDefinition(member);
+ CodegenIrComputer(compiler.reporter, actualMap, elementMap, member,
+ compiler.backendStrategy, closedWorld.closureDataLookup)
+ .run(definition.node);
+ }
+
+ @override
+ DataInterpreter<String> get dataValidator => const CodeDataInterpreter();
+}
+
+/// AST visitor for computing codegen data for a member.
+class CodegenIrComputer extends IrDataExtractor<String> {
+ final JsBackendStrategy _backendStrategy;
+ final JsToElementMap _elementMap;
+ final ClosureData _closureDataLookup;
+
+ CodegenIrComputer(
+ DiagnosticReporter reporter,
+ Map<Id, ActualData<String>> actualMap,
+ this._elementMap,
+ MemberEntity member,
+ this._backendStrategy,
+ this._closureDataLookup)
+ : super(reporter, actualMap);
+
+ String getMemberValue(MemberEntity member) {
+ if (member is FunctionEntity) {
+ return _backendStrategy.getGeneratedCodeForTesting(member);
+ }
+ return null;
+ }
+
+ @override
+ String computeMemberValue(Id id, ir.Member node) {
+ return getMemberValue(_elementMap.getMember(node));
+ }
+
+ @override
+ String computeNodeValue(Id id, ir.TreeNode node) {
+ if (node is ir.FunctionExpression || node is ir.FunctionDeclaration) {
+ ClosureRepresentationInfo info = _closureDataLookup.getClosureInfo(node);
+ return getMemberValue(info.callMethod);
+ }
+ return null;
+ }
+}
+
+/// Default data interpreter for string data representing compiled JavaScript
+/// code.
+///
+/// The data annotation reader strips out newlines and indentation so the
+/// comparison needs to compensate.
+///
+/// The special data annotation `ignore` always passes, so we don't have to
+/// track uninteresting code like a 'main' program.
+class CodeDataInterpreter implements DataInterpreter<String> {
+ const CodeDataInterpreter();
+
+ String _clean(String code) => code.replaceAll(_re, '');
+ static RegExp _re = RegExp(r'[\n\r]\s*');
+
+ @override
+ String isAsExpected(String actualData, String expectedData) {
+ actualData ??= '';
+ expectedData ??= '';
+ if (expectedData == 'ignore') return null;
+ if (_clean(actualData) != _clean(expectedData)) {
+ return 'Expected $expectedData, found $actualData';
+ }
+ return null;
+ }
+
+ @override
+ bool isEmpty(String actualData) {
+ return _clean(actualData) == '';
+ }
+
+ @override
+ String getText(String actualData, [String indentation]) {
+ return actualData;
+ }
+}
diff --git a/pkg/compiler/test/codegen/data/array_add.dart b/pkg/compiler/test/codegen/data/array_add.dart
new file mode 100644
index 0000000..9f2cb1ad
--- /dev/null
+++ b/pkg/compiler/test/codegen/data/array_add.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2020, 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.
+
+// In prod mode, List.add is lowered to Array.push.
+//
+// TODO(sra): Lower when type of input does not need a generic covariant check.
+@pragma('dart2js:noInline')
+/*spec.member: test1:function() {
+ var t1 = H.setRuntimeTypeInfo([], type$.JSArray_int);
+ C.JSArray_methods.add$1(t1, 1);
+ return t1;
+}*/
+/*prod.member: test1:function() {
+ var t1 = [];
+ t1.push(1);
+ return t1;
+}*/
+test1() {
+ return <int>[]..add(1);
+}
+
+/*member: main:function() {
+ F.test1();
+}*/
+main() {
+ test1();
+}
diff --git a/pkg/compiler/test/codegen/data/codeUnitAt_folding.dart b/pkg/compiler/test/codegen/data/codeUnitAt_folding.dart
new file mode 100644
index 0000000..f898183
--- /dev/null
+++ b/pkg/compiler/test/codegen/data/codeUnitAt_folding.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2020, 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.
+
+@pragma('dart2js:noInline')
+/*member: foo1:function() {
+ return 72;
+}*/
+foo1() {
+ var a = 'Hello';
+ var b = 0;
+ return a.codeUnitAt(b);
+ // Constant folds to 'return 72;'
+}
+
+@pragma('dart2js:noInline')
+/*spec.member: foo2:function() {
+ return C.JSString_methods.codeUnitAt$1("Hello", H._asInt(1.5));
+}*/
+/*prod.member: foo2:function() {
+ return C.JSString_methods.codeUnitAt$1("Hello", 1.5);
+}*/
+foo2() {
+ var a = 'Hello';
+ dynamic b = 1.5;
+ return a.codeUnitAt(b);
+ // No folding of index type error.
+}
+
+@pragma('dart2js:noInline')
+/*member: foo3:function() {
+ return C.JSString_methods._codeUnitAt$1("Hello", 55);
+}*/
+foo3() {
+ var a = 'Hello';
+ dynamic b = 55;
+ return a.codeUnitAt(b);
+ // No folding of index range error.
+}
+
+/*member: main:ignore*/
+main() {
+ foo1();
+ foo2();
+ foo3();
+}
diff --git a/pkg/compiler/test/codegen/data/marker.options b/pkg/compiler/test/codegen/data/marker.options
new file mode 100644
index 0000000..a1cab2b
--- /dev/null
+++ b/pkg/compiler/test/codegen/data/marker.options
@@ -0,0 +1,2 @@
+spec=pkg/compiler/test/codegen/codegen_test_helper.dart
+prod=pkg/compiler/test/codegen/codegen_test_helper.dart
diff --git a/pkg/compiler/test/codegen/data/tdiv1.dart b/pkg/compiler/test/codegen/data/tdiv1.dart
new file mode 100644
index 0000000..554e0c6
--- /dev/null
+++ b/pkg/compiler/test/codegen/data/tdiv1.dart
@@ -0,0 +1,98 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+//@dart=2.10
+
+/*member: main:ignore*/
+void main() {
+ for (var a in [false, true]) {
+ sink = foo1(a);
+ sink = foo2(a);
+ sink = foo3(a);
+ sink = foo4(a, 2);
+ sink = foo4(a, 10);
+
+ for (var b in [false, true]) {
+ sink = foo5(a, b);
+ sink = foo_regress_37502(a, b);
+ }
+ }
+}
+
+Object? sink;
+
+@pragma('dart2js:noInline')
+/*member: foo1:function(param) {
+ return (param ? 4294967295 : 1) / 2 | 0;
+}*/
+int foo1(bool param) {
+ var a = param ? 0xFFFFFFFF : 1;
+ return a ~/ 2;
+ // Above can be compiled to division followed by truncate.
+ // present: ' / 2 | 0'
+}
+
+@pragma('dart2js:noInline')
+/*member: foo2:function(param) {
+ return (param ? 4294967295 : 1) / 3 | 0;
+}*/
+int foo2(bool param) {
+ var a = param ? 0xFFFFFFFF : 1;
+ return a ~/ 3;
+ // Above can be compiled to division followed by truncate.
+ // present: ' / 3 | 0'
+}
+
+@pragma('dart2js:noInline')
+/*member: foo3:function(param) {
+ return C.JSInt_methods._tdivFast$1(param ? 4294967295 : -1, 2);
+}*/
+int foo3(bool param) {
+ var a = param ? 0xFFFFFFFF : -1;
+ return a ~/ 2;
+ // Potentially negative inputs go via '_tdivFast' fast helper.
+ // present: '_tdivFast'
+}
+
+@pragma('dart2js:noInline')
+/*member: foo4:function(param1, param2) {
+ return C.JSInt_methods.$tdiv(param1 ? 4294967295 : 0, param2);
+}*/
+int foo4(bool param1, int param2) {
+ var a = param1 ? 0xFFFFFFFF : 0;
+ return a ~/ param2;
+ // Unknown divisor goes via full implementation.
+ // present: '$tdiv'
+ // absent: '/'
+}
+
+@pragma('dart2js:noInline')
+/*member: foo5:function(param1, param2) {
+ var a = param1 ? 4294967295 : 0;
+ return C.JSInt_methods.$tdiv(a, param2 ? 3 : 4);
+}*/
+int foo5(bool param1, bool param2) {
+ var a = param1 ? 0xFFFFFFFF : 0;
+ var b = param2 ? 3 : 4;
+ return a ~/ b;
+ // We could optimize this with range analysis, but type inference summarizes
+ // '3 or 4' to uint31, which is not >= 2.
+ // present: '$tdiv'
+ // absent: '/'
+}
+
+@pragma('dart2js:noInline')
+/*member: foo_regress_37502:function(param1, param2) {
+ var a = param1 ? 1.2 : 12.3;
+ return C.JSInt_methods.gcd$1(C.JSDouble_methods.$tdiv(a, param2 ? 3.14 : 2.81), 2);
+}*/
+foo_regress_37502(param1, param2) {
+ var a = param1 ? 1.2 : 12.3;
+ var b = param2 ? 3.14 : 2.81;
+ return (a ~/ b).gcd(2);
+ // The result of ~/ is int; gcd is defined only on int and is too complex
+ // to be inlined.
+ //
+ // present: 'JSInt_methods.gcd'
+}
diff --git a/pkg/compiler/test/codegen/data/unused_empty_map.dart b/pkg/compiler/test/codegen/data/unused_empty_map.dart
new file mode 100644
index 0000000..d9e0363
--- /dev/null
+++ b/pkg/compiler/test/codegen/data/unused_empty_map.dart
@@ -0,0 +1,58 @@
+// Copyright (c) 2020, 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.
+
+@pragma('dart2js:noInline')
+// No code to construct unused map.
+/*member: foo1:function() {
+ return;
+}*/
+void foo1() {
+ var x = {};
+ return;
+}
+
+@pragma('dart2js:noInline')
+// No code to construct unused maps.
+/*member: foo2:function() {
+ return;
+}*/
+void foo2() {
+ var x = {};
+ var y = <String, String>{};
+ return;
+}
+
+@pragma('dart2js:noInline')
+// No code to construct maps which become unused after list is removed.
+/*member: foo3:function() {
+ return;
+}*/
+void foo3() {
+ var x = [{}, {}];
+ return;
+}
+
+@pragma('dart2js:noInline')
+// Constructor is inlined, allocation is removed, leaving maps unused.
+/*member: foo4:function() {
+ return;
+}*/
+void foo4() {
+ var x = AAA4({});
+ return;
+}
+
+class AAA4 {
+ Map<String, String> field1 = {};
+ Map<String, int> field2;
+ AAA4(this.field2);
+}
+
+/*member: main:ignore*/
+main() {
+ foo1();
+ foo2();
+ foo3();
+ foo4();
+}
diff --git a/pkg/compiler/test/codegen/data_2/marker.options b/pkg/compiler/test/codegen/data_2/marker.options
new file mode 100644
index 0000000..a1cab2b
--- /dev/null
+++ b/pkg/compiler/test/codegen/data_2/marker.options
@@ -0,0 +1,2 @@
+spec=pkg/compiler/test/codegen/codegen_test_helper.dart
+prod=pkg/compiler/test/codegen/codegen_test_helper.dart
diff --git a/pkg/compiler/test/codegen/data_2/tdiv1.dart b/pkg/compiler/test/codegen/data_2/tdiv1.dart
new file mode 100644
index 0000000..d180327
--- /dev/null
+++ b/pkg/compiler/test/codegen/data_2/tdiv1.dart
@@ -0,0 +1,118 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart = 2.7
+
+/*member: main:ignore*/
+void main() {
+ for (var a in [false, true]) {
+ sink = foo1(a);
+ sink = foo2(a);
+ sink = foo3(a);
+ sink = foo4(a, 2);
+ sink = foo4(a, 10);
+
+ for (var b in [false, true]) {
+ sink = foo5(a, b);
+ sink = foo_regress_37502(a, b);
+ }
+ }
+}
+
+Object sink;
+
+@pragma('dart2js:noInline')
+/*spec.member: foo1:function(param) {
+ return (H.boolConversionCheck(param) ? 4294967295 : 1) / 2 | 0;
+}*/
+/*prod.member: foo1:function(param) {
+ return (param ? 4294967295 : 1) / 2 | 0;
+}*/
+int foo1(bool param) {
+ var a = param ? 0xFFFFFFFF : 1;
+ return a ~/ 2;
+ // Above can be compiled to division followed by truncate.
+ // present: ' / 2 | 0'
+}
+
+@pragma('dart2js:noInline')
+/*spec.member: foo2:function(param) {
+ return (H.boolConversionCheck(param) ? 4294967295 : 1) / 3 | 0;
+}*/
+/*prod.member: foo2:function(param) {
+ return (param ? 4294967295 : 1) / 3 | 0;
+}*/
+int foo2(bool param) {
+ var a = param ? 0xFFFFFFFF : 1;
+ return a ~/ 3;
+ // Above can be compiled to division followed by truncate.
+ // present: ' / 3 | 0'
+}
+
+@pragma('dart2js:noInline')
+/*spec.member: foo3:function(param) {
+ return C.JSInt_methods._tdivFast$1(H.boolConversionCheck(param) ? 4294967295 : -1, 2);
+}*/
+/*prod.member: foo3:function(param) {
+ return C.JSInt_methods._tdivFast$1(param ? 4294967295 : -1, 2);
+}*/
+int foo3(bool param) {
+ var a = param ? 0xFFFFFFFF : -1;
+ return a ~/ 2;
+ // Potentially negative inputs go via '_tdivFast' fast helper.
+ // present: '_tdivFast'
+}
+
+@pragma('dart2js:noInline')
+/*spec.member: foo4:function(param1, param2) {
+ return C.JSInt_methods.$tdiv(H.boolConversionCheck(param1) ? 4294967295 : 0, param2);
+}*/
+/*prod.member: foo4:function(param1, param2) {
+ return C.JSInt_methods.$tdiv(param1 ? 4294967295 : 0, param2);
+}*/
+int foo4(bool param1, int param2) {
+ var a = param1 ? 0xFFFFFFFF : 0;
+ return a ~/ param2;
+ // Unknown divisor goes via full implementation.
+ // present: '$tdiv'
+ // absent: '/'
+}
+
+@pragma('dart2js:noInline')
+/*spec.member: foo5:function(param1, param2) {
+ var a = H.boolConversionCheck(param1) ? 4294967295 : 0;
+ return C.JSInt_methods.$tdiv(a, H.boolConversionCheck(param2) ? 3 : 4);
+}*/
+/*prod.member: foo5:function(param1, param2) {
+ var a = param1 ? 4294967295 : 0;
+ return C.JSInt_methods.$tdiv(a, param2 ? 3 : 4);
+}*/
+int foo5(bool param1, bool param2) {
+ var a = param1 ? 0xFFFFFFFF : 0;
+ var b = param2 ? 3 : 4;
+ return a ~/ b;
+ // We could optimize this with range analysis, but type inference summarizes
+ // '3 or 4' to uint31, which is not >= 2.
+ // present: '$tdiv'
+ // absent: '/'
+}
+
+@pragma('dart2js:noInline')
+/*spec.member: foo_regress_37502:function(param1, param2) {
+ var a = H.boolConversionCheck(param1) ? 1.2 : 12.3;
+ return C.JSInt_methods.gcd$1(C.JSDouble_methods.$tdiv(a, H.boolConversionCheck(param2) ? 3.14 : 2.81), 2);
+}*/
+/*prod.member: foo_regress_37502:function(param1, param2) {
+ var a = param1 ? 1.2 : 12.3;
+ return C.JSInt_methods.gcd$1(C.JSDouble_methods.$tdiv(a, param2 ? 3.14 : 2.81), 2);
+}*/
+foo_regress_37502(param1, param2) {
+ var a = param1 ? 1.2 : 12.3;
+ var b = param2 ? 3.14 : 2.81;
+ return (a ~/ b).gcd(2);
+ // The result of ~/ is int; gcd is defined only on int and is too complex
+ // to be inlined.
+ //
+ // present: 'JSInt_methods.gcd'
+}
diff --git a/pkg/compiler/test/codegen/data_2/unused_empty_map.dart b/pkg/compiler/test/codegen/data_2/unused_empty_map.dart
new file mode 100644
index 0000000..d9e0363
--- /dev/null
+++ b/pkg/compiler/test/codegen/data_2/unused_empty_map.dart
@@ -0,0 +1,58 @@
+// Copyright (c) 2020, 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.
+
+@pragma('dart2js:noInline')
+// No code to construct unused map.
+/*member: foo1:function() {
+ return;
+}*/
+void foo1() {
+ var x = {};
+ return;
+}
+
+@pragma('dart2js:noInline')
+// No code to construct unused maps.
+/*member: foo2:function() {
+ return;
+}*/
+void foo2() {
+ var x = {};
+ var y = <String, String>{};
+ return;
+}
+
+@pragma('dart2js:noInline')
+// No code to construct maps which become unused after list is removed.
+/*member: foo3:function() {
+ return;
+}*/
+void foo3() {
+ var x = [{}, {}];
+ return;
+}
+
+@pragma('dart2js:noInline')
+// Constructor is inlined, allocation is removed, leaving maps unused.
+/*member: foo4:function() {
+ return;
+}*/
+void foo4() {
+ var x = AAA4({});
+ return;
+}
+
+class AAA4 {
+ Map<String, String> field1 = {};
+ Map<String, int> field2;
+ AAA4(this.field2);
+}
+
+/*member: main:ignore*/
+main() {
+ foo1();
+ foo2();
+ foo3();
+ foo4();
+}
diff --git a/pkg/compiler/testing.json b/pkg/compiler/testing.json
index 71e5988..df10340 100644
--- a/pkg/compiler/testing.json
+++ b/pkg/compiler/testing.json
@@ -14,6 +14,7 @@
"exclude": [
"^pkg/compiler/test/.*/data/.*",
+ "^pkg/compiler/test/.*/data_2/.*",
"^pkg/compiler/test/.*/model_data/.*",
"^pkg/compiler/test/deferred_loading/libs/.*",
"^pkg/compiler/test/sourcemaps/stacktrace/extension_method.dart"
diff --git a/pkg/dartdev/lib/src/commands/fix.dart b/pkg/dartdev/lib/src/commands/fix.dart
index 990da09..8a360e7 100644
--- a/pkg/dartdev/lib/src/commands/fix.dart
+++ b/pkg/dartdev/lib/src/commands/fix.dart
@@ -43,8 +43,8 @@
usageException("Directory doesn't exist: ${dir.path}");
}
- var progress =
- log.progress('Computing fixes in ${path.basename(dir.path)}');
+ var progress = log.progress(
+ 'Computing fixes in ${path.basename(path.canonicalize(dir.path))}');
var server = AnalysisServer(
io.Directory(sdk.sdkPath),
diff --git a/pkg/front_end/lib/src/api_prototype/compiler_options.dart b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
index 7914ed3..564b09e 100644
--- a/pkg/front_end/lib/src/api_prototype/compiler_options.dart
+++ b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
@@ -184,6 +184,9 @@
/// Errors are reported via the [onDiagnostic] callback.
bool verify = false;
+ /// Whether to - if verifying - skip the platform.
+ bool verifySkipPlatform = false;
+
/// Whether to dump generated components in a text format (also mainly for
/// debugging).
///
@@ -305,6 +308,7 @@
}
if (!ignoreVerify) {
if (verify != other.verify) return false;
+ if (verifySkipPlatform != other.verifySkipPlatform) return false;
}
if (!ignoreDebugDump) {
if (debugDump != other.debugDump) return false;
diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
index c3b0dc7..de7521d 100644
--- a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
+++ b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
@@ -202,6 +202,12 @@
"native_stack_traces": {
ExperimentalFlag.nonNullable,
},
+ "observatory": {
+ ExperimentalFlag.nonNullable,
+ },
+ "observatory_test_package": {
+ ExperimentalFlag.nonNullable,
+ },
"path": {
ExperimentalFlag.nonNullable,
},
diff --git a/pkg/front_end/lib/src/base/command_line_options.dart b/pkg/front_end/lib/src/base/command_line_options.dart
index 9640a43..3f5b1ce 100644
--- a/pkg/front_end/lib/src/base/command_line_options.dart
+++ b/pkg/front_end/lib/src/base/command_line_options.dart
@@ -40,5 +40,6 @@
static const String singleRootScheme = "--single-root-scheme";
static const String verbose = "--verbose";
static const String verify = "--verify";
+ static const String verifySkipPlatform = "--verify-skip-platform";
static const String warnOnReachabilityCheck = "--warn-on-reachability-check";
}
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 1c158cd..2e20ff0 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -165,6 +165,8 @@
bool get verify => _raw.verify;
+ bool get verifySkipPlatform => _raw.verifySkipPlatform;
+
bool get debugDump => _raw.debugDump;
bool get omitPlatform => _raw.omitPlatform;
diff --git a/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart b/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart
index 7b8b992..9868a51 100644
--- a/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart
@@ -33,7 +33,6 @@
import '../builder/type_alias_builder.dart';
import '../builder/type_builder.dart';
import '../builder/type_declaration_builder.dart';
-import '../builder/type_variable_builder.dart';
import '../loader.dart' show Loader;
@@ -2402,29 +2401,6 @@
return result ?? supertypes;
}
- List<TypeBuilder> computeDefaultTypeArguments(TypeBuilder type) {
- TypeDeclarationBuilder decl = type.declaration;
- List<TypeVariableBuilder> typeVariables;
- LibraryBuilder library;
- if (decl is TypeAliasBuilder) {
- typeVariables = decl.typeVariables;
- library = decl.library;
- } else if (decl is ClassBuilder) {
- typeVariables = decl.typeVariables;
- library = decl.library;
- } else {
- return unhandled("${decl.runtimeType}", "$decl", classBuilder.charOffset,
- classBuilder.fileUri);
- }
- List<TypeBuilder> result = new List<TypeBuilder>(typeVariables.length);
- for (int i = 0; i < result.length; ++i) {
- TypeVariableBuilder tv = typeVariables[i];
- result[i] = tv.defaultType ??
- library.loader.computeTypeBuilder(tv.parameter.defaultType);
- }
- return result;
- }
-
void addInterface(List<Supertype> interfaces, List<Supertype> superclasses,
Supertype type) {
if (type == null) return null;
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
index 6f9a38e..06237ec 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
@@ -560,7 +560,8 @@
static Generator make(ExpressionGeneratorHelper helper, Token token,
Expression receiver, Name name, bool isNullAware) {
if (helper.forest.isThisExpression(receiver)) {
- return new ThisPropertyAccessGenerator(helper, token, name);
+ return new ThisPropertyAccessGenerator(helper, token, name,
+ thisOffset: receiver.fileOffset, isNullAware: isNullAware);
} else {
return isNullAware
? new NullAwarePropertyAccessGenerator(helper, token, receiver, name)
@@ -603,8 +604,13 @@
/// documentation.
final Name name;
+ /// The offset of `this` if explicit. Otherwise `null`.
+ final int thisOffset;
+ final bool isNullAware;
+
ThisPropertyAccessGenerator(
- ExpressionGeneratorHelper helper, Token token, this.name)
+ ExpressionGeneratorHelper helper, Token token, this.name,
+ {this.thisOffset, this.isNullAware: false})
: super(helper, token);
@override
@@ -613,18 +619,30 @@
@override
String get _plainNameForRead => name.text;
+ void _reportNonNullableInNullAwareWarningIfNeeded() {
+ if (isNullAware && _helper.libraryBuilder.isNonNullableByDefault) {
+ _helper.libraryBuilder.addProblem(
+ messageThisInNullAwareReceiver,
+ thisOffset ?? fileOffset,
+ thisOffset != null ? 4 : noLength,
+ _helper.uri);
+ }
+ }
+
@override
Expression buildSimpleRead() {
return _createRead();
}
Expression _createRead() {
+ _reportNonNullableInNullAwareWarningIfNeeded();
return _forest.createPropertyGet(
fileOffset, _forest.createThisExpression(fileOffset), name);
}
@override
Expression buildAssignment(Expression value, {bool voidContext: false}) {
+ _reportNonNullableInNullAwareWarningIfNeeded();
return _createWrite(fileOffset, value, forEffect: voidContext);
}
@@ -649,6 +667,7 @@
bool voidContext: false,
bool isPreIncDec: false,
bool isPostIncDec: false}) {
+ _reportNonNullableInNullAwareWarningIfNeeded();
_helper.forest.createBinary(
offset,
_forest.createPropertyGet(
@@ -672,6 +691,7 @@
return buildCompoundAssignment(binaryOperator, value,
offset: offset, voidContext: voidContext, isPostIncDec: true);
}
+ _reportNonNullableInNullAwareWarningIfNeeded();
VariableDeclaration read = _helper.forest.createVariableDeclarationForValue(
_forest.createPropertyGet(
fileOffset, _forest.createThisExpression(fileOffset), name));
@@ -1096,7 +1116,8 @@
{bool isNullAware}) {
assert(isNullAware != null);
if (helper.forest.isThisExpression(receiver)) {
- return new ThisIndexedAccessGenerator(helper, token, index);
+ return new ThisIndexedAccessGenerator(helper, token, index,
+ thisOffset: receiver.fileOffset, isNullAware: isNullAware);
} else {
return new IndexedAccessGenerator(helper, token, receiver, index,
isNullAware: isNullAware);
@@ -1109,8 +1130,12 @@
class ThisIndexedAccessGenerator extends Generator {
final Expression index;
+ final int thisOffset;
+ final bool isNullAware;
+
ThisIndexedAccessGenerator(
- ExpressionGeneratorHelper helper, Token token, this.index)
+ ExpressionGeneratorHelper helper, Token token, this.index,
+ {this.thisOffset, this.isNullAware: false})
: super(helper, token);
@override
@@ -1119,14 +1144,26 @@
@override
String get _debugName => "ThisIndexedAccessGenerator";
+ void _reportNonNullableInNullAwareWarningIfNeeded() {
+ if (isNullAware && _helper.libraryBuilder.isNonNullableByDefault) {
+ _helper.libraryBuilder.addProblem(
+ messageThisInNullAwareReceiver,
+ thisOffset ?? fileOffset,
+ thisOffset != null ? 4 : noLength,
+ _helper.uri);
+ }
+ }
+
@override
Expression buildSimpleRead() {
+ _reportNonNullableInNullAwareWarningIfNeeded();
Expression receiver = _helper.forest.createThisExpression(fileOffset);
return _forest.createIndexGet(fileOffset, receiver, index);
}
@override
Expression buildAssignment(Expression value, {bool voidContext: false}) {
+ _reportNonNullableInNullAwareWarningIfNeeded();
Expression receiver = _helper.forest.createThisExpression(fileOffset);
return _forest.createIndexSet(fileOffset, receiver, index, value,
forEffect: voidContext, readOnlyReceiver: true);
@@ -1135,6 +1172,7 @@
@override
Expression buildIfNullAssignment(Expression value, DartType type, int offset,
{bool voidContext: false}) {
+ _reportNonNullableInNullAwareWarningIfNeeded();
Expression receiver = _helper.forest.createThisExpression(fileOffset);
return new IfNullIndexSet(receiver, index, value,
readOffset: fileOffset,
@@ -1150,6 +1188,7 @@
bool voidContext: false,
bool isPreIncDec: false,
bool isPostIncDec: false}) {
+ _reportNonNullableInNullAwareWarningIfNeeded();
Expression receiver = _helper.forest.createThisExpression(fileOffset);
return new CompoundIndexSet(receiver, index, binaryOperator, value,
readOffset: fileOffset,
@@ -1348,8 +1387,13 @@
/// without a corresponding setter.
final Member writeTarget;
+ /// The offset of the type name if explicit. Otherwise `null`.
+ final int typeOffset;
+ final bool isNullAware;
+
StaticAccessGenerator(ExpressionGeneratorHelper helper, Token token,
- this.targetName, this.readTarget, this.writeTarget)
+ this.targetName, this.readTarget, this.writeTarget,
+ {this.typeOffset, this.isNullAware: false})
: assert(targetName != null),
assert(readTarget != null || writeTarget != null),
super(helper, token);
@@ -1359,9 +1403,23 @@
String targetName,
Token token,
MemberBuilder getterBuilder,
- MemberBuilder setterBuilder) {
+ MemberBuilder setterBuilder,
+ {int typeOffset,
+ bool isNullAware: false}) {
return new StaticAccessGenerator(helper, token, targetName,
- getterBuilder?.readTarget, setterBuilder?.writeTarget);
+ getterBuilder?.readTarget, setterBuilder?.writeTarget,
+ typeOffset: typeOffset, isNullAware: isNullAware);
+ }
+
+ void _reportNonNullableInNullAwareWarningIfNeeded() {
+ if (isNullAware && _helper.libraryBuilder.isNonNullableByDefault) {
+ String className = (readTarget ?? writeTarget).enclosingClass.name;
+ _helper.libraryBuilder.addProblem(
+ templateClassInNullAwareReceiver.withArguments(className),
+ typeOffset ?? fileOffset,
+ typeOffset != null ? className.length : noLength,
+ _helper.uri);
+ }
}
@override
@@ -1380,6 +1438,7 @@
if (readTarget == null) {
read = _makeInvalidRead();
} else {
+ _reportNonNullableInNullAwareWarningIfNeeded();
read = _helper.makeStaticGet(readTarget, token);
}
return read;
@@ -1387,6 +1446,7 @@
@override
Expression buildAssignment(Expression value, {bool voidContext = false}) {
+ _reportNonNullableInNullAwareWarningIfNeeded();
return _createWrite(fileOffset, value);
}
@@ -1395,6 +1455,7 @@
if (writeTarget == null) {
write = _makeInvalidWrite(value);
} else {
+ _reportNonNullableInNullAwareWarningIfNeeded();
write = new StaticSet(writeTarget, value)..fileOffset = offset;
}
return write;
@@ -3043,10 +3104,6 @@
@override
buildPropertyAccess(
IncompleteSendGenerator send, int operatorOffset, bool isNullAware) {
- // `SomeType?.toString` is the same as `SomeType.toString`, not
- // `(SomeType).toString`.
- isNullAware = false;
-
Name name = send.name;
Arguments arguments = send.arguments;
@@ -3107,7 +3164,9 @@
name.text,
send.token,
member is MemberBuilder ? member : null,
- setter is MemberBuilder ? setter : null);
+ setter is MemberBuilder ? setter : null,
+ typeOffset: fileOffset,
+ isNullAware: isNullAware);
}
return arguments == null
@@ -3116,6 +3175,8 @@
offsetForToken(send.token), send.typeArguments, arguments,
isTypeArgumentsInForest: send.isTypeArgumentsInForest);
} else {
+ // `SomeType?.toString` is the same as `SomeType.toString`, not
+ // `(SomeType).toString`.
return super.buildPropertyAccess(send, operatorOffset, isNullAware);
}
}
@@ -4132,6 +4193,13 @@
];
}
+ void _reportNonNullableInNullAwareWarningIfNeeded() {
+ if (_helper.libraryBuilder.isNonNullableByDefault) {
+ _helper.libraryBuilder.addProblem(
+ messageThisInNullAwareReceiver, fileOffset, 4, _helper.uri);
+ }
+ }
+
buildPropertyAccess(
IncompleteSendGenerator send, int operatorOffset, bool isNullAware) {
Name name = send.name;
@@ -4150,6 +4218,9 @@
if (send is SendAccessGenerator) {
// Notice that 'this' or 'super' can't be null. So we can ignore the
// value of [isNullAware].
+ if (isNullAware) {
+ _reportNonNullableInNullAwareWarningIfNeeded();
+ }
return _helper.buildMethodInvocation(
_forest.createThisExpression(fileOffset),
name,
@@ -4173,7 +4244,9 @@
_helper,
// TODO(ahe): This is not the 'this' token.
send.token,
- name);
+ name,
+ thisOffset: fileOffset,
+ isNullAware: isNullAware);
}
}
}
@@ -4313,7 +4386,8 @@
_helper.lookupInstanceMember(indexGetName, isSuper: true),
_helper.lookupInstanceMember(indexSetName, isSuper: true));
} else {
- return new ThisIndexedAccessGenerator(_helper, token, index);
+ return new ThisIndexedAccessGenerator(_helper, token, index,
+ thisOffset: fileOffset, isNullAware: isNullAware);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
index e5d4c71..7d827d0 100644
--- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
@@ -1165,21 +1165,26 @@
DartType inferredType = inferrer.typeSchemaEnvironment
.getStandardUpperBound(nonNullableLhsType, rhsResult.inferredType,
inferrer.library.library);
- VariableDeclaration variable =
- createVariable(lhsResult.expression, lhsResult.inferredType);
- MethodInvocation equalsNull = createEqualsNull(
- lhsResult.expression.fileOffset,
- createVariableGet(variable),
- equalsMember);
- VariableGet variableGet = createVariableGet(variable);
- if (inferrer.library.isNonNullableByDefault &&
- !identical(nonNullableLhsType, originalLhsType)) {
- variableGet.promotedType = nonNullableLhsType;
+ Expression replacement;
+ if (lhsResult.expression is ThisExpression) {
+ replacement = lhsResult.expression;
+ } else {
+ VariableDeclaration variable =
+ createVariable(lhsResult.expression, lhsResult.inferredType);
+ MethodInvocation equalsNull = createEqualsNull(
+ lhsResult.expression.fileOffset,
+ createVariableGet(variable),
+ equalsMember);
+ VariableGet variableGet = createVariableGet(variable);
+ if (inferrer.library.isNonNullableByDefault &&
+ !identical(nonNullableLhsType, originalLhsType)) {
+ variableGet.promotedType = nonNullableLhsType;
+ }
+ ConditionalExpression conditional = new ConditionalExpression(
+ equalsNull, rhsResult.expression, variableGet, inferredType);
+ replacement = new Let(variable, conditional)
+ ..fileOffset = node.fileOffset;
}
- ConditionalExpression conditional = new ConditionalExpression(
- equalsNull, rhsResult.expression, variableGet, inferredType);
- Expression replacement = new Let(variable, conditional)
- ..fileOffset = node.fileOffset;
return new ExpressionInferenceResult(inferredType, replacement);
}
@@ -5704,15 +5709,15 @@
node.isImplicitlyTyped ? const UnknownType() : node.type;
DartType inferredType;
ExpressionInferenceResult initializerResult;
- inferrer.flowAnalysis.declare(node, node.initializer != null);
+ inferrer.flowAnalysis.declare(node, node.hasDeclaredInitializer);
if (node.initializer != null) {
- if (node.isLate) {
+ if (node.isLate && node.hasDeclaredInitializer) {
inferrer.flowAnalysis.lateInitializer_begin(node);
}
initializerResult = inferrer.inferExpression(node.initializer,
declaredType, !inferrer.isTopLevel || node.isImplicitlyTyped,
isVoidAllowed: true);
- if (node.isLate) {
+ if (node.isLate && node.hasDeclaredInitializer) {
inferrer.flowAnalysis.lateInitializer_end();
}
inferredType = inferrer.inferDeclarationType(
diff --git a/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart b/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
index 2ed8f56..5fdaeb3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
@@ -1378,6 +1378,11 @@
final bool isImplicitlyTyped;
/// True if the initializer was specified by the programmer.
+ ///
+ /// Note that the variable might have a synthesized initializer expression,
+ /// so `hasDeclaredInitializer == false` doesn't imply `initializer == null`.
+ /// For instance, for duplicate variable names, an invalid expression is set
+ /// as the initializer of the second variable.
final bool hasDeclaredInitializer;
// TODO(ahe): Remove this field. We can get rid of it by recording closure
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 19f16db..af96c7f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -53,7 +53,6 @@
show ChangedStructureNotifier;
import 'package:kernel/target/targets.dart' show DiagnosticReporter;
import 'package:kernel/type_environment.dart' show TypeEnvironment;
-import 'package:kernel/verifier.dart' show verifyGetStaticType;
import 'package:kernel/transformations/value_class.dart' as valueClass;
@@ -130,7 +129,7 @@
import 'metadata_collector.dart' show MetadataCollector;
-import 'verifier.dart' show verifyComponent;
+import 'verifier.dart' show verifyComponent, verifyGetStaticType;
class KernelTarget extends TargetImplementation {
/// The [FileSystem] which should be used to access files.
@@ -1221,14 +1220,16 @@
void verify() {
// TODO(ahe): How to handle errors.
- verifyComponent(component);
+ verifyComponent(component,
+ skipPlatform: context.options.verifySkipPlatform);
ClassHierarchy hierarchy =
new ClassHierarchy(component, new CoreTypes(component),
onAmbiguousSupertypes: (Class cls, Supertype a, Supertype b) {
// An error has already been reported.
});
verifyGetStaticType(
- new TypeEnvironment(loader.coreTypes, hierarchy), component);
+ new TypeEnvironment(loader.coreTypes, hierarchy), component,
+ skipPlatform: context.options.verifySkipPlatform);
ticker.logMs("Verified component");
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart b/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart
index 0aea072..28ac4f2 100644
--- a/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart
@@ -155,7 +155,7 @@
}
for (int i = 0; i < namedParameters.length; i++) {
NamedType parameter = namedParameters[i];
- TypeBuilder type = positionalParameters[i].accept(this);
+ TypeBuilder type = parameter.type.accept(this);
formals[i + positionalParameters.length] = new FormalParameterBuilder(
null, 0, type, parameter.name, null, -1, null)
..kind = FormalParameterKind.optionalNamed;
diff --git a/pkg/front_end/lib/src/fasta/kernel/verifier.dart b/pkg/front_end/lib/src/fasta/kernel/verifier.dart
index 3f0877b..3bc4b4c 100644
--- a/pkg/front_end/lib/src/fasta/kernel/verifier.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/verifier.dart
@@ -12,7 +12,10 @@
import 'package:kernel/transformations/flags.dart' show TransformerFlag;
-import 'package:kernel/verifier.dart' show VerifyingVisitor;
+import 'package:kernel/type_environment.dart' show TypeEnvironment;
+
+import 'package:kernel/verifier.dart'
+ show VerifyGetStaticType, VerifyingVisitor;
import '../compiler_context.dart' show CompilerContext;
@@ -404,3 +407,23 @@
exitTreeNode(node);
}
}
+
+void verifyGetStaticType(TypeEnvironment env, Component component,
+ {bool skipPlatform: false}) {
+ component.accept(new FastaVerifyGetStaticType(env, skipPlatform));
+}
+
+class FastaVerifyGetStaticType extends VerifyGetStaticType {
+ final bool skipPlatform;
+
+ FastaVerifyGetStaticType(TypeEnvironment env, this.skipPlatform) : super(env);
+
+ @override
+ visitLibrary(Library node) {
+ if (skipPlatform && node.importUri.scheme == 'dart') {
+ return;
+ }
+
+ super.visitLibrary(node);
+ }
+}
diff --git a/pkg/front_end/lib/widget_cache.dart b/pkg/front_end/lib/widget_cache.dart
index 158125b..06cdb6a 100644
--- a/pkg/front_end/lib/widget_cache.dart
+++ b/pkg/front_end/lib/widget_cache.dart
@@ -14,7 +14,7 @@
WidgetCache(Component fullComponent) {
Library frameworkLibrary;
for (Library library in fullComponent.libraries) {
- if (library?.importUri?.path == 'flutter/src/widgets/framework.dart') {
+ if (library?.importUri?.path == _frameworkLibrary) {
frameworkLibrary = library;
break;
}
@@ -22,15 +22,7 @@
if (frameworkLibrary == null) {
return;
}
- for (Class classDeclaration in frameworkLibrary.classes) {
- if (classDeclaration.name == _statelessWidgetClassName) {
- _statelessWidget = classDeclaration;
- } else if (classDeclaration.name == _statefulWidgetClassName) {
- _statefulWidget = classDeclaration;
- } else if (classDeclaration.name == _stateClassName) {
- _state = classDeclaration;
- }
- }
+ _locatedClassDeclarations(frameworkLibrary);
_frameworkTypesLocated =
_statefulWidget != null && _state != null && _statelessWidget != null;
}
@@ -44,6 +36,8 @@
Class _statefulWidget;
bool _frameworkTypesLocated = false;
+ static const String _frameworkLibrary = 'flutter/src/widgets/framework.dart';
+
/// Mark [uri] as invalidated.
void invalidate(Uri uri) {
_invalidatedLibraries.add(uri);
@@ -126,9 +120,19 @@
return null;
}
+ // Update the class references to stateless, stateful, and state classes.
+ if (classHierarchy is ClosedWorldClassHierarchy) {
+ for (Library library in classHierarchy.knownLibraries) {
+ if (library?.importUri?.path == _frameworkLibrary) {
+ _locatedClassDeclarations(library);
+ }
+ }
+ }
+
if (classHierarchy.isSubclassOf(newClass, _statelessWidget) ||
classHierarchy.isSubclassOf(newClass, _statefulWidget)) {
- if (_hasSubClasses(newClass, partialComponent, classHierarchy)) {
+ if (classHierarchy.isExtended(newClass) ||
+ classHierarchy.isUsedAsMixin(newClass)) {
return null;
}
return newClass.name;
@@ -150,8 +154,8 @@
if (statefulWidgetType.name == _statefulWidgetClassName) {
return null;
}
- if (_hasSubClasses(
- statefulWidgetType, partialComponent, classHierarchy)) {
+ if (classHierarchy.isExtended(statefulWidgetType) ||
+ classHierarchy.isUsedAsMixin(statefulWidgetType)) {
return null;
}
return statefulWidgetType.name;
@@ -161,22 +165,6 @@
return null;
}
- /// Checks whether the class [node] has any subclasses.
- bool _hasSubClasses(
- Class node, Component component, ClassHierarchy classHierarchy) {
- for (Library library in component.libraries) {
- for (Class otherClass in library.classes) {
- if (identical(otherClass, node)) {
- continue;
- }
- if (classHierarchy.isSubclassOf(otherClass, node)) {
- return true;
- }
- }
- }
- return false;
- }
-
// Locate the that fully contains the edit range, or null.
Class _locateContainingClass(
Library library, int startOffset, int endOffset) {
@@ -188,4 +176,16 @@
}
return null;
}
+
+ void _locatedClassDeclarations(Library library) {
+ for (Class classDeclaration in library.classes) {
+ if (classDeclaration.name == _statelessWidgetClassName) {
+ _statelessWidget = classDeclaration;
+ } else if (classDeclaration.name == _statefulWidgetClassName) {
+ _statefulWidget = classDeclaration;
+ } else if (classDeclaration.name == _stateClassName) {
+ _state = classDeclaration;
+ }
+ }
+ }
}
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 5679493..1cb6060 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -63,6 +63,7 @@
CantUsePrefixWithNullAware/part_wrapped_script: Fail # Importing file in the (now) part.
CantUseSuperBoundedTypeForInstanceCreation/analyzerCode: Fail
CantUseSuperBoundedTypeForInstanceCreation/example: Fail
+ClassInNullAwareReceiver/analyzerCode: Fail
ColonInPlaceOfIn/example: Fail
ConflictingModifiers/part_wrapped_script1: Fail
ConflictingModifiers/script1: Fail
@@ -711,6 +712,7 @@
SyntheticToken/example: Fail # Can't be tested, used to recover from other errors.
ThisAccessInFieldInitializer/example: Fail
ThisAsIdentifier/example: Fail
+ThisInNullAwareReceiver/analyzerCode: Fail
ThisOrSuperAccessInFieldInitializer/example: Fail
ThrowingNotAssignableToObjectError/analyzerCode: Fail
ThrowingNotAssignableToObjectError/example: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index df50caa..905e30c 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -4400,6 +4400,32 @@
template: "Operand of null-aware operation '#name' has type '#type' which excludes null."
severity: WARNING
+ThisInNullAwareReceiver:
+ template: "The receiver 'this' cannot be null."
+ tip: "Try replacing '?.' with '.'"
+ severity: WARNING
+ configuration: nnbd-strong
+ script: |
+ class C {
+ var field;
+ method() {
+ this?.field;
+ }
+ }
+
+ClassInNullAwareReceiver:
+ template: "The class '#name' cannot be null."
+ tip: "Try replacing '?.' with '.'"
+ severity: WARNING
+ configuration: nnbd-strong
+ script: |
+ class C {
+ static var field;
+ }
+ method() {
+ C?.field;
+ }
+
NonNullableNotAssignedError:
template: "Non-nullable variable '#name' must be assigned before it can be used."
configuration: nnbd-strong
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index ed80870..9e69886 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -1104,7 +1104,6 @@
description, p, userLibraries, options, sourceTarget),
context.expectationSet["InstrumentationMismatch"],
instrumentation.problemsAsString,
- null,
autoFixCommand: '${UPDATE_COMMENTS}=true');
}
}
@@ -1194,8 +1193,7 @@
return new Result<ComponentResult>(
result,
context.expectationSet["TransformVerificationError"],
- errors.join('\n'),
- null);
+ errors.join('\n'));
}
return pass(result);
}
@@ -1236,8 +1234,8 @@
if (messages.isEmpty) {
return pass(result);
} else {
- return new Result<ComponentResult>(null,
- context.expectationSet["VerificationError"], "$messages", null);
+ return new Result<ComponentResult>(
+ null, context.expectationSet["VerificationError"], "$messages");
}
}, errorOnMissingInput: false);
}
diff --git a/pkg/front_end/test/fasta/textual_outline_suite.dart b/pkg/front_end/test/fasta/textual_outline_suite.dart
index aeb3343..6127a28 100644
--- a/pkg/front_end/test/fasta/textual_outline_suite.dart
+++ b/pkg/front_end/test/fasta/textual_outline_suite.dart
@@ -81,8 +81,8 @@
performModelling: modelled,
addMarkerForUnknownForTest: modelled);
if (result == null) {
- return new Result(null, context.expectationSet["EmptyOutput"],
- description.uri, StackTrace.current);
+ return new Result(
+ null, context.expectationSet["EmptyOutput"], description.uri);
}
// In an attempt to make it less sensitive to formatting first remove
@@ -122,8 +122,9 @@
if (expectMatch.outcome != Expectation.Pass) return expectMatch;
if (formatterException != null) {
- return new Result(null, context.expectationSet["FormatterCrash"],
- formatterException, formatterExceptionSt);
+ return new Result(
+ null, context.expectationSet["FormatterCrash"], formatterException,
+ trace: formatterExceptionSt);
}
}
diff --git a/pkg/front_end/test/incremental_load_from_dill_suite.dart b/pkg/front_end/test/incremental_load_from_dill_suite.dart
index 768e1ba..c7c6a35 100644
--- a/pkg/front_end/test/incremental_load_from_dill_suite.dart
+++ b/pkg/front_end/test/incremental_load_from_dill_suite.dart
@@ -74,7 +74,7 @@
import 'package:kernel/text/ast_to_text.dart' show Printer, componentToString;
import "package:testing/testing.dart"
- show Chain, ChainContext, Result, Step, TestDescription, runMe;
+ show Chain, ChainContext, Expectation, Result, Step, TestDescription, runMe;
import "package:vm/target/vm.dart" show VmTarget;
@@ -89,6 +89,43 @@
main([List<String> arguments = const []]) =>
runMe(arguments, createContext, configurationPath: "../testing.json");
+const Expectation ExpectationFileMismatch =
+ const Expectation.fail("ExpectationFileMismatch");
+const Expectation ExpectationFileMissing =
+ const Expectation.fail("ExpectationFileMissing");
+const Expectation MissingErrors = const Expectation.fail("MissingErrors");
+const Expectation UnexpectedErrors = const Expectation.fail("UnexpectedErrors");
+const Expectation MissingWarnings = const Expectation.fail("MissingWarnings");
+const Expectation UnexpectedWarnings =
+ const Expectation.fail("UnexpectedWarnings");
+const Expectation ClassHierarchyError =
+ const Expectation.fail("ClassHierarchyError");
+const Expectation NeededDillMismatch =
+ const Expectation.fail("NeededDillMismatch");
+const Expectation IncrementalSerializationError =
+ const Expectation.fail("IncrementalSerializationError");
+const Expectation ContentDataMismatch =
+ const Expectation.fail("ContentDataMismatch");
+const Expectation MissingInitializationError =
+ const Expectation.fail("MissingInitializationError");
+const Expectation UnexpectedInitializationError =
+ const Expectation.fail("UnexpectedInitializationError");
+const Expectation ReachableLibrariesError =
+ const Expectation.fail("ReachableLibrariesError");
+const Expectation UriToSourceError = const Expectation.fail("UriToSourceError");
+const Expectation MissingPlatformLibraries =
+ const Expectation.fail("MissingPlatformLibraries");
+const Expectation UnexpectedPlatformLibraries =
+ const Expectation.fail("UnexpectedPlatformLibraries");
+const Expectation UnexpectedRebuildBodiesOnly =
+ const Expectation.fail("UnexpectedRebuildBodiesOnly");
+const Expectation UnexpectedEntryToLibraryCount =
+ const Expectation.fail("UnexpectedEntryToLibraryCount");
+const Expectation LibraryCountMismatch =
+ const Expectation.fail("LibraryCountMismatch");
+const Expectation InitializedFromDillMismatch =
+ const Expectation.fail("InitializedFromDillMismatch");
+
Future<Context> createContext(
Chain suite, Map<String, String> environment) async {
// Disable colors to ensure that expectation files are the same across
@@ -152,6 +189,7 @@
String get name => "run compilations";
Future<Result<TestData>> run(TestData data, Context context) async {
+ Result<TestData> result;
YamlMap map = data.map;
Set<String> keys = new Set<String>.from(map.keys.cast<String>());
keys.remove("type");
@@ -175,7 +213,7 @@
"trackWidgetCreation",
"incrementalSerialization"
]);
- await new NewWorldTest().newWorldTest(
+ result = await new NewWorldTest().newWorldTest(
data,
context,
map["worlds"],
@@ -192,7 +230,7 @@
}
if (keys.isNotEmpty) throw "Unknown toplevel keys: $keys";
- return pass(data);
+ return result ?? pass(data);
}
}
@@ -340,7 +378,7 @@
return output;
}
- Future<Null> newWorldTest(
+ Future<Result<TestData>> newWorldTest(
TestData data,
Context context,
List worlds,
@@ -611,8 +649,9 @@
}
}
}
- performErrorAndWarningCheck(
- world, gotError, formattedErrors, gotWarning, formattedWarnings);
+ Result<TestData> result = performErrorAndWarningCheck(world, data,
+ gotError, formattedErrors, gotWarning, formattedWarnings);
+ if (result != null) return result;
if (world["expectInitializationError"] != null) {
Set<String> seenInitializationError = seenDiagnosticCodes.intersection({
"InitializeFromDillNotSelfContainedNoDump",
@@ -622,12 +661,16 @@
});
if (world["expectInitializationError"] == true) {
if (seenInitializationError.isEmpty) {
- throw "Expected to see an initialization error but didn't.";
+ return new Result<TestData>(data, MissingInitializationError,
+ "Expected to see an initialization error but didn't.");
}
} else if (world["expectInitializationError"] == false) {
if (seenInitializationError.isNotEmpty) {
- throw "Expected not to see an initialization error but did: "
- "$seenInitializationError.";
+ return new Result<TestData>(
+ data,
+ UnexpectedInitializationError,
+ "Expected not to see an initialization error but did: "
+ "$seenInitializationError.");
}
} else {
throw "Unsupported value for 'expectInitializationError': "
@@ -639,8 +682,11 @@
fileSystem: gotError ? null : fs);
print("Compile took ${stopwatch.elapsedMilliseconds} ms");
- checkExpectedContent(world, component);
- checkNeededDillLibraries(world, compiler.neededDillLibraries, base);
+ Result contentResult = checkExpectedContent(world, component);
+ if (contentResult != null) return contentResult.copyWithOutput(data);
+ result = checkNeededDillLibraries(
+ world, data, compiler.neededDillLibraries, base);
+ if (result != null) return result;
if (!noFullComponent) {
Set<Library> allLibraries = new Set<Library>();
@@ -648,13 +694,19 @@
computeAllReachableLibrariesFor(lib, allLibraries);
}
if (allLibraries.length != component.libraries.length) {
- Expect.fail("Expected for the reachable stuff to be equal to "
+ return new Result<TestData>(
+ data,
+ ReachableLibrariesError,
+ "Expected for the reachable stuff to be equal to "
"${component.libraries} but it was $allLibraries");
}
Set<Library> tooMany = allLibraries.toSet()
..removeAll(component.libraries);
if (tooMany.isNotEmpty) {
- Expect.fail("Expected for the reachable stuff to be equal to "
+ return new Result<TestData>(
+ data,
+ ReachableLibrariesError,
+ "Expected for the reachable stuff to be equal to "
"${component.libraries} but these were there too: $tooMany "
"(and others were missing)");
}
@@ -670,8 +722,11 @@
for (String filename in world["uriToSourcesDoesntInclude"]) {
Uri uri = base.resolve(filename);
if (component.uriToSource[uri] != null) {
- throw "Expected no uriToSource for $uri but found "
- "${component.uriToSource[uri]}";
+ return new Result<TestData>(
+ data,
+ UriToSourceError,
+ "Expected no uriToSource for $uri but found "
+ "${component.uriToSource[uri]}");
}
}
}
@@ -686,14 +741,20 @@
// Dart scheme uris too.
if (uri == null || uri.scheme == "org-dartlang-sdk") continue;
if (!allowed.contains(uri)) {
- throw "Expected no uriToSource for $uri but found "
- "${component.uriToSource[uri]}";
+ return new Result<TestData>(
+ data,
+ UriToSourceError,
+ "Expected no uriToSource for $uri but found "
+ "${component.uriToSource[uri]}");
}
}
}
- checkExpectFile(data, worldNum, "", context, actualSerialized);
- checkClassHierarchy(compiler, component, data, worldNum, context);
+ result = checkExpectFile(data, worldNum, "", context, actualSerialized);
+ if (result != null) return result;
+ result =
+ checkClassHierarchy(compiler, component, data, worldNum, context);
+ if (result != null) return result;
int nonSyntheticLibraries = countNonSyntheticLibraries(component);
int nonSyntheticPlatformLibraries =
@@ -701,36 +762,54 @@
int syntheticLibraries = countSyntheticLibraries(component);
if (world["expectsPlatform"] == true) {
if (nonSyntheticPlatformLibraries < 5) {
- throw "Expected to have at least 5 platform libraries "
+ return new Result<TestData>(
+ data,
+ MissingPlatformLibraries,
+ "Expected to have at least 5 platform libraries "
"(actually, the entire sdk), "
- "but got $nonSyntheticPlatformLibraries.";
+ "but got $nonSyntheticPlatformLibraries.");
}
} else {
if (nonSyntheticPlatformLibraries != 0) {
- throw "Expected to have 0 platform libraries "
- "but got $nonSyntheticPlatformLibraries.";
+ return new Result<TestData>(
+ data,
+ UnexpectedPlatformLibraries,
+ "Expected to have 0 platform libraries "
+ "but got $nonSyntheticPlatformLibraries.");
}
}
if (world["expectedLibraryCount"] != null) {
if (nonSyntheticLibraries - nonSyntheticPlatformLibraries !=
world["expectedLibraryCount"]) {
- throw "Expected ${world["expectedLibraryCount"]} non-synthetic "
+ return new Result<TestData>(
+ data,
+ LibraryCountMismatch,
+ "Expected ${world["expectedLibraryCount"]} non-synthetic "
"libraries, got "
"${nonSyntheticLibraries - nonSyntheticPlatformLibraries} "
- "(not counting platform libraries)";
+ "(not counting platform libraries)");
}
}
if (world["expectedSyntheticLibraryCount"] != null) {
if (syntheticLibraries != world["expectedSyntheticLibraryCount"]) {
- throw "Expected ${world["expectedSyntheticLibraryCount"]} synthetic "
- "libraries, got ${syntheticLibraries}";
+ return new Result<TestData>(
+ data,
+ LibraryCountMismatch,
+ "Expected ${world["expectedSyntheticLibraryCount"]} synthetic "
+ "libraries, got ${syntheticLibraries}");
}
}
if (world["expectsRebuildBodiesOnly"] != null) {
bool didRebuildBodiesOnly = compiler.rebuildBodiesCount > 0;
- Expect.equals(world["expectsRebuildBodiesOnly"], didRebuildBodiesOnly,
- "Whether we expected to rebuild bodies only.");
+ if (world["expectsRebuildBodiesOnly"] != didRebuildBodiesOnly) {
+ return new Result<TestData>(
+ data,
+ UnexpectedRebuildBodiesOnly,
+ "Expected didRebuildBodiesOnly="
+ "${world["expectsRebuildBodiesOnly"]}, "
+ "didRebuildBodiesOnly=${didRebuildBodiesOnly}.");
+ }
}
if (!noFullComponent) {
@@ -740,14 +819,20 @@
entries.contains(lib.fileUri))
.toList();
if (entryLib.length != entries.length) {
- throw "Expected the entries to become libraries. "
+ return new Result<TestData>(
+ data,
+ UnexpectedEntryToLibraryCount,
+ "Expected the entries to become libraries. "
"Got ${entryLib.length} libraries for the expected "
- "${entries.length} entries.";
+ "${entries.length} entries.");
}
}
if (compiler.initializedFromDill != expectInitializeFromDill) {
- throw "Expected that initializedFromDill would be "
- "$expectInitializeFromDill but was ${compiler.initializedFromDill}";
+ return new Result<TestData>(
+ data,
+ InitializedFromDillMismatch,
+ "Expected that initializedFromDill would be "
+ "$expectInitializeFromDill but was ${compiler.initializedFromDill}");
}
if (incrementalSerialization == true && compiler.initializedFromDill) {
@@ -772,8 +857,12 @@
Expect.isNull(world["expectedInvalidatedUri"]);
}
}
- List<int> incrementalSerializationBytes = checkIncrementalSerialization(
+ Result<List<int>> serializationResult = checkIncrementalSerialization(
incrementalSerialization, component, incrementalSerializer, world);
+ if (!serializationResult.isPass) {
+ return serializationResult.copyWithOutput(data);
+ }
+ List<int> incrementalSerializationBytes = serializationResult.output;
Set<String> prevFormattedErrors = formattedErrors.toSet();
Set<String> prevFormattedWarnings = formattedWarnings.toSet();
@@ -791,8 +880,9 @@
entryPoints: entries,
fullComponent: true,
simulateTransformer: world["simulateTransformer"]);
- performErrorAndWarningCheck(
- world, gotError, formattedErrors, gotWarning, formattedWarnings);
+ Result<TestData> result = performErrorAndWarningCheck(world, data,
+ gotError, formattedErrors, gotWarning, formattedWarnings);
+ if (result != null) return result;
List<int> thisWholeComponent = util.postProcess(component2);
print("*****\n\ncomponent2:\n"
"${componentToStringSdkFiltered(component2)}\n\n\n");
@@ -801,16 +891,22 @@
prevFormattedWarnings, formattedWarnings);
newestWholeComponent = component2;
- List<int> incrementalSerializationBytes2 =
- checkIncrementalSerialization(incrementalSerialization, component2,
- incrementalSerializer, world);
+ Result<List<int>> serializationResult = checkIncrementalSerialization(
+ incrementalSerialization, component2, incrementalSerializer, world);
+ if (!serializationResult.isPass) {
+ return serializationResult.copyWithOutput(data);
+ }
+ List<int> incrementalSerializationBytes2 = serializationResult.output;
if ((incrementalSerializationBytes == null &&
incrementalSerializationBytes2 != null) ||
(incrementalSerializationBytes != null &&
incrementalSerializationBytes2 == null)) {
- throw "Incremental serialization gave results in one instance, "
- "but not another.";
+ return new Result<TestData>(
+ data,
+ IncrementalSerializationError,
+ "Incremental serialization gave results in one instance, "
+ "but not another.");
}
if (incrementalSerializationBytes != null) {
@@ -837,22 +933,29 @@
Procedure procedure = await compiler.compileExpression(
expression, {}, [], "debugExpr", uri);
if (gotError && !expectErrors) {
- throw "Got error(s) on expression compilation: ${formattedErrors}.";
+ return new Result<TestData>(data, UnexpectedErrors,
+ "Got error(s) on expression compilation: ${formattedErrors}.");
} else if (!gotError && expectErrors) {
- throw "Didn't get any errors.";
+ return new Result<TestData>(
+ data, MissingErrors, "Didn't get any errors.");
}
if (gotWarning && !expectWarnings) {
- throw "Got warning(s) on expression compilation: "
- "${formattedWarnings}.";
+ return new Result<TestData>(
+ data,
+ UnexpectedWarnings,
+ "Got warning(s) on expression compilation: "
+ "${formattedWarnings}.");
} else if (!gotWarning && expectWarnings) {
- throw "Didn't get any warnings.";
+ return new Result<TestData>(
+ data, MissingWarnings, "Didn't get any warnings.");
}
- checkExpectFile(
+ Result<TestData> result = checkExpectFile(
data,
worldNum,
".expression.$expressionCompilationNum",
context,
nodeToString(procedure));
+ if (result != null) return result;
}
}
@@ -885,8 +988,9 @@
entryPoints: entries,
simulateTransformer: world["simulateTransformer"]);
compilerFromScratch = null;
- performErrorAndWarningCheck(
- world, gotError, formattedErrors, gotWarning, formattedWarnings);
+ Result<TestData> result = performErrorAndWarningCheck(world, data,
+ gotError, formattedErrors, gotWarning, formattedWarnings);
+ if (result != null) return result;
util.throwOnEmptyMixinBodies(component3);
await util.throwOnInsufficientUriToSource(component3);
print("Compile took ${stopwatch.elapsedMilliseconds} ms");
@@ -897,16 +1001,25 @@
checkErrorsAndWarnings(prevFormattedErrors, formattedErrors,
prevFormattedWarnings, formattedWarnings);
- List<int> incrementalSerializationBytes3 =
- checkIncrementalSerialization(incrementalSerialization, component3,
- incrementalSerializer2, world);
+ Result<List<int>> serializationResult = checkIncrementalSerialization(
+ incrementalSerialization,
+ component3,
+ incrementalSerializer2,
+ world);
+ if (!serializationResult.isPass) {
+ return serializationResult.copyWithOutput(data);
+ }
+ List<int> incrementalSerializationBytes3 = serializationResult.output;
if ((incrementalSerializationBytes == null &&
incrementalSerializationBytes3 != null) ||
(incrementalSerializationBytes != null &&
incrementalSerializationBytes3 == null)) {
- throw "Incremental serialization gave results in one instance, "
- "but not another.";
+ return new Result<TestData>(
+ data,
+ IncrementalSerializationError,
+ "Incremental serialization gave results in one instance, "
+ "but not another.");
}
if (incrementalSerializationBytes != null) {
@@ -930,11 +1043,12 @@
print("Continuing after debug break");
}
}
+ return new Result<TestData>.pass(data);
}
}
-void checkExpectFile(TestData data, int worldNum, String extraUriString,
- Context context, String actualSerialized) {
+Result<TestData> checkExpectFile(TestData data, int worldNum,
+ String extraUriString, Context context, String actualSerialized) {
Uri uri = data.loadedFrom.resolve(data.loadedFrom.pathSegments.last +
".world.$worldNum${extraUriString}.expect");
String expected;
@@ -948,24 +1062,32 @@
} else {
String extra = "";
if (expected == null) extra = "Expect file did not exist.\n";
- throw "${extra}Unexpected serialized representation. "
+ return new Result<TestData>(
+ data,
+ expected == null ? ExpectationFileMissing : ExpectationFileMismatch,
+ "${extra}Unexpected serialized representation. "
"Fix or update $uri to contain the below:\n\n"
- "$actualSerialized";
+ "$actualSerialized",
+ autoFixCommand: "updateExpectations=true");
}
}
+ return null;
}
/// Check that the class hierarchy is up-to-date with reality.
///
/// This has the option to do expect files, but it's disabled by default
/// while we're trying to figure out if it's useful or not.
-void checkClassHierarchy(TestIncrementalCompiler compiler, Component component,
- TestData data, int worldNum, Context context,
+Result<TestData> checkClassHierarchy(TestIncrementalCompiler compiler,
+ Component component, TestData data, int worldNum, Context context,
{bool checkExpectFile: false}) {
ClassHierarchy classHierarchy = compiler.getClassHierarchy();
if (classHierarchy is! ClosedWorldClassHierarchy) {
- throw "Expected the class hierarchy to be ClosedWorldClassHierarchy "
- "but it wasn't. It was ${classHierarchy.runtimeType}";
+ return new Result<TestData>(
+ data,
+ ClassHierarchyError,
+ "Expected the class hierarchy to be ClosedWorldClassHierarchy "
+ "but it wasn't. It was ${classHierarchy.runtimeType}");
}
List<ForTestingClassInfo> classHierarchyData =
(classHierarchy as ClosedWorldClassHierarchy).getTestingClassInfo();
@@ -973,7 +1095,8 @@
new Map<Class, ForTestingClassInfo>();
for (ForTestingClassInfo info in classHierarchyData) {
if (classHierarchyMap[info.classNode] != null) {
- throw "Two entries for ${info.classNode}";
+ return new Result<TestData>(
+ data, ClassHierarchyError, "Two entries for ${info.classNode}");
}
classHierarchyMap[info.classNode] = info;
}
@@ -986,28 +1109,35 @@
sb.writeln(" - Class ${c.name}");
Set<Class> checkedSupertypes = <Class>{};
- void checkSupertype(Supertype supertype) {
- if (supertype == null) return;
+ Result<TestData> checkSupertype(Supertype supertype) {
+ if (supertype == null) return null;
Class superclass = supertype.classNode;
if (checkedSupertypes.add(superclass)) {
Supertype asSuperClass =
classHierarchy.getClassAsInstanceOf(c, superclass);
if (asSuperClass == null) {
- throw "${superclass} not found as a superclass of $c";
+ return new Result<TestData>(data, ClassHierarchyError,
+ "${superclass} not found as a superclass of $c");
}
- checkSupertype(superclass.supertype);
- checkSupertype(superclass.mixedInType);
+ Result<TestData> result = checkSupertype(superclass.supertype);
+ if (result != null) return result;
+ result = checkSupertype(superclass.mixedInType);
+ if (result != null) return result;
for (Supertype interface in superclass.implementedTypes) {
- checkSupertype(interface);
+ result = checkSupertype(interface);
+ if (result != null) return result;
}
}
+ return null;
}
- checkSupertype(c.asThisSupertype);
+ Result<TestData> result = checkSupertype(c.asThisSupertype);
+ if (result != null) return result;
ForTestingClassInfo info = classHierarchyMap[c];
if (info == null) {
- throw "Didn't find any class hierarchy info for $c";
+ return new Result<TestData>(data, ClassHierarchyError,
+ "Didn't find any class hierarchy info for $c");
}
if (info.lazyDeclaredGettersAndCalls != null) {
@@ -1022,21 +1152,30 @@
if (f.isStatic) continue;
if (!f.hasImplicitGetter) continue;
if (!members.remove(f)) {
- throw "Didn't find ${f.name.text} in lazyDeclaredGettersAndCalls "
- "for ${c.name} in ${library.importUri}";
+ return new Result<TestData>(
+ data,
+ ClassHierarchyError,
+ "Didn't find ${f.name.text} in lazyDeclaredGettersAndCalls "
+ "for ${c.name} in ${library.importUri}");
}
}
for (Procedure p in c.procedures) {
if (p.isStatic) continue;
if (p.isSetter) continue;
if (!members.remove(p)) {
- throw "Didn't find ${p.name.text} in lazyDeclaredGettersAndCalls "
- "for ${c.name} in ${library.importUri}";
+ return new Result<TestData>(
+ data,
+ ClassHierarchyError,
+ "Didn't find ${p.name.text} in lazyDeclaredGettersAndCalls "
+ "for ${c.name} in ${library.importUri}");
}
}
if (members.isNotEmpty) {
- throw "Still have ${members.map((m) => m.name.text)} left "
- "for ${c.name} in ${library.importUri}";
+ return new Result<TestData>(
+ data,
+ ClassHierarchyError,
+ "Still have ${members.map((m) => m.name.text)} left "
+ "for ${c.name} in ${library.importUri}");
}
}
if (info.lazyDeclaredSetters != null) {
@@ -1051,19 +1190,24 @@
if (f.isStatic) continue;
if (!f.hasImplicitSetter) continue;
if (!members.remove(f)) {
- throw "Didn't find $f in lazyDeclaredSetters for $c";
+ return new Result<TestData>(data, ClassHierarchyError,
+ "Didn't find $f in lazyDeclaredSetters for $c");
}
}
for (Procedure p in c.procedures) {
if (p.isStatic) continue;
if (!p.isSetter) continue;
if (!members.remove(p)) {
- throw "Didn't find $p in lazyDeclaredSetters for $c";
+ return new Result<TestData>(data, ClassHierarchyError,
+ "Didn't find $p in lazyDeclaredSetters for $c");
}
}
if (members.isNotEmpty) {
- throw "Still have ${members.map((m) => m.name.text)} left "
- "for ${c.name} in ${library.importUri}";
+ return new Result<TestData>(
+ data,
+ ClassHierarchyError,
+ "Still have ${members.map((m) => m.name.text)} left "
+ "for ${c.name} in ${library.importUri}");
}
}
if (info.lazyImplementedGettersAndCalls != null) {
@@ -1107,12 +1251,16 @@
} else {
String extra = "";
if (expected == null) extra = "Expect file did not exist.\n";
- throw "${extra}Unexpected serialized representation. "
+ return new Result<TestData>(
+ data,
+ ClassHierarchyError,
+ "${extra}Unexpected serialized representation. "
"Fix or update $uri to contain the below:\n\n"
- "$actualClassHierarchy";
+ "$actualClassHierarchy");
}
}
}
+ return null;
}
void checkErrorsAndWarnings(
@@ -1144,7 +1292,7 @@
}
}
-List<int> checkIncrementalSerialization(
+Result<List<int>> checkIncrementalSerialization(
bool incrementalSerialization,
Component component,
IncrementalSerializer incrementalSerializer,
@@ -1159,18 +1307,26 @@
incrementalSerializer.writePackagesToSinkAndTrimComponent(c, sink);
int librariesAfter = c.libraries.length;
if (librariesAfter > librariesBefore) {
- throw "Incremental serialization added libraries!";
+ return new Result<List<int>>(null, IncrementalSerializationError,
+ "Incremental serialization added libraries!");
}
if (librariesBefore == librariesAfter &&
world["incrementalSerializationDoesWork"] == true) {
- throw "Incremental serialization didn't remove any libraries!";
+ return new Result<List<int>>(null, IncrementalSerializationError,
+ "Incremental serialization didn't remove any libraries!");
}
if (librariesAfter < librariesBefore && sink.builder.isEmpty) {
- throw "Incremental serialization didn't output any bytes, "
- "but did remove libraries";
+ return new Result<List<int>>(
+ null,
+ IncrementalSerializationError,
+ "Incremental serialization didn't output any bytes, "
+ "but did remove libraries");
} else if (librariesAfter == librariesBefore && !sink.builder.isEmpty) {
- throw "Incremental serialization did output bytes, "
- "but didn't remove libraries";
+ return new Result<List<int>>(
+ null,
+ IncrementalSerializationError,
+ "Incremental serialization did output bytes, "
+ "but didn't remove libraries");
}
if (librariesAfter < librariesBefore) {
// If we actually did incrementally serialize anything, check the output!
@@ -1191,8 +1347,11 @@
for (String uriString in serializationShouldNotInclude) {
Uri uri = Uri.parse(uriString);
if (includedImportUris.contains(uri)) {
- throw "Incremental serialization shouldn't include "
- "$uriString but did.";
+ return new Result<List<int>>(
+ null,
+ IncrementalSerializationError,
+ "Incremental serialization shouldn't include "
+ "$uriString but did.");
}
}
}
@@ -1207,18 +1366,20 @@
for (String key in newKeys) {
afterContent.remove(key);
}
- checkExpectedContentData(afterContent, originalContent);
+ Result result = checkExpectedContentData(afterContent, originalContent);
+ if (result != null) return result.copyWithOutput<List<int>>(null);
// Check that the result is self-contained.
- checkSelfContained(loadedComponent);
+ result = checkSelfContained(loadedComponent);
+ if (result != null) return result.copyWithOutput<List<int>>(null);
- return bytes;
+ return new Result<List<int>>.pass(bytes);
}
}
- return null;
+ return new Result<List<int>>.pass(null);
}
-void checkSelfContained(Component component) {
+Result checkSelfContained(Component component) {
Set<Library> got = new Set<Library>.from(component.libraries);
for (Library lib in component.libraries) {
for (LibraryDependency dependency in lib.dependencies) {
@@ -1229,11 +1390,15 @@
.startsWith("root::dart:")) {
continue;
}
- throw "Component didn't contain ${dependency.importedLibraryReference} "
- "and it should have.";
+ return Result(
+ null,
+ IncrementalSerializationError,
+ "Component didn't contain ${dependency.importedLibraryReference} "
+ "and it should have.");
}
}
}
+ return null;
}
void computeAllReachableLibrariesFor(Library lib, Set<Library> allLibraries) {
@@ -1254,33 +1419,46 @@
}
}
-void checkExpectedContent(YamlMap world, Component component) {
+Result checkExpectedContent(YamlMap world, Component component) {
if (world["expectedContent"] != null) {
Map<String, Set<String>> actualContent = buildMapOfContent(component);
Map expectedContent = world["expectedContent"];
- checkExpectedContentData(actualContent, expectedContent);
+ return checkExpectedContentData(actualContent, expectedContent);
}
+ return null;
}
-void checkExpectedContentData(
+Result checkExpectedContentData(
Map<String, Set<String>> actualContent, Map expectedContent) {
- doThrow() {
- throw "Expected and actual content not the same.\n"
+ Result<TestData> createFailureResult() {
+ return new Result(
+ null,
+ ContentDataMismatch,
+ "Expected and actual content not the same.\n"
"Expected $expectedContent.\n"
- "Got $actualContent";
+ "Got $actualContent");
}
- if (actualContent.length != expectedContent.length) doThrow();
+ if (actualContent.length != expectedContent.length) {
+ return createFailureResult();
+ }
Set<String> missingKeys = actualContent.keys.toSet()
..removeAll(expectedContent.keys);
- if (missingKeys.isNotEmpty) doThrow();
+ if (missingKeys.isNotEmpty) {
+ return createFailureResult();
+ }
for (String key in expectedContent.keys) {
Set<String> expected = new Set<String>.from(expectedContent[key]);
Set<String> actual = actualContent[key].toSet();
- if (expected.length != actual.length) doThrow();
+ if (expected.length != actual.length) {
+ return createFailureResult();
+ }
actual.removeAll(expected);
- if (actual.isNotEmpty) doThrow();
+ if (actual.isNotEmpty) {
+ return createFailureResult();
+ }
}
+ return null;
}
Map<String, Set<String>> buildMapOfContent(Component component) {
@@ -1301,8 +1479,8 @@
return actualContent;
}
-void checkNeededDillLibraries(
- YamlMap world, Set<Library> neededDillLibraries, Uri base) {
+Result<TestData> checkNeededDillLibraries(
+ YamlMap world, TestData data, Set<Library> neededDillLibraries, Uri base) {
if (world["neededDillLibraries"] != null) {
List<Uri> actualContent = new List<Uri>();
for (Library lib in neededDillLibraries) {
@@ -1315,20 +1493,30 @@
expectedContent.add(base.resolve(entry));
}
- doThrow() {
- throw "Expected and actual content not the same.\n"
+ Result<TestData> createFailureResult() {
+ return new Result<TestData>(
+ data,
+ NeededDillMismatch,
+ "Expected and actual content not the same.\n"
"Expected $expectedContent.\n"
- "Got $actualContent";
+ "Got $actualContent");
}
- if (actualContent.length != expectedContent.length) doThrow();
+ if (actualContent.length != expectedContent.length) {
+ return createFailureResult();
+ }
Set<Uri> notInExpected =
actualContent.toSet().difference(expectedContent.toSet());
Set<Uri> notInActual =
expectedContent.toSet().difference(actualContent.toSet());
- if (notInExpected.isNotEmpty) doThrow();
- if (notInActual.isNotEmpty) doThrow();
+ if (notInExpected.isNotEmpty) {
+ return createFailureResult();
+ }
+ if (notInActual.isNotEmpty) {
+ return createFailureResult();
+ }
}
+ return null;
}
String nodeToString(TreeNode node) {
@@ -1386,22 +1574,28 @@
return result;
}
-void performErrorAndWarningCheck(
+Result<TestData> performErrorAndWarningCheck(
YamlMap world,
+ TestData data,
bool gotError,
Set<String> formattedErrors,
bool gotWarning,
Set<String> formattedWarnings) {
if (world["errors"] == true && !gotError) {
- throw "Expected error, but didn't get any.";
+ return new Result<TestData>(
+ data, MissingErrors, "Expected error, but didn't get any.");
} else if (world["errors"] != true && gotError) {
- throw "Got unexpected error(s): $formattedErrors.";
+ return new Result<TestData>(
+ data, UnexpectedErrors, "Got unexpected error(s): $formattedErrors.");
}
if (world["warnings"] == true && !gotWarning) {
- throw "Expected warning, but didn't get any.";
+ return new Result<TestData>(
+ data, MissingWarnings, "Expected warning, but didn't get any.");
} else if (world["warnings"] != true && gotWarning) {
- throw "Got unexpected warnings(s): $formattedWarnings.";
+ return new Result<TestData>(data, UnexpectedWarnings,
+ "Got unexpected warnings(s): $formattedWarnings.");
}
+ return null;
}
void checkIsEqual(List<int> a, List<int> b) {
diff --git a/pkg/front_end/test/utils/kernel_chain.dart b/pkg/front_end/test/utils/kernel_chain.dart
index 804af3c..4b0f44e 100644
--- a/pkg/front_end/test/utils/kernel_chain.dart
+++ b/pkg/front_end/test/utils/kernel_chain.dart
@@ -94,8 +94,8 @@
}
String diff = await runDiff(expectedFile.uri, actual);
onMismatch ??= expectationFileMismatch;
- return new Result<O>(output, onMismatch,
- "$uri doesn't match ${expectedFile.uri}\n$diff", null,
+ return new Result<O>(
+ output, onMismatch, "$uri doesn't match ${expectedFile.uri}\n$diff",
autoFixCommand: onMismatch == expectationFileMismatch
? updateExpectationsOption
: null);
@@ -113,7 +113,6 @@
"""
Please create file ${expectedFile.path} with this content:
$actual""",
- null,
autoFixCommand: updateExpectationsOption);
}
}
@@ -179,8 +178,7 @@
return new Result<ComponentResult>(
null,
context.expectationSet["TypeCheckError"],
- '${errorFormatter.numberOfFailures} type errors',
- null);
+ '${errorFormatter.numberOfFailures} type errors');
}
}
}
@@ -377,11 +375,8 @@
}
if (failures.isNotEmpty) {
- return new Result<ComponentResult>(
- null,
- context.expectationSet["TextSerializationFailure"],
- "$messages",
- null);
+ return new Result<ComponentResult>(null,
+ context.expectationSet["TextSerializationFailure"], "$messages");
}
return pass(result);
});
diff --git a/pkg/front_end/testcases/general/flutter_issue68092/main.dart b/pkg/front_end/testcases/general/flutter_issue68092/main.dart
new file mode 100644
index 0000000..4ff4f3b
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue68092/main.dart
@@ -0,0 +1,6 @@
+import 'main_lib.dart';
+
+void main() {
+ int f({int x}) => null;
+ Registry().register(f);
+}
diff --git a/pkg/front_end/testcases/general/flutter_issue68092/main.dart.outline.expect b/pkg/front_end/testcases/general/flutter_issue68092/main.dart.outline.expect
new file mode 100644
index 0000000..cfc2e45
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue68092/main.dart.outline.expect
@@ -0,0 +1,32 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → void
+ ;
+
+library;
+import self as self2;
+import "dart:core" as core;
+
+class DynamicDispatchRegistry<T extends core::Function* = core::Function*> extends core::Object {
+ synthetic constructor •() → self2::DynamicDispatchRegistry<self2::DynamicDispatchRegistry::T*>*
+ ;
+ method register(generic-covariant-impl self2::DynamicDispatchRegistry::T* function) → self2::DynamicDispatchRegistry::T*
+ ;
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class Registry extends self2::DynamicDispatchRegistry<({x: core::int*}) →* core::int*> {
+ synthetic constructor •() → self2::Registry*
+ ;
+}
diff --git a/pkg/front_end/testcases/general/flutter_issue68092/main.dart.strong.expect b/pkg/front_end/testcases/general/flutter_issue68092/main.dart.strong.expect
new file mode 100644
index 0000000..317b261
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue68092/main.dart.strong.expect
@@ -0,0 +1,43 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "main_lib.dart" as mai;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → void {
+ function f({core::int* x = #C1}) → core::int*
+ return null;
+ new mai::Registry::•().{mai::DynamicDispatchRegistry::register}(f);
+}
+
+library;
+import self as mai;
+import "dart:core" as core;
+
+class DynamicDispatchRegistry<T extends core::Function* = core::Function*> extends core::Object {
+ synthetic constructor •() → mai::DynamicDispatchRegistry<mai::DynamicDispatchRegistry::T*>*
+ : super core::Object::•()
+ ;
+ method register(generic-covariant-impl mai::DynamicDispatchRegistry::T* function) → mai::DynamicDispatchRegistry::T*
+ return null;
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class Registry extends mai::DynamicDispatchRegistry<({x: core::int*}) →* core::int*> {
+ synthetic constructor •() → mai::Registry*
+ : super mai::DynamicDispatchRegistry::•()
+ ;
+}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/general/flutter_issue68092/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/flutter_issue68092/main.dart.strong.transformed.expect
new file mode 100644
index 0000000..317b261
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue68092/main.dart.strong.transformed.expect
@@ -0,0 +1,43 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "main_lib.dart" as mai;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → void {
+ function f({core::int* x = #C1}) → core::int*
+ return null;
+ new mai::Registry::•().{mai::DynamicDispatchRegistry::register}(f);
+}
+
+library;
+import self as mai;
+import "dart:core" as core;
+
+class DynamicDispatchRegistry<T extends core::Function* = core::Function*> extends core::Object {
+ synthetic constructor •() → mai::DynamicDispatchRegistry<mai::DynamicDispatchRegistry::T*>*
+ : super core::Object::•()
+ ;
+ method register(generic-covariant-impl mai::DynamicDispatchRegistry::T* function) → mai::DynamicDispatchRegistry::T*
+ return null;
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class Registry extends mai::DynamicDispatchRegistry<({x: core::int*}) →* core::int*> {
+ synthetic constructor •() → mai::Registry*
+ : super mai::DynamicDispatchRegistry::•()
+ ;
+}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/general/flutter_issue68092/main.dart.textual_outline.expect b/pkg/front_end/testcases/general/flutter_issue68092/main.dart.textual_outline.expect
new file mode 100644
index 0000000..3e55fb8
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue68092/main.dart.textual_outline.expect
@@ -0,0 +1,3 @@
+import 'main_lib.dart';
+
+void main() {}
diff --git a/pkg/front_end/testcases/general/flutter_issue68092/main.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/flutter_issue68092/main.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..3e55fb8
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue68092/main.dart.textual_outline_modelled.expect
@@ -0,0 +1,3 @@
+import 'main_lib.dart';
+
+void main() {}
diff --git a/pkg/front_end/testcases/general/flutter_issue68092/main_lib.dart b/pkg/front_end/testcases/general/flutter_issue68092/main_lib.dart
new file mode 100644
index 0000000..e43e181
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue68092/main_lib.dart
@@ -0,0 +1,5 @@
+class DynamicDispatchRegistry<T extends Function> {
+ T register(T function) => null;
+}
+
+class Registry extends DynamicDispatchRegistry<int Function({int x})> {}
diff --git a/pkg/front_end/testcases/general/flutter_issue68092/test.options b/pkg/front_end/testcases/general/flutter_issue68092/test.options
new file mode 100644
index 0000000..bfe6dc8
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue68092/test.options
@@ -0,0 +1 @@
+main_lib.dart
\ No newline at end of file
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart
new file mode 100644
index 0000000..a24f92f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2020, 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.
+
+class I<X> {}
+
+class M0<X, Y extends void Function({String name})> extends I<X> {}
+
+class M1 implements I<int> {}
+
+// M0 is inferred as M0<int, void Function({String name})>
+class A extends M1 with M0 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.outline.expect
new file mode 100644
index 0000000..a94c66e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.outline.expect
@@ -0,0 +1,47 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object* = dynamic> extends core::Object {
+ synthetic constructor •() → self::I<self::I::X*>*
+ ;
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class M0<X extends core::Object* = dynamic, Y extends ({name: core::String*}) →* void = ({name: core::String*}) →* void> extends self::I<self::M0::X*> {
+ synthetic constructor •() → self::M0<self::M0::X*, self::M0::Y*>*
+ ;
+}
+class M1 extends core::Object implements self::I<core::int*> {
+ synthetic constructor •() → self::M1*
+ ;
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+abstract class _A&M1&M0 = self::M1 with self::M0<core::int*, ({name: core::String*}) →* void> /*isAnonymousMixin*/ {
+ synthetic constructor •() → self::_A&M1&M0*
+ : super self::M1::•()
+ ;
+}
+class A extends self::_A&M1&M0 {
+ synthetic constructor •() → self::A*
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.strong.expect
new file mode 100644
index 0000000..f7381da
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.strong.expect
@@ -0,0 +1,50 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object* = dynamic> extends core::Object {
+ synthetic constructor •() → self::I<self::I::X*>*
+ : super core::Object::•()
+ ;
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class M0<X extends core::Object* = dynamic, Y extends ({name: core::String*}) →* void = ({name: core::String*}) →* void> extends self::I<self::M0::X*> {
+ synthetic constructor •() → self::M0<self::M0::X*, self::M0::Y*>*
+ : super self::I::•()
+ ;
+}
+class M1 extends core::Object implements self::I<core::int*> {
+ synthetic constructor •() → self::M1*
+ : super core::Object::•()
+ ;
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+abstract class _A&M1&M0 = self::M1 with self::M0<core::int*, ({name: core::String*}) →* void> /*isAnonymousMixin*/ {
+ synthetic constructor •() → self::_A&M1&M0*
+ : super self::M1::•()
+ ;
+}
+class A extends self::_A&M1&M0 {
+ synthetic constructor •() → self::A*
+ : super self::_A&M1&M0::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.strong.transformed.expect
new file mode 100644
index 0000000..5237b52
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.strong.transformed.expect
@@ -0,0 +1,50 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object* = dynamic> extends core::Object {
+ synthetic constructor •() → self::I<self::I::X*>*
+ : super core::Object::•()
+ ;
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class M0<X extends core::Object* = dynamic, Y extends ({name: core::String*}) →* void = ({name: core::String*}) →* void> extends self::I<self::M0::X*> {
+ synthetic constructor •() → self::M0<self::M0::X*, self::M0::Y*>*
+ : super self::I::•()
+ ;
+}
+class M1 extends core::Object implements self::I<core::int*> {
+ synthetic constructor •() → self::M1*
+ : super core::Object::•()
+ ;
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+abstract class _A&M1&M0 extends self::M1 implements self::M0<core::int*, ({name: core::String*}) →* void> /*isAnonymousMixin,isEliminatedMixin*/ {
+ synthetic constructor •() → self::_A&M1&M0*
+ : super self::M1::•()
+ ;
+}
+class A extends self::_A&M1&M0 {
+ synthetic constructor •() → self::A*
+ : super self::_A&M1&M0::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.textual_outline.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.textual_outline.expect
new file mode 100644
index 0000000..01ac810
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.textual_outline.expect
@@ -0,0 +1,9 @@
+class I<X> {}
+
+class M0<X, Y extends void Function({String name})> extends I<X> {}
+
+class M1 implements I<int> {}
+
+class A extends M1 with M0 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..761ffaf
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_4.dart.textual_outline_modelled.expect
@@ -0,0 +1,9 @@
+class A extends M1 with M0 {}
+
+class I<X> {}
+
+class M0<X, Y extends void Function({String name})> extends I<X> {}
+
+class M1 implements I<int> {}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue43689.dart b/pkg/front_end/testcases/nnbd/issue43689.dart
new file mode 100644
index 0000000..20737ba
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43689.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2020, 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.
+
+late final int y;
+late final int? y;
+
+test() {
+ late final int x;
+ late final int? x;
+ int z;
+ int? z;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue43689.dart.outline.expect b/pkg/front_end/testcases/nnbd/issue43689.dart.outline.expect
new file mode 100644
index 0000000..35b1c6f
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43689.dart.outline.expect
@@ -0,0 +1,19 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:6:17: Error: 'y' is already declared in this scope.
+// late final int? y;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:5:16: Context: Previous declaration of 'y'.
+// late final int y;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+late static final field core::int y;
+static method test() → dynamic
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/nnbd/issue43689.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue43689.dart.strong.expect
new file mode 100644
index 0000000..64c8656
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43689.dart.strong.expect
@@ -0,0 +1,40 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:6:17: Error: 'y' is already declared in this scope.
+// late final int? y;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:5:16: Context: Previous declaration of 'y'.
+// late final int y;
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:10:19: Error: 'x' is already declared in this scope.
+// late final int? x;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:9:18: Context: Previous declaration of 'x'.
+// late final int x;
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:12:8: Error: 'z' is already declared in this scope.
+// int? z;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:11:7: Context: Previous declaration of 'z'.
+// int z;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+late static final field core::int y;
+static method test() → dynamic {
+ late final core::int x;
+ late final core::int? x = invalid-expression "pkg/front_end/testcases/nnbd/issue43689.dart:10:19: Error: 'x' is already declared in this scope.
+ late final int? x;
+ ^" as{TypeError,ForDynamic,ForNonNullableByDefault} core::int?;
+ core::int z;
+ core::int? z = invalid-expression "pkg/front_end/testcases/nnbd/issue43689.dart:12:8: Error: 'z' is already declared in this scope.
+ int? z;
+ ^" as{TypeError,ForDynamic,ForNonNullableByDefault} core::int?;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue43689.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue43689.dart.strong.transformed.expect
new file mode 100644
index 0000000..4d8f37a
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43689.dart.strong.transformed.expect
@@ -0,0 +1,42 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:6:17: Error: 'y' is already declared in this scope.
+// late final int? y;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:5:16: Context: Previous declaration of 'y'.
+// late final int y;
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:10:19: Error: 'x' is already declared in this scope.
+// late final int? x;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:9:18: Context: Previous declaration of 'x'.
+// late final int x;
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:12:8: Error: 'z' is already declared in this scope.
+// int? z;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:11:7: Context: Previous declaration of 'z'.
+// int z;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+late static final field core::int y;
+static method test() → dynamic {
+ late final core::int x;
+ function #x#initializer() → core::int?
+ return invalid-expression "pkg/front_end/testcases/nnbd/issue43689.dart:10:19: Error: 'x' is already declared in this scope.
+ late final int? x;
+ ^";
+ late final core::int? x = #x#initializer.call();
+ core::int z;
+ core::int? z = invalid-expression "pkg/front_end/testcases/nnbd/issue43689.dart:12:8: Error: 'z' is already declared in this scope.
+ int? z;
+ ^";
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue43689.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/issue43689.dart.textual_outline.expect
new file mode 100644
index 0000000..efaf61b
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43689.dart.textual_outline.expect
@@ -0,0 +1,6 @@
+late ;
+final int y;
+late ;
+final int? y;
+test() {}
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue43689.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue43689.dart.weak.expect
new file mode 100644
index 0000000..64c8656
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43689.dart.weak.expect
@@ -0,0 +1,40 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:6:17: Error: 'y' is already declared in this scope.
+// late final int? y;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:5:16: Context: Previous declaration of 'y'.
+// late final int y;
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:10:19: Error: 'x' is already declared in this scope.
+// late final int? x;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:9:18: Context: Previous declaration of 'x'.
+// late final int x;
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:12:8: Error: 'z' is already declared in this scope.
+// int? z;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:11:7: Context: Previous declaration of 'z'.
+// int z;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+late static final field core::int y;
+static method test() → dynamic {
+ late final core::int x;
+ late final core::int? x = invalid-expression "pkg/front_end/testcases/nnbd/issue43689.dart:10:19: Error: 'x' is already declared in this scope.
+ late final int? x;
+ ^" as{TypeError,ForDynamic,ForNonNullableByDefault} core::int?;
+ core::int z;
+ core::int? z = invalid-expression "pkg/front_end/testcases/nnbd/issue43689.dart:12:8: Error: 'z' is already declared in this scope.
+ int? z;
+ ^" as{TypeError,ForDynamic,ForNonNullableByDefault} core::int?;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue43689.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue43689.dart.weak.transformed.expect
new file mode 100644
index 0000000..4d8f37a
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43689.dart.weak.transformed.expect
@@ -0,0 +1,42 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:6:17: Error: 'y' is already declared in this scope.
+// late final int? y;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:5:16: Context: Previous declaration of 'y'.
+// late final int y;
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:10:19: Error: 'x' is already declared in this scope.
+// late final int? x;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:9:18: Context: Previous declaration of 'x'.
+// late final int x;
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43689.dart:12:8: Error: 'z' is already declared in this scope.
+// int? z;
+// ^
+// pkg/front_end/testcases/nnbd/issue43689.dart:11:7: Context: Previous declaration of 'z'.
+// int z;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+late static final field core::int y;
+static method test() → dynamic {
+ late final core::int x;
+ function #x#initializer() → core::int?
+ return invalid-expression "pkg/front_end/testcases/nnbd/issue43689.dart:10:19: Error: 'x' is already declared in this scope.
+ late final int? x;
+ ^";
+ late final core::int? x = #x#initializer.call();
+ core::int z;
+ core::int? z = invalid-expression "pkg/front_end/testcases/nnbd/issue43689.dart:12:8: Error: 'z' is already declared in this scope.
+ int? z;
+ ^";
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_static_access.dart b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart
new file mode 100644
index 0000000..62eca0d
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2020, 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.
+
+class C {
+ static int get staticMember => 0;
+ static void set staticMember(int value) {}
+ static int? get staticMember2 => 0;
+ static void set staticMember2(int? value) {}
+ static void staticMethod() {}
+
+ static List<int> get property => [0];
+ static Map<int, int?> get property2 => {};
+}
+
+void main() {
+ C?.staticMember;
+ C?.staticMember;
+ C?.staticMember = 42;
+ C?.staticMethod();
+ C?.staticMember.isEven;
+ C?.staticMember.toString();
+ C?.property[0];
+ C?.property[0] = 0;
+ C?.property2[0] ??= 0;
+ C?.staticMember2 ??= 42;
+ C?.staticMember += 2;
+ C?.staticMember++;
+ --C?.staticMember;
+}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.outline.expect b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.outline.expect
new file mode 100644
index 0000000..c2596b9
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.outline.expect
@@ -0,0 +1,24 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → self::C
+ ;
+ static get staticMember() → core::int
+ ;
+ static set staticMember(core::int value) → void
+ ;
+ static get staticMember2() → core::int?
+ ;
+ static set staticMember2(core::int? value) → void
+ ;
+ static method staticMethod() → void
+ ;
+ static get property() → core::List<core::int>
+ ;
+ static get property2() → core::Map<core::int, core::int?>
+ ;
+}
+static method main() → void
+ ;
diff --git a/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.strong.expect b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.strong.expect
new file mode 100644
index 0000000..df91c3c
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.strong.expect
@@ -0,0 +1,98 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:17:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:18:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:19:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember = 42;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:21:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember.isEven;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:22:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember.toString();
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:23:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property[0];
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:24:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property[0] = 0;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:25:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property2[0] ??= 0;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:26:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember2 ??= 42;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:27:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember += 2;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:28:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember++;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:29:5: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// --C?.staticMember;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → self::C
+ : super core::Object::•()
+ ;
+ static get staticMember() → core::int
+ return 0;
+ static set staticMember(core::int value) → void {}
+ static get staticMember2() → core::int?
+ return 0;
+ static set staticMember2(core::int? value) → void {}
+ static method staticMethod() → void {}
+ static get property() → core::List<core::int>
+ return <core::int>[0];
+ static get property2() → core::Map<core::int, core::int?>
+ return <core::int, core::int?>{};
+}
+static method main() → void {
+ self::C::staticMember;
+ self::C::staticMember;
+ self::C::staticMember = 42;
+ self::C::staticMethod();
+ self::C::staticMember.{core::int::isEven};
+ self::C::staticMember.{core::int::toString}();
+ self::C::property.{core::List::[]}(0);
+ self::C::property.{core::List::[]=}(0, 0);
+ let final core::Map<core::int, core::int?> #t1 = self::C::property2 in let final core::int #t2 = 0 in #t1.{core::Map::[]}(#t2).{core::num::==}(null) ?{core::int} #t1.{core::Map::[]=}(#t2, 0) : null;
+ self::C::staticMember2.{core::num::==}(null) ?{core::int} self::C::staticMember2 = 42 : null;
+ self::C::staticMember = self::C::staticMember.{core::num::+}(2);
+ self::C::staticMember = self::C::staticMember.{core::num::+}(1);
+ self::C::staticMember = self::C::staticMember.{core::num::-}(1);
+}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.strong.transformed.expect
new file mode 100644
index 0000000..5af0f3e
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.strong.transformed.expect
@@ -0,0 +1,104 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:17:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:18:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:19:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember = 42;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:21:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember.isEven;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:22:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember.toString();
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:23:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property[0];
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:24:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property[0] = 0;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:25:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property2[0] ??= 0;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:26:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember2 ??= 42;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:27:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember += 2;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:28:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember++;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:29:5: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// --C?.staticMember;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → self::C
+ : super core::Object::•()
+ ;
+ static get staticMember() → core::int
+ return 0;
+ static set staticMember(core::int value) → void {}
+ static get staticMember2() → core::int?
+ return 0;
+ static set staticMember2(core::int? value) → void {}
+ static method staticMethod() → void {}
+ static get property() → core::List<core::int>
+ return <core::int>[0];
+ static get property2() → core::Map<core::int, core::int?>
+ return <core::int, core::int?>{};
+}
+static method main() → void {
+ self::C::staticMember;
+ self::C::staticMember;
+ self::C::staticMember = 42;
+ self::C::staticMethod();
+ self::C::staticMember.{core::int::isEven};
+ self::C::staticMember.{core::int::toString}();
+ self::C::property.{core::List::[]}(0);
+ self::C::property.{core::List::[]=}(0, 0);
+ let final core::Map<core::int, core::int?> #t1 = self::C::property2 in let final core::int #t2 = 0 in #t1.{core::Map::[]}(#t2).{core::num::==}(null) ?{core::int} #t1.{core::Map::[]=}(#t2, 0) : null;
+ self::C::staticMember2.{core::num::==}(null) ?{core::int} self::C::staticMember2 = 42 : null;
+ self::C::staticMember = self::C::staticMember.{core::num::+}(2);
+ self::C::staticMember = self::C::staticMember.{core::num::+}(1);
+ self::C::staticMember = self::C::staticMember.{core::num::-}(1);
+}
+
+
+Extra constant evaluation status:
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_static_access.dart:25:16 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_static_access.dart:25:16 -> IntConstant(0)
+Extra constant evaluation: evaluated: 38, effectively constant: 2
diff --git a/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.textual_outline.expect
new file mode 100644
index 0000000..7871be6
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.textual_outline.expect
@@ -0,0 +1,11 @@
+class C {
+ static int get staticMember => 0;
+ static void set staticMember(int value) {}
+ static int? get staticMember2 => 0;
+ static void set staticMember2(int? value) {}
+ static void staticMethod() {}
+ static List<int> get property => [0];
+ static Map<int, int?> get property2 => {};
+}
+
+void main() {}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..f1e61b6
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.textual_outline_modelled.expect
@@ -0,0 +1,11 @@
+class C {
+ static List<int> get property => [0];
+ static Map<int, int?> get property2 => {};
+ static int? get staticMember2 => 0;
+ static int get staticMember => 0;
+ static void set staticMember(int value) {}
+ static void set staticMember2(int? value) {}
+ static void staticMethod() {}
+}
+
+void main() {}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.weak.expect b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.weak.expect
new file mode 100644
index 0000000..df91c3c
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.weak.expect
@@ -0,0 +1,98 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:17:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:18:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:19:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember = 42;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:21:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember.isEven;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:22:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember.toString();
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:23:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property[0];
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:24:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property[0] = 0;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:25:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property2[0] ??= 0;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:26:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember2 ??= 42;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:27:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember += 2;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:28:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember++;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:29:5: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// --C?.staticMember;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → self::C
+ : super core::Object::•()
+ ;
+ static get staticMember() → core::int
+ return 0;
+ static set staticMember(core::int value) → void {}
+ static get staticMember2() → core::int?
+ return 0;
+ static set staticMember2(core::int? value) → void {}
+ static method staticMethod() → void {}
+ static get property() → core::List<core::int>
+ return <core::int>[0];
+ static get property2() → core::Map<core::int, core::int?>
+ return <core::int, core::int?>{};
+}
+static method main() → void {
+ self::C::staticMember;
+ self::C::staticMember;
+ self::C::staticMember = 42;
+ self::C::staticMethod();
+ self::C::staticMember.{core::int::isEven};
+ self::C::staticMember.{core::int::toString}();
+ self::C::property.{core::List::[]}(0);
+ self::C::property.{core::List::[]=}(0, 0);
+ let final core::Map<core::int, core::int?> #t1 = self::C::property2 in let final core::int #t2 = 0 in #t1.{core::Map::[]}(#t2).{core::num::==}(null) ?{core::int} #t1.{core::Map::[]=}(#t2, 0) : null;
+ self::C::staticMember2.{core::num::==}(null) ?{core::int} self::C::staticMember2 = 42 : null;
+ self::C::staticMember = self::C::staticMember.{core::num::+}(2);
+ self::C::staticMember = self::C::staticMember.{core::num::+}(1);
+ self::C::staticMember = self::C::staticMember.{core::num::-}(1);
+}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.weak.transformed.expect
new file mode 100644
index 0000000..5af0f3e
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_static_access.dart.weak.transformed.expect
@@ -0,0 +1,104 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:17:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:18:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:19:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember = 42;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:21:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember.isEven;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:22:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember.toString();
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:23:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property[0];
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:24:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property[0] = 0;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:25:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.property2[0] ??= 0;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:26:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember2 ??= 42;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:27:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember += 2;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:28:3: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// C?.staticMember++;
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_static_access.dart:29:5: Warning: The class 'C' cannot be null.
+// Try replacing '?.' with '.'
+// --C?.staticMember;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → self::C
+ : super core::Object::•()
+ ;
+ static get staticMember() → core::int
+ return 0;
+ static set staticMember(core::int value) → void {}
+ static get staticMember2() → core::int?
+ return 0;
+ static set staticMember2(core::int? value) → void {}
+ static method staticMethod() → void {}
+ static get property() → core::List<core::int>
+ return <core::int>[0];
+ static get property2() → core::Map<core::int, core::int?>
+ return <core::int, core::int?>{};
+}
+static method main() → void {
+ self::C::staticMember;
+ self::C::staticMember;
+ self::C::staticMember = 42;
+ self::C::staticMethod();
+ self::C::staticMember.{core::int::isEven};
+ self::C::staticMember.{core::int::toString}();
+ self::C::property.{core::List::[]}(0);
+ self::C::property.{core::List::[]=}(0, 0);
+ let final core::Map<core::int, core::int?> #t1 = self::C::property2 in let final core::int #t2 = 0 in #t1.{core::Map::[]}(#t2).{core::num::==}(null) ?{core::int} #t1.{core::Map::[]=}(#t2, 0) : null;
+ self::C::staticMember2.{core::num::==}(null) ?{core::int} self::C::staticMember2 = 42 : null;
+ self::C::staticMember = self::C::staticMember.{core::num::+}(2);
+ self::C::staticMember = self::C::staticMember.{core::num::+}(1);
+ self::C::staticMember = self::C::staticMember.{core::num::-}(1);
+}
+
+
+Extra constant evaluation status:
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_static_access.dart:25:16 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_static_access.dart:25:16 -> IntConstant(0)
+Extra constant evaluation: evaluated: 38, effectively constant: 2
diff --git a/pkg/front_end/testcases/nnbd/null_aware_this_access.dart b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart
new file mode 100644
index 0000000..d82d2f6
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2020, 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.
+
+class C {
+ int? m1;
+ int m2 = 0;
+
+ C get property => this;
+
+ test() {
+ this?.m1;
+ this?.m1 = 42;
+ this?.method();
+ this?.property.m1;
+ this?.property.method();
+ this?[0];
+ this?[0] = 0;
+ this?[0] ??= 0;
+ this?.property[0];
+ this?.property[0] = 0;
+ this?.property[0] ??= 0;
+ this?.m1 ??= 42;
+ this?.m2 += 2;
+ this?.m2++;
+ --this?.m2;
+ this ?? new C();
+ }
+
+ int? operator [](int index) => 0;
+
+ void operator []=(int index, int value) {}
+
+ method() {}
+}
+
+class D {
+ D get property => this;
+
+ test() {
+ this?[0];
+ this?[0] = 0;
+ this?[0] += 0;
+ this?.property[0];
+ this?.property[0] = 0;
+ this?.property[0] += 0;
+ }
+
+ int operator [](int index) => 0;
+
+ void operator []=(int index, int value) {}
+}
+
+main() {
+ new C().test();
+ new D().test();
+}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.outline.expect b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.outline.expect
new file mode 100644
index 0000000..754edd6
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.outline.expect
@@ -0,0 +1,34 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ field core::int? m1;
+ field core::int m2;
+ synthetic constructor •() → self::C
+ ;
+ get property() → self::C
+ ;
+ method test() → dynamic
+ ;
+ operator [](core::int index) → core::int?
+ ;
+ operator []=(core::int index, core::int value) → void
+ ;
+ method method() → dynamic
+ ;
+}
+class D extends core::Object {
+ synthetic constructor •() → self::D
+ ;
+ get property() → self::D
+ ;
+ method test() → dynamic
+ ;
+ operator [](core::int index) → core::int
+ ;
+ operator []=(core::int index, core::int value) → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.strong.expect b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.strong.expect
new file mode 100644
index 0000000..2c133c7
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.strong.expect
@@ -0,0 +1,170 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:12:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:13:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1 = 42;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:14:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.method();
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:15:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property.m1;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:16:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property.method();
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:17:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:18:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:19:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] ??= 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:20:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:21:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:22:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] ??= 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:23:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1 ??= 42;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:24:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m2 += 2;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:25:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m2++;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:26:7: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// --this?.m2;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:27:5: Warning: Operand of null-aware operation '??' has type 'C' which excludes null.
+// - 'C' is from 'pkg/front_end/testcases/nnbd/null_aware_this_access.dart'.
+// this ?? new C();
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:41:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:42:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:43:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] += 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:44:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:45:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:46:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] += 0;
+// ^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ field core::int? m1 = null;
+ field core::int m2 = 0;
+ synthetic constructor •() → self::C
+ : super core::Object::•()
+ ;
+ get property() → self::C
+ return this;
+ method test() → dynamic {
+ this.{self::C::m1};
+ this.{self::C::m1} = 42;
+ this.{self::C::method}();
+ this.{self::C::property}.{self::C::m1};
+ this.{self::C::property}.{self::C::method}();
+ this.{self::C::[]}(0);
+ this.{self::C::[]=}(0, 0);
+ let final core::int #t1 = 0 in this.{self::C::[]}(#t1).{core::num::==}(null) ?{core::int} this.{self::C::[]=}(#t1, 0) : null;
+ this.{self::C::property}.{self::C::[]}(0);
+ this.{self::C::property}.{self::C::[]=}(0, 0);
+ let final self::C #t2 = this.{self::C::property} in let final core::int #t3 = 0 in #t2.{self::C::[]}(#t3).{core::num::==}(null) ?{core::int} #t2.{self::C::[]=}(#t3, 0) : null;
+ this.{self::C::m1}.{core::num::==}(null) ?{core::int} this.{self::C::m1} = 42 : null;
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::+}(2);
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::+}(1);
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::-}(1);
+ this;
+ }
+ operator [](core::int index) → core::int?
+ return 0;
+ operator []=(core::int index, core::int value) → void {}
+ method method() → dynamic {}
+}
+class D extends core::Object {
+ synthetic constructor •() → self::D
+ : super core::Object::•()
+ ;
+ get property() → self::D
+ return this;
+ method test() → dynamic {
+ this.{self::D::[]}(0);
+ this.{self::D::[]=}(0, 0);
+ let final core::int #t4 = 0 in this.{self::D::[]=}(#t4, this.{self::D::[]}(#t4).{core::num::+}(0));
+ this.{self::D::property}.{self::D::[]}(0);
+ this.{self::D::property}.{self::D::[]=}(0, 0);
+ let final self::D #t5 = this.{self::D::property} in let final core::int #t6 = 0 in #t5.{self::D::[]=}(#t6, #t5.{self::D::[]}(#t6).{core::num::+}(0));
+ }
+ operator [](core::int index) → core::int
+ return 0;
+ operator []=(core::int index, core::int value) → void {}
+}
+static method main() → dynamic {
+ new self::C::•().{self::C::test}();
+ new self::D::•().{self::D::test}();
+}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.strong.transformed.expect
new file mode 100644
index 0000000..992a282
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.strong.transformed.expect
@@ -0,0 +1,182 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:12:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:13:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1 = 42;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:14:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.method();
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:15:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property.m1;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:16:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property.method();
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:17:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:18:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:19:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] ??= 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:20:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:21:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:22:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] ??= 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:23:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1 ??= 42;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:24:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m2 += 2;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:25:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m2++;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:26:7: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// --this?.m2;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:27:5: Warning: Operand of null-aware operation '??' has type 'C' which excludes null.
+// - 'C' is from 'pkg/front_end/testcases/nnbd/null_aware_this_access.dart'.
+// this ?? new C();
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:41:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:42:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:43:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] += 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:44:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:45:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:46:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] += 0;
+// ^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ field core::int? m1 = null;
+ field core::int m2 = 0;
+ synthetic constructor •() → self::C
+ : super core::Object::•()
+ ;
+ get property() → self::C
+ return this;
+ method test() → dynamic {
+ this.{self::C::m1};
+ this.{self::C::m1} = 42;
+ this.{self::C::method}();
+ this.{self::C::property}.{self::C::m1};
+ this.{self::C::property}.{self::C::method}();
+ this.{self::C::[]}(0);
+ this.{self::C::[]=}(0, 0);
+ let final core::int #t1 = 0 in this.{self::C::[]}(#t1).{core::num::==}(null) ?{core::int} this.{self::C::[]=}(#t1, 0) : null;
+ this.{self::C::property}.{self::C::[]}(0);
+ this.{self::C::property}.{self::C::[]=}(0, 0);
+ let final self::C #t2 = this.{self::C::property} in let final core::int #t3 = 0 in #t2.{self::C::[]}(#t3).{core::num::==}(null) ?{core::int} #t2.{self::C::[]=}(#t3, 0) : null;
+ this.{self::C::m1}.{core::num::==}(null) ?{core::int} this.{self::C::m1} = 42 : null;
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::+}(2);
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::+}(1);
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::-}(1);
+ this;
+ }
+ operator [](core::int index) → core::int?
+ return 0;
+ operator []=(core::int index, core::int value) → void {}
+ method method() → dynamic {}
+}
+class D extends core::Object {
+ synthetic constructor •() → self::D
+ : super core::Object::•()
+ ;
+ get property() → self::D
+ return this;
+ method test() → dynamic {
+ this.{self::D::[]}(0);
+ this.{self::D::[]=}(0, 0);
+ let final core::int #t4 = 0 in this.{self::D::[]=}(#t4, this.{self::D::[]}(#t4).{core::num::+}(0));
+ this.{self::D::property}.{self::D::[]}(0);
+ this.{self::D::property}.{self::D::[]=}(0, 0);
+ let final self::D #t5 = this.{self::D::property} in let final core::int #t6 = 0 in #t5.{self::D::[]=}(#t6, #t5.{self::D::[]}(#t6).{core::num::+}(0));
+ }
+ operator [](core::int index) → core::int
+ return 0;
+ operator []=(core::int index, core::int value) → void {}
+}
+static method main() → dynamic {
+ new self::C::•().{self::C::test}();
+ new self::D::•().{self::D::test}();
+}
+
+
+Extra constant evaluation status:
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:19:11 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:19:11 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:22:20 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:22:20 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:43:11 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:43:11 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:46:20 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:46:20 -> IntConstant(0)
+Extra constant evaluation: evaluated: 100, effectively constant: 8
diff --git a/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.textual_outline.expect
new file mode 100644
index 0000000..64332d9
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.textual_outline.expect
@@ -0,0 +1,18 @@
+class C {
+ int? m1;
+ int m2 = 0;
+ C get property => this;
+ test() {}
+ int? operator [](int index) => 0;
+ void operator []=(int index, int value) {}
+ method() {}
+}
+
+class D {
+ D get property => this;
+ test() {}
+ int operator [](int index) => 0;
+ void operator []=(int index, int value) {}
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..0315e45
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.textual_outline_modelled.expect
@@ -0,0 +1,18 @@
+class C {
+ C get property => this;
+ int? m1;
+ int? operator [](int index) => 0;
+ int m2 = 0;
+ method() {}
+ test() {}
+ void operator []=(int index, int value) {}
+}
+
+class D {
+ D get property => this;
+ int operator [](int index) => 0;
+ test() {}
+ void operator []=(int index, int value) {}
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.weak.expect b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.weak.expect
new file mode 100644
index 0000000..2c133c7
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.weak.expect
@@ -0,0 +1,170 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:12:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:13:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1 = 42;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:14:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.method();
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:15:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property.m1;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:16:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property.method();
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:17:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:18:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:19:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] ??= 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:20:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:21:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:22:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] ??= 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:23:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1 ??= 42;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:24:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m2 += 2;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:25:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m2++;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:26:7: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// --this?.m2;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:27:5: Warning: Operand of null-aware operation '??' has type 'C' which excludes null.
+// - 'C' is from 'pkg/front_end/testcases/nnbd/null_aware_this_access.dart'.
+// this ?? new C();
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:41:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:42:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:43:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] += 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:44:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:45:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:46:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] += 0;
+// ^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ field core::int? m1 = null;
+ field core::int m2 = 0;
+ synthetic constructor •() → self::C
+ : super core::Object::•()
+ ;
+ get property() → self::C
+ return this;
+ method test() → dynamic {
+ this.{self::C::m1};
+ this.{self::C::m1} = 42;
+ this.{self::C::method}();
+ this.{self::C::property}.{self::C::m1};
+ this.{self::C::property}.{self::C::method}();
+ this.{self::C::[]}(0);
+ this.{self::C::[]=}(0, 0);
+ let final core::int #t1 = 0 in this.{self::C::[]}(#t1).{core::num::==}(null) ?{core::int} this.{self::C::[]=}(#t1, 0) : null;
+ this.{self::C::property}.{self::C::[]}(0);
+ this.{self::C::property}.{self::C::[]=}(0, 0);
+ let final self::C #t2 = this.{self::C::property} in let final core::int #t3 = 0 in #t2.{self::C::[]}(#t3).{core::num::==}(null) ?{core::int} #t2.{self::C::[]=}(#t3, 0) : null;
+ this.{self::C::m1}.{core::num::==}(null) ?{core::int} this.{self::C::m1} = 42 : null;
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::+}(2);
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::+}(1);
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::-}(1);
+ this;
+ }
+ operator [](core::int index) → core::int?
+ return 0;
+ operator []=(core::int index, core::int value) → void {}
+ method method() → dynamic {}
+}
+class D extends core::Object {
+ synthetic constructor •() → self::D
+ : super core::Object::•()
+ ;
+ get property() → self::D
+ return this;
+ method test() → dynamic {
+ this.{self::D::[]}(0);
+ this.{self::D::[]=}(0, 0);
+ let final core::int #t4 = 0 in this.{self::D::[]=}(#t4, this.{self::D::[]}(#t4).{core::num::+}(0));
+ this.{self::D::property}.{self::D::[]}(0);
+ this.{self::D::property}.{self::D::[]=}(0, 0);
+ let final self::D #t5 = this.{self::D::property} in let final core::int #t6 = 0 in #t5.{self::D::[]=}(#t6, #t5.{self::D::[]}(#t6).{core::num::+}(0));
+ }
+ operator [](core::int index) → core::int
+ return 0;
+ operator []=(core::int index, core::int value) → void {}
+}
+static method main() → dynamic {
+ new self::C::•().{self::C::test}();
+ new self::D::•().{self::D::test}();
+}
diff --git a/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.weak.transformed.expect
new file mode 100644
index 0000000..992a282
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/null_aware_this_access.dart.weak.transformed.expect
@@ -0,0 +1,182 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:12:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:13:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1 = 42;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:14:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.method();
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:15:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property.m1;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:16:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property.method();
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:17:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:18:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:19:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] ??= 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:20:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:21:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:22:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] ??= 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:23:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m1 ??= 42;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:24:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m2 += 2;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:25:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.m2++;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:26:7: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// --this?.m2;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:27:5: Warning: Operand of null-aware operation '??' has type 'C' which excludes null.
+// - 'C' is from 'pkg/front_end/testcases/nnbd/null_aware_this_access.dart'.
+// this ?? new C();
+// ^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:41:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:42:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:43:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?[0] += 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:44:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0];
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:45:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] = 0;
+// ^^^^
+//
+// pkg/front_end/testcases/nnbd/null_aware_this_access.dart:46:5: Warning: The receiver 'this' cannot be null.
+// Try replacing '?.' with '.'
+// this?.property[0] += 0;
+// ^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ field core::int? m1 = null;
+ field core::int m2 = 0;
+ synthetic constructor •() → self::C
+ : super core::Object::•()
+ ;
+ get property() → self::C
+ return this;
+ method test() → dynamic {
+ this.{self::C::m1};
+ this.{self::C::m1} = 42;
+ this.{self::C::method}();
+ this.{self::C::property}.{self::C::m1};
+ this.{self::C::property}.{self::C::method}();
+ this.{self::C::[]}(0);
+ this.{self::C::[]=}(0, 0);
+ let final core::int #t1 = 0 in this.{self::C::[]}(#t1).{core::num::==}(null) ?{core::int} this.{self::C::[]=}(#t1, 0) : null;
+ this.{self::C::property}.{self::C::[]}(0);
+ this.{self::C::property}.{self::C::[]=}(0, 0);
+ let final self::C #t2 = this.{self::C::property} in let final core::int #t3 = 0 in #t2.{self::C::[]}(#t3).{core::num::==}(null) ?{core::int} #t2.{self::C::[]=}(#t3, 0) : null;
+ this.{self::C::m1}.{core::num::==}(null) ?{core::int} this.{self::C::m1} = 42 : null;
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::+}(2);
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::+}(1);
+ this.{self::C::m2} = this.{self::C::m2}.{core::num::-}(1);
+ this;
+ }
+ operator [](core::int index) → core::int?
+ return 0;
+ operator []=(core::int index, core::int value) → void {}
+ method method() → dynamic {}
+}
+class D extends core::Object {
+ synthetic constructor •() → self::D
+ : super core::Object::•()
+ ;
+ get property() → self::D
+ return this;
+ method test() → dynamic {
+ this.{self::D::[]}(0);
+ this.{self::D::[]=}(0, 0);
+ let final core::int #t4 = 0 in this.{self::D::[]=}(#t4, this.{self::D::[]}(#t4).{core::num::+}(0));
+ this.{self::D::property}.{self::D::[]}(0);
+ this.{self::D::property}.{self::D::[]=}(0, 0);
+ let final self::D #t5 = this.{self::D::property} in let final core::int #t6 = 0 in #t5.{self::D::[]=}(#t6, #t5.{self::D::[]}(#t6).{core::num::+}(0));
+ }
+ operator [](core::int index) → core::int
+ return 0;
+ operator []=(core::int index, core::int value) → void {}
+}
+static method main() → dynamic {
+ new self::C::•().{self::C::test}();
+ new self::D::•().{self::D::test}();
+}
+
+
+Extra constant evaluation status:
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:19:11 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:19:11 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:22:20 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:22:20 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:43:11 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:43:11 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:46:20 -> IntConstant(0)
+Evaluated: VariableGet @ org-dartlang-testcase:///null_aware_this_access.dart:46:20 -> IntConstant(0)
+Extra constant evaluation: evaluated: 100, effectively constant: 8
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index eb51541..3be2c16 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -189,6 +189,7 @@
nnbd/issue43211: FormatterCrash
nnbd/issue43278: FormatterCrash
nnbd/issue43354: FormatterCrash
+nnbd/issue43689: FormatterCrash
nnbd/language_issue1182: FormatterCrash
nnbd/late: FormatterCrash
nnbd/later: FormatterCrash
diff --git a/pkg/front_end/tool/_fasta/command_line.dart b/pkg/front_end/tool/_fasta/command_line.dart
index ca24131..1f64a3d 100644
--- a/pkg/front_end/tool/_fasta/command_line.dart
+++ b/pkg/front_end/tool/_fasta/command_line.dart
@@ -197,6 +197,7 @@
Flags.target: const StringValue(),
Flags.verbose: const BoolValue(false),
Flags.verify: const BoolValue(false),
+ Flags.verifySkipPlatform: const BoolValue(false),
Flags.warnOnReachabilityCheck: const BoolValue(false),
Flags.linkDependencies: const UriListValue(),
Flags.noDeps: const BoolValue(false),
@@ -265,6 +266,8 @@
final bool verify = options[Flags.verify];
+ final bool verifySkipPlatform = options[Flags.verifySkipPlatform];
+
final bool dumpIr = options[Flags.dumpIr];
final bool excludeSource = options[Flags.excludeSource];
@@ -347,6 +350,7 @@
..omitPlatform = omitPlatform
..verbose = verbose
..verify = verify
+ ..verifySkipPlatform = verifySkipPlatform
..experimentalFlags = experimentalFlags
..environmentDefines = noDefines ? null : parsedArguments.defines
..nnbdMode = nnbdMode
diff --git a/pkg/front_end/tool/_fasta/entry_points.dart b/pkg/front_end/tool/_fasta/entry_points.dart
index 1a4399f2..d1af713 100644
--- a/pkg/front_end/tool/_fasta/entry_points.dart
+++ b/pkg/front_end/tool/_fasta/entry_points.dart
@@ -13,6 +13,9 @@
import 'package:_fe_analyzer_shared/src/util/relativize.dart'
show isWindows, relativizeUri;
+import 'package:front_end/src/fasta/fasta_codes.dart'
+ show LocatedMessage, codeInternalProblemVerificationError;
+
import 'package:kernel/kernel.dart'
show CanonicalName, Library, Component, Source, loadComponentFromBytes;
@@ -136,6 +139,8 @@
Component platformComponent;
+ bool hadVerifyError = false;
+
BatchCompiler(this.lines);
run() async {
@@ -176,12 +181,15 @@
ProcessedOptions options = c.options;
bool verbose = options.verbose;
Ticker ticker = new Ticker(isVerbose: verbose);
- if (platformComponent == null || platformUri != options.sdkSummary) {
+ if (platformComponent == null ||
+ platformUri != options.sdkSummary ||
+ hadVerifyError) {
platformUri = options.sdkSummary;
platformComponent = await options.loadSdkSummary(null);
if (platformComponent == null) {
throw "platformComponent is null";
}
+ hadVerifyError = false;
} else {
options.sdkSummaryComponent = platformComponent;
}
@@ -195,7 +203,13 @@
root.adoptChild(name);
}
}
- root.unbindAll();
+ for (Object error in c.errors) {
+ if (error is LocatedMessage) {
+ if (error.messageObject.code == codeInternalProblemVerificationError) {
+ hadVerifyError = true;
+ }
+ }
+ }
return c.errors.isEmpty;
}
}
@@ -314,9 +328,9 @@
dillTarget.loader.appendLibraries(additionalDill);
}
} else {
- Uri platform = c.options.sdkSummary;
- if (platform != null) {
- _appendDillForUri(dillTarget, platform);
+ Component sdkSummary = await c.options.loadSdkSummary(null);
+ if (sdkSummary != null) {
+ dillTarget.loader.appendLibraries(sdkSummary);
}
}
diff --git a/pkg/kernel/lib/class_hierarchy.dart b/pkg/kernel/lib/class_hierarchy.dart
index 9f8500c..f0ea6cc 100644
--- a/pkg/kernel/lib/class_hierarchy.dart
+++ b/pkg/kernel/lib/class_hierarchy.dart
@@ -164,6 +164,9 @@
/// mixin application (i.e. [Class.mixedInType]).
bool isUsedAsMixin(Class class_);
+ /// True if the given class is extended by another class using `extends`.
+ bool isExtended(Class class_);
+
/// Invokes [callback] for every member declared in or inherited by [class_]
/// that overrides or implements a member in a supertype of [class_]
/// (or in rare cases, overrides a member declared in [class_]).
@@ -547,6 +550,11 @@
return infoFor(class_).directMixers.isNotEmpty;
}
+ @override
+ bool isExtended(Class class_) {
+ return infoFor(class_).directExtenders.isNotEmpty;
+ }
+
List<_ClassInfo> _getRankedSuperclassInfos(_ClassInfo info) {
if (info.leastUpperBoundInfos != null) return info.leastUpperBoundInfos;
var heap = new _LubHeap()..add(info);
diff --git a/pkg/nnbd_migration/lib/src/edge_builder.dart b/pkg/nnbd_migration/lib/src/edge_builder.dart
index 44f256d..762e728 100644
--- a/pkg/nnbd_migration/lib/src/edge_builder.dart
+++ b/pkg/nnbd_migration/lib/src/edge_builder.dart
@@ -368,7 +368,8 @@
var sourceIsSetupCall = false;
if (node.leftHandSide is SimpleIdentifier &&
_isCurrentFunctionExpressionFoundInTestSetUpCall()) {
- var assignee = (node.leftHandSide as SimpleIdentifier).staticElement;
+ var assignee =
+ getWriteOrReadElement(node.leftHandSide as SimpleIdentifier);
var enclosingElementOfCurrentFunction =
_currentFunctionExpression.declaredElement.enclosingElement;
if (enclosingElementOfCurrentFunction == assignee.enclosingElement) {
@@ -1001,7 +1002,7 @@
} else if (target != null) {
targetType = _checkExpressionNotNull(target);
}
- var callee = node.staticElement;
+ var callee = getWriteOrReadElement(node);
DecoratedType result;
if (callee == null) {
// Dynamic dispatch. The return type is `dynamic`.
@@ -1306,7 +1307,7 @@
writeType = _fixNumericTypes(calleeType.returnType, node.staticType);
}
if (operand is SimpleIdentifier) {
- var element = operand.staticElement;
+ var element = getWriteOrReadElement(operand);
if (element is PromotableElement) {
_flowAnalysis.write(element, writeType);
}
@@ -1357,7 +1358,7 @@
}
if (isIncrementOrDecrement) {
if (operand is SimpleIdentifier) {
- var element = operand.staticElement;
+ var element = getWriteOrReadElement(operand);
if (element is PromotableElement) {
_flowAnalysis.write(element, staticType);
}
@@ -1499,7 +1500,7 @@
@override
DecoratedType visitSimpleIdentifier(SimpleIdentifier node) {
DecoratedType result;
- var staticElement = node.staticElement;
+ var staticElement = getWriteOrReadElement(node);
if (staticElement is PromotableElement) {
if (!node.inDeclarationContext()) {
var promotedType = _flowAnalysis.variableRead(node, staticElement);
@@ -2198,7 +2199,7 @@
PromotableElement destinationLocalVariable;
if (destinationType == null) {
if (destinationExpression is SimpleIdentifier) {
- var element = destinationExpression.staticElement;
+ var element = getWriteOrReadElement(destinationExpression);
if (element is PromotableElement) {
destinationLocalVariable = element;
}
@@ -2825,7 +2826,7 @@
DecoratedType _handlePropertyAccess(Expression node, Expression target,
SimpleIdentifier propertyName, bool isNullAware, bool isCascaded) {
DecoratedType targetType;
- var callee = propertyName.staticElement;
+ var callee = getWriteOrReadElement(propertyName);
bool calleeIsStatic = callee is ExecutableElement && callee.isStatic;
if (isCascaded) {
targetType = _currentCascadeTargetType;
@@ -3141,6 +3142,47 @@
return _futureOf(type, node);
}
+
+ /// If the [node] is the finishing identifier of an assignment, return its
+ /// "writeElement", otherwise return its "staticElement", which might be
+ /// thought as the "readElement".
+ static Element getWriteOrReadElement(AstNode node) {
+ var writeElement = _getWriteElement(node);
+ if (writeElement != null) {
+ return writeElement;
+ }
+
+ if (node is IndexExpression) {
+ return node.staticElement;
+ } else if (node is SimpleIdentifier) {
+ return node.staticElement;
+ } else {
+ return null;
+ }
+ }
+
+ /// If the [node] is the target of a [CompoundAssignmentExpression],
+ /// return the corresponding "writeElement", which is the local variable,
+ /// the setter referenced with a [SimpleIdentifier] or a [PropertyAccess],
+ /// or the `[]=` operator.
+ static Element _getWriteElement(AstNode node) {
+ var parent = node.parent;
+ if (parent is AssignmentExpression && parent.leftHandSide == node) {
+ return parent.writeElement;
+ } else if (parent is PostfixExpression) {
+ return parent.writeElement;
+ } else if (parent is PrefixExpression) {
+ return parent.writeElement;
+ }
+
+ if (parent is PrefixedIdentifier && parent.identifier == node) {
+ return _getWriteElement(parent);
+ } else if (parent is PropertyAccess && parent.propertyName == node) {
+ return _getWriteElement(parent);
+ } else {
+ return null;
+ }
+ }
}
/// Implementation of [_checkAssignment] for [EdgeBuilder].
diff --git a/pkg/nnbd_migration/lib/src/front_end/region_renderer.dart b/pkg/nnbd_migration/lib/src/front_end/region_renderer.dart
index e6be786..33f4b6c 100644
--- a/pkg/nnbd_migration/lib/src/front_end/region_renderer.dart
+++ b/pkg/nnbd_migration/lib/src/front_end/region_renderer.dart
@@ -49,14 +49,11 @@
EditLink linkForEdit(EditDetail edit) => EditLink(
description: edit.description,
- href: Uri(
- scheme: 'http',
- path: pathContext.basename(unitInfo.path),
- queryParameters: {
- 'offset': edit.offset.toString(),
- 'end': (edit.offset + edit.length).toString(),
- 'replacement': edit.replacement
- }).toString());
+ href: Uri(path: pathContext.basename(unitInfo.path), queryParameters: {
+ 'offset': edit.offset.toString(),
+ 'end': (edit.offset + edit.length).toString(),
+ 'replacement': edit.replacement
+ }).toString());
var response = EditDetails(
displayPath: unitInfo.path,
diff --git a/pkg/nnbd_migration/test/migration_cli_test.dart b/pkg/nnbd_migration/test/migration_cli_test.dart
index 9b4e0a3..42325ee 100644
--- a/pkg/nnbd_migration/test/migration_cli_test.dart
+++ b/pkg/nnbd_migration/test/migration_cli_test.dart
@@ -207,6 +207,8 @@
final hasUsageText = contains('Usage: nnbd_migration');
+ final urlStartRegexp = RegExp('https?:');
+
String assertDecodeArgsFailure(List<String> args) {
var cli = _createCli();
try {
@@ -276,7 +278,7 @@
}
Future assertPreviewServerResponsive(String url) async {
- var response = await http.get(url);
+ var response = await httpGet(url);
assertHttpSuccess(response);
}
@@ -348,6 +350,19 @@
return stderrText;
}
+ /// Wraps a future containing an HTTP response so that when that response is
+ /// received, we will verify that it is reasonable.
+ Future<http.Response> checkHttpResponse(
+ Future<http.Response> futureResponse) async {
+ var response = await futureResponse;
+ // Check that all "http:" and "https:" URLs in the given HTTP response are
+ // absolute (guards against https://github.com/dart-lang/sdk/issues/43545).
+ for (var match in urlStartRegexp.allMatches(response.body)) {
+ expect(response.body.substring(match.end), startsWith('//'));
+ }
+ return response;
+ }
+
String createProjectDir(Map<String, String> contents,
{String posixPath = '/test_project'}) {
for (var entry in contents.entries) {
@@ -366,6 +381,20 @@
return jsonDecode(response.body)['sourceCode'] as String;
}
+ /// Performs an HTTP get, verifying that the response received (if any) is
+ /// reasonable.
+ Future<http.Response> httpGet(dynamic url, {Map<String, String> headers}) {
+ return checkHttpResponse(http.get(url, headers: headers));
+ }
+
+ /// Performs an HTTP post, verifying that the response received (if any) is
+ /// reasonable.
+ Future<http.Response> httpPost(dynamic url,
+ {Map<String, String> headers, dynamic body, Encoding encoding}) {
+ return checkHttpResponse(
+ http.post(url, headers: headers, body: body, encoding: encoding));
+ }
+
Future<void> runWithPreviewServer(_MigrationCli cli, List<String> args,
Future<void> Function(String) callback) async {
String url;
@@ -378,7 +407,7 @@
await callback(url);
});
// Server should be stopped now
- expect(http.get(url), throwsA(anything));
+ expect(httpGet(url), throwsA(anything));
assertNormalExit(cliRunner);
}
}
@@ -848,7 +877,7 @@
await assertPreviewServerResponsive(url);
var uri = Uri.parse(url);
var authToken = uri.queryParameters['authToken'];
- var response = await http.post(
+ var response = await httpPost(
uri.replace(
path: resourceProvider.pathContext
.toUri(resourceProvider.pathContext
@@ -884,7 +913,7 @@
await assertPreviewServerResponsive(url);
var uri = Uri.parse(url);
var authToken = uri.queryParameters['authToken'];
- var response = await http.post(
+ var response = await httpPost(
uri.replace(
path: PreviewSite.applyMigrationPath,
queryParameters: {'authToken': authToken}),
@@ -915,7 +944,7 @@
await assertPreviewServerResponsive(url);
final uri = Uri.parse(url);
final authToken = uri.queryParameters['authToken'];
- final fileResponse = await http.get(
+ final fileResponse = await httpGet(
uri.replace(
path: resourceProvider.pathContext
.toUri(resourceProvider.pathContext
@@ -928,7 +957,7 @@
final aLink = RegExp(r'<a href="([^"]+)" class="nav-link">');
for (final match in aLink.allMatches(navigation)) {
var href = match.group(1);
- final contentsResponse = await http.get(
+ final contentsResponse = await httpGet(
uri.replace(
path: Uri.parse(href).path,
queryParameters: {'inline': 'true', 'authToken': authToken}),
@@ -948,7 +977,7 @@
await assertPreviewServerResponsive(url);
var uri = Uri.parse(url);
var authToken = uri.queryParameters['authToken'];
- var treeResponse = await http.get(
+ var treeResponse = await httpGet(
uri.replace(
path: '/_preview/navigationTree.json',
queryParameters: {'authToken': authToken}),
@@ -958,7 +987,7 @@
var navTree = NavigationTreeNode.fromJson(root);
for (final file in navTree.subtree) {
if (file.href != null) {
- final contentsResponse = await http.get(
+ final contentsResponse = await httpGet(
uri
.resolve(file.href)
.replace(queryParameters: {'authToken': authToken}),
@@ -993,7 +1022,7 @@
await assertPreviewServerResponsive(url);
var uri = Uri.parse(url);
var authToken = uri.queryParameters['authToken'];
- var regionResponse = await http.get(
+ var regionResponse = await httpGet(
uri.replace(
path: resourceProvider.pathContext
.toUri(resourceProvider.pathContext
@@ -1009,7 +1038,7 @@
final displayPath = regionJson.displayPath;
final uriPath = regionJson.uriPath;
// uriPath should be a working URI
- final contentsResponse = await http.get(
+ final contentsResponse = await httpGet(
uri.replace(
path: uriPath,
queryParameters: {'inline': 'true', 'authToken': authToken}),
@@ -1034,7 +1063,7 @@
await assertPreviewServerResponsive(url);
final uri = Uri.parse(url);
final authToken = uri.queryParameters['authToken'];
- final fileResponse = await http.get(
+ final fileResponse = await httpGet(
uri.replace(
path: resourceProvider.pathContext
.toUri(resourceProvider.pathContext
@@ -1047,7 +1076,7 @@
final regionsPathRegex = RegExp(r'<table data-path="([^"]+)">');
expect(regionsPathRegex.hasMatch(regions), true);
final regionsPath = regionsPathRegex.matchAsPrefix(regions).group(1);
- final contentsResponse = await http.get(
+ final contentsResponse = await httpGet(
uri.replace(
path: Uri.parse(regionsPath).path,
queryParameters: {'inline': 'true', 'authToken': authToken}),
@@ -1071,7 +1100,7 @@
// We haven't rerun, so getting the file details from the server should
// still yield the original source text
expect(await getSourceFromServer(uri, testPath), origSourceText);
- var response = await http.post(uri.replace(path: 'rerun-migration'),
+ var response = await httpPost(uri.replace(path: 'rerun-migration'),
headers: {'Content-Type': 'application/json; charset=UTF-8'});
assertHttpSuccess(response);
// Now that we've rerun, the server should yield the new source text
@@ -1094,7 +1123,7 @@
// fail
var response = await tryGetSourceFromServer(uri, test2Path);
expect(response.statusCode, 404);
- response = await http.post(uri.replace(path: 'rerun-migration'),
+ response = await httpPost(uri.replace(path: 'rerun-migration'),
headers: {'Content-Type': 'application/json; charset=UTF-8'});
assertHttpSuccess(response);
// Now that we've rerun, the server should yield the new source text
@@ -1124,7 +1153,7 @@
contains('lib${separator}test.dart'));
// Now delete the lib file and rerun
resourceProvider.deleteFile(testPath);
- var response = await http.post(uri.replace(path: 'rerun-migration'),
+ var response = await httpPost(uri.replace(path: 'rerun-migration'),
headers: {'Content-Type': 'application/json; charset=UTF-8'});
assertHttpSuccess(response);
// lib/test.dart should no longer be readable from the server and
@@ -1153,7 +1182,7 @@
// We haven't rerun, so getting the file details from the server should
// still yield the original source text, with informational space.
expect(await getSourceFromServer(uri, testPath), 'void f(int i) {}');
- var response = await http.post(uri.replace(path: 'rerun-migration'),
+ var response = await httpPost(uri.replace(path: 'rerun-migration'),
headers: {'Content-Type': 'application/json; charset=UTF-8'});
assertHttpSuccess(response);
var body = jsonDecode(response.body);
@@ -1214,7 +1243,7 @@
await assertPreviewServerResponsive(url);
var uri = Uri.parse(url);
var authToken = uri.queryParameters['authToken'];
- var regionResponse = await http.get(
+ var regionResponse = await httpGet(
uri.replace(
path: resourceProvider.pathContext
.toUri(resourceProvider.pathContext
@@ -1227,7 +1256,7 @@
}),
headers: {'Content-Type': 'application/json; charset=UTF-8'});
var regionJson = jsonDecode(regionResponse.body);
- var response = await http.post(
+ var response = await httpPost(
uri.replace(
path: 'apply-hint', queryParameters: {'authToken': authToken}),
headers: {'Content-Type': 'application/json; charset=UTF-8'},
@@ -1259,13 +1288,13 @@
'offset': '3',
'authToken': authToken
});
- var regionResponse = await http.get(regionUri,
+ var regionResponse = await httpGet(regionUri,
headers: {'Content-Type': 'application/json; charset=UTF-8'});
var regionJson = EditDetails.fromJson(jsonDecode(regionResponse.body));
final traceEntry = regionJson.traces[0].entries[0];
final uriPath = traceEntry.link.href;
// uriPath should be a working URI
- final contentsResponse = await http.get(
+ final contentsResponse = await httpGet(
regionUri
.resolve(uriPath)
.replace(queryParameters: {'authToken': authToken}),
@@ -1367,7 +1396,7 @@
resourceProvider.getFile(testPath).writeAsStringSync(newSourceText);
// Rerunning should create a new summary
var uri = Uri.parse(url);
- var response = await http.post(uri.replace(path: 'rerun-migration'),
+ var response = await httpPost(uri.replace(path: 'rerun-migration'),
headers: {'Content-Type': 'application/json; charset=UTF-8'});
assertHttpSuccess(response);
summaryData =
@@ -1806,7 +1835,7 @@
Future<http.Response> tryGetSourceFromServer(Uri uri, String path) async {
var authToken = uri.queryParameters['authToken'];
- return await http.get(
+ return await httpGet(
uri.replace(
path: resourceProvider.pathContext.toUri(path).path,
queryParameters: {'inline': 'true', 'authToken': authToken}),
diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart
index 4698cc2..01ae343 100644
--- a/pkg/test_runner/lib/src/compiler_configuration.dart
+++ b/pkg/test_runner/lib/src/compiler_configuration.dart
@@ -1192,6 +1192,7 @@
var compilerArguments = [
'--verify',
+ '--verify-skip-platform',
"-o",
outputFileName,
"--platform",
diff --git a/pkg/testing/lib/src/chain.dart b/pkg/testing/lib/src/chain.dart
index a6c982d..c6f6c16 100644
--- a/pkg/testing/lib/src/chain.dart
+++ b/pkg/testing/lib/src/chain.dart
@@ -358,16 +358,18 @@
/// update the test to match new expectations.
final String autoFixCommand;
- Result(this.output, this.outcome, this.error, this.trace,
- {this.autoFixCommand});
+ Result(this.output, this.outcome, this.error,
+ {this.trace, this.autoFixCommand});
- Result.pass(O output) : this(output, Expectation.Pass, null, null);
+ Result.pass(O output) : this(output, Expectation.Pass, null);
Result.crash(error, StackTrace trace)
- : this(null, Expectation.Crash, error, trace);
+ : this(null, Expectation.Crash, error, trace: trace);
Result.fail(O output, [error, StackTrace trace])
- : this(output, Expectation.Fail, error, trace);
+ : this(output, Expectation.Fail, error, trace: trace);
+
+ bool get isPass => outcome == Expectation.Pass;
String get log => logs.join();
@@ -376,7 +378,14 @@
}
Result<O> copyWithOutcome(Expectation outcome) {
- return new Result<O>(output, outcome, error, trace)..logs.addAll(logs);
+ return new Result<O>(output, outcome, error, trace: trace)
+ ..logs.addAll(logs);
+ }
+
+ Result<O2> copyWithOutput<O2>(O2 output) {
+ return new Result<O2>(output, outcome, error,
+ trace: trace, autoFixCommand: autoFixCommand)
+ ..logs.addAll(logs);
}
}
diff --git a/pkg/testing/lib/src/expectation.dart b/pkg/testing/lib/src/expectation.dart
index 8c8e7e9..58efce8 100644
--- a/pkg/testing/lib/src/expectation.dart
+++ b/pkg/testing/lib/src/expectation.dart
@@ -34,6 +34,8 @@
const Expectation(this.name, this.group);
+ const Expectation.fail(this.name) : group = ExpectationGroup.Fail;
+
/// Returns the canonical expectation representing [group]. That is, one of
/// the above expectations (except for `Meta` which returns `this`).
Expectation get canonical => fromGroup(group) ?? this;
diff --git a/pkg/testing/lib/src/stdio_process.dart b/pkg/testing/lib/src/stdio_process.dart
index 72b534a..16bbfdf 100644
--- a/pkg/testing/lib/src/stdio_process.dart
+++ b/pkg/testing/lib/src/stdio_process.dart
@@ -28,7 +28,7 @@
return new Result<int>.pass(exitCode);
} else {
return new Result<int>(
- exitCode, ExpectationSet.Default["RuntimeError"], output, null);
+ exitCode, ExpectationSet.Default["RuntimeError"], output);
}
}
diff --git a/runtime/observatory/BUILD.gn b/runtime/observatory/BUILD.gn
index 1762e1a..360863c 100644
--- a/runtime/observatory/BUILD.gn
+++ b/runtime/observatory/BUILD.gn
@@ -37,6 +37,8 @@
"-o",
rebase_path(output),
"--packages=" + rebase_path("../../.packages"),
+ "--enable-experiment=non-nullable",
+ "--no-sound-null-safety",
]
if (is_debug) {
args += [ "--enable-asserts" ]
diff --git a/runtime/observatory/analysis_options.yaml b/runtime/observatory/analysis_options.yaml
index 6babf28..13bad8a 100644
--- a/runtime/observatory/analysis_options.yaml
+++ b/runtime/observatory/analysis_options.yaml
@@ -1,7 +1,10 @@
analyzer:
+ enable-experiment:
+ - non-nullable
errors:
dead_code: ignore
unused_local_variable: ignore
+ getter_not_subtype_setter_types: ignore
exclude:
- tests/service/bad_reload/v2/main.dart
- tests/service/complex_reload/v2/main.dart
diff --git a/runtime/observatory/bin/heap_snapshot.dart b/runtime/observatory/bin/heap_snapshot.dart
index 22d3ce5..b5aaf93 100644
--- a/runtime/observatory/bin/heap_snapshot.dart
+++ b/runtime/observatory/bin/heap_snapshot.dart
@@ -22,14 +22,14 @@
reader.onProgress.listen(print);
- ws.listen((dynamic response) {
- if (response is String) {
- response = json.decode(response);
+ ws.listen((dynamic dynResponse) {
+ if (dynResponse is String) {
+ final response = json.decode(dynResponse);
if (response['id'] == 1) {
getVM.complete(response['result']['isolates'][0]['id']);
}
- } else if (response is List<int>) {
- response = new Uint8List.fromList(response);
+ } else if (dynResponse is List<int>) {
+ final response = new Uint8List.fromList(dynResponse);
final dataOffset =
new ByteData.view(response.buffer).getUint32(0, Endian.little);
dynamic metadata = new Uint8List.view(response.buffer, 4, dataOffset - 4);
diff --git a/runtime/observatory/bin/shell.dart b/runtime/observatory/bin/shell.dart
index a0cb274..d6c551f 100644
--- a/runtime/observatory/bin/shell.dart
+++ b/runtime/observatory/bin/shell.dart
@@ -30,7 +30,7 @@
void main() {
String addr = 'ws://localhost:8181/ws';
new WebSocketVM(new WebSocketVMTarget(addr)).load().then((serviceObject) {
- VM vm = serviceObject;
+ VM vm = serviceObject as VM;
Isolate isolate = vm.isolates.first;
repl(vm, isolate, 'isolate ${isolate.id}');
});
diff --git a/runtime/observatory/lib/event.dart b/runtime/observatory/lib/event.dart
index e79b16b..71bed82 100644
--- a/runtime/observatory/lib/event.dart
+++ b/runtime/observatory/lib/event.dart
@@ -108,7 +108,7 @@
final bool atAsyncSuspension;
/// [optional]
- final M.Breakpoint breakpoint;
+ final M.Breakpoint? breakpoint;
PauseBreakpointEvent(
this.timestamp,
this.isolate,
@@ -128,7 +128,7 @@
class PauseInterruptedEvent implements M.PauseInterruptedEvent {
final DateTime timestamp;
final M.IsolateRef isolate;
- final M.Frame topFrame;
+ final M.Frame? topFrame;
final bool atAsyncSuspension;
PauseInterruptedEvent(
this.timestamp, this.isolate, this.topFrame, this.atAsyncSuspension) {
@@ -141,7 +141,7 @@
class PausePostRequestEvent implements M.PausePostRequestEvent {
final DateTime timestamp;
final M.IsolateRef isolate;
- final M.Frame topFrame;
+ final M.Frame? topFrame;
final bool atAsyncSuspension;
PausePostRequestEvent(
this.timestamp, this.isolate, this.topFrame, this.atAsyncSuspension) {
@@ -168,7 +168,7 @@
class ResumeEvent implements M.ResumeEvent {
final DateTime timestamp;
final M.IsolateRef isolate;
- final M.Frame topFrame;
+ final M.Frame? topFrame;
ResumeEvent(this.timestamp, this.isolate, this.topFrame) {
assert(timestamp != null);
assert(isolate != null);
@@ -309,69 +309,71 @@
}
}
-M.Event createEventFromServiceEvent(S.ServiceEvent event) {
+M.Event? createEventFromServiceEvent(S.ServiceEvent event) {
switch (event.kind) {
case S.ServiceEvent.kVMUpdate:
- return new VMUpdateEvent(event.timestamp, event.vm);
+ return new VMUpdateEvent(event.timestamp!, event.vm);
case S.ServiceEvent.kIsolateStart:
- return new IsolateStartEvent(event.timestamp, event.isolate);
+ return new IsolateStartEvent(event.timestamp!, event.isolate!);
case S.ServiceEvent.kIsolateRunnable:
- return new IsolateRunnableEvent(event.timestamp, event.isolate);
+ return new IsolateRunnableEvent(event.timestamp!, event.isolate!);
case S.ServiceEvent.kIsolateUpdate:
- return new IsolateUpdateEvent(event.timestamp, event.isolate);
+ return new IsolateUpdateEvent(event.timestamp!, event.isolate!);
case S.ServiceEvent.kIsolateReload:
return new IsolateReloadEvent(
- event.timestamp, event.isolate, event.error);
+ event.timestamp!, event.isolate!, event.error!);
case S.ServiceEvent.kIsolateExit:
- return new IsolateExitEvent(event.timestamp, event.isolate);
+ return new IsolateExitEvent(event.timestamp!, event.isolate!);
case S.ServiceEvent.kBreakpointAdded:
return new BreakpointAddedEvent(
- event.timestamp, event.isolate, event.breakpoint);
+ event.timestamp!, event.isolate!, event.breakpoint!);
case S.ServiceEvent.kBreakpointResolved:
return new BreakpointResolvedEvent(
- event.timestamp, event.isolate, event.breakpoint);
+ event.timestamp!, event.isolate!, event.breakpoint!);
case S.ServiceEvent.kBreakpointRemoved:
return new BreakpointRemovedEvent(
- event.timestamp, event.isolate, event.breakpoint);
+ event.timestamp!, event.isolate!, event.breakpoint!);
case S.ServiceEvent.kDebuggerSettingsUpdate:
- return new DebuggerSettingsUpdateEvent(event.timestamp, event.isolate);
+ return new DebuggerSettingsUpdateEvent(event.timestamp!, event.isolate!);
case S.ServiceEvent.kResume:
- return new ResumeEvent(event.timestamp, event.isolate, event.topFrame);
+ return new ResumeEvent(event.timestamp!, event.isolate!, event.topFrame);
case S.ServiceEvent.kPauseStart:
- return new PauseStartEvent(event.timestamp, event.isolate);
+ return new PauseStartEvent(event.timestamp!, event.isolate!);
case S.ServiceEvent.kPauseExit:
- return new PauseExitEvent(event.timestamp, event.isolate);
+ return new PauseExitEvent(event.timestamp!, event.isolate!);
case S.ServiceEvent.kPausePostRequest:
- return new PausePostRequestEvent(event.timestamp, event.isolate,
- event.topFrame, event.atAsyncSuspension);
+ return new PausePostRequestEvent(event.timestamp!, event.isolate!,
+ event.topFrame, event.atAsyncSuspension!);
case S.ServiceEvent.kPauseBreakpoint:
return new PauseBreakpointEvent(
- event.timestamp,
- event.isolate,
- event.pauseBreakpoints,
- event.topFrame,
- event.atAsyncSuspension,
+ event.timestamp!,
+ event.isolate!,
+ event.pauseBreakpoints!,
+ event.topFrame!,
+ event.atAsyncSuspension!,
event.breakpoint);
case S.Isolate.kLoggingStream:
- return new LoggingEvent(event.timestamp, event.isolate, event.logRecord);
+ return new LoggingEvent(
+ event.timestamp!, event.isolate!, event.logRecord!);
case S.ServiceEvent.kPauseInterrupted:
- return new PauseInterruptedEvent(event.timestamp, event.isolate,
- event.topFrame, event.atAsyncSuspension);
+ return new PauseInterruptedEvent(event.timestamp!, event.isolate!,
+ event.topFrame, event.atAsyncSuspension!);
case S.ServiceEvent.kPauseException:
return new PauseExceptionEvent(
- event.timestamp, event.isolate, event.topFrame, event.exception);
+ event.timestamp!, event.isolate!, event.topFrame!, event.exception!);
case S.ServiceEvent.kInspect:
- return new InspectEvent(event.timestamp, event.isolate, event.inspectee);
+ return new InspectEvent(
+ event.timestamp!, event.isolate!, event.inspectee!);
case S.ServiceEvent.kGC:
- return new GCEvent(event.timestamp, event.isolate);
+ return new GCEvent(event.timestamp!, event.isolate!);
case S.ServiceEvent.kServiceRegistered:
return new ServiceRegisteredEvent(
- event.timestamp, event.service, event.method, event.alias);
+ event.timestamp!, event.service!, event.method!, event.alias!);
case S.ServiceEvent.kServiceUnregistered:
return new ServiceUnregisteredEvent(
- event.timestamp, event.service, event.method);
+ event.timestamp!, event.service!, event.method!);
case S.ServiceEvent.kNone:
- return new NoneEvent(event.timestamp, event.isolate);
+ return new NoneEvent(event.timestamp!, event.isolate!);
default:
// Ignore unrecognized events.
Logger.root.severe('Unrecognized event: $event');
diff --git a/runtime/observatory/lib/object_graph.dart b/runtime/observatory/lib/object_graph.dart
index 0e891ce..f0adee0 100644
--- a/runtime/observatory/lib/object_graph.dart
+++ b/runtime/observatory/lib/object_graph.dart
@@ -22,7 +22,7 @@
class _SnapshotReader implements SnapshotReader {
bool _closed = false;
- var _chunks = <Uint8List>[];
+ List<Uint8List>? _chunks = <Uint8List>[];
final _onProgress = new StreamController<String>.broadcast();
final _done = new Completer<SnapshotGraph>();
@@ -32,8 +32,8 @@
if (_closed) {
throw new StateError("Stream is closed");
}
- _chunks.add(chunk);
- _onProgress.add("Receiving snapshot chunk ${_chunks.length}...");
+ _chunks!.add(chunk);
+ _onProgress.add("Receiving snapshot chunk ${_chunks!.length}...");
// TODO(rmacnak): Incremental loading.
}
@@ -45,7 +45,7 @@
_closed = true;
var graph = new _SnapshotGraph._new();
- var chunks = _chunks;
+ var chunks = _chunks!;
_chunks = null; // Let the binary chunks be GCable.
_done.complete(graph._load(chunks, _onProgress));
return _done.future;
@@ -270,39 +270,39 @@
int get hashCode => _id ^ _graph.hashCode;
int get shallowSize => internalSize + externalSize;
- int get internalSize => _graph._internalSizes[_id];
- int get externalSize => _graph._externalSizes[_id];
- int get retainedSize => _graph._retainedSizes[_id];
+ int get internalSize => _graph._internalSizes![_id];
+ int get externalSize => _graph._externalSizes![_id];
+ int get retainedSize => _graph._retainedSizes![_id];
String get description => _graph._describeObject(_id);
- SnapshotClass get klass => _graph._classes[_graph._cids[_id]];
+ SnapshotClass get klass => _graph._classes![_graph._cids![_id]]!;
Iterable<SnapshotObject> get successors sync* {
final id = _id;
- final cid = _graph._cids[id];
- final startSuccIndex = _graph._firstSuccs[id];
- final limitSuccIndex = _graph._firstSuccs[id + 1];
+ final cid = _graph._cids![id];
+ final startSuccIndex = _graph._firstSuccs![id];
+ final limitSuccIndex = _graph._firstSuccs![id + 1];
for (var nextSuccIndex = startSuccIndex;
nextSuccIndex < limitSuccIndex;
nextSuccIndex++) {
final index = nextSuccIndex - startSuccIndex;
- final succId = _graph._succs[nextSuccIndex];
+ final succId = _graph._succs![nextSuccIndex];
final name = _graph._edgeName(cid, index);
yield _SnapshotObject._new(succId, _graph, name);
}
}
Iterable<SnapshotObject> get predecessors sync* {
- var firstSuccs = _graph._firstSuccs;
- var succs = _graph._succs;
+ var firstSuccs = _graph._firstSuccs!;
+ var succs = _graph._succs!;
var id = _id;
- var N = _graph._N;
+ var N = _graph._N!;
for (var predId = 1; predId <= N; predId++) {
var base = firstSuccs[predId];
var limit = firstSuccs[predId + 1];
for (var i = base; i < limit; i++) {
if (succs[i] == id) {
- var cid = _graph._cids[predId];
+ var cid = _graph._cids![predId];
var name = _graph._edgeName(cid, i - base);
yield _SnapshotObject._new(predId, _graph, name);
}
@@ -314,12 +314,12 @@
if (_id == _ROOT) {
return this;
}
- return _SnapshotObject._new(_graph._doms[_id], _graph, "");
+ return _SnapshotObject._new(_graph._doms![_id], _graph, "");
}
Iterable<SnapshotObject> get children sync* {
- var N = _graph._N;
- var doms = _graph._doms;
+ var N = _graph._N!;
+ var doms = _graph._doms!;
var parentId = _id;
for (var childId = _ROOT; childId <= N; childId++) {
if (doms[childId] == parentId) {
@@ -334,17 +334,17 @@
}
class _SyntheticSnapshotObject implements SnapshotObject {
- String _description;
- SnapshotClass _klass;
- int _internalSize;
- int _externalSize;
- int _retainedSize;
- List<SnapshotObject> _successors;
- List<SnapshotObject> _predecessors;
- SnapshotObject _parent;
- List<SnapshotObject> _children;
+ late String _description;
+ late SnapshotClass _klass;
+ late int _internalSize;
+ late int _externalSize;
+ late int _retainedSize;
+ late List<SnapshotObject> _successors;
+ late List<SnapshotObject> _predecessors;
+ late SnapshotObject _parent;
+ late List<SnapshotObject> _children;
- String get label => null;
+ String get label => "";
String get description => _description;
SnapshotClass get klass => _klass;
@@ -404,7 +404,7 @@
class _SnapshotMergedDominator implements SnapshotMergedDominator {
final int _id;
final _SnapshotGraph _graph;
- final _SnapshotMergedDominator _parent;
+ final _SnapshotMergedDominator? _parent;
_SnapshotMergedDominator._new(this._id, this._graph, this._parent);
@@ -423,70 +423,78 @@
: "$instanceCount instances of ${klass.name}";
}
- SnapshotClass get klass => _graph._classes[_graph._cids[_id]];
+ SnapshotClass get klass => _graph._classes![_graph._cids![_id]]!;
int get shallowSize => internalSize + externalSize;
int get internalSize {
- var cids = _graph._cids;
+ var cids = _graph._cids!;
+ var internalSizes = _graph._internalSizes!;
+ var mergedDomNext = _graph._mergedDomNext!;
var size = 0;
var sibling = _id;
while (sibling != _SENTINEL && cids[sibling] == cids[_id]) {
- size += _graph._internalSizes[sibling];
- sibling = _graph._mergedDomNext[sibling];
+ size += internalSizes[sibling];
+ sibling = mergedDomNext[sibling];
}
return size;
}
int get externalSize {
- var cids = _graph._cids;
+ var cids = _graph._cids!;
+ var externalSizes = _graph._externalSizes!;
+ var mergedDomNext = _graph._mergedDomNext!;
var size = 0;
var sibling = _id;
while (sibling != _SENTINEL && cids[sibling] == cids[_id]) {
- size += _graph._externalSizes[sibling];
- sibling = _graph._mergedDomNext[sibling];
+ size += externalSizes[sibling];
+ sibling = mergedDomNext[sibling];
}
return size;
}
int get retainedSize {
- var cids = _graph._cids;
+ var cids = _graph._cids!;
+ var retainedSizes = _graph._retainedSizes!;
+ var mergedDomNext = _graph._mergedDomNext!;
var size = 0;
var sibling = _id;
while (sibling != _SENTINEL && cids[sibling] == cids[_id]) {
- size += _graph._retainedSizes[sibling];
- sibling = _graph._mergedDomNext[sibling];
+ size += retainedSizes[sibling];
+ sibling = mergedDomNext[sibling];
}
return size;
}
int get instanceCount {
- var cids = _graph._cids;
+ var cids = _graph._cids!;
+ var mergedDomNext = _graph._mergedDomNext!;
var count = 0;
var sibling = _id;
while (sibling != _SENTINEL && cids[sibling] == cids[_id]) {
count++;
- sibling = _graph._mergedDomNext[sibling];
+ sibling = mergedDomNext[sibling];
}
return count;
}
Iterable<SnapshotObject> get objects sync* {
- var cids = _graph._cids;
+ var cids = _graph._cids!;
+ var mergedDomNext = _graph._mergedDomNext!;
var sibling = _id;
while (sibling != _SENTINEL && cids[sibling] == cids[_id]) {
yield _SnapshotObject._new(sibling, _graph, "");
- sibling = _graph._mergedDomNext[sibling];
+ sibling = mergedDomNext[sibling];
}
}
SnapshotMergedDominator get parent => _parent ?? this;
Iterable<SnapshotMergedDominator> get children sync* {
- var next = _graph._mergedDomNext;
- var cids = _graph._cids;
+ var next = _graph._mergedDomNext!;
+ var cids = _graph._cids!;
var prev = _SENTINEL;
- var child = _graph._mergedDomHead[_id];
+ var child = _graph._mergedDomHead![_id];
// Walk the list of children and look for the representative objects, i.e.
// the first sibling of each cid.
while (child != _SENTINEL) {
@@ -500,14 +508,14 @@
}
class _SyntheticSnapshotMergedDominator implements SnapshotMergedDominator {
- String _description;
- SnapshotClass _klass;
- int _internalSize;
- int _externalSize;
- int _retainedSize;
- List<SnapshotObject> _objects;
- SnapshotMergedDominator _parent;
- List<SnapshotMergedDominator> _children;
+ late String _description;
+ late SnapshotClass _klass;
+ late int _internalSize;
+ late int _externalSize;
+ late int _retainedSize;
+ late List<SnapshotObject> _objects;
+ late SnapshotMergedDominator _parent;
+ late List<SnapshotMergedDominator> _children;
SnapshotClass get klass => _klass;
String get description => _description;
@@ -560,9 +568,11 @@
int get instanceCount => liveInstanceCount;
Iterable<SnapshotObject> get instances sync* {
- final N = _graph._N;
+ final N = _graph._N!;
+ final cids = _graph._cids!;
+ final retainedSizes = _graph._retainedSizes!;
for (var id = 1; id <= N; id++) {
- if (_graph._cids[id] == _cid && _graph._retainedSizes[id] > 0) {
+ if (cids[id] == _cid && retainedSizes[id] > 0) {
yield _SnapshotObject._new(id, _graph, "");
}
}
@@ -613,36 +623,36 @@
const _kUnknownFieldName = "<unknown>";
class _SnapshotGraph implements SnapshotGraph {
- List<Uint8List> _chunks;
- List<Uint8List> get chunks => _chunks;
+ List<Uint8List>? _chunks;
+ List<Uint8List> get chunks => _chunks!;
_SnapshotGraph._new();
- String get description => _description;
+ String get description => _description!;
- int get size => _liveInternalSize + _liveExternalSize;
- int get internalSize => _liveInternalSize;
- int get externalSize => _liveExternalSize;
- int get capacity => _capacity;
+ int get size => _liveInternalSize! + _liveExternalSize!;
+ int get internalSize => _liveInternalSize!;
+ int get externalSize => _liveExternalSize!;
+ int get capacity => _capacity!;
SnapshotObject get root => _SnapshotObject._new(_ROOT, this, "Root");
SnapshotMergedDominator get mergedRoot =>
_SnapshotMergedDominator._new(_ROOT, this, null);
- SnapshotObject _extendedRoot;
+ SnapshotObject? _extendedRoot;
SnapshotObject get extendedRoot {
if (_extendedRoot == null) {
_createExtended();
}
- return _extendedRoot;
+ return _extendedRoot!;
}
- SnapshotMergedDominator _extendedMergedRoot;
+ SnapshotMergedDominator? _extendedMergedRoot;
SnapshotMergedDominator get extendedMergedRoot {
if (_extendedMergedRoot == null) {
_createExtended();
}
- return _extendedMergedRoot;
+ return _extendedMergedRoot!;
}
void _createExtended() {
@@ -657,8 +667,8 @@
capacity._description = "Capacity + External";
capacity._klass = live.klass;
- capacity._internalSize = _capacity;
- capacity._externalSize = _totalExternalSize;
+ capacity._internalSize = _capacity!;
+ capacity._externalSize = _totalExternalSize!;
capacity._retainedSize = capacity._internalSize + capacity._externalSize;
capacity._successors = <SnapshotObject>[live, uncollected, fragmentation];
capacity._predecessors = <SnapshotObject>[];
@@ -666,8 +676,8 @@
mcapacity._description = "Capacity + External";
mcapacity._klass = mlive.klass;
- mcapacity._internalSize = _capacity;
- mcapacity._externalSize = _totalExternalSize;
+ mcapacity._internalSize = _capacity!;
+ mcapacity._externalSize = _totalExternalSize!;
mcapacity._retainedSize = mcapacity._internalSize + mcapacity._externalSize;
mcapacity._children = <SnapshotMergedDominator>[
mlive,
@@ -678,8 +688,8 @@
uncollected._description = "Uncollected Garbage";
uncollected._klass = live.klass;
- uncollected._internalSize = _totalInternalSize - _liveInternalSize;
- uncollected._externalSize = _totalExternalSize - _liveExternalSize;
+ uncollected._internalSize = _totalInternalSize! - _liveInternalSize!;
+ uncollected._externalSize = _totalExternalSize! - _liveExternalSize!;
uncollected._retainedSize =
uncollected._internalSize + uncollected._externalSize;
uncollected._successors = <SnapshotObject>[];
@@ -689,8 +699,8 @@
muncollected._description = "Uncollected Garbage";
muncollected._klass = mlive.klass;
- muncollected._internalSize = _totalInternalSize - _liveInternalSize;
- muncollected._externalSize = _totalExternalSize - _liveExternalSize;
+ muncollected._internalSize = _totalInternalSize! - _liveInternalSize!;
+ muncollected._externalSize = _totalExternalSize! - _liveExternalSize!;
muncollected._retainedSize =
muncollected._internalSize + muncollected._externalSize;
muncollected._parent = mcapacity;
@@ -699,7 +709,7 @@
fragmentation._description = "Free";
fragmentation._klass = live.klass;
- fragmentation._internalSize = _capacity - _totalInternalSize;
+ fragmentation._internalSize = _capacity! - _totalInternalSize!;
fragmentation._externalSize = 0;
fragmentation._retainedSize = fragmentation._internalSize;
fragmentation._successors = <SnapshotObject>[];
@@ -709,7 +719,7 @@
mfragmentation._description = "Free";
mfragmentation._klass = mlive.klass;
- mfragmentation._internalSize = _capacity - _totalInternalSize;
+ mfragmentation._internalSize = _capacity! - _totalInternalSize!;
mfragmentation._externalSize = 0;
mfragmentation._retainedSize = mfragmentation._internalSize;
mfragmentation._parent = mcapacity;
@@ -721,9 +731,10 @@
}
Iterable<SnapshotObject> get objects sync* {
- final N = _N;
+ final N = _N!;
+ final retainedSizes = _retainedSizes!;
for (var id = 1; id <= N; id++) {
- if (_retainedSizes[id] > 0) {
+ if (retainedSizes[id] > 0) {
yield _SnapshotObject._new(id, this, "");
}
}
@@ -737,7 +748,7 @@
return _kRootName;
}
var cls = _className(oid);
- var data = _nonReferenceData[oid];
+ var data = _nonReferenceData![oid];
if (data == null) {
return cls;
} else {
@@ -746,8 +757,8 @@
}
String _className(int oid) {
- var cid = _cids[oid];
- var cls = _classes[cid];
+ var cid = _cids![oid];
+ var cls = _classes![cid];
if (cls == null) {
return "Class$cid";
}
@@ -755,7 +766,7 @@
}
String _edgeName(int cid, int index) {
- var c = _classes[cid];
+ var c = _classes![cid];
if (c == null) {
return _kUnknownFieldName;
}
@@ -767,7 +778,7 @@
}
Iterable<SnapshotClass> get classes sync* {
- for (final c in _classes) {
+ for (final c in _classes!) {
// Not all CIDs are occupied.
if (c != null) {
yield c;
@@ -776,9 +787,9 @@
}
Future<SnapshotGraph> _load(
- List<Uint8List> chunks, StreamController<String> onProgress) async {
+ List<Uint8List>? chunks, StreamController<String> onProgress) async {
_chunks = chunks;
- var stream = _ReadStream._new(chunks);
+ _ReadStream? stream = _ReadStream._new(chunks!);
chunks = null;
// The phases of loading are placed in explicit `new Future(compuation)` so
@@ -786,13 +797,13 @@
// defer to the microtask loop.
onProgress.add("Loading classes...");
- await new Future(() => _readClasses(stream));
+ await new Future(() => _readClasses(stream!));
onProgress.add("Loading objects...");
- await new Future(() => _readObjects(stream));
+ await new Future(() => _readObjects(stream!));
onProgress.add("Loading external properties...");
- await new Future(() => _readExternalProperties(stream));
+ await new Future(() => _readExternalProperties(stream!));
stream = null;
@@ -839,46 +850,46 @@
return this;
}
- Uint8List _encoded;
+ Uint8List? _encoded;
- String _description;
+ String? _description;
- int _kStackCid;
- int _kFieldCid;
- int _numCids;
- int _N; // Objects in the snapshot.
- int _Nconnected; // Objects reachable from root.
- int _E; // References in the snapshot.
+ int? _kStackCid;
+ int? _kFieldCid;
+ int? _numCids;
+ int? _N; // Objects in the snapshot.
+ int? _Nconnected; // Objects reachable from root.
+ int? _E; // References in the snapshot.
- int _capacity;
- int _liveInternalSize;
- int _liveExternalSize;
- int _totalInternalSize;
- int _totalExternalSize;
+ int? _capacity;
+ int? _liveInternalSize;
+ int? _liveExternalSize;
+ int? _totalInternalSize;
+ int? _totalExternalSize;
- List<_SnapshotClass> _classes;
+ List<_SnapshotClass?>? _classes;
// Indexed by node id, with id 0 representing invalid/uninitialized.
// From snapshot.
- List _nonReferenceData;
- Uint16List _cids;
- Uint32List _internalSizes;
- Uint32List _externalSizes;
- Uint32List _firstSuccs;
- Uint32List _succs;
+ List? _nonReferenceData;
+ Uint16List? _cids;
+ Uint32List? _internalSizes;
+ Uint32List? _externalSizes;
+ Uint32List? _firstSuccs;
+ Uint32List? _succs;
// Intermediates.
- Uint32List _vertex;
- Uint32List _parent;
- Uint32List _semi;
- Uint32List _firstPreds; // Offset into preds.
- Uint32List _preds;
+ Uint32List? _vertex;
+ Uint32List? _parent;
+ Uint32List? _semi;
+ Uint32List? _firstPreds; // Offset into preds.
+ Uint32List? _preds;
// Outputs.
- Uint32List _doms;
- Uint32List _retainedSizes;
- Uint32List _mergedDomHead;
- Uint32List _mergedDomNext;
+ Uint32List? _doms;
+ Uint32List? _retainedSizes;
+ Uint32List? _mergedDomHead;
+ Uint32List? _mergedDomNext;
void _readClasses(_ReadStream stream) {
for (var i = 0; i < 8; i++) {
@@ -892,7 +903,7 @@
_totalExternalSize = stream.readUnsigned();
var K = stream.readUnsigned();
- var classes = new List<_SnapshotClass>.filled(K + 1, null);
+ var classes = new List<_SnapshotClass?>.filled(K + 1, null);
classes[0] = _SnapshotClass._new(this, 0, "Root", "", "");
for (var cid = 1; cid <= K; cid++) {
@@ -935,7 +946,7 @@
var internalSizes = _newUint32Array(N + 1);
var cids = _newUint16Array(N + 1);
- var nonReferenceData = new List(N + 1);
+ var nonReferenceData = new List<dynamic>.filled(N + 1, null);
var firstSuccs = _newUint32Array(N + 2);
var succs = _newUint32Array(E);
var eid = 0;
@@ -1011,7 +1022,7 @@
}
void _readExternalProperties(_ReadStream stream) {
- final N = _N;
+ final N = _N!;
final externalPropertyCount = stream.readUnsigned();
final externalSizes = _newUint32Array(N + 1);
@@ -1026,11 +1037,11 @@
}
void _computeClassTable() {
- final N = _N;
- final classes = _classes;
- final cids = _cids;
- final internalSizes = _internalSizes;
- final externalSizes = _externalSizes;
+ final N = _N!;
+ final classes = _classes!;
+ final cids = _cids!;
+ final internalSizes = _internalSizes!;
+ final externalSizes = _externalSizes!;
var totalInternalSize = 0;
var totalExternalSize = 0;
@@ -1041,7 +1052,7 @@
var externalSize = externalSizes[oid];
totalExternalSize += externalSize;
- var cls = classes[cids[oid]];
+ var cls = classes[cids[oid]]!;
cls.totalInternalSize += internalSize;
cls.totalExternalSize += externalSize;
cls.totalInstanceCount++;
@@ -1052,9 +1063,9 @@
}
void _dfs() {
- final N = _N;
- final firstSuccs = _firstSuccs;
- final succs = _succs;
+ final N = _N!;
+ final firstSuccs = _firstSuccs!;
+ final succs = _succs!;
final stackNodes = _newUint32Array(N);
final stackCurrentEdgePos = _newUint32Array(N);
@@ -1142,11 +1153,11 @@
}
void _buildPredecessors() {
- final N = _N;
- final Nconnected = _Nconnected;
- final E = _E;
- final firstSuccs = _firstSuccs;
- final succs = _succs;
+ final N = _N!;
+ final Nconnected = _Nconnected!;
+ final E = _E!;
+ final firstSuccs = _firstSuccs!;
+ final succs = _succs!;
// This is first filled with the predecessor counts, then reused to hold the
// offset to the first predecessor (see alias below).
@@ -1201,17 +1212,17 @@
// Fold the size of any object with in-degree(1) into its parent.
// Requires the DFS numbering and predecessor lists.
void _buildOwnedSizes() {
- final N = _N;
- final Nconnected = _Nconnected;
+ final N = _N!;
+ final Nconnected = _Nconnected!;
final kStackCid = _kStackCid;
final kFieldCid = _kFieldCid;
- final cids = _cids;
- final internalSizes = _internalSizes;
- final externalSizes = _externalSizes;
- final vertex = _vertex;
- final firstPreds = _firstPreds;
- final preds = _preds;
+ final cids = _cids!;
+ final internalSizes = _internalSizes!;
+ final externalSizes = _externalSizes!;
+ final vertex = _vertex!;
+ final firstPreds = _firstPreds!;
+ final preds = _preds!;
final ownedSizes = _newUint32Array(N + 1);
for (var i = 1; i <= Nconnected; i++) {
@@ -1256,11 +1267,11 @@
// TODO(rmacnak): Maybe keep the per-objects sizes to be able to provide
// examples of large owners for each class.
- final classes = _classes;
+ final classes = _classes!;
for (var i = 1; i <= Nconnected; i++) {
final v = vertex[i];
final cid = cids[v];
- final cls = classes[cid];
+ final cls = classes[cid]!;
cls.ownedSize += ownedSizes[v];
}
}
@@ -1342,14 +1353,14 @@
// T. Lengauer and R. E. Tarjan. "A Fast Algorithm for Finding Dominators
// in a Flowgraph."
void _buildDominators() {
- final N = _N;
- final Nconnected = _Nconnected;
+ final N = _N!;
+ final Nconnected = _Nconnected!;
- final vertex = _vertex;
- final semi = _semi;
- final parent = _parent;
- final firstPreds = _firstPreds;
- final preds = _preds;
+ final vertex = _vertex!;
+ final semi = _semi!;
+ final parent = _parent!;
+ final firstPreds = _firstPreds!;
+ final preds = _preds!;
final dom = _newUint32Array(N + 1);
@@ -1358,7 +1369,7 @@
for (var i = 1; i <= N; i++) {
label[i] = i;
}
- final buckets = new List(N + 1);
+ final buckets = new List<dynamic>.filled(N + 1, null);
final child = _newUint32Array(N + 1);
final size = _newUint32Array(N + 1);
for (var i = 1; i <= N; i++) {
@@ -1385,7 +1396,7 @@
// w.semi.bucket.add(w);
var tmp = vertex[semi[w]];
if (buckets[tmp] == null) {
- buckets[tmp] = new List();
+ buckets[tmp] = [];
}
buckets[tmp].add(w);
@@ -1417,17 +1428,17 @@
}
void _calculateRetainedSizes() {
- final N = _N;
- final Nconnected = _Nconnected;
+ final N = _N!;
+ final Nconnected = _Nconnected!;
var liveInternalSize = 0;
var liveExternalSize = 0;
- final classes = _classes;
- final cids = _cids;
- final internalSizes = _internalSizes;
- final externalSizes = _externalSizes;
- final vertex = _vertex;
- final doms = _doms;
+ final classes = _classes!;
+ final cids = _cids!;
+ final internalSizes = _internalSizes!;
+ final externalSizes = _externalSizes!;
+ final vertex = _vertex!;
+ final doms = _doms!;
// Sum internal and external sizes.
for (var i = 1; i <= Nconnected; i++) {
@@ -1437,7 +1448,7 @@
liveInternalSize += internalSize;
liveExternalSize += externalSize;
- var cls = classes[cids[v]];
+ var cls = classes[cids[v]]!;
cls.liveInternalSize += internalSize;
cls.liveExternalSize += externalSize;
cls.liveInstanceCount++;
@@ -1468,18 +1479,18 @@
_liveInternalSize = liveInternalSize;
_liveExternalSize = liveExternalSize;
- print("internal-garbage: ${_totalInternalSize - _liveInternalSize}");
- print("external-garbage: ${_totalExternalSize - _liveExternalSize}");
- print("fragmentation: ${_capacity - _totalInternalSize}");
- assert(_liveInternalSize <= _totalInternalSize);
- assert(_liveExternalSize <= _totalExternalSize);
- assert(_totalInternalSize <= _capacity);
+ print("internal-garbage: ${_totalInternalSize! - _liveInternalSize!}");
+ print("external-garbage: ${_totalExternalSize! - _liveExternalSize!}");
+ print("fragmentation: ${_capacity! - _totalInternalSize!}");
+ assert(_liveInternalSize! <= _totalInternalSize!);
+ assert(_liveExternalSize! <= _totalExternalSize!);
+ assert(_totalInternalSize! <= _capacity!);
}
// Build linked lists of the children for each node in the dominator tree.
void _linkDominatorChildren() {
- final N = _N;
- final doms = _doms;
+ final N = _N!;
+ final doms = _doms!;
final head = _newUint32Array(N + 1);
final next = _newUint32Array(N + 1);
@@ -1533,10 +1544,10 @@
}
void _sortDominatorChildren() {
- final N = _N;
- final cids = _cids;
- final head = _mergedDomHead;
- final next = _mergedDomNext;
+ final N = _N!;
+ final cids = _cids!;
+ final head = _mergedDomHead!;
+ final next = _mergedDomNext!;
// Returns the new head of the sorted list.
int sort(int head) {
@@ -1570,10 +1581,10 @@
}
void _mergeDominatorSiblings() {
- var N = _N;
- var cids = _cids;
- var head = _mergedDomHead;
- var next = _mergedDomNext;
+ var N = _N!;
+ var cids = _cids!;
+ var head = _mergedDomHead!;
+ var next = _mergedDomNext!;
var workStack = _newUint32Array(N);
var workStackTop = 0;
diff --git a/runtime/observatory/lib/service_common.dart b/runtime/observatory/lib/service_common.dart
index 2ff8175..236343c 100644
--- a/runtime/observatory/lib/service_common.dart
+++ b/runtime/observatory/lib/service_common.dart
@@ -26,9 +26,9 @@
bool get standalone => !chrome;
// User defined name.
- String name;
+ late String name;
// Network address of VM.
- String networkAddress;
+ late String networkAddress;
WebSocketVMTarget(this.networkAddress) {
name = networkAddress;
@@ -89,7 +89,7 @@
String get displayName => '${name}@${target.name}';
- CommonWebSocket _webSocket;
+ CommonWebSocket? _webSocket;
CommonWebSocketVM(this.target, this._webSocket) {
assert(target != null);
@@ -120,7 +120,7 @@
void disconnect({String reason: 'WebSocket closed'}) {
if (_hasInitiatedConnect) {
if (_webSocket != null) {
- _webSocket.close();
+ _webSocket!.close();
}
}
// We don't need to cancel requests and notify here. These
@@ -135,8 +135,8 @@
if (!_hasInitiatedConnect) {
_hasInitiatedConnect = true;
try {
- await _webSocket.connect(
- target, _onOpen, _onMessage, _onError, _onClose);
+ await _webSocket!
+ .connect(target, _onOpen, _onMessage, _onError, _onClose);
} catch (_, stack) {
_webSocket = null;
var exception = new NetworkRpcException('WebSocket closed');
@@ -150,7 +150,7 @@
}
String serial = (_requestSerial++).toString();
var request = new _WebSocketRequest(method, params);
- if ((_webSocket != null) && _webSocket.isOpen) {
+ if ((_webSocket != null) && _webSocket!.isOpen) {
// Already connected, send request immediately.
_sendRequest(serial, request);
} else {
@@ -180,7 +180,7 @@
_notifyConnect();
}
- Map _parseJSON(String message) {
+ Map? _parseJSON(String message) {
var map;
try {
map = json.decode(message);
@@ -198,7 +198,7 @@
}
void _onBinaryMessage(dynamic data) {
- _webSocket.nonStringToByteData(data).then((ByteData bytes) {
+ _webSocket!.nonStringToByteData(data).then((ByteData bytes) {
var metadataOffset = 4;
var dataOffset = bytes.getUint32(0, Endian.little);
var metadataLength = dataOffset - metadataOffset;
@@ -292,7 +292,7 @@
/// Send all delayed requests.
void _sendAllDelayedRequests() {
- assert(_webSocket.isOpen);
+ assert(_webSocket!.isOpen);
if (_delayedRequests.length == 0) {
return;
}
@@ -305,7 +305,7 @@
/// Send the request over WebSocket.
void _sendRequest(String serial, _WebSocketRequest request) {
- assert(_webSocket.isOpen);
+ assert(_webSocket!.isOpen);
// Mark request as pending.
assert(_pendingRequests.containsKey(serial) == false);
_pendingRequests[serial] = request;
@@ -332,7 +332,7 @@
'GET [${serial}] ${request.method}(${request.params}) from ${target.networkAddress}');
}
// Send message.
- _webSocket.send(message);
+ _webSocket!.send(message);
}
String toString() => displayName;
diff --git a/runtime/observatory/lib/service_html.dart b/runtime/observatory/lib/service_html.dart
index cf93d5e..fa2be06 100644
--- a/runtime/observatory/lib/service_html.dart
+++ b/runtime/observatory/lib/service_html.dart
@@ -15,7 +15,7 @@
export 'package:observatory/service_common.dart';
class _HtmlWebSocket implements CommonWebSocket {
- WebSocket _webSocket;
+ WebSocket? _webSocket;
Future<void> connect(WebSocketVMTarget target, void onOpen(),
void onMessage(dynamic data), void onError(), void onClose()) async {
@@ -43,20 +43,20 @@
target.networkAddress = response['result']['uri'];
*/
_webSocket = new WebSocket(target.networkAddress);
- _webSocket.onClose.listen((CloseEvent) => onClose());
- _webSocket.onError.listen((Event) => onError());
- _webSocket.onOpen.listen((Event) => onOpen());
- _webSocket.onMessage.listen((MessageEvent event) => onMessage(event.data));
+ _webSocket!.onClose.listen((CloseEvent) => onClose());
+ _webSocket!.onError.listen((Event) => onError());
+ _webSocket!.onOpen.listen((Event) => onOpen());
+ _webSocket!.onMessage.listen((MessageEvent event) => onMessage(event.data));
}
- bool get isOpen => _webSocket.readyState == WebSocket.OPEN;
+ bool get isOpen => _webSocket!.readyState == WebSocket.OPEN;
void send(dynamic data) {
- _webSocket.send(data);
+ _webSocket!.send(data);
}
void close() {
- _webSocket.close();
+ _webSocket!.close();
}
Future<ByteData> nonStringToByteData(dynamic data) {
diff --git a/runtime/observatory/lib/service_io.dart b/runtime/observatory/lib/service_io.dart
index bf21fea..ece0fe1 100644
--- a/runtime/observatory/lib/service_io.dart
+++ b/runtime/observatory/lib/service_io.dart
@@ -15,13 +15,13 @@
export 'package:observatory/service_common.dart';
class _IOWebSocket implements CommonWebSocket {
- WebSocket _webSocket;
+ WebSocket? _webSocket;
Future<void> connect(WebSocketVMTarget target, void onOpen(),
void onMessage(dynamic data), void onError(), void onClose()) async {
try {
_webSocket = await WebSocket.connect(target.networkAddress);
- _webSocket.listen(onMessage,
+ _webSocket!.listen(onMessage,
onError: (dynamic) => onError(),
onDone: onClose,
cancelOnError: true);
@@ -32,16 +32,14 @@
}
bool get isOpen =>
- (_webSocket != null) && (_webSocket.readyState == WebSocket.open);
+ (_webSocket != null) && (_webSocket!.readyState == WebSocket.open);
void send(dynamic data) {
- _webSocket.add(data);
+ _webSocket!.add(data);
}
void close() {
- if (_webSocket != null) {
- _webSocket.close();
- }
+ _webSocket?.close();
}
Future<ByteData> nonStringToByteData(dynamic data) {
diff --git a/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart b/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart
index c1e7aa1..0ec7fa1 100644
--- a/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart
+++ b/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart
@@ -6,15 +6,16 @@
class AllocationProfile implements M.AllocationProfile {
static const _lastServiceGC = 'dateLastServiceGC';
- final DateTime lastServiceGC;
+ final DateTime? lastServiceGC;
static const _lastAccumulatorReset = 'dateLastAccumulatorReset';
- final DateTime lastAccumulatorReset;
+ final DateTime? lastAccumulatorReset;
final S.HeapSpace newSpace;
final S.HeapSpace oldSpace;
final S.HeapSpace totalSpace;
final Iterable<M.ClassHeapStats> members;
- AllocationProfile(S.ServiceMap map, {Map/*<String, List<String>>*/ defaults})
+ AllocationProfile(S.ServiceMap map,
+ {Map/*<String, List<String>>*/ ? defaults})
: lastAccumulatorReset = _intString2DateTime(map[_lastAccumulatorReset]),
lastServiceGC = _intString2DateTime(map[_lastServiceGC]),
oldSpace = new S.HeapSpace()..update(map['_heaps']['old']),
@@ -25,7 +26,7 @@
totalSpace.add(newSpace);
}
- static DateTime _intString2DateTime(String milliseconds) {
+ static DateTime? _intString2DateTime(String milliseconds) {
if ((milliseconds == null) || milliseconds == '') {
return null;
}
@@ -38,7 +39,7 @@
}
static List<M.ClassHeapStats> _convertMembers(Iterable/*<S.ServiceMap>*/ raw,
- {Map/*<String, List<String>>*/ defaults}) {
+ {Map/*<String, List<String>>*/ ? defaults}) {
final List<M.ClassHeapStats> members =
raw.map<ClassHeapStats>(_convertMember).toList();
if (defaults == null) {
@@ -49,26 +50,26 @@
final Map<String, List<ClassHeapStats>> accumulators =
<String, List<ClassHeapStats>>{};
defaults.forEach((/*String*/ key, /*List<String>*/ values) {
- final classes = aliases[key];
+ final classes = aliases[key]!;
accumulators.addAll(new Map.fromIterable(values, value: (_) => classes));
});
final List<M.ClassHeapStats> result = <M.ClassHeapStats>[];
members.forEach((M.ClassHeapStats member) {
- if (accumulators.containsKey(member.clazz.id)) {
- accumulators[member.clazz.id].add(member);
+ if (accumulators.containsKey(member.clazz!.id)) {
+ accumulators[member.clazz!.id]!.add(member as ClassHeapStats);
} else {
- result.add(member);
+ result.add(member as ClassHeapStats);
}
});
return result
..addAll(
- aliases.keys.map((key) => new ClassesHeapStats(key, aliases[key])));
+ aliases.keys.map((key) => new ClassesHeapStats(key, aliases[key]!)));
}
}
class ClassHeapStats implements M.ClassHeapStats {
- final S.Class clazz;
- final String displayName = null;
+ final S.Class? clazz;
+ final String? displayName = null;
final S.Allocations newSpace;
final S.Allocations oldSpace;
@@ -79,8 +80,8 @@
}
class ClassesHeapStats implements M.ClassHeapStats {
- final S.Class clazz = null;
- final String displayName;
+ final S.Class? clazz = null;
+ final String? displayName;
final S.Allocations newSpace;
final S.Allocations oldSpace;
diff --git a/runtime/observatory/lib/src/app/application.dart b/runtime/observatory/lib/src/app/application.dart
index 768c3b4..e7eae4d 100644
--- a/runtime/observatory/lib/src/app/application.dart
+++ b/runtime/observatory/lib/src/app/application.dart
@@ -7,30 +7,30 @@
/// The observatory application. Instances of this are created and owned
/// by the observatory_application custom element.
class ObservatoryApplication {
- static ObservatoryApplication app;
+ static late ObservatoryApplication app;
final RenderingQueue queue = new RenderingQueue();
final TargetRepository targets = new TargetRepository(isConnectedVMTarget);
final EventRepository events = new EventRepository();
final NotificationRepository notifications = new NotificationRepository();
final _pageRegistry = <Page>[];
- LocationManager _locationManager;
+ late LocationManager _locationManager;
LocationManager get locationManager => _locationManager;
- Page currentPage;
+ Page? currentPage;
bool _vmConnected = false;
- VM _vm;
- VM get vm => _vm;
+ VM? _vm;
+ VM get vm => _vm!;
static bool isConnectedVMTarget(M.Target target) {
if (app._vm is CommonWebSocketVM) {
if ((app._vm as CommonWebSocketVM).target == target) {
- return app._vm.isConnected;
+ return app._vm!.isConnected;
}
}
return false;
}
- _switchVM(VM newVM) {
- final VM oldVM = _vm;
+ _switchVM(VM? newVM) {
+ final VM? oldVM = _vm;
Logger.root.info('_switchVM from:${oldVM} to:${newVM}');
@@ -89,14 +89,14 @@
_vm = newVM;
}
- StreamSubscription _gcSubscription;
- StreamSubscription _loggingSubscription;
+ StreamSubscription? _gcSubscription;
+ StreamSubscription? _loggingSubscription;
Future startGCEventListener() async {
if (_gcSubscription != null || _vm == null) {
return;
}
- _gcSubscription = await _vm.listenEventStream(VM.kGCStream, _onEvent);
+ _gcSubscription = await _vm!.listenEventStream(VM.kGCStream, _onEvent);
}
Future startLoggingEventListener() async {
@@ -104,14 +104,14 @@
return;
}
_loggingSubscription =
- await _vm.listenEventStream(Isolate.kLoggingStream, _onEvent);
+ await _vm!.listenEventStream(Isolate.kLoggingStream, _onEvent);
}
Future stopGCEventListener() async {
if (_gcSubscription == null) {
return;
}
- _gcSubscription.cancel();
+ _gcSubscription!.cancel();
_gcSubscription = null;
}
@@ -119,16 +119,15 @@
if (_loggingSubscription == null) {
return;
}
- _loggingSubscription.cancel();
+ _loggingSubscription!.cancel();
_loggingSubscription = null;
}
final ObservatoryApplicationElement rootElement;
- ServiceObject lastErrorOrException;
+ ServiceObject? lastErrorOrException;
void _initOnce() {
- assert(app == null);
app = this;
_registerPages();
// Visit the current page.
@@ -145,7 +144,7 @@
void _onEvent(ServiceEvent event) {
assert(event.kind != ServiceEvent.kNone);
- M.Event e = createEventFromServiceEvent(event);
+ M.Event? e = createEventFromServiceEvent(event);
if (e != null) {
events.add(e);
}
@@ -179,7 +178,7 @@
_pageRegistry.add(new ErrorPage(this));
}
- void _visit(Uri uri, Map internalArguments) {
+ void _visit(Uri uri, Map<String, String> internalArguments) {
if (internalArguments['trace'] != null) {
var traceArg = internalArguments['trace'];
if (traceArg == 'on') {
@@ -189,7 +188,7 @@
}
}
if (Tracer.current != null) {
- Tracer.current.reset();
+ Tracer.current!.reset();
}
for (var i = 0; i < _pageRegistry.length; i++) {
var page = _pageRegistry[i];
@@ -211,7 +210,7 @@
}
if (currentPage != null) {
Logger.root.info('Uninstalling page: $currentPage');
- currentPage.onUninstall();
+ currentPage!.onUninstall();
// Clear children.
rootElement.children.clear();
}
@@ -222,7 +221,7 @@
Logger.root.severe('Failed to install page: $e');
}
// Add new page.
- rootElement.children.add(page.element);
+ rootElement.children.add(page.element!);
// Remember page.
currentPage = page;
@@ -239,22 +238,22 @@
_switchVM(null);
} else {
final bool currentTarget =
- (_vm as WebSocketVM)?.target == targets.current;
- final bool currentTargetConnected = (_vm != null) && _vm.isConnected;
+ (_vm as WebSocketVM?)?.target == targets.current;
+ final bool currentTargetConnected = (_vm != null) && _vm!.isConnected;
if (!currentTarget || !currentTargetConnected) {
- _switchVM(new WebSocketVM(targets.current));
- _vm.onConnect.then((_) {
+ _switchVM(new WebSocketVM(targets.current!));
+ _vm!.onConnect.then((_) {
app.locationManager.go(Uris.vm());
});
- _vm.load();
+ _vm!.load();
} else if (currentTargetConnected) {
app.locationManager.go(Uris.vm());
}
}
});
- Logger.root.info('Setting initial target to ${targets.current.name}');
- _switchVM(new WebSocketVM(targets.current));
+ Logger.root.info('Setting initial target to ${targets.current!.name}');
+ _switchVM(new WebSocketVM(targets.current!));
_initOnce();
// delete pause events.
diff --git a/runtime/observatory/lib/src/app/location_manager.dart b/runtime/observatory/lib/src/app/location_manager.dart
index a0e1af1..2f231d8 100644
--- a/runtime/observatory/lib/src/app/location_manager.dart
+++ b/runtime/observatory/lib/src/app/location_manager.dart
@@ -11,11 +11,11 @@
/// application URL.
final Map<String, String> internalArguments = new Map<String, String>();
- Uri _uri;
+ Uri? _uri;
/// [uri] is the application uri. Application uris consist of a path and
/// the queryParameters map.
- Uri get uri => _uri;
+ Uri get uri => _uri!;
LocationManager(this._app) {
window.onPopState.listen(_onBrowserNavigation);
@@ -90,13 +90,14 @@
/// Notify the current page that something has changed.
_visit() {
- Chain.capture(() => _app._visit(_uri, internalArguments), onError: (e, st) {
+ Chain.capture(() => _app._visit(_uri!, internalArguments),
+ onError: (e, st) {
if (e is IsolateNotFound) {
var newPath = ((_app.vm == null || _app.vm.isDisconnected)
? '/vm-connect'
: '/isolate-reconnect');
var parameters = <String, dynamic>{};
- parameters.addAll(_uri.queryParameters);
+ parameters.addAll(_uri!.queryParameters);
parameters['originalUri'] = _uri.toString();
parameters['isolateId'] = parameters['isolateId'];
var generatedUri = new Uri(path: newPath, queryParameters: parameters);
@@ -126,7 +127,7 @@
}
makeLinkReplacingParameters(Map updatedParameters) {
- var parameters = new Map.from(_uri.queryParameters);
+ var parameters = new Map<String, dynamic>.from(_uri!.queryParameters);
updatedParameters.forEach((k, v) {
parameters[k] = v;
});
@@ -141,7 +142,7 @@
}
makeLinkForwardingParameters(String newPath) {
- var parameters = _uri.queryParameters;
+ var parameters = _uri!.queryParameters;
var generatedUri = new Uri(path: newPath, queryParameters: parameters);
return makeLink(generatedUri.toString());
}
@@ -161,7 +162,7 @@
event.preventDefault();
// 'currentTarget' is the dom element that would process the event.
// If we use 'target' we might get an <em> element or somesuch.
- Element target = event.currentTarget;
- go(target.attributes['href']);
+ Element target = event.currentTarget as Element;
+ go(target.attributes['href']!);
}
}
diff --git a/runtime/observatory/lib/src/app/notification.dart b/runtime/observatory/lib/src/app/notification.dart
index 1f5f9d7..933cdb9 100644
--- a/runtime/observatory/lib/src/app/notification.dart
+++ b/runtime/observatory/lib/src/app/notification.dart
@@ -8,7 +8,7 @@
final exception;
/// [optional]
- final StackTrace stacktrace;
+ final StackTrace? stacktrace;
ExceptionNotification(this.exception, {this.stacktrace});
}
diff --git a/runtime/observatory/lib/src/app/page.dart b/runtime/observatory/lib/src/app/page.dart
index a366acf..9adaad7 100644
--- a/runtime/observatory/lib/src/app/page.dart
+++ b/runtime/observatory/lib/src/app/page.dart
@@ -55,7 +55,7 @@
abstract class Page {
final ObservatoryApplication app;
final Map<String, String> internalArguments = <String, String>{};
- HtmlElement element;
+ HtmlElement? element;
Page(this.app);
@@ -70,7 +70,7 @@
}
/// Called when the page should update its state based on [uri].
- void visit(Uri uri, Map internalArguments) {
+ void visit(Uri uri, Map<String, String> internalArguments) {
this.internalArguments.clear();
this.internalArguments.addAll(internalArguments);
_visit(uri);
@@ -95,7 +95,7 @@
Future<Isolate> getIsolate(Uri uri) {
var isolateId = uri.queryParameters['isolateId'];
- return app.vm.getIsolate(isolateId).then((isolate) {
+ return app.vm.getIsolate(isolateId!).then((isolate) {
if (isolate == null) {
throw new IsolateNotFound(isolateId);
}
@@ -106,7 +106,6 @@
EditorRepository getEditor(Uri uri) {
final editor = uri.queryParameters['editor'];
return new EditorRepository(app.vm, editor: editor);
- return null;
}
bool canVisit(Uri uri) => uri.path == path;
@@ -119,7 +118,7 @@
void onInstall() {
if (element == null) {
- element = new Element.tag(elementTagName);
+ element = new Element.tag(elementTagName) as HtmlElement;
}
}
}
@@ -169,7 +168,7 @@
return;
}
app.vm.reload().then((serviceObject) {
- VM vm = serviceObject;
+ VM vm = serviceObject as VM;
container.children = <Element>[
new VMViewElement(
vm,
@@ -257,7 +256,7 @@
container.children = <Element>[
new ClassViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -280,7 +279,7 @@
container.children = <Element>[
new CodeViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -296,7 +295,7 @@
container.children = <Element>[
new ContextViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -317,7 +316,7 @@
container.children = <Element>[
new FieldViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -336,7 +335,7 @@
container.children = <Element>[
new InstanceViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -374,7 +373,7 @@
container.children = <Element>[
new FunctionViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -393,7 +392,7 @@
container.children = <Element>[
new ICDataViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -410,7 +409,7 @@
container.children = <Element>[
new SingleTargetCacheViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -427,7 +426,7 @@
container.children = <Element>[
new SubtypeTestCacheViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -444,7 +443,7 @@
container.children = <Element>[
new UnlinkedCallViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -461,7 +460,7 @@
container.children = <Element>[
new LibraryViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -481,7 +480,7 @@
container.children = <Element>[
new MegamorphicCacheViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -498,7 +497,7 @@
container.children = <Element>[
new ObjectPoolViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -515,13 +514,13 @@
var pos;
if (app.locationManager.internalArguments['pos'] != null) {
try {
- pos = int.parse(app.locationManager.internalArguments['pos']);
+ pos = int.parse(app.locationManager.internalArguments['pos']!);
} catch (_) {}
}
container.children = <Element>[
new ScriptViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -539,7 +538,7 @@
container.children = <Element>[
new ObjectViewElement(
app.vm,
- obj.isolate,
+ obj.isolate as Isolate,
obj,
app.events,
app.notifications,
@@ -553,8 +552,8 @@
];
} else if (obj is Sentinel) {
container.children = <Element>[
- new SentinelViewElement(
- app.vm, obj.isolate, obj, app.events, app.notifications,
+ new SentinelViewElement(app.vm, obj.isolate as Isolate, obj, app.events,
+ app.notifications,
queue: app.queue)
.element
];
@@ -911,8 +910,8 @@
app.vm,
app.events,
app.notifications,
- uri.queryParameters['isolateId'],
- Uri.parse(uri.queryParameters['originalUri']))
+ uri.queryParameters['isolateId']!,
+ Uri.parse(uri.queryParameters['originalUri']!))
.element
];
assert(element != null);
@@ -927,7 +926,7 @@
final DivElement container = new DivElement();
- Isolate lastIsolate;
+ Isolate? lastIsolate;
void _visit(Uri uri) {
super._visit(uri);
@@ -953,7 +952,7 @@
@override
void onUninstall() {
super.onUninstall();
- _metricRepository.stopSampling(lastIsolate);
+ _metricRepository.stopSampling(lastIsolate!);
container.children = const [];
}
}
diff --git a/runtime/observatory/lib/src/cli/command.dart b/runtime/observatory/lib/src/cli/command.dart
index 0a0fc42..7beb26f 100644
--- a/runtime/observatory/lib/src/cli/command.dart
+++ b/runtime/observatory/lib/src/cli/command.dart
@@ -46,8 +46,8 @@
// A command may optionally have sub-commands.
List<Command> _children = <Command>[];
- _CommandBase _parent;
- int get _depth => (_parent == null ? 0 : _parent._depth + 1);
+ _CommandBase? _parent;
+ int get _depth => (_parent == null ? 0 : _parent!._depth + 1);
// Override in subclasses to provide command-specific argument completion.
//
@@ -115,7 +115,7 @@
// The root of a tree of commands.
class RootCommand extends _CommandBase {
- RootCommand(List<Command> children, [List<String> history])
+ RootCommand(List<Command> children, [List<String>? history])
: this._(children, history ?? ['']);
RootCommand._(List<Command> children, List<String> history)
@@ -161,7 +161,7 @@
// If we are showing all possiblities, also include local
// completions for the parent command.
return commands[0]
- ._parent
+ ._parent!
._buildCompletions(args, false)
.then((localCompletions) {
completions.addAll(localCompletions);
@@ -232,7 +232,7 @@
throw 'should-not-execute-the-root-command';
}
- toString() => 'RootCommand';
+ String toString() => 'RootCommand';
}
// A node in the command tree.
@@ -240,18 +240,18 @@
Command(this.name, List<Command> children) : super(children);
final String name;
- String alias;
+ String? alias;
String get fullName {
if (_parent is RootCommand) {
return name;
} else {
- Command parent = _parent;
+ Command parent = _parent as Command;
return '${parent.fullName} $name';
}
}
- toString() => 'Command(${name})';
+ String toString() => 'Command(${name})';
}
abstract class CommandException implements Exception {}
diff --git a/runtime/observatory/lib/src/debugger/debugger.dart b/runtime/observatory/lib/src/debugger/debugger.dart
index fb297c7..f243e02 100644
--- a/runtime/observatory/lib/src/debugger/debugger.dart
+++ b/runtime/observatory/lib/src/debugger/debugger.dart
@@ -8,7 +8,7 @@
abstract class Debugger {
VM get vm;
Isolate get isolate;
- M.ObjectRepository objects;
- ServiceMap get stack;
- int get currentFrame;
+ M.ObjectRepository? objects;
+ ServiceMap? get stack;
+ int? get currentFrame;
}
diff --git a/runtime/observatory/lib/src/debugger/debugger_location.dart b/runtime/observatory/lib/src/debugger/debugger_location.dart
index a186fd4..344a010 100644
--- a/runtime/observatory/lib/src/debugger/debugger_location.dart
+++ b/runtime/observatory/lib/src/debugger/debugger_location.dart
@@ -50,12 +50,12 @@
new DebuggerLocation.error("Invalid source location '${locDesc}'"));
}
- static Future<Frame> _currentFrame(Debugger debugger) async {
- ServiceMap stack = debugger.stack;
+ static Future<Frame?> _currentFrame(Debugger debugger) async {
+ ServiceMap? stack = debugger.stack;
if (stack == null || stack['frames'].length == 0) {
return null;
}
- return stack['frames'][debugger.currentFrame];
+ return stack['frames'][debugger.currentFrame] as Frame?;
}
static Future<DebuggerLocation> _currentLocation(Debugger debugger) async {
@@ -64,10 +64,10 @@
return new DebuggerLocation.error(
'A script must be provided when the stack is empty');
}
- Script script = frame.location.script;
+ Script script = frame.location!.script;
await script.load();
- var line = script.tokenToLine(frame.location.tokenPos);
- var col = script.tokenToCol(frame.location.tokenPos);
+ var line = script.tokenToLine(frame.location!.tokenPos);
+ var col = script.tokenToCol(frame.location!.tokenPos);
return new DebuggerLocation.file(script, line, col);
}
@@ -87,7 +87,7 @@
if (colStr != null) {
colStr = colStr.substring(1);
}
- var line = int.tryParse(lineStr) ?? -1;
+ var line = int.tryParse(lineStr!) ?? -1;
var col = (colStr != null ? int.tryParse(colStr) ?? -1 : null);
if (line == -1) {
return new Future.value(
@@ -121,7 +121,7 @@
return new Future.value(new DebuggerLocation.error(
'A script must be provided when the stack is empty'));
}
- Script script = frame.location.script;
+ Script script = frame.location!.script;
await script.load();
return new DebuggerLocation.file(script, line, col);
}
@@ -139,7 +139,7 @@
var matches = <Script>{};
for (var lib in isolate.libraries) {
for (var script in lib.scripts) {
- final String haystack = useUri ? script.uri : script.name;
+ final String haystack = useUri ? script.uri : script.name!;
if (allowPrefix) {
if (haystack.startsWith(name)) {
matches.add(script);
@@ -162,7 +162,7 @@
assert(lib.loaded);
for (var function in lib.functions) {
if (allowPrefix) {
- if (function.name.startsWith(name)) {
+ if (function.name!.startsWith(name)) {
matches.add(function);
}
} else {
@@ -194,7 +194,7 @@
for (var lib in isolate.libraries) {
for (var cls in lib.classes) {
if (allowPrefix) {
- if (cls.name.startsWith(name)) {
+ if (cls.name!.startsWith(name)) {
matches.add(cls);
}
} else {
@@ -207,7 +207,7 @@
return matches;
}
- static ServiceFunction _getConstructor(Class cls, String name) {
+ static ServiceFunction? _getConstructor(Class cls, String name) {
for (var function in cls.functions) {
assert(cls.loaded);
if (name == function.name) {
@@ -222,7 +222,7 @@
static Future<DebuggerLocation> _parseFunction(
Debugger debugger, Match match) {
Isolate isolate = debugger.isolate;
- var base = match.group(1);
+ var base = match.group(1)!;
var qualifier = match.group(2);
assert(base != null);
@@ -234,7 +234,7 @@
for (var cls in classes) {
// Look for a self-named constructor.
- var constructor = _getConstructor(cls, cls.name);
+ var constructor = _getConstructor(cls, cls.name!);
if (constructor != null) {
functions.add(constructor);
}
@@ -300,9 +300,8 @@
static Future<List<String>> _completeFunction(
Debugger debugger, Match match) {
Isolate isolate = debugger.isolate;
- var base = match.group(1);
+ var base = match.group(1) ?? '';
var qualifier = match.group(2);
- base = (base == null ? '' : base);
if (qualifier == null) {
return _lookupClass(isolate, base, allowPrefix: true).then((classes) {
@@ -310,12 +309,12 @@
// Complete top-level function names.
var functions = _lookupFunction(isolate, base, allowPrefix: true);
- var funcNames = functions.map((f) => f.name).toList();
+ var funcNames = functions.map((f) => f.name!).toList();
funcNames.sort();
completions.addAll(funcNames);
// Complete class names.
- var classNames = classes.map((f) => f.name).toList();
+ var classNames = classes.map((f) => f.name!).toList();
classNames.sort();
completions.addAll(classNames);
@@ -327,12 +326,12 @@
for (var cls in classes) {
for (var function in cls.functions) {
if (function.kind == M.FunctionKind.constructor) {
- if (function.name.startsWith(match.group(0))) {
- completions.add(function.name);
+ if (function.name!.startsWith(match.group(0)!)) {
+ completions.add(function.name!);
}
} else {
- if (function.qualifiedName.startsWith(match.group(0))) {
- completions.add(function.qualifiedName);
+ if (function.qualifiedName!.startsWith(match.group(0)!)) {
+ completions.add(function.qualifiedName!);
}
}
}
@@ -354,34 +353,29 @@
var lineStr;
var lineStrComplete = false;
var colStr;
- if (_startsWithDigit(match.group(1))) {
+ if (_startsWithDigit(match.group(1)!)) {
// CASE 1: We have matched a prefix of (lineStr:)(colStr)
var frame = await _currentFrame(debugger);
if (frame == null) {
return [];
}
- scriptName = frame.location.script.name;
+ scriptName = frame.location!.script.name;
scriptNameComplete = true;
- lineStr = match.group(1);
- lineStr = (lineStr == null ? '' : lineStr);
+ lineStr = match.group(1) ?? '';
if (lineStr.endsWith(':')) {
lineStr = lineStr.substring(0, lineStr.length - 1);
lineStrComplete = true;
}
- colStr = match.group(2);
- colStr = (colStr == null ? '' : colStr);
+ colStr = match.group(2) ?? '';
} else {
// CASE 2: We have matched a prefix of (scriptName:)(lineStr)(:colStr)
- scriptName = match.group(1);
- scriptName = (scriptName == null ? '' : scriptName);
+ scriptName = match.group(1) ?? '';
if (scriptName.endsWith(':')) {
scriptName = scriptName.substring(0, scriptName.length - 1);
scriptNameComplete = true;
}
- lineStr = match.group(2);
- lineStr = (lineStr == null ? '' : lineStr);
- colStr = match.group(3);
- colStr = (colStr == null ? '' : colStr);
+ lineStr = match.group(2) ?? '';
+ colStr = match.group(3) ?? '';
if (colStr.startsWith(':')) {
lineStrComplete = true;
colStr = colStr.substring(1);
@@ -394,7 +388,7 @@
await _lookupScript(debugger.isolate, scriptName, allowPrefix: true);
var completions = <String>[];
for (var script in scripts) {
- completions.add(script.name + ':');
+ completions.add(script.name! + ':');
}
completions.sort();
return completions;
@@ -411,8 +405,8 @@
// Complete the line.
var sharedPrefix = '${script.name}:';
var completions = <String>[];
- var report = await script.isolate
- .getSourceReport([Isolate.kPossibleBreakpointsReport], script);
+ var report = await script.isolate!.getSourceReport(
+ [Isolate.kPossibleBreakpointsReport], script) as ServiceMap;
Set<int> possibleBpts = getPossibleBreakpointLines(report, script);
for (var line in possibleBpts) {
var currentLineStr = line.toString();
@@ -425,7 +419,7 @@
} else {
// Complete the column.
int lineNum = int.parse(lineStr);
- var scriptLine = script.getLine(lineNum);
+ var scriptLine = script.getLine(lineNum)!;
var sharedPrefix = '${script.name}:${lineStr}:';
var completions = <String>[];
int maxCol = scriptLine.text.trimRight().runes.length;
@@ -443,20 +437,20 @@
String toString() {
if (valid) {
if (function != null) {
- return '${function.qualifiedName}';
+ return '${function!.qualifiedName}';
} else if (col != null) {
- return '${script.name}:${line}:${col}';
+ return '${script!.name}:${line}:${col}';
} else {
- return '${script.name}:${line}';
+ return '${script!.name}:${line}';
}
}
return 'invalid source location (${errorMessage})';
}
- Script script;
- int line;
- int col;
- ServiceFunction function;
- String errorMessage;
+ Script? script;
+ int? line;
+ int? col;
+ ServiceFunction? function;
+ String? errorMessage;
bool get valid => (errorMessage == null);
}
diff --git a/runtime/observatory/lib/src/elements/allocation_profile.dart b/runtime/observatory/lib/src/elements/allocation_profile.dart
index ae66a6a8..63bfe2c 100644
--- a/runtime/observatory/lib/src/elements/allocation_profile.dart
+++ b/runtime/observatory/lib/src/elements/allocation_profile.dart
@@ -37,20 +37,20 @@
enum _SortingDirection { ascending, descending }
class AllocationProfileElement extends CustomElement implements Renderable {
- RenderingScheduler<AllocationProfileElement> _r;
+ late RenderingScheduler<AllocationProfileElement> _r;
Stream<RenderedEvent<AllocationProfileElement>> get onRendered =>
_r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.AllocationProfileRepository _repository;
- M.AllocationProfile _profile;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.AllocationProfileRepository _repository;
+ M.AllocationProfile? _profile;
bool _autoRefresh = false;
bool _isCompacted = false;
- StreamSubscription _gcSubscription;
+ late StreamSubscription _gcSubscription;
_SortingField _sortingField = _SortingField.size;
_SortingDirection _sortingDirection = _SortingDirection.descending;
@@ -64,7 +64,7 @@
M.EventRepository events,
M.NotificationRepository notifications,
M.AllocationProfileRepository repository,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -163,9 +163,9 @@
..text = 'last forced GC at',
new DivElement()
..classes = ['memberValue']
- ..text = _profile.lastServiceGC == null
+ ..text = _profile!.lastServiceGC == null
? '---'
- : '${_profile.lastServiceGC}',
+ : '${_profile!.lastServiceGC}',
],
],
new HRElement(),
@@ -179,14 +179,14 @@
? [
new HeadingElement.h2()
..text = 'New Generation '
- '(${_usedCaption(_profile.newSpace)})',
+ '(${_usedCaption(_profile!.newSpace)})',
]
: [
new HeadingElement.h2()..text = 'New Generation',
new BRElement(),
new DivElement()
..classes = ['memberList']
- ..children = _createSpaceMembers(_profile.newSpace),
+ ..children = _createSpaceMembers(_profile!.newSpace),
],
new DivElement()
..classes = ['heap-space', 'left']
@@ -194,14 +194,14 @@
? [
new HeadingElement.h2()
..text = 'Old Generation '
- '(${_usedCaption(_profile.oldSpace)})',
+ '(${_usedCaption(_profile!.oldSpace)})',
]
: [
new HeadingElement.h2()..text = 'Old Generation',
new BRElement(),
new DivElement()
..classes = ['memberList']
- ..children = _createSpaceMembers(_profile.oldSpace),
+ ..children = _createSpaceMembers(_profile!.oldSpace),
],
new DivElement()
..classes = ['heap-space', 'left']
@@ -209,14 +209,14 @@
? [
new HeadingElement.h2()
..text = 'Total '
- '(${_usedCaption(_profile.totalSpace)})',
+ '(${_usedCaption(_profile!.totalSpace)})',
]
: [
new HeadingElement.h2()..text = 'Total',
new BRElement(),
new DivElement()
..classes = ['memberList']
- ..children = _createSpaceMembers(_profile.totalSpace),
+ ..children = _createSpaceMembers(_profile!.totalSpace),
],
new ButtonElement()
..classes = ['compact']
@@ -234,7 +234,7 @@
_createCollectionLine, _updateCollectionLine,
createHeader: _createCollectionHeader,
search: _search,
- items: _profile.members.toList()..sort(_createSorter()),
+ items: _profile!.members.toList()..sort(_createSorter()),
queue: _r.queue)
.element
]
@@ -282,7 +282,7 @@
getter = _getInstances;
break;
case _SortingField.className:
- getter = (M.ClassHeapStats s) => s.clazz.name;
+ getter = (M.ClassHeapStats s) => s.clazz!.name;
break;
}
switch (_sortingDirection) {
@@ -432,14 +432,14 @@
e.children[9].text = Utils.formatSize(_getExternalSize(item));
e.children[10].text = Utils.formatSize(_getSize(item));
e.children[11].text = '${_getInstances(item)}';
- e.children[12] = new ClassRefElement(_isolate, item.clazz, queue: _r.queue)
+ e.children[12] = new ClassRefElement(_isolate, item.clazz!, queue: _r.queue)
.element
..classes = ['name'];
}
bool _search(Pattern pattern, itemDynamic) {
M.ClassHeapStats item = itemDynamic;
- return item.clazz.name.contains(pattern);
+ return item.clazz!.name!.contains(pattern);
}
static String _usedCaption(M.HeapSpace space) =>
@@ -526,11 +526,11 @@
'Class'
].join(',') +
'\n';
- AnchorElement tl = document.createElement('a');
+ AnchorElement tl = document.createElement('a') as AnchorElement;
tl
..attributes['href'] = 'data:text/plain;charset=utf-8,' +
Uri.encodeComponent(header +
- (_profile.members.toList()..sort(_createSorter()))
+ (_profile!.members.toList()..sort(_createSorter()))
.map(_csvOut)
.join('\n'))
..attributes['download'] = 'heap-profile.csv'
@@ -551,7 +551,7 @@
_getExternalSize(s),
_getSize(s),
_getInstances(s),
- s.clazz.name
+ s.clazz!.name
].join(',');
}
diff --git a/runtime/observatory/lib/src/elements/class_allocation_profile.dart b/runtime/observatory/lib/src/elements/class_allocation_profile.dart
index 46cc688..b37586c 100644
--- a/runtime/observatory/lib/src/elements/class_allocation_profile.dart
+++ b/runtime/observatory/lib/src/elements/class_allocation_profile.dart
@@ -13,27 +13,27 @@
class ClassAllocationProfileElement extends CustomElement
implements Renderable {
- RenderingScheduler<ClassAllocationProfileElement> _r;
+ late RenderingScheduler<ClassAllocationProfileElement> _r;
Stream<RenderedEvent<ClassAllocationProfileElement>> get onRendered =>
_r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.Class _cls;
- M.ClassSampleProfileRepository _profiles;
- Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
- M.SampleProfileLoadingProgress _progress;
- M.SampleProfileTag _tag = M.SampleProfileTag.none;
- ProfileTreeMode _mode = ProfileTreeMode.function;
- M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.Class _cls;
+ late M.ClassSampleProfileRepository _profiles;
+ late Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
+ M.SampleProfileLoadingProgress? _progress;
+ late M.SampleProfileTag _tag = M.SampleProfileTag.none;
+ late ProfileTreeMode _mode = ProfileTreeMode.function;
+ late M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
M.IsolateRef get isolate => _isolate;
M.Class get cls => _cls;
factory ClassAllocationProfileElement(M.VM vm, M.IsolateRef isolate,
M.Class cls, M.ClassSampleProfileRepository profiles,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(cls != null);
@@ -72,7 +72,7 @@
return;
}
final content = <HtmlElement>[
- (new SampleBufferControlElement(_vm, _progress, _progressStream,
+ (new SampleBufferControlElement(_vm, _progress!, _progressStream,
selectedTag: _tag, queue: _r.queue)
..onTagChange.listen((e) {
_tag = e.element.selectedTag;
@@ -80,8 +80,8 @@
}))
.element
];
- if (_progress.status == M.SampleProfileLoadingStatus.loaded) {
- CpuProfileVirtualTreeElement tree;
+ if (_progress!.status == M.SampleProfileLoadingStatus.loaded) {
+ late CpuProfileVirtualTreeElement tree;
content.addAll([
new BRElement(),
(new StackTraceTreeConfigElement(
@@ -97,7 +97,7 @@
}))
.element,
new BRElement(),
- (tree = new CpuProfileVirtualTreeElement(_isolate, _progress.profile,
+ (tree = new CpuProfileVirtualTreeElement(_isolate, _progress!.profile,
queue: _r.queue))
.element
]);
@@ -112,7 +112,7 @@
_r.dirty();
_progress = (await _progressStream.first).progress;
_r.dirty();
- if (M.isSampleProcessRunning(_progress.status)) {
+ if (M.isSampleProcessRunning(_progress!.status)) {
_progress = (await _progressStream.last).progress;
_r.dirty();
}
diff --git a/runtime/observatory/lib/src/elements/class_instances.dart b/runtime/observatory/lib/src/elements/class_instances.dart
index a8d926a..abf90cc 100644
--- a/runtime/observatory/lib/src/elements/class_instances.dart
+++ b/runtime/observatory/lib/src/elements/class_instances.dart
@@ -15,19 +15,19 @@
import 'package:observatory/utils.dart';
class ClassInstancesElement extends CustomElement implements Renderable {
- RenderingScheduler<ClassInstancesElement> _r;
+ late RenderingScheduler<ClassInstancesElement> _r;
Stream<RenderedEvent<ClassInstancesElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.Class _cls;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.StronglyReachableInstancesRepository _stronglyReachableInstances;
- M.ObjectRepository _objects;
- M.Guarded<M.Instance> _retainedSize = null;
+ late M.IsolateRef _isolate;
+ late M.Class _cls;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.StronglyReachableInstancesRepository _stronglyReachableInstances;
+ late M.ObjectRepository _objects;
+ M.Guarded<M.Instance>? _retainedSize = null;
bool _loadingRetainedBytes = false;
- M.Guarded<M.Instance> _reachableSize = null;
+ M.Guarded<M.Instance>? _reachableSize = null;
bool _loadingReachableBytes = false;
M.IsolateRef get isolate => _isolate;
@@ -40,7 +40,7 @@
M.ReachableSizeRepository reachableSizes,
M.StronglyReachableInstancesRepository stronglyReachableInstances,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(cls != null);
assert(retainedSizes != null);
@@ -73,15 +73,15 @@
children = <Element>[];
}
- StronglyReachableInstancesElement _strong;
+ StronglyReachableInstancesElement? _strong;
void render() {
_strong = _strong ??
new StronglyReachableInstancesElement(
_isolate, _cls, _stronglyReachableInstances, _objects,
queue: _r.queue);
- final instanceCount = _cls.newSpace.instances + _cls.oldSpace.instances;
- final size = Utils.formatSize(_cls.newSpace.size + _cls.oldSpace.size);
+ final instanceCount = _cls.newSpace!.instances + _cls.oldSpace!.instances;
+ final size = Utils.formatSize(_cls.newSpace!.size + _cls.oldSpace!.size);
children = <Element>[
new DivElement()
..classes = ['memberList']
@@ -104,7 +104,7 @@
..text = 'strongly reachable ',
new DivElement()
..classes = ['memberValue']
- ..children = <Element>[_strong.element]
+ ..children = <Element>[_strong!.element]
],
new DivElement()
..classes = ['memberItem']
@@ -137,14 +137,14 @@
List<Element> _createReachableSizeValue() {
final content = <Element>[];
if (_reachableSize != null) {
- if (_reachableSize.isSentinel) {
- content.add(
- new SentinelValueElement(_reachableSize.asSentinel, queue: _r.queue)
- .element);
+ if (_reachableSize!.isSentinel) {
+ content.add(new SentinelValueElement(_reachableSize!.asSentinel!,
+ queue: _r.queue)
+ .element);
} else {
content.add(new SpanElement()
..text = Utils.formatSize(
- int.parse(_reachableSize.asValue.valueAsString)));
+ int.parse(_reachableSize!.asValue!.valueAsString!)));
}
} else {
content.add(new SpanElement()..text = '...');
@@ -156,7 +156,7 @@
button.onClick.listen((_) async {
button.disabled = true;
_loadingReachableBytes = true;
- _reachableSize = await _reachableSizes.get(_isolate, _cls.id);
+ _reachableSize = await _reachableSizes.get(_isolate, _cls.id!);
_r.dirty();
});
content.add(button);
@@ -166,14 +166,14 @@
List<Element> _createRetainedSizeValue() {
final content = <Element>[];
if (_retainedSize != null) {
- if (_retainedSize.isSentinel) {
- content.add(
- new SentinelValueElement(_retainedSize.asSentinel, queue: _r.queue)
- .element);
+ if (_retainedSize!.isSentinel) {
+ content.add(new SentinelValueElement(_retainedSize!.asSentinel!,
+ queue: _r.queue)
+ .element);
} else {
content.add(new SpanElement()
- ..text =
- Utils.formatSize(int.parse(_retainedSize.asValue.valueAsString)));
+ ..text = Utils.formatSize(
+ int.parse(_retainedSize!.asValue!.valueAsString!)));
}
} else {
content.add(new SpanElement()..text = '...');
@@ -185,7 +185,7 @@
button.onClick.listen((_) async {
button.disabled = true;
_loadingRetainedBytes = true;
- _retainedSize = await _retainedSizes.get(_isolate, _cls.id);
+ _retainedSize = await _retainedSizes.get(_isolate, _cls.id!);
_r.dirty();
});
content.add(button);
diff --git a/runtime/observatory/lib/src/elements/class_ref.dart b/runtime/observatory/lib/src/elements/class_ref.dart
index 29ca871..824d0b1 100644
--- a/runtime/observatory/lib/src/elements/class_ref.dart
+++ b/runtime/observatory/lib/src/elements/class_ref.dart
@@ -10,18 +10,18 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class ClassRefElement extends CustomElement implements Renderable {
- RenderingScheduler<ClassRefElement> _r;
+ late RenderingScheduler<ClassRefElement> _r;
Stream<RenderedEvent<ClassRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.ClassRef _class;
+ late M.IsolateRef _isolate;
+ late M.ClassRef _class;
M.IsolateRef get isolate => _isolate;
M.ClassRef get cls => _class;
factory ClassRefElement(M.IsolateRef isolate, M.ClassRef cls,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(cls != null);
ClassRefElement e = new ClassRefElement.created();
e._r = new RenderingScheduler<ClassRefElement>(e, queue: queue);
diff --git a/runtime/observatory/lib/src/elements/class_tree.dart b/runtime/observatory/lib/src/elements/class_tree.dart
index 5eb5f9c..b0ef85c 100644
--- a/runtime/observatory/lib/src/elements/class_tree.dart
+++ b/runtime/observatory/lib/src/elements/class_tree.dart
@@ -19,26 +19,26 @@
import 'package:observatory/src/elements/nav/vm_menu.dart';
class ClassTreeElement extends CustomElement implements Renderable {
- RenderingScheduler<ClassTreeElement> _r;
+ late RenderingScheduler<ClassTreeElement> _r;
Stream<RenderedEvent<ClassTreeElement>> get onRendered => _r.onRendered;
- M.VMRef _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.ClassRepository _classes;
- M.Class _object;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.ClassRepository _classes;
+ M.Class? _object;
final _subclasses = <String, Iterable<M.Class>>{};
- final _mixins = <String, List<M.Instance>>{};
+ final _mixins = <String, List<M.Instance>?>{};
factory ClassTreeElement(
- M.VMRef vm,
+ M.VM vm,
M.IsolateRef isolate,
M.EventRepository events,
M.NotificationRepository notifications,
M.ClassRepository classes,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -70,7 +70,7 @@
_r.disable(notify: true);
}
- VirtualTreeElement _tree;
+ VirtualTreeElement? _tree;
void render() {
children = <Element>[
@@ -98,8 +98,8 @@
Element _createTree() {
_tree = new VirtualTreeElement(_create, _update, _children,
items: [_object], search: _search, queue: _r.queue);
- _tree.expand(_object, autoExpandSingleChildNodes: true);
- return _tree.element;
+ _tree!.expand(_object, autoExpandSingleChildNodes: true);
+ return _tree!.element;
}
Future _refresh() async {
@@ -111,25 +111,26 @@
}
Future<M.Class> _register(M.Class cls) async {
- _subclasses[cls.id] = await Future.wait(
- (await Future.wait(cls.subclasses.map(_getActualChildrens)))
+ _subclasses[cls.id!] = await Future.wait(
+ (await Future.wait(cls.subclasses!.map(_getActualChildrens)))
.expand((f) => f)
.map(_register));
return cls;
}
Future<Iterable<M.Class>> _getActualChildrens(M.ClassRef ref) async {
- var cls = await _classes.get(_isolate, ref.id);
- if (cls.isPatch) {
+ var cls = await _classes.get(_isolate, ref.id!);
+ if (cls.isPatch!) {
return const [];
}
if (cls.mixin == null) {
return [cls];
}
- return (await Future.wait(cls.subclasses.map(_getActualChildrens)))
+ return (await Future.wait(cls.subclasses!.map(_getActualChildrens)))
.expand((f) => f)
..forEach((subcls) {
- _mixins[subcls.id] = (_mixins[subcls.id] ?? [])..add(cls.mixin);
+ _mixins[subcls.id!] = (_mixins[subcls.id!] ?? [])
+ ..add(cls.mixin as M.Instance);
});
}
@@ -147,23 +148,23 @@
void _update(HtmlElement el, classDynamic, int index) {
M.Class cls = classDynamic;
- virtualTreeUpdateLines(el.children[0], index);
- if (cls.subclasses.isEmpty) {
+ virtualTreeUpdateLines(el.children[0] as SpanElement, index);
+ if (cls.subclasses!.isEmpty) {
el.children[1].text = '';
} else {
- el.children[1].text = _tree.isExpanded(cls) ? '▼' : '►';
+ el.children[1].text = _tree!.isExpanded(cls) ? '▼' : '►';
}
el.children[2].children = <Element>[
new ClassRefElement(_isolate, cls, queue: _r.queue).element
];
if (_mixins[cls.id] != null) {
- el.children[2].children.addAll(_createMixins(_mixins[cls.id]));
+ el.children[2].children.addAll(_createMixins(_mixins[cls.id]!));
}
}
bool _search(Pattern pattern, classDynamic) {
M.Class cls = classDynamic;
- return cls.name.contains(pattern);
+ return cls.name!.contains(pattern);
}
List<Element> _createMixins(List<M.Instance> types) {
@@ -171,8 +172,8 @@
.expand((type) => <Element>[
new SpanElement()..text = ', ',
type.typeClass == null
- ? (new SpanElement()..text = type.name.split('<').first)
- : new ClassRefElement(_isolate, type.typeClass,
+ ? (new SpanElement()..text = type.name!.split('<').first)
+ : new ClassRefElement(_isolate, type.typeClass!,
queue: _r.queue)
.element
])
@@ -183,6 +184,6 @@
Iterable<M.Class> _children(classDynamic) {
M.Class cls = classDynamic;
- return _subclasses[cls.id];
+ return _subclasses[cls.id]!;
}
}
diff --git a/runtime/observatory/lib/src/elements/class_view.dart b/runtime/observatory/lib/src/elements/class_view.dart
index d80597e..6ac2e06 100644
--- a/runtime/observatory/lib/src/elements/class_view.dart
+++ b/runtime/observatory/lib/src/elements/class_view.dart
@@ -33,27 +33,27 @@
import 'package:observatory/src/elements/view_footer.dart';
class ClassViewElement extends CustomElement implements Renderable {
- RenderingScheduler<ClassViewElement> _r;
+ late RenderingScheduler<ClassViewElement> _r;
Stream<RenderedEvent<ClassViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.Class _cls;
- M.ClassRepository _classes;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.StronglyReachableInstancesRepository _stronglyReachableInstances;
- M.FieldRepository _fields;
- M.ScriptRepository _scripts;
- M.ObjectRepository _objects;
- M.EvalRepository _eval;
- M.ClassSampleProfileRepository _profiles;
- Iterable<M.Field> _classFields;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.Class _cls;
+ late M.ClassRepository _classes;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.StronglyReachableInstancesRepository _stronglyReachableInstances;
+ late M.FieldRepository _fields;
+ late M.ScriptRepository _scripts;
+ late M.ObjectRepository _objects;
+ late M.EvalRepository _eval;
+ late M.ClassSampleProfileRepository _profiles;
+ Iterable<M.Field>? _classFields;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -77,7 +77,7 @@
M.EvalRepository eval,
M.StronglyReachableInstancesRepository stronglyReachable,
M.ClassSampleProfileRepository profiles,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -131,8 +131,8 @@
children = <Element>[];
}
- ObjectCommonElement _common;
- ClassInstancesElement _classInstances;
+ ObjectCommonElement? _common;
+ ClassInstancesElement? _classInstances;
bool _loadProfile = false;
void render() {
@@ -145,10 +145,10 @@
_reachableSizes, _stronglyReachableInstances, _objects,
queue: _r.queue);
var header = '';
- if (_cls.isAbstract) {
+ if (_cls.isAbstract!) {
header += 'abstract ';
}
- if (_cls.isPatch) {
+ if (_cls.isPatch!) {
header += 'patch ';
}
children = <Element>[
@@ -182,7 +182,7 @@
..children = <Element>[
new HeadingElement.h2()..text = '$header class ${_cls.name}',
new HRElement(),
- _common.element,
+ _common!.element,
new BRElement(),
new DivElement()
..classes = ['memberList']
@@ -192,7 +192,7 @@
? const []
: [
new HRElement(),
- new ErrorRefElement(_cls.error, queue: _r.queue).element
+ new ErrorRefElement(_cls.error!, queue: _r.queue).element
],
new HRElement(),
new EvalBoxElement(_isolate, _cls, _objects, _eval, queue: _r.queue)
@@ -204,7 +204,7 @@
..children = _createElements(),
new HRElement(),
new HeadingElement.h2()..text = 'Instances',
- new DivElement()..children = [_classInstances.element],
+ new DivElement()..children = [_classInstances!.element],
new HRElement(),
new HeadingElement.h2()..text = 'Allocations',
new DivElement()
@@ -215,7 +215,7 @@
..text = 'Tracing allocations? ',
new DivElement()
..classes = ['memberValue']
- ..children = _cls.traceAllocations
+ ..children = _cls.traceAllocations!
? [
new SpanElement()..text = 'Yes ',
new ButtonElement()
@@ -251,7 +251,7 @@
..children = _cls.location != null
? [
new HRElement(),
- new SourceInsetElement(_isolate, _cls.location, _scripts,
+ new SourceInsetElement(_isolate, _cls.location!, _scripts,
_objects, _events,
queue: _r.queue)
.element
@@ -263,8 +263,8 @@
];
}
- bool _fieldsExpanded;
- bool _functionsExpanded;
+ bool? _fieldsExpanded;
+ bool? _functionsExpanded;
List<Element> _createMembers() {
final members = <Element>[];
@@ -278,7 +278,7 @@
new DivElement()
..classes = ['memberValue']
..children = <Element>[
- new LibraryRefElement(_isolate, _cls.library, queue: _r.queue)
+ new LibraryRefElement(_isolate, _cls.library!, queue: _r.queue)
.element
]
]);
@@ -293,7 +293,7 @@
new DivElement()
..classes = ['memberValue']
..children = <Element>[
- new SourceLinkElement(_isolate, _cls.location, _scripts,
+ new SourceLinkElement(_isolate, _cls.location!, _scripts,
queue: _r.queue)
.element
]
@@ -309,7 +309,7 @@
new DivElement()
..classes = ['memberValue']
..children = <Element>[
- new ClassRefElement(_isolate, _cls.superclass, queue: _r.queue)
+ new ClassRefElement(_isolate, _cls.superclass!, queue: _r.queue)
.element
]
]);
@@ -324,7 +324,7 @@
new DivElement()
..classes = ['memberValue']
..children = <Element>[
- new InstanceRefElement(_isolate, _cls.superType, _objects,
+ new InstanceRefElement(_isolate, _cls.superType!, _objects,
queue: _r.queue)
.element
]
@@ -340,13 +340,13 @@
new DivElement()
..classes = ['memberValue']
..children = <Element>[
- new InstanceRefElement(_isolate, _cls.mixin, _objects,
+ new InstanceRefElement(_isolate, _cls.mixin!, _objects,
queue: _r.queue)
.element
]
]);
}
- if (_cls.subclasses.length > 0) {
+ if (_cls.subclasses!.length > 0) {
members.add(new DivElement()
..classes = ['memberItem']
..children = <Element>[
@@ -355,7 +355,7 @@
..text = 'extended by',
new DivElement()
..classes = ['memberValue']
- ..children = (_cls.subclasses
+ ..children = (_cls.subclasses!
.expand((subcls) => <Element>[
new ClassRefElement(_isolate, subcls, queue: _r.queue)
.element,
@@ -368,7 +368,7 @@
members.add(new BRElement());
- if (_cls.interfaces.length > 0) {
+ if (_cls.interfaces!.length > 0) {
members.add(new DivElement()
..classes = ['memberItem']
..children = <Element>[
@@ -377,7 +377,7 @@
..text = 'implements',
new DivElement()
..classes = ['memberValue']
- ..children = (_cls.interfaces
+ ..children = (_cls.interfaces!
.expand((interf) => <Element>[
new InstanceRefElement(_isolate, interf, _objects,
queue: _r.queue)
@@ -405,8 +405,8 @@
List<Element> _createElements() {
final members = <Element>[];
- if (_classFields != null && _classFields.isNotEmpty) {
- final fields = _classFields.toList();
+ if (_classFields != null && _classFields!.isNotEmpty) {
+ final fields = _classFields!.toList();
_fieldsExpanded = _fieldsExpanded ?? (fields.length <= 8);
members.add(new DivElement()
..classes = ['memberItem']
@@ -417,7 +417,7 @@
new DivElement()
..classes = ['memberValue']
..children = <Element>[
- (new CurlyBlockElement(expanded: _fieldsExpanded)
+ (new CurlyBlockElement(expanded: _fieldsExpanded!)
..onToggle
.listen((e) => _fieldsExpanded = e.control.expanded)
..content = <Element>[
@@ -451,8 +451,8 @@
]);
}
- if (_cls.functions.isNotEmpty) {
- final functions = _cls.functions.toList();
+ if (_cls.functions!.isNotEmpty) {
+ final functions = _cls.functions!.toList();
_functionsExpanded = _functionsExpanded ?? (functions.length <= 8);
members.add(new DivElement()
..classes = ['memberItem']
@@ -463,7 +463,7 @@
new DivElement()
..classes = ['memberValue']
..children = <Element>[
- (new CurlyBlockElement(expanded: _functionsExpanded)
+ (new CurlyBlockElement(expanded: _functionsExpanded!)
..onToggle
.listen((e) => _functionsExpanded = e.control.expanded)
..content = (functions
@@ -482,14 +482,14 @@
}
Future _refresh() async {
- _cls = await _classes.get(_isolate, _cls.id);
+ _cls = await _classes.get(_isolate, _cls.id!);
await _loadAdditionalData();
_r.dirty();
}
Future _loadAdditionalData() async {
- _classFields =
- await Future.wait(_cls.fields.map((f) => _fields.get(_isolate, f.id)));
+ _classFields = await Future.wait(
+ _cls.fields!.map((f) => _fields.get(_isolate, f.id!)));
_r.dirty();
}
}
diff --git a/runtime/observatory/lib/src/elements/code_ref.dart b/runtime/observatory/lib/src/elements/code_ref.dart
index bb02f4c..60140ca 100644
--- a/runtime/observatory/lib/src/elements/code_ref.dart
+++ b/runtime/observatory/lib/src/elements/code_ref.dart
@@ -13,18 +13,18 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class CodeRefElement extends CustomElement implements Renderable {
- RenderingScheduler<CodeRefElement> _r;
+ late RenderingScheduler<CodeRefElement> _r;
Stream<RenderedEvent<CodeRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.CodeRef _code;
+ M.IsolateRef? _isolate;
+ late M.CodeRef _code;
- M.IsolateRef get isolate => _isolate;
+ M.IsolateRef get isolate => _isolate!;
M.CodeRef get code => _code;
- factory CodeRefElement(M.IsolateRef isolate, M.CodeRef code,
- {RenderingQueue queue}) {
+ factory CodeRefElement(M.IsolateRef? isolate, M.CodeRef code,
+ {RenderingQueue? queue}) {
assert(code != null);
CodeRefElement e = new CodeRefElement.created();
e._r = new RenderingScheduler<CodeRefElement>(e, queue: queue);
@@ -53,7 +53,7 @@
new AnchorElement(
href: ((M.isSyntheticCode(_code.kind)) || (_isolate == null))
? null
- : Uris.inspect(_isolate, object: _code))
+ : Uris.inspect(_isolate!, object: _code))
..text = _code.name
];
}
diff --git a/runtime/observatory/lib/src/elements/code_view.dart b/runtime/observatory/lib/src/elements/code_view.dart
index 776ed04..c210fcc 100644
--- a/runtime/observatory/lib/src/elements/code_view.dart
+++ b/runtime/observatory/lib/src/elements/code_view.dart
@@ -37,22 +37,22 @@
}
class CodeViewElement extends CustomElement implements Renderable {
- RenderingScheduler<CodeViewElement> _r;
+ late RenderingScheduler<CodeViewElement> _r;
Stream<RenderedEvent<CodeViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.Code _code;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
- DisassemblyTable disassemblyTable;
- InlineTable inlineTable;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.Code _code;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
+ late DisassemblyTable disassemblyTable;
+ late InlineTable inlineTable;
static const kDisassemblyColumnIndex = 3;
@@ -72,7 +72,7 @@
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -129,15 +129,15 @@
children = <Element>[];
}
- TableElement _disassemblyTable;
- TableElement _inlineRangeTable;
- Element _disassemblyTableBody;
- Element _inlineRangeTableBody;
+ TableElement? _disassemblyTable;
+ TableElement? _inlineRangeTable;
+ Element? _disassemblyTableBody;
+ Element? _inlineRangeTableBody;
void render() {
if (_inlineRangeTable == null) {
_inlineRangeTable = new TableElement()..classes = ['table'];
- _inlineRangeTable.createTHead().children = <Element>[
+ _inlineRangeTable!.createTHead().children = <Element>[
new TableRowElement()
..children = <Element>[
document.createElement('th')
@@ -152,12 +152,12 @@
document.createElement('th')..text = 'Functions',
]
];
- _inlineRangeTableBody = _inlineRangeTable.createTBody();
- _inlineRangeTableBody.classes = ['monospace'];
+ _inlineRangeTableBody = _inlineRangeTable!.createTBody();
+ _inlineRangeTableBody!.classes = ['monospace'];
}
if (_disassemblyTable == null) {
_disassemblyTable = new TableElement()..classes = ['table'];
- _disassemblyTable.createTHead().children = <Element>[
+ _disassemblyTable!.createTHead().children = <Element>[
new TableRowElement()
..children = <Element>[
document.createElement('th')
@@ -179,17 +179,17 @@
..text = 'Object',
]
];
- _disassemblyTableBody = _disassemblyTable.createTBody();
- _disassemblyTableBody.classes = ['monospace'];
+ _disassemblyTableBody = _disassemblyTable!.createTBody();
+ _disassemblyTableBody!.classes = ['monospace'];
}
- final inlinedFunctions = _code.inlinedFunctions.toList();
+ final inlinedFunctions = _code.inlinedFunctions!.toList();
final S.Code code = _code as S.Code;
children = <Element>[
navBar(<Element>[
new NavTopMenuElement(queue: _r.queue).element,
new NavVMMenuElement(_vm, _events, queue: _r.queue).element,
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element,
- navMenu(_code.name),
+ navMenu(_code.name!),
(new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) async {
e.element.disabled = true;
@@ -208,7 +208,7 @@
..classes = ['content-centered-big']
..children = <Element>[
new HeadingElement.h1()
- ..text = (M.isDartCode(_code.kind) && _code.isOptimized)
+ ..text = (M.isDartCode(_code.kind) && _code.isOptimized!)
? 'Optimized code for ${_code.name}'
: 'Code for ${_code.name}',
new HRElement(),
@@ -240,7 +240,7 @@
..text = 'Optimized',
new DivElement()
..classes = ['memberValue']
- ..text = _code.isOptimized ? 'Yes' : 'No'
+ ..text = _code.isOptimized! ? 'Yes' : 'No'
],
new DivElement()
..classes = ['memberItem']
@@ -251,7 +251,7 @@
new DivElement()
..classes = ['memberValue']
..children = <Element>[
- new FunctionRefElement(_isolate, _code.function,
+ new FunctionRefElement(_isolate, _code.function!,
queue: _r.queue)
.element
]
@@ -266,7 +266,7 @@
..text = 'Inclusive',
new DivElement()
..classes = ['memberValue']
- ..text = '${code.profile.formattedInclusiveTicks}'
+ ..text = '${code.profile!.formattedInclusiveTicks}'
],
new DivElement()
..classes = ['memberItem']
@@ -278,7 +278,7 @@
..text = 'Exclusive',
new DivElement()
..classes = ['memberValue']
- ..text = '${code.profile.formattedExclusiveTicks}'
+ ..text = '${code.profile!.formattedExclusiveTicks}'
],
new DivElement()
..classes = ['memberItem']
@@ -289,7 +289,7 @@
new DivElement()
..classes = ['memberValue']
..children = <Element>[
- new ObjectPoolRefElement(_isolate, _code.objectPool,
+ new ObjectPoolRefElement(_isolate, _code.objectPool!,
queue: _r.queue)
.element
]
@@ -320,9 +320,9 @@
]
],
new HRElement(),
- _inlineRangeTable,
+ _inlineRangeTable!,
new HRElement(),
- _disassemblyTable
+ _disassemblyTable!
],
];
_updateDisassembly();
@@ -337,11 +337,10 @@
Future _refreshTicks() async {
S.Code code = _code as S.Code;
- final isolate = code.isolate;
- S.ServiceMap response =
- await isolate.invokeRpc('_getCpuProfile', {'tags': 'None'});
+ final isolate = code.isolate!;
+ var response = await isolate.invokeRpc('_getCpuProfile', {'tags': 'None'});
final cpuProfile = new SampleProfile();
- await cpuProfile.load(isolate, response);
+ await cpuProfile.load(isolate, response as S.ServiceMap);
_r.dirty();
}
@@ -363,7 +362,7 @@
if (code.profile == null) {
return '';
}
- var intervalTick = code.profile.intervalTicks[interval.start];
+ var intervalTick = code.profile!.intervalTicks[interval.start];
if (intervalTick == null) {
return '';
}
@@ -372,7 +371,7 @@
return '';
}
var pcent = Utils.formatPercent(
- intervalTick.inclusiveTicks, code.profile.profile.sampleCount);
+ intervalTick.inclusiveTicks, code.profile!.profile.sampleCount);
return '$pcent (${intervalTick.inclusiveTicks})';
}
@@ -381,21 +380,22 @@
if (code.profile == null) {
return '';
}
- var intervalTick = code.profile.intervalTicks[interval.start];
+ var intervalTick = code.profile!.intervalTicks[interval.start];
if (intervalTick == null) {
return '';
}
var pcent = Utils.formatPercent(
- intervalTick.exclusiveTicks, code.profile.profile.sampleCount);
+ intervalTick.exclusiveTicks, code.profile!.profile.sampleCount);
return '$pcent (${intervalTick.exclusiveTicks})';
}
String _formattedInclusive(S.CodeInstruction instruction) {
S.Code code = _code as S.Code;
- if (code.profile == null) {
+ var profile = code.profile;
+ if (profile == null) {
return '';
}
- var tick = code.profile.addressTicks[instruction.address];
+ var tick = profile.addressTicks[instruction.address];
if (tick == null) {
return '';
}
@@ -403,22 +403,23 @@
if (tick.inclusiveTicks == tick.exclusiveTicks) {
return '';
}
- var pcent = Utils.formatPercent(
- tick.inclusiveTicks, code.profile.profile.sampleCount);
+ var pcent =
+ Utils.formatPercent(tick.inclusiveTicks, profile.profile.sampleCount);
return '$pcent (${tick.inclusiveTicks})';
}
String _formattedExclusive(S.CodeInstruction instruction) {
S.Code code = _code as S.Code;
- if (code.profile == null) {
+ var profile = code.profile;
+ if (profile == null) {
return '';
}
- var tick = code.profile.addressTicks[instruction.address];
+ var tick = profile.addressTicks[instruction.address];
if (tick == null) {
return '';
}
- var pcent = Utils.formatPercent(
- tick.exclusiveTicks, code.profile.profile.sampleCount);
+ var pcent =
+ Utils.formatPercent(tick.exclusiveTicks, profile.profile.sampleCount);
return '$pcent (${tick.exclusiveTicks})';
}
@@ -441,7 +442,7 @@
}
void _addDisassemblyDOMRow() {
- var tableBody = _disassemblyTableBody;
+ var tableBody = _disassemblyTableBody!;
assert(tableBody != null);
var tr = new TableRowElement();
@@ -492,7 +493,7 @@
}
void _updateDisassemblyDOMTable() {
- var tableBody = _disassemblyTableBody;
+ var tableBody = _disassemblyTableBody!;
assert(tableBody != null);
// Resize DOM table.
if (tableBody.children.length > disassemblyTable.sortedRows.length) {
@@ -517,7 +518,7 @@
var i = 0;
for (var tr in tableBody.children) {
var rowIndex = disassemblyTable.sortedRows[i];
- _fillDisassemblyDOMRow(tr, rowIndex);
+ _fillDisassemblyDOMRow(tr as TableRowElement, rowIndex);
i++;
}
}
@@ -542,7 +543,7 @@
}
void _addInlineDOMRow() {
- var tableBody = _inlineRangeTableBody;
+ var tableBody = _inlineRangeTableBody!;
assert(tableBody != null);
var tr = new TableRowElement();
@@ -595,7 +596,7 @@
}
void _updateInlineDOMTable() {
- var tableBody = _inlineRangeTableBody;
+ var tableBody = _inlineRangeTableBody!;
// Resize DOM table.
if (tableBody.children.length > inlineTable.sortedRows.length) {
// Shrink the table.
@@ -615,7 +616,7 @@
for (var i = 0; i < inlineTable.sortedRows.length; i++) {
var rowIndex = inlineTable.sortedRows[i];
var tr = tableBody.children[i];
- _fillInlineDOMRow(tr, rowIndex);
+ _fillInlineDOMRow(tr as TableRowElement, rowIndex);
}
}
@@ -624,7 +625,7 @@
_updateInlineDOMTable();
}
- static String _codeKindToString(M.CodeKind kind) {
+ static String _codeKindToString(M.CodeKind? kind) {
switch (kind) {
case M.CodeKind.dart:
return 'dart';
diff --git a/runtime/observatory/lib/src/elements/containers/search_bar.dart b/runtime/observatory/lib/src/elements/containers/search_bar.dart
index c66f284..fda5ddf 100644
--- a/runtime/observatory/lib/src/elements/containers/search_bar.dart
+++ b/runtime/observatory/lib/src/elements/containers/search_bar.dart
@@ -17,7 +17,7 @@
typedef Iterable<dynamic> SearchBarSearchCallback(Pattern pattern);
class SearchBarElement extends CustomElement implements Renderable {
- RenderingScheduler<SearchBarElement> _r;
+ late RenderingScheduler<SearchBarElement> _r;
StreamController<SearchResultSelected> _onSearchResultSelected =
new StreamController<SearchResultSelected>.broadcast();
@@ -26,11 +26,11 @@
Stream<SearchResultSelected> get onSearchResultSelected =>
_onSearchResultSelected.stream;
- StreamSubscription _onKeyDownSubscription;
+ late StreamSubscription _onKeyDownSubscription;
- Element _workspace;
- SearchBarSearchCallback _search;
- bool _isOpen;
+ Element? _workspace;
+ late SearchBarSearchCallback _search;
+ late bool _isOpen;
bool _focusRequested = false;
String _lastValue = '';
List _results = const [];
@@ -41,7 +41,7 @@
set isOpen(bool value) {
if (!value) {
- _input.value = '';
+ _input!.value = '';
_lastValue = '';
if (_results.isNotEmpty) {
_results = const [];
@@ -53,7 +53,7 @@
}
factory SearchBarElement(SearchBarSearchCallback search,
- {bool isOpen: false, Element workspace, RenderingQueue queue}) {
+ {bool isOpen: false, Element? workspace, RenderingQueue? queue}) {
assert(search != null);
assert(isOpen != null);
SearchBarElement e = new SearchBarElement.created();
@@ -72,11 +72,11 @@
_r.enable();
_workspace?.tabIndex = 1;
_onKeyDownSubscription = (_workspace ?? window).onKeyDown.listen((e) {
- if (e.key.toLowerCase() == 'f' &&
+ if (e.key!.toLowerCase() == 'f' &&
!e.shiftKey &&
!e.altKey &&
e.ctrlKey != e.metaKey) {
- if (e.metaKey == window.navigator.platform.startsWith('Mac')) {
+ if (e.metaKey == window.navigator.platform!.startsWith('Mac')) {
e.stopPropagation();
e.preventDefault();
isOpen = true;
@@ -94,15 +94,15 @@
_onKeyDownSubscription.cancel();
}
- TextInputElement _input;
- SpanElement _resultsArea;
+ TextInputElement? _input;
+ SpanElement? _resultsArea;
void render() {
if (_input == null) {
_input = new TextInputElement()
..onKeyPress.listen((e) {
if (e.keyCode == KeyCode.ENTER) {
- if (_input.value == '') {
+ if (_input!.value == '') {
_lastValue = '';
if (_results.isNotEmpty) {
_results = const [];
@@ -110,9 +110,9 @@
_triggerSearchResultSelected();
_r.dirty();
}
- } else if (_input.value != _lastValue) {
- _lastValue = _input.value;
- _results = _doSearch(_input.value);
+ } else if (_input!.value != _lastValue) {
+ _lastValue = _input!.value!;
+ _results = _doSearch(_input!.value!);
_current = 0;
_triggerSearchResultSelected();
_r.dirty();
@@ -127,8 +127,8 @@
});
_resultsArea = new SpanElement();
children = <Element>[
- _input,
- _resultsArea,
+ _input!,
+ _resultsArea!,
new ButtonElement()
..text = '❌'
..onClick.listen((_) {
@@ -136,7 +136,7 @@
})
];
}
- _resultsArea.nodes = [
+ _resultsArea!.nodes = [
new ButtonElement()
..text = '▲'
..disabled = _results.isEmpty
@@ -150,7 +150,7 @@
];
style.visibility = isOpen ? null : 'collapse';
if (_focusRequested) {
- _input.focus();
+ _input!.focus();
_focusRequested = false;
}
}
@@ -200,6 +200,6 @@
Iterable<Match> allMatches(String string, [int start = 0]) =>
_pattern.allMatches(string.toLowerCase(), start);
- Match matchAsPrefix(String string, [int start = 0]) =>
+ Match? matchAsPrefix(String string, [int start = 0]) =>
_pattern.matchAsPrefix(string.toLowerCase(), start);
}
diff --git a/runtime/observatory/lib/src/elements/containers/virtual_collection.dart b/runtime/observatory/lib/src/elements/containers/virtual_collection.dart
index 0890c07..f1f1e33 100644
--- a/runtime/observatory/lib/src/elements/containers/virtual_collection.dart
+++ b/runtime/observatory/lib/src/elements/containers/virtual_collection.dart
@@ -16,26 +16,26 @@
typedef bool VirtualCollectionSearchCallback(Pattern pattern, dynamic item);
class VirtualCollectionElement extends CustomElement implements Renderable {
- RenderingScheduler<VirtualCollectionElement> _r;
+ late RenderingScheduler<VirtualCollectionElement> _r;
Stream<RenderedEvent<VirtualCollectionElement>> get onRendered =>
_r.onRendered;
- VirtualCollectionCreateCallback _create;
- VirtualCollectionHeaderCallback _createHeader;
- VirtualCollectionUpdateCallback _update;
- VirtualCollectionSearchCallback _search;
- double _itemHeight;
- int _top;
- double _height;
- List _items;
- StreamSubscription _onScrollSubscription;
- StreamSubscription _onResizeSubscription;
+ late VirtualCollectionCreateCallback _create;
+ VirtualCollectionHeaderCallback? _createHeader;
+ late VirtualCollectionUpdateCallback _update;
+ VirtualCollectionSearchCallback? _search;
+ double? _itemHeight;
+ int? _top;
+ double? _height;
+ List? _items;
+ late StreamSubscription _onScrollSubscription;
+ late StreamSubscription _onResizeSubscription;
- List get items => _items;
+ List? get items => _items;
- set items(Iterable value) {
- _items = new List.unmodifiable(value);
+ set items(Iterable? value) {
+ _items = new List.unmodifiable(value!);
_top = null;
_searcher?.update();
_r.dirty();
@@ -44,9 +44,9 @@
factory VirtualCollectionElement(VirtualCollectionCreateCallback create,
VirtualCollectionUpdateCallback update,
{Iterable items: const [],
- VirtualCollectionHeaderCallback createHeader,
- VirtualCollectionSearchCallback search,
- RenderingQueue queue}) {
+ VirtualCollectionHeaderCallback? createHeader,
+ VirtualCollectionSearchCallback? search,
+ RenderingQueue? queue}) {
assert(create != null);
assert(update != null);
assert(items != null);
@@ -81,8 +81,8 @@
_onResizeSubscription.cancel();
}
- DivElement _header;
- SearchBarElement _searcher;
+ DivElement? _header;
+ SearchBarElement? _searcher;
final DivElement _viewport = new DivElement()
..classes = ['viewport', 'container'];
final DivElement _spacer = new DivElement()..classes = ['spacer'];
@@ -103,10 +103,11 @@
if (el_index < 0) {
return null;
}
- final item_index =
- _top + el_index - safeFloor(_buffer.children.length * _inverse_preload);
- if (0 <= item_index && item_index < items.length) {
- return _items[item_index];
+ final item_index = _top! +
+ el_index -
+ safeFloor(_buffer.children.length * _inverse_preload);
+ if (0 <= item_index && item_index < items!.length) {
+ return _items![item_index];
}
return null;
}
@@ -148,38 +149,39 @@
..onSearchResultSelected.listen((e) {
takeIntoView(e.item);
});
- children.insert(0, _searcher.element);
+ children.insert(0, _searcher!.element);
}
if (_createHeader != null) {
_header = new DivElement()
..classes = ['header', 'container']
- ..children = _createHeader();
- children.insert(0, _header);
- final rect = _header.getBoundingClientRect();
- _header.classes.add('attached');
+ ..children = _createHeader!();
+ children.insert(0, _header!);
+ final rect = _header!.getBoundingClientRect();
+ _header!.classes.add('attached');
_viewport.style.top = '${rect.height}px';
- final width = _header.children.fold(0.0, _foldWidth);
+ final width = _header!.children.fold(0.0, _foldWidth);
_buffer.style.minWidth = '${width}px';
}
- _itemHeight = _buffer.children[0].getBoundingClientRect().height;
- _height = getBoundingClientRect().height;
+ _itemHeight =
+ _buffer.children[0].getBoundingClientRect().height as double;
+ _height = getBoundingClientRect().height as double;
}
if (_takeIntoView != null) {
- final index = items.indexOf(_takeIntoView);
+ final index = items!.indexOf(_takeIntoView);
if (index >= 0) {
- final minScrollTop = _itemHeight * (index + 1) - _height;
- final maxScrollTop = _itemHeight * index;
+ final minScrollTop = _itemHeight! * (index + 1) - _height!;
+ final maxScrollTop = _itemHeight! * index;
_viewport.scrollTop =
safeFloor((maxScrollTop - minScrollTop) / 2 + minScrollTop);
}
_takeIntoView = null;
}
- final top = safeFloor(_viewport.scrollTop / _itemHeight);
+ final top = safeFloor(_viewport.scrollTop / _itemHeight!);
- _spacer.style.height = '${_itemHeight * (_items.length)}px';
- final tail_length = safeCeil(_height / _itemHeight / _preload);
+ _spacer.style.height = '${_itemHeight! * (_items!.length)}px';
+ final tail_length = safeCeil(_height! / _itemHeight! / _preload);
final length = tail_length * 2 + tail_length * _preload;
if (_buffer.children.length < length) {
@@ -191,13 +193,13 @@
_top = null; // force update;
}
- if ((_top == null) || ((top - _top).abs() >= tail_length)) {
- _buffer.style.top = '${_itemHeight * (top - tail_length)}px';
+ if ((_top == null) || ((top - _top!).abs() >= tail_length)) {
+ _buffer.style.top = '${_itemHeight! * (top - tail_length)}px';
int i = top - tail_length;
- for (final HtmlElement e in _buffer.children) {
- if (0 <= i && i < _items.length) {
+ for (final e in _buffer.children) {
+ if (0 <= i && i < _items!.length) {
e.style.display = null;
- _update(e, _items[i], i);
+ _update(e as HtmlElement, _items![i], i);
} else {
e.style.display = 'hidden';
}
@@ -207,11 +209,11 @@
}
if (_searcher != null) {
- final current = _searcher.current;
- int i = _top - tail_length;
- for (final HtmlElement e in _buffer.children) {
- if (0 <= i && i < _items.length) {
- if (_items[i] == current) {
+ final current = _searcher!.current;
+ int i = _top! - tail_length;
+ for (final e in _buffer.children) {
+ if (0 <= i && i < _items!.length) {
+ if (_items![i] == current) {
e.classes.add('marked');
} else {
e.classes.remove('marked');
@@ -224,14 +226,14 @@
}
double _foldWidth(double value, Element child) {
- return math.max(value, child.getBoundingClientRect().width);
+ return math.max(value, child.getBoundingClientRect().width as double);
}
void _updateHeader() {
if (_header != null) {
- _header.style.left = '${-_viewport.scrollLeft}px';
+ _header!.style.left = '${-_viewport.scrollLeft}px';
final width = _buffer.getBoundingClientRect().width;
- _header.children.last.style.width = '${width}px';
+ _header!.children.last.style.width = '${width}px';
}
}
@@ -242,8 +244,8 @@
}
void _onResize(_) {
- final newHeight = getBoundingClientRect().height;
- if (newHeight > _height) {
+ final newHeight = getBoundingClientRect().height as double;
+ if (newHeight > _height!) {
_height = newHeight;
_r.dirty();
} else {
@@ -254,6 +256,6 @@
}
Iterable<dynamic> _doSearch(Pattern search) {
- return _items.where((item) => _search(search, item));
+ return _items!.where((item) => _search!(search, item));
}
}
diff --git a/runtime/observatory/lib/src/elements/containers/virtual_tree.dart b/runtime/observatory/lib/src/elements/containers/virtual_tree.dart
index 0f7939b..b56c36b 100644
--- a/runtime/observatory/lib/src/elements/containers/virtual_tree.dart
+++ b/runtime/observatory/lib/src/elements/containers/virtual_tree.dart
@@ -27,13 +27,13 @@
}
class VirtualTreeElement extends CustomElement implements Renderable {
- RenderingScheduler<VirtualTreeElement> _r;
+ late RenderingScheduler<VirtualTreeElement> _r;
Stream<RenderedEvent<VirtualTreeElement>> get onRendered => _r.onRendered;
- VritualTreeGetChildrenCallback _children;
- List _items;
- List _depths;
+ late VritualTreeGetChildrenCallback _children;
+ late List _items;
+ late List _depths;
final Set _expanded = new Set();
List get items => _items;
@@ -47,8 +47,8 @@
factory VirtualTreeElement(VirtualTreeCreateCallback create,
VirtualTreeUpdateCallback update, VritualTreeGetChildrenCallback children,
{Iterable items: const [],
- VirtualTreeSearchCallback search,
- RenderingQueue queue}) {
+ VirtualTreeSearchCallback? search,
+ RenderingQueue? queue}) {
assert(create != null);
assert(update != null);
assert(children != null);
@@ -61,7 +61,7 @@
return element = create((
{bool autoToggleSingleChildNodes: false,
bool autoToggleWholeTree: false}) {
- var item = e._collection.getItemFromElement(element);
+ var item = e._collection!.getItemFromElement(element);
if (e.isExpanded(item)) {
e.collapse(item,
autoCollapseWholeTree: autoToggleWholeTree,
@@ -144,11 +144,11 @@
children = const [];
}
- VirtualCollectionElement _collection;
+ VirtualCollectionElement? _collection;
void render() {
if (children.length == 0) {
- children = <Element>[_collection.element];
+ children = <Element>[_collection!.element];
}
final items = [];
@@ -176,8 +176,8 @@
}
_depths = depths;
- _collection.items = items;
+ _collection!.items = items;
- _r.waitFor([_collection.onRendered.first]);
+ _r.waitFor([_collection!.onRendered.first]);
}
}
diff --git a/runtime/observatory/lib/src/elements/context_ref.dart b/runtime/observatory/lib/src/elements/context_ref.dart
index 6de2c38..7559bbb 100644
--- a/runtime/observatory/lib/src/elements/context_ref.dart
+++ b/runtime/observatory/lib/src/elements/context_ref.dart
@@ -12,15 +12,15 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class ContextRefElement extends CustomElement implements Renderable {
- RenderingScheduler<ContextRefElement> _r;
+ late RenderingScheduler<ContextRefElement> _r;
Stream<RenderedEvent<ContextRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.ContextRef _context;
- M.ObjectRepository _objects;
- M.Context _loadedContext;
- bool _expandable;
+ late M.IsolateRef _isolate;
+ late M.ContextRef _context;
+ late M.ObjectRepository _objects;
+ M.Context? _loadedContext;
+ late bool _expandable;
bool _expanded = false;
M.IsolateRef get isolate => _isolate;
@@ -28,7 +28,7 @@
factory ContextRefElement(
M.IsolateRef isolate, M.ContextRef context, M.ObjectRepository objects,
- {RenderingQueue queue, bool expandable: true}) {
+ {RenderingQueue? queue, bool expandable: true}) {
assert(isolate != null);
assert(context != null);
assert(objects != null);
@@ -57,7 +57,7 @@
}
Future _refresh() async {
- _loadedContext = await _objects.get(_isolate, _context.id);
+ _loadedContext = await _objects.get(_isolate, _context.id!) as M.Context;
_r.dirty();
}
@@ -99,7 +99,7 @@
return [new SpanElement()..text = 'Loading...'];
}
var members = <Element>[];
- if (_loadedContext.parentContext != null) {
+ if (_loadedContext!.parentContext != null) {
members.add(new DivElement()
..classes = ['memberItem']
..children = <Element>[
@@ -110,14 +110,14 @@
..classes = ['memberName']
..children = <Element>[
new ContextRefElement(
- _isolate, _loadedContext.parentContext, _objects,
+ _isolate, _loadedContext!.parentContext!, _objects,
queue: _r.queue)
.element
]
]);
}
- if (_loadedContext.variables.isNotEmpty) {
- var variables = _loadedContext.variables.toList();
+ if (_loadedContext!.variables!.isNotEmpty) {
+ var variables = _loadedContext!.variables!.toList();
for (var index = 0; index < variables.length; index++) {
var variable = variables[index];
members.add(new DivElement()
diff --git a/runtime/observatory/lib/src/elements/context_view.dart b/runtime/observatory/lib/src/elements/context_view.dart
index f4a1ba4..8cfb76c 100644
--- a/runtime/observatory/lib/src/elements/context_view.dart
+++ b/runtime/observatory/lib/src/elements/context_view.dart
@@ -22,21 +22,21 @@
import 'package:observatory/src/elements/view_footer.dart';
class ContextViewElement extends CustomElement implements Renderable {
- RenderingScheduler<ContextViewElement> _r;
+ late RenderingScheduler<ContextViewElement> _r;
Stream<RenderedEvent<ContextViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.Context _context;
- M.ContextRepository _contexts;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.Context _context;
+ late M.ContextRepository _contexts;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -55,7 +55,7 @@
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -104,13 +104,13 @@
new NavTopMenuElement(queue: _r.queue).element,
new NavVMMenuElement(_vm, _events, queue: _r.queue).element,
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element,
- new NavClassMenuElement(_isolate, _context.clazz, queue: _r.queue)
+ new NavClassMenuElement(_isolate, _context.clazz!, queue: _r.queue)
.element,
navMenu('instance'),
(new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) async {
e.element.disabled = true;
- _context = await _contexts.get(_isolate, _context.id);
+ _context = await _contexts.get(_isolate, _context.id!);
_r.dirty();
}))
.element,
@@ -146,7 +146,7 @@
..classes = ['memberName']
..children = <Element>[
new ContextRefElement(
- _isolate, _context.parentContext, _objects,
+ _isolate, _context.parentContext!, _objects,
queue: _r.queue)
.element
]
@@ -156,7 +156,7 @@
]);
}
content.add(new HRElement());
- if (_context.variables.isNotEmpty) {
+ if (_context.variables!.isNotEmpty) {
int index = 0;
content.addAll([
new DivElement()
@@ -167,7 +167,7 @@
..content = <Element>[
new DivElement()
..classes = ['memberList']
- ..children = _context.variables
+ ..children = _context.variables!
.map<Element>((variable) => new DivElement()
..classes = ['memberItem']
..children = <Element>[
diff --git a/runtime/observatory/lib/src/elements/cpu_profile.dart b/runtime/observatory/lib/src/elements/cpu_profile.dart
index 41c3ffb..43ff7ee 100644
--- a/runtime/observatory/lib/src/elements/cpu_profile.dart
+++ b/runtime/observatory/lib/src/elements/cpu_profile.dart
@@ -22,21 +22,21 @@
import 'package:observatory/src/elements/stack_trace_tree_config.dart';
class CpuProfileElement extends CustomElement implements Renderable {
- RenderingScheduler<CpuProfileElement> _r;
+ late RenderingScheduler<CpuProfileElement> _r;
Stream<RenderedEvent<CpuProfileElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.IsolateSampleProfileRepository _profiles;
- Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
- M.SampleProfileLoadingProgress _progress;
- M.SampleProfileTag _tag = M.SampleProfileTag.none;
- ProfileTreeMode _mode = ProfileTreeMode.function;
- M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
- String _filter = '';
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.IsolateSampleProfileRepository _profiles;
+ late Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
+ M.SampleProfileLoadingProgress? _progress;
+ late M.SampleProfileTag _tag = M.SampleProfileTag.none;
+ late ProfileTreeMode _mode = ProfileTreeMode.function;
+ late M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
+ late String _filter = '';
M.IsolateRef get isolate => _isolate;
M.NotificationRepository get notifications => _notifications;
@@ -49,7 +49,7 @@
M.EventRepository events,
M.NotificationRepository notifications,
M.IsolateSampleProfileRepository profiles,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -100,15 +100,16 @@
children = content;
return;
}
- content.add((new SampleBufferControlElement(_vm, _progress, _progressStream,
+ content.add((new SampleBufferControlElement(
+ _vm, _progress!, _progressStream,
selectedTag: _tag, queue: _r.queue)
..onTagChange.listen((e) {
_tag = e.element.selectedTag;
_request();
}))
.element);
- if (_progress.status == M.SampleProfileLoadingStatus.loaded) {
- CpuProfileVirtualTreeElement tree;
+ if (_progress!.status == M.SampleProfileLoadingStatus.loaded) {
+ late CpuProfileVirtualTreeElement tree;
content.addAll([
new BRElement(),
(new StackTraceTreeConfigElement(
@@ -134,7 +135,7 @@
}))
.element,
new BRElement(),
- (tree = new CpuProfileVirtualTreeElement(_isolate, _progress.profile,
+ (tree = new CpuProfileVirtualTreeElement(_isolate, _progress!.profile,
queue: _r.queue))
.element
]);
@@ -149,7 +150,7 @@
_r.dirty();
_progress = (await _progressStream.first).progress;
_r.dirty();
- if (M.isSampleProcessRunning(_progress.status)) {
+ if (M.isSampleProcessRunning(_progress!.status)) {
_progress = (await _progressStream.last).progress;
_r.dirty();
}
diff --git a/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart b/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart
index 7044f5c..4d5de13 100644
--- a/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart
+++ b/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart
@@ -19,45 +19,45 @@
show ProfileTreeMode;
class CpuProfileVirtualTreeElement extends CustomElement implements Renderable {
- RenderingScheduler<CpuProfileVirtualTreeElement> _r;
+ late RenderingScheduler<CpuProfileVirtualTreeElement> _r;
Stream<RenderedEvent<CpuProfileVirtualTreeElement>> get onRendered =>
_r.onRendered;
- M.ProfileTreeDirection _direction;
- ProfileTreeMode _mode;
- M.SampleProfileType _type;
- M.IsolateRef _isolate;
- M.SampleProfile _profile;
- Iterable<M.CallTreeNodeFilter> _filters;
+ late M.ProfileTreeDirection _direction;
+ late ProfileTreeMode _mode;
+ late M.SampleProfileType _type;
+ late M.IsolateRef _isolate;
+ late M.SampleProfile _profile;
+ Iterable<M.CallTreeNodeFilter>? _filters;
M.ProfileTreeDirection get direction => _direction;
ProfileTreeMode get mode => _mode;
M.SampleProfileType get type => _type;
M.IsolateRef get isolate => _isolate;
M.SampleProfile get profile => _profile;
- Iterable<M.CallTreeNodeFilter> get filters => _filters;
+ Iterable<M.CallTreeNodeFilter>? get filters => _filters;
set direction(M.ProfileTreeDirection value) =>
_direction = _r.checkAndReact(_direction, value);
set mode(ProfileTreeMode value) => _mode = _r.checkAndReact(_mode, value);
- set filters(Iterable<M.CallTreeNodeFilter> value) {
- _filters = new List.unmodifiable(value);
+ set filters(Iterable<M.CallTreeNodeFilter>? value) {
+ _filters = new List.unmodifiable(value!);
_r.dirty();
}
- factory CpuProfileVirtualTreeElement(Object owner, M.SampleProfile profile,
+ factory CpuProfileVirtualTreeElement(Object? owner, M.SampleProfile profile,
{ProfileTreeMode mode: ProfileTreeMode.function,
M.SampleProfileType type: M.SampleProfileType.cpu,
M.ProfileTreeDirection direction: M.ProfileTreeDirection.exclusive,
- RenderingQueue queue}) {
+ RenderingQueue? queue}) {
assert(profile != null);
assert(mode != null);
assert(direction != null);
CpuProfileVirtualTreeElement e = new CpuProfileVirtualTreeElement.created();
e._r =
new RenderingScheduler<CpuProfileVirtualTreeElement>(e, queue: queue);
- e._isolate = owner;
+ e._isolate = owner as M.Isolate;
e._profile = profile;
e._mode = mode;
e._type = type;
@@ -81,7 +81,7 @@
children = <Element>[];
}
- VirtualTreeElement _tree;
+ VirtualTreeElement? _tree;
void render() {
var tree;
@@ -121,7 +121,7 @@
throw new Exception('Unknown SampleProfileType: $type');
}
if (filters != null) {
- tree = filters.fold(tree, (tree, filter) {
+ tree = filters!.fold(tree, (dynamic tree, filter) {
return tree?.filtered(filter);
});
}
@@ -139,9 +139,9 @@
];
return;
} else if (tree.root.children.length == 1) {
- _tree.expand(tree.root.children.first, autoExpandSingleChildNodes: true);
+ _tree!.expand(tree.root.children.first, autoExpandSingleChildNodes: true);
}
- children = <Element>[_tree.element];
+ children = <Element>[_tree!.element];
}
static HtmlElement _createCpuRow(toggle) {
@@ -203,13 +203,13 @@
_updateLines(element.children[2].children, depth);
if (item.children.isNotEmpty) {
element.children[3].text =
- _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon;
+ _tree!.isExpanded(item) ? _expandedIcon : _collapsedIcon;
} else {
element.children[3].text = '';
}
element.children[4].text = Utils.formatPercentNormalized(item.percentage);
element.children[5] = (new FunctionRefElement(
- _isolate, item.profileFunction.function,
+ _isolate, item.profileFunction.function!,
queue: _r.queue)
..classes = ['name'])
.element;
@@ -228,13 +228,13 @@
_updateLines(element.children[2].children, depth);
if (item.children.isNotEmpty) {
element.children[3].text =
- _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon;
+ _tree!.isExpanded(item) ? _expandedIcon : _collapsedIcon;
} else {
element.children[3].text = '';
}
element.children[4].text = Utils.formatPercentNormalized(item.percentage);
element.children[5] = (new FunctionRefElement(
- null, item.profileFunction.function,
+ null, item.profileFunction.function!,
queue: _r.queue)
..classes = ['name'])
.element;
@@ -243,7 +243,7 @@
bool _searchFunction(Pattern pattern, itemDynamic) {
M.FunctionCallTreeNode item = itemDynamic;
return M
- .getFunctionFullName(item.profileFunction.function)
+ .getFunctionFullName(item.profileFunction.function!)
.contains(pattern);
}
@@ -256,13 +256,13 @@
_updateLines(element.children[2].children, depth);
if (item.children.isNotEmpty) {
element.children[3].text =
- _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon;
+ _tree!.isExpanded(item) ? _expandedIcon : _collapsedIcon;
} else {
element.children[3].text = '';
}
element.children[4].text = Utils.formatPercentNormalized(item.percentage);
element.children[5] =
- (new CodeRefElement(_isolate, item.profileCode.code, queue: _r.queue)
+ (new CodeRefElement(_isolate, item.profileCode.code!, queue: _r.queue)
..classes = ['name'])
.element;
}
@@ -280,20 +280,20 @@
_updateLines(element.children[2].children, depth);
if (item.children.isNotEmpty) {
element.children[3].text =
- _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon;
+ _tree!.isExpanded(item) ? _expandedIcon : _collapsedIcon;
} else {
element.children[3].text = '';
}
element.children[4].text = Utils.formatPercentNormalized(item.percentage);
element.children[5] =
- (new CodeRefElement(null, item.profileCode.code, queue: _r.queue)
+ (new CodeRefElement(null, item.profileCode.code!, queue: _r.queue)
..classes = ['name'])
.element;
}
bool _searchCode(Pattern pattern, itemDynamic) {
M.CodeCallTreeNode item = itemDynamic;
- return item.profileCode.code.name.contains(pattern);
+ return item.profileCode.code!.name!.contains(pattern);
}
static _updateLines(List<Element> lines, int n) {
diff --git a/runtime/observatory/lib/src/elements/cpu_profile_table.dart b/runtime/observatory/lib/src/elements/cpu_profile_table.dart
index 4cb0a9d..bfb95a1 100644
--- a/runtime/observatory/lib/src/elements/cpu_profile_table.dart
+++ b/runtime/observatory/lib/src/elements/cpu_profile_table.dart
@@ -30,17 +30,17 @@
enum _SortingDirection { ascending, descending }
class CpuProfileTableElement extends CustomElement implements Renderable {
- RenderingScheduler<CpuProfileTableElement> _r;
+ late RenderingScheduler<CpuProfileTableElement> _r;
Stream<RenderedEvent<CpuProfileTableElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.IsolateSampleProfileRepository _profiles;
- Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
- M.SampleProfileLoadingProgress _progress;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.IsolateSampleProfileRepository _profiles;
+ late Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
+ M.SampleProfileLoadingProgress? _progress;
final _sortingField = <_Table, _SortingField>{
_Table.functions: _SortingField.exclusive,
_Table.caller: _SortingField.caller,
@@ -64,7 +64,7 @@
M.EventRepository events,
M.NotificationRepository notifications,
M.IsolateSampleProfileRepository profiles,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -115,10 +115,10 @@
children = content;
return;
}
- content.add(new SampleBufferControlElement(_vm, _progress, _progressStream,
+ content.add(new SampleBufferControlElement(_vm, _progress!, _progressStream,
showTag: false, queue: _r.queue)
.element);
- if (_progress.status == M.SampleProfileLoadingStatus.loaded) {
+ if (_progress!.status == M.SampleProfileLoadingStatus.loaded) {
content.add(new BRElement());
content.addAll(_createTables());
content.add(new BRElement());
@@ -127,10 +127,10 @@
children = content;
}
- M.ProfileFunction _selected;
- VirtualCollectionElement _functions;
- VirtualCollectionElement _callers;
- VirtualCollectionElement _callees;
+ M.ProfileFunction? _selected;
+ VirtualCollectionElement? _functions;
+ VirtualCollectionElement? _callers;
+ VirtualCollectionElement? _callees;
List<Element> _createTables() {
_functions = _functions ??
@@ -139,11 +139,11 @@
search: _searchFunction,
queue: _r.queue);
// If there's no samples, don't populate the function list.
- _functions.items = (_progress.profile.sampleCount != 0)
- ? _progress.profile.functions.toList()
+ _functions!.items = (_progress!.profile.sampleCount != 0)
+ ? _progress!.profile.functions.toList()
: []
..sort(_createSorter(_Table.functions));
- _functions.takeIntoView(_selected);
+ _functions!.takeIntoView(_selected);
_callers = _callers ??
new VirtualCollectionElement(_createCaller, _updateCaller,
createHeader: _createCallerHeader,
@@ -155,13 +155,13 @@
search: _searchFunction,
queue: _r.queue);
if (_selected != null) {
- _callers.items = _selected.callers.keys.toList()
+ _callers!.items = _selected!.callers.keys.toList()
..sort(_createSorter(_Table.caller));
- _callees.items = _selected.callees.keys.toList()
+ _callees!.items = _selected!.callees.keys.toList()
..sort(_createSorter(_Table.callee));
} else {
- _callers.items = const [];
- _callees.items = const [];
+ _callers!.items = const [];
+ _callees!.items = const [];
}
return <Element>[
new DivElement()
@@ -169,25 +169,25 @@
..children = <Element>[
new DivElement()
..classes = ['profile-trees-all']
- ..children = <Element>[_functions.element],
+ ..children = <Element>[_functions!.element],
new DivElement()
..classes = ['profile-trees-current']
..children = <Element>[
new DivElement()
..classes = ['profile-trees-caller']
- ..children = <Element>[_callers.element],
+ ..children = <Element>[_callers!.element],
new DivElement()
..classes = ['profile-trees-selected']
..children = _selected == null
? [new SpanElement()..text = 'No element selected']
: [
- new FunctionRefElement(_isolate, _selected.function,
+ new FunctionRefElement(_isolate, _selected!.function!,
queue: _r.queue)
.element
],
new DivElement()
..classes = ['profile-trees-callee']
- ..children = <Element>[_callees.element]
+ ..children = <Element>[_callees!.element]
]
]
];
@@ -209,7 +209,7 @@
if (e.target is AnchorElement) {
return;
}
- _selected = _functions.getItemFromElement(element);
+ _selected = _functions!.getItemFromElement(element);
_r.dirty();
});
return element;
@@ -224,7 +224,7 @@
}
e.children[0].text = Utils.formatPercentNormalized(_getExclusiveT(item));
e.children[1].text = Utils.formatPercentNormalized(_getInclusiveT(item));
- e.children[2].text = M.getFunctionFullName(item.function);
+ e.children[2].text = M.getFunctionFullName(item.function!);
}
List<HtmlElement> _createFunctionHeader() => [
@@ -250,7 +250,7 @@
bool _searchFunction(Pattern pattern, itemDynamic) {
M.ProfileFunction item = itemDynamic;
- return M.getFunctionFullName(item.function).contains(pattern);
+ return M.getFunctionFullName(item.function!).contains(pattern);
}
void _setSorting(
@@ -284,7 +284,7 @@
if (e.target is AnchorElement) {
return;
}
- _selected = _callees.getItemFromElement(element);
+ _selected = _callees!.getItemFromElement(element);
_r.dirty();
});
return element;
@@ -323,7 +323,7 @@
if (e.target is AnchorElement) {
return;
}
- _selected = _callers.getItemFromElement(element);
+ _selected = _callers!.getItemFromElement(element);
_r.dirty();
});
return element;
@@ -361,7 +361,7 @@
..onClick.listen((_) => _setSorting(table, field, direction));
List<Element> _createTree() {
- CpuProfileVirtualTreeElement tree;
+ late CpuProfileVirtualTreeElement tree;
return [
(new StackTraceTreeConfigElement(
showMode: false,
@@ -383,7 +383,7 @@
}))
.element,
new BRElement(),
- (tree = new CpuProfileVirtualTreeElement(_isolate, _progress.profile,
+ (tree = new CpuProfileVirtualTreeElement(_isolate, _progress!.profile,
mode: ProfileTreeMode.function,
direction: M.ProfileTreeDirection.exclusive,
queue: _r.queue)
@@ -411,7 +411,7 @@
_r.dirty();
_progress = (await _progressStream.first).progress;
_r.dirty();
- if (M.isSampleProcessRunning(_progress.status)) {
+ if (M.isSampleProcessRunning(_progress!.status)) {
_progress = (await _progressStream.last).progress;
_r.dirty();
}
@@ -445,7 +445,7 @@
getter = _getCallerT;
break;
case _SortingField.method:
- getter = (M.ProfileFunction s) => M.getFunctionFullName(s.function);
+ getter = (M.ProfileFunction s) => M.getFunctionFullName(s.function!);
break;
}
switch (_sortingDirection[table]) {
@@ -467,7 +467,9 @@
static double _getInclusiveT(M.ProfileFunction f) =>
f.normalizedInclusiveTicks;
double _getCalleeT(M.ProfileFunction f) =>
- _selected.callees[f] / _selected.callees.values.reduce((a, b) => a + b);
+ _selected!.callees[f]! /
+ _selected!.callees.values.reduce((a, b) => a + b);
double _getCallerT(M.ProfileFunction f) =>
- _selected.callers[f] / _selected.callers.values.reduce((a, b) => a + b);
+ _selected!.callers[f]! /
+ _selected!.callers.values.reduce((a, b) => a + b);
}
diff --git a/runtime/observatory/lib/src/elements/curly_block.dart b/runtime/observatory/lib/src/elements/curly_block.dart
index 875d566..2bc6e2a 100644
--- a/runtime/observatory/lib/src/elements/curly_block.dart
+++ b/runtime/observatory/lib/src/elements/curly_block.dart
@@ -16,15 +16,15 @@
}
class CurlyBlockElement extends CustomElement implements Renderable {
- RenderingScheduler<CurlyBlockElement> _r;
+ late RenderingScheduler<CurlyBlockElement> _r;
final StreamController<CurlyBlockToggleEvent> _onToggle =
new StreamController<CurlyBlockToggleEvent>.broadcast();
Stream<CurlyBlockToggleEvent> get onToggle => _onToggle.stream;
Stream<RenderedEvent<CurlyBlockElement>> get onRendered => _r.onRendered;
- bool _expanded;
- bool _disabled;
+ late bool _expanded;
+ late bool _disabled;
Iterable<Element> _content = const [];
bool get expanded => _expanded;
@@ -43,7 +43,7 @@
}
factory CurlyBlockElement(
- {bool expanded: false, bool disabled: false, RenderingQueue queue}) {
+ {bool expanded: false, bool disabled: false, RenderingQueue? queue}) {
assert(expanded != null);
assert(disabled != null);
CurlyBlockElement e = new CurlyBlockElement.created();
diff --git a/runtime/observatory/lib/src/elements/debugger.dart b/runtime/observatory/lib/src/elements/debugger.dart
index 568145c..c7c4dc5 100644
--- a/runtime/observatory/lib/src/elements/debugger.dart
+++ b/runtime/observatory/lib/src/elements/debugger.dart
@@ -36,8 +36,9 @@
abstract class DebuggerCommand extends Command {
ObservatoryDebugger debugger;
- DebuggerCommand(this.debugger, name, List<Command> children)
- : super(name, children);
+ DebuggerCommand(Debugger debugger, name, List<Command> children)
+ : debugger = debugger as ObservatoryDebugger,
+ super(name, children);
String get helpShort;
String get helpLong;
@@ -46,7 +47,7 @@
// TODO(turnidge): Rewrite HelpCommand so that it is a general utility
// provided by the cli library.
class HelpCommand extends DebuggerCommand {
- HelpCommand(Debugger debugger)
+ HelpCommand(ObservatoryDebugger debugger)
: super(debugger, 'help', <Command>[
new HelpHotkeysCommand(debugger),
]);
@@ -66,7 +67,8 @@
var commands = debugger.cmd.matchCommand(<String>[], false);
commands.sort((a, b) => a.name.compareTo(b.name));
con.print('List of commands:\n');
- for (DebuggerCommand command in commands) {
+ for (Command c in commands) {
+ DebuggerCommand command = c as DebuggerCommand;
con.print('${_nameAndAlias(command).padRight(12)} '
'- ${command.helpShort}');
}
@@ -89,7 +91,8 @@
return new Future.value(null);
}
con.print('');
- for (DebuggerCommand command in commands) {
+ for (Command c in commands) {
+ DebuggerCommand command = c as DebuggerCommand;
con.printBold(_nameAndAlias(command));
con.print(command.helpLong);
@@ -102,7 +105,8 @@
if (subCommands.isNotEmpty) {
subCommands.sort((a, b) => a.name.compareTo(b.name));
con.print('Subcommands:\n');
- for (DebuggerCommand subCommand in subCommands) {
+ for (Command c in subCommands) {
+ DebuggerCommand subCommand = c as DebuggerCommand;
con.print(' ${subCommand.fullName.padRight(16)} '
'- ${subCommand.helpShort}');
}
@@ -177,14 +181,15 @@
}
var expression = args.join('');
var response =
- await debugger.isolate.evalFrame(debugger.currentFrame, expression);
+ await debugger.isolate.evalFrame(debugger.currentFrame!, expression);
if (response is S.DartError) {
- debugger.console.print(response.message);
+ debugger.console.print(response.message!);
} else if (response is S.Sentinel) {
debugger.console.print(response.valueAsString);
} else {
debugger.console.print('= ', newline: false);
- debugger.console.printRef(debugger.isolate, response, debugger.objects);
+ debugger.console.printRef(
+ debugger.isolate, response as S.Instance, debugger.objects!);
}
}
@@ -214,7 +219,7 @@
try {
debugger.downFrame(count);
debugger.console.print('frame = ${debugger.currentFrame}');
- } catch (e) {
+ } on dynamic catch (e) {
debugger.console
.print('frame must be in range [${e.start}..${e.end - 1}]');
}
@@ -251,7 +256,7 @@
debugger.console.print('frame = ${debugger.currentFrame}');
} on RangeError catch (e) {
debugger.console
- .print('frame must be in range [${e.start}..${e.end - 1}]');
+ .print('frame must be in range [${e.start}..${e.end! - 1}]');
}
return new Future.value(null);
}
@@ -288,7 +293,7 @@
debugger.console.print('frame = ${debugger.currentFrame}');
} on RangeError catch (e) {
debugger.console
- .print('frame must be in range [${e.start}..${e.end - 1}]');
+ .print('frame must be in range [${e.start}..${e.end! - 1}]');
}
return new Future.value(null);
}
@@ -420,7 +425,7 @@
Future run(List<String> args) async {
try {
- int count = 1;
+ int? count = 1;
if (args.length == 1) {
count = int.tryParse(args[0]);
if (count == null || count < 1 || count >= debugger.stackDepth) {
@@ -433,10 +438,10 @@
debugger.console.print('rewind expects 0 or 1 argument');
return;
}
- await debugger.rewind(count);
+ await debugger.rewind(count as int);
} on S.ServerRpcException catch (e) {
if (e.code == S.ServerRpcException.kCannotResume) {
- debugger.console.printRed(e.data['details']);
+ debugger.console.printRed(e.data!['details']);
} else {
rethrow;
}
@@ -474,7 +479,7 @@
} on S.ServerRpcException catch (e) {
if (e.code == S.ServerRpcException.kIsolateReloadBarred ||
e.code == S.ServerRpcException.kIsolateIsReloading) {
- debugger.console.printRed(e.data['details']);
+ debugger.console.printRed(e.data!['details']);
} else {
rethrow;
}
@@ -527,7 +532,7 @@
return new Future.value(null);
}
- Level _findLevel(String levelName) {
+ Level? _findLevel(String levelName) {
levelName = levelName.toUpperCase();
for (var level in Level.LEVELS) {
if (level.name == levelName) {
@@ -669,7 +674,7 @@
Future run(List<String> args) async {
if (args.length == 0) {
for (var name in _options.keys) {
- dynamic getHandler = _options[name][2];
+ dynamic getHandler = _options[name]![2];
var value = await getHandler(debugger, name);
debugger.console.print("${name} = ${value}");
}
@@ -722,7 +727,7 @@
var prefix = args[1];
var optionInfo = _options[name];
if (optionInfo != null) {
- var validValues = optionInfo[0];
+ dynamic validValues = optionInfo[0];
for (var value in validValues) {
if (value.startsWith(prefix)) {
result.add('${args[0]}${value} ');
@@ -761,7 +766,7 @@
if (loc.valid) {
if (loc.function != null) {
try {
- await debugger.isolate.addBreakpointAtEntry(loc.function);
+ await debugger.isolate.addBreakpointAtEntry(loc.function!);
} on S.ServerRpcException catch (e) {
if (e.code == S.ServerRpcException.kCannotAddBreakpoint) {
debugger.console.print('Unable to set breakpoint at ${loc}');
@@ -771,15 +776,15 @@
}
} else {
assert(loc.script != null);
- var script = loc.script;
+ var script = loc.script!;
await script.load();
- if (loc.line < 1 || loc.line > script.lines.length) {
+ if (loc.line! < 1 || loc.line! > script.lines.length) {
debugger.console.print(
'line number must be in range [1..${script.lines.length}]');
return;
}
try {
- await debugger.isolate.addBreakpoint(script, loc.line, loc.col);
+ await debugger.isolate.addBreakpoint(script, loc.line!, loc.col);
} on S.ServerRpcException catch (e) {
if (e.code == S.ServerRpcException.kCannotAddBreakpoint) {
debugger.console.print('Unable to set breakpoint at ${loc}');
@@ -789,7 +794,7 @@
}
}
} else {
- debugger.console.print(loc.errorMessage);
+ debugger.console.print(loc.errorMessage!);
}
}
@@ -843,7 +848,7 @@
var arg = (args.length == 0 ? '' : args[0]);
var loc = await DebuggerLocation.parse(debugger, arg);
if (!loc.valid) {
- debugger.console.print(loc.errorMessage);
+ debugger.console.print(loc.errorMessage!);
return;
}
if (loc.function != null) {
@@ -852,20 +857,20 @@
return;
}
- var script = loc.script;
- if (loc.line < 1 || loc.line > script.lines.length) {
+ var script = loc.script!;
+ if (loc.line! < 1 || loc.line! > script.lines.length) {
debugger.console
.print('line number must be in range [1..${script.lines.length}]');
return;
}
- var lineInfo = script.getLine(loc.line);
+ var lineInfo = script.getLine(loc.line!)!;
var bpts = lineInfo.breakpoints;
var foundBreakpoint = false;
if (bpts != null) {
var bptList = bpts.toList();
for (var bpt in bptList) {
if (loc.col == null ||
- loc.col == script.tokenToCol(bpt.location.tokenPos)) {
+ loc.col == script.tokenToCol(bpt.location!.tokenPos)) {
foundBreakpoint = true;
var result = await debugger.isolate.removeBreakpoint(bpt);
if (result is S.DartError) {
@@ -1061,7 +1066,7 @@
}
}
for (var isolate in debugger.vm.isolates) {
- if (isolate.name.startsWith(args[0])) {
+ if (isolate.name!.startsWith(args[0])) {
result.add('${isolate.name} ');
}
}
@@ -1108,7 +1113,7 @@
const maxRunStateLen = 7;
var maxNameLen = 'NAME'.length;
for (var isolate in debugger.vm.isolates) {
- maxNameLen = max(maxNameLen, isolate.name.length);
+ maxNameLen = max(maxNameLen, isolate.name!.length);
}
debugger.console.print("${'ID'.padLeft(maxIdLen, ' ')} "
"${'ORIGIN'.padLeft(maxIdLen, ' ')} "
@@ -1120,7 +1125,7 @@
debugger.console
.print("${isolate.number.toString().padLeft(maxIdLen, ' ')} "
"${isolate.originNumber.toString().padLeft(maxIdLen, ' ')} "
- "${isolate.name.padRight(maxNameLen, ' ')} "
+ "${isolate.name!.padRight(maxNameLen, ' ')} "
"${_isolateRunState(isolate).padRight(maxRunStateLen, ' ')} "
"${current}");
}
@@ -1225,7 +1230,7 @@
for (var vm in vmList) {
maxAddrLen = max(maxAddrLen, vm.target.networkAddress.length);
- maxNameLen = max(maxNameLen, vm.name.length);
+ maxNameLen = max(maxNameLen, vm.name!.length);
}
debugger.console.print("${'ADDRESS'.padRight(maxAddrLen, ' ')} "
@@ -1235,7 +1240,7 @@
String current = (vm == debugger.vm ? '*' : '');
debugger.console
.print("${vm.target.networkAddress.padRight(maxAddrLen, ' ')} "
- "${vm.name.padRight(maxNameLen, ' ')} "
+ "${vm.name!.padRight(maxNameLen, ' ')} "
"${current}");
}
}
@@ -1292,19 +1297,19 @@
_ConsoleStreamPrinter(this._debugger);
Level _minimumLogLevel = Level.OFF;
- String _savedStream;
- String _savedIsolate;
- String _savedLine;
+ String? _savedStream;
+ String? _savedIsolate;
+ String? _savedLine;
List<String> _buffer = [];
void onEvent(String streamName, S.ServiceEvent event) {
if (event.kind == S.ServiceEvent.kLogging) {
// Check if we should print this log message.
- if (event.logRecord['level'].value < _minimumLogLevel.value) {
+ if (event.logRecord!['level'].value < _minimumLogLevel.value) {
return;
}
}
- String isolateName = event.isolate.name;
+ String isolateName = event.isolate!.name!;
// If we get a line from a different isolate/stream, flush
// any pending output, even if it is not newline-terminated.
if ((_savedIsolate != null && isolateName != _savedIsolate) ||
@@ -1314,14 +1319,14 @@
String data;
bool hasNewline;
if (event.kind == S.ServiceEvent.kLogging) {
- data = event.logRecord["message"].valueAsString;
+ data = event.logRecord!["message"].valueAsString;
hasNewline = true;
} else {
- data = event.bytesAsString;
+ data = event.bytesAsString!;
hasNewline = data.endsWith('\n');
}
if (_savedLine != null) {
- data = _savedLine + data;
+ data = _savedLine! + data;
_savedIsolate = null;
_savedStream = null;
_savedLine = null;
@@ -1345,7 +1350,7 @@
void flush() {
// If there is any saved output, flush it now.
if (_savedLine != null) {
- _buffer.add(_format(_savedIsolate, _savedStream, _savedLine));
+ _buffer.add(_format(_savedIsolate!, _savedStream!, _savedLine!));
_savedIsolate = null;
_savedStream = null;
_savedLine = null;
@@ -1364,18 +1369,18 @@
// Tracks the state for an isolate debugging session.
class ObservatoryDebugger extends Debugger {
final SettingsGroup settings = new SettingsGroup('debugger');
- RootCommand cmd;
- DebuggerPageElement page;
- DebuggerConsoleElement console;
- DebuggerInputElement input;
- DebuggerStackElement stackElement;
- S.ServiceMap stack;
+ late RootCommand cmd;
+ late DebuggerPageElement page;
+ late DebuggerConsoleElement console;
+ late DebuggerInputElement input;
+ late DebuggerStackElement stackElement;
+ S.ServiceMap? stack;
final S.Isolate isolate;
String breakOnException = "none"; // Last known setting.
- int get currentFrame => _currentFrame;
+ int? get currentFrame => _currentFrame;
- void set currentFrame(int value) {
+ void set currentFrame(int? value) {
if (value != null && (value < 0 || value >= stackDepth)) {
throw new RangeError.range(value, 0, stackDepth);
}
@@ -1385,7 +1390,7 @@
}
}
- int _currentFrame = null;
+ int? _currentFrame = null;
bool get upIsDown => _upIsDown;
void set upIsDown(bool value) {
@@ -1393,7 +1398,7 @@
_upIsDown = value;
}
- bool _upIsDown;
+ bool _upIsDown = false;
bool get causalAsyncStacks => _causalAsyncStacks;
void set causalAsyncStacks(bool value) {
@@ -1401,7 +1406,7 @@
_causalAsyncStacks = value;
}
- bool _causalAsyncStacks;
+ bool _causalAsyncStacks = true;
bool get awaiterStacks => _awaiterStacks;
void set awaiterStacks(bool value) {
@@ -1409,7 +1414,7 @@
_causalAsyncStacks = value;
}
- bool _awaiterStacks;
+ bool _awaiterStacks = true;
static const String kAwaiterStackFrames = 'awaiterFrames';
static const String kAsyncCausalStackFrames = 'asyncCausalFrames';
@@ -1417,50 +1422,50 @@
void upFrame(int count) {
if (_upIsDown) {
- currentFrame += count;
+ currentFrame = currentFrame! + count;
} else {
- currentFrame -= count;
+ currentFrame = currentFrame! - count;
}
}
void downFrame(int count) {
if (_upIsDown) {
- currentFrame -= count;
+ currentFrame = currentFrame! - count;
} else {
- currentFrame += count;
+ currentFrame = currentFrame! + count;
}
}
int get stackDepth {
if (awaiterStacks) {
- var awaiterStackFrames = stack[kAwaiterStackFrames];
+ var awaiterStackFrames = stack![kAwaiterStackFrames];
if (awaiterStackFrames != null) {
return awaiterStackFrames.length;
}
}
if (causalAsyncStacks) {
- var asyncCausalStackFrames = stack[kAsyncCausalStackFrames];
+ var asyncCausalStackFrames = stack![kAsyncCausalStackFrames];
if (asyncCausalStackFrames != null) {
return asyncCausalStackFrames.length;
}
}
- return stack[kStackFrames].length;
+ return stack![kStackFrames].length;
}
List get stackFrames {
if (awaiterStacks) {
- var awaiterStackFrames = stack[kAwaiterStackFrames];
+ var awaiterStackFrames = stack![kAwaiterStackFrames];
if (awaiterStackFrames != null) {
return awaiterStackFrames;
}
}
if (causalAsyncStacks) {
- var asyncCausalStackFrames = stack[kAsyncCausalStackFrames];
+ var asyncCausalStackFrames = stack![kAsyncCausalStackFrames];
if (asyncCausalStackFrames != null) {
return asyncCausalStackFrames;
}
}
- return stack[kStackFrames] ?? [];
+ return stack![kStackFrames] ?? [];
}
static final _history = [''];
@@ -1497,7 +1502,7 @@
}
void _loadSettings() {
- _upIsDown = settings.get('up-is-down');
+ _upIsDown = settings.get('up-is-down') ?? false;
_causalAsyncStacks = settings.get('causal-async-stacks') ?? true;
_awaiterStacks = settings.get('awaiter-stacks') ?? true;
}
@@ -1518,11 +1523,11 @@
if ((breakOnException != isolate.exceptionsPauseInfo) &&
(isolate.exceptionsPauseInfo != null)) {
- breakOnException = isolate.exceptionsPauseInfo;
+ breakOnException = isolate.exceptionsPauseInfo!;
}
isolate.reload().then((serviceObject) {
- S.Isolate response = serviceObject;
+ S.Isolate response = serviceObject as S.Isolate;
if (response.isSentinel) {
// The isolate has gone away. The IsolateExit event will
// clear the isolate for the debugger page.
@@ -1573,7 +1578,7 @@
});
}
- Future<S.ServiceMap> _refreshStack(M.DebugEvent pauseEvent) {
+ Future<S.ServiceMap?> _refreshStack(M.DebugEvent? pauseEvent) {
return isolate.getStack().then((result) {
if (result.isSentinel) {
// The isolate has gone away. The IsolateExit event will
@@ -1581,8 +1586,8 @@
return;
}
stack = result;
- stackElement.updateStack(stack, pauseEvent);
- if (stack['frames'].length > 0) {
+ stackElement.updateStack(stack!, pauseEvent);
+ if (stack!['frames'].length > 0) {
currentFrame = 0;
} else {
currentFrame = null;
@@ -1600,18 +1605,18 @@
} else if (isolate.running) {
console.print("Isolate is running (type 'pause' to interrupt)");
} else if (isolate.pauseEvent != null) {
- _reportPause(isolate.pauseEvent);
+ _reportPause(isolate.pauseEvent!);
} else {
console.print('Isolate is in unknown state');
}
warnOutOfDate();
}
- void _reportIsolateError(S.Isolate isolate, M.DebugEvent event) {
+ void _reportIsolateError(S.Isolate? isolate, M.DebugEvent event) {
if (isolate == null) {
return;
}
- S.DartError error = isolate.error;
+ S.DartError? error = isolate.error;
if (error == null) {
return;
}
@@ -1621,11 +1626,11 @@
} else {
console.printBold('Isolate has exited due to an unhandled exception:');
}
- console.print(error.message);
+ console.print(error.message!);
console.newline();
if (event is M.PauseExceptionEvent &&
- (error.exception.isStackOverflowError ||
- error.exception.isOutOfMemoryError)) {
+ (error.exception!.isStackOverflowError ||
+ error.exception!.isOutOfMemoryError)) {
console.printBold(
'When an unhandled stack overflow or OOM exception occurs, the VM '
'has run out of memory and cannot keep the stack alive while '
@@ -1652,14 +1657,14 @@
console.print("Paused at an unhandled exception "
"(type 'continue' or [F7] to exit the isolate')");
_reportIsolateError(isolate, event);
- } else if (stack['frames'].length > 0) {
- S.Frame frame = stack['frames'][0];
- var script = frame.location.script;
+ } else if (stack!['frames'].length > 0) {
+ S.Frame frame = stack!['frames'][0];
+ var script = frame.location!.script;
script.load().then((_) {
- var line = script.tokenToLine(frame.location.tokenPos);
- var col = script.tokenToCol(frame.location.tokenPos);
+ var line = script.tokenToLine(frame.location!.tokenPos);
+ var col = script.tokenToCol(frame.location!.tokenPos);
if ((event is M.PauseBreakpointEvent) && (event.breakpoint != null)) {
- var bpId = event.breakpoint.number;
+ var bpId = event.breakpoint!.number;
console.print('Paused at breakpoint ${bpId} at '
'${script.name}:${line}:${col}');
} else if ((event is M.PauseExceptionEvent) &&
@@ -1669,7 +1674,7 @@
// This seems to be missing if we are paused-at-exception after
// paused-at-isolate-exit. Maybe we shutdown part of the debugger too
// soon?
- console.printRef(isolate, event.exception, objects);
+ console.printRef(isolate, event.exception as S.Instance, objects!);
} else {
console.print('Paused at ${script.name}:${line}:${col}');
}
@@ -1696,12 +1701,12 @@
default:
break;
}
- var script = bpt.location.script;
+ var script = bpt!.location!.script;
await script.load();
var bpId = bpt.number;
- var locString = await bpt.location.toUserString();
- if (bpt.resolved) {
+ var locString = await bpt.location!.toUserString();
+ if (bpt.resolved!) {
console.print('Breakpoint ${bpId} ${verb} at ${locString}');
} else {
console.print('Future breakpoint ${bpId} ${verb} at ${locString}');
@@ -1711,20 +1716,20 @@
void onEvent(S.ServiceEvent event) {
switch (event.kind) {
case S.ServiceEvent.kVMUpdate:
- S.VM vm = event.owner;
+ S.VM vm = event.owner as S.VM;
console.print("VM ${vm.displayName} renamed to '${vm.name}'");
break;
case S.ServiceEvent.kIsolateStart:
{
- S.Isolate iso = event.owner;
+ S.Isolate iso = event.owner as S.Isolate;
console.print("Isolate ${iso.number} '${iso.name}' has been created");
}
break;
case S.ServiceEvent.kIsolateExit:
{
- S.Isolate iso = event.owner;
+ S.Isolate iso = event.owner as S.Isolate;
if (iso == isolate) {
console.print("The current isolate ${iso.number} '${iso.name}' "
"has exited");
@@ -1743,13 +1748,13 @@
case S.ServiceEvent.kDebuggerSettingsUpdate:
if (breakOnException != event.exceptions) {
- breakOnException = event.exceptions;
+ breakOnException = event.exceptions!;
console.print("Now pausing for exceptions: $breakOnException");
}
break;
case S.ServiceEvent.kIsolateUpdate:
- S.Isolate iso = event.owner;
+ S.Isolate iso = event.owner as S.Isolate;
console.print("Isolate ${iso.number} renamed to '${iso.name}'");
break;
@@ -1768,7 +1773,7 @@
case S.ServiceEvent.kPauseInterrupted:
case S.ServiceEvent.kPauseException:
if (event.owner == isolate) {
- var e = createEventFromServiceEvent(event);
+ var e = createEventFromServiceEvent(event) as M.DebugEvent;
_refreshStack(e).then((_) async {
flushStdio();
if (isolate != null) {
@@ -1802,7 +1807,7 @@
break;
case S.ServiceEvent.kLogging:
- _consolePrinter.onEvent(event.logRecord['level'].name, event);
+ _consolePrinter.onEvent(event.logRecord!['level'].name, event);
break;
default:
@@ -1811,7 +1816,7 @@
}
}
- _ConsoleStreamPrinter _consolePrinter;
+ late _ConsoleStreamPrinter _consolePrinter;
void flushStdio() {
_consolePrinter.flush();
@@ -1865,11 +1870,11 @@
}
// TODO(turnidge): Implement real command line history.
- String lastCommand;
+ String? lastCommand;
Future run(String command) {
if (command == '' && lastCommand != null) {
- command = lastCommand;
+ command = lastCommand!;
}
console.printBold('\$ $command');
return cmd.runCommand(command).then((_) {
@@ -1921,7 +1926,7 @@
var script = loc.script;
var line = loc.line;
if (script != null && line != null) {
- var bpts = script.getLine(line).breakpoints;
+ var bpts = script.getLine(line)!.breakpoints;
if (bpts == null || bpts.isEmpty) {
// Set a new breakpoint.
// TODO(turnidge): Set this breakpoint at current column.
@@ -1940,7 +1945,8 @@
Future smartNext() async {
if (isolatePaused()) {
- M.AsyncSuspensionEvent event = isolate.pauseEvent;
+ M.AsyncSuspensionEvent event =
+ isolate.pauseEvent as M.AsyncSuspensionEvent;
if (event.atAsyncSuspension) {
return asyncNext();
} else {
@@ -1953,7 +1959,8 @@
Future asyncNext() async {
if (isolatePaused()) {
- M.AsyncSuspensionEvent event = isolate.pauseEvent;
+ M.AsyncSuspensionEvent event =
+ isolate.pauseEvent as M.AsyncSuspensionEvent;
if (!event.atAsyncSuspension) {
console.print("No async continuation at this location");
} else {
@@ -2013,11 +2020,11 @@
}
class DebuggerPageElement extends CustomElement implements Renderable {
- S.Isolate _isolate;
- ObservatoryDebugger _debugger;
- M.ObjectRepository _objects;
- M.ScriptRepository _scripts;
- M.EventRepository _events;
+ late S.Isolate _isolate;
+ late ObservatoryDebugger _debugger;
+ late M.ObjectRepository _objects;
+ late M.ScriptRepository _scripts;
+ late M.EventRepository _events;
factory DebuggerPageElement(S.Isolate isolate, M.ObjectRepository objects,
M.ScriptRepository scripts, M.EventRepository events) {
@@ -2039,16 +2046,16 @@
DebuggerPageElement.created() : super.created('debugger-page');
- Future<StreamSubscription> _vmSubscriptionFuture;
- Future<StreamSubscription> _isolateSubscriptionFuture;
- Future<StreamSubscription> _debugSubscriptionFuture;
- Future<StreamSubscription> _stdoutSubscriptionFuture;
- Future<StreamSubscription> _stderrSubscriptionFuture;
- Future<StreamSubscription> _logSubscriptionFuture;
+ Future<StreamSubscription>? _vmSubscriptionFuture;
+ Future<StreamSubscription>? _isolateSubscriptionFuture;
+ Future<StreamSubscription>? _debugSubscriptionFuture;
+ Future<StreamSubscription>? _stdoutSubscriptionFuture;
+ Future<StreamSubscription>? _stderrSubscriptionFuture;
+ Future<StreamSubscription>? _logSubscriptionFuture;
ObservatoryApplication get app => ObservatoryApplication.app;
- Timer _timer;
+ Timer? _timer;
static final consoleElement = new DebuggerConsoleElement();
@@ -2111,7 +2118,7 @@
app.vm.listenEventStream(S.VM.kStdoutStream, _debugger.onStdout);
if (_stdoutSubscriptionFuture != null) {
// TODO(turnidge): How do we want to handle this in general?
- _stdoutSubscriptionFuture.catchError((e, st) {
+ _stdoutSubscriptionFuture!.catchError((e, st) {
Logger.root.info('Failed to subscribe to stdout: $e\n$st\n');
_stdoutSubscriptionFuture = null;
});
@@ -2120,7 +2127,7 @@
app.vm.listenEventStream(S.VM.kStderrStream, _debugger.onStderr);
if (_stderrSubscriptionFuture != null) {
// TODO(turnidge): How do we want to handle this in general?
- _stderrSubscriptionFuture.catchError((e, st) {
+ _stderrSubscriptionFuture!.catchError((e, st) {
Logger.root.info('Failed to subscribe to stderr: $e\n$st\n');
_stderrSubscriptionFuture = null;
});
@@ -2150,31 +2157,31 @@
@override
void detached() {
- _timer.cancel();
+ _timer!.cancel();
children = const [];
- S.cancelFutureSubscription(_vmSubscriptionFuture);
+ S.cancelFutureSubscription(_vmSubscriptionFuture!);
_vmSubscriptionFuture = null;
- S.cancelFutureSubscription(_isolateSubscriptionFuture);
+ S.cancelFutureSubscription(_isolateSubscriptionFuture!);
_isolateSubscriptionFuture = null;
- S.cancelFutureSubscription(_debugSubscriptionFuture);
+ S.cancelFutureSubscription(_debugSubscriptionFuture!);
_debugSubscriptionFuture = null;
- S.cancelFutureSubscription(_stdoutSubscriptionFuture);
+ S.cancelFutureSubscription(_stdoutSubscriptionFuture!);
_stdoutSubscriptionFuture = null;
- S.cancelFutureSubscription(_stderrSubscriptionFuture);
+ S.cancelFutureSubscription(_stderrSubscriptionFuture!);
_stderrSubscriptionFuture = null;
- S.cancelFutureSubscription(_logSubscriptionFuture);
+ S.cancelFutureSubscription(_logSubscriptionFuture!);
_logSubscriptionFuture = null;
super.detached();
}
}
class DebuggerStackElement extends CustomElement implements Renderable {
- S.Isolate _isolate;
- M.ObjectRepository _objects;
- M.ScriptRepository _scripts;
- M.EventRepository _events;
- Element _scroller;
- DivElement _isSampled;
+ late S.Isolate _isolate;
+ late M.ObjectRepository _objects;
+ late M.ScriptRepository _scripts;
+ late M.EventRepository _events;
+ late Element _scroller;
+ late DivElement _isSampled;
bool get isSampled => !_isSampled.classes.contains('hidden');
set isSampled(bool value) {
if (value != isSampled) {
@@ -2182,7 +2189,7 @@
}
}
- DivElement _hasStack;
+ late DivElement _hasStack;
bool get hasStack => _hasStack.classes.contains('hidden');
set hasStack(bool value) {
if (value != hasStack) {
@@ -2190,7 +2197,7 @@
}
}
- DivElement _hasMessages;
+ late DivElement _hasMessages;
bool get hasMessages => _hasMessages.classes.contains('hidden');
set hasMessages(bool value) {
if (value != hasMessages) {
@@ -2198,10 +2205,10 @@
}
}
- UListElement _frameList;
- UListElement _messageList;
- int currentFrame;
- ObservatoryDebugger _debugger;
+ UListElement? _frameList;
+ UListElement? _messageList;
+ int? currentFrame;
+ late ObservatoryDebugger _debugger;
factory DebuggerStackElement(
S.Isolate isolate,
@@ -2309,7 +2316,7 @@
ObservatoryApplication get app => ObservatoryApplication.app;
void updateStackFrames(S.ServiceMap newStack) {
- List frameElements = _frameList.children;
+ List frameElements = _frameList!.children;
List newFrames;
if (_debugger.awaiterStacks &&
(newStack[ObservatoryDebugger.kAwaiterStackFrames] != null)) {
@@ -2327,7 +2334,8 @@
int newPos = newFrames.length - 1;
while (oldPos >= 0 && newPos >= 0) {
DebuggerFrameElement dbgFrameElement =
- CustomElement.reverse(frameElements[oldPos].children[0]);
+ CustomElement.reverse(frameElements[oldPos].children[0])
+ as DebuggerFrameElement;
if (!dbgFrameElement.matchFrame(newFrames[newPos])) {
// The rest of the frame elements no longer match. Remove them.
for (int i = 0; i <= oldPos; i++) {
@@ -2363,7 +2371,8 @@
if (frameElements.isNotEmpty) {
for (int i = newCount; i < frameElements.length; i++) {
DebuggerFrameElement dbgFrameElement =
- CustomElement.reverse(frameElements[i].children[0]);
+ CustomElement.reverse(frameElements[i].children[0])
+ as DebuggerFrameElement;
dbgFrameElement.updateFrame(newFrames[i]);
}
}
@@ -2372,7 +2381,7 @@
}
void updateStackMessages(S.ServiceMap newStack) {
- List messageElements = _messageList.children;
+ List messageElements = _messageList!.children;
List newMessages = newStack['messages'];
// Remove any extra message elements.
@@ -2397,7 +2406,8 @@
// Update old messages.
for (int i = 0; i < newStartingIndex; i++) {
DebuggerMessageElement e =
- CustomElement.reverse(messageElements[i].children[0]);
+ CustomElement.reverse(messageElements[i].children[0])
+ as DebuggerMessageElement;
e.updateMessage(newMessages[i]);
}
}
@@ -2405,18 +2415,19 @@
hasMessages = messageElements.isNotEmpty;
}
- void updateStack(S.ServiceMap newStack, M.DebugEvent pauseEvent) {
+ void updateStack(S.ServiceMap newStack, M.DebugEvent? pauseEvent) {
updateStackFrames(newStack);
updateStackMessages(newStack);
isSampled = pauseEvent == null;
}
- void setCurrentFrame(int value) {
+ void setCurrentFrame(int? value) {
currentFrame = value;
- List frameElements = _frameList.children;
+ List frameElements = _frameList!.children;
for (var frameElement in frameElements) {
DebuggerFrameElement dbgFrameElement =
- CustomElement.reverse(frameElement.children[0]);
+ CustomElement.reverse(frameElement.children[0])
+ as DebuggerFrameElement;
if (dbgFrameElement.frame.index == currentFrame) {
dbgFrameElement.setCurrent(true);
} else {
@@ -2429,18 +2440,18 @@
}
class DebuggerFrameElement extends CustomElement implements Renderable {
- RenderingScheduler<DebuggerFrameElement> _r;
+ late RenderingScheduler<DebuggerFrameElement> _r;
Stream<RenderedEvent<DebuggerFrameElement>> get onRendered => _r.onRendered;
- Element _scroller;
- DivElement _varsDiv;
- M.Isolate _isolate;
- S.Frame _frame;
+ late Element _scroller;
+ late DivElement _varsDiv;
+ late M.Isolate _isolate;
+ late S.Frame _frame;
S.Frame get frame => _frame;
- M.ObjectRepository _objects;
- M.ScriptRepository _scripts;
- M.EventRepository _events;
+ late M.ObjectRepository _objects;
+ late M.ScriptRepository _scripts;
+ late M.EventRepository _events;
// Is this the current frame?
bool _current = false;
@@ -2452,7 +2463,7 @@
void setCurrent(bool value) {
Future load = (_frame.function != null)
- ? _frame.function.load()
+ ? _frame.function!.load()
: new Future.value(null);
load.then((func) {
_current = value;
@@ -2476,7 +2487,7 @@
M.ObjectRepository objects,
M.ScriptRepository scripts,
M.EventRepository events,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(frame != null);
assert(scroller != null);
@@ -2513,12 +2524,12 @@
}
if (_frame.kind == M.FrameKind.asyncSuspensionMarker) {
final content = <Element>[
- new SpanElement()..children = _createMarkerHeader(_frame.marker)
+ new SpanElement()..children = _createMarkerHeader(_frame.marker!)
];
children = content;
return;
}
- ButtonElement expandButton;
+ late ButtonElement expandButton;
final content = <Element>[
expandButton = new ButtonElement()
..children = _createHeader()
@@ -2532,14 +2543,14 @@
})
];
if (_expanded) {
- final homeMethod = _frame.function.homeMethod;
- String homeMethodName;
- if ((homeMethod.dartOwner is S.Class) && homeMethod.isStatic) {
+ final homeMethod = _frame.function!.homeMethod;
+ String? homeMethodName;
+ if ((homeMethod.dartOwner is S.Class) && homeMethod.isStatic!) {
homeMethodName = '<class>';
} else if (homeMethod.dartOwner is S.Library) {
homeMethodName = '<library>';
}
- ButtonElement collapseButton;
+ late ButtonElement collapseButton;
content.addAll([
new DivElement()
..classes = ['frameDetails']
@@ -2554,11 +2565,11 @@
: [
(new SourceInsetElement(
_isolate,
- _frame.function.location,
+ _frame.function!.location!,
_scripts,
_objects,
_events,
- currentPos: _frame.location.tokenPos,
+ currentPos: _frame.location!.tokenPos,
variables: _frame.variables,
inDebuggerContext: true,
queue: _r.queue))
@@ -2612,7 +2623,7 @@
await _toggleExpand();
collapseButton.disabled = false;
})
- ..children = <Element>[iconExpandLess.clone(true)]
+ ..children = <Element>[iconExpandLess.clone(true) as Element]
]
]
]);
@@ -2650,7 +2661,7 @@
..children = _frame.function == null
? const []
: [
- new FunctionRefElement(_isolate, _frame.function,
+ new FunctionRefElement(_isolate, _frame.function!,
queue: _r.queue)
.element
],
@@ -2660,7 +2671,7 @@
? const []
: [
new SourceLinkElement(
- _isolate, _frame.function.location, _scripts,
+ _isolate, _frame.function!.location!, _scripts,
queue: _r.queue)
.element
],
@@ -2670,7 +2681,7 @@
if (!_expanded) {
content.add(new DivElement()
..classes = ['frameExpander']
- ..children = <Element>[iconExpandMore.clone(true)]);
+ ..children = <Element>[iconExpandMore.clone(true) as Element]);
}
return [
new DivElement()
@@ -2680,7 +2691,7 @@
}
String makeExpandKey(String key) {
- return '${_frame.function.qualifiedName}/${key}';
+ return '${_frame.function!.qualifiedName}/${key}';
}
bool matchFrame(S.Frame newFrame) {
@@ -2690,8 +2701,8 @@
if (newFrame.function == null) {
return frame.function == null;
}
- return (newFrame.function.id == _frame.function.id &&
- newFrame.location.script.id == frame.location.script.id);
+ return (newFrame.function!.id == _frame.function!.id &&
+ newFrame.location!.script.id == frame.location!.script.id);
}
void updateFrame(S.Frame newFrame) {
@@ -2699,15 +2710,15 @@
_frame = newFrame;
}
- S.Script get script => _frame.location.script;
+ S.Script get script => _frame.location!.script;
int _varsTop(DivElement varsDiv) {
const minTop = 0;
if (varsDiv == null) {
return minTop;
}
- final num paddingTop = document.body.contentEdge.top;
- final Rectangle parent = varsDiv.parent.getBoundingClientRect();
+ final num paddingTop = document.body!.contentEdge.top;
+ final Rectangle parent = varsDiv.parent!.getBoundingClientRect();
final int varsHeight = varsDiv.clientHeight;
final int maxTop = (parent.height - varsHeight).toInt();
final int adjustedTop = (paddingTop - parent.top).toInt();
@@ -2737,8 +2748,8 @@
_r.dirty();
}
- StreamSubscription _scrollSubscription;
- StreamSubscription _resizeSubscription;
+ StreamSubscription? _scrollSubscription;
+ StreamSubscription? _resizeSubscription;
void _subscribeToScroll() {
if (_scroller != null) {
@@ -2753,11 +2764,11 @@
void _unsubscribeToScroll() {
if (_scrollSubscription != null) {
- _scrollSubscription.cancel();
+ _scrollSubscription!.cancel();
_scrollSubscription = null;
}
if (_resizeSubscription != null) {
- _resizeSubscription.cancel();
+ _resizeSubscription!.cancel();
_resizeSubscription = null;
}
}
@@ -2778,7 +2789,7 @@
}
Future _toggleExpand() async {
- await _frame.function.load();
+ await _frame.function!.load();
_pinned = !_pinned;
if (_pinned) {
_expand();
@@ -2789,16 +2800,16 @@
}
class DebuggerMessageElement extends CustomElement implements Renderable {
- RenderingScheduler<DebuggerMessageElement> _r;
+ late RenderingScheduler<DebuggerMessageElement> _r;
Stream<RenderedEvent<DebuggerMessageElement>> get onRendered => _r.onRendered;
- S.Isolate _isolate;
- S.ServiceMessage _message;
- S.ServiceObject _preview;
- M.ObjectRepository _objects;
- M.ScriptRepository _scripts;
- M.EventRepository _events;
+ late S.Isolate _isolate;
+ late S.ServiceMessage _message;
+ late S.ServiceObject _preview;
+ late M.ObjectRepository _objects;
+ late M.ScriptRepository _scripts;
+ late M.EventRepository _events;
// Is this the current message?
bool _current = false;
@@ -2814,7 +2825,7 @@
M.ObjectRepository objects,
M.ScriptRepository scripts,
M.EventRepository events,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(message != null);
assert(objects != null);
@@ -2842,7 +2853,7 @@
} else {
classes.remove('current');
}
- ButtonElement expandButton;
+ late ButtonElement expandButton;
final content = <Element>[
expandButton = new ButtonElement()
..children = _createHeader()
@@ -2856,8 +2867,8 @@
})
];
if (_expanded) {
- ButtonElement collapseButton;
- ButtonElement previewButton;
+ late ButtonElement collapseButton;
+ late ButtonElement previewButton;
content.addAll([
new DivElement()
..classes = ['messageDetails']
@@ -2872,7 +2883,7 @@
: [
new SourceInsetElement(
_isolate,
- _message.handler.location,
+ _message.handler!.location!,
_scripts,
_objects,
_events,
@@ -2913,7 +2924,7 @@
await _toggleExpand();
collapseButton.disabled = false;
})
- ..children = <Element>[iconExpandLess.clone(true)]
+ ..children = <Element>[iconExpandLess.clone(true) as Element]
]
]
]);
@@ -2939,7 +2950,7 @@
..children = _message.handler == null
? const []
: [
- new FunctionRefElement(_isolate, _message.handler,
+ new FunctionRefElement(_isolate, _message.handler!,
queue: _r.queue)
.element
],
@@ -2948,7 +2959,8 @@
..children = _message.location == null
? const []
: [
- new SourceLinkElement(_isolate, _message.location, _scripts,
+ new SourceLinkElement(
+ _isolate, _message.location!, _scripts,
queue: _r.queue)
.element
],
@@ -2958,7 +2970,7 @@
if (!_expanded) {
content.add(new DivElement()
..classes = ['messageExpander']
- ..children = <Element>[iconExpandMore.clone(true)]);
+ ..children = <Element>[iconExpandMore.clone(true) as Element]);
}
return [
new DivElement()
@@ -3002,7 +3014,9 @@
}
Future<S.ServiceObject> previewMessage(_) {
- return _message.isolate.getObject(_message.messageObjectId).then((result) {
+ return _message.isolate!
+ .getObject(_message.messageObjectId!)
+ .then((result) {
_preview = result;
return result;
});
@@ -3019,7 +3033,7 @@
DebuggerConsoleElement.created() : super.created('debugger-console');
/// Is [container] scrolled to the within [threshold] pixels of the bottom?
- static bool _isScrolledToBottom(DivElement container, [int threshold = 2]) {
+ static bool _isScrolledToBottom(DivElement? container, [int threshold = 2]) {
if (container == null) {
return false;
}
@@ -3033,7 +3047,7 @@
}
/// Scroll [container] so the bottom content is visible.
- static _scrollToBottom(DivElement container) {
+ static _scrollToBottom(DivElement? container) {
if (container == null) {
return;
}
@@ -3042,10 +3056,10 @@
}
void _append(HtmlElement span) {
- bool autoScroll = _isScrolledToBottom(parent);
+ bool autoScroll = _isScrolledToBottom(parent as DivElement?);
children.add(span);
if (autoScroll) {
- _scrollToBottom(parent);
+ _scrollToBottom(parent as DivElement?);
}
}
@@ -3080,7 +3094,7 @@
}
void printStdio(List<String> lines) {
- bool autoScroll = _isScrolledToBottom(parent);
+ bool autoScroll = _isScrolledToBottom(parent as DivElement?);
for (var line in lines) {
var span = new SpanElement();
span.classes.add('green');
@@ -3089,7 +3103,7 @@
children.add(span);
}
if (autoScroll) {
- _scrollToBottom(parent);
+ _scrollToBottom(parent as DivElement?);
}
}
@@ -3118,15 +3132,15 @@
}
class DebuggerInputElement extends CustomElement implements Renderable {
- S.Isolate _isolate;
- ObservatoryDebugger _debugger;
+ late S.Isolate _isolate;
+ late ObservatoryDebugger _debugger;
bool _busy = false;
final _modalPromptDiv = new DivElement()..classes = ['modalPrompt', 'hidden'];
final _textBox = new TextInputElement()
..classes = ['textBox']
..autofocus = true;
- String get modalPrompt => _modalPromptDiv.text;
- set modalPrompt(String value) {
+ String? get modalPrompt => _modalPromptDiv.text;
+ set modalPrompt(String? value) {
if (_modalPromptDiv.text == '') {
_modalPromptDiv.classes.remove('hidden');
}
@@ -3136,8 +3150,8 @@
}
}
- String get text => _textBox.value;
- set text(String value) => _textBox.value = value;
+ String? get text => _textBox.value;
+ set text(String? value) => _textBox.value = value;
var modalCallback = null;
factory DebuggerInputElement(
@@ -3172,9 +3186,9 @@
switch (e.keyCode) {
case KeyCode.TAB:
e.preventDefault();
- int cursorPos = _textBox.selectionStart;
- _debugger.complete(text.substring(0, cursorPos)).then((completion) {
- text = completion + text.substring(cursorPos);
+ int cursorPos = _textBox.selectionStart!;
+ _debugger.complete(text!.substring(0, cursorPos)).then((completion) {
+ text = completion + text!.substring(cursorPos);
// TODO(turnidge): Move the cursor to the end of the
// completion, rather than the end of the string.
}).whenComplete(() {
@@ -3184,7 +3198,7 @@
case KeyCode.ENTER:
var command = text;
- _debugger.run(command).whenComplete(() {
+ _debugger.run(command!).whenComplete(() {
text = '';
_busy = false;
});
@@ -3192,13 +3206,13 @@
case KeyCode.UP:
e.preventDefault();
- text = _debugger.historyPrev(text);
+ text = _debugger.historyPrev(text!);
_busy = false;
break;
case KeyCode.DOWN:
e.preventDefault();
- text = _debugger.historyNext(text);
+ text = _debugger.historyNext(text!);
_busy = false;
break;
diff --git a/runtime/observatory/lib/src/elements/error_ref.dart b/runtime/observatory/lib/src/elements/error_ref.dart
index ffff85c..9d4c26a8 100644
--- a/runtime/observatory/lib/src/elements/error_ref.dart
+++ b/runtime/observatory/lib/src/elements/error_ref.dart
@@ -11,15 +11,15 @@
import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
class ErrorRefElement extends CustomElement implements Renderable {
- RenderingScheduler<ErrorRefElement> _r;
+ late RenderingScheduler<ErrorRefElement> _r;
Stream<RenderedEvent<ErrorRefElement>> get onRendered => _r.onRendered;
- ErrorRef _error;
+ late ErrorRef _error;
ErrorRef get error => _error;
- factory ErrorRefElement(ErrorRef error, {RenderingQueue queue}) {
+ factory ErrorRefElement(ErrorRef error, {RenderingQueue? queue}) {
assert(error != null);
ErrorRefElement e = new ErrorRefElement.created();
e._r = new RenderingScheduler<ErrorRefElement>(e, queue: queue);
diff --git a/runtime/observatory/lib/src/elements/error_view.dart b/runtime/observatory/lib/src/elements/error_view.dart
index c89eb5c..893e865 100644
--- a/runtime/observatory/lib/src/elements/error_view.dart
+++ b/runtime/observatory/lib/src/elements/error_view.dart
@@ -15,18 +15,18 @@
import 'package:observatory/src/elements/view_footer.dart';
class ErrorViewElement extends CustomElement implements Renderable {
- RenderingScheduler<ErrorViewElement> _r;
+ late RenderingScheduler<ErrorViewElement> _r;
Stream<RenderedEvent<ErrorViewElement>> get onRendered => _r.onRendered;
- M.Error _error;
- M.NotificationRepository _notifications;
+ late M.Error _error;
+ late M.NotificationRepository _notifications;
M.Error get error => _error;
factory ErrorViewElement(
M.NotificationRepository notifications, M.Error error,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(error != null);
assert(notifications != null);
ErrorViewElement e = new ErrorViewElement.created();
@@ -71,7 +71,7 @@
];
}
- static String _kindToString(M.ErrorKind kind) {
+ static String _kindToString(M.ErrorKind? kind) {
switch (kind) {
case M.ErrorKind.unhandledException:
return 'Unhandled Exception';
diff --git a/runtime/observatory/lib/src/elements/eval_box.dart b/runtime/observatory/lib/src/elements/eval_box.dart
index 7928031..1ad3a95 100644
--- a/runtime/observatory/lib/src/elements/eval_box.dart
+++ b/runtime/observatory/lib/src/elements/eval_box.dart
@@ -13,18 +13,18 @@
import 'package:observatory/src/elements/instance_ref.dart';
class EvalBoxElement extends CustomElement implements Renderable {
- RenderingScheduler<EvalBoxElement> _r;
+ late RenderingScheduler<EvalBoxElement> _r;
Stream<RenderedEvent<EvalBoxElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.ObjectRef _context;
- M.ObjectRepository _objects;
- M.EvalRepository _eval;
+ late M.IsolateRef _isolate;
+ late M.ObjectRef _context;
+ late M.ObjectRepository _objects;
+ late M.EvalRepository _eval;
final _results = <_ExpressionDescription>[];
- String _expression = '';
- bool _multiline;
- Iterable<String> _quickExpressions;
+ String? _expression = '';
+ late bool _multiline;
+ late Iterable<String> _quickExpressions;
M.IsolateRef get isolate => _isolate;
M.ObjectRef get context => _context;
@@ -33,7 +33,7 @@
M.ObjectRepository objects, M.EvalRepository eval,
{bool multiline: false,
Iterable<String> quickExpressions: const [],
- RenderingQueue queue}) {
+ RenderingQueue? queue}) {
assert(isolate != null);
assert(context != null);
assert(objects != null);
@@ -136,7 +136,7 @@
var area = new TextAreaElement()
..classes = ['textbox']
..placeholder = 'evaluate an expression'
- ..value = _expression
+ ..value = _expression!
..onKeyUp.where((e) => e.key == '\n').listen((e) {
e.preventDefault();
_run();
@@ -152,7 +152,7 @@
var textbox = new TextInputElement()
..classes = ['textbox']
..placeholder = 'evaluate an expression'
- ..value = _expression
+ ..value = _expression!
..onKeyUp.where((e) => e.key == '\n').listen((e) {
e.preventDefault();
_run();
@@ -177,15 +177,15 @@
final checkbox = new CheckboxInputElement()..checked = _multiline;
checkbox.onClick.listen((e) {
e.preventDefault();
- _multiline = checkbox.checked;
+ _multiline = checkbox.checked!;
_r.dirty();
});
return checkbox;
}
Future _run() async {
- if (_expression == null || _expression.isEmpty) return;
final expression = _expression;
+ if (expression == null || expression.isEmpty) return;
_expression = null;
final result = new _ExpressionDescription.pending(expression);
_results.add(result);
@@ -199,7 +199,7 @@
class _ExpressionDescription {
final String expression;
- final M.ObjectRef value;
+ final M.ObjectRef? value;
bool get isPending => value == null;
_ExpressionDescription(this.expression, this.value);
diff --git a/runtime/observatory/lib/src/elements/field_ref.dart b/runtime/observatory/lib/src/elements/field_ref.dart
index eeb8bb9..69975e2 100644
--- a/runtime/observatory/lib/src/elements/field_ref.dart
+++ b/runtime/observatory/lib/src/elements/field_ref.dart
@@ -11,21 +11,21 @@
import 'package:observatory/src/elements/instance_ref.dart';
class FieldRefElement extends CustomElement implements Renderable {
- RenderingScheduler<FieldRefElement> _r;
+ late RenderingScheduler<FieldRefElement> _r;
Stream<RenderedEvent<FieldRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.FieldRef _field;
- M.ObjectRepository _objects;
- bool _expandable;
+ late M.IsolateRef _isolate;
+ late M.FieldRef _field;
+ late M.ObjectRepository _objects;
+ late bool _expandable;
M.IsolateRef get isolate => _isolate;
M.FieldRef get field => _field;
factory FieldRefElement(
M.IsolateRef isolate, M.FieldRef field, M.ObjectRepository objects,
- {RenderingQueue queue, bool expandable: true}) {
+ {RenderingQueue? queue, bool expandable: true}) {
assert(isolate != null);
assert(field != null);
assert(objects != null);
@@ -55,21 +55,21 @@
void render() {
var header = '';
- if (_field.isStatic) {
+ if (_field.isStatic!) {
if (_field.dartOwner is M.ClassRef) {
header += 'static ';
} else {
header += 'top-level ';
}
}
- if (_field.isFinal) {
+ if (_field.isFinal!) {
header += 'final ';
- } else if (_field.isConst) {
+ } else if (_field.isConst!) {
header += 'const ';
- } else if (_field.declaredType.name == 'dynamic') {
+ } else if (_field.declaredType!.name == 'dynamic') {
header += 'var ';
}
- if (_field.declaredType.name == 'dynamic') {
+ if (_field.declaredType!.name == 'dynamic') {
children = <Element>[
new SpanElement()..text = header,
new AnchorElement(href: Uris.inspect(_isolate, object: _field))
@@ -78,7 +78,7 @@
} else {
children = <Element>[
new SpanElement()..text = header,
- new InstanceRefElement(_isolate, _field.declaredType, _objects,
+ new InstanceRefElement(_isolate, _field.declaredType!, _objects,
queue: _r.queue, expandable: _expandable)
.element,
new SpanElement()..text = ' ',
diff --git a/runtime/observatory/lib/src/elements/field_view.dart b/runtime/observatory/lib/src/elements/field_view.dart
index 81231e3..2844b8f 100644
--- a/runtime/observatory/lib/src/elements/field_view.dart
+++ b/runtime/observatory/lib/src/elements/field_view.dart
@@ -27,24 +27,24 @@
import 'package:observatory/src/elements/view_footer.dart';
class FieldViewElement extends CustomElement implements Renderable {
- RenderingScheduler<FieldViewElement> _r;
+ late RenderingScheduler<FieldViewElement> _r;
Stream<RenderedEvent<FieldViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.Field _field;
- M.LibraryRef _library;
- M.FieldRepository _fields;
- M.ClassRepository _classes;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ScriptRepository _scripts;
- M.ObjectRepository _objects;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.Field _field;
+ M.LibraryRef? _library;
+ late M.FieldRepository _fields;
+ late M.ClassRepository _classes;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ScriptRepository _scripts;
+ late M.ObjectRepository _objects;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -65,7 +65,7 @@
M.RetainingPathRepository retainingPaths,
M.ScriptRepository scripts,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -95,7 +95,7 @@
e._scripts = scripts;
e._objects = objects;
if (field.dartOwner is M.LibraryRef) {
- e._library = field.dartOwner;
+ e._library = field.dartOwner as M.LibraryRef;
}
return e;
}
@@ -118,22 +118,22 @@
void render() {
var header = '';
- if (_field.isStatic) {
+ if (_field.isStatic!) {
if (_field.dartOwner is M.ClassRef) {
header += 'static ';
} else {
header += 'top-level ';
}
}
- if (_field.isFinal) {
+ if (_field.isFinal!) {
header += 'final ';
- } else if (_field.isConst) {
+ } else if (_field.isConst!) {
header += 'const ';
}
- if (_field.declaredType.name == 'dynamic') {
+ if (_field.declaredType!.name == 'dynamic') {
header += 'var';
} else {
- header += _field.declaredType.name;
+ header += _field.declaredType!.name!;
}
children = <Element>[
navBar(_createMenu()),
@@ -155,10 +155,10 @@
..children = _field.location == null
? const []
: [
- new ScriptInsetElement(_isolate, _field.location.script,
+ new ScriptInsetElement(_isolate, _field.location!.script,
_scripts, _objects, _events,
- startPos: field.location.tokenPos,
- endPos: field.location.tokenPos,
+ startPos: field.location!.tokenPos,
+ endPos: field.location!.tokenPos,
queue: _r.queue)
.element
],
@@ -174,15 +174,15 @@
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element
];
if (_library != null) {
- menu.add(new NavLibraryMenuElement(_isolate, _library, queue: _r.queue)
+ menu.add(new NavLibraryMenuElement(_isolate, _library!, queue: _r.queue)
.element);
} else if (_field.dartOwner is M.ClassRef) {
- menu.add(
- new NavClassMenuElement(_isolate, _field.dartOwner, queue: _r.queue)
- .element);
+ menu.add(new NavClassMenuElement(_isolate, _field.dartOwner as M.ClassRef,
+ queue: _r.queue)
+ .element);
}
menu.addAll(<Element>[
- navMenu(_field.name),
+ navMenu(_field.name!),
(new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) {
e.element.disabled = true;
@@ -220,13 +220,13 @@
new DivElement()
..classes = ['memberName']
..children = <Element>[
- new SourceLinkElement(_isolate, field.location, _scripts,
+ new SourceLinkElement(_isolate, field.location!, _scripts,
queue: _r.queue)
.element
]
]
];
- if (!_field.isStatic) {
+ if (!_field.isStatic!) {
members.add(new DivElement()
..classes = ['memberItem']
..title = 'The types observed for this field at runtime. '
@@ -269,22 +269,23 @@
break;
case M.GuardClassKind.single:
guard.add(
- new ClassRefElement(_isolate, _field.guardClass, queue: _r.queue)
+ new ClassRefElement(_isolate, _field.guardClass!, queue: _r.queue)
.element);
break;
}
guard.add(new SpanElement()
..text =
- _field.guardNullable ? '— null observed' : '— null not observed');
+ _field.guardNullable! ? '— null observed' : '— null not observed');
return guard;
}
Future _refresh() async {
- _field = await _fields.get(_isolate, _field.id);
+ _field = await _fields.get(_isolate, _field.id!);
if (_field.dartOwner is M.LibraryRef) {
- _library = _field.dartOwner;
+ _library = _field.dartOwner as M.LibraryRef;
} else if (_field.dartOwner is M.ClassRef) {
- _library = (await _classes.get(_isolate, _field.dartOwner.id)).library;
+ var cls = _field.dartOwner as M.ClassRef;
+ _library = (await _classes.get(_isolate, cls.id!)).library!;
}
_r.dirty();
}
diff --git a/runtime/observatory/lib/src/elements/flag_list.dart b/runtime/observatory/lib/src/elements/flag_list.dart
index d9b847c..d01b782 100644
--- a/runtime/observatory/lib/src/elements/flag_list.dart
+++ b/runtime/observatory/lib/src/elements/flag_list.dart
@@ -19,21 +19,21 @@
import 'package:observatory/src/elements/view_footer.dart';
class FlagListElement extends CustomElement implements Renderable {
- RenderingScheduler<FlagListElement> _r;
+ late RenderingScheduler<FlagListElement> _r;
Stream<RenderedEvent<FlagListElement>> get onRendered => _r.onRendered;
- M.VMRef _vm;
- M.EventRepository _events;
- M.FlagsRepository _repository;
- M.NotificationRepository _notifications;
- Iterable<M.Flag> _flags;
+ late M.VMRef _vm;
+ late M.EventRepository _events;
+ late M.FlagsRepository _repository;
+ late M.NotificationRepository _notifications;
+ Iterable<M.Flag>? _flags;
M.VMRef get vm => _vm;
factory FlagListElement(M.VMRef vm, M.EventRepository events,
M.FlagsRepository repository, M.NotificationRepository notifications,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(events != null);
assert(repository != null);
@@ -68,8 +68,8 @@
if (_flags == null) {
content.add(new HeadingElement.h1()..text = 'Loading Flags...');
} else {
- final modified = _flags.where(_isModified);
- final unmodified = _flags.where(_isUnmodified);
+ final modified = _flags!.where(_isModified);
+ final unmodified = _flags!.where(_isUnmodified);
if (modified.isNotEmpty) {
content.add(new HeadingElement.h1()..text = 'Modified Flags');
@@ -91,7 +91,7 @@
children = <Element>[
navBar(<Element>[
new NavTopMenuElement(queue: _r.queue).element,
- new NavVMMenuElement(_vm, _events, queue: _r.queue).element,
+ new NavVMMenuElement(_vm as M.VM, _events, queue: _r.queue).element,
navMenu('flags', link: Uris.flags()),
(new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) async {
@@ -137,7 +137,7 @@
new SpanElement()..text = '=',
new SpanElement()
..classes = ['value']
- ..text = flag.valueAsString ?? 'NULL'
+ ..text = flag.valueAsString
],
new BRElement(),
];
diff --git a/runtime/observatory/lib/src/elements/function_ref.dart b/runtime/observatory/lib/src/elements/function_ref.dart
index b6ea92f..a53b6c4 100644
--- a/runtime/observatory/lib/src/elements/function_ref.dart
+++ b/runtime/observatory/lib/src/elements/function_ref.dart
@@ -20,20 +20,20 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class FunctionRefElement extends CustomElement implements Renderable {
- RenderingScheduler<FunctionRefElement> _r;
+ late RenderingScheduler<FunctionRefElement> _r;
Stream<RenderedEvent<FunctionRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.FunctionRef _function;
- bool _qualified;
+ M.IsolateRef? _isolate;
+ late M.FunctionRef _function;
+ late bool _qualified;
- M.IsolateRef get isolate => _isolate;
+ M.IsolateRef? get isolate => _isolate;
M.FunctionRef get function => _function;
bool get qualified => _qualified;
- factory FunctionRefElement(M.IsolateRef isolate, M.FunctionRef function,
- {bool qualified: true, RenderingQueue queue}) {
+ factory FunctionRefElement(M.IsolateRef? isolate, M.FunctionRef function,
+ {bool qualified: true, RenderingQueue? queue}) {
assert(function != null);
assert(qualified != null);
FunctionRefElement e = new FunctionRefElement.created();
@@ -65,11 +65,11 @@
new AnchorElement(
href: (M.isSyntheticFunction(_function.kind) || (_isolate == null))
? null
- : Uris.inspect(_isolate, object: _function))
+ : Uris.inspect(_isolate!, object: _function))
..text = _function.name
];
if (qualified) {
- M.ObjectRef owner = _function.dartOwner;
+ M.ObjectRef? owner = _function.dartOwner;
while (owner is M.FunctionRef) {
M.FunctionRef function = (owner as M.FunctionRef);
content.addAll([
@@ -77,7 +77,7 @@
new AnchorElement(
href: (M.isSyntheticFunction(function.kind) || (_isolate == null))
? null
- : Uris.inspect(_isolate, object: function))
+ : Uris.inspect(_isolate!, object: function))
..text = function.name
]);
owner = function.dartOwner;
@@ -85,7 +85,8 @@
if (owner is M.ClassRef) {
content.addAll([
new SpanElement()..text = '.',
- new ClassRefElement(_isolate, owner, queue: _r.queue).element
+ new ClassRefElement(_isolate!, owner as M.ClassRef, queue: _r.queue)
+ .element
]);
}
}
diff --git a/runtime/observatory/lib/src/elements/function_view.dart b/runtime/observatory/lib/src/elements/function_view.dart
index 8150d65..e5bcfd1 100644
--- a/runtime/observatory/lib/src/elements/function_view.dart
+++ b/runtime/observatory/lib/src/elements/function_view.dart
@@ -30,24 +30,24 @@
import 'package:observatory/src/elements/view_footer.dart';
class FunctionViewElement extends CustomElement implements Renderable {
- RenderingScheduler<FunctionViewElement> _r;
+ late RenderingScheduler<FunctionViewElement> _r;
Stream<RenderedEvent<FunctionViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.ServiceFunction _function;
- M.LibraryRef _library;
- M.FunctionRepository _functions;
- M.ClassRepository _classes;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ScriptRepository _scripts;
- M.ObjectRepository _objects;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.ServiceFunction _function;
+ M.LibraryRef? _library;
+ late M.FunctionRepository _functions;
+ late M.ClassRepository _classes;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ScriptRepository _scripts;
+ late M.ObjectRepository _objects;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -68,7 +68,7 @@
M.RetainingPathRepository retainingPaths,
M.ScriptRepository scripts,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -98,7 +98,7 @@
e._scripts = scripts;
e._objects = objects;
if (function.dartOwner is M.LibraryRef) {
- e._library = function.dartOwner;
+ e._library = function.dartOwner as M.LibraryRef;
}
return e;
}
@@ -140,7 +140,7 @@
..children = _function.location == null
? const []
: [
- new SourceInsetElement(_isolate, _function.location,
+ new SourceInsetElement(_isolate, _function.location!,
_scripts, _objects, _events,
queue: _r.queue)
.element
@@ -157,15 +157,16 @@
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element
];
if (_library != null) {
- menu.add(new NavLibraryMenuElement(_isolate, _library, queue: _r.queue)
+ menu.add(new NavLibraryMenuElement(_isolate, _library!, queue: _r.queue)
.element);
} else if (_function.dartOwner is M.ClassRef) {
- menu.add(new NavClassMenuElement(_isolate, _function.dartOwner,
+ menu.add(new NavClassMenuElement(
+ _isolate, _function.dartOwner as M.ClassRef,
queue: _r.queue)
.element);
}
menu.addAll(<Element>[
- navMenu(_function.name),
+ navMenu(_function.name!),
(new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) {
e.element.disabled = true;
@@ -189,8 +190,8 @@
..classes = ['memberName']
..children = <Element>[
new SpanElement()
- ..text = '${_function.isStatic ? "static " : ""}'
- '${_function.isConst ? "const " : ""}'
+ ..text = '${_function.isStatic! ? "static " : ""}'
+ '${_function.isConst! ? "const " : ""}'
'${_functionKindToString(_function.kind)}'
]
],
@@ -220,7 +221,7 @@
new DivElement()
..classes = ['memberName']
..children = <Element>[
- new FieldRefElement(_isolate, _function.field, _objects,
+ new FieldRefElement(_isolate, _function.field!, _objects,
queue: _r.queue)
.element
]
@@ -235,7 +236,7 @@
new DivElement()
..classes = ['memberName']
..children = <Element>[
- new SourceLinkElement(_isolate, _function.location, _scripts,
+ new SourceLinkElement(_isolate, _function.location!, _scripts,
queue: _r.queue)
.element
]
@@ -250,7 +251,7 @@
new DivElement()
..classes = ['memberName']
..children = <Element>[
- new CodeRefElement(_isolate, _function.code, queue: _r.queue)
+ new CodeRefElement(_isolate, _function.code!, queue: _r.queue)
.element
]
]);
@@ -265,7 +266,7 @@
new DivElement()
..classes = ['memberName']
..children = <Element>[
- new CodeRefElement(_isolate, _function.unoptimizedCode,
+ new CodeRefElement(_isolate, _function.unoptimizedCode!,
queue: _r.queue)
.element,
new SpanElement()
@@ -286,7 +287,7 @@
new DivElement()
..classes = ['memberName']
..children = <Element>[
- new CodeRefElement(_isolate, _function.bytecode, queue: _r.queue)
+ new CodeRefElement(_isolate, _function.bytecode!, queue: _r.queue)
.element,
]
]);
@@ -305,7 +306,7 @@
new DivElement()
..classes = ['memberName']
..children = <Element>[
- new InstanceRefElement(_isolate, _function.icDataArray, _objects,
+ new InstanceRefElement(_isolate, _function.icDataArray!, _objects,
queue: _r.queue)
.element
]
@@ -331,7 +332,7 @@
..text = 'optimizable',
new DivElement()
..classes = ['memberName']
- ..text = _function.isOptimizable ? 'yes' : 'no'
+ ..text = _function.isOptimizable! ? 'yes' : 'no'
],
new DivElement()
..classes = ['memberItem']
@@ -341,7 +342,7 @@
..text = 'inlinable',
new DivElement()
..classes = ['memberName']
- ..text = _function.isInlinable ? 'yes' : 'no'
+ ..text = _function.isInlinable! ? 'yes' : 'no'
],
new DivElement()
..classes = ['memberItem']
@@ -351,7 +352,7 @@
..text = 'intrinsic',
new DivElement()
..classes = ['memberName']
- ..text = _function.hasIntrinsic ? 'yes' : 'no'
+ ..text = _function.hasIntrinsic! ? 'yes' : 'no'
],
new DivElement()
..classes = ['memberItem']
@@ -361,7 +362,7 @@
..text = 'recognized',
new DivElement()
..classes = ['memberName']
- ..text = _function.isRecognized ? 'yes' : 'no'
+ ..text = _function.isRecognized! ? 'yes' : 'no'
],
new DivElement()
..classes = ['memberItem']
@@ -371,7 +372,7 @@
..text = 'native',
new DivElement()
..classes = ['memberName']
- ..text = _function.isNative ? 'yes' : 'no'
+ ..text = _function.isNative! ? 'yes' : 'no'
],
new DivElement()
..classes = ['memberItem']
@@ -388,16 +389,17 @@
}
Future _refresh() async {
- _function = await _functions.get(_isolate, _function.id);
+ _function = await _functions.get(_isolate, _function.id!);
if (_function.dartOwner is M.LibraryRef) {
- _library = _function.dartOwner;
+ _library = _function.dartOwner as M.LibraryRef;
} else if (_function.dartOwner is M.ClassRef) {
- _library = (await _classes.get(_isolate, _function.dartOwner.id)).library;
+ var cls = _function.dartOwner as M.ClassRef;
+ _library = (await _classes.get(_isolate, cls.id!)).library!;
}
_r.dirty();
}
- static String _functionKindToString(M.FunctionKind kind) {
+ static String _functionKindToString(M.FunctionKind? kind) {
switch (kind) {
case M.FunctionKind.regular:
return 'regular';
diff --git a/runtime/observatory/lib/src/elements/general_error.dart b/runtime/observatory/lib/src/elements/general_error.dart
index 430e366..40ffff9 100644
--- a/runtime/observatory/lib/src/elements/general_error.dart
+++ b/runtime/observatory/lib/src/elements/general_error.dart
@@ -14,19 +14,19 @@
import 'package:observatory/src/elements/nav/top_menu.dart';
class GeneralErrorElement extends CustomElement implements Renderable {
- RenderingScheduler<GeneralErrorElement> _r;
+ late RenderingScheduler<GeneralErrorElement> _r;
Stream<RenderedEvent<GeneralErrorElement>> get onRendered => _r.onRendered;
- M.NotificationRepository _notifications;
- String _message;
+ late M.NotificationRepository _notifications;
+ late String _message;
String get message => _message;
set message(String value) => _message = _r.checkAndReact(_message, value);
factory GeneralErrorElement(M.NotificationRepository notifications,
- {String message: '', RenderingQueue queue}) {
+ {String message: '', RenderingQueue? queue}) {
assert(notifications != null);
assert(message != null);
GeneralErrorElement e = new GeneralErrorElement.created();
diff --git a/runtime/observatory/lib/src/elements/heap_map.dart b/runtime/observatory/lib/src/elements/heap_map.dart
index 461fb52..7b10370 100644
--- a/runtime/observatory/lib/src/elements/heap_map.dart
+++ b/runtime/observatory/lib/src/elements/heap_map.dart
@@ -21,21 +21,21 @@
import 'package:observatory/src/elements/nav/vm_menu.dart';
class HeapMapElement extends CustomElement implements Renderable {
- RenderingScheduler<HeapMapElement> _r;
+ late RenderingScheduler<HeapMapElement> _r;
Stream<RenderedEvent<HeapMapElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
M.NotificationRepository get notifications => _notifications;
factory HeapMapElement(M.VM vm, M.IsolateRef isolate,
M.EventRepository events, M.NotificationRepository notifications,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -65,9 +65,9 @@
children = <Element>[];
}
- CanvasElement _canvas;
- var _fragmentationData;
- double _pageHeight;
+ CanvasElement? _canvas;
+ dynamic _fragmentationData;
+ int? _pageHeight;
final _classIdToColor = {};
final _colorToClassId = {};
final _classIdToName = {};
@@ -79,8 +79,8 @@
// TODO(koda): Improve interface for huge heaps.
static const _MAX_CANVAS_HEIGHT = 6000;
- String _status;
- S.ServiceMap _fragmentation;
+ String _status = 'Loading';
+ S.ServiceMap? _fragmentation;
void render() {
if (_canvas == null) {
@@ -91,7 +91,7 @@
}
// Set hover text to describe the object under the cursor.
- _canvas.title = _status;
+ _canvas!.title = _status;
children = <Element>[
navBar(<Element>[
@@ -121,7 +121,7 @@
],
new DivElement()
..classes = ['flex-row']
- ..children = <Element>[_canvas]
+ ..children = <Element>[_canvas!]
];
}
@@ -150,9 +150,9 @@
print('Ignoring non-class in class list');
continue;
}
- var classId = int.parse(member.id.split('/').last);
+ var classId = int.parse(member.id!.split('/').last);
var color = _classIdToRGBA(classId);
- _addClass(classId, member.name, color);
+ _addClass(classId, member.name!, color);
}
_addClass(freeClassId, 'Free', _freeColor);
_addClass(0, '', _pageSeparationColor);
@@ -169,15 +169,15 @@
return _classIdToName[_colorToClassId[_packColor(color)]];
}
- ObjectInfo _objectAt(Point<num> point) {
+ ObjectInfo? _objectAt(Point<num> point) {
if (_fragmentation == null || _canvas == null) {
return null;
}
- var pagePixels = _pageHeight * _fragmentationData.width;
+ var pagePixels = _pageHeight! * _fragmentationData.width;
var index = new PixelReference(_fragmentationData, point).index;
var pageIndex = index ~/ pagePixels;
num pageOffset = index % pagePixels;
- var pages = _fragmentation['pages'];
+ var pages = _fragmentation!['pages'];
if (pageIndex < 0 || pageIndex >= pages.length) {
return null;
}
@@ -196,8 +196,8 @@
}
return new ObjectInfo(
int.parse(page['objectStart']) +
- pageOffset * _fragmentation['unitSizeBytes'],
- size * _fragmentation['unitSizeBytes']);
+ pageOffset * _fragmentation!['unitSizeBytes'],
+ size * _fragmentation!['unitSizeBytes']);
}
void _handleMouseMove(MouseEvent event) {
@@ -218,28 +218,28 @@
return;
}
_updateClassList(
- _fragmentation['classList'], _fragmentation['freeClassId']);
- var pages = _fragmentation['pages'];
- var width = max(_canvas.parent.client.width, 1);
+ _fragmentation!['classList'], _fragmentation!['freeClassId']);
+ var pages = _fragmentation!['pages'];
+ var width = max(_canvas!.parent!.client.width, 1) as int;
_pageHeight = _PAGE_SEPARATION_HEIGHT +
- _fragmentation['pageSizeBytes'] ~/
- _fragmentation['unitSizeBytes'] ~/
+ (_fragmentation!['pageSizeBytes'] as int) ~/
+ (_fragmentation!['unitSizeBytes'] as int) ~/
width;
- var height = min(_pageHeight * pages.length, _MAX_CANVAS_HEIGHT);
- _fragmentationData = _canvas.context2D.createImageData(width, height);
- _canvas.width = _fragmentationData.width;
- _canvas.height = _fragmentationData.height;
+ var height = min(_pageHeight! * pages.length, _MAX_CANVAS_HEIGHT) as int;
+ _fragmentationData = _canvas!.context2D.createImageData(width, height);
+ _canvas!.width = _fragmentationData.width;
+ _canvas!.height = _fragmentationData.height;
_renderPages(0);
}
// Renders and draws asynchronously, one page at a time to avoid
// blocking the UI.
void _renderPages(int startPage) {
- var pages = _fragmentation['pages'];
+ var pages = _fragmentation!['pages'];
_status = 'Loaded $startPage of ${pages.length} pages';
_r.dirty();
- var startY = (startPage * _pageHeight).round();
- var endY = startY + _pageHeight.round();
+ var startY = (startPage * _pageHeight!).round();
+ var endY = startY + _pageHeight!.round();
if (startPage >= pages.length || endY > _fragmentationData.height) {
return;
}
@@ -258,7 +258,7 @@
pixel.color = _pageSeparationColor;
pixel = pixel.next();
}
- _canvas.context2D.putImageData(
+ _canvas!.context2D.putImageData(
_fragmentationData, 0, 0, 0, startY, _fragmentationData.width, endY);
// Continue with the next page, asynchronously.
new Future(() {
@@ -266,14 +266,14 @@
});
}
- Future _refresh({String gc}) {
+ Future _refresh({String? gc}) {
final isolate = _isolate as S.Isolate;
var params = {};
if (gc != null) {
params['gc'] = gc;
}
return isolate.invokeRpc('_getHeapMap', params).then((serviceObject) {
- S.ServiceMap response = serviceObject;
+ S.ServiceMap response = serviceObject as S.ServiceMap;
assert(response['type'] == 'HeapMap');
_fragmentation = response;
_updateFragmentationData();
diff --git a/runtime/observatory/lib/src/elements/heap_snapshot.dart b/runtime/observatory/lib/src/elements/heap_snapshot.dart
index 0f99d3a..1ddb59e 100644
--- a/runtime/observatory/lib/src/elements/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/elements/heap_snapshot.dart
@@ -168,9 +168,9 @@
String getType(MergedDominatorDiff node) => node.name;
String getName(MergedDominatorDiff node) => "instances of ${node.name}";
- MergedDominatorDiff getParent(MergedDominatorDiff node) => node.parent;
+ MergedDominatorDiff? getParent(MergedDominatorDiff node) => node.parent;
Iterable<MergedDominatorDiff> getChildren(MergedDominatorDiff node) =>
- node.children;
+ node.children!;
void onSelect(MergedDominatorDiff node) {
element.mergedDiffSelection = node;
element._r.dirty();
@@ -198,7 +198,7 @@
? "${snapshot.classes.length} classes"
: "${node.instanceCount} instances of ${node.name}";
- SnapshotClass getParent(SnapshotClass node) => null;
+ SnapshotClass? getParent(SnapshotClass node) => null;
Iterable<SnapshotClass> getChildren(SnapshotClass node) =>
node == null ? snapshot.classes : <SnapshotClass>[];
void onSelect(SnapshotClass node) {}
@@ -255,7 +255,7 @@
node == null ? "Classes" : node.name;
String getName(SnapshotClassDiff node) =>
node == null ? "${classes.length} classes" : "instances of ${node.name}";
- SnapshotClassDiff getParent(SnapshotClassDiff node) => null;
+ SnapshotClassDiff? getParent(SnapshotClassDiff node) => null;
Iterable<SnapshotClassDiff> getChildren(SnapshotClassDiff node) =>
node == null ? classes : <SnapshotClassDiff>[];
void onSelect(SnapshotClassDiff node) {}
@@ -280,7 +280,7 @@
String getName(SnapshotClass node) => node == null
? "${snapshot.classes.length} Classes"
: "${node.instanceCount} instances of ${node.name}";
- SnapshotClass getParent(SnapshotClass node) => null;
+ SnapshotClass? getParent(SnapshotClass node) => null;
Iterable<SnapshotClass> getChildren(SnapshotClass node) =>
node == null ? snapshot.classes : <SnapshotClass>[];
void onSelect(SnapshotClass node) {}
@@ -337,7 +337,7 @@
node == null ? "Classes" : node.name;
String getName(SnapshotClassDiff node) =>
node == null ? "${classes.length} classes" : "instances of ${node.name}";
- SnapshotClassDiff getParent(SnapshotClassDiff node) => null;
+ SnapshotClassDiff? getParent(SnapshotClassDiff node) => null;
Iterable<SnapshotClassDiff> getChildren(SnapshotClassDiff node) =>
node == null ? classes : <SnapshotClassDiff>[];
void onSelect(SnapshotClassDiff node) {}
@@ -350,16 +350,16 @@
}
class SnapshotClassDiff {
- SnapshotClass _a;
- SnapshotClass _b;
+ SnapshotClass? _a;
+ SnapshotClass? _b;
- int get shallowSizeA => _a == null ? 0 : _a.shallowSize;
- int get ownedSizeA => _a == null ? 0 : _a.ownedSize;
- int get instanceCountA => _a == null ? 0 : _a.instanceCount;
+ int get shallowSizeA => _a == null ? 0 : _a!.shallowSize;
+ int get ownedSizeA => _a == null ? 0 : _a!.ownedSize;
+ int get instanceCountA => _a == null ? 0 : _a!.instanceCount;
- int get shallowSizeB => _b == null ? 0 : _b.shallowSize;
- int get ownedSizeB => _b == null ? 0 : _b.ownedSize;
- int get instanceCountB => _b == null ? 0 : _b.instanceCount;
+ int get shallowSizeB => _b == null ? 0 : _b!.shallowSize;
+ int get ownedSizeB => _b == null ? 0 : _b!.ownedSize;
+ int get instanceCountB => _b == null ? 0 : _b!.instanceCount;
int get shallowSizeDiff => shallowSizeB - shallowSizeA;
int get ownedSizeDiff => ownedSizeB - ownedSizeA;
@@ -377,12 +377,12 @@
shallowSizeB > shallowSizeA ? shallowSizeA : shallowSizeB;
int get ownedSizeCommon => ownedSizeB > ownedSizeA ? ownedSizeA : ownedSizeB;
- String get name => _a == null ? _b.name : _a.name;
+ String get name => _a == null ? _b!.name : _a!.name;
List<SnapshotObject> get objectsA =>
- _a == null ? <SnapshotObject>[] : _a.instances.toList();
+ _a == null ? const <SnapshotObject>[] : _a!.instances.toList();
List<SnapshotObject> get objectsB =>
- _b == null ? <SnapshotObject>[] : _b.instances.toList();
+ _b == null ? const <SnapshotObject>[] : _b!.instances.toList();
static List<SnapshotClassDiff> from(
SnapshotGraph graphA, SnapshotGraph graphB) {
@@ -414,32 +414,32 @@
}
class MergedDominatorDiff {
- SnapshotMergedDominator _a;
- SnapshotMergedDominator _b;
- MergedDominatorDiff parent;
- List<MergedDominatorDiff> children;
+ SnapshotMergedDominator? _a;
+ SnapshotMergedDominator? _b;
+ MergedDominatorDiff? parent;
+ List<MergedDominatorDiff>? children;
int retainedGain = -1;
int retainedLoss = -1;
int retainedCommon = -1;
- int get shallowSizeA => _a == null ? 0 : _a.shallowSize;
- int get retainedSizeA => _a == null ? 0 : _a.retainedSize;
- int get instanceCountA => _a == null ? 0 : _a.instanceCount;
+ int get shallowSizeA => _a == null ? 0 : _a!.shallowSize;
+ int get retainedSizeA => _a == null ? 0 : _a!.retainedSize;
+ int get instanceCountA => _a == null ? 0 : _a!.instanceCount;
- int get shallowSizeB => _b == null ? 0 : _b.shallowSize;
- int get retainedSizeB => _b == null ? 0 : _b.retainedSize;
- int get instanceCountB => _b == null ? 0 : _b.instanceCount;
+ int get shallowSizeB => _b == null ? 0 : _b!.shallowSize;
+ int get retainedSizeB => _b == null ? 0 : _b!.retainedSize;
+ int get instanceCountB => _b == null ? 0 : _b!.instanceCount;
int get shallowSizeDiff => shallowSizeB - shallowSizeA;
int get retainedSizeDiff => retainedSizeB - retainedSizeA;
int get instanceCountDiff => instanceCountB - instanceCountA;
- String get name => _a == null ? _b.klass.name : _a.klass.name;
+ String get name => _a == null ? _b!.klass.name : _a!.klass.name;
List<SnapshotObject> get objectsA =>
- _a == null ? <SnapshotObject>[] : _a.objects.toList();
+ _a == null ? const <SnapshotObject>[] : _a!.objects.toList();
List<SnapshotObject> get objectsB =>
- _b == null ? <SnapshotObject>[] : _b.objects.toList();
+ _b == null ? const <SnapshotObject>[] : _b!.objects.toList();
static MergedDominatorDiff from(
SnapshotMergedDominator a, SnapshotMergedDominator b) {
@@ -472,11 +472,11 @@
// Matching children by MergedObjectVertex.klass.qualifiedName.
final childrenB = <String, SnapshotMergedDominator>{};
if (_b != null)
- for (var childB in _b.children) {
+ for (var childB in _b!.children) {
childrenB[childB.klass.qualifiedName] = childB;
}
if (_a != null)
- for (var childA in _a.children) {
+ for (var childA in _a!.children) {
var childDiff = new MergedDominatorDiff();
childDiff.parent = this;
childDiff._a = childA;
@@ -486,18 +486,18 @@
childrenB.remove(qualifiedName);
childDiff._b = childB;
}
- children.add(childDiff);
+ children!.add(childDiff);
worklist.add(childDiff);
}
for (var childB in childrenB.values) {
var childDiff = new MergedDominatorDiff();
childDiff.parent = this;
childDiff._b = childB;
- children.add(childDiff);
+ children!.add(childDiff);
worklist.add(childDiff);
}
- if (children.length == 0) {
+ if (children!.length == 0) {
// Compress.
children = const <MergedDominatorDiff>[];
}
@@ -507,7 +507,7 @@
int g = 0;
int l = 0;
int c = 0;
- for (var child in children) {
+ for (var child in children!) {
g += child.retainedGain;
l += child.retainedLoss;
c += child.retainedCommon;
@@ -528,30 +528,30 @@
}
class HeapSnapshotElement extends CustomElement implements Renderable {
- RenderingScheduler<HeapSnapshotElement> _r;
+ late RenderingScheduler<HeapSnapshotElement> _r;
Stream<RenderedEvent<HeapSnapshotElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.HeapSnapshotRepository _snapshots;
- M.ObjectRepository _objects;
- SnapshotReader _reader;
- String _status;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.HeapSnapshotRepository _snapshots;
+ late M.ObjectRepository _objects;
+ SnapshotReader? _reader;
+ String? _status;
List<SnapshotGraph> _loadedSnapshots = <SnapshotGraph>[];
- SnapshotGraph _snapshotA;
- SnapshotGraph _snapshotB;
+ SnapshotGraph? _snapshotA;
+ SnapshotGraph? _snapshotB;
HeapSnapshotTreeMode _mode = HeapSnapshotTreeMode.mergedDominatorTreeMap;
M.IsolateRef get isolate => _isolate;
M.NotificationRepository get notifications => _notifications;
M.HeapSnapshotRepository get profiles => _snapshots;
M.VMRef get vm => _vm;
- List<SnapshotObject> selection;
- SnapshotMergedDominator mergedSelection;
- MergedDominatorDiff mergedDiffSelection;
+ List<SnapshotObject>? selection;
+ SnapshotMergedDominator? mergedSelection;
+ MergedDominatorDiff? mergedDiffSelection;
factory HeapSnapshotElement(
M.VM vm,
@@ -560,7 +560,7 @@
M.NotificationRepository notifications,
M.HeapSnapshotRepository snapshots,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -625,7 +625,7 @@
if (_reader != null) {
// Loading
content.addAll(_createStatusMessage('Loading snapshot...',
- description: _status, progress: 1));
+ description: _status!, progress: 1));
} else if (_snapshotA != null) {
// Loaded
content.addAll(_createReport());
@@ -639,7 +639,7 @@
}
_save() {
- var blob = new Blob(_snapshotA.chunks, 'application/octet-stream');
+ var blob = new Blob(_snapshotA!.chunks, 'application/octet-stream');
var blobUrl = Url.createObjectUrl(blob);
var link = new AnchorElement();
link.href = blobUrl;
@@ -653,13 +653,13 @@
input.type = 'file';
input.multiple = false;
input.onChange.listen((event) {
- var file = input.files[0];
+ var file = input.files![0];
var reader = new FileReader();
reader.onLoad.listen((event) async {
- var encoded = <Uint8List>[reader.result];
+ var encoded = <Uint8List>[reader.result as Uint8List];
var snapshotReader = new SnapshotReader();
_snapshotLoading(snapshotReader);
- snapshotReader.add(reader.result);
+ snapshotReader.add(reader.result as Uint8List);
snapshotReader.close();
});
reader.readAsArrayBuffer(file);
@@ -713,7 +713,7 @@
];
}
- VirtualTreeElement _tree;
+ VirtualTreeElement? _tree;
void _createTreeMap<T>(List<HtmlElement> report, TreeMap<T> treemap, T root) {
final content = new DivElement();
@@ -786,13 +786,13 @@
switch (_mode) {
case HeapSnapshotTreeMode.dominatorTree:
if (selection == null) {
- selection = List.from(_snapshotA.extendedRoot.objects);
+ selection = List.from(_snapshotA!.extendedRoot.objects);
}
_tree = new VirtualTreeElement(
_createDominator, _updateDominator, _getChildrenDominator,
- items: selection, queue: _r.queue);
- if (selection.length == 1) {
- _tree.expand(selection.first);
+ items: selection!, queue: _r.queue);
+ if (selection!.length == 1) {
+ _tree!.expand(selection!.first);
}
final text = 'In a heap dominator tree, an object X is a parent of '
'object Y if every path from the root to Y goes through '
@@ -804,49 +804,49 @@
new DivElement()
..classes = ['content-centered-big', 'explanation']
..text = text,
- _tree.element
+ _tree!.element
]);
break;
case HeapSnapshotTreeMode.dominatorTreeMap:
if (selection == null) {
- selection = List.from(_snapshotA.extendedRoot.objects);
+ selection = List.from(_snapshotA!.extendedRoot.objects);
}
- _createTreeMap(report, new DominatorTreeMap(this), selection.first);
+ _createTreeMap(report, new DominatorTreeMap(this), selection!.first);
break;
case HeapSnapshotTreeMode.mergedDominatorTree:
_tree = new VirtualTreeElement(_createMergedDominator,
_updateMergedDominator, _getChildrenMergedDominator,
- items: _getChildrenMergedDominator(_snapshotA.extendedMergedRoot),
+ items: _getChildrenMergedDominator(_snapshotA!.extendedMergedRoot),
queue: _r.queue);
- _tree.expand(_snapshotA.extendedMergedRoot);
+ _tree!.expand(_snapshotA!.extendedMergedRoot);
final text = 'A heap dominator tree, where siblings with the same class'
' have been merged into a single node.';
report.addAll([
new DivElement()
..classes = ['content-centered-big', 'explanation']
..text = text,
- _tree.element
+ _tree!.element
]);
break;
case HeapSnapshotTreeMode.mergedDominatorTreeDiff:
var root = MergedDominatorDiff.from(
- _snapshotA.mergedRoot, _snapshotB.mergedRoot);
+ _snapshotA!.mergedRoot, _snapshotB!.mergedRoot);
_tree = new VirtualTreeElement(_createMergedDominatorDiff,
_updateMergedDominatorDiff, _getChildrenMergedDominatorDiff,
items: _getChildrenMergedDominatorDiff(root), queue: _r.queue);
- _tree.expand(root);
+ _tree!.expand(root);
final text = 'A heap dominator tree, where siblings with the same class'
' have been merged into a single node.';
report.addAll([
new DivElement()
..classes = ['content-centered-big', 'explanation']
..text = text,
- _tree.element
+ _tree!.element
]);
break;
case HeapSnapshotTreeMode.mergedDominatorTreeMap:
if (mergedSelection == null) {
- mergedSelection = _snapshotA.extendedMergedRoot;
+ mergedSelection = _snapshotA!.extendedMergedRoot;
}
_createTreeMap(
report, new MergedDominatorTreeMap(this), mergedSelection);
@@ -854,18 +854,19 @@
case HeapSnapshotTreeMode.mergedDominatorTreeMapDiff:
if (mergedDiffSelection == null) {
mergedDiffSelection = MergedDominatorDiff.from(
- _snapshotA.mergedRoot, _snapshotB.mergedRoot);
+ _snapshotA!.mergedRoot, _snapshotB!.mergedRoot);
}
_createTreeMap(
report, new MergedDominatorDiffTreeMap(this), mergedDiffSelection);
break;
case HeapSnapshotTreeMode.ownershipTable:
- final items = _snapshotA.classes.where((c) => c.ownedSize > 0).toList();
+ final items =
+ _snapshotA!.classes.where((c) => c.ownedSize > 0).toList();
items.sort((a, b) => b.ownedSize - a.ownedSize);
_tree = new VirtualTreeElement(
_createOwnership, _updateOwnership, _getChildrenOwnership,
items: items, queue: _r.queue);
- _tree.expand(_snapshotA.root);
+ _tree!.expand(_snapshotA!.root);
final text = 'An object X is said to "own" object Y if X is the only '
'object that references Y, or X owns the only object that '
'references Y. In particular, objects "own" the space of any '
@@ -874,18 +875,18 @@
new DivElement()
..classes = ['content-centered-big', 'explanation']
..text = text,
- _tree.element
+ _tree!.element
]);
break;
case HeapSnapshotTreeMode.ownershipTableDiff:
- final items = SnapshotClassDiff.from(_snapshotA, _snapshotB);
+ final items = SnapshotClassDiff.from(_snapshotA!, _snapshotB!);
items.sort((a, b) => b.ownedSizeB - a.ownedSizeB);
items.sort((a, b) => b.ownedSizeA - a.ownedSizeA);
items.sort((a, b) => b.ownedSizeDiff - a.ownedSizeDiff);
_tree = new VirtualTreeElement(_createOwnershipDiff,
_updateOwnershipDiff, _getChildrenOwnershipDiff,
items: items, queue: _r.queue);
- _tree.expand(_snapshotA.root);
+ _tree!.expand(_snapshotA!.root);
final text = 'An object X is said to "own" object Y if X is the only '
'object that references Y, or X owns the only object that '
'references Y. In particular, objects "own" the space of any '
@@ -894,79 +895,79 @@
new DivElement()
..classes = ['content-centered-big', 'explanation']
..text = text,
- _tree.element
+ _tree!.element
]);
break;
case HeapSnapshotTreeMode.ownershipTreeMap:
_createTreeMap(
- report, new ClassesOwnershipTreeMap(this, _snapshotA), null);
+ report, new ClassesOwnershipTreeMap(this, _snapshotA!), null);
break;
case HeapSnapshotTreeMode.ownershipTreeMapDiff:
- final items = SnapshotClassDiff.from(_snapshotA, _snapshotB);
+ final items = SnapshotClassDiff.from(_snapshotA!, _snapshotB!);
_createTreeMap(
report, new ClassesOwnershipDiffTreeMap(this, items), null);
break;
case HeapSnapshotTreeMode.successors:
if (selection == null) {
- selection = List.from(_snapshotA.root.objects);
+ selection = List.from(_snapshotA!.root.objects);
}
_tree = new VirtualTreeElement(
_createSuccessor, _updateSuccessor, _getChildrenSuccessor,
- items: selection, queue: _r.queue);
- if (selection.length == 1) {
- _tree.expand(selection.first);
+ items: selection!, queue: _r.queue);
+ if (selection!.length == 1) {
+ _tree!.expand(selection!.first);
}
final text = '';
report.addAll([
new DivElement()
..classes = ['content-centered-big', 'explanation']
..text = text,
- _tree.element
+ _tree!.element
]);
break;
case HeapSnapshotTreeMode.predecessors:
if (selection == null) {
- selection = List.from(_snapshotA.root.objects);
+ selection = List.from(_snapshotA!.root.objects);
}
_tree = new VirtualTreeElement(
_createPredecessor, _updatePredecessor, _getChildrenPredecessor,
- items: selection, queue: _r.queue);
- if (selection.length == 1) {
- _tree.expand(selection.first);
+ items: selection!, queue: _r.queue);
+ if (selection!.length == 1) {
+ _tree!.expand(selection!.first);
}
final text = '';
report.addAll([
new DivElement()
..classes = ['content-centered-big', 'explanation']
..text = text,
- _tree.element
+ _tree!.element
]);
break;
case HeapSnapshotTreeMode.classesTable:
- final items = _snapshotA.classes.toList();
+ final items = _snapshotA!.classes.toList();
items.sort((a, b) => b.shallowSize - a.shallowSize);
_tree = new VirtualTreeElement(
_createClass, _updateClass, _getChildrenClass,
items: items, queue: _r.queue);
- report.add(_tree.element);
+ report.add(_tree!.element);
break;
case HeapSnapshotTreeMode.classesTableDiff:
- final items = SnapshotClassDiff.from(_snapshotA, _snapshotB);
+ final items = SnapshotClassDiff.from(_snapshotA!, _snapshotB!);
items.sort((a, b) => b.shallowSizeB - a.shallowSizeB);
items.sort((a, b) => b.shallowSizeA - a.shallowSizeA);
items.sort((a, b) => b.shallowSizeDiff - a.shallowSizeDiff);
_tree = new VirtualTreeElement(
_createClassDiff, _updateClassDiff, _getChildrenClassDiff,
items: items, queue: _r.queue);
- report.add(_tree.element);
+ report.add(_tree!.element);
break;
case HeapSnapshotTreeMode.classesTreeMap:
_createTreeMap(
- report, new ClassesShallowTreeMap(this, _snapshotA), null);
+ report, new ClassesShallowTreeMap(this, _snapshotA!), null);
break;
case HeapSnapshotTreeMode.classesTreeMapDiff:
- final items = SnapshotClassDiff.from(_snapshotA, _snapshotB);
+ final items = SnapshotClassDiff.from(_snapshotA!, _snapshotB!);
_createTreeMap(
report, new ClassesShallowDiffTreeMap(this, items), null);
break;
@@ -1215,7 +1216,7 @@
static Iterable _getChildrenMergedDominatorDiff(nodeDynamic) {
MergedDominatorDiff node = nodeDynamic;
- final list = node.children
+ final list = node.children!
.where((child) =>
child.retainedSizeA >= kMinRetainedSize ||
child.retainedSizeB >= kMinRetainedSize)
@@ -1243,11 +1244,11 @@
void _updateDominator(HtmlElement element, nodeDynamic, int depth) {
SnapshotObject node = nodeDynamic;
element.children[0].text = Utils.formatPercentNormalized(
- node.retainedSize * 1.0 / _snapshotA.size);
+ node.retainedSize * 1.0 / _snapshotA!.size);
element.children[1].text = Utils.formatSize(node.retainedSize);
_updateLines(element.children[2].children, depth);
if (_getChildrenDominator(node).isNotEmpty) {
- element.children[3].text = _tree.isExpanded(node) ? '▼' : '►';
+ element.children[3].text = _tree!.isExpanded(node) ? '▼' : '►';
} else {
element.children[3].text = '';
}
@@ -1273,7 +1274,7 @@
SnapshotObject node = nodeDynamic;
_updateLines(element.children[0].children, depth);
if (_getChildrenSuccessor(node).isNotEmpty) {
- element.children[1].text = _tree.isExpanded(node) ? '▼' : '►';
+ element.children[1].text = _tree!.isExpanded(node) ? '▼' : '►';
} else {
element.children[1].text = '';
}
@@ -1301,7 +1302,7 @@
SnapshotObject node = nodeDynamic;
_updateLines(element.children[0].children, depth);
if (_getChildrenSuccessor(node).isNotEmpty) {
- element.children[1].text = _tree.isExpanded(node) ? '▼' : '►';
+ element.children[1].text = _tree!.isExpanded(node) ? '▼' : '►';
} else {
element.children[1].text = '';
}
@@ -1328,11 +1329,11 @@
void _updateMergedDominator(HtmlElement element, nodeDynamic, int depth) {
SnapshotMergedDominator node = nodeDynamic;
element.children[0].text = Utils.formatPercentNormalized(
- node.retainedSize * 1.0 / _snapshotA.size);
+ node.retainedSize * 1.0 / _snapshotA!.size);
element.children[1].text = Utils.formatSize(node.retainedSize);
_updateLines(element.children[2].children, depth);
if (_getChildrenMergedDominator(node).isNotEmpty) {
- element.children[3].text = _tree.isExpanded(node) ? '▼' : '►';
+ element.children[3].text = _tree!.isExpanded(node) ? '▼' : '►';
} else {
element.children[3].text = '';
}
@@ -1343,10 +1344,10 @@
void _updateMergedDominatorDiff(HtmlElement element, nodeDynamic, int depth) {
MergedDominatorDiff node = nodeDynamic;
element.children[0].text = Utils.formatPercentNormalized(
- node.retainedSizeA * 1.0 / _snapshotA.size);
+ node.retainedSizeA * 1.0 / _snapshotA!.size);
element.children[1].text = Utils.formatSize(node.retainedSizeA);
element.children[2].text = Utils.formatPercentNormalized(
- node.retainedSizeB * 1.0 / _snapshotB.size);
+ node.retainedSizeB * 1.0 / _snapshotB!.size);
element.children[3].text = Utils.formatSize(node.retainedSizeB);
element.children[4].text = (node.retainedSizeDiff > 0 ? '+' : '') +
Utils.formatSize(node.retainedSizeDiff);
@@ -1354,7 +1355,7 @@
node.retainedSizeDiff > 0 ? "red" : "green";
_updateLines(element.children[5].children, depth);
if (_getChildrenMergedDominatorDiff(node).isNotEmpty) {
- element.children[6].text = _tree.isExpanded(node) ? '▼' : '►';
+ element.children[6].text = _tree!.isExpanded(node) ? '▼' : '►';
} else {
element.children[6].text = '';
}
@@ -1366,7 +1367,7 @@
void _updateOwnership(HtmlElement element, nodeDynamic, int depth) {
SnapshotClass node = nodeDynamic;
element.children[0].text =
- Utils.formatPercentNormalized(node.ownedSize * 1.0 / _snapshotA.size);
+ Utils.formatPercentNormalized(node.ownedSize * 1.0 / _snapshotA!.size);
element.children[1].text = Utils.formatSize(node.ownedSize);
element.children[2].text = node.name;
}
@@ -1374,10 +1375,10 @@
void _updateOwnershipDiff(HtmlElement element, nodeDynamic, int depth) {
SnapshotClassDiff node = nodeDynamic;
element.children[0].text =
- Utils.formatPercentNormalized(node.ownedSizeA * 1.0 / _snapshotA.size);
+ Utils.formatPercentNormalized(node.ownedSizeA * 1.0 / _snapshotA!.size);
element.children[1].text = Utils.formatSize(node.ownedSizeA);
element.children[2].text =
- Utils.formatPercentNormalized(node.ownedSizeB * 1.0 / _snapshotB.size);
+ Utils.formatPercentNormalized(node.ownedSizeB * 1.0 / _snapshotB!.size);
element.children[3].text = Utils.formatSize(node.ownedSizeB);
element.children[4].text = (node.ownedSizeDiff > 0 ? "+" : "") +
Utils.formatSize(node.ownedSizeDiff);
@@ -1387,8 +1388,8 @@
void _updateClass(HtmlElement element, nodeDynamic, int depth) {
SnapshotClass node = nodeDynamic;
- element.children[0].text =
- Utils.formatPercentNormalized(node.shallowSize * 1.0 / _snapshotA.size);
+ element.children[0].text = Utils.formatPercentNormalized(
+ node.shallowSize * 1.0 / _snapshotA!.size);
element.children[1].text = Utils.formatSize(node.shallowSize);
element.children[2].text = node.instanceCount.toString();
element.children[3].text = node.name;
diff --git a/runtime/observatory/lib/src/elements/helpers/any_ref.dart b/runtime/observatory/lib/src/elements/helpers/any_ref.dart
index a6ef2e9..3324eb6 100644
--- a/runtime/observatory/lib/src/elements/helpers/any_ref.dart
+++ b/runtime/observatory/lib/src/elements/helpers/any_ref.dart
@@ -28,7 +28,7 @@
import 'package:observatory/src/elements/unlinkedcall_ref.dart';
Element anyRef(M.IsolateRef isolate, ref, M.ObjectRepository objects,
- {RenderingQueue queue, bool expandable: true}) {
+ {RenderingQueue? queue, bool expandable: true}) {
if (ref == null) {
return new SpanElement()..text = "???";
}
diff --git a/runtime/observatory/lib/src/elements/helpers/custom_element.dart b/runtime/observatory/lib/src/elements/helpers/custom_element.dart
index 2af0d6c..b3f93f2 100644
--- a/runtime/observatory/lib/src/elements/helpers/custom_element.dart
+++ b/runtime/observatory/lib/src/elements/helpers/custom_element.dart
@@ -9,14 +9,15 @@
class CustomElement {
static Expando reverseElements = new Expando();
- static CustomElement reverse(HtmlElement element) => reverseElements[element];
+ static CustomElement reverse(HtmlElement element) =>
+ reverseElements[element] as CustomElement;
static List<CustomElement> toBeAttached = <CustomElement>[];
static void drainAttached() {
// Send 'attached' to elements that have been attached to the document.
bool fired = false;
var connectedElements = toBeAttached
- .where((CustomElement element) => element.element.isConnected)
+ .where((CustomElement element) => element.element.isConnected!)
.toList();
for (CustomElement element in connectedElements) {
toBeAttached.remove(element);
@@ -47,7 +48,7 @@
final HtmlElement element;
CustomElement.created(String elementClass)
- : element = document.createElement("shadow") {
+ : element = document.createElement("shadow") as HtmlElement {
reverseElements[element] = this;
element.classes = [elementClass];
@@ -60,7 +61,7 @@
void attached() {}
void detached() {}
- Element get parent => element.parent;
+ Element? get parent => element.parent;
List<Element> get children => element.children;
set children(List<Element> c) => element.children = c;
@@ -68,11 +69,11 @@
CssClassSet get classes => element.classes;
set classes(dynamic c) => element.classes = c;
- String get title => element.title;
- set title(String t) => element.title = t;
+ String? get title => element.title;
+ set title(String? t) => element.title = t;
- String get text => element.text;
- set text(String t) => element.text = t;
+ String? get text => element.text;
+ set text(String? t) => element.text = t;
CssStyleDeclaration get style => element.style;
diff --git a/runtime/observatory/lib/src/elements/helpers/nav_bar.dart b/runtime/observatory/lib/src/elements/helpers/nav_bar.dart
index 050041b..fac7f84 100644
--- a/runtime/observatory/lib/src/elements/helpers/nav_bar.dart
+++ b/runtime/observatory/lib/src/elements/helpers/nav_bar.dart
@@ -4,7 +4,7 @@
import 'dart:html';
-Element navBar(Iterable<Element> content) {
+Element navBar(List<Element> content) {
assert(content != null);
return document.createElement('nav')
..classes = ['nav-bar']
diff --git a/runtime/observatory/lib/src/elements/helpers/nav_menu.dart b/runtime/observatory/lib/src/elements/helpers/nav_menu.dart
index 02cf8ef..5a79190 100644
--- a/runtime/observatory/lib/src/elements/helpers/nav_menu.dart
+++ b/runtime/observatory/lib/src/elements/helpers/nav_menu.dart
@@ -4,7 +4,7 @@
import 'dart:html';
-navMenu(String label, {String link, Iterable<Element> content: const []}) {
+navMenu(String label, {String? link, List<Element> content: const []}) {
assert(label != null);
assert(content != null);
return new LIElement()
diff --git a/runtime/observatory/lib/src/elements/helpers/rendering_scheduler.dart b/runtime/observatory/lib/src/elements/helpers/rendering_scheduler.dart
index 5d9706e..e179642 100644
--- a/runtime/observatory/lib/src/elements/helpers/rendering_scheduler.dart
+++ b/runtime/observatory/lib/src/elements/helpers/rendering_scheduler.dart
@@ -54,7 +54,7 @@
/// Creates a new scheduler for an element.
/// If no queue is provided it will create a new default configured queue.
- factory RenderingScheduler(T element, {RenderingQueue queue}) {
+ factory RenderingScheduler(T element, {RenderingQueue? queue}) {
assert(element != null);
if (queue == null) {
queue = new RenderingQueue();
diff --git a/runtime/observatory/lib/src/elements/helpers/uris.dart b/runtime/observatory/lib/src/elements/helpers/uris.dart
index 4e53b95..370e852 100644
--- a/runtime/observatory/lib/src/elements/helpers/uris.dart
+++ b/runtime/observatory/lib/src/elements/helpers/uris.dart
@@ -7,7 +7,7 @@
/// Utility class for URIs generation.
abstract class Uris {
static String _isolatePage(String path, M.IsolateRef isolate,
- {M.ObjectRef object}) {
+ {M.ObjectRef? object}) {
final parameters = {'isolateId': isolate.id};
if (object != null) parameters['objectId'] = object.id;
return '#' + new Uri(path: path, queryParameters: parameters).toString();
@@ -28,7 +28,7 @@
_isolatePage('/heap-map', isolate);
static String heapSnapshot(M.IsolateRef isolate) =>
_isolatePage('/heap-snapshot', isolate);
- static String inspect(M.IsolateRef isolate, {M.ObjectRef object, int pos}) {
+ static String inspect(M.IsolateRef isolate, {M.ObjectRef? object, int? pos}) {
if (pos == null) {
return _isolatePage('/inspect', isolate, object: object);
}
diff --git a/runtime/observatory/lib/src/elements/icdata_ref.dart b/runtime/observatory/lib/src/elements/icdata_ref.dart
index 43883f5..435c636 100644
--- a/runtime/observatory/lib/src/elements/icdata_ref.dart
+++ b/runtime/observatory/lib/src/elements/icdata_ref.dart
@@ -10,18 +10,18 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class ICDataRefElement extends CustomElement implements Renderable {
- RenderingScheduler<ICDataRefElement> _r;
+ late RenderingScheduler<ICDataRefElement> _r;
Stream<RenderedEvent<ICDataRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.ICDataRef _icdata;
+ late M.IsolateRef _isolate;
+ late M.ICDataRef _icdata;
M.IsolateRef get isolate => _isolate;
M.ICDataRef get icdata => _icdata;
factory ICDataRefElement(M.IsolateRef isolate, M.ICDataRef icdata,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(icdata != null);
ICDataRefElement e = new ICDataRefElement.created();
diff --git a/runtime/observatory/lib/src/elements/icdata_view.dart b/runtime/observatory/lib/src/elements/icdata_view.dart
index ea5090e..90a0a3e 100644
--- a/runtime/observatory/lib/src/elements/icdata_view.dart
+++ b/runtime/observatory/lib/src/elements/icdata_view.dart
@@ -20,21 +20,21 @@
import 'package:observatory/src/elements/view_footer.dart';
class ICDataViewElement extends CustomElement implements Renderable {
- RenderingScheduler<ICDataViewElement> _r;
+ late RenderingScheduler<ICDataViewElement> _r;
Stream<RenderedEvent<ICDataViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.ICData _icdata;
- M.ICDataRepository _icdatas;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.ICData _icdata;
+ late M.ICDataRepository _icdatas;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -53,7 +53,7 @@
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -106,7 +106,7 @@
(new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) async {
e.element.disabled = true;
- _icdata = await _icdatas.get(_isolate, _icdata.id);
+ _icdata = await _icdatas.get(_isolate, _icdata.id!);
_r.dirty();
}))
.element,
diff --git a/runtime/observatory/lib/src/elements/inbound_references.dart b/runtime/observatory/lib/src/elements/inbound_references.dart
index 47643fc..db22f02 100644
--- a/runtime/observatory/lib/src/elements/inbound_references.dart
+++ b/runtime/observatory/lib/src/elements/inbound_references.dart
@@ -12,16 +12,16 @@
import 'package:observatory/src/elements/helpers/custom_element.dart';
class InboundReferencesElement extends CustomElement implements Renderable {
- RenderingScheduler<InboundReferencesElement> _r;
+ late RenderingScheduler<InboundReferencesElement> _r;
Stream<RenderedEvent<InboundReferencesElement>> get onRendered =>
_r.onRendered;
- M.IsolateRef _isolate;
- M.ObjectRef _object;
- M.InboundReferencesRepository _references;
- M.ObjectRepository _objects;
- M.InboundReferences _inbounds;
+ late M.IsolateRef _isolate;
+ late M.ObjectRef _object;
+ late M.InboundReferencesRepository _references;
+ late M.ObjectRepository _objects;
+ M.InboundReferences? _inbounds;
bool _expanded = false;
M.IsolateRef get isolate => _isolate;
@@ -29,7 +29,7 @@
factory InboundReferencesElement(M.IsolateRef isolate, M.ObjectRef object,
M.InboundReferencesRepository references, M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(object != null);
assert(references != null);
@@ -75,7 +75,7 @@
}
Future _refresh() async {
- _inbounds = await _references.get(_isolate, _object.id);
+ _inbounds = await _references.get(_isolate, _object.id!);
_r.dirty();
}
@@ -83,7 +83,7 @@
if (_inbounds == null) {
return const [];
}
- return _inbounds.elements.map<Element>(_createItem).toList();
+ return _inbounds!.elements.map<Element>(_createItem).toList();
}
Element _createItem(M.InboundReference reference) {
diff --git a/runtime/observatory/lib/src/elements/instance_ref.dart b/runtime/observatory/lib/src/elements/instance_ref.dart
index 708fcde..d92d2b9 100644
--- a/runtime/observatory/lib/src/elements/instance_ref.dart
+++ b/runtime/observatory/lib/src/elements/instance_ref.dart
@@ -14,23 +14,23 @@
import 'package:observatory/utils.dart';
class InstanceRefElement extends CustomElement implements Renderable {
- RenderingScheduler<InstanceRefElement> _r;
+ late RenderingScheduler<InstanceRefElement> _r;
Stream<RenderedEvent<InstanceRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.InstanceRef _instance;
- M.ObjectRepository _objects;
- M.Instance _loadedInstance;
- bool _expandable;
- bool _expanded = false;
+ late M.IsolateRef _isolate;
+ late M.InstanceRef _instance;
+ late M.ObjectRepository _objects;
+ M.Instance? _loadedInstance;
+ late bool _expandable;
+ late bool _expanded = false;
M.IsolateRef get isolate => _isolate;
M.InstanceRef get instance => _instance;
factory InstanceRefElement(
M.IsolateRef isolate, M.InstanceRef instance, M.ObjectRepository objects,
- {RenderingQueue queue, bool expandable: true}) {
+ {RenderingQueue? queue, bool expandable: true}) {
assert(isolate != null);
assert(instance != null);
assert(objects != null);
@@ -86,19 +86,20 @@
}
Future _refresh() async {
- _loadedInstance = await _objects.get(_isolate, _instance.id);
+ _loadedInstance = await _objects.get(_isolate, _instance.id!) as M.Instance;
_r.dirty();
}
List<Element> _createShowMoreButton() {
- if (_loadedInstance.count == null) {
+ if (_loadedInstance!.count == null) {
return [];
}
- final count = _loadedInstance.count;
+ final count = _loadedInstance!.count;
final button = new ButtonElement()..text = 'show next ${count}';
button.onClick.listen((_) async {
button.disabled = true;
- _loadedInstance = await _objects.get(_isolate, _instance.id);
+ _loadedInstance =
+ await _objects.get(_isolate, _instance.id!) as M.Instance;
_r.dirty();
});
return [button];
@@ -121,7 +122,7 @@
return [
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
..text = Utils.formatStringAsLiteral(
- _instance.valueAsString, _instance.valueAsStringIsTruncated)
+ _instance.valueAsString!, _instance.valueAsStringIsTruncated!)
];
case M.InstanceKind.type:
case M.InstanceKind.typeRef:
@@ -137,7 +138,7 @@
new SpanElement()
..classes = ['emphasize']
..text = 'Closure',
- new SpanElement()..text = ' (${_instance.closureFunction.name})'
+ new SpanElement()..text = ' (${_instance.closureFunction!.name})'
]
];
case M.InstanceKind.regExp:
@@ -146,8 +147,8 @@
..children = <Element>[
new SpanElement()
..classes = ['emphasize']
- ..text = _instance.clazz.name,
- new SpanElement()..text = ' (${_instance.pattern.valueAsString})'
+ ..text = _instance.clazz!.name,
+ new SpanElement()..text = ' (${_instance.pattern!.valueAsString})'
]
];
case M.InstanceKind.stackTrace:
@@ -156,14 +157,14 @@
..children = <Element>[
new SpanElement()
..classes = ['emphasize']
- ..text = _instance.clazz.name,
+ ..text = _instance.clazz!.name,
]
];
case M.InstanceKind.plainInstance:
return [
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
..classes = ['emphasize']
- ..text = _instance.clazz.name
+ ..text = _instance.clazz!.name
];
case M.InstanceKind.list:
case M.InstanceKind.map:
@@ -186,7 +187,7 @@
..children = <Element>[
new SpanElement()
..classes = ['emphasize']
- ..text = _instance.clazz.name,
+ ..text = _instance.clazz!.name,
new SpanElement()..text = ' (${_instance.length})'
]
];
@@ -194,13 +195,13 @@
return [
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
..classes = ['emphasize']
- ..text = _instance.clazz.name
+ ..text = _instance.clazz!.name
];
case M.InstanceKind.weakProperty:
return [
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
..classes = ['emphasize']
- ..text = _instance.clazz.name
+ ..text = _instance.clazz!.name
];
}
throw new Exception('Unknown InstanceKind: ${_instance.kind}');
@@ -230,7 +231,7 @@
case M.InstanceKind.int32x4List:
case M.InstanceKind.float32x4List:
case M.InstanceKind.float64x2List:
- return _instance.length > 0;
+ return _instance.length! > 0;
default:
return false;
}
@@ -244,29 +245,30 @@
case M.InstanceKind.closure:
{
var members = <Element>[];
- if (_loadedInstance.closureFunction != null) {
+ if (_loadedInstance!.closureFunction != null) {
members.add(new DivElement()
..children = <Element>[
new SpanElement()..text = 'function = ',
- anyRef(_isolate, _loadedInstance.closureFunction, _objects,
+ anyRef(_isolate, _loadedInstance!.closureFunction, _objects,
queue: _r.queue)
]);
}
- if (_loadedInstance.closureContext != null) {
+ if (_loadedInstance!.closureContext != null) {
members.add(new DivElement()
..children = <Element>[
new SpanElement()..text = 'context = ',
- anyRef(_isolate, _loadedInstance.closureContext, _objects,
+ anyRef(_isolate, _loadedInstance!.closureContext, _objects,
queue: _r.queue)
]);
}
return members;
}
case M.InstanceKind.plainInstance:
- return _loadedInstance.fields
+ return _loadedInstance!.fields!
.map<Element>((f) => new DivElement()
..children = <Element>[
- new FieldRefElement(_isolate, f.decl, _objects, queue: _r.queue)
+ new FieldRefElement(_isolate, f.decl!, _objects,
+ queue: _r.queue)
.element,
new SpanElement()..text = ' = ',
anyRef(_isolate, f.value, _objects, queue: _r.queue)
@@ -274,7 +276,7 @@
.toList();
case M.InstanceKind.list:
var index = 0;
- return _loadedInstance.elements
+ return _loadedInstance!.elements!
.map<Element>((element) => new DivElement()
..children = <Element>[
new SpanElement()..text = '[ ${index++} ] : ',
@@ -283,7 +285,7 @@
.toList()
..addAll(_createShowMoreButton());
case M.InstanceKind.map:
- return _loadedInstance.associations
+ return _loadedInstance!.associations!
.map<Element>((association) => new DivElement()
..children = <Element>[
new SpanElement()..text = '[ ',
@@ -308,14 +310,14 @@
case M.InstanceKind.float32x4List:
case M.InstanceKind.float64x2List:
var index = 0;
- return _loadedInstance.typedElements
+ return _loadedInstance!.typedElements!
.map<Element>((e) => new DivElement()..text = '[ ${index++} ] : $e')
.toList()
..addAll(_createShowMoreButton());
case M.InstanceKind.mirrorReference:
return [
new SpanElement()..text = '<referent> : ',
- anyRef(_isolate, _loadedInstance.referent, _objects, queue: _r.queue)
+ anyRef(_isolate, _loadedInstance!.referent, _objects, queue: _r.queue)
];
case M.InstanceKind.stackTrace:
return [
@@ -326,12 +328,12 @@
case M.InstanceKind.weakProperty:
return [
new SpanElement()..text = '<key> : ',
- new InstanceRefElement(_isolate, _loadedInstance.key, _objects,
+ new InstanceRefElement(_isolate, _loadedInstance!.key!, _objects,
queue: _r.queue)
.element,
new BRElement(),
new SpanElement()..text = '<value> : ',
- new InstanceRefElement(_isolate, _loadedInstance.value, _objects,
+ new InstanceRefElement(_isolate, _loadedInstance!.value!, _objects,
queue: _r.queue)
.element,
];
diff --git a/runtime/observatory/lib/src/elements/instance_view.dart b/runtime/observatory/lib/src/elements/instance_view.dart
index de780cb..ca36d45 100644
--- a/runtime/observatory/lib/src/elements/instance_view.dart
+++ b/runtime/observatory/lib/src/elements/instance_view.dart
@@ -33,29 +33,29 @@
import 'package:observatory/utils.dart';
class InstanceViewElement extends CustomElement implements Renderable {
- RenderingScheduler<InstanceViewElement> _r;
+ late RenderingScheduler<InstanceViewElement> _r;
Stream<RenderedEvent<InstanceViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.Instance _instance;
- M.LibraryRef _library;
- M.ObjectRepository _objects;
- M.ClassRepository _classes;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ScriptRepository _scripts;
- M.EvalRepository _eval;
- M.TypeArguments _typeArguments;
- M.TypeArgumentsRepository _arguments;
- M.BreakpointRepository _breakpoints;
- M.FunctionRepository _functions;
- M.SourceLocation _location;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.Instance _instance;
+ M.LibraryRef? _library;
+ late M.ObjectRepository _objects;
+ late M.ClassRepository _classes;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ScriptRepository _scripts;
+ late M.EvalRepository _eval;
+ M.TypeArguments? _typeArguments;
+ late M.TypeArgumentsRepository _arguments;
+ late M.BreakpointRepository _breakpoints;
+ late M.FunctionRepository _functions;
+ M.SourceLocation? _location;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -79,7 +79,7 @@
M.TypeArgumentsRepository arguments,
M.BreakpointRepository breakpoints,
M.FunctionRepository functions,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -138,7 +138,7 @@
new HeadingElement.h2()
..text = M.isAbstractType(_instance.kind)
? 'type ${_instance.name}'
- : 'instance of ${_instance.clazz.name}',
+ : 'instance of ${_instance.clazz!.name}',
new HRElement(),
new ObjectCommonElement(_isolate, _instance, _retainedSizes,
_reachableSizes, _references, _retainingPaths, _objects,
@@ -157,7 +157,8 @@
if (_location != null) {
content.addAll([
new HRElement(),
- new SourceInsetElement(_isolate, _location, _scripts, _objects, _events,
+ new SourceInsetElement(
+ _isolate, _location!, _scripts, _objects, _events,
queue: _r.queue)
.element
]);
@@ -179,11 +180,11 @@
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element
];
if (_library != null) {
- menu.add(new NavLibraryMenuElement(_isolate, _library, queue: _r.queue)
+ menu.add(new NavLibraryMenuElement(_isolate, _library!, queue: _r.queue)
.element);
}
menu.addAll(<Element>[
- new NavClassMenuElement(_isolate, _instance.clazz, queue: _r.queue)
+ new NavClassMenuElement(_isolate, _instance.clazz!, queue: _r.queue)
.element,
navMenu('instance'),
(new NavRefreshElement(queue: _r.queue)
@@ -224,8 +225,8 @@
if (_instance.kind == M.InstanceKind.string) {
members.add(member(
'value as literal',
- Utils.formatStringAsLiteral(
- _instance.valueAsString, _instance.valueAsStringIsTruncated)));
+ Utils.formatStringAsLiteral(_instance.valueAsString!,
+ _instance.valueAsStringIsTruncated!)));
} else {
members.add(member('value', _instance.valueAsString));
}
@@ -233,7 +234,7 @@
if (_instance.typeClass != null) {
members.add(member('type class', _instance.typeClass));
}
- if (_typeArguments != null && _typeArguments.types.isNotEmpty) {
+ if (_typeArguments != null && _typeArguments!.types!.isNotEmpty) {
members.add(new DivElement()
..classes = ['memberItem']
..children = <Element>[
@@ -243,7 +244,7 @@
new DivElement()
..classes = ['memberValue']
..children = ([new SpanElement()..text = '< ']
- ..addAll(_typeArguments.types.expand((type) => [
+ ..addAll(_typeArguments!.types!.expand((type) => [
new InstanceRefElement(_isolate, type, _objects,
queue: _r.queue)
.element,
@@ -272,7 +273,7 @@
members.add(member('closure context', _instance.closureContext));
}
if (_instance.kind == M.InstanceKind.closure) {
- ButtonElement btn;
+ late ButtonElement btn;
members.add(new DivElement()
..classes = ['memberItem']
..children = <Element>[
@@ -294,24 +295,24 @@
]);
}
- if (_instance.nativeFields != null && _instance.nativeFields.isNotEmpty) {
+ if (_instance.nativeFields != null && _instance.nativeFields!.isNotEmpty) {
int i = 0;
members.add(new DivElement()
..classes = ['memberItem']
..children = <Element>[
new DivElement()
..classes = ['memberName']
- ..text = 'native fields (${_instance.nativeFields.length})',
+ ..text = 'native fields (${_instance.nativeFields!.length})',
new DivElement()
..classes = ['memberName']
..children = <Element>[
(new CurlyBlockElement(
- expanded: _instance.nativeFields.length <= 100,
+ expanded: _instance.nativeFields!.length <= 100,
queue: _r.queue)
..content = <Element>[
new DivElement()
..classes = ['memberList']
- ..children = _instance.nativeFields
+ ..children = _instance.nativeFields!
.map<Element>(
(f) => member('[ ${i++} ]', '[ ${f.value} ]'))
.toList()
@@ -321,8 +322,8 @@
]);
}
- if (_instance.fields != null && _instance.fields.isNotEmpty) {
- final fields = _instance.fields.toList();
+ if (_instance.fields != null && _instance.fields!.isNotEmpty) {
+ final fields = _instance.fields!.toList();
members.add(new DivElement()
..classes = ['memberItem']
..children = <Element>[
@@ -346,8 +347,8 @@
]);
}
- if (_instance.elements != null && _instance.elements.isNotEmpty) {
- final elements = _instance.elements.toList();
+ if (_instance.elements != null && _instance.elements!.isNotEmpty) {
+ final elements = _instance.elements!.toList();
int i = 0;
members.add(new DivElement()
..classes = ['memberItem']
@@ -373,12 +374,12 @@
]);
if (_instance.length != elements.length) {
members.add(member(
- '...', '${_instance.length - elements.length} omitted elements'));
+ '...', '${_instance.length! - elements.length} omitted elements'));
}
}
- if (_instance.associations != null && _instance.associations.isNotEmpty) {
- final associations = _instance.associations.toList();
+ if (_instance.associations != null && _instance.associations!.isNotEmpty) {
+ final associations = _instance.associations!.toList();
members.add(new DivElement()
..classes = ['memberItem']
..children = <Element>[
@@ -419,12 +420,13 @@
]);
if (_instance.length != associations.length) {
members.add(member('...',
- '${_instance.length - associations.length} omitted elements'));
+ '${_instance.length! - associations.length} omitted elements'));
}
}
- if (_instance.typedElements != null && _instance.typedElements.isNotEmpty) {
- final typedElements = _instance.typedElements.toList();
+ if (_instance.typedElements != null &&
+ _instance.typedElements!.isNotEmpty) {
+ final typedElements = _instance.typedElements!.toList();
int i = 0;
members.add(new DivElement()
..classes = ['memberItem']
@@ -449,15 +451,15 @@
]);
if (_instance.length != typedElements.length) {
members.add(member('...',
- '${_instance.length - typedElements.length} omitted elements'));
+ '${_instance.length! - typedElements.length} omitted elements'));
}
}
if (_instance.kind == M.InstanceKind.regExp) {
members.add(member('pattern', _instance.pattern));
members.add(
- member('isCaseSensitive', _instance.isCaseSensitive ? 'yes' : 'no'));
- members.add(member('isMultiLine', _instance.isMultiLine ? 'yes' : 'no'));
+ member('isCaseSensitive', _instance.isCaseSensitive! ? 'yes' : 'no'));
+ members.add(member('isMultiLine', _instance.isMultiLine! ? 'yes' : 'no'));
if (_instance.oneByteFunction != null) {
members.add(member('oneByteFunction', _instance.oneByteFunction));
}
@@ -493,25 +495,26 @@
}
Future _refresh() async {
- _instance = await _objects.get(_isolate, _instance.id);
+ _instance = await _objects.get(_isolate, _instance.id!) as M.Instance;
await _loadExtraData();
_r.dirty();
}
Future _loadExtraData() async {
- _library = (await _classes.get(_isolate, _instance.clazz.id)).library;
+ _library = (await _classes.get(_isolate, _instance.clazz!.id!)).library!;
if (_instance.typeArguments != null) {
_typeArguments =
- await _arguments.get(_isolate, _instance.typeArguments.id);
+ await _arguments.get(_isolate, _instance.typeArguments!.id!);
} else {
_typeArguments = null;
}
if (_instance.closureFunction != null) {
- _location = (await _functions.get(_isolate, _instance.closureFunction.id))
- .location;
+ _location =
+ (await _functions.get(_isolate, _instance.closureFunction!.id!))
+ .location;
} else if (_instance.typeClass != null) {
_location =
- (await _classes.get(_isolate, _instance.typeClass.id)).location;
+ (await _classes.get(_isolate, _instance.typeClass!.id!)).location;
}
_r.dirty();
}
@@ -520,7 +523,7 @@
if (_instance.activationBreakpoint == null) {
await _breakpoints.addOnActivation(_isolate, _instance);
} else {
- await _breakpoints.remove(_isolate, _instance.activationBreakpoint);
+ await _breakpoints.remove(_isolate, _instance.activationBreakpoint!);
}
await _refresh();
}
diff --git a/runtime/observatory/lib/src/elements/isolate/counter_chart.dart b/runtime/observatory/lib/src/elements/isolate/counter_chart.dart
index 4d25105..095db10 100644
--- a/runtime/observatory/lib/src/elements/isolate/counter_chart.dart
+++ b/runtime/observatory/lib/src/elements/isolate/counter_chart.dart
@@ -8,15 +8,15 @@
import 'package:observatory/src/elements/helpers/custom_element.dart';
class IsolateCounterChartElement extends CustomElement implements Renderable {
- RenderingScheduler<IsolateCounterChartElement> _r;
+ late RenderingScheduler<IsolateCounterChartElement> _r;
Stream<RenderedEvent<IsolateCounterChartElement>> get onRendered =>
_r.onRendered;
- Map _counters;
- StreamSubscription _subscription;
+ late Map _counters;
+ late StreamSubscription _subscription;
- factory IsolateCounterChartElement(Map counters, {RenderingQueue queue}) {
+ factory IsolateCounterChartElement(Map counters, {RenderingQueue? queue}) {
assert(counters != null);
IsolateCounterChartElement e = new IsolateCounterChartElement.created();
e._r = new RenderingScheduler<IsolateCounterChartElement>(e, queue: queue);
diff --git a/runtime/observatory/lib/src/elements/isolate/location.dart b/runtime/observatory/lib/src/elements/isolate/location.dart
index 5aa7f89..7dce5c9 100644
--- a/runtime/observatory/lib/src/elements/isolate/location.dart
+++ b/runtime/observatory/lib/src/elements/isolate/location.dart
@@ -11,19 +11,19 @@
import 'package:observatory/src/elements/source_link.dart';
class IsolateLocationElement extends CustomElement implements Renderable {
- RenderingScheduler<IsolateLocationElement> _r;
+ late RenderingScheduler<IsolateLocationElement> _r;
Stream<RenderedEvent<IsolateLocationElement>> get onRendered => _r.onRendered;
- M.Isolate _isolate;
- M.EventRepository _events;
- M.ScriptRepository _scripts;
- StreamSubscription _debugSubscription;
- StreamSubscription _isolateSubscription;
+ late M.Isolate _isolate;
+ late M.EventRepository _events;
+ late M.ScriptRepository _scripts;
+ late StreamSubscription _debugSubscription;
+ late StreamSubscription _isolateSubscription;
factory IsolateLocationElement(
M.Isolate isolate, M.EventRepository events, M.ScriptRepository scripts,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(events != null);
assert(scripts != null);
@@ -63,12 +63,12 @@
children = <Element>[
new SpanElement()..text = 'at ',
new FunctionRefElement(
- _isolate, M.topFrame(_isolate.pauseEvent).function,
+ _isolate, M.topFrame(_isolate.pauseEvent)!.function!,
queue: _r.queue)
.element,
new SpanElement()..text = ' (',
- new SourceLinkElement(
- _isolate, M.topFrame(_isolate.pauseEvent).location, _scripts,
+ new SourceLinkElement(_isolate,
+ M.topFrame(_isolate.pauseEvent)!.location!, _scripts,
queue: _r.queue)
.element,
new SpanElement()..text = ') '
@@ -92,12 +92,12 @@
content.addAll([
new SpanElement()..text = ' at ',
new FunctionRefElement(
- _isolate, M.topFrame(_isolate.pauseEvent).function,
+ _isolate, M.topFrame(_isolate.pauseEvent)!.function!,
queue: _r.queue)
.element,
new SpanElement()..text = ' (',
new SourceLinkElement(_isolate,
- M.topFrame(_isolate.pauseEvent).location, _scripts,
+ M.topFrame(_isolate.pauseEvent)!.location!, _scripts,
queue: _r.queue)
.element,
new SpanElement()..text = ') '
diff --git a/runtime/observatory/lib/src/elements/isolate/run_state.dart b/runtime/observatory/lib/src/elements/isolate/run_state.dart
index 3576a4b..e1b6c13 100644
--- a/runtime/observatory/lib/src/elements/isolate/run_state.dart
+++ b/runtime/observatory/lib/src/elements/isolate/run_state.dart
@@ -9,17 +9,17 @@
import 'package:observatory/src/elements/helpers/custom_element.dart';
class IsolateRunStateElement extends CustomElement implements Renderable {
- RenderingScheduler<IsolateRunStateElement> _r;
+ late RenderingScheduler<IsolateRunStateElement> _r;
Stream<RenderedEvent<IsolateRunStateElement>> get onRendered => _r.onRendered;
- M.Isolate _isolate;
- M.EventRepository _events;
- StreamSubscription _debugSubscription;
- StreamSubscription _isolateSubscription;
+ late M.Isolate _isolate;
+ late M.EventRepository _events;
+ late StreamSubscription _debugSubscription;
+ late StreamSubscription _isolateSubscription;
factory IsolateRunStateElement(M.Isolate isolate, M.EventRepository events,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(events != null);
IsolateRunStateElement e = new IsolateRunStateElement.created();
@@ -62,7 +62,7 @@
case M.IsolateStatus.paused:
children = <Element>[
new SpanElement()
- ..title = '${_isolate.pauseEvent.timestamp}'
+ ..title = '${_isolate.pauseEvent!.timestamp}'
..text = 'paused '
];
break;
diff --git a/runtime/observatory/lib/src/elements/isolate/shared_summary.dart b/runtime/observatory/lib/src/elements/isolate/shared_summary.dart
index 7823a1d..36a3e54 100644
--- a/runtime/observatory/lib/src/elements/isolate/shared_summary.dart
+++ b/runtime/observatory/lib/src/elements/isolate/shared_summary.dart
@@ -12,18 +12,18 @@
import 'package:observatory/src/elements/isolate/counter_chart.dart';
class IsolateSharedSummaryElement extends CustomElement implements Renderable {
- RenderingScheduler<IsolateSharedSummaryElement> _r;
+ late RenderingScheduler<IsolateSharedSummaryElement> _r;
Stream<RenderedEvent<IsolateSharedSummaryElement>> get onRendered =>
_r.onRendered;
- M.Isolate _isolate;
- M.EventRepository _events;
- StreamSubscription _isolateSubscription;
+ late M.Isolate _isolate;
+ late M.EventRepository _events;
+ late StreamSubscription _isolateSubscription;
factory IsolateSharedSummaryElement(
M.Isolate isolate, M.EventRepository events,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(events != null);
IsolateSharedSummaryElement e = new IsolateSharedSummaryElement.created();
@@ -52,10 +52,10 @@
}
void render() {
- final newHeapUsed = Utils.formatSize(_isolate.newSpace.used);
- final newHeapCapacity = Utils.formatSize(_isolate.newSpace.capacity);
- final oldHeapUsed = Utils.formatSize(_isolate.oldSpace.used);
- final oldHeapCapacity = Utils.formatSize(_isolate.oldSpace.capacity);
+ final newHeapUsed = Utils.formatSize(_isolate.newSpace!.used);
+ final newHeapCapacity = Utils.formatSize(_isolate.newSpace!.capacity);
+ final oldHeapUsed = Utils.formatSize(_isolate.oldSpace!.used);
+ final oldHeapCapacity = Utils.formatSize(_isolate.oldSpace!.capacity);
final content = <Element>[
new DivElement()
..classes = ['menu']
@@ -148,13 +148,14 @@
new AnchorElement(href: Uris.logging(_isolate))..text = 'logging'
]
],
- new IsolateCounterChartElement(_isolate.counters, queue: _r.queue).element
+ new IsolateCounterChartElement(_isolate.counters!, queue: _r.queue)
+ .element
];
if (_isolate.error != null) {
children = <Element>[
new PreElement()
..classes = ['errorBox']
- ..text = _isolate.error.message,
+ ..text = _isolate.error!.message,
new DivElement()
..classes = ['summary']
..children = content
diff --git a/runtime/observatory/lib/src/elements/isolate/summary.dart b/runtime/observatory/lib/src/elements/isolate/summary.dart
index 78eb1f8..00cf8f0 100644
--- a/runtime/observatory/lib/src/elements/isolate/summary.dart
+++ b/runtime/observatory/lib/src/elements/isolate/summary.dart
@@ -15,22 +15,22 @@
import 'package:observatory/src/elements/isolate/shared_summary.dart';
class IsolateSummaryElement extends CustomElement implements Renderable {
- RenderingScheduler<IsolateSummaryElement> _r;
+ late RenderingScheduler<IsolateSummaryElement> _r;
Stream<RenderedEvent<IsolateSummaryElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.IsolateRepository _isolates;
- M.ScriptRepository _scripts;
- M.Isolate _loadedIsolate;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.IsolateRepository _isolates;
+ late M.ScriptRepository _scripts;
+ M.Isolate? _loadedIsolate;
factory IsolateSummaryElement(
M.IsolateRef isolate,
M.IsolateRepository isolates,
M.EventRepository events,
M.ScriptRepository scripts,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(isolates != null);
assert(events != null);
@@ -90,9 +90,10 @@
new DivElement()
..classes = ['flex-row', 'isolate-state-container']
..children = <Element>[
- new IsolateRunStateElement(_isolate, _events, queue: _r.queue)
+ new IsolateRunStateElement(_isolate as M.Isolate, _events,
+ queue: _r.queue)
.element,
- new IsolateLocationElement(_isolate, _events, _scripts,
+ new IsolateLocationElement(_isolate as M.Isolate, _events, _scripts,
queue: _r.queue)
.element,
new SpanElement()..text = ' [',
@@ -104,14 +105,14 @@
Element memoryRow() {
final isolate = _isolate as M.Isolate;
- final newHeapUsed = Utils.formatSize(isolate.newSpace.used);
- final newHeapCapacity = Utils.formatSize(isolate.newSpace.capacity);
- final oldHeapUsed = Utils.formatSize(isolate.oldSpace.used);
- final oldHeapCapacity = Utils.formatSize(isolate.oldSpace.capacity);
+ final newHeapUsed = Utils.formatSize(isolate.newSpace!.used);
+ final newHeapCapacity = Utils.formatSize(isolate.newSpace!.capacity);
+ final oldHeapUsed = Utils.formatSize(isolate.oldSpace!.used);
+ final oldHeapCapacity = Utils.formatSize(isolate.oldSpace!.capacity);
final heapUsed =
- Utils.formatSize(isolate.newSpace.used + isolate.oldSpace.used);
- final heapCapacity =
- Utils.formatSize(isolate.newSpace.capacity + isolate.oldSpace.capacity);
+ Utils.formatSize(isolate.newSpace!.used + isolate.oldSpace!.used);
+ final heapCapacity = Utils.formatSize(
+ isolate.newSpace!.capacity + isolate.oldSpace!.capacity);
return new DivElement()
..classes = ['flex-row-wrap-right']
..children = <Element>[
diff --git a/runtime/observatory/lib/src/elements/isolate_reconnect.dart b/runtime/observatory/lib/src/elements/isolate_reconnect.dart
index e6369b1..c6a02f9 100644
--- a/runtime/observatory/lib/src/elements/isolate_reconnect.dart
+++ b/runtime/observatory/lib/src/elements/isolate_reconnect.dart
@@ -16,25 +16,25 @@
import 'package:observatory/src/elements/view_footer.dart';
class IsolateReconnectElement extends CustomElement implements Renderable {
- RenderingScheduler<IsolateReconnectElement> _r;
+ late RenderingScheduler<IsolateReconnectElement> _r;
Stream<RenderedEvent<IsolateReconnectElement>> get onRendered =>
_r.onRendered;
- M.VM _vm;
- String _missing;
- Uri _uri;
- M.EventRepository _events;
- StreamSubscription _subscription;
+ late M.VM _vm;
+ late String _missing;
+ late Uri _uri;
+ late M.EventRepository _events;
+ late StreamSubscription _subscription;
M.VM get vm => _vm;
String get missing => _missing;
Uri get uri => _uri;
- M.NotificationRepository _notifications;
+ late M.NotificationRepository _notifications;
factory IsolateReconnectElement(M.VM vm, M.EventRepository events,
M.NotificationRepository notifications, String missing, Uri uri,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(events != null);
assert(missing != null);
@@ -56,7 +56,7 @@
void attached() {
super.attached();
_subscription = _events.onVMUpdate.listen((e) {
- _vm = e.vm;
+ _vm = e.vm as M.VM;
_r.dirty();
});
_r.enable();
diff --git a/runtime/observatory/lib/src/elements/isolate_ref.dart b/runtime/observatory/lib/src/elements/isolate_ref.dart
index 344f4b6..a7eb1b6 100644
--- a/runtime/observatory/lib/src/elements/isolate_ref.dart
+++ b/runtime/observatory/lib/src/elements/isolate_ref.dart
@@ -12,18 +12,18 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class IsolateRefElement extends CustomElement implements Renderable {
- RenderingScheduler<IsolateRefElement> _r;
+ late RenderingScheduler<IsolateRefElement> _r;
Stream<RenderedEvent<IsolateRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- StreamSubscription _updatesSubscription;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late StreamSubscription _updatesSubscription;
M.IsolateRef get isolate => _isolate;
factory IsolateRefElement(M.IsolateRef isolate, M.EventRepository events,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(events != null);
IsolateRefElement e = new IsolateRefElement.created();
@@ -56,7 +56,7 @@
}
void render() {
- final isolateType = isolate.isSystemIsolate ? 'System Isolate' : 'Isolate';
+ final isolateType = isolate.isSystemIsolate! ? 'System Isolate' : 'Isolate';
children = <Element>[
new AnchorElement(href: Uris.inspect(isolate))
..text = '$isolateType ${isolate.number} (${isolate.name})'
diff --git a/runtime/observatory/lib/src/elements/isolate_view.dart b/runtime/observatory/lib/src/elements/isolate_view.dart
index 4a3f0b7..73377da 100644
--- a/runtime/observatory/lib/src/elements/isolate_view.dart
+++ b/runtime/observatory/lib/src/elements/isolate_view.dart
@@ -31,23 +31,23 @@
import 'package:observatory/utils.dart';
class IsolateViewElement extends CustomElement implements Renderable {
- RenderingScheduler<IsolateViewElement> _r;
+ late RenderingScheduler<IsolateViewElement> _r;
Stream<RenderedEvent<IsolateViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.Isolate _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.IsolateRepository _isolates;
- M.ScriptRepository _scripts;
- M.FunctionRepository _functions;
- M.LibraryRepository _libraries;
- M.ObjectRepository _objects;
- M.EvalRepository _eval;
- M.ServiceFunction _function;
- M.ScriptRef _rootScript;
- StreamSubscription _subscription;
+ late M.VM _vm;
+ late M.Isolate _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.IsolateRepository _isolates;
+ late M.ScriptRepository _scripts;
+ late M.FunctionRepository _functions;
+ late M.LibraryRepository _libraries;
+ late M.ObjectRepository _objects;
+ late M.EvalRepository _eval;
+ M.ServiceFunction? _function;
+ M.ScriptRef? _rootScript;
+ late StreamSubscription _subscription;
M.VMRef get vm => _vm;
M.Isolate get isolate => _isolate;
@@ -64,7 +64,7 @@
M.LibraryRepository libraries,
M.ObjectRepository objects,
M.EvalRepository eval,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -114,9 +114,9 @@
}
void render() {
- final uptime = new DateTime.now().difference(_isolate.startTime);
- final libraries = _isolate.libraries.toList();
- final List<M.Thread> threads = _isolate.threads;
+ final uptime = new DateTime.now().difference(_isolate.startTime!);
+ final libraries = _isolate.libraries!.toList();
+ final List<M.Thread> threads = _isolate.threads!.toList();
children = <Element>[
navBar(<Element>[
new NavTopMenuElement(queue: _r.queue).element,
@@ -165,11 +165,11 @@
..children = _function != null
? [
new BRElement(),
- (new SourceInsetElement(_isolate, _function.location,
+ (new SourceInsetElement(_isolate, _function!.location!,
_scripts, _objects, _events,
currentPos: M
- .topFrame(isolate.pauseEvent)
- .location
+ .topFrame(isolate.pauseEvent)!
+ .location!
.tokenPos,
queue: _r.queue)
..classes = ['header_inset'])
@@ -215,7 +215,7 @@
_isolate.rootLibrary == null
? (new SpanElement()..text = 'loading...')
: new LibraryRefElement(
- _isolate, _isolate.rootLibrary,
+ _isolate, _isolate.rootLibrary!,
queue: _r.queue)
.element
]
@@ -230,7 +230,7 @@
new DivElement()
..classes = ['memberValue']
..children = <Element>[
- new FunctionRefElement(_isolate, _isolate.entry,
+ new FunctionRefElement(_isolate, _isolate.entry!,
queue: _r.queue)
.element
]
@@ -341,7 +341,7 @@
]
],
new HRElement(),
- new EvalBoxElement(_isolate, _isolate.rootLibrary, _objects, _eval,
+ new EvalBoxElement(_isolate, _isolate.rootLibrary!, _objects, _eval,
queue: _r.queue)
.element,
new DivElement()
@@ -349,7 +349,7 @@
? [
new HRElement(),
new ScriptInsetElement(
- _isolate, _rootScript, _scripts, _objects, _events,
+ _isolate, _rootScript!, _scripts, _objects, _events,
queue: _r.queue)
.element
]
@@ -390,11 +390,11 @@
_rootScript = null;
final frame = M.topFrame(_isolate.pauseEvent);
if (frame != null) {
- _function = await _functions.get(_isolate, frame.function.id);
+ _function = await _functions.get(_isolate, frame.function!.id!);
}
if (_isolate.rootLibrary != null) {
final rootLibrary =
- await _libraries.get(_isolate, _isolate.rootLibrary.id);
+ await _libraries.get(_isolate, _isolate.rootLibrary!.id!);
_rootScript = rootLibrary.rootScript;
}
_r.dirty();
diff --git a/runtime/observatory/lib/src/elements/json_view.dart b/runtime/observatory/lib/src/elements/json_view.dart
index 194e759..9e59278 100644
--- a/runtime/observatory/lib/src/elements/json_view.dart
+++ b/runtime/observatory/lib/src/elements/json_view.dart
@@ -15,18 +15,18 @@
import 'package:observatory/src/elements/view_footer.dart';
class JSONViewElement extends CustomElement implements Renderable {
- RenderingScheduler<JSONViewElement> _r;
+ late RenderingScheduler<JSONViewElement> _r;
Stream<RenderedEvent<JSONViewElement>> get onRendered => _r.onRendered;
- M.NotificationRepository _notifications;
- Map _map;
+ late M.NotificationRepository _notifications;
+ late Map _map;
M.NotificationRepository get notifications => _notifications;
Map get map => _map;
factory JSONViewElement(Map map, M.NotificationRepository notifications,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(notifications != null);
assert(map != null);
JSONViewElement e = new JSONViewElement.created();
diff --git a/runtime/observatory/lib/src/elements/library_ref.dart b/runtime/observatory/lib/src/elements/library_ref.dart
index 7d5047d..591d56c 100644
--- a/runtime/observatory/lib/src/elements/library_ref.dart
+++ b/runtime/observatory/lib/src/elements/library_ref.dart
@@ -12,18 +12,18 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class LibraryRefElement extends CustomElement implements Renderable {
- RenderingScheduler<LibraryRefElement> _r;
+ late RenderingScheduler<LibraryRefElement> _r;
Stream<RenderedEvent<LibraryRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.LibraryRef _library;
+ late M.IsolateRef _isolate;
+ late M.LibraryRef _library;
M.IsolateRef get isolate => _isolate;
M.LibraryRef get library => _library;
factory LibraryRefElement(M.IsolateRef isolate, M.LibraryRef library,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(library != null);
LibraryRefElement e = new LibraryRefElement.created();
diff --git a/runtime/observatory/lib/src/elements/library_view.dart b/runtime/observatory/lib/src/elements/library_view.dart
index 7974dba..849eaba 100644
--- a/runtime/observatory/lib/src/elements/library_view.dart
+++ b/runtime/observatory/lib/src/elements/library_view.dart
@@ -29,25 +29,25 @@
import 'package:observatory/src/elements/view_footer.dart';
class LibraryViewElement extends CustomElement implements Renderable {
- RenderingScheduler<LibraryViewElement> _r;
+ late RenderingScheduler<LibraryViewElement> _r;
Stream<RenderedEvent<LibraryViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.Library _library;
- M.LibraryRepository _libraries;
- M.FieldRepository _fields;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ScriptRepository _scripts;
- M.ObjectRepository _objects;
- M.EvalRepository _eval;
- Iterable<M.Field> _variables;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.Library _library;
+ late M.LibraryRepository _libraries;
+ late M.FieldRepository _fields;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ScriptRepository _scripts;
+ late M.ObjectRepository _objects;
+ late M.EvalRepository _eval;
+ Iterable<M.Field>? _variables;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -69,7 +69,7 @@
M.ScriptRepository scripts,
M.ObjectRepository objects,
M.EvalRepository eval,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -197,19 +197,19 @@
}
Future _refresh() async {
- _library = await _libraries.get(_isolate, _library.id);
+ _library = await _libraries.get(_isolate, _library.id!);
_variables = null;
_r.dirty();
_variables = await Future.wait(
- _library.variables.map((field) => _fields.get(_isolate, field.id)));
+ _library.variables!.map((field) => _fields.get(_isolate, field.id!)));
_r.dirty();
}
Element _createDependencies() {
- if (_library.dependencies.isEmpty) {
+ if (_library.dependencies!.isEmpty) {
return new SpanElement();
}
- final dependencies = _library.dependencies.toList();
+ final dependencies = _library.dependencies!.toList();
return new DivElement()
..children = <Element>[
new SpanElement()..text = 'dependencies (${dependencies.length}) ',
@@ -232,10 +232,10 @@
}
Element _createScripts() {
- if (_library.scripts.isEmpty) {
+ if (_library.scripts!.isEmpty) {
return new SpanElement();
}
- final scripts = _library.scripts.toList();
+ final scripts = _library.scripts!.toList();
return new DivElement()
..children = <Element>[
new SpanElement()..text = 'scripts (${scripts.length}) ',
@@ -252,10 +252,10 @@
}
Element _createClasses() {
- if (_library.classes.isEmpty) {
+ if (_library.classes!.isEmpty) {
return new SpanElement();
}
- final classes = _library.classes.toList();
+ final classes = _library.classes!.toList();
return new DivElement()
..children = <Element>[
new SpanElement()..text = 'classes (${classes.length}) ',
@@ -272,10 +272,10 @@
}
Element _createVariables() {
- if (_library.variables.isEmpty) {
+ if (_library.variables!.isEmpty) {
return new SpanElement();
}
- final variables = _library.variables.toList();
+ final variables = _library.variables!.toList();
return new DivElement()
..children = <Element>[
new SpanElement()..text = 'variables (${variables.length}) ',
@@ -285,7 +285,7 @@
? (new SpanElement()..text = 'loading...')
: (new DivElement()
..classes = ['indent', 'memberList']
- ..children = _variables
+ ..children = _variables!
.map<Element>((f) => new DivElement()
..classes = ['memberItem']
..children = <Element>[
@@ -311,10 +311,10 @@
}
Element _createFunctions() {
- if (_library.functions.isEmpty) {
+ if (_library.functions!.isEmpty) {
return new SpanElement();
}
- final functions = _library.functions.toList();
+ final functions = _library.functions!.toList();
return new DivElement()
..children = <Element>[
new SpanElement()..text = 'functions (${functions.length}) ',
diff --git a/runtime/observatory/lib/src/elements/local_var_descriptors_ref.dart b/runtime/observatory/lib/src/elements/local_var_descriptors_ref.dart
index 6a0cbe7..b168181 100644
--- a/runtime/observatory/lib/src/elements/local_var_descriptors_ref.dart
+++ b/runtime/observatory/lib/src/elements/local_var_descriptors_ref.dart
@@ -12,20 +12,20 @@
class LocalVarDescriptorsRefElement extends CustomElement
implements Renderable {
- RenderingScheduler<LocalVarDescriptorsRefElement> _r;
+ late RenderingScheduler<LocalVarDescriptorsRefElement> _r;
Stream<RenderedEvent<LocalVarDescriptorsRefElement>> get onRendered =>
_r.onRendered;
- M.IsolateRef _isolate;
- M.LocalVarDescriptorsRef _localVar;
+ late M.IsolateRef _isolate;
+ late M.LocalVarDescriptorsRef _localVar;
M.IsolateRef get isolate => _isolate;
M.LocalVarDescriptorsRef get localVar => _localVar;
factory LocalVarDescriptorsRefElement(
M.IsolateRef isolate, M.LocalVarDescriptorsRef localVar,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(localVar != null);
LocalVarDescriptorsRefElement e =
diff --git a/runtime/observatory/lib/src/elements/logging.dart b/runtime/observatory/lib/src/elements/logging.dart
index 416fcba..349401d 100644
--- a/runtime/observatory/lib/src/elements/logging.dart
+++ b/runtime/observatory/lib/src/elements/logging.dart
@@ -22,15 +22,15 @@
import 'package:observatory/src/elements/view_footer.dart';
class LoggingPageElement extends CustomElement implements Renderable {
- RenderingScheduler<LoggingPageElement> _r;
+ late RenderingScheduler<LoggingPageElement> _r;
Stream<RenderedEvent<LoggingPageElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- Level _level = Level.ALL;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late Level _level = Level.ALL;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -38,7 +38,7 @@
factory LoggingPageElement(M.VM vm, M.IsolateRef isolate,
M.EventRepository events, M.NotificationRepository notifications,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -67,11 +67,11 @@
children = <Element>[];
}
- LoggingListElement _logs;
+ LoggingListElement? _logs;
void render() {
_logs = _logs ?? new LoggingListElement(_isolate, _events);
- _logs.level = _level;
+ _logs!.level = _level;
children = <Element>[
navBar(<Element>[
new NavTopMenuElement(queue: _r.queue).element,
@@ -94,7 +94,7 @@
new SpanElement()..text = 'Show messages with severity ',
_createLevelSelector(),
new HRElement(),
- _logs.element
+ _logs!.element
]
];
}
@@ -107,7 +107,7 @@
..text = level.name;
}).toList(growable: false);
s.onChange.listen((_) {
- _level = Level.LEVELS[s.selectedIndex];
+ _level = Level.LEVELS[s.selectedIndex!];
_r.dirty();
});
return s;
diff --git a/runtime/observatory/lib/src/elements/logging_list.dart b/runtime/observatory/lib/src/elements/logging_list.dart
index 7984766..ed3479b 100644
--- a/runtime/observatory/lib/src/elements/logging_list.dart
+++ b/runtime/observatory/lib/src/elements/logging_list.dart
@@ -11,13 +11,13 @@
import 'package:observatory/utils.dart';
class LoggingListElement extends CustomElement implements Renderable {
- RenderingScheduler<LoggingListElement> _r;
+ late RenderingScheduler<LoggingListElement> _r;
Stream<RenderedEvent<LoggingListElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- StreamSubscription _subscription;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late StreamSubscription _subscription;
Level _level = Level.ALL;
final _logs = <Map>[];
@@ -27,7 +27,7 @@
set level(Level value) => _level = _r.checkAndReact(_level, value);
factory LoggingListElement(M.IsolateRef isolate, M.EventRepository events,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(events != null);
LoggingListElement e = new LoggingListElement.created();
diff --git a/runtime/observatory/lib/src/elements/megamorphiccache_ref.dart b/runtime/observatory/lib/src/elements/megamorphiccache_ref.dart
index bcb4c3e..122711e 100644
--- a/runtime/observatory/lib/src/elements/megamorphiccache_ref.dart
+++ b/runtime/observatory/lib/src/elements/megamorphiccache_ref.dart
@@ -11,20 +11,20 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class MegamorphicCacheRefElement extends CustomElement implements Renderable {
- RenderingScheduler<MegamorphicCacheRefElement> _r;
+ late RenderingScheduler<MegamorphicCacheRefElement> _r;
Stream<RenderedEvent<MegamorphicCacheRefElement>> get onRendered =>
_r.onRendered;
- M.IsolateRef _isolate;
- M.MegamorphicCacheRef _cache;
+ late M.IsolateRef _isolate;
+ late M.MegamorphicCacheRef _cache;
M.IsolateRef get isolate => _isolate;
M.MegamorphicCacheRef get cache => _cache;
factory MegamorphicCacheRefElement(
M.IsolateRef isolate, M.MegamorphicCacheRef cache,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(cache != null);
MegamorphicCacheRefElement e = new MegamorphicCacheRefElement.created();
diff --git a/runtime/observatory/lib/src/elements/megamorphiccache_view.dart b/runtime/observatory/lib/src/elements/megamorphiccache_view.dart
index fb1f262..fab2513 100644
--- a/runtime/observatory/lib/src/elements/megamorphiccache_view.dart
+++ b/runtime/observatory/lib/src/elements/megamorphiccache_view.dart
@@ -23,22 +23,22 @@
import 'package:observatory/src/elements/view_footer.dart';
class MegamorphicCacheViewElement extends CustomElement implements Renderable {
- RenderingScheduler<MegamorphicCacheViewElement> _r;
+ late RenderingScheduler<MegamorphicCacheViewElement> _r;
Stream<RenderedEvent<MegamorphicCacheViewElement>> get onRendered =>
_r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.MegamorphicCache _cache;
- M.MegamorphicCacheRepository _caches;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.MegamorphicCache _cache;
+ late M.MegamorphicCacheRepository _caches;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -57,7 +57,7 @@
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -111,7 +111,7 @@
(new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) async {
e.element.disabled = true;
- _cache = await _caches.get(_isolate, _cache.id);
+ _cache = await _caches.get(_isolate, _cache.id!);
_r.dirty();
}))
.element,
diff --git a/runtime/observatory/lib/src/elements/metric/details.dart b/runtime/observatory/lib/src/elements/metric/details.dart
index 71fd1f0..742465a 100644
--- a/runtime/observatory/lib/src/elements/metric/details.dart
+++ b/runtime/observatory/lib/src/elements/metric/details.dart
@@ -9,20 +9,20 @@
import 'package:observatory/src/elements/helpers/custom_element.dart';
class MetricDetailsElement extends CustomElement implements Renderable {
- RenderingScheduler<MetricDetailsElement> _r;
+ late RenderingScheduler<MetricDetailsElement> _r;
Stream<RenderedEvent<MetricDetailsElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.Metric _metric;
- M.MetricRepository _metrics;
+ late M.IsolateRef _isolate;
+ late M.Metric _metric;
+ late M.MetricRepository _metrics;
M.IsolateRef get isolate => _isolate;
M.Metric get metric => _metric;
factory MetricDetailsElement(
M.IsolateRef isolate, M.Metric metric, M.MetricRepository metrics,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(metric != null);
assert(metrics != null);
diff --git a/runtime/observatory/lib/src/elements/metric/graph.dart b/runtime/observatory/lib/src/elements/metric/graph.dart
index 0b00a160..bb482b2 100644
--- a/runtime/observatory/lib/src/elements/metric/graph.dart
+++ b/runtime/observatory/lib/src/elements/metric/graph.dart
@@ -9,21 +9,21 @@
import 'package:observatory/src/elements/helpers/custom_element.dart';
class MetricGraphElement extends CustomElement implements Renderable {
- RenderingScheduler<MetricGraphElement> _r;
+ late RenderingScheduler<MetricGraphElement> _r;
Stream<RenderedEvent<MetricGraphElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.Metric _metric;
- M.MetricRepository _metrics;
- Timer _timer;
+ late M.IsolateRef _isolate;
+ late M.Metric _metric;
+ late M.MetricRepository _metrics;
+ late Timer _timer;
M.IsolateRef get isolate => _isolate;
M.Metric get metric => _metric;
factory MetricGraphElement(
M.IsolateRef isolate, M.Metric metric, M.MetricRepository metrics,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(metric != null);
assert(metrics != null);
@@ -56,8 +56,8 @@
final min = _metrics.getMinValue(_isolate, _metric);
final max = _metrics.getMaxValue(_isolate, _metric);
final rows = _metrics
- .getSamples(_isolate, _metric)
- .map((s) => [s.time.millisecondsSinceEpoch, s.value])
+ .getSamples(_isolate, _metric)!
+ .map((s) => [s.time!.millisecondsSinceEpoch, s.value])
.toList();
final current = rows.last.last;
diff --git a/runtime/observatory/lib/src/elements/metrics.dart b/runtime/observatory/lib/src/elements/metrics.dart
index 30a9e9c..55c2bb6 100644
--- a/runtime/observatory/lib/src/elements/metrics.dart
+++ b/runtime/observatory/lib/src/elements/metrics.dart
@@ -20,17 +20,17 @@
import 'package:observatory/src/elements/nav/vm_menu.dart';
class MetricsPageElement extends CustomElement implements Renderable {
- RenderingScheduler<MetricsPageElement> _r;
+ late RenderingScheduler<MetricsPageElement> _r;
Stream<RenderedEvent<MetricsPageElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.MetricRepository _metrics;
- List<M.Metric> _available;
- M.Metric _selected;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.MetricRepository _metrics;
+ List<M.Metric>? _available;
+ M.Metric? _selected;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -42,7 +42,7 @@
M.EventRepository events,
M.NotificationRepository notifications,
M.MetricRepository metrics,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -114,7 +114,7 @@
..children = _selected == null
? const []
: [
- new MetricDetailsElement(_isolate, _selected, _metrics,
+ new MetricDetailsElement(_isolate, _selected!, _metrics,
queue: _r.queue)
.element
],
@@ -124,7 +124,7 @@
..children = _selected == null
? const []
: [
- new MetricGraphElement(_isolate, _selected, _metrics,
+ new MetricGraphElement(_isolate, _selected!, _metrics,
queue: _r.queue)
.element
]
@@ -134,8 +134,8 @@
Future _refresh() async {
_available = (await _metrics.list(_isolate)).toList();
- if (!_available.contains(_selected)) {
- _selected = _available.first;
+ if (!_available!.contains(_selected)) {
+ _selected = _available!.first;
}
_r.dirty();
}
@@ -144,14 +144,14 @@
var s;
return [
s = new SelectElement()
- ..value = _selected.name
- ..children = _available.map((metric) {
+ ..value = _selected!.name!
+ ..children = _available!.map((metric) {
return new OptionElement(
- value: metric.name, selected: _selected == metric)
- ..text = metric.name;
+ value: metric.name!, selected: _selected == metric)
+ ..text = metric.name!;
}).toList(growable: false)
..onChange.listen((_) {
- _selected = _available[s.selectedIndex];
+ _selected = _available![s.selectedIndex];
_r.dirty();
})
];
diff --git a/runtime/observatory/lib/src/elements/native_memory_profiler.dart b/runtime/observatory/lib/src/elements/native_memory_profiler.dart
index 8d8b1ac..2289189 100644
--- a/runtime/observatory/lib/src/elements/native_memory_profiler.dart
+++ b/runtime/observatory/lib/src/elements/native_memory_profiler.dart
@@ -21,21 +21,21 @@
import 'package:observatory/src/elements/stack_trace_tree_config.dart';
class NativeMemoryProfileElement extends CustomElement implements Renderable {
- RenderingScheduler<NativeMemoryProfileElement> _r;
+ late RenderingScheduler<NativeMemoryProfileElement> _r;
Stream<RenderedEvent<NativeMemoryProfileElement>> get onRendered =>
_r.onRendered;
- M.VM _vm;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.NativeMemorySampleProfileRepository _profiles;
- Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
- M.SampleProfileLoadingProgress _progress;
- M.SampleProfileTag _tag = M.SampleProfileTag.none;
- ProfileTreeMode _mode = ProfileTreeMode.function;
- M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
- String _filter = '';
+ late M.VM _vm;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.NativeMemorySampleProfileRepository _profiles;
+ Stream<M.SampleProfileLoadingProgressEvent>? _progressStream;
+ M.SampleProfileLoadingProgress? _progress;
+ late M.SampleProfileTag _tag = M.SampleProfileTag.none;
+ late ProfileTreeMode _mode = ProfileTreeMode.function;
+ late M.ProfileTreeDirection _direction = M.ProfileTreeDirection.exclusive;
+ late String _filter = '';
M.NotificationRepository get notifications => _notifications;
M.NativeMemorySampleProfileRepository get profiles => _profiles;
@@ -45,7 +45,7 @@
M.EventRepository events,
M.NotificationRepository notifications,
M.NativeMemorySampleProfileRepository profiles,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(events != null);
assert(notifications != null);
@@ -90,15 +90,16 @@
children = content;
return;
}
- content.add((new SampleBufferControlElement(_vm, _progress, _progressStream,
+ content.add((new SampleBufferControlElement(
+ _vm, _progress!, _progressStream!,
selectedTag: _tag, queue: _r.queue)
..onTagChange.listen((e) {
_tag = e.element.selectedTag;
_request();
}))
.element);
- if (_progress.status == M.SampleProfileLoadingStatus.loaded) {
- CpuProfileVirtualTreeElement tree;
+ if (_progress!.status == M.SampleProfileLoadingStatus.loaded) {
+ late CpuProfileVirtualTreeElement tree;
content.addAll([
new BRElement(),
(new StackTraceTreeConfigElement(
@@ -124,7 +125,7 @@
}))
.element,
new BRElement(),
- (tree = new CpuProfileVirtualTreeElement(null, _progress.profile,
+ (tree = new CpuProfileVirtualTreeElement(null, _progress!.profile,
queue: _r.queue, type: M.SampleProfileType.memory))
.element,
]);
@@ -134,17 +135,17 @@
Future _request({bool forceFetch: false}) async {
if (forceFetch) {
- for (M.Isolate isolate in _vm.isolates) {
+ for (M.IsolateRef isolate in _vm.isolates) {
await isolate.collectAllGarbage();
}
}
_progress = null;
_progressStream = _profiles.get(_vm, _tag, forceFetch: forceFetch);
_r.dirty();
- _progress = (await _progressStream.first).progress;
+ _progress = (await _progressStream!.first).progress;
_r.dirty();
- if (M.isSampleProcessRunning(_progress.status)) {
- _progress = (await _progressStream.last).progress;
+ if (M.isSampleProcessRunning(_progress!.status)) {
+ _progress = (await _progressStream!.last).progress;
_r.dirty();
}
}
diff --git a/runtime/observatory/lib/src/elements/nav/class_menu.dart b/runtime/observatory/lib/src/elements/nav/class_menu.dart
index 8a6992d..3596d3f 100644
--- a/runtime/observatory/lib/src/elements/nav/class_menu.dart
+++ b/runtime/observatory/lib/src/elements/nav/class_menu.dart
@@ -11,17 +11,17 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class NavClassMenuElement extends CustomElement implements Renderable {
- RenderingScheduler<NavClassMenuElement> _r;
+ late RenderingScheduler<NavClassMenuElement> _r;
Stream<RenderedEvent<NavClassMenuElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.ClassRef _cls;
- Iterable<Element> _content = const [];
+ late M.IsolateRef _isolate;
+ late M.ClassRef _cls;
+ List<Element> _content = const [];
M.IsolateRef get isolate => _isolate;
M.ClassRef get cls => _cls;
- Iterable<Element> get content => _content;
+ List<Element> get content => _content;
set content(Iterable<Element> value) {
_content = value.toList();
@@ -29,7 +29,7 @@
}
factory NavClassMenuElement(M.IsolateRef isolate, M.ClassRef cls,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(cls != null);
NavClassMenuElement e = new NavClassMenuElement.created();
@@ -56,7 +56,7 @@
void render() {
children = <Element>[
- navMenu(cls.name,
+ navMenu(cls.name!,
content: _content, link: Uris.inspect(isolate, object: cls))
];
}
diff --git a/runtime/observatory/lib/src/elements/nav/isolate_menu.dart b/runtime/observatory/lib/src/elements/nav/isolate_menu.dart
index 833f975..b3184f4 100644
--- a/runtime/observatory/lib/src/elements/nav/isolate_menu.dart
+++ b/runtime/observatory/lib/src/elements/nav/isolate_menu.dart
@@ -12,14 +12,14 @@
import 'package:observatory/src/elements/nav/menu_item.dart';
class NavIsolateMenuElement extends CustomElement implements Renderable {
- RenderingScheduler<NavIsolateMenuElement> _r;
+ late RenderingScheduler<NavIsolateMenuElement> _r;
Stream<RenderedEvent<NavIsolateMenuElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- StreamSubscription _updatesSubscription;
- Iterable<Element> _content = const [];
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ StreamSubscription? _updatesSubscription;
+ late Iterable<Element> _content = const [];
M.IsolateRef get isolate => _isolate;
Iterable<Element> get content => _content;
@@ -30,7 +30,7 @@
}
factory NavIsolateMenuElement(M.IsolateRef isolate, M.EventRepository events,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(events != null);
NavIsolateMenuElement e = new NavIsolateMenuElement.created();
@@ -60,7 +60,7 @@
children = <Element>[];
_r.disable(notify: true);
assert(_updatesSubscription != null);
- _updatesSubscription.cancel();
+ _updatesSubscription!.cancel();
_updatesSubscription = null;
}
@@ -101,7 +101,7 @@
.element,
]..addAll(_content);
children = <Element>[
- navMenu(isolate.name, content: content, link: Uris.inspect(isolate))
+ navMenu(isolate.name!, content: content, link: Uris.inspect(isolate))
];
}
}
diff --git a/runtime/observatory/lib/src/elements/nav/library_menu.dart b/runtime/observatory/lib/src/elements/nav/library_menu.dart
index e24a5a3..4639fee 100644
--- a/runtime/observatory/lib/src/elements/nav/library_menu.dart
+++ b/runtime/observatory/lib/src/elements/nav/library_menu.dart
@@ -11,17 +11,17 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class NavLibraryMenuElement extends CustomElement implements Renderable {
- RenderingScheduler<NavLibraryMenuElement> _r;
+ late RenderingScheduler<NavLibraryMenuElement> _r;
Stream<RenderedEvent<NavLibraryMenuElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.LibraryRef _library;
- Iterable<Element> _content = const [];
+ late M.IsolateRef _isolate;
+ late M.LibraryRef _library;
+ List<Element> _content = const [];
M.IsolateRef get isolate => _isolate;
M.LibraryRef get library => _library;
- Iterable<Element> get content => _content;
+ List<Element> get content => _content;
set content(Iterable<Element> value) {
_content = value.toList();
@@ -29,7 +29,7 @@
}
factory NavLibraryMenuElement(M.IsolateRef isolate, M.LibraryRef library,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(library != null);
NavLibraryMenuElement e = new NavLibraryMenuElement.created();
@@ -56,7 +56,7 @@
void render() {
children = <Element>[
- navMenu(library.name,
+ navMenu(library.name!,
content: _content,
link: Uris.inspect(isolate, object: library).toString())
];
diff --git a/runtime/observatory/lib/src/elements/nav/menu_item.dart b/runtime/observatory/lib/src/elements/nav/menu_item.dart
index f7b94f6..a6fcd34 100644
--- a/runtime/observatory/lib/src/elements/nav/menu_item.dart
+++ b/runtime/observatory/lib/src/elements/nav/menu_item.dart
@@ -8,17 +8,17 @@
import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
class NavMenuItemElement extends CustomElement implements Renderable {
- RenderingScheduler<NavMenuItemElement> _r;
+ late RenderingScheduler<NavMenuItemElement> _r;
Stream<RenderedEvent<NavMenuItemElement>> get onRendered => _r.onRendered;
- String _label;
- String _link;
- Iterable<Element> _content = const <Element>[];
+ late String _label;
+ late String _link;
+ List<Element> _content = const <Element>[];
String get label => _label;
String get link => _link;
- Iterable<Element> get content => _content;
+ List<Element> get content => _content;
set label(String value) => _label = _r.checkAndReact(_label, value);
set link(String value) => _link = _r.checkAndReact(_link, value);
@@ -28,7 +28,7 @@
}
factory NavMenuItemElement(String label,
- {String link, RenderingQueue queue}) {
+ {String link = '', RenderingQueue? queue}) {
assert(label != null);
NavMenuItemElement e = new NavMenuItemElement.created();
e._r = new RenderingScheduler<NavMenuItemElement>(e, queue: queue);
diff --git a/runtime/observatory/lib/src/elements/nav/notify.dart b/runtime/observatory/lib/src/elements/nav/notify.dart
index 3fc8e64..53d27d0 100644
--- a/runtime/observatory/lib/src/elements/nav/notify.dart
+++ b/runtime/observatory/lib/src/elements/nav/notify.dart
@@ -11,14 +11,14 @@
import 'package:observatory/src/elements/nav/notify_exception.dart';
class NavNotifyElement extends CustomElement implements Renderable {
- RenderingScheduler<NavNotifyElement> _r;
+ late RenderingScheduler<NavNotifyElement> _r;
Stream<RenderedEvent<NavNotifyElement>> get onRendered => _r.onRendered;
- M.NotificationRepository _repository;
- StreamSubscription _subscription;
+ late M.NotificationRepository _repository;
+ StreamSubscription? _subscription;
- bool _notifyOnPause;
+ late bool _notifyOnPause;
bool get notifyOnPause => _notifyOnPause;
@@ -26,7 +26,7 @@
_notifyOnPause = _r.checkAndReact(_notifyOnPause, value);
factory NavNotifyElement(M.NotificationRepository repository,
- {bool notifyOnPause: true, RenderingQueue queue}) {
+ {bool notifyOnPause: true, RenderingQueue? queue}) {
assert(repository != null);
assert(notifyOnPause != null);
NavNotifyElement e = new NavNotifyElement.created();
@@ -50,7 +50,7 @@
super.detached();
children = <Element>[];
_r.disable(notify: true);
- _subscription.cancel();
+ _subscription!.cancel();
}
void render() {
diff --git a/runtime/observatory/lib/src/elements/nav/notify_event.dart b/runtime/observatory/lib/src/elements/nav/notify_event.dart
index 0d39e61..5bda508 100644
--- a/runtime/observatory/lib/src/elements/nav/notify_event.dart
+++ b/runtime/observatory/lib/src/elements/nav/notify_event.dart
@@ -15,7 +15,7 @@
}
class NavNotifyEventElement extends CustomElement implements Renderable {
- RenderingScheduler<NavNotifyEventElement> _r;
+ late RenderingScheduler<NavNotifyEventElement> _r;
Stream<RenderedEvent<NavNotifyEventElement>> get onRendered => _r.onRendered;
@@ -23,11 +23,11 @@
new StreamController<EventDeleteEvent>.broadcast();
Stream<EventDeleteEvent> get onDelete => _onDelete.stream;
- M.Event _event;
+ late M.Event _event;
M.Event get event => _event;
- factory NavNotifyEventElement(M.Event event, {RenderingQueue queue}) {
+ factory NavNotifyEventElement(M.Event event, {RenderingQueue? queue}) {
assert(event != null);
NavNotifyEventElement e = new NavNotifyEventElement.created();
e._r = new RenderingScheduler<NavNotifyEventElement>(e, queue: queue);
@@ -116,7 +116,7 @@
M.PauseBreakpointEvent event) {
String message = ' is paused';
if (event.breakpoint != null) {
- message += ' at breakpoint ${event.breakpoint.number}';
+ message += ' at breakpoint ${event.breakpoint!.number}';
}
return [
new SpanElement()..text = 'Isolate ',
diff --git a/runtime/observatory/lib/src/elements/nav/notify_exception.dart b/runtime/observatory/lib/src/elements/nav/notify_exception.dart
index 6075dcf..13c1d60 100644
--- a/runtime/observatory/lib/src/elements/nav/notify_exception.dart
+++ b/runtime/observatory/lib/src/elements/nav/notify_exception.dart
@@ -11,13 +11,13 @@
class ExceptionDeleteEvent {
final dynamic exception;
- final StackTrace stacktrace;
+ final StackTrace? stacktrace;
ExceptionDeleteEvent(this.exception, {this.stacktrace});
}
class NavNotifyExceptionElement extends CustomElement implements Renderable {
- RenderingScheduler<NavNotifyExceptionElement> _r;
+ late RenderingScheduler<NavNotifyExceptionElement> _r;
Stream<RenderedEvent<NavNotifyExceptionElement>> get onRendered =>
_r.onRendered;
@@ -26,14 +26,14 @@
new StreamController<ExceptionDeleteEvent>.broadcast();
Stream<ExceptionDeleteEvent> get onDelete => _onDelete.stream;
- dynamic _exception;
- StackTrace _stacktrace;
+ late dynamic _exception;
+ StackTrace? _stacktrace;
dynamic get exception => _exception;
- StackTrace get stacktrace => _stacktrace;
+ StackTrace? get stacktrace => _stacktrace;
factory NavNotifyExceptionElement(dynamic exception,
- {StackTrace stacktrace: null, RenderingQueue queue}) {
+ {StackTrace? stacktrace: null, RenderingQueue? queue}) {
assert(exception != null);
NavNotifyExceptionElement e = new NavNotifyExceptionElement.created();
e._r = new RenderingScheduler<NavNotifyExceptionElement>(e, queue: queue);
diff --git a/runtime/observatory/lib/src/elements/nav/refresh.dart b/runtime/observatory/lib/src/elements/nav/refresh.dart
index df71f20..6e51ef4 100644
--- a/runtime/observatory/lib/src/elements/nav/refresh.dart
+++ b/runtime/observatory/lib/src/elements/nav/refresh.dart
@@ -13,7 +13,7 @@
}
class NavRefreshElement extends CustomElement implements Renderable {
- RenderingScheduler<NavRefreshElement> _r;
+ late RenderingScheduler<NavRefreshElement> _r;
Stream<RenderedEvent<NavRefreshElement>> get onRendered => _r.onRendered;
@@ -21,8 +21,8 @@
new StreamController<RefreshEvent>.broadcast();
Stream<RefreshEvent> get onRefresh => _onRefresh.stream;
- bool _disabled;
- String _label;
+ late bool _disabled;
+ late String _label;
bool get disabled => _disabled;
String get label => _label;
@@ -31,7 +31,7 @@
set label(String value) => _label = _r.checkAndReact(_label, value);
factory NavRefreshElement(
- {String label: 'Refresh', bool disabled: false, RenderingQueue queue}) {
+ {String label: 'Refresh', bool disabled: false, RenderingQueue? queue}) {
assert(label != null);
assert(disabled != null);
NavRefreshElement e = new NavRefreshElement.created();
diff --git a/runtime/observatory/lib/src/elements/nav/reload.dart b/runtime/observatory/lib/src/elements/nav/reload.dart
index b17a54b..2400b6c 100644
--- a/runtime/observatory/lib/src/elements/nav/reload.dart
+++ b/runtime/observatory/lib/src/elements/nav/reload.dart
@@ -16,7 +16,7 @@
}
class NavReloadElement extends CustomElement implements Renderable {
- RenderingScheduler<NavReloadElement> _r;
+ late RenderingScheduler<NavReloadElement> _r;
Stream<RenderedEvent<NavReloadElement>> get onRendered => _r.onRendered;
@@ -24,15 +24,15 @@
new StreamController<ReloadEvent>.broadcast();
Stream<ReloadEvent> get onReload => _onReload.stream;
- M.IsolateRef _isolate;
- M.IsolateRepository _isolates;
- M.EventRepository _events;
- StreamSubscription _sub;
+ late M.IsolateRef _isolate;
+ late M.IsolateRepository _isolates;
+ late M.EventRepository _events;
+ StreamSubscription? _sub;
bool _disabled = false;
factory NavReloadElement(M.IsolateRef isolate, M.IsolateRepository isolates,
M.EventRepository events,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(isolates != null);
assert(events != null);
@@ -57,7 +57,7 @@
void detached() {
super.detached();
children = <Element>[];
- _sub.cancel();
+ _sub!.cancel();
_sub = null;
_r.disable(notify: true);
}
@@ -82,13 +82,15 @@
.listen((_) => _reload(_isolates.reloadSourcesServices.single))
]);
} else {
- final content = _isolates.reloadSourcesServices.map((s) => new LIElement()
- ..children = <Element>[
- new ButtonElement()
- ..text = s.alias
- ..disabled = _disabled
- ..onClick.listen((_) => _reload(s))
- ]);
+ final content = _isolates.reloadSourcesServices
+ .map((s) => new LIElement()
+ ..children = <Element>[
+ new ButtonElement()
+ ..text = s.alias
+ ..disabled = _disabled
+ ..onClick.listen((_) => _reload(s))
+ ])
+ .toList();
children.add(navMenu('Reload Source', content: content));
}
this.children = children;
diff --git a/runtime/observatory/lib/src/elements/nav/top_menu.dart b/runtime/observatory/lib/src/elements/nav/top_menu.dart
index f31ef58..a7408a4 100644
--- a/runtime/observatory/lib/src/elements/nav/top_menu.dart
+++ b/runtime/observatory/lib/src/elements/nav/top_menu.dart
@@ -11,7 +11,7 @@
import 'package:observatory/src/elements/nav/menu_item.dart';
class NavTopMenuElement extends CustomElement implements Renderable {
- RenderingScheduler<NavTopMenuElement> _r;
+ late RenderingScheduler<NavTopMenuElement> _r;
Stream<RenderedEvent<NavTopMenuElement>> get onRendered => _r.onRendered;
@@ -24,7 +24,7 @@
_r.dirty();
}
- factory NavTopMenuElement({RenderingQueue queue}) {
+ factory NavTopMenuElement({RenderingQueue? queue}) {
NavTopMenuElement e = new NavTopMenuElement.created();
e._r = new RenderingScheduler<NavTopMenuElement>(e, queue: queue);
return e;
diff --git a/runtime/observatory/lib/src/elements/nav/vm_menu.dart b/runtime/observatory/lib/src/elements/nav/vm_menu.dart
index 6751816..0a454a1 100644
--- a/runtime/observatory/lib/src/elements/nav/vm_menu.dart
+++ b/runtime/observatory/lib/src/elements/nav/vm_menu.dart
@@ -12,13 +12,13 @@
import 'package:observatory/src/elements/nav/menu_item.dart';
class NavVMMenuElement extends CustomElement implements Renderable {
- RenderingScheduler<NavVMMenuElement> _r;
+ late RenderingScheduler<NavVMMenuElement> _r;
Stream<RenderedEvent<NavVMMenuElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.EventRepository _events;
- StreamSubscription _updatesSubscription;
+ late M.VM _vm;
+ late M.EventRepository _events;
+ late StreamSubscription _updatesSubscription;
Iterable<Element> _content = const [];
M.VM get vm => _vm;
@@ -30,7 +30,7 @@
}
factory NavVMMenuElement(M.VM vm, M.EventRepository events,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(events != null);
NavVMMenuElement e = new NavVMMenuElement.created();
@@ -46,7 +46,7 @@
void attached() {
super.attached();
_updatesSubscription = _events.onVMUpdate.listen((e) {
- _vm = e.vm;
+ _vm = e.vm as M.VM;
_r.dirty();
});
_r.enable();
@@ -62,13 +62,13 @@
void render() {
final content = (_vm.isolates.map<Element>((isolate) {
- return new NavMenuItemElement(isolate.name,
+ return new NavMenuItemElement(isolate.name!,
queue: _r.queue, link: Uris.inspect(isolate))
.element;
}).toList()
..addAll(_content));
children = <Element>[
- navMenu(vm.displayName, link: Uris.vm(), content: content)
+ navMenu(vm.displayName!, link: Uris.vm(), content: content)
];
}
}
diff --git a/runtime/observatory/lib/src/elements/object_common.dart b/runtime/observatory/lib/src/elements/object_common.dart
index 8413c3d..5e6152f 100644
--- a/runtime/observatory/lib/src/elements/object_common.dart
+++ b/runtime/observatory/lib/src/elements/object_common.dart
@@ -14,20 +14,20 @@
import 'package:observatory/utils.dart';
class ObjectCommonElement extends CustomElement implements Renderable {
- RenderingScheduler<ObjectCommonElement> _r;
+ late RenderingScheduler<ObjectCommonElement> _r;
Stream<RenderedEvent<ObjectCommonElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.Object _object;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
- M.Guarded<M.Instance> _retainedSize = null;
+ late M.IsolateRef _isolate;
+ late M.Object _object;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
+ M.Guarded<M.Instance>? _retainedSize = null;
bool _loadingRetainedBytes = false;
- M.Guarded<M.Instance> _reachableSize = null;
+ M.Guarded<M.Instance>? _reachableSize = null;
bool _loadingReachableBytes = false;
M.IsolateRef get isolate => _isolate;
@@ -41,7 +41,7 @@
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(object != null);
assert(retainedSizes != null);
@@ -76,8 +76,8 @@
children = <Element>[];
}
- RetainingPathElement _path;
- InboundReferencesElement _inbounds;
+ RetainingPathElement? _path;
+ InboundReferencesElement? _inbounds;
void render() {
_path = _path ??
@@ -101,7 +101,7 @@
..children = <Element>[
_object.clazz == null
? (new SpanElement()..text = '...')
- : new ClassRefElement(_isolate, _object.clazz,
+ : new ClassRefElement(_isolate, _object.clazz!,
queue: _r.queue)
.element
]
@@ -149,7 +149,7 @@
..text = 'Retaining path ',
new DivElement()
..classes = ['memberValue']
- ..children = <Element>[_path.element]
+ ..children = <Element>[_path!.element]
],
new DivElement()
..classes = ['memberItem']
@@ -160,7 +160,7 @@
..text = 'Inbound references ',
new DivElement()
..classes = ['memberValue']
- ..children = <Element>[_inbounds.element]
+ ..children = <Element>[_inbounds!.element]
]
]
];
@@ -169,14 +169,14 @@
List<Element> _createReachableSizeValue() {
final content = <Element>[];
if (_reachableSize != null) {
- if (_reachableSize.isSentinel) {
- content.add(
- new SentinelValueElement(_reachableSize.asSentinel, queue: _r.queue)
- .element);
+ if (_reachableSize!.isSentinel) {
+ content.add(new SentinelValueElement(_reachableSize!.asSentinel!,
+ queue: _r.queue)
+ .element);
} else {
content.add(new SpanElement()
..text = Utils.formatSize(
- int.parse(_reachableSize.asValue.valueAsString)));
+ int.parse(_reachableSize!.asValue!.valueAsString!)));
}
} else {
content.add(new SpanElement()..text = '...');
@@ -188,7 +188,7 @@
button.onClick.listen((_) async {
button.disabled = true;
_loadingReachableBytes = true;
- _reachableSize = await _reachableSizes.get(_isolate, _object.id);
+ _reachableSize = await _reachableSizes.get(_isolate, _object.id!);
_r.dirty();
});
content.add(button);
@@ -198,14 +198,14 @@
List<Element> _createRetainedSizeValue() {
final content = <Element>[];
if (_retainedSize != null) {
- if (_retainedSize.isSentinel) {
- content.add(
- new SentinelValueElement(_retainedSize.asSentinel, queue: _r.queue)
- .element);
+ if (_retainedSize!.isSentinel) {
+ content.add(new SentinelValueElement(_retainedSize!.asSentinel!,
+ queue: _r.queue)
+ .element);
} else {
content.add(new SpanElement()
- ..text =
- Utils.formatSize(int.parse(_retainedSize.asValue.valueAsString)));
+ ..text = Utils.formatSize(
+ int.parse(_retainedSize!.asValue!.valueAsString!)));
}
} else {
content.add(new SpanElement()..text = '...');
@@ -217,7 +217,7 @@
button.onClick.listen((_) async {
button.disabled = true;
_loadingRetainedBytes = true;
- _retainedSize = await _retainedSizes.get(_isolate, _object.id);
+ _retainedSize = await _retainedSizes.get(_isolate, _object.id!);
_r.dirty();
});
content.add(button);
diff --git a/runtime/observatory/lib/src/elements/object_view.dart b/runtime/observatory/lib/src/elements/object_view.dart
index 6a805b4..7ff7708 100644
--- a/runtime/observatory/lib/src/elements/object_view.dart
+++ b/runtime/observatory/lib/src/elements/object_view.dart
@@ -20,25 +20,24 @@
import 'package:observatory/src/elements/view_footer.dart';
class ObjectViewElement extends CustomElement implements Renderable {
- RenderingScheduler<ObjectViewElement> _r;
+ late RenderingScheduler<ObjectViewElement> _r;
Stream<RenderedEvent<ObjectViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.Object _object;
- M.ObjectRepository _objects;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.Object _object;
+ late M.ObjectRepository _objects;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
M.NotificationRepository get notifications => _notifications;
- M.Context get object => _object;
factory ObjectViewElement(
M.VM vm,
@@ -51,7 +50,7 @@
M.ReachableSizeRepository reachableSizes,
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -102,7 +101,7 @@
(new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) async {
e.element.disabled = true;
- _object = await _objects.get(_isolate, _object.id);
+ _object = await _objects.get(_isolate, _object.id!);
_r.dirty();
}))
.element,
diff --git a/runtime/observatory/lib/src/elements/objectpool_ref.dart b/runtime/observatory/lib/src/elements/objectpool_ref.dart
index bdebccb..02a6ced 100644
--- a/runtime/observatory/lib/src/elements/objectpool_ref.dart
+++ b/runtime/observatory/lib/src/elements/objectpool_ref.dart
@@ -10,18 +10,18 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class ObjectPoolRefElement extends CustomElement implements Renderable {
- RenderingScheduler<ObjectPoolRefElement> _r;
+ late RenderingScheduler<ObjectPoolRefElement> _r;
Stream<RenderedEvent<ObjectPoolRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.ObjectPoolRef _pool;
+ late M.IsolateRef _isolate;
+ late M.ObjectPoolRef _pool;
M.IsolateRef get isolate => _isolate;
M.ObjectPoolRef get pool => _pool;
factory ObjectPoolRefElement(M.IsolateRef isolate, M.ObjectPoolRef pool,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(pool != null);
ObjectPoolRefElement e = new ObjectPoolRefElement.created();
diff --git a/runtime/observatory/lib/src/elements/objectpool_view.dart b/runtime/observatory/lib/src/elements/objectpool_view.dart
index 32459bf0..1967324 100644
--- a/runtime/observatory/lib/src/elements/objectpool_view.dart
+++ b/runtime/observatory/lib/src/elements/objectpool_view.dart
@@ -23,21 +23,21 @@
import 'package:observatory/src/elements/view_footer.dart';
class ObjectPoolViewElement extends CustomElement implements Renderable {
- RenderingScheduler<ObjectPoolViewElement> _r;
+ late RenderingScheduler<ObjectPoolViewElement> _r;
Stream<RenderedEvent<ObjectPoolViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.ObjectPool _pool;
- M.ObjectPoolRepository _pools;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.ObjectPool _pool;
+ late M.ObjectPoolRepository _pools;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -56,7 +56,7 @@
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -109,7 +109,7 @@
(new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) async {
e.element.disabled = true;
- _pool = await _pools.get(_isolate, _pool.id);
+ _pool = await _pools.get(_isolate, _pool.id!);
_r.dirty();
}))
.element,
@@ -125,10 +125,10 @@
queue: _r.queue)
.element,
new HRElement(),
- new HeadingElement.h3()..text = 'entries (${_pool.entries.length})',
+ new HeadingElement.h3()..text = 'entries (${_pool.entries!.length})',
new DivElement()
..classes = ['memberList']
- ..children = _pool.entries
+ ..children = _pool.entries!
.map<Element>((entry) => new DivElement()
..classes = ['memberItem']
..children = <Element>[
@@ -154,12 +154,12 @@
case M.ObjectPoolEntryKind.immediate:
return [
new SpanElement()
- ..text = 'Immediate 0x${entry.asInteger.toRadixString(16)}'
+ ..text = 'Immediate 0x${entry.asInteger!.toRadixString(16)}'
];
case M.ObjectPoolEntryKind.nativeEntry:
return [
new SpanElement()
- ..text = 'NativeEntry 0x${entry.asInteger.toRadixString(16)}'
+ ..text = 'NativeEntry 0x${entry.asInteger!.toRadixString(16)}'
];
}
throw new Exception('Unknown ObjectPoolEntryKind (${entry.kind})');
diff --git a/runtime/observatory/lib/src/elements/objectstore_view.dart b/runtime/observatory/lib/src/elements/objectstore_view.dart
index 1ffe6dd..59c4003 100644
--- a/runtime/observatory/lib/src/elements/objectstore_view.dart
+++ b/runtime/observatory/lib/src/elements/objectstore_view.dart
@@ -20,17 +20,17 @@
import 'package:observatory/src/elements/view_footer.dart';
class ObjectStoreViewElement extends CustomElement implements Renderable {
- RenderingScheduler<ObjectStoreViewElement> _r;
+ late RenderingScheduler<ObjectStoreViewElement> _r;
Stream<RenderedEvent<ObjectStoreViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.ObjectStore _store;
- M.ObjectStoreRepository _stores;
- M.ObjectRepository _objects;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ M.ObjectStore? _store;
+ late M.ObjectStoreRepository _stores;
+ late M.ObjectRepository _objects;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -43,7 +43,7 @@
M.NotificationRepository notifications,
M.ObjectStoreRepository stores,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -78,7 +78,7 @@
}
void render() {
- final fields = _store?.fields?.toList(growable: false);
+ final fields = _store?.fields.toList(growable: false);
children = <Element>[
navBar(<Element>[
new NavTopMenuElement(queue: _r.queue).element,
diff --git a/runtime/observatory/lib/src/elements/observatory_application.dart b/runtime/observatory/lib/src/elements/observatory_application.dart
index 1ba16ef..8d44e45 100644
--- a/runtime/observatory/lib/src/elements/observatory_application.dart
+++ b/runtime/observatory/lib/src/elements/observatory_application.dart
@@ -11,7 +11,7 @@
/// [ObservatoryApplication] which is passed declaratively to all child
/// elements.
class ObservatoryApplicationElement extends CustomElement {
- ObservatoryApplication app;
+ late ObservatoryApplication app;
ObservatoryApplicationElement.created()
: super.created('observatory-application');
diff --git a/runtime/observatory/lib/src/elements/pc_descriptors_ref.dart b/runtime/observatory/lib/src/elements/pc_descriptors_ref.dart
index 840be60..afd7fd0 100644
--- a/runtime/observatory/lib/src/elements/pc_descriptors_ref.dart
+++ b/runtime/observatory/lib/src/elements/pc_descriptors_ref.dart
@@ -10,20 +10,20 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class PcDescriptorsRefElement extends CustomElement implements Renderable {
- RenderingScheduler<PcDescriptorsRefElement> _r;
+ late RenderingScheduler<PcDescriptorsRefElement> _r;
Stream<RenderedEvent<PcDescriptorsRefElement>> get onRendered =>
_r.onRendered;
- M.IsolateRef _isolate;
- M.PcDescriptorsRef _descriptors;
+ late M.IsolateRef _isolate;
+ late M.PcDescriptorsRef _descriptors;
M.IsolateRef get isolate => _isolate;
M.PcDescriptorsRef get descriptors => _descriptors;
factory PcDescriptorsRefElement(
M.IsolateRef isolate, M.PcDescriptorsRef descriptors,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(descriptors != null);
PcDescriptorsRefElement e = new PcDescriptorsRefElement.created();
diff --git a/runtime/observatory/lib/src/elements/persistent_handles.dart b/runtime/observatory/lib/src/elements/persistent_handles.dart
index 72eef36..0d8f69b 100644
--- a/runtime/observatory/lib/src/elements/persistent_handles.dart
+++ b/runtime/observatory/lib/src/elements/persistent_handles.dart
@@ -26,18 +26,18 @@
enum _SortingDirection { ascending, descending }
class PersistentHandlesPageElement extends CustomElement implements Renderable {
- RenderingScheduler<PersistentHandlesPageElement> _r;
+ late RenderingScheduler<PersistentHandlesPageElement> _r;
Stream<RenderedEvent<PersistentHandlesPageElement>> get onRendered =>
_r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.PersistentHandlesRepository _repository;
- M.ObjectRepository _objects;
- M.PersistentHandles _handles;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.PersistentHandlesRepository _repository;
+ late M.ObjectRepository _objects;
+ M.PersistentHandles? _handles;
_SortingField _sortingField = _SortingField.externalSize;
_SortingDirection _sortingDirection = _SortingDirection.descending;
@@ -52,7 +52,7 @@
M.NotificationRepository notifications,
M.PersistentHandlesRepository repository,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -102,19 +102,19 @@
])
]
..addAll(_createHandlers('Persistent Handles',
- _handles?.elements?.toList(), _createLine, _updateLine))
+ _handles?.elements.toList(), _createLine, _updateLine))
..add(new BRElement())
..addAll(_createHandlers(
'Weak Persistent Handles',
_handles == null
? null
- : (_handles.weakElements.toList()..sort(_createSorter())),
+ : (_handles!.weakElements.toList()..sort(_createSorter())),
_createWeakLine,
_updateWeakLine,
createHeader: _createWeakHeader));
}
- List<Element> _createHandlers(String name, List items, create, update,
+ List<Element> _createHandlers(String name, List? items, create, update,
{createHeader}) {
return [
new DivElement()
diff --git a/runtime/observatory/lib/src/elements/ports.dart b/runtime/observatory/lib/src/elements/ports.dart
index b4f32e0..4a40a89 100644
--- a/runtime/observatory/lib/src/elements/ports.dart
+++ b/runtime/observatory/lib/src/elements/ports.dart
@@ -19,17 +19,17 @@
import 'package:observatory/src/elements/view_footer.dart';
class PortsElement extends CustomElement implements Renderable {
- RenderingScheduler<PortsElement> _r;
+ late RenderingScheduler<PortsElement> _r;
Stream<RenderedEvent<PortsElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.PortsRepository _ports;
- M.ObjectRepository _objects;
- M.Ports _isolatePorts;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.PortsRepository _ports;
+ late M.ObjectRepository _objects;
+ M.Ports? _isolatePorts;
M.IsolateRef get isolate => _isolate;
M.NotificationRepository get notifications => _notifications;
@@ -43,7 +43,7 @@
M.NotificationRepository notifications,
M.PortsRepository ports,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -64,7 +64,7 @@
PortsElement.created() : super.created('ports-page');
int get portCount {
- return _isolatePorts == null ? 0 : _isolatePorts.elements.length;
+ return _isolatePorts == null ? 0 : _isolatePorts!.elements.length;
}
@override
@@ -110,7 +110,7 @@
return const [];
}
int i = 0;
- return _isolatePorts.elements
+ return _isolatePorts!.elements
.map<Element>((port) => new DivElement()
..classes = ['memberItem']
..children = <Element>[
diff --git a/runtime/observatory/lib/src/elements/process_snapshot.dart b/runtime/observatory/lib/src/elements/process_snapshot.dart
index 2911f63..66ad120 100644
--- a/runtime/observatory/lib/src/elements/process_snapshot.dart
+++ b/runtime/observatory/lib/src/elements/process_snapshot.dart
@@ -44,24 +44,24 @@
}
class ProcessSnapshotElement extends CustomElement implements Renderable {
- RenderingScheduler<ProcessSnapshotElement> _r;
+ late RenderingScheduler<ProcessSnapshotElement> _r;
Stream<RenderedEvent<ProcessSnapshotElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
+ late M.VM _vm;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
M.NotificationRepository get notifications => _notifications;
M.VMRef get vm => _vm;
List<Map> _loadedSnapshots = <Map>[];
- Map selection;
- Map _snapshotA;
- Map _snapshotB;
+ Map? selection;
+ Map? _snapshotA;
+ Map? _snapshotB;
factory ProcessSnapshotElement(
M.VM vm, M.EventRepository events, M.NotificationRepository notifications,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(events != null);
assert(notifications != null);
@@ -145,10 +145,10 @@
input.type = 'file';
input.multiple = false;
input.onChange.listen((event) {
- var file = input.files[0];
+ var file = input.files![0];
var reader = new FileReader();
reader.onLoad.listen((event) async {
- _snapshotLoaded(jsonDecode(reader.result));
+ _snapshotLoaded(jsonDecode(reader.result as String));
});
reader.readAsText(file);
});
@@ -224,7 +224,7 @@
],
];
if (selection == null) {
- selection = _snapshotA["root"];
+ selection = _snapshotA!["root"];
}
_createTreeMap(report, new ProcessItemTreeMap(this), selection);
return report;
diff --git a/runtime/observatory/lib/src/elements/retaining_path.dart b/runtime/observatory/lib/src/elements/retaining_path.dart
index d04865e..33f8575 100644
--- a/runtime/observatory/lib/src/elements/retaining_path.dart
+++ b/runtime/observatory/lib/src/elements/retaining_path.dart
@@ -12,15 +12,15 @@
import 'package:observatory/src/elements/helpers/custom_element.dart';
class RetainingPathElement extends CustomElement implements Renderable {
- RenderingScheduler<RetainingPathElement> _r;
+ late RenderingScheduler<RetainingPathElement> _r;
Stream<RenderedEvent<RetainingPathElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.ObjectRef _object;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
- M.RetainingPath _path;
+ late M.IsolateRef _isolate;
+ late M.ObjectRef _object;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
+ M.RetainingPath? _path;
bool _expanded = false;
M.IsolateRef get isolate => _isolate;
@@ -28,7 +28,7 @@
factory RetainingPathElement(M.IsolateRef isolate, M.ObjectRef object,
M.RetainingPathRepository retainingPaths, M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(object != null);
assert(retainingPaths != null);
@@ -75,7 +75,7 @@
Future _refresh() async {
_path = null;
- _path = await _retainingPaths.get(_isolate, _object.id);
+ _path = await _retainingPaths.get(_isolate, _object.id!);
_r.dirty();
}
@@ -86,11 +86,11 @@
var elements = <Element>[];
bool first = true;
- for (var item in _path.elements) {
+ for (var item in _path!.elements) {
elements.add(_createItem(item, first));
first = false;
}
- elements.add(_createGCRootItem(_path.gcRootType));
+ elements.add(_createGCRootItem(_path!.gcRootType));
return elements;
}
diff --git a/runtime/observatory/lib/src/elements/sample_buffer_control.dart b/runtime/observatory/lib/src/elements/sample_buffer_control.dart
index 1ef2186..33d4132d 100644
--- a/runtime/observatory/lib/src/elements/sample_buffer_control.dart
+++ b/runtime/observatory/lib/src/elements/sample_buffer_control.dart
@@ -15,7 +15,7 @@
}
class SampleBufferControlElement extends CustomElement implements Renderable {
- RenderingScheduler<SampleBufferControlElement> _r;
+ late RenderingScheduler<SampleBufferControlElement> _r;
Stream<RenderedEvent<SampleBufferControlElement>> get onRendered =>
_r.onRendered;
@@ -25,13 +25,13 @@
Stream<SampleBufferControlChangedElement> get onTagChange =>
_onTagChange.stream;
- M.VM _vm;
- Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
- M.SampleProfileLoadingProgress _progress;
- M.SampleProfileTag _tag;
+ late M.VM _vm;
+ late Stream<M.SampleProfileLoadingProgressEvent> _progressStream;
+ late M.SampleProfileLoadingProgress _progress;
+ late M.SampleProfileTag _tag;
bool _showTag = false;
bool _profileVM = false;
- StreamSubscription _subscription;
+ late StreamSubscription _subscription;
M.SampleProfileLoadingProgress get progress => _progress;
M.SampleProfileTag get selectedTag => _tag;
@@ -49,7 +49,7 @@
Stream<M.SampleProfileLoadingProgressEvent> progressStream,
{M.SampleProfileTag selectedTag: M.SampleProfileTag.none,
bool showTag: true,
- RenderingQueue queue}) {
+ RenderingQueue? queue}) {
assert(progress != null);
assert(progressStream != null);
assert(selectedTag != null);
diff --git a/runtime/observatory/lib/src/elements/script_inset.dart b/runtime/observatory/lib/src/elements/script_inset.dart
index 67bac9c..68dc829 100644
--- a/runtime/observatory/lib/src/elements/script_inset.dart
+++ b/runtime/observatory/lib/src/elements/script_inset.dart
@@ -17,22 +17,22 @@
import 'package:observatory/utils.dart';
class ScriptInsetElement extends CustomElement implements Renderable {
- RenderingScheduler<ScriptInsetElement> _r;
+ late RenderingScheduler<ScriptInsetElement> _r;
Stream<RenderedEvent<ScriptInsetElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.ScriptRef _script;
- M.Script _loadedScript;
- M.ScriptRepository _scripts;
- M.ObjectRepository _objects;
- M.EventRepository _events;
- StreamSubscription _subscription;
- int _startPos;
- int _endPos;
- int _currentPos;
- bool _inDebuggerContext;
- Iterable _variables;
+ late M.IsolateRef _isolate;
+ late M.ScriptRef _script;
+ M.Script? _loadedScript;
+ late M.ScriptRepository _scripts;
+ late M.ObjectRepository _objects;
+ late M.EventRepository _events;
+ late StreamSubscription _subscription;
+ int? _startPos;
+ int? _endPos;
+ int? _currentPos;
+ late bool _inDebuggerContext;
+ Iterable? _variables;
M.IsolateRef get isolate => _isolate;
M.ScriptRef get script => _script;
@@ -43,12 +43,12 @@
M.ScriptRepository scripts,
M.ObjectRepository objects,
M.EventRepository events,
- {int startPos,
- int endPos,
- int currentPos,
+ {int? startPos,
+ int? endPos,
+ int? currentPos,
bool inDebuggerContext: false,
Iterable variables: const [],
- RenderingQueue queue}) {
+ RenderingQueue? queue}) {
assert(isolate != null);
assert(script != null);
assert(scripts != null);
@@ -73,7 +73,7 @@
ScriptInsetElement.created() : super.created('script-inset');
- bool get noSource => _startPos == -1 || _loadedScript.source == null;
+ bool get noSource => _startPos == -1 || _loadedScript!.source == null;
@override
void attached() {
@@ -83,11 +83,11 @@
.where((e) => e is M.BreakpointEvent)
.map((e) => (e as M.BreakpointEvent).breakpoint)
.listen((M.Breakpoint b) async {
- final M.Location loc = b.location;
- int line;
+ final M.Location loc = b.location!;
+ int? line;
if (loc.script.id == script.id) {
if (loc.tokenPos != null) {
- line = _loadedScript.tokenToLine(loc.tokenPos);
+ line = _loadedScript!.tokenToLine(loc.tokenPos!);
} else {
line = (loc as dynamic).line;
}
@@ -96,12 +96,12 @@
line = (loc as dynamic).line;
} on NoSuchMethodError {
if (loc.tokenPos != null) {
- M.Script scriptUsed = await _scripts.get(_isolate, loc.script.id);
- line = scriptUsed.tokenToLine(loc.tokenPos);
+ M.Script scriptUsed = await _scripts.get(_isolate, loc.script.id!);
+ line = scriptUsed.tokenToLine(loc.tokenPos!);
}
}
}
- if ((line == null) || ((line >= _startLine) && (line <= _endLine))) {
+ if ((line == null) || ((line >= _startLine!) && (line <= _endLine!))) {
_r.dirty();
}
});
@@ -130,9 +130,9 @@
firstBuild = true;
}
- children = <Element>[container];
- container.children.clear();
- container.children.add(table);
+ children = <Element>[container!];
+ container!.children.clear();
+ container!.children.add(table);
_makeCssClassUncopyable(table, "noCopy");
if (firstBuild) {
_scrollToCurrentPos();
@@ -141,19 +141,19 @@
}
Future _refresh() async {
- _loadedScript = await _scripts.get(_isolate, _script.id);
+ _loadedScript = await _scripts.get(_isolate, _script.id!);
await _refreshSourceReport();
await _computeAnnotations();
_r.dirty();
}
- ButtonElement _refreshButton;
- ButtonElement _toggleProfileButton;
+ ButtonElement? _refreshButton;
+ ButtonElement? _toggleProfileButton;
- int _currentLine;
- int _currentCol;
- int _startLine;
- int _endLine;
+ int? _currentLine;
+ int? _currentCol;
+ int? _startLine;
+ int? _endLine;
Map/*<int, List<S.ServiceMap>>*/ _rangeMap = {};
Set _callSites = new Set<S.CallSite>();
@@ -165,7 +165,7 @@
bool _includeProfile = false;
- String makeLineClass(int line) {
+ String makeLineClass(int? line) {
return 'script-inset-line-$line';
}
@@ -215,7 +215,7 @@
return element;
}
- Element container;
+ Element? container;
// Build _rangeMap and _callSites from a source report.
Future _refreshSourceReport() async {
@@ -229,16 +229,16 @@
reports.add(S.Isolate.kProfileReport);
}
S.Isolate isolate = _isolate as S.Isolate;
- dynamic sourceReport =
- await isolate.getSourceReport(reports, script, _startPos, _endPos);
+ dynamic sourceReport = await isolate.getSourceReport(
+ reports, script as S.Script, _startPos, _endPos);
_possibleBreakpointLines =
- S.getPossibleBreakpointLines(sourceReport, script);
+ S.getPossibleBreakpointLines(sourceReport, script as S.Script);
_rangeMap.clear();
_callSites.clear();
_profileMap.clear();
for (var range in sourceReport['ranges']) {
- int startLine = _loadedScript.tokenToLine(range['startPos']);
- int endLine = _loadedScript.tokenToLine(range['endPos']);
+ int? startLine = _loadedScript!.tokenToLine(range['startPos']);
+ int? endLine = _loadedScript!.tokenToLine(range['endPos']);
// TODO(turnidge): Track down the root cause of null startLine/endLine.
if ((startLine != null) && (endLine != null)) {
for (var line = startLine; line <= endLine; line++) {
@@ -263,10 +263,10 @@
// TODO(johnmccutchan): Add classifier data to UI.
continue;
}
- int line = _loadedScript.tokenToLine(positions[i]);
- ScriptLineProfile lineProfile = _profileMap[line];
+ int? line = _loadedScript!.tokenToLine(positions[i]);
+ ScriptLineProfile? lineProfile = _profileMap[line];
if (lineProfile == null) {
- lineProfile = new ScriptLineProfile(line, sampleCount);
+ lineProfile = new ScriptLineProfile(line!, sampleCount);
_profileMap[line] = lineProfile;
}
lineProfile.process(exclusiveTicks[i], inclusiveTicks[i]);
@@ -276,7 +276,8 @@
var rangeCallSites = range['callSites'];
if (rangeCallSites != null) {
for (var callSiteMap in rangeCallSites) {
- _callSites.add(new S.CallSite.fromMap(callSiteMap, script));
+ _callSites
+ .add(new S.CallSite.fromMap(callSiteMap, script as S.Script));
}
}
}
@@ -287,21 +288,22 @@
if (noSource) return;
_startLine = (_startPos != null
- ? _loadedScript.tokenToLine(_startPos)
- : 1 + _loadedScript.lineOffset);
+ ? _loadedScript!.tokenToLine(_startPos!)
+ : 1 + _loadedScript!.lineOffset!);
_currentLine =
- (_currentPos != null ? _loadedScript.tokenToLine(_currentPos) : null);
- _currentCol =
- (_currentPos != null ? (_loadedScript.tokenToCol(_currentPos)) : null);
+ (_currentPos != null ? _loadedScript!.tokenToLine(_currentPos!) : null);
+ _currentCol = (_currentPos != null
+ ? (_loadedScript!.tokenToCol(_currentPos!))
+ : null);
if (_currentCol != null) {
- _currentCol--; // make this 0-based.
+ _currentCol = _currentCol! - 1; // make this 0-based.
}
S.Script script = _loadedScript as S.Script;
_endLine = (_endPos != null
- ? _loadedScript.tokenToLine(_endPos)
- : script.lines.length + _loadedScript.lineOffset);
+ ? _loadedScript!.tokenToLine(_endPos!)
+ : script.lines.length + _loadedScript!.lineOffset!);
if (_startLine == null || _endLine == null) {
return;
@@ -313,7 +315,7 @@
addBreakpointAnnotations();
if (!_inDebuggerContext && script.library != null) {
- await loadDeclarationsOfLibrary(script.library);
+ await loadDeclarationsOfLibrary(script.library!);
addLibraryAnnotations();
addDependencyAnnotations();
addPartAnnotations();
@@ -331,22 +333,22 @@
void addCurrentExecutionAnnotation() {
if (_currentLine != null) {
var a = new CurrentExecutionAnnotation(_isolate, _objects, _r.queue);
- a.line = _currentLine;
- a.columnStart = _currentCol;
+ a.line = _currentLine!;
+ a.columnStart = _currentCol!;
S.Script script = _loadedScript as S.Script;
- var length = script.guessTokenLength(_currentLine, _currentCol);
+ var length = script.guessTokenLength(_currentLine!, _currentCol!);
if (length == null) {
length = 1;
}
- a.columnStop = _currentCol + length;
+ a.columnStop = _currentCol! + length;
_annotations.add(a);
}
}
void addBreakpointAnnotations() {
S.Script script = _loadedScript as S.Script;
- for (var line = _startLine; line <= _endLine; line++) {
- var bpts = script.getLine(line).breakpoints;
+ for (var line = _startLine!; line <= _endLine!; line++) {
+ var bpts = script.getLine(line)!.breakpoints;
if (bpts != null) {
for (var bpt in bpts) {
if (bpt.location != null) {
@@ -360,7 +362,7 @@
Future loadDeclarationsOfLibrary(S.Library lib) {
return lib.load().then((serviceObject) {
- S.Library lib = serviceObject;
+ S.Library lib = serviceObject as S.Library;
var loads = <Future>[];
for (var func in lib.functions) {
loads.add(func.load());
@@ -377,7 +379,7 @@
Future loadDeclarationsOfClass(S.Class cls) {
return cls.load().then((serviceObject) {
- S.Class cls = serviceObject;
+ S.Class cls = serviceObject as S.Class;
var loads = <Future>[];
for (var func in cls.functions) {
loads.add(func.load());
@@ -393,30 +395,30 @@
S.Script script = _loadedScript as S.Script;
for (S.ScriptLine line in script.lines) {
// TODO(rmacnak): Use a real scanner.
- var pattern = new RegExp("library ${script.library.name}");
+ var pattern = new RegExp("library ${script.library!.name!}");
var match = pattern.firstMatch(line.text);
if (match != null) {
var anno = new LibraryAnnotation(
_isolate,
_objects,
_r.queue,
- _loadedScript.library,
- Uris.inspect(isolate, object: _loadedScript.library));
+ _loadedScript!.library as S.Library,
+ Uris.inspect(isolate, object: _loadedScript!.library));
anno.line = line.line;
anno.columnStart = match.start + 8;
anno.columnStop = match.end;
_annotations.add(anno);
}
// TODO(rmacnak): Use a real scanner.
- pattern = new RegExp("part of ${script.library.name}");
+ pattern = new RegExp("part of ${script.library!.name!}");
match = pattern.firstMatch(line.text);
if (match != null) {
var anno = new LibraryAnnotation(
_isolate,
_objects,
_r.queue,
- _loadedScript.library,
- Uris.inspect(isolate, object: _loadedScript.library));
+ _loadedScript!.library as S.Library,
+ Uris.inspect(isolate, object: _loadedScript!.library));
anno.line = line.line;
anno.columnStart = match.start + 8;
anno.columnStop = match.end;
@@ -425,22 +427,23 @@
}
}
- M.Library resolveDependency(String relativeUri) {
+ S.Library? resolveDependency(String relativeUri) {
S.Script script = _loadedScript as S.Script;
// This isn't really correct: we need to ask the embedder to do the
// uri canonicalization for us, but Observatory isn't in a position
// to invoke the library tag handler. Handle the most common cases.
- var targetUri = Uri.parse(_loadedScript.library.uri).resolve(relativeUri);
- for (M.Library l in script.isolate.libraries) {
+ var targetUri =
+ Uri.parse(_loadedScript!.library!.uri!).resolve(relativeUri);
+ for (M.Library l in script.isolate!.libraries) {
if (targetUri.toString() == l.uri) {
- return l;
+ return l as S.Library;
}
}
if (targetUri.scheme == 'package') {
var targetUriString = "packages/${targetUri.path}";
- for (M.Library l in script.isolate.libraries) {
+ for (M.Library l in script.isolate!.libraries) {
if (targetUriString == l.uri) {
- return l;
+ return l as S.Library;
}
}
}
@@ -462,10 +465,10 @@
for (var pattern in patterns) {
var match = pattern.firstMatch(line.text);
if (match != null) {
- M.Library target = resolveDependency(match[1]);
+ M.Library? target = resolveDependency(match[1]!);
if (target != null) {
var anno = new LibraryAnnotation(_isolate, _objects, _r.queue,
- target, Uris.inspect(isolate, object: target));
+ target as S.Library, Uris.inspect(isolate, object: target));
anno.line = line.line;
anno.columnStart = match.start + 8;
anno.columnStop = match.end - 1;
@@ -476,17 +479,17 @@
}
}
- M.Script resolvePart(String relativeUri) {
+ S.Script? resolvePart(String relativeUri) {
S.Script script = _loadedScript as S.Script;
- var rootUri = Uri.parse(script.library.uri);
+ var rootUri = Uri.parse(script.library!.uri!);
if (rootUri.scheme == 'dart') {
// The relative paths from dart:* libraries to their parts are not valid.
- rootUri = Uri.parse(script.library.uri + '/');
+ rootUri = Uri.parse(script.library!.uri! + '/');
}
var targetUri = rootUri.resolve(relativeUri);
- for (M.Script s in script.library.scripts) {
+ for (M.Script s in script.library!.scripts) {
if (targetUri.toString() == s.uri) {
- return s;
+ return s as S.Script?;
}
}
print("Could not resolve part: $relativeUri");
@@ -504,7 +507,7 @@
for (var pattern in patterns) {
var match = pattern.firstMatch(line.text);
if (match != null) {
- S.Script part = resolvePart(match[1]);
+ S.Script? part = resolvePart(match[1]!);
if (part != null) {
var anno = new PartAnnotation(_isolate, _objects, _r.queue, part,
Uris.inspect(isolate, object: part));
@@ -520,8 +523,8 @@
void addClassAnnotations() {
S.Script script = _loadedScript as S.Script;
- for (var cls in script.library.classes) {
- if ((cls.location != null) && (cls.location.script == script)) {
+ for (var cls in script.library!.classes) {
+ if ((cls.location != null) && (cls.location!.script == script)) {
var a = new ClassDeclarationAnnotation(_isolate, _objects, _r.queue,
cls, Uris.inspect(isolate, object: cls));
_annotations.add(a);
@@ -531,16 +534,16 @@
void addFieldAnnotations() {
S.Script script = _loadedScript as S.Script;
- for (var field in script.library.variables) {
- if ((field.location != null) && (field.location.script == script)) {
+ for (var field in script.library!.variables) {
+ if ((field.location != null) && (field.location!.script == script)) {
var a = new FieldDeclarationAnnotation(_isolate, _objects, _r.queue,
field, Uris.inspect(isolate, object: field));
_annotations.add(a);
}
}
- for (var cls in script.library.classes) {
+ for (var cls in script.library!.classes) {
for (var field in cls.fields) {
- if ((field.location != null) && (field.location.script == script)) {
+ if ((field.location != null) && (field.location!.script == script)) {
var a = new FieldDeclarationAnnotation(_isolate, _objects, _r.queue,
field, Uris.inspect(isolate, object: field));
_annotations.add(a);
@@ -551,9 +554,9 @@
void addFunctionAnnotations() {
S.Script script = _loadedScript as S.Script;
- for (var func in script.library.functions) {
+ for (var func in script.library!.functions) {
if ((func.location != null) &&
- (func.location.script == script) &&
+ (func.location!.script == script) &&
(func.kind != M.FunctionKind.implicitGetter) &&
(func.kind != M.FunctionKind.implicitSetter)) {
// We annotate a field declaration with the field instead of the
@@ -563,11 +566,11 @@
_annotations.add(a);
}
}
- for (var cls in script.library.classes) {
+ for (var cls in script.library!.classes) {
S.Script script = _loadedScript as S.Script;
for (var func in cls.functions) {
if ((func.location != null) &&
- (func.location.script == script) &&
+ (func.location!.script == script) &&
(func.kind != M.FunctionKind.implicitGetter) &&
(func.kind != M.FunctionKind.implicitSetter)) {
// We annotate a field declaration with the field instead of the
@@ -592,7 +595,7 @@
// We have local variable information.
if (_variables != null) {
// For each variable.
- for (var variable in _variables) {
+ for (var variable in _variables!) {
// Find variable usage locations.
var locations = script.scanForLocalVariableLocations(
variable['name'], variable['_tokenPos'], variable['_endTokenPos']);
@@ -615,7 +618,7 @@
button.disabled = false;
});
button.title = 'Refresh coverage';
- button.children = <Element>[_iconRefresh.clone(true)];
+ button.children = <Element>[_iconRefresh.clone(true) as Element];
return button;
}
@@ -631,7 +634,7 @@
_refresh();
button.disabled = false;
});
- button.children = <Element>[_iconWhatsHot.clone(true)];
+ button.children = <Element>[_iconWhatsHot.clone(true) as Element];
return button;
}
@@ -642,23 +645,23 @@
_refreshButton = _newRefreshButton();
_toggleProfileButton = _newToggleProfileButton();
- table.append(_refreshButton);
- table.append(_toggleProfileButton);
+ table.append(_refreshButton!);
+ table.append(_toggleProfileButton!);
if (_startLine == null || _endLine == null) {
return table;
}
var endLine = (_endPos != null
- ? _loadedScript.tokenToLine(_endPos)
- : script.lines.length + _loadedScript.lineOffset);
+ ? _loadedScript!.tokenToLine(_endPos!)
+ : script.lines.length + _loadedScript!.lineOffset!);
var lineNumPad = endLine.toString().length;
_annotationsCursor = 0;
int blankLineCount = 0;
- for (int i = _startLine; i <= _endLine; i++) {
- var line = script.getLine(i);
+ for (int i = _startLine!; i <= _endLine!; i++) {
+ var line = script.getLine(i)!;
if (line.isBlank) {
// Try to introduce ellipses if there are 4 or more contiguous
// blank lines.
@@ -688,7 +691,7 @@
}
// Assumes annotations are sorted.
- Annotation nextAnnotationOnLine(int line) {
+ Annotation? nextAnnotationOnLine(int line) {
if (_annotationsCursor >= _annotations.length) return null;
var annotation = _annotations[_annotationsCursor];
@@ -706,7 +709,7 @@
return annotation;
}
- Element lineElement(S.ScriptLine line, int lineNumPad) {
+ Element lineElement(S.ScriptLine? line, int lineNumPad) {
var e = new DivElement();
e.classes.add("sourceRow");
e.append(lineBreakpointElement(line));
@@ -719,7 +722,7 @@
return e;
}
- Element lineProfileElement(S.ScriptLine line, bool self) {
+ Element lineProfileElement(S.ScriptLine? line, bool self) {
var e = span('');
e.classes.add('noCopy');
if (self) {
@@ -741,7 +744,7 @@
return e;
}
- ScriptLineProfile lineProfile = _profileMap[line.line];
+ ScriptLineProfile? lineProfile = _profileMap[line.line];
if (lineProfile == null) {
e.classes.add('noProfile');
e.text = nbsp;
@@ -765,7 +768,7 @@
return e;
}
- Element lineBreakpointElement(S.ScriptLine line) {
+ Element lineBreakpointElement(S.ScriptLine? line) {
var e = new DivElement();
if (line == null || !_possibleBreakpointLines.contains(line.line)) {
e.classes.add('noCopy');
@@ -783,8 +786,8 @@
e.classes.add("busyBreakpoint");
} else if (line.breakpoints != null) {
bool resolved = false;
- for (var bpt in line.breakpoints) {
- if (bpt.resolved) {
+ for (var bpt in line.breakpoints!) {
+ if (bpt.resolved!) {
resolved = true;
break;
}
@@ -806,7 +809,7 @@
busy = true;
if (line.breakpoints == null) {
// No breakpoint. Add it.
- line.script.isolate
+ line.script.isolate!
.addBreakpoint(line.script, line.line)
.catchError((e, st) {
if (e is! S.ServerRpcException ||
@@ -821,8 +824,8 @@
} else {
// Existing breakpoint. Remove it.
List<Future> pending = [];
- for (var bpt in line.breakpoints) {
- pending.add(line.script.isolate.removeBreakpoint(bpt));
+ for (var bpt in line.breakpoints!) {
+ pending.add(line.script.isolate!.removeBreakpoint(bpt));
}
Future.wait(pending).then((_) {
busy = false;
@@ -835,7 +838,7 @@
return e;
}
- Element lineNumberElement(S.ScriptLine line, int lineNumPad) {
+ Element lineNumberElement(S.ScriptLine? line, int lineNumPad) {
var lineNumber = line == null ? "..." : line.line;
var e =
span("$nbsp${lineNumber.toString().padLeft(lineNumPad, nbsp)}$nbsp");
@@ -856,7 +859,7 @@
for (var range in ranges) {
if (range['compiled']) {
for (var callSite in range['callSites']) {
- var callLine = line.script.tokenToLine(callSite['tokenPos']);
+ var callLine = line!.script.tokenToLine(callSite['tokenPos']);
if (lineNumber == callLine) {
// The call site is on the current line.
hasCallInfo = true;
@@ -888,7 +891,7 @@
return e;
}
- Element lineSourceElement(S.ScriptLine line) {
+ Element lineSourceElement(S.ScriptLine? line) {
var e = new DivElement();
e.classes.add("sourceItem");
@@ -916,10 +919,11 @@
}
// TODO(rmacnak): Tolerate overlapping annotations.
- var annotation;
- while ((annotation = nextAnnotationOnLine(line.line)) != null) {
+ var annotation = nextAnnotationOnLine(line.line);
+ while (annotation != null) {
consumeUntil(annotation.columnStart);
annotation.applyStyleTo(consumeUntil(annotation.columnStop));
+ annotation = nextAnnotationOnLine(line.line);
}
consumeUntil(line.text.length);
}
@@ -935,7 +939,8 @@
/// children have been added, and only supports one node at a time.
static void _makeCssClassUncopyable(Element root, String className) {
var noCopyNodes = root.getElementsByClassName(className);
- for (HtmlElement node in noCopyNodes) {
+ for (Node n in noCopyNodes) {
+ var node = n as HtmlElement;
node.style.setProperty('-moz-user-select', 'none');
node.style.setProperty('-khtml-user-select', 'none');
node.style.setProperty('-webkit-user-select', 'none');
@@ -945,11 +950,13 @@
root.onCopy.listen((event) {
// Mark the nodes as hidden before the copy happens, then mark them as
// visible on the next event loop turn.
- for (HtmlElement node in noCopyNodes) {
+ for (Node n in noCopyNodes) {
+ var node = n as HtmlElement;
node.style.visibility = 'hidden';
}
Timer.run(() {
- for (HtmlElement node in noCopyNodes) {
+ for (Node n in noCopyNodes) {
+ var node = n as HtmlElement;
node.style.visibility = 'visible';
}
});
@@ -999,10 +1006,10 @@
abstract class Annotation implements Comparable<Annotation> {
M.IsolateRef _isolate;
M.ObjectRepository _objects;
- RenderingQueue queue;
- int line;
- int columnStart;
- int columnStop;
+ RenderingQueue? queue;
+ int? line;
+ int? columnStart;
+ int? columnStop;
int get priority;
Annotation(this._isolate, this._objects, this.queue);
@@ -1014,9 +1021,9 @@
if (columnStart == other.columnStart) {
return priority.compareTo(other.priority);
}
- return columnStart.compareTo(other.columnStart);
+ return columnStart!.compareTo(other.columnStart!);
}
- return line.compareTo(other.line);
+ return line!.compareTo(other.line!);
}
Element table() {
@@ -1053,7 +1060,7 @@
int priority = 0; // highest priority.
CurrentExecutionAnnotation(
- M.IsolateRef isolate, M.ObjectRepository objects, RenderingQueue queue)
+ M.IsolateRef isolate, M.ObjectRepository objects, RenderingQueue? queue)
: super(isolate, objects, queue);
void applyStyleTo(element) {
@@ -1070,37 +1077,34 @@
int priority = 1;
BreakpointAnnotation(M.IsolateRef isolate, M.ObjectRepository objects,
- RenderingQueue queue, this.bpt)
+ RenderingQueue? queue, this.bpt)
: super(isolate, objects, queue) {
- S.Script script = bpt.location.script;
- var location = bpt.location;
+ S.Script script = bpt.location!.script as S.Script;
+ var location = bpt.location!;
if (location.tokenPos != null) {
- var pos = location.tokenPos;
+ var pos = location.tokenPos!;
line = script.tokenToLine(pos);
- columnStart = script.tokenToCol(pos) - 1; // tokenToCol is 1-origin.
+ columnStart = script.tokenToCol(pos)! - 1; // tokenToCol is 1-origin.
} else if (location is M.UnresolvedSourceLocation) {
- line = location.line;
- columnStart = location.column;
- if (columnStart == null) {
- columnStart = 0;
- }
+ line = location.line!;
+ columnStart = location.column ?? 0;
}
- var length = script.guessTokenLength(line, columnStart);
+ var length = script.guessTokenLength(line!, columnStart!);
if (length == null) {
length = 1;
}
- columnStop = columnStart + length;
+ columnStop = columnStart! + length;
}
void applyStyleTo(element) {
if (element == null) {
return; // TODO(rmacnak): Handling overlapping annotations.
}
- S.Script script = bpt.location.script;
- var pos = bpt.location.tokenPos;
- int line = script.tokenToLine(pos);
- int column = script.tokenToCol(pos);
- if (bpt.resolved) {
+ S.Script script = bpt.location!.script as S.Script;
+ int? pos = bpt.location!.tokenPos;
+ int? line = script.tokenToLine(pos);
+ int? column = script.tokenToCol(pos);
+ if (bpt.resolved!) {
element.classes.add("resolvedBreakAnnotation");
} else {
element.classes.add("unresolvedBreakAnnotation");
@@ -1115,7 +1119,7 @@
int priority = 2;
LibraryAnnotation(M.IsolateRef isolate, M.ObjectRepository objects,
- RenderingQueue queue, this.target, this.url)
+ RenderingQueue? queue, this.target, this.url)
: super(isolate, objects, queue);
void applyStyleTo(element) {
@@ -1133,7 +1137,7 @@
int priority = 2;
PartAnnotation(M.IsolateRef isolate, M.ObjectRepository objects,
- RenderingQueue queue, this.part, this.url)
+ RenderingQueue? queue, this.part, this.url)
: super(isolate, objects, queue);
void applyStyleTo(element) {
@@ -1150,7 +1154,7 @@
int priority = 2;
LocalVariableAnnotation(M.IsolateRef isolate, M.ObjectRepository objects,
- RenderingQueue queue, S.LocalVarLocation location, this.value)
+ RenderingQueue? queue, S.LocalVarLocation location, this.value)
: super(isolate, objects, queue) {
line = location.line;
columnStart = location.column;
@@ -1171,17 +1175,17 @@
int priority = 2;
CallSiteAnnotation(M.IsolateRef isolate, M.ObjectRepository objects,
- RenderingQueue queue, this.callSite)
+ RenderingQueue? queue, this.callSite)
: super(isolate, objects, queue) {
line = callSite.line;
columnStart = callSite.column - 1; // Call site is 1-origin.
- var tokenLength = callSite.script.guessTokenLength(line, columnStart);
+ var tokenLength = callSite.script.guessTokenLength(line!, columnStart!);
if (tokenLength == null) {
tokenLength = callSite.name.length; // Approximate.
if (callSite.name.startsWith("get:") || callSite.name.startsWith("set:"))
tokenLength -= 4;
}
- columnStop = columnStart + tokenLength;
+ columnStop = columnStart! + tokenLength;
}
void applyStyleTo(element) {
@@ -1224,7 +1228,7 @@
int priority = 2;
DeclarationAnnotation(M.IsolateRef isolate, M.ObjectRepository objects,
- RenderingQueue queue, decl, this.url)
+ RenderingQueue? queue, decl, this.url)
: super(isolate, objects, queue) {
assert(decl.loaded);
S.SourceLocation location = decl.location;
@@ -1243,18 +1247,18 @@
columnStart = 0;
columnStop = 0;
} else {
- columnStart--; // 1-origin -> 0-origin.
+ columnStart = columnStart! - 1; // 1-origin -> 0-origin.
// The method's token position is at the beginning of the method
// declaration, which may be a return type annotation, metadata, static
// modifier, etc. Try to scan forward to position this annotation on the
// function's name instead.
- var lineSource = script.getLine(line).text;
- var betterStart = lineSource.indexOf(decl.name, columnStart);
+ var lineSource = script.getLine(line!)!.text;
+ var betterStart = lineSource.indexOf(decl.name, columnStart!);
if (betterStart != -1) {
columnStart = betterStart;
}
- columnStop = columnStart + decl.name.length;
+ columnStop = columnStart! + (decl.name.length as int);
}
}
}
@@ -1263,7 +1267,7 @@
S.Class klass;
ClassDeclarationAnnotation(M.IsolateRef isolate, M.ObjectRepository objects,
- RenderingQueue queue, S.Class cls, String url)
+ RenderingQueue? queue, S.Class cls, String url)
: klass = cls,
super(isolate, objects, queue, cls, url);
@@ -1280,7 +1284,7 @@
S.Field field;
FieldDeclarationAnnotation(M.IsolateRef isolate, M.ObjectRepository objects,
- RenderingQueue queue, S.Field fld, String url)
+ RenderingQueue? queue, S.Field fld, String url)
: field = fld,
super(isolate, objects, queue, fld, url);
@@ -1300,7 +1304,7 @@
FunctionDeclarationAnnotation(
M.IsolateRef isolate,
M.ObjectRepository objects,
- RenderingQueue queue,
+ RenderingQueue? queue,
S.ServiceFunction func,
String url)
: function = func,
@@ -1317,14 +1321,14 @@
if (function.isInlinable == false) {
tooltip += "\nNot inlinable!";
}
- if (function.deoptimizations > 0) {
+ if (function.deoptimizations! > 0) {
tooltip += "\nDeoptimized ${function.deoptimizations} times!";
}
element.title = tooltip;
if (function.isOptimizable == false ||
function.isInlinable == false ||
- function.deoptimizations > 0) {
+ function.deoptimizations! > 0) {
element.style.backgroundColor = "#EEA7A7"; // Low-saturation red.
}
diff --git a/runtime/observatory/lib/src/elements/script_ref.dart b/runtime/observatory/lib/src/elements/script_ref.dart
index a09841b..4a851b9 100644
--- a/runtime/observatory/lib/src/elements/script_ref.dart
+++ b/runtime/observatory/lib/src/elements/script_ref.dart
@@ -12,18 +12,18 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class ScriptRefElement extends CustomElement implements Renderable {
- RenderingScheduler<ScriptRefElement> _r;
+ late RenderingScheduler<ScriptRefElement> _r;
Stream<RenderedEvent<ScriptRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.ScriptRef _script;
+ late M.IsolateRef _isolate;
+ late M.ScriptRef _script;
M.IsolateRef get isolate => _isolate;
M.ScriptRef get script => _script;
factory ScriptRefElement(M.IsolateRef isolate, M.ScriptRef script,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(script != null);
ScriptRefElement e = new ScriptRefElement.created();
@@ -49,14 +49,14 @@
}
void render() {
- var displayUri = script.uri.split('/').last;
+ var displayUri = script.uri!.split('/').last;
if (displayUri.isEmpty) {
displayUri = 'N/A';
}
children = <Element>[
new AnchorElement(href: Uris.inspect(isolate, object: script))
- ..title = script.uri
+ ..title = script.uri!
..text = displayUri
];
}
diff --git a/runtime/observatory/lib/src/elements/script_view.dart b/runtime/observatory/lib/src/elements/script_view.dart
index eb1d209..44fb84e 100644
--- a/runtime/observatory/lib/src/elements/script_view.dart
+++ b/runtime/observatory/lib/src/elements/script_view.dart
@@ -24,22 +24,22 @@
import 'package:observatory/src/elements/view_footer.dart';
class ScriptViewElement extends CustomElement implements Renderable {
- RenderingScheduler<ScriptViewElement> _r;
+ late RenderingScheduler<ScriptViewElement> _r;
Stream<RenderedEvent<ScriptViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.Script _script;
- M.ScriptRepository _scripts;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
- int _pos;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.Script _script;
+ late M.ScriptRepository _scripts;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
+ int? _pos;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -58,8 +58,8 @@
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
M.ObjectRepository objects,
- {int pos,
- RenderingQueue queue}) {
+ {int? pos,
+ RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -109,13 +109,13 @@
new NavTopMenuElement(queue: _r.queue).element,
new NavVMMenuElement(_vm, _events, queue: _r.queue).element,
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue).element,
- new NavLibraryMenuElement(_isolate, _script.library, queue: _r.queue)
+ new NavLibraryMenuElement(_isolate, _script.library!, queue: _r.queue)
.element,
navMenu('object'),
(new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) async {
e.element.disabled = true;
- _script = await _scripts.get(_isolate, _script.id);
+ _script = await _scripts.get(_isolate, _script.id!);
_r.dirty();
}))
.element,
diff --git a/runtime/observatory/lib/src/elements/sentinel_value.dart b/runtime/observatory/lib/src/elements/sentinel_value.dart
index 8245534..ef911fda 100644
--- a/runtime/observatory/lib/src/elements/sentinel_value.dart
+++ b/runtime/observatory/lib/src/elements/sentinel_value.dart
@@ -9,15 +9,15 @@
import 'package:observatory/src/elements/helpers/custom_element.dart';
class SentinelValueElement extends CustomElement implements Renderable {
- RenderingScheduler<SentinelValueElement> _r;
+ late RenderingScheduler<SentinelValueElement> _r;
Stream<RenderedEvent<SentinelValueElement>> get onRendered => _r.onRendered;
- M.Sentinel _sentinel;
+ late M.Sentinel _sentinel;
M.Sentinel get sentinel => _sentinel;
- factory SentinelValueElement(M.Sentinel sentinel, {RenderingQueue queue}) {
+ factory SentinelValueElement(M.Sentinel sentinel, {RenderingQueue? queue}) {
assert(sentinel != null);
SentinelValueElement e = new SentinelValueElement.created();
e._r = new RenderingScheduler<SentinelValueElement>(e, queue: queue);
diff --git a/runtime/observatory/lib/src/elements/sentinel_view.dart b/runtime/observatory/lib/src/elements/sentinel_view.dart
index c3c9b69..dd45ef5 100644
--- a/runtime/observatory/lib/src/elements/sentinel_view.dart
+++ b/runtime/observatory/lib/src/elements/sentinel_view.dart
@@ -16,15 +16,15 @@
import 'package:observatory/src/elements/view_footer.dart';
class SentinelViewElement extends CustomElement implements Renderable {
- RenderingScheduler<SentinelViewElement> _r;
+ late RenderingScheduler<SentinelViewElement> _r;
Stream<RenderedEvent<SentinelViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.Sentinel _sentinel;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.Sentinel _sentinel;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
M.Sentinel get sentinel => _sentinel;
@@ -34,7 +34,7 @@
M.Sentinel sentinel,
M.EventRepository events,
M.NotificationRepository notifications,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(sentinel != null);
diff --git a/runtime/observatory/lib/src/elements/singletargetcache_ref.dart b/runtime/observatory/lib/src/elements/singletargetcache_ref.dart
index 0e0a674..693106a 100644
--- a/runtime/observatory/lib/src/elements/singletargetcache_ref.dart
+++ b/runtime/observatory/lib/src/elements/singletargetcache_ref.dart
@@ -11,20 +11,20 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class SingleTargetCacheRefElement extends CustomElement implements Renderable {
- RenderingScheduler<SingleTargetCacheRefElement> _r;
+ late RenderingScheduler<SingleTargetCacheRefElement> _r;
Stream<RenderedEvent<SingleTargetCacheRefElement>> get onRendered =>
_r.onRendered;
- M.IsolateRef _isolate;
- M.SingleTargetCacheRef _singleTargetCache;
+ late M.IsolateRef _isolate;
+ late M.SingleTargetCacheRef _singleTargetCache;
M.IsolateRef get isolate => _isolate;
M.SingleTargetCacheRef get singleTargetCache => _singleTargetCache;
factory SingleTargetCacheRefElement(
M.IsolateRef isolate, M.SingleTargetCacheRef singleTargetCache,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(singleTargetCache != null);
SingleTargetCacheRefElement e = new SingleTargetCacheRefElement.created();
@@ -58,7 +58,7 @@
new SpanElement()
..classes = ['emphasize']
..text = 'SingleTargetCache',
- new SpanElement()..text = ' (${_singleTargetCache.target.name})'
+ new SpanElement()..text = ' (${_singleTargetCache.target!.name})'
]
];
}
diff --git a/runtime/observatory/lib/src/elements/singletargetcache_view.dart b/runtime/observatory/lib/src/elements/singletargetcache_view.dart
index f25a184..6d0fdd3 100644
--- a/runtime/observatory/lib/src/elements/singletargetcache_view.dart
+++ b/runtime/observatory/lib/src/elements/singletargetcache_view.dart
@@ -20,22 +20,22 @@
import 'package:observatory/src/elements/view_footer.dart';
class SingleTargetCacheViewElement extends CustomElement implements Renderable {
- RenderingScheduler<SingleTargetCacheViewElement> _r;
+ late RenderingScheduler<SingleTargetCacheViewElement> _r;
Stream<RenderedEvent<SingleTargetCacheViewElement>> get onRendered =>
_r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.SingleTargetCache _singleTargetCache;
- M.SingleTargetCacheRepository _singleTargetCaches;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.SingleTargetCache _singleTargetCache;
+ late M.SingleTargetCacheRepository _singleTargetCaches;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -54,7 +54,7 @@
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -112,7 +112,7 @@
..onRefresh.listen((e) async {
e.element.disabled = true;
_singleTargetCache = await _singleTargetCaches.get(
- _isolate, _singleTargetCache.id);
+ _isolate, _singleTargetCache.id!);
_r.dirty();
}))
.element,
diff --git a/runtime/observatory/lib/src/elements/source_inset.dart b/runtime/observatory/lib/src/elements/source_inset.dart
index 1cd0edc..378dfc4 100644
--- a/runtime/observatory/lib/src/elements/source_inset.dart
+++ b/runtime/observatory/lib/src/elements/source_inset.dart
@@ -12,18 +12,18 @@
import 'package:observatory/src/elements/script_inset.dart';
class SourceInsetElement extends CustomElement implements Renderable {
- RenderingScheduler<SourceInsetElement> _r;
+ late RenderingScheduler<SourceInsetElement> _r;
Stream<RenderedEvent<SourceInsetElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.SourceLocation _location;
- M.ScriptRepository _scripts;
- M.ObjectRepository _objects;
- M.EventRepository _events;
- int _currentPos;
- bool _inDebuggerContext;
- Iterable _variables;
+ late M.IsolateRef _isolate;
+ late M.SourceLocation _location;
+ late M.ScriptRepository _scripts;
+ late M.ObjectRepository _objects;
+ late M.EventRepository _events;
+ int? _currentPos;
+ late bool _inDebuggerContext;
+ late Iterable _variables;
M.IsolateRef get isolate => _isolate;
M.SourceLocation get location => _location;
@@ -34,10 +34,10 @@
M.ScriptRepository scripts,
M.ObjectRepository objects,
M.EventRepository events,
- {int currentPos,
+ {int? currentPos,
bool inDebuggerContext: false,
Iterable variables: const [],
- RenderingQueue queue}) {
+ RenderingQueue? queue}) {
assert(isolate != null);
assert(location != null);
assert(scripts != null);
@@ -78,7 +78,7 @@
new ScriptInsetElement(
_isolate, _location.script, _scripts, _objects, _events,
startPos: _location.tokenPos,
- endPos: _location.endTokenPos,
+ endPos: _location.endTokenPos!,
currentPos: _currentPos,
inDebuggerContext: _inDebuggerContext,
variables: _variables,
diff --git a/runtime/observatory/lib/src/elements/source_link.dart b/runtime/observatory/lib/src/elements/source_link.dart
index 62b2e39..47ee300 100644
--- a/runtime/observatory/lib/src/elements/source_link.dart
+++ b/runtime/observatory/lib/src/elements/source_link.dart
@@ -14,21 +14,21 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class SourceLinkElement extends CustomElement implements Renderable {
- RenderingScheduler<SourceLinkElement> _r;
+ late RenderingScheduler<SourceLinkElement> _r;
Stream<RenderedEvent<SourceLinkElement>> get onRendered => _r.onRendered;
- IsolateRef _isolate;
- SourceLocation _location;
- Script _script;
- ScriptRepository _repository;
+ late IsolateRef _isolate;
+ late SourceLocation _location;
+ Script? _script;
+ late ScriptRepository _repository;
IsolateRef get isolate => _isolate;
SourceLocation get location => _location;
factory SourceLinkElement(
IsolateRef isolate, SourceLocation location, ScriptRepository repository,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(location != null);
SourceLinkElement e = new SourceLinkElement.created();
@@ -44,7 +44,7 @@
@override
void attached() {
super.attached();
- _repository.get(_isolate, _location.script.id).then((script) {
+ _repository.get(_isolate, _location.script.id!).then((script) {
_script = script;
_r.dirty();
}, onError: (e) {
@@ -75,14 +75,14 @@
if (_script == null) {
children = <Element>[new SpanElement()..text = '<LOADING>'];
} else {
- String label = _script.uri.split('/').last;
- int token = _location.tokenPos;
- int line = _script.tokenToLine(token);
- int column = _script.tokenToCol(token);
+ String label = _script!.uri!.split('/').last;
+ int? token = _location.tokenPos;
+ int? line = _script!.tokenToLine(token);
+ int? column = _script!.tokenToCol(token);
children = <Element>[
new AnchorElement(
- href: Uris.inspect(isolate, object: _script, pos: token))
- ..title = _script.uri
+ href: Uris.inspect(isolate, object: _script!, pos: token))
+ ..title = _script!.uri!
..text = '${label}:${line}:${column}'
];
}
diff --git a/runtime/observatory/lib/src/elements/stack_trace_tree_config.dart b/runtime/observatory/lib/src/elements/stack_trace_tree_config.dart
index ff23373..9cd0bf3 100644
--- a/runtime/observatory/lib/src/elements/stack_trace_tree_config.dart
+++ b/runtime/observatory/lib/src/elements/stack_trace_tree_config.dart
@@ -19,7 +19,7 @@
}
class StackTraceTreeConfigElement extends CustomElement implements Renderable {
- RenderingScheduler<StackTraceTreeConfigElement> _r;
+ late RenderingScheduler<StackTraceTreeConfigElement> _r;
Stream<RenderedEvent<StackTraceTreeConfigElement>> get onRendered =>
_r.onRendered;
@@ -37,12 +37,12 @@
Stream<StackTraceTreeConfigChangedEvent> get onFilterChange =>
_onFilterChange.stream;
- bool _showMode;
- bool _showDirection;
- bool _showFilter;
- ProfileTreeMode _mode;
- M.ProfileTreeDirection _direction;
- String _filter;
+ late bool _showMode;
+ late bool _showDirection;
+ late bool _showFilter;
+ late ProfileTreeMode _mode;
+ late M.ProfileTreeDirection _direction;
+ late String _filter;
bool get showMode => _showMode;
bool get showDirection => _showDirection;
@@ -68,7 +68,7 @@
String filter: '',
ProfileTreeMode mode: ProfileTreeMode.function,
M.ProfileTreeDirection direction: M.ProfileTreeDirection.exclusive,
- RenderingQueue queue}) {
+ RenderingQueue? queue}) {
assert(showMode != null);
assert(showDirection != null);
assert(showFilter != null);
diff --git a/runtime/observatory/lib/src/elements/strongly_reachable_instances.dart b/runtime/observatory/lib/src/elements/strongly_reachable_instances.dart
index 340686a..252e5e8 100644
--- a/runtime/observatory/lib/src/elements/strongly_reachable_instances.dart
+++ b/runtime/observatory/lib/src/elements/strongly_reachable_instances.dart
@@ -13,16 +13,16 @@
class StronglyReachableInstancesElement extends CustomElement
implements Renderable {
- RenderingScheduler<StronglyReachableInstancesElement> _r;
+ late RenderingScheduler<StronglyReachableInstancesElement> _r;
Stream<RenderedEvent<StronglyReachableInstancesElement>> get onRendered =>
_r.onRendered;
- M.IsolateRef _isolate;
- M.ClassRef _cls;
- M.StronglyReachableInstancesRepository _stronglyReachableInstances;
- M.ObjectRepository _objects;
- M.InstanceSet _result;
+ late M.IsolateRef _isolate;
+ late M.ClassRef _cls;
+ late M.StronglyReachableInstancesRepository _stronglyReachableInstances;
+ late M.ObjectRepository _objects;
+ M.InstanceSet? _result;
bool _expanded = false;
M.IsolateRef get isolate => _isolate;
@@ -33,7 +33,7 @@
M.ClassRef cls,
M.StronglyReachableInstancesRepository stronglyReachable,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(cls != null);
assert(stronglyReachable != null);
@@ -89,7 +89,7 @@
if (_result == null) {
return [new SpanElement()..text = 'Loading...'];
}
- final content = _result.instances
+ final content = _result!.instances!
.map<Element>((sample) => new DivElement()
..children = <Element>[
anyRef(_isolate, sample, _objects, queue: _r.queue)
@@ -98,13 +98,13 @@
content.add(new DivElement()
..children = ([]
..addAll(_createShowMoreButton())
- ..add(new SpanElement()..text = ' of total ${_result.count}')));
+ ..add(new SpanElement()..text = ' of total ${_result!.count}')));
return content;
}
List<Element> _createShowMoreButton() {
- final samples = _result.instances.toList();
- if (samples.length == _result.count) {
+ final samples = _result!.instances!.toList();
+ if (samples.length == _result!.count) {
return [];
}
final count = samples.length;
diff --git a/runtime/observatory/lib/src/elements/subtypetestcache_ref.dart b/runtime/observatory/lib/src/elements/subtypetestcache_ref.dart
index 1d26ab8..40ba454 100644
--- a/runtime/observatory/lib/src/elements/subtypetestcache_ref.dart
+++ b/runtime/observatory/lib/src/elements/subtypetestcache_ref.dart
@@ -11,20 +11,20 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class SubtypeTestCacheRefElement extends CustomElement implements Renderable {
- RenderingScheduler<SubtypeTestCacheRefElement> _r;
+ late RenderingScheduler<SubtypeTestCacheRefElement> _r;
Stream<RenderedEvent<SubtypeTestCacheRefElement>> get onRendered =>
_r.onRendered;
- M.IsolateRef _isolate;
- M.SubtypeTestCacheRef _subtypeTestCache;
+ late M.IsolateRef _isolate;
+ late M.SubtypeTestCacheRef _subtypeTestCache;
M.IsolateRef get isolate => _isolate;
M.SubtypeTestCacheRef get subtypeTestCache => _subtypeTestCache;
factory SubtypeTestCacheRefElement(
M.IsolateRef isolate, M.SubtypeTestCacheRef subtypeTestCache,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(subtypeTestCache != null);
SubtypeTestCacheRefElement e = new SubtypeTestCacheRefElement.created();
diff --git a/runtime/observatory/lib/src/elements/subtypetestcache_view.dart b/runtime/observatory/lib/src/elements/subtypetestcache_view.dart
index 740298f..5734b7d 100644
--- a/runtime/observatory/lib/src/elements/subtypetestcache_view.dart
+++ b/runtime/observatory/lib/src/elements/subtypetestcache_view.dart
@@ -20,22 +20,22 @@
import 'package:observatory/src/elements/view_footer.dart';
class SubtypeTestCacheViewElement extends CustomElement implements Renderable {
- RenderingScheduler<SubtypeTestCacheViewElement> _r;
+ late RenderingScheduler<SubtypeTestCacheViewElement> _r;
Stream<RenderedEvent<SubtypeTestCacheViewElement>> get onRendered =>
_r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.SubtypeTestCache _subtypeTestCache;
- M.SubtypeTestCacheRepository _subtypeTestCaches;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.SubtypeTestCache _subtypeTestCache;
+ late M.SubtypeTestCacheRepository _subtypeTestCaches;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -54,7 +54,7 @@
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -109,7 +109,7 @@
..onRefresh.listen((e) async {
e.element.disabled = true;
_subtypeTestCache = await _subtypeTestCaches.get(
- _isolate, _subtypeTestCache.id);
+ _isolate, _subtypeTestCache.id!);
_r.dirty();
}))
.element,
diff --git a/runtime/observatory/lib/src/elements/timeline/dashboard.dart b/runtime/observatory/lib/src/elements/timeline/dashboard.dart
index 99d57cf..d3c7e4b 100644
--- a/runtime/observatory/lib/src/elements/timeline/dashboard.dart
+++ b/runtime/observatory/lib/src/elements/timeline/dashboard.dart
@@ -34,15 +34,15 @@
enum _TimelineView { strict, frame }
class TimelineDashboardElement extends CustomElement implements Renderable {
- RenderingScheduler<TimelineDashboardElement> _r;
+ late RenderingScheduler<TimelineDashboardElement> _r;
Stream<RenderedEvent<TimelineDashboardElement>> get onRendered =>
_r.onRendered;
- M.VM _vm;
- M.TimelineRepository _repository;
- M.NotificationRepository _notifications;
- M.TimelineFlags _flags;
+ late M.VM _vm;
+ late M.TimelineRepository _repository;
+ late M.NotificationRepository _notifications;
+ late M.TimelineFlags _flags;
_TimelineView _view = _TimelineView.strict;
M.VM get vm => _vm;
@@ -50,7 +50,7 @@
factory TimelineDashboardElement(M.VM vm, M.TimelineRepository repository,
M.NotificationRepository notifications,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(repository != null);
assert(notifications != null);
@@ -81,8 +81,8 @@
children = <Element>[];
}
- IFrameElement _frame;
- DivElement _content;
+ IFrameElement? _frame;
+ DivElement? _content;
void render() {
if (_frame == null) {
@@ -91,8 +91,8 @@
if (_content == null) {
_content = new DivElement()..classes = ['content-centered-big'];
}
- _frame.src = _makeFrameUrl();
- _content.children = <Element>[
+ _frame!.src = _makeFrameUrl();
+ _content!.children = <Element>[
new HeadingElement.h2()
..nodes = ([new Text("Timeline View")]
..addAll(_createButtons())
@@ -109,10 +109,10 @@
navBar(<Element>[
new NavNotifyElement(_notifications, queue: _r.queue).element
]),
- _content,
+ _content!,
new DivElement()
..classes = ['iframe']
- ..children = <Element>[_frame]
+ ..children = <Element>[_frame!]
];
}
}
@@ -222,7 +222,7 @@
Future _postMessage(String method,
[Map<String, dynamic> params = const <String, dynamic>{}]) async {
var message = {'method': method, 'params': params};
- _frame.contentWindow
+ _frame!.contentWindow!
.postMessage(json.encode(message), window.location.href);
return null;
}
diff --git a/runtime/observatory/lib/src/elements/timeline_page.dart b/runtime/observatory/lib/src/elements/timeline_page.dart
index b3253ca..2a17e2b 100644
--- a/runtime/observatory/lib/src/elements/timeline_page.dart
+++ b/runtime/observatory/lib/src/elements/timeline_page.dart
@@ -19,25 +19,25 @@
import 'package:observatory/src/elements/nav/vm_menu.dart';
class TimelinePageElement extends CustomElement implements Renderable {
- RenderingScheduler<TimelinePageElement> _r;
+ late RenderingScheduler<TimelinePageElement> _r;
Stream<RenderedEvent<TimelinePageElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.TimelineRepository _repository;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.TimelineRecorder _recorder;
- Set<M.TimelineStream> _availableStreams;
- Set<M.TimelineStream> _recordedStreams;
- Set<M.TimelineProfile> _profiles;
+ late M.VM _vm;
+ late M.TimelineRepository _repository;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ M.TimelineRecorder? _recorder;
+ late Set<M.TimelineStream> _availableStreams;
+ late Set<M.TimelineStream> _recordedStreams;
+ late Set<M.TimelineProfile> _profiles;
M.VM get vm => _vm;
M.NotificationRepository get notifications => _notifications;
factory TimelinePageElement(M.VM vm, M.TimelineRepository repository,
M.EventRepository events, M.NotificationRepository notifications,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(repository != null);
assert(events != null);
@@ -67,25 +67,25 @@
children = <Element>[];
}
- IFrameElement _frame;
- DivElement _content;
+ IFrameElement? _frame;
+ DivElement? _content;
bool get usingVMRecorder =>
- _recorder.name != "Fuchsia" &&
- _recorder.name != "Systrace" &&
- _recorder.name != "Macos";
+ _recorder!.name != "Fuchsia" &&
+ _recorder!.name != "Systrace" &&
+ _recorder!.name != "Macos";
void render() {
if (_frame == null) {
_frame = new IFrameElement()..src = 'timeline.html';
- _frame.onLoad.listen((event) {
+ _frame!.onLoad.listen((event) {
_refresh();
});
}
if (_content == null) {
_content = new DivElement()..classes = ['content-centered-big'];
}
- _content.children = <Element>[
+ _content!.children = <Element>[
new HeadingElement.h1()..text = 'Timeline settings',
_recorder == null
? (new DivElement()..text = 'Loading...')
@@ -100,7 +100,7 @@
..text = 'Recorder:',
new DivElement()
..classes = ['memberValue']
- ..text = _recorder.name
+ ..text = _recorder!.name
],
new DivElement()
..classes = ['memberItem']
@@ -162,19 +162,20 @@
.element,
new NavNotifyElement(_notifications, queue: _r.queue).element
]),
- _content,
+ _content!,
_createIFrameOrMessage(),
];
}
HtmlElement _createIFrameOrMessage() {
- if (_recorder == null) {
+ final recorder = _recorder;
+ if (recorder == null) {
return new DivElement()
..classes = ['content-centered-big']
..text = 'Loading...';
}
- if (_recorder.name == "Fuchsia") {
+ if (recorder.name == "Fuchsia") {
return new DivElement()
..classes = ['content-centered-big']
..children = <Element>[
@@ -189,7 +190,7 @@
];
}
- if (_recorder.name == "Systrace") {
+ if (recorder.name == "Systrace") {
return new DivElement()
..classes = ['content-centered-big']
..children = <Element>[
@@ -205,7 +206,7 @@
];
}
- if (_recorder.name == "Macos") {
+ if (recorder.name == "Macos") {
return new DivElement()
..classes = ['content-centered-big']
..children = <Element>[
@@ -223,7 +224,7 @@
return new DivElement()
..classes = ['iframe']
- ..children = <Element>[_frame];
+ ..children = <Element>[_frame!];
}
List<Element> _createProfileSelect() {
@@ -263,12 +264,12 @@
}
Future _postMessage(String method,
- [Map<String, dynamic> params = const <String, dynamic>{}]) async {
- if (_frame.contentWindow == null) {
+ [Map<dynamic, dynamic> params = const <dynamic, dynamic>{}]) async {
+ if (_frame!.contentWindow == null) {
return null;
}
var message = {'method': method, 'params': params};
- _frame.contentWindow
+ _frame!.contentWindow!
.postMessage(json.encode(message), window.location.href);
return null;
}
@@ -302,7 +303,7 @@
span.text = stream.name;
InputElement checkbox = new InputElement();
checkbox.onChange.listen((_) {
- if (checkbox.checked) {
+ if (checkbox.checked!) {
_recordedStreams.add(stream);
} else {
_recordedStreams.remove(stream);
diff --git a/runtime/observatory/lib/src/elements/tree_map.dart b/runtime/observatory/lib/src/elements/tree_map.dart
index f79b9aa..3a3721d 100644
--- a/runtime/observatory/lib/src/elements/tree_map.dart
+++ b/runtime/observatory/lib/src/elements/tree_map.dart
@@ -11,7 +11,7 @@
String getBackground(T node);
String getLabel(T node);
String getTooltip(T node) => getLabel(node);
- T getParent(T node);
+ T? getParent(T node);
Iterable<T> getChildren(T node);
void onSelect(T node);
void onDetails(T node);
@@ -34,7 +34,8 @@
div.onDoubleClick.listen((event) {
event.stopPropagation();
if (depth == 0) {
- onSelect(getParent(node)); // Zoom out.
+ var p = getParent(node);
+ onSelect(p ?? node); // Zoom out.
} else {
onSelect(node); // Zoom in.
}
diff --git a/runtime/observatory/lib/src/elements/type_arguments_ref.dart b/runtime/observatory/lib/src/elements/type_arguments_ref.dart
index 9e8ff9f..a9a85ad 100644
--- a/runtime/observatory/lib/src/elements/type_arguments_ref.dart
+++ b/runtime/observatory/lib/src/elements/type_arguments_ref.dart
@@ -10,19 +10,19 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class TypeArgumentsRefElement extends CustomElement implements Renderable {
- RenderingScheduler<TypeArgumentsRefElement> _r;
+ late RenderingScheduler<TypeArgumentsRefElement> _r;
Stream<RenderedEvent<TypeArgumentsRefElement>> get onRendered =>
_r.onRendered;
- M.IsolateRef _isolate;
- M.TypeArgumentsRef _arguments;
+ late M.IsolateRef _isolate;
+ late M.TypeArgumentsRef _arguments;
M.IsolateRef get isolate => _isolate;
M.TypeArgumentsRef get arguments => _arguments;
factory TypeArgumentsRefElement(M.IsolateRef isolate, M.TypeArgumentsRef args,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(args != null);
TypeArgumentsRefElement e = new TypeArgumentsRefElement.created();
diff --git a/runtime/observatory/lib/src/elements/unknown_ref.dart b/runtime/observatory/lib/src/elements/unknown_ref.dart
index 6425a39..ab8358d 100644
--- a/runtime/observatory/lib/src/elements/unknown_ref.dart
+++ b/runtime/observatory/lib/src/elements/unknown_ref.dart
@@ -10,19 +10,19 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class UnknownObjectRefElement extends CustomElement implements Renderable {
- RenderingScheduler<UnknownObjectRefElement> _r;
+ late RenderingScheduler<UnknownObjectRefElement> _r;
Stream<RenderedEvent<UnknownObjectRefElement>> get onRendered =>
_r.onRendered;
- M.IsolateRef _isolate;
- M.UnknownObjectRef _obj;
+ late M.IsolateRef _isolate;
+ late M.UnknownObjectRef _obj;
M.IsolateRef get isolate => _isolate;
M.UnknownObjectRef get obj => _obj;
factory UnknownObjectRefElement(M.IsolateRef isolate, M.UnknownObjectRef obj,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(obj != null);
UnknownObjectRefElement e = new UnknownObjectRefElement.created();
diff --git a/runtime/observatory/lib/src/elements/unlinkedcall_ref.dart b/runtime/observatory/lib/src/elements/unlinkedcall_ref.dart
index 2a9051e..1dae01c 100644
--- a/runtime/observatory/lib/src/elements/unlinkedcall_ref.dart
+++ b/runtime/observatory/lib/src/elements/unlinkedcall_ref.dart
@@ -10,19 +10,19 @@
import 'package:observatory/src/elements/helpers/uris.dart';
class UnlinkedCallRefElement extends CustomElement implements Renderable {
- RenderingScheduler<UnlinkedCallRefElement> _r;
+ late RenderingScheduler<UnlinkedCallRefElement> _r;
Stream<RenderedEvent<UnlinkedCallRefElement>> get onRendered => _r.onRendered;
- M.IsolateRef _isolate;
- M.UnlinkedCallRef _unlinkedcall;
+ late M.IsolateRef _isolate;
+ late M.UnlinkedCallRef _unlinkedcall;
M.IsolateRef get isolate => _isolate;
M.UnlinkedCallRef get unlinkedcall => _unlinkedcall;
factory UnlinkedCallRefElement(
M.IsolateRef isolate, M.UnlinkedCallRef unlinkedcall,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(isolate != null);
assert(unlinkedcall != null);
UnlinkedCallRefElement e = new UnlinkedCallRefElement.created();
diff --git a/runtime/observatory/lib/src/elements/unlinkedcall_view.dart b/runtime/observatory/lib/src/elements/unlinkedcall_view.dart
index 7e4cf0b..a346b48 100644
--- a/runtime/observatory/lib/src/elements/unlinkedcall_view.dart
+++ b/runtime/observatory/lib/src/elements/unlinkedcall_view.dart
@@ -20,22 +20,22 @@
import 'package:observatory/src/elements/view_footer.dart';
class UnlinkedCallViewElement extends CustomElement implements Renderable {
- RenderingScheduler<UnlinkedCallViewElement> _r;
+ late RenderingScheduler<UnlinkedCallViewElement> _r;
Stream<RenderedEvent<UnlinkedCallViewElement>> get onRendered =>
_r.onRendered;
- M.VM _vm;
- M.IsolateRef _isolate;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.UnlinkedCall _unlinkedcall;
- M.UnlinkedCallRepository _unlinkedcalls;
- M.RetainedSizeRepository _retainedSizes;
- M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
- M.ObjectRepository _objects;
+ late M.VM _vm;
+ late M.IsolateRef _isolate;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.UnlinkedCall _unlinkedcall;
+ late M.UnlinkedCallRepository _unlinkedcalls;
+ late M.RetainedSizeRepository _retainedSizes;
+ late M.ReachableSizeRepository _reachableSizes;
+ late M.InboundReferencesRepository _references;
+ late M.RetainingPathRepository _retainingPaths;
+ late M.ObjectRepository _objects;
M.VMRef get vm => _vm;
M.IsolateRef get isolate => _isolate;
@@ -54,7 +54,7 @@
M.InboundReferencesRepository references,
M.RetainingPathRepository retainingPaths,
M.ObjectRepository objects,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(isolate != null);
assert(events != null);
@@ -108,7 +108,7 @@
..onRefresh.listen((e) async {
e.element.disabled = true;
_unlinkedcall =
- await _unlinkedcalls.get(_isolate, _unlinkedcall.id);
+ await _unlinkedcalls.get(_isolate, _unlinkedcall.id!);
_r.dirty();
}))
.element,
diff --git a/runtime/observatory/lib/src/elements/view_footer.dart b/runtime/observatory/lib/src/elements/view_footer.dart
index 6181511..4d52516 100644
--- a/runtime/observatory/lib/src/elements/view_footer.dart
+++ b/runtime/observatory/lib/src/elements/view_footer.dart
@@ -10,11 +10,11 @@
import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
class ViewFooterElement extends CustomElement implements Renderable {
- RenderingScheduler<ViewFooterElement> _r;
+ late RenderingScheduler<ViewFooterElement> _r;
Stream<RenderedEvent<ViewFooterElement>> get onRendered => _r.onRendered;
- factory ViewFooterElement({RenderingQueue queue}) {
+ factory ViewFooterElement({RenderingQueue? queue}) {
ViewFooterElement e = new ViewFooterElement.created();
e._r = new RenderingScheduler<ViewFooterElement>(e, queue: queue);
return e;
diff --git a/runtime/observatory/lib/src/elements/vm_connect.dart b/runtime/observatory/lib/src/elements/vm_connect.dart
index 1d14168..26bfb17 100644
--- a/runtime/observatory/lib/src/elements/vm_connect.dart
+++ b/runtime/observatory/lib/src/elements/vm_connect.dart
@@ -17,19 +17,19 @@
import 'package:observatory/src/elements/vm_connect_target.dart';
class VMConnectElement extends CustomElement implements Renderable {
- RenderingScheduler<VMConnectElement> _r;
+ late RenderingScheduler<VMConnectElement> _r;
Stream<RenderedEvent<VMConnectElement>> get onRendered => _r.onRendered;
- M.NotificationRepository _notifications;
- M.TargetRepository _targets;
- StreamSubscription _targetsSubscription;
+ late M.NotificationRepository _notifications;
+ late M.TargetRepository _targets;
+ late StreamSubscription _targetsSubscription;
- String _address;
+ late String _address;
factory VMConnectElement(
M.TargetRepository targets, M.NotificationRepository notifications,
- {String address: '', RenderingQueue queue}) {
+ {String address: '', RenderingQueue? queue}) {
assert(address != null);
assert(notifications != null);
assert(targets != null);
@@ -128,7 +128,7 @@
_createAndConnect();
});
textbox.onInput.listen((e) {
- _address = textbox.value;
+ _address = textbox.value!;
});
return textbox;
}
@@ -139,7 +139,7 @@
_targets.add(normalizedNetworkAddress);
var target = _targets.find(normalizedNetworkAddress);
assert(target != null);
- _targets.setCurrent(target);
+ _targets.setCurrent(target!);
// the navigation to the VM page is done in the ObservatoryApplication
}
diff --git a/runtime/observatory/lib/src/elements/vm_connect_target.dart b/runtime/observatory/lib/src/elements/vm_connect_target.dart
index 9a11a01..3a0341f 100644
--- a/runtime/observatory/lib/src/elements/vm_connect_target.dart
+++ b/runtime/observatory/lib/src/elements/vm_connect_target.dart
@@ -15,7 +15,7 @@
}
class VMConnectTargetElement extends CustomElement implements Renderable {
- RenderingScheduler<VMConnectTargetElement> _r;
+ late RenderingScheduler<VMConnectTargetElement> _r;
Stream<RenderedEvent<VMConnectTargetElement>> get onRendered => _r.onRendered;
@@ -26,14 +26,14 @@
new StreamController<TargetEvent>.broadcast();
Stream<TargetEvent> get onDelete => _onDelete.stream;
- M.Target _target;
- bool _current;
+ late M.Target _target;
+ late bool _current;
M.Target get target => _target;
bool get current => _current;
factory VMConnectTargetElement(M.Target target,
- {bool current: false, RenderingQueue queue}) {
+ {bool current: false, RenderingQueue? queue}) {
assert(target != null);
assert(current != null);
VMConnectTargetElement e = new VMConnectTargetElement.created();
diff --git a/runtime/observatory/lib/src/elements/vm_view.dart b/runtime/observatory/lib/src/elements/vm_view.dart
index fed475a..2b82602 100644
--- a/runtime/observatory/lib/src/elements/vm_view.dart
+++ b/runtime/observatory/lib/src/elements/vm_view.dart
@@ -20,20 +20,20 @@
import 'package:observatory/utils.dart';
class VMViewElement extends CustomElement implements Renderable {
- RenderingScheduler<VMViewElement> _r;
+ late RenderingScheduler<VMViewElement> _r;
Stream<RenderedEvent<VMViewElement>> get onRendered => _r.onRendered;
- M.VM _vm;
- M.VMRepository _vms;
- M.EventRepository _events;
- M.NotificationRepository _notifications;
- M.IsolateRepository _isolates;
- M.IsolateGroupRepository _isolateGroups;
- M.ScriptRepository _scripts;
- StreamSubscription _vmSubscription;
- StreamSubscription _startSubscription;
- StreamSubscription _exitSubscription;
+ late M.VM _vm;
+ late M.VMRepository _vms;
+ late M.EventRepository _events;
+ late M.NotificationRepository _notifications;
+ late M.IsolateRepository _isolates;
+ late M.IsolateGroupRepository _isolateGroups;
+ late M.ScriptRepository _scripts;
+ late StreamSubscription _vmSubscription;
+ late StreamSubscription _startSubscription;
+ late StreamSubscription _exitSubscription;
M.VMRef get vm => _vm;
M.NotificationRepository get notifications => _notifications;
@@ -46,7 +46,7 @@
M.IsolateRepository isolates,
M.IsolateGroupRepository isolateGroups,
M.ScriptRepository scripts,
- {RenderingQueue queue}) {
+ {RenderingQueue? queue}) {
assert(vm != null);
assert(vms != null);
assert(events != null);
@@ -72,7 +72,7 @@
super.attached();
_r.enable();
_vmSubscription = _events.onVMUpdate.listen((e) {
- _vm = e.vm;
+ _vm = e.vm as M.VM;
_r.dirty();
});
_startSubscription = _events.onIsolateStart.listen((_) => _r.dirty());
@@ -220,7 +220,7 @@
}
Element describeVM() {
- final uptime = new DateTime.now().difference(_vm.startTime);
+ final uptime = new DateTime.now().difference(_vm.startTime!);
return new DivElement()
..classes = ['content-centered-big']
..children = <HtmlElement>[
@@ -256,7 +256,7 @@
..text = 'embedder',
new DivElement()
..classes = ['memberValue']
- ..text = _vm.embedder ?? "UNKNOWN"
+ ..text = _vm.embedder
],
new DivElement()
..classes = ['memberItem']
@@ -337,7 +337,7 @@
Element describeIsolateGroup(M.IsolateGroupRef group) {
final isolateType =
- group.isSystemIsolateGroup ? 'System Isolate' : 'Isolate';
+ group.isSystemIsolateGroup! ? 'System Isolate' : 'Isolate';
final isolates = (group as M.IsolateGroup).isolates;
return new DivElement()
..classes = ['content-centered-big']
@@ -350,7 +350,7 @@
..children = <Element>[
new UListElement()
..classes = ['list-group']
- ..children = isolates.map(describeIsolate).toList(),
+ ..children = isolates!.map(describeIsolate).toList(),
],
];
}
diff --git a/runtime/observatory/lib/src/models/objects/allocation_profile.dart b/runtime/observatory/lib/src/models/objects/allocation_profile.dart
index f9aa5a6..b8b3f24 100644
--- a/runtime/observatory/lib/src/models/objects/allocation_profile.dart
+++ b/runtime/observatory/lib/src/models/objects/allocation_profile.dart
@@ -5,8 +5,8 @@
part of models;
abstract class AllocationProfile {
- DateTime get lastServiceGC;
- DateTime get lastAccumulatorReset;
+ DateTime? get lastServiceGC;
+ DateTime? get lastAccumulatorReset;
HeapSpace get newSpace;
HeapSpace get oldSpace;
HeapSpace get totalSpace;
@@ -15,10 +15,10 @@
abstract class ClassHeapStats {
/// [Optional] at least one between clazz and displayName should be non null
- ClassRef get clazz;
+ ClassRef? get clazz;
/// [Optional] at least one between clazz and displayName should be non null
- String get displayName;
+ String? get displayName;
Allocations get newSpace;
Allocations get oldSpace;
}
diff --git a/runtime/observatory/lib/src/models/objects/breakpoint.dart b/runtime/observatory/lib/src/models/objects/breakpoint.dart
index 28ed56c..6417e12 100644
--- a/runtime/observatory/lib/src/models/objects/breakpoint.dart
+++ b/runtime/observatory/lib/src/models/objects/breakpoint.dart
@@ -6,16 +6,16 @@
abstract class Breakpoint extends Object {
/// A number identifying this breakpoint to the user.
- int get number;
+ int? get number;
/// Has this breakpoint been assigned to a specific program location?
- bool get resolved;
+ bool? get resolved;
/// [optional]Is this a breakpoint that was added synthetically as part of a
/// step OverAsyncSuspension resume command?
- bool get isSyntheticAsyncContinuation;
+ bool? get isSyntheticAsyncContinuation;
/// SourceLocation when breakpoint is resolved, UnresolvedSourceLocation
/// when a breakpoint is not resolved.
- Location get location;
+ Location? get location;
}
diff --git a/runtime/observatory/lib/src/models/objects/class.dart b/runtime/observatory/lib/src/models/objects/class.dart
index 47a1a34..92d946e 100644
--- a/runtime/observatory/lib/src/models/objects/class.dart
+++ b/runtime/observatory/lib/src/models/objects/class.dart
@@ -6,68 +6,68 @@
abstract class ClassRef extends ObjectRef {
/// The name of this class.
- String get name;
+ String? get name;
}
abstract class Class extends Object implements ClassRef {
/// The error which occurred during class finalization, if it exists.
/// [optional]
- ErrorRef get error;
+ ErrorRef? get error;
/// Is this an abstract class?
- bool get isAbstract;
+ bool? get isAbstract;
/// Is this a const class?
- bool get isConst;
+ bool? get isConst;
/// [internal]
- bool get isPatch;
+ bool? get isPatch;
/// [optional] The library which contains this class.
- LibraryRef get library;
+ LibraryRef? get library;
/// [optional] The location of this class in the source code.
- SourceLocation get location;
+ SourceLocation? get location;
/// [optional] The superclass of this class, if any.
- ClassRef get superclass;
+ ClassRef? get superclass;
/// [optional]The supertype for this class, if any.
///
/// The value will be of the kind: Type.
- InstanceRef get superType;
+ InstanceRef? get superType;
/// A list of interface types for this class.
///
/// The values will be of the kind: Type.
- Iterable<InstanceRef> get interfaces;
+ Iterable<InstanceRef>? get interfaces;
/// The mixin type for this class, if any.
///
/// [optional] The value will be of the kind: Type.
- InstanceRef get mixin;
+ InstanceRef? get mixin;
/// A list of fields in this class. Does not include fields from
/// superclasses.
- Iterable<FieldRef> get fields;
+ Iterable<FieldRef>? get fields;
/// A list of functions in this class. Does not include functions
/// from superclasses.
- Iterable<FunctionRef> get functions;
+ Iterable<FunctionRef>? get functions;
// A list of subclasses of this class.
- Iterable<ClassRef> get subclasses;
+ Iterable<ClassRef>? get subclasses;
- bool get hasAllocations;
- bool get hasNoAllocations;
+ bool? get hasAllocations;
+ bool? get hasNoAllocations;
- Allocations get newSpace;
- Allocations get oldSpace;
+ Allocations? get newSpace;
+ Allocations? get oldSpace;
- bool get traceAllocations;
+ bool? get traceAllocations;
}
abstract class InstanceSet {
- int get count;
- Iterable<ObjectRef> get instances;
+ int? get count;
+ Iterable<ObjectRef>? get instances;
}
diff --git a/runtime/observatory/lib/src/models/objects/code.dart b/runtime/observatory/lib/src/models/objects/code.dart
index 12d84df..6e4a915 100644
--- a/runtime/observatory/lib/src/models/objects/code.dart
+++ b/runtime/observatory/lib/src/models/objects/code.dart
@@ -6,7 +6,10 @@
enum CodeKind { dart, native, stub, tag, collected }
-bool isSyntheticCode(CodeKind kind) {
+bool isSyntheticCode(CodeKind? kind) {
+ if (kind == null) {
+ return false;
+ }
switch (kind) {
case CodeKind.collected:
case CodeKind.native:
@@ -17,20 +20,25 @@
}
}
-bool isDartCode(CodeKind kind) => !isSyntheticCode(kind);
+bool isDartCode(CodeKind? kind) {
+ if (kind == null) {
+ return false;
+ }
+ return !isSyntheticCode(kind);
+}
abstract class CodeRef extends ObjectRef {
/// The name of this class.
- String get name;
+ String? get name;
// What kind of code object is this?
- CodeKind get kind;
+ CodeKind? get kind;
- bool get isOptimized;
+ bool? get isOptimized;
}
abstract class Code extends Object implements CodeRef {
- FunctionRef get function;
- ObjectPoolRef get objectPool;
- Iterable<FunctionRef> get inlinedFunctions;
+ FunctionRef? get function;
+ ObjectPoolRef? get objectPool;
+ Iterable<FunctionRef>? get inlinedFunctions;
}
diff --git a/runtime/observatory/lib/src/models/objects/context.dart b/runtime/observatory/lib/src/models/objects/context.dart
index 7378086..a9e9fd8 100644
--- a/runtime/observatory/lib/src/models/objects/context.dart
+++ b/runtime/observatory/lib/src/models/objects/context.dart
@@ -6,17 +6,17 @@
abstract class ContextRef extends ObjectRef {
/// The number of variables in this context.
- int get length;
+ int? get length;
}
abstract class Context extends Object implements ContextRef {
/// [optional] The enclosing context for this context.
- Context get parentContext;
+ Context? get parentContext;
// The variables in this context object.
- Iterable<ContextElement> get variables;
+ Iterable<ContextElement>? get variables;
}
abstract class ContextElement {
- Guarded<InstanceRef> get value;
+ Guarded<InstanceRef>? get value;
}
diff --git a/runtime/observatory/lib/src/models/objects/error.dart b/runtime/observatory/lib/src/models/objects/error.dart
index 56eff8b..cdf3e89 100644
--- a/runtime/observatory/lib/src/models/objects/error.dart
+++ b/runtime/observatory/lib/src/models/objects/error.dart
@@ -20,8 +20,8 @@
}
abstract class ErrorRef extends ObjectRef {
- ErrorKind get kind;
- String get message;
+ ErrorKind? get kind;
+ String? get message;
}
abstract class Error extends Object implements ErrorRef {}
diff --git a/runtime/observatory/lib/src/models/objects/event.dart b/runtime/observatory/lib/src/models/objects/event.dart
index 24ed7e3..5d540ed 100644
--- a/runtime/observatory/lib/src/models/objects/event.dart
+++ b/runtime/observatory/lib/src/models/objects/event.dart
@@ -75,7 +75,7 @@
abstract class PauseBreakpointEvent extends AsyncSuspensionEvent {
/// [optional] The breakpoint at which we are currently paused.
- Breakpoint get breakpoint;
+ Breakpoint? get breakpoint;
/// The list of breakpoints at which we are currently paused
/// for a PauseBreakpoint event.
@@ -94,13 +94,13 @@
abstract class PauseInterruptedEvent extends AsyncSuspensionEvent {
/// [optional] The top stack frame associated with this event. There will be
/// no top frame if the isolate is idle (waiting in the message loop).
- Frame get topFrame;
+ Frame? get topFrame;
}
abstract class PausePostRequestEvent extends AsyncSuspensionEvent {
/// [optional] The top stack frame associated with this event. There will be
/// no top frame if the isolate is idle (waiting in the message loop).
- Frame get topFrame;
+ Frame? get topFrame;
}
abstract class PauseExceptionEvent extends PauseEvent {
@@ -115,7 +115,7 @@
/// [optional] The top stack frame associated with this event. It is provided
/// at all times except for the initial resume event that is delivered when an
/// isolate begins execution.
- Frame get topFrame;
+ Frame? get topFrame;
}
abstract class BreakpointAddedEvent extends BreakpointEvent {}
@@ -168,7 +168,7 @@
String get reason;
}
-Frame topFrame(DebugEvent event) {
+Frame? topFrame(Event? event) {
if (event is PauseBreakpointEvent) {
return event.topFrame;
}
@@ -184,7 +184,7 @@
return null;
}
-bool isAtAsyncSuspension(DebugEvent event) {
+bool isAtAsyncSuspension(DebugEvent? event) {
if (event is PauseBreakpointEvent) {
return event.atAsyncSuspension;
}
diff --git a/runtime/observatory/lib/src/models/objects/field.dart b/runtime/observatory/lib/src/models/objects/field.dart
index ca59328c..c063238 100644
--- a/runtime/observatory/lib/src/models/objects/field.dart
+++ b/runtime/observatory/lib/src/models/objects/field.dart
@@ -6,38 +6,38 @@
abstract class FieldRef extends ObjectRef {
/// The name of this field.
- String get name;
+ String? get name;
/// The owner of this field, which can be either a Library or a
/// Class.
- ObjectRef get dartOwner;
+ ObjectRef? get dartOwner;
/// The declared type of this field.
///
/// The value will always be of one of the kinds:
/// Type, TypeRef, TypeParameter.
- InstanceRef get declaredType;
+ InstanceRef? get declaredType;
/// Is this field const?
- bool get isConst;
+ bool? get isConst;
/// Is this field final?
- bool get isFinal;
+ bool? get isFinal;
/// Is this field static?
- bool get isStatic;
+ bool? get isStatic;
}
enum GuardClassKind { unknown, single, dynamic }
abstract class Field extends Object implements FieldRef {
/// [optional] The value of this field, if the field is static.
- ObjectRef get staticValue;
+ ObjectRef? get staticValue;
/// [optional] The location of this field in the source code.
- SourceLocation get location;
+ SourceLocation? get location;
- GuardClassKind get guardClassKind;
- ClassRef get guardClass;
- bool get guardNullable;
+ GuardClassKind? get guardClassKind;
+ ClassRef? get guardClass;
+ bool? get guardNullable;
}
diff --git a/runtime/observatory/lib/src/models/objects/frame.dart b/runtime/observatory/lib/src/models/objects/frame.dart
index 12140f6..694a7f5 100644
--- a/runtime/observatory/lib/src/models/objects/frame.dart
+++ b/runtime/observatory/lib/src/models/objects/frame.dart
@@ -7,8 +7,8 @@
enum FrameKind { regular, asyncCausal, asyncSuspensionMarker, asyncActivation }
abstract class Frame {
- FrameKind get kind;
- String get marker;
- FunctionRef get function;
- SourceLocation get location;
+ FrameKind? get kind;
+ String? get marker;
+ FunctionRef? get function;
+ SourceLocation? get location;
}
diff --git a/runtime/observatory/lib/src/models/objects/function.dart b/runtime/observatory/lib/src/models/objects/function.dart
index 82d3d7f..3dbe653 100644
--- a/runtime/observatory/lib/src/models/objects/function.dart
+++ b/runtime/observatory/lib/src/models/objects/function.dart
@@ -28,7 +28,7 @@
dynamicInvocationForwarder
}
-bool isSyntheticFunction(FunctionKind kind) {
+bool isSyntheticFunction(FunctionKind? kind) {
switch (kind) {
case FunctionKind.collected:
case FunctionKind.native:
@@ -40,64 +40,64 @@
}
}
-bool isDartFunction(FunctionKind kind) => !isSyntheticFunction(kind);
-bool isStubFunction(FunctionKind kind) => kind == FunctionKind.stub;
-bool hasDartCode(FunctionKind kind) =>
+bool isDartFunction(FunctionKind? kind) => !isSyntheticFunction(kind);
+bool isStubFunction(FunctionKind? kind) => kind == FunctionKind.stub;
+bool hasDartCode(FunctionKind? kind) =>
isDartFunction(kind) || isStubFunction(kind);
String getFunctionFullName(FunctionRef function) {
- var content = <String>[function.name];
- ObjectRef owner = function.dartOwner;
+ String content = function.name!;
+ ObjectRef? owner = function.dartOwner;
while (owner is FunctionRef) {
FunctionRef function = (owner as FunctionRef);
- content.add(function.name);
- owner = function.dartOwner;
+ content = "${function.name!}.${content}";
+ owner = function.dartOwner!;
}
if (owner is ClassRef) {
- content.add(owner.name);
+ content = "${owner.name!}.${content}";
}
- return content.reversed.join('.');
+ return content;
}
abstract class FunctionRef extends ObjectRef {
/// The name of this class.
- String get name;
+ String? get name;
/// The owner of this function, which can be a LibraryRef, ClassRef,
/// or a FunctionRef.
- ObjectRef get dartOwner; // owner
+ ObjectRef? get dartOwner; // owner
/// Is this function static?
- bool get isStatic;
+ bool? get isStatic;
/// Is this function const?
- bool get isConst;
+ bool? get isConst;
/// The kind of the function.
- FunctionKind get kind;
+ FunctionKind? get kind;
}
abstract class ServiceFunction extends Object implements FunctionRef {
/// The location of this function in the source code. [optional]
- SourceLocation get location;
+ SourceLocation? get location;
/// The compiled code associated with this function. [optional]
- CodeRef get code;
+ CodeRef? get code;
/// [optional]
- CodeRef get unoptimizedCode;
+ CodeRef? get unoptimizedCode;
/// [optional]
- CodeRef get bytecode;
+ CodeRef? get bytecode;
/// [optional]
- FieldRef get field;
- int get usageCounter;
- InstanceRef get icDataArray;
- int get deoptimizations;
- bool get isOptimizable;
- bool get isInlinable;
- bool get hasIntrinsic;
- bool get isRecognized;
- bool get isNative;
+ FieldRef? get field;
+ int? get usageCounter;
+ InstanceRef? get icDataArray;
+ int? get deoptimizations;
+ bool? get isOptimizable;
+ bool? get isInlinable;
+ bool? get hasIntrinsic;
+ bool? get isRecognized;
+ bool? get isNative;
}
diff --git a/runtime/observatory/lib/src/models/objects/guarded.dart b/runtime/observatory/lib/src/models/objects/guarded.dart
index 82bf1ee..4617541 100644
--- a/runtime/observatory/lib/src/models/objects/guarded.dart
+++ b/runtime/observatory/lib/src/models/objects/guarded.dart
@@ -7,6 +7,6 @@
abstract class Guarded<T> {
bool get isValue;
bool get isSentinel;
- Sentinel get asSentinel;
- T get asValue;
+ Sentinel? get asSentinel;
+ T? get asValue;
}
diff --git a/runtime/observatory/lib/src/models/objects/icdata.dart b/runtime/observatory/lib/src/models/objects/icdata.dart
index d975301..26e5335 100644
--- a/runtime/observatory/lib/src/models/objects/icdata.dart
+++ b/runtime/observatory/lib/src/models/objects/icdata.dart
@@ -5,11 +5,11 @@
part of models;
abstract class ICDataRef extends ObjectRef {
- String get selector;
+ String? get selector;
}
abstract class ICData extends Object implements ICDataRef {
- ObjectRef get dartOwner;
- InstanceRef get argumentsDescriptor;
- InstanceRef get entries;
+ ObjectRef? get dartOwner;
+ InstanceRef? get argumentsDescriptor;
+ InstanceRef? get entries;
}
diff --git a/runtime/observatory/lib/src/models/objects/instance.dart b/runtime/observatory/lib/src/models/objects/instance.dart
index 66965e9..ab8d6d6 100644
--- a/runtime/observatory/lib/src/models/objects/instance.dart
+++ b/runtime/observatory/lib/src/models/objects/instance.dart
@@ -122,7 +122,10 @@
typeRef,
}
-bool isTypedData(InstanceKind kind) {
+bool isTypedData(InstanceKind? kind) {
+ if (kind == null) {
+ return false;
+ }
switch (kind) {
case InstanceKind.uint8ClampedList:
case InstanceKind.uint8List:
@@ -144,7 +147,10 @@
}
}
-bool isSimdValue(InstanceKind kind) {
+bool isSimdValue(InstanceKind? kind) {
+ if (kind == null) {
+ return false;
+ }
switch (kind) {
case InstanceKind.float32x4:
case InstanceKind.float64x2:
@@ -155,7 +161,10 @@
}
}
-bool isAbstractType(InstanceKind kind) {
+bool isAbstractType(InstanceKind? kind) {
+ if (kind == null) {
+ return false;
+ }
switch (kind) {
case InstanceKind.type:
case InstanceKind.typeRef:
@@ -168,10 +177,10 @@
abstract class InstanceRef extends ObjectRef {
/// What kind of instance is this?
- InstanceKind get kind;
+ InstanceKind? get kind;
/// Instance references always include their class.
- ClassRef get clazz;
+ ClassRef? get clazz;
/// [optional] The value of this instance as a string.
///
@@ -185,13 +194,13 @@
/// Float64x2
/// Int32x4
/// StackTrace
- String get valueAsString;
+ String? get valueAsString;
/// [optional] The valueAsString for String references may be truncated. If so,
/// this property is added with the value 'true'.
///
/// New code should use 'length' and 'count' instead.
- bool get valueAsStringIsTruncated;
+ bool? get valueAsStringIsTruncated;
/// [optional] The length of a List or the number of associations in a Map or
/// the number of codeunits in a String.
@@ -214,25 +223,25 @@
/// Int32x4List
/// Float32x4List
/// Float64x2List
- int get length;
+ int? get length;
/// [optional] The name of a Type instance.
///
/// Provided for instance kinds:
/// Type
- String get name;
+ String? get name;
/// [optional] The corresponding Class if this Type is canonical.
///
/// Provided for instance kinds:
/// Type
- ClassRef get typeClass;
+ ClassRef? get typeClass;
/// [optional] The parameterized class of a type parameter:
///
/// Provided for instance kinds:
/// TypeParameter
- ClassRef get parameterizedClass;
+ ClassRef? get parameterizedClass;
/// [optional] The pattern of a RegExp instance.
///
@@ -240,19 +249,19 @@
///
/// Provided for instance kinds:
/// RegExp
- InstanceRef get pattern;
+ InstanceRef? get pattern;
/// [optional] The function associated with a Closure instance.
///
/// Provided for instance kinds:
/// Closure
- FunctionRef get closureFunction;
+ FunctionRef? get closureFunction;
/// [optional] The context associated with a Closure instance.
///
/// Provided for instance kinds:
/// Closure
- ContextRef get closureContext;
+ ContextRef? get closureContext;
}
abstract class Instance extends Object implements InstanceRef {
@@ -277,7 +286,7 @@
/// Int32x4List
/// Float32x4List
/// Float64x2List
- int get offset;
+ int? get offset;
/// [optional] The number of elements or associations or codeunits returned.
/// This is only provided when it is less than length.
@@ -300,7 +309,7 @@
/// Int32x4List
/// Float32x4List
/// Float64x2List
- int get count;
+ int? get count;
/// [optional] The elements of a TypedData instance.
///
@@ -319,19 +328,19 @@
/// Int32x4List
/// Float32x4List
/// Float64x2List
- List<dynamic> get typedElements;
+ List<dynamic>? get typedElements;
/// [optional] The native fields of this Instance.
- Iterable<NativeField> get nativeFields;
+ Iterable<NativeField>? get nativeFields;
/// [optional] The fields of this Instance.
- Iterable<BoundField> get fields;
+ Iterable<BoundField>? get fields;
/// [optional] The elements of a List instance.
///
/// Provided for instance kinds:
/// List
- Iterable<Guarded<ObjectRef>> get elements;
+ Iterable<Guarded<ObjectRef>>? get elements;
// It should be:
// Iterable<Guarded<InstanceRef>> get elements;
// In some situations we obtain lists of non Instances
@@ -340,37 +349,37 @@
///
/// Provided for instance kinds:
/// Map
- Iterable<MapAssociation> get associations;
+ Iterable<MapAssociation>? get associations;
/// [optional] The key for a WeakProperty instance.
///
/// Provided for instance kinds:
/// WeakProperty
- InstanceRef get key;
+ InstanceRef? get key;
/// [optional] The key for a WeakProperty instance.
///
/// Provided for instance kinds:
/// WeakProperty
- InstanceRef get value;
+ InstanceRef? get value;
/// [optional] The referent of a MirrorReference instance.
///
/// Provided for instance kinds:
/// MirrorReference
- ObjectRef get referent;
+ ObjectRef? get referent;
/// [optional] The type arguments for this type.
///
/// Provided for instance kinds:
/// Type
- TypeArgumentsRef get typeArguments;
+ TypeArgumentsRef? get typeArguments;
/// [optional] The index of a TypeParameter instance.
///
/// Provided for instance kinds:
/// TypeParameter
- int get parameterIndex;
+ int? get parameterIndex;
/// [optional] The referent of a TypeRef instance.
///
@@ -379,7 +388,7 @@
///
/// Provided for instance kinds:
/// TypeRef
- InstanceRef get targetType;
+ InstanceRef? get targetType;
/// [optional] The bound of a TypeParameter.
///
@@ -388,66 +397,66 @@
///
/// Provided for instance kinds:
/// TypeParameter
- InstanceRef get bound;
+ InstanceRef? get bound;
/// [optional]
///
/// Provided for instance kinds:
/// Closure
- Breakpoint get activationBreakpoint;
+ Breakpoint? get activationBreakpoint;
/// [optional]
///
/// Provided for instance kinds:
/// RegExp
- bool get isCaseSensitive;
+ bool? get isCaseSensitive;
/// [optional]
///
/// Provided for instance kinds:
/// RegExp
- bool get isMultiLine;
+ bool? get isMultiLine;
/// [optional]
///
/// Provided for instance kinds:
/// RegExp
- FunctionRef get oneByteFunction;
+ FunctionRef? get oneByteFunction;
/// [optional]
///
/// Provided for instance kinds:
/// RegExp
- FunctionRef get twoByteFunction;
+ FunctionRef? get twoByteFunction;
/// [optional]
///
/// Provided for instance kinds:
/// RegExp
- FunctionRef get externalOneByteFunction;
+ FunctionRef? get externalOneByteFunction;
/// [optional]
///
/// Provided for instance kinds:
/// RegExp
- FunctionRef get externalTwoByteFunction;
+ FunctionRef? get externalTwoByteFunction;
/// [optional]
///
/// Provided for instance kinds:
/// RegExp
- InstanceRef get oneByteBytecode;
+ InstanceRef? get oneByteBytecode;
/// [optional]
///
/// Provided for instance kinds:
/// RegExp
- InstanceRef get twoByteBytecode;
+ InstanceRef? get twoByteBytecode;
}
abstract class BoundField {
- FieldRef get decl;
- Guarded<InstanceRef> get value;
+ FieldRef? get decl;
+ Guarded<InstanceRef>? get value;
}
abstract class NativeField {
diff --git a/runtime/observatory/lib/src/models/objects/isolate.dart b/runtime/observatory/lib/src/models/objects/isolate.dart
index a3c063a..3f83455 100644
--- a/runtime/observatory/lib/src/models/objects/isolate.dart
+++ b/runtime/observatory/lib/src/models/objects/isolate.dart
@@ -7,16 +7,16 @@
abstract class IsolateRef {
/// The id which is passed to the getIsolate RPC to reload this
/// isolate.
- String get id;
+ String? get id;
/// A numeric id for this isolate, represented as a string. Unique.
- int get number;
+ int? get number;
/// A name identifying this isolate. Not guaranteed to be unique.
- String get name;
+ String? get name;
/// True if the isolate is a system isolate which is not running user code.
- bool get isSystemIsolate;
+ bool? get isSystemIsolate;
/// Trigger a full GC, collecting all unreachable or weakly reachable objects.
Future collectAllGarbage();
@@ -26,7 +26,7 @@
abstract class Isolate extends IsolateRef {
/// The time that the VM started in milliseconds since the epoch.
- DateTime get startTime;
+ DateTime? get startTime;
/// Is the isolate in a runnable state?
bool get runnable;
@@ -39,51 +39,51 @@
/// The last pause event delivered to the isolate. If the isolate is
/// running, this will be a resume event.
- Event get pauseEvent;
+ Event? get pauseEvent;
/// [optional] The root library for this isolate.
///
/// Guaranteed to be initialized when the IsolateRunnable event fires.
- LibraryRef get rootLibrary;
+ LibraryRef? get rootLibrary;
/// A list of all libraries for this isolate.
///
/// Guaranteed to be initialized when the IsolateRunnable event fires.
- Iterable<LibraryRef> get libraries;
+ Iterable<LibraryRef>? get libraries;
/// A list of all breakpoints for this isolate.
//Iterable<Breakpoint> get breakpoints;
/// [optional] The error that is causing this isolate to exit, if applicable.
- Error get error;
+ Error? get error;
/// The list of threads associated with this isolate.
- Iterable<Thread> get threads;
+ Iterable<Thread>? get threads;
/// The maximum amount of zone memory in bytes allocated by the isolate in
/// all threads at a given time. Calculated using the high watermarks of each
/// thread alive when a thread is unscheduled.
- int get zoneHighWatermark;
+ int? get zoneHighWatermark;
/// The number of zone handles currently held by this isolate.
- int get numZoneHandles;
+ int? get numZoneHandles;
/// The number of scoped handles currently held by this isolate.
- int get numScopedHandles;
+ int? get numScopedHandles;
/// The current pause on exception mode for this isolate.
//ExceptionPauseMode get exceptionPauseMode;
/// [optional] The list of service extension RPCs that are registered for this
/// isolate, if any.
- Iterable<String> get extensionRPCs;
+ Iterable<String>? get extensionRPCs;
- Map get counters;
- HeapSpace get newSpace;
- HeapSpace get oldSpace;
+ Map? get counters;
+ HeapSpace? get newSpace;
+ HeapSpace? get oldSpace;
- IsolateStatus get status;
+ IsolateStatus? get status;
/// [optional]
- FunctionRef get entry;
+ FunctionRef? get entry;
}
diff --git a/runtime/observatory/lib/src/models/objects/isolate_group.dart b/runtime/observatory/lib/src/models/objects/isolate_group.dart
index 7b7a83c..3ede0ba 100644
--- a/runtime/observatory/lib/src/models/objects/isolate_group.dart
+++ b/runtime/observatory/lib/src/models/objects/isolate_group.dart
@@ -7,18 +7,18 @@
abstract class IsolateGroupRef {
/// The id which is passed to the getIsolateGroup RPC to reload this
/// isolate group.
- String get id;
+ String? get id;
/// A numeric id for this isolate group, represented as a string. Unique.
- int get number;
+ int? get number;
/// A name identifying this isolate group. Not guaranteed to be unique.
- String get name;
+ String? get name;
- bool get isSystemIsolateGroup;
+ bool? get isSystemIsolateGroup;
}
abstract class IsolateGroup extends IsolateGroupRef {
/// A list of all isolates in this isolate group.
- Iterable<IsolateRef> get isolates;
+ Iterable<IsolateRef>? get isolates;
}
diff --git a/runtime/observatory/lib/src/models/objects/library.dart b/runtime/observatory/lib/src/models/objects/library.dart
index 83bab54..b02a97d 100644
--- a/runtime/observatory/lib/src/models/objects/library.dart
+++ b/runtime/observatory/lib/src/models/objects/library.dart
@@ -6,10 +6,10 @@
abstract class LibraryRef extends ObjectRef {
/// The name of this library.
- String get name;
+ String? get name;
/// The uri of this library.
- String get uri;
+ String? get uri;
}
abstract class Library extends Object implements LibraryRef {
@@ -17,22 +17,22 @@
//bool get debuggable;
/// A list of the imports for this library.
- Iterable<LibraryDependency> get dependencies;
+ Iterable<LibraryDependency>? get dependencies;
/// A list of the scripts which constitute this library.
- Iterable<ScriptRef> get scripts;
+ Iterable<ScriptRef>? get scripts;
/// A list of the top-level variables in this library.
- Iterable<FieldRef> get variables;
+ Iterable<FieldRef>? get variables;
/// A list of the top-level functions in this library.
- Iterable<FunctionRef> get functions;
+ Iterable<FunctionRef>? get functions;
/// A list of all classes in this library.
- Iterable<ClassRef> get classes;
+ Iterable<ClassRef>? get classes;
- ScriptRef get rootScript;
- String get vmName;
+ ScriptRef? get rootScript;
+ String? get vmName;
}
abstract class LibraryDependency {
diff --git a/runtime/observatory/lib/src/models/objects/local_var_descriptors.dart b/runtime/observatory/lib/src/models/objects/local_var_descriptors.dart
index 5643b80..a8e6320 100644
--- a/runtime/observatory/lib/src/models/objects/local_var_descriptors.dart
+++ b/runtime/observatory/lib/src/models/objects/local_var_descriptors.dart
@@ -6,5 +6,5 @@
abstract class LocalVarDescriptorsRef extends ObjectRef {
/// [optional]
- String get name;
+ String? get name;
}
diff --git a/runtime/observatory/lib/src/models/objects/megamorphiccache.dart b/runtime/observatory/lib/src/models/objects/megamorphiccache.dart
index 74657de..5618a7e 100644
--- a/runtime/observatory/lib/src/models/objects/megamorphiccache.dart
+++ b/runtime/observatory/lib/src/models/objects/megamorphiccache.dart
@@ -5,12 +5,12 @@
part of models;
abstract class MegamorphicCacheRef extends ObjectRef {
- String get selector;
+ String? get selector;
}
abstract class MegamorphicCache extends Object implements MegamorphicCacheRef {
- String get selector;
- int get mask;
- InstanceRef get buckets;
- InstanceRef get argumentsDescriptor;
+ String? get selector;
+ int? get mask;
+ InstanceRef? get buckets;
+ InstanceRef? get argumentsDescriptor;
}
diff --git a/runtime/observatory/lib/src/models/objects/metric.dart b/runtime/observatory/lib/src/models/objects/metric.dart
index fd8f7ac..13c1c78 100644
--- a/runtime/observatory/lib/src/models/objects/metric.dart
+++ b/runtime/observatory/lib/src/models/objects/metric.dart
@@ -5,12 +5,12 @@
part of models;
abstract class Metric {
- String get id;
- String get name;
- String get description;
+ String? get id;
+ String? get name;
+ String? get description;
}
abstract class MetricSample {
- double get value;
- DateTime get time;
+ double? get value;
+ DateTime? get time;
}
diff --git a/runtime/observatory/lib/src/models/objects/notification.dart b/runtime/observatory/lib/src/models/objects/notification.dart
index 1f46766..54e8c61 100644
--- a/runtime/observatory/lib/src/models/objects/notification.dart
+++ b/runtime/observatory/lib/src/models/objects/notification.dart
@@ -10,7 +10,7 @@
get exception;
/// [optional]
- StackTrace get stacktrace;
+ StackTrace? get stacktrace;
}
abstract class EventNotification implements Notification {
diff --git a/runtime/observatory/lib/src/models/objects/object.dart b/runtime/observatory/lib/src/models/objects/object.dart
index 044072f..6f258f6 100644
--- a/runtime/observatory/lib/src/models/objects/object.dart
+++ b/runtime/observatory/lib/src/models/objects/object.dart
@@ -6,7 +6,7 @@
abstract class ObjectRef {
/// A unique identifier for an Object.
- String get id;
+ String? get id;
}
abstract class Object implements ObjectRef {
@@ -18,7 +18,7 @@
///
/// Moving an Object into or out of the heap is considered a
/// backwards compatible change for types other than Instance.
- ClassRef get clazz;
+ ClassRef? get clazz;
/// [optional] The size of this object in the heap.
///
@@ -27,9 +27,9 @@
/// Note that the size can be zero for some objects. In the current
/// VM implementation, this occurs for small integers, which are
/// stored entirely within their object pointers.
- int get size;
+ int? get size;
- String get vmName;
+ String? get vmName;
}
abstract class RetainingObject {
diff --git a/runtime/observatory/lib/src/models/objects/objectpool.dart b/runtime/observatory/lib/src/models/objects/objectpool.dart
index ba65961..da7fd76 100644
--- a/runtime/observatory/lib/src/models/objects/objectpool.dart
+++ b/runtime/observatory/lib/src/models/objects/objectpool.dart
@@ -5,11 +5,11 @@
part of models;
abstract class ObjectPoolRef extends ObjectRef {
- int get length;
+ int? get length;
}
abstract class ObjectPool extends Object implements ObjectPoolRef {
- Iterable<ObjectPoolEntry> get entries;
+ Iterable<ObjectPoolEntry>? get entries;
}
enum ObjectPoolEntryKind { object, immediate, nativeEntryData, nativeEntry }
@@ -17,6 +17,6 @@
abstract class ObjectPoolEntry {
int get offset;
ObjectPoolEntryKind get kind;
- ObjectRef get asObject;
- int get asInteger;
+ ObjectRef? get asObject;
+ int? get asInteger;
}
diff --git a/runtime/observatory/lib/src/models/objects/pc_descriptors.dart b/runtime/observatory/lib/src/models/objects/pc_descriptors.dart
index fea4ce6..256a9dd 100644
--- a/runtime/observatory/lib/src/models/objects/pc_descriptors.dart
+++ b/runtime/observatory/lib/src/models/objects/pc_descriptors.dart
@@ -6,5 +6,5 @@
abstract class PcDescriptorsRef extends ObjectRef {
/// [optional]
- String get name;
+ String? get name;
}
diff --git a/runtime/observatory/lib/src/models/objects/sample_profile.dart b/runtime/observatory/lib/src/models/objects/sample_profile.dart
index 582e571..3dcd394 100644
--- a/runtime/observatory/lib/src/models/objects/sample_profile.dart
+++ b/runtime/observatory/lib/src/models/objects/sample_profile.dart
@@ -26,14 +26,14 @@
}
abstract class ProfileCode extends Profile {
- CodeRef get code;
+ CodeRef? get code;
Map<ProfileCode, int> get callers;
Map<ProfileCode, int> get callees;
}
abstract class ProfileFunction extends Profile {
- FunctionRef get function;
- String get resolvedUrl;
+ FunctionRef? get function;
+ String? get resolvedUrl;
Map<ProfileFunction, int> get callers;
Map<ProfileFunction, int> get callees;
}
diff --git a/runtime/observatory/lib/src/models/objects/script.dart b/runtime/observatory/lib/src/models/objects/script.dart
index df4b63b..a6ce8ee 100644
--- a/runtime/observatory/lib/src/models/objects/script.dart
+++ b/runtime/observatory/lib/src/models/objects/script.dart
@@ -6,23 +6,23 @@
abstract class ScriptRef extends ObjectRef {
/// The uri from which this script was loaded.
- String get uri;
+ String? get uri;
}
abstract class Script extends Object implements ScriptRef {
/// The library which owns this script.
- LibraryRef get library;
+ LibraryRef? get library;
/// The source code for this script. For certain built-in scripts,
/// this may be reconstructed without source comments.
- String get source;
+ String? get source;
- DateTime get loadTime;
- int get firstTokenPos;
- int get lastTokenPos;
- int get lineOffset;
- int get columnOffset;
+ DateTime? get loadTime;
+ int? get firstTokenPos;
+ int? get lastTokenPos;
+ int? get lineOffset;
+ int? get columnOffset;
- int tokenToLine(int token);
- int tokenToCol(int token);
+ int? tokenToLine(int? token);
+ int? tokenToCol(int? token);
}
diff --git a/runtime/observatory/lib/src/models/objects/single_target_cache.dart b/runtime/observatory/lib/src/models/objects/single_target_cache.dart
index 5178e7a..185df81 100644
--- a/runtime/observatory/lib/src/models/objects/single_target_cache.dart
+++ b/runtime/observatory/lib/src/models/objects/single_target_cache.dart
@@ -5,11 +5,11 @@
part of models;
abstract class SingleTargetCacheRef extends ObjectRef {
- Code get target;
+ Code? get target;
}
abstract class SingleTargetCache extends Object
implements SingleTargetCacheRef {
- int get lowerLimit;
- int get upperLimit;
+ int? get lowerLimit;
+ int? get upperLimit;
}
diff --git a/runtime/observatory/lib/src/models/objects/source_location.dart b/runtime/observatory/lib/src/models/objects/source_location.dart
index 8a03f13..27a7c59 100644
--- a/runtime/observatory/lib/src/models/objects/source_location.dart
+++ b/runtime/observatory/lib/src/models/objects/source_location.dart
@@ -9,7 +9,7 @@
ScriptRef get script;
/// [optional] The first token of the location.
- int get tokenPos;
+ int? get tokenPos;
}
abstract class SourceLocation implements Location {
@@ -17,19 +17,19 @@
int get tokenPos;
/// [optional] The last token of the location if this is a range.
- int get endTokenPos;
+ int? get endTokenPos;
}
abstract class UnresolvedSourceLocation implements Location {
/// [optional] The uri of the script containing the source location if the
/// script has yet to be loaded.
- String get scriptUri;
+ String? get scriptUri;
/// [optional] An approximate line number for the source location. This may
/// change when the location is resolved.
- int get line;
+ int? get line;
/// [optional] An approximate column number for the source location. This may
/// change when the location is resolved.
- int get column;
+ int? get column;
}
diff --git a/runtime/observatory/lib/src/models/objects/subtype_test_cache.dart b/runtime/observatory/lib/src/models/objects/subtype_test_cache.dart
index cf56939..99ab1b1 100644
--- a/runtime/observatory/lib/src/models/objects/subtype_test_cache.dart
+++ b/runtime/observatory/lib/src/models/objects/subtype_test_cache.dart
@@ -7,5 +7,5 @@
abstract class SubtypeTestCacheRef extends ObjectRef {}
abstract class SubtypeTestCache extends Object implements SubtypeTestCacheRef {
- InstanceRef get cache;
+ InstanceRef? get cache;
}
diff --git a/runtime/observatory/lib/src/models/objects/thread.dart b/runtime/observatory/lib/src/models/objects/thread.dart
index 8d16a8c..b29d3e6 100644
--- a/runtime/observatory/lib/src/models/objects/thread.dart
+++ b/runtime/observatory/lib/src/models/objects/thread.dart
@@ -15,17 +15,17 @@
abstract class Thread {
/// The id associated with the thread on creation.
- String get id;
+ String? get id;
/// The task type associated with the thread.
- ThreadKind get kind;
+ ThreadKind? get kind;
- String get kindString;
+ String? get kindString;
/// The maximum amount of zone memory in bytes allocated by a thread at a
/// given time throughout the entire life of the thread.
- int get zoneHighWatermark;
+ int? get zoneHighWatermark;
/// The current Zone capacity available to this thread.
- int get zoneCapacity;
+ int? get zoneCapacity;
}
diff --git a/runtime/observatory/lib/src/models/objects/type_arguments.dart b/runtime/observatory/lib/src/models/objects/type_arguments.dart
index a3614dd..ffe2186 100644
--- a/runtime/observatory/lib/src/models/objects/type_arguments.dart
+++ b/runtime/observatory/lib/src/models/objects/type_arguments.dart
@@ -6,7 +6,7 @@
abstract class TypeArgumentsRef extends ObjectRef {
/// A name for this type argument list.
- String get name;
+ String? get name;
}
abstract class TypeArguments extends Object implements TypeArgumentsRef {
@@ -14,5 +14,5 @@
///
/// The value will always be one of the kinds:
/// Type, TypeRef, TypeParameter.
- Iterable<InstanceRef> get types;
+ Iterable<InstanceRef>? get types;
}
diff --git a/runtime/observatory/lib/src/models/objects/unknown.dart b/runtime/observatory/lib/src/models/objects/unknown.dart
index 3faeed0..9228c8e 100644
--- a/runtime/observatory/lib/src/models/objects/unknown.dart
+++ b/runtime/observatory/lib/src/models/objects/unknown.dart
@@ -5,5 +5,5 @@
part of models;
abstract class UnknownObjectRef extends ObjectRef {
- String get vmType;
+ String? get vmType;
}
diff --git a/runtime/observatory/lib/src/models/objects/unlinked_call.dart b/runtime/observatory/lib/src/models/objects/unlinked_call.dart
index ed07750..37980ec 100644
--- a/runtime/observatory/lib/src/models/objects/unlinked_call.dart
+++ b/runtime/observatory/lib/src/models/objects/unlinked_call.dart
@@ -5,9 +5,9 @@
part of models;
abstract class UnlinkedCallRef extends ObjectRef {
- String get selector;
+ String? get selector;
}
abstract class UnlinkedCall extends Object implements UnlinkedCallRef {
- InstanceRef get argumentsDescriptor;
+ InstanceRef? get argumentsDescriptor;
}
diff --git a/runtime/observatory/lib/src/models/objects/vm.dart b/runtime/observatory/lib/src/models/objects/vm.dart
index b69d744..10deac8 100644
--- a/runtime/observatory/lib/src/models/objects/vm.dart
+++ b/runtime/observatory/lib/src/models/objects/vm.dart
@@ -6,11 +6,11 @@
abstract class VMRef {
/// A name identifying this vm. Not guaranteed to be unique.
- String get name;
+ String? get name;
/// [Not actually from the apis]
/// A name used to identify the VM in the UI.
- String get displayName;
+ String? get displayName;
}
abstract class VM implements VMRef {
@@ -47,7 +47,7 @@
/// The time that the VM started in milliseconds since the epoch.
///
/// Suitable to pass to DateTime.fromMillisecondsSinceEpoch.
- DateTime get startTime;
+ DateTime? get startTime;
// A list of isolates running in the VM.
Iterable<IsolateRef> get isolates;
diff --git a/runtime/observatory/lib/src/models/repositories/metric.dart b/runtime/observatory/lib/src/models/repositories/metric.dart
index ee10fdb..ed90d50 100644
--- a/runtime/observatory/lib/src/models/repositories/metric.dart
+++ b/runtime/observatory/lib/src/models/repositories/metric.dart
@@ -14,7 +14,7 @@
MetricSamplingRate getSamplingRate(IsolateRef isolate, Metric metric);
void setBufferSize(IsolateRef isolate, Metric metric, MetricBufferSize r);
MetricBufferSize getBufferSize(IsolateRef isolate, Metric metric);
- Iterable<MetricSample> getSamples(IsolateRef isolate, Metric metric);
+ Iterable<MetricSample>? getSamples(IsolateRef isolate, Metric metric);
double getMinValue(IsolateRef isolate, Metric metric);
double getMaxValue(IsolateRef isolate, Metric metric);
}
diff --git a/runtime/observatory/lib/src/models/repositories/target.dart b/runtime/observatory/lib/src/models/repositories/target.dart
index 2c2db92..a443a54 100644
--- a/runtime/observatory/lib/src/models/repositories/target.dart
+++ b/runtime/observatory/lib/src/models/repositories/target.dart
@@ -11,11 +11,11 @@
abstract class TargetRepository {
Stream<TargetChangeEvent> get onChange;
- Target get current;
+ Target? get current;
Iterable<Target> list();
void add(String address);
void setCurrent(Target t);
void delete(Target o);
- Target find(String networkAddress);
+ Target? find(String networkAddress);
bool isConnectedVMTarget(Target target);
}
diff --git a/runtime/observatory/lib/src/repositories/allocation_profile.dart b/runtime/observatory/lib/src/repositories/allocation_profile.dart
index 365a6fc..5dc8667 100644
--- a/runtime/observatory/lib/src/repositories/allocation_profile.dart
+++ b/runtime/observatory/lib/src/repositories/allocation_profile.dart
@@ -22,7 +22,7 @@
params['reset'] = true;
}
final dynamic response = await isolate.invokeRpc(_api, params);
- Map defaults;
+ Map? defaults;
if (combine) {
defaults = await isolate.vm.invokeRpcNoUpgrade(_defaultsApi, {});
defaults = defaults['map'];
diff --git a/runtime/observatory/lib/src/repositories/breakpoint.dart b/runtime/observatory/lib/src/repositories/breakpoint.dart
index 99a66ca..7465cb0 100644
--- a/runtime/observatory/lib/src/repositories/breakpoint.dart
+++ b/runtime/observatory/lib/src/repositories/breakpoint.dart
@@ -8,12 +8,12 @@
Future addOnActivation(M.IsolateRef i, M.Instance closure) async {
S.Isolate isolate = i as S.Isolate;
assert(isolate != null);
- await isolate.addBreakOnActivation(closure);
+ await isolate.addBreakOnActivation(closure as S.Instance);
}
Future remove(M.IsolateRef i, M.Breakpoint breakpoint) async {
S.Isolate isolate = i as S.Isolate;
assert(isolate != null);
- await isolate.removeBreakpoint(breakpoint);
+ await isolate.removeBreakpoint(breakpoint as S.Breakpoint);
}
}
diff --git a/runtime/observatory/lib/src/repositories/editor.dart b/runtime/observatory/lib/src/repositories/editor.dart
index d58cb36..2728b14 100644
--- a/runtime/observatory/lib/src/repositories/editor.dart
+++ b/runtime/observatory/lib/src/repositories/editor.dart
@@ -6,24 +6,24 @@
class EditorRepository extends M.EditorRepository {
final S.VM _vm;
- final String _editor;
+ final String? _editor;
bool get isAvailable => _getService() != null;
- EditorRepository(S.VM vm, {String editor})
+ EditorRepository(S.VM vm, {String? editor})
: _vm = vm,
_editor = editor {
assert(_vm != null);
}
- S.Service _getService() {
+ S.Service? _getService() {
Iterable<M.Service> services =
_vm.services.where((s) => s.service == 'openSourceLocation');
if (_editor != null) {
services = services.where((s) => s.alias == _editor);
}
if (services.isNotEmpty) {
- return services.first;
+ return services.first as S.Service;
}
return null;
}
@@ -70,7 +70,7 @@
return await openClass(i, o);
}
if (o is M.InstanceRef) {
- return await openClass(i, o.clazz);
+ return await openClass(i, o.clazz!);
}
if (o is M.FieldRef) {
return await openField(i, o);
@@ -80,18 +80,18 @@
}
if (o is M.InstanceRef) {
if (o.closureFunction != null) {
- return await openFunction(i, o.closureFunction);
+ return await openFunction(i, o.closureFunction!);
}
- return await openClass(i, o.clazz);
+ return await openClass(i, o.clazz!);
}
return new Future.value();
}
- Future openSourceLocation(M.IsolateRef i, M.SourceLocation l) async {
+ Future openSourceLocation(M.IsolateRef i, M.SourceLocation? l) async {
final isolate = i as S.Isolate;
assert(isolate != null);
assert(l != null);
- return await isolate.invokeRpc(_getService().method,
- {'scriptId': l.script.id, 'tokenPos': l.tokenPos});
+ return await isolate.invokeRpc(_getService()!.method,
+ {'scriptId': l!.script.id!, 'tokenPos': l.tokenPos});
}
}
diff --git a/runtime/observatory/lib/src/repositories/inbound_references.dart b/runtime/observatory/lib/src/repositories/inbound_references.dart
index a9b63e0..18895fc 100644
--- a/runtime/observatory/lib/src/repositories/inbound_references.dart
+++ b/runtime/observatory/lib/src/repositories/inbound_references.dart
@@ -10,6 +10,6 @@
assert(isolate != null);
final response = await isolate
.invokeRpc('getInboundReferences', {'targetId': id, 'limit': 100});
- return new S.InboundReferences(response);
+ return new S.InboundReferences(response as S.ServiceMap);
}
}
diff --git a/runtime/observatory/lib/src/repositories/isolate.dart b/runtime/observatory/lib/src/repositories/isolate.dart
index 68b8ae1..e72431a 100644
--- a/runtime/observatory/lib/src/repositories/isolate.dart
+++ b/runtime/observatory/lib/src/repositories/isolate.dart
@@ -25,7 +25,7 @@
return isolate;
}
- Future reloadSources(M.IsolateRef i, {M.Service service}) async {
+ Future reloadSources(M.IsolateRef i, {M.Service? service}) async {
if (service == null) {
S.Isolate isolate = i as S.Isolate;
assert(isolate != null);
diff --git a/runtime/observatory/lib/src/repositories/metric.dart b/runtime/observatory/lib/src/repositories/metric.dart
index 2d90187..e1b7a9a 100644
--- a/runtime/observatory/lib/src/repositories/metric.dart
+++ b/runtime/observatory/lib/src/repositories/metric.dart
@@ -26,14 +26,14 @@
<S.Isolate, Map<Metric, int>>{};
final Map<S.Isolate, Map<Metric, int>> _sizes =
<S.Isolate, Map<Metric, int>>{};
- Timer _timer;
+ Timer? _timer;
int count = 0;
Future<Iterable<Metric>> list(M.IsolateRef i) async {
S.Isolate isolate = i as S.Isolate;
assert(isolate != null);
if (_samples.containsKey(isolate)) {
- return _samples[isolate].keys;
+ return _samples[isolate]!.keys;
}
return const [];
}
@@ -71,14 +71,14 @@
_rates.remove(isolate);
_sizes.remove(isolate);
if (_samples.isEmpty) {
- _timer.cancel();
+ _timer!.cancel();
}
}
}
M.MetricSamplingRate getSamplingRate(M.IsolateRef i, M.Metric m) {
if (_rates.containsKey(i)) {
- final metrics = _rates[i];
+ final metrics = _rates[i]!;
if (metrics.containsKey(m)) {
switch (metrics[m]) {
case 0:
@@ -101,9 +101,9 @@
void setSamplingRate(M.IsolateRef i, M.Metric m, M.MetricSamplingRate r) {
if (_rates.containsKey(i)) {
- final metrics = _rates[i];
+ final metrics = _rates[i]!;
if (metrics.containsKey(m)) {
- metrics[m] = _rateToInteger(r);
+ metrics[m as Metric] = _rateToInteger(r);
}
} else {
throw new Exception('Sampling for isolate ${i.id} is not started');
@@ -112,7 +112,7 @@
M.MetricBufferSize getBufferSize(M.IsolateRef i, M.Metric m) {
if (_sizes.containsKey(i)) {
- final metrics = _sizes[i];
+ final metrics = _sizes[i]!;
if (metrics.containsKey(m)) {
switch (metrics[m]) {
case 10:
@@ -129,9 +129,9 @@
void setBufferSize(M.IsolateRef i, M.Metric m, M.MetricBufferSize s) {
if (_sizes.containsKey(i)) {
- final metrics = _sizes[i];
+ final metrics = _sizes[i]!;
if (metrics.containsKey(m)) {
- metrics[m] = _sizeToInteger(s);
+ metrics[m as Metric] = _sizeToInteger(s);
}
} else {
throw new Exception('Sampling for isolate ${i.id} is not started');
@@ -168,9 +168,9 @@
throw new Exception('Unknown MetricBufferSize ($s)');
}
- Iterable<M.MetricSample> getSamples(M.IsolateRef i, M.Metric m) {
+ Iterable<M.MetricSample>? getSamples(M.IsolateRef i, M.Metric m) {
if (_samples.containsKey(i)) {
- final metrics = _samples[i];
+ final metrics = _samples[i]!;
if (metrics.containsKey(m)) {
return metrics[m];
}
@@ -192,12 +192,12 @@
void _update(_) {
for (final isolate in _rates.keys) {
- final metrics = _rates[isolate];
+ final metrics = _rates[isolate]!;
for (final metric in metrics.keys) {
- final rate = metrics[metric];
+ final rate = metrics[metric]!;
if (rate != 0 && count % rate == 0) {
- final size = _sizes[isolate][metric];
- final samples = _samples[isolate][metric];
+ final size = _sizes[isolate]![metric]!;
+ final samples = _samples[isolate]![metric]!;
metric.internal.reload().then((m) {
if (samples.length >= size) {
samples.removeRange(0, samples.length - size + 1);
diff --git a/runtime/observatory/lib/src/repositories/notification.dart b/runtime/observatory/lib/src/repositories/notification.dart
index 19eb99e..22a891f 100644
--- a/runtime/observatory/lib/src/repositories/notification.dart
+++ b/runtime/observatory/lib/src/repositories/notification.dart
@@ -47,7 +47,7 @@
if (_list.length != length) _notify();
}
- void deletePauseEvents({M.Isolate isolate}) {
+ void deletePauseEvents({M.Isolate? isolate}) {
if (isolate == null) {
deleteWhere((notification) {
return notification is M.EventNotification &&
diff --git a/runtime/observatory/lib/src/repositories/persistent_handles.dart b/runtime/observatory/lib/src/repositories/persistent_handles.dart
index db94cbc..7716529 100644
--- a/runtime/observatory/lib/src/repositories/persistent_handles.dart
+++ b/runtime/observatory/lib/src/repositories/persistent_handles.dart
@@ -9,6 +9,6 @@
S.Isolate isolate = i as S.Isolate;
assert(isolate != null);
final response = await isolate.invokeRpc('_getPersistentHandles', {});
- return new S.PersistentHandles(response);
+ return new S.PersistentHandles(response as S.ServiceMap);
}
}
diff --git a/runtime/observatory/lib/src/repositories/ports.dart b/runtime/observatory/lib/src/repositories/ports.dart
index 324ef74..21f56ad 100644
--- a/runtime/observatory/lib/src/repositories/ports.dart
+++ b/runtime/observatory/lib/src/repositories/ports.dart
@@ -9,6 +9,6 @@
S.Isolate isolate = i as S.Isolate;
assert(isolate != null);
final response = await isolate.invokeRpc('_getPorts', {});
- return new S.Ports(response);
+ return new S.Ports(response as S.ServiceMap);
}
}
diff --git a/runtime/observatory/lib/src/repositories/retaining_path.dart b/runtime/observatory/lib/src/repositories/retaining_path.dart
index cfe4c38..8d0f1b3 100644
--- a/runtime/observatory/lib/src/repositories/retaining_path.dart
+++ b/runtime/observatory/lib/src/repositories/retaining_path.dart
@@ -10,6 +10,6 @@
assert(isolate != null);
final response = await isolate
.invokeRpc('getRetainingPath', {'targetId': id, 'limit': 100});
- return new S.RetainingPath(response);
+ return new S.RetainingPath(response as S.ServiceMap);
}
}
diff --git a/runtime/observatory/lib/src/repositories/sample_profile.dart b/runtime/observatory/lib/src/repositories/sample_profile.dart
index 944eaba..edb45cc 100644
--- a/runtime/observatory/lib/src/repositories/sample_profile.dart
+++ b/runtime/observatory/lib/src/repositories/sample_profile.dart
@@ -17,7 +17,7 @@
_onProgress.stream;
final S.ServiceObjectOwner owner;
- final S.Class cls;
+ final S.Class? cls;
final M.SampleProfileTag tag;
final bool clear;
final M.SampleProfileType type;
@@ -26,13 +26,13 @@
double _progress = 0.0;
final _fetchingTime = Stopwatch();
final _loadingTime = Stopwatch();
- SampleProfile _profile;
+ SampleProfile? _profile;
M.SampleProfileLoadingStatus get status => _status;
double get progress => _progress;
Duration get fetchingTime => _fetchingTime.elapsed;
Duration get loadingTime => _loadingTime.elapsed;
- SampleProfile get profile => _profile;
+ SampleProfile get profile => _profile!;
SampleProfileLoadingProgress(this.owner, this.tag, this.clear,
{this.type: M.SampleProfileType.cpu, this.cls}) {
@@ -49,7 +49,7 @@
var response;
if (type == M.SampleProfileType.cpu) {
response = cls != null
- ? await cls.getAllocationSamples()
+ ? await cls!.getAllocationSamples()
: await owner.invokeRpc('getCpuSamples', {'_code': true});
} else if (type == M.SampleProfileType.memory) {
assert(owner is M.VM);
@@ -65,7 +65,8 @@
_triggerOnProgress();
SampleProfile profile = SampleProfile();
- Stream<double> progress = profile.loadProgress(owner, response);
+ Stream<double> progress =
+ profile.loadProgress(owner, response as S.ServiceMap);
progress.listen((value) {
_progress = value;
_triggerOnProgress();
@@ -98,7 +99,7 @@
}
void reuse(M.SampleProfileTag t) {
- _profile.tagOrder = t;
+ _profile!.tagOrder = t;
final onProgress =
StreamController<SampleProfileLoadingProgressEvent>.broadcast();
Timer.run(() {
@@ -111,7 +112,7 @@
class IsolateSampleProfileRepository
implements M.IsolateSampleProfileRepository {
- SampleProfileLoadingProgress _last;
+ SampleProfileLoadingProgress? _last;
Stream<SampleProfileLoadingProgressEvent> get(
M.IsolateRef i, M.SampleProfileTag t,
@@ -120,12 +121,12 @@
assert(forceFetch != null);
S.Isolate isolate = i as S.Isolate;
assert(isolate != null);
- if ((_last != null) && !clear && !forceFetch && (_last.owner == isolate)) {
- _last.reuse(t);
+ if ((_last != null) && !clear && !forceFetch && (_last!.owner == isolate)) {
+ _last!.reuse(t);
} else {
_last = SampleProfileLoadingProgress(isolate, t, clear);
}
- return _last.onProgress;
+ return _last!.onProgress;
}
}
@@ -155,7 +156,7 @@
class NativeMemorySampleProfileRepository
implements M.NativeMemorySampleProfileRepository {
- SampleProfileLoadingProgress _last;
+ SampleProfileLoadingProgress? _last;
Stream<SampleProfileLoadingProgressEvent> get(M.VM vm, M.SampleProfileTag t,
{bool forceFetch: false, bool clear: false}) {
@@ -163,12 +164,12 @@
S.VM owner = vm as S.VM;
assert(owner != null);
- if ((_last != null) && (_last.profile != null) && !forceFetch) {
- _last.reuse(t);
+ if ((_last != null) && (_last!.profile != null) && !forceFetch) {
+ _last!.reuse(t);
} else {
_last = SampleProfileLoadingProgress(owner, t, false,
type: M.SampleProfileType.memory);
}
- return _last.onProgress;
+ return _last!.onProgress;
}
}
diff --git a/runtime/observatory/lib/src/repositories/target.dart b/runtime/observatory/lib/src/repositories/target.dart
index 4fb1fb1..eec61d0 100644
--- a/runtime/observatory/lib/src/repositories/target.dart
+++ b/runtime/observatory/lib/src/repositories/target.dart
@@ -20,7 +20,7 @@
final SettingsRepository _settings = new SettingsRepository('targetManager');
final List<SC.WebSocketVMTarget> _list = <SC.WebSocketVMTarget>[];
- SC.WebSocketVMTarget current;
+ SC.WebSocketVMTarget? current;
final IsConnectedVMTargetDelegate _isConnectedVMTarget;
factory TargetRepository(IsConnectedVMTargetDelegate isConnectedVMTarget) {
@@ -59,7 +59,7 @@
return;
}
current = target;
- current.lastConnectionTime = new DateTime.now().millisecondsSinceEpoch;
+ current!.lastConnectionTime = new DateTime.now().millisecondsSinceEpoch;
_onChange.add(new TargetChangeEvent(this));
_store();
}
@@ -99,7 +99,7 @@
}
/// Find by networkAddress.
- SC.WebSocketVMTarget find(String networkAddress) {
+ SC.WebSocketVMTarget? find(String networkAddress) {
for (SC.WebSocketVMTarget item in _list) {
if (item.networkAddress == networkAddress) {
return item;
@@ -114,8 +114,8 @@
// http://localhost:8080?override-port=8181
// http://localhost:8080?override-port=8181&override-host=10.0.0.2
final Uri serverAddress = Uri.parse(window.location.toString());
- final String port = serverAddress.queryParameters['override-port'];
- final String host = serverAddress.queryParameters['override-host'];
+ final String? port = serverAddress.queryParameters['override-port'];
+ final String? host = serverAddress.queryParameters['override-host'];
final Uri wsAddress = new Uri(
scheme: 'ws',
host: host ?? serverAddress.host,
diff --git a/runtime/observatory/lib/src/repositories/timeline.dart b/runtime/observatory/lib/src/repositories/timeline.dart
index 7c0e4a7..834e637 100644
--- a/runtime/observatory/lib/src/repositories/timeline.dart
+++ b/runtime/observatory/lib/src/repositories/timeline.dart
@@ -11,7 +11,8 @@
Future<M.TimelineFlags> getFlags(M.VMRef ref) async {
S.VM vm = ref as S.VM;
- S.ServiceMap response = await vm.invokeRpc('getVMTimelineFlags', {});
+ S.ServiceMap response =
+ await vm.invokeRpc('getVMTimelineFlags', {}) as S.ServiceMap;
return new S.TimelineFlags(response);
}
@@ -36,7 +37,7 @@
final trie = profile.loadFunctionTree(M.ProfileTreeDirection.inclusive);
final root = trie.root;
int nextId = kRootFrameId;
- processFrame(FunctionCallTreeNode current, FunctionCallTreeNode parent) {
+ processFrame(FunctionCallTreeNode current, FunctionCallTreeNode? parent) {
int id = nextId;
++nextId;
current.frameId = id;
diff --git a/runtime/observatory/lib/src/repositories/timeline_base.dart b/runtime/observatory/lib/src/repositories/timeline_base.dart
index 6f12bc0..24a5daf 100644
--- a/runtime/observatory/lib/src/repositories/timeline_base.dart
+++ b/runtime/observatory/lib/src/repositories/timeline_base.dart
@@ -18,11 +18,12 @@
Future<S.ServiceObject> cpuSamples) async {
const kRootFrameId = 0;
final profile = SampleProfile();
- await profile.load(isolate as S.ServiceObjectOwner, await cpuSamples);
+ await profile.load(
+ isolate as S.ServiceObjectOwner, await cpuSamples as S.ServiceMap);
final trie = profile.loadFunctionTree(M.ProfileTreeDirection.inclusive);
final root = trie.root;
int nextId = kRootFrameId;
- processFrame(FunctionCallTreeNode current, FunctionCallTreeNode parent) {
+ processFrame(FunctionCallTreeNode current, FunctionCallTreeNode? parent) {
int id = nextId;
++nextId;
current.frameId = id;
@@ -64,7 +65,7 @@
}
Future<Map> getCpuProfileTimeline(M.VMRef ref,
- {int timeOriginMicros, int timeExtentMicros}) async {
+ {int? timeOriginMicros, int? timeExtentMicros}) async {
final S.VM vm = ref as S.VM;
final traceObject = <String, dynamic>{
_kStackFrames: {},
@@ -86,10 +87,10 @@
Future<Map> getTimeline(M.VMRef ref) async {
final S.VM vm = ref as S.VM;
final S.ServiceMap vmTimelineResponse =
- await vm.invokeRpc('getVMTimeline', {});
+ await vm.invokeRpc('getVMTimeline', {}) as S.ServiceMap;
final timeOriginMicros = vmTimelineResponse[kTimeOriginMicros];
final timeExtentMicros = vmTimelineResponse[kTimeExtentMicros];
- var traceObject = <String, dynamic>{
+ var traceObject = <dynamic, dynamic>{
_kStackFrames: {},
_kTraceEvents: [],
};
diff --git a/runtime/observatory/lib/src/sample_profile/sample_profile.dart b/runtime/observatory/lib/src/sample_profile/sample_profile.dart
index 48667cc..06280ce 100644
--- a/runtime/observatory/lib/src/sample_profile/sample_profile.dart
+++ b/runtime/observatory/lib/src/sample_profile/sample_profile.dart
@@ -16,8 +16,8 @@
final attributes = <String>{};
// Used for building timeline
- int frameId = null;
- int parentId = null;
+ int? frameId = null;
+ int? parentId = null;
// Either a ProfileCode or a ProfileFunction.
Object get profileData;
@@ -38,7 +38,8 @@
void tick(Map sample, {bool exclusive = false}) {
++_count;
if (SampleProfile._isNativeAllocationSample(sample)) {
- final allocationSize = sample[SampleProfile._kNativeAllocationSizeBytes];
+ final allocationSize =
+ sample[SampleProfile._kNativeAllocationSizeBytes] as int;
if (exclusive) {
exclusiveNativeAllocations += allocationSize;
}
@@ -54,7 +55,7 @@
Object get profileData => profileCode;
- String get name => profileCode.code.name;
+ String get name => profileCode.code.name!;
final attributes = <String>{};
CodeCallTreeNode(this.profileCode, int count, int inclusiveNativeAllocations,
@@ -66,7 +67,7 @@
}
CodeCallTreeNode.fromIndex(this.profile, int tableIndex)
- : profileCode = profile.codes[tableIndex],
+ : profileCode = profile.codes[tableIndex] as ProfileCode,
super(<CodeCallTreeNode>[]);
CodeCallTreeNode getChild(int codeTableIndex) {
@@ -116,14 +117,15 @@
treeFilter.build();
if ((treeFilter.filtered.root.inclusiveNativeAllocations != null) &&
(treeFilter.filtered.root.inclusiveNativeAllocations != 0)) {
- _setCodeMemoryPercentage(null, treeFilter.filtered.root);
+ _setCodeMemoryPercentage(
+ null, treeFilter.filtered.root as CodeCallTreeNode);
} else {
- _setCodePercentage(null, treeFilter.filtered.root);
+ _setCodePercentage(null, treeFilter.filtered.root as CodeCallTreeNode);
}
- return treeFilter.filtered;
+ return treeFilter.filtered as CodeCallTree;
}
- _setCodePercentage(CodeCallTreeNode parent, CodeCallTreeNode node) {
+ _setCodePercentage(CodeCallTreeNode? parent, CodeCallTreeNode node) {
assert(node != null);
var parentPercentage = 1.0;
var parentCount = node.count;
@@ -141,7 +143,7 @@
}
}
- _setCodeMemoryPercentage(CodeCallTreeNode parent, CodeCallTreeNode node) {
+ _setCodeMemoryPercentage(CodeCallTreeNode? parent, CodeCallTreeNode node) {
assert(node != null);
var parentPercentage = 1.0;
var parentMemory = node.inclusiveNativeAllocations;
@@ -164,7 +166,7 @@
}
_recordCallerAndCalleesInner(
- CodeCallTreeNode caller, CodeCallTreeNode callee) {
+ CodeCallTreeNode? caller, CodeCallTreeNode callee) {
if (caller != null) {
caller.profileCode._recordCallee(callee.profileCode, callee.count);
callee.profileCode._recordCaller(caller.profileCode, caller.count);
@@ -208,7 +210,7 @@
}
FunctionCallTreeNode.fromIndex(this.profile, int tableIndex)
- : profileFunction = profile.functions[tableIndex],
+ : profileFunction = profile.functions[tableIndex] as ProfileFunction,
super(<FunctionCallTreeNode>[]);
FunctionCallTreeNode getChild(int functionTableIndex) {
@@ -263,7 +265,7 @@
_descend(_unfilteredTree.root);
}
- CallTreeNode _findInChildren(CallTreeNode current, CallTreeNode needle) {
+ CallTreeNode? _findInChildren(CallTreeNode current, CallTreeNode needle) {
for (var child in current.children) {
if ((child as CallTreeNode).profileData == needle.profileData) {
return child;
@@ -276,7 +278,7 @@
/// Add all nodes in [_currentPath].
FunctionCallTreeNode _addCurrentPath() {
- FunctionCallTreeNode current = filtered.root;
+ FunctionCallTreeNode current = filtered.root as FunctionCallTreeNode;
// Tree root is always the first element of the current path.
assert(_unfilteredTree.root == _currentPath[0]);
// Assert that unfiltered tree's root and filtered tree's root are different.
@@ -289,38 +291,38 @@
if (child == null) {
// New node.
child = _copyNode(toAdd);
- current.children.add(child);
+ current.children.add(child as FunctionCallTreeNode);
}
- current = child;
+ current = child as FunctionCallTreeNode;
}
return current;
}
/// Starting at [current] append [next] and all of [next]'s sub-trees
- _appendTree(CallTreeNode current, CallTreeNode next) {
+ _appendTree(CallTreeNode current, CallTreeNode? next) {
if (next == null) {
return;
}
var child = _findInChildren(current, next);
if (child == null) {
- child = _copyNode(next);
+ child = _copyNode(next as NodeT);
current.children.add(child);
}
current = child;
for (var nextChild in next.children) {
- _appendTree(current, nextChild);
+ _appendTree(current, nextChild as CallTreeNode);
}
}
/// Add path from root to [child], [child], and all of [child]'s sub-trees
/// to filtered tree.
- _addTree(CallTreeNode child) {
+ _addTree(CallTreeNode? child) {
var current = _addCurrentPath();
_appendTree(current, child);
}
/// Descend further into the tree. [current] is from the unfiltered tree.
- _descend(CallTreeNode current) {
+ _descend(CallTreeNode? current) {
if (current == null) {
return;
}
@@ -334,13 +336,13 @@
} else {
// Add all child trees.
for (var child in current.children) {
- _addTree(child);
+ _addTree(child as CallTreeNode);
}
}
} else {
// Did not match, descend to each child.
for (var child in current.children) {
- _descend(child);
+ _descend(child as CallTreeNode);
}
}
@@ -359,13 +361,13 @@
FunctionCallTree(
tree.inclusive,
FunctionCallTreeNode(
- tree.root.profileData,
+ tree.root.profileData as ProfileFunction,
tree.root.count,
tree.root.inclusiveNativeAllocations,
tree.root.exclusiveNativeAllocations)));
_copyNode(FunctionCallTreeNode node) {
- return FunctionCallTreeNode(node.profileData, node.count,
+ return FunctionCallTreeNode(node.profileData as ProfileFunction, node.count,
node.inclusiveNativeAllocations, node.exclusiveNativeAllocations);
}
}
@@ -379,13 +381,13 @@
CodeCallTree(
tree.inclusive,
CodeCallTreeNode(
- tree.root.profileData,
+ tree.root.profileData as ProfileCode,
tree.root.count,
tree.root.inclusiveNativeAllocations,
tree.root.exclusiveNativeAllocations)));
_copyNode(CodeCallTreeNode node) {
- return CodeCallTreeNode(node.profileData, node.count,
+ return CodeCallTreeNode(node.profileData as ProfileCode, node.count,
node.inclusiveNativeAllocations, node.exclusiveNativeAllocations);
}
}
@@ -407,15 +409,17 @@
treeFilter.build();
if ((treeFilter.filtered.root.inclusiveNativeAllocations != null) &&
(treeFilter.filtered.root.inclusiveNativeAllocations != 0)) {
- _setFunctionMemoryPercentage(null, treeFilter.filtered.root);
+ _setFunctionMemoryPercentage(
+ null, treeFilter.filtered.root as FunctionCallTreeNode);
} else {
- _setFunctionPercentage(null, treeFilter.filtered.root);
+ _setFunctionPercentage(
+ null, treeFilter.filtered.root as FunctionCallTreeNode);
}
- return treeFilter.filtered;
+ return treeFilter.filtered as FunctionCallTree;
}
void _setFunctionPercentage(
- FunctionCallTreeNode parent, FunctionCallTreeNode node) {
+ FunctionCallTreeNode? parent, FunctionCallTreeNode node) {
assert(node != null);
var parentPercentage = 1.0;
var parentCount = node.count;
@@ -434,7 +438,7 @@
}
void _setFunctionMemoryPercentage(
- FunctionCallTreeNode parent, FunctionCallTreeNode node) {
+ FunctionCallTreeNode? parent, FunctionCallTreeNode node) {
assert(node != null);
var parentPercentage = 1.0;
var parentMemory = node.inclusiveNativeAllocations;
@@ -457,7 +461,7 @@
}
_markFunctionCallsInner(
- FunctionCallTreeNode caller, FunctionCallTreeNode callee) {
+ FunctionCallTreeNode? caller, FunctionCallTreeNode callee) {
if (caller != null) {
caller.profileFunction
._recordCallee(callee.profileFunction, callee.count);
@@ -495,8 +499,8 @@
final int tableIndex;
final SampleProfile profile;
final Code code;
- int exclusiveTicks;
- int inclusiveTicks;
+ int exclusiveTicks = 0;
+ int inclusiveTicks = 0;
double normalizedExclusiveTicks = 0.0;
double normalizedInclusiveTicks = 0.0;
final addressTicks = <int, CodeTick>{};
@@ -553,15 +557,15 @@
if (code.kind == M.CodeKind.stub) {
attributes.add('stub');
} else if (code.kind == M.CodeKind.dart) {
- if (code.isNative) {
+ if (code.isNative!) {
attributes.add('ffi'); // Not to be confused with a C function.
} else {
attributes.add('dart');
}
- if (code.hasIntrinsic) {
+ if (code.hasIntrinsic!) {
attributes.add('intrinsic');
}
- if (code.isOptimized) {
+ if (code.isOptimized!) {
attributes.add('optimized');
} else {
attributes.add('unoptimized');
@@ -680,7 +684,7 @@
attribs.add('native');
} else if (M.isSyntheticFunction(function.kind)) {
attribs.add('synthetic');
- } else if (function.isNative) {
+ } else if (function.isNative!) {
attribs.add('ffi'); // Not to be confused with a C function.
} else {
attribs.add('dart');
@@ -746,7 +750,7 @@
}
class SampleProfile extends M.SampleProfile {
- Isolate isolate;
+ Isolate? isolate;
int sampleCount = 0;
int samplePeriod = 0;
@@ -852,7 +856,7 @@
Future.delayed(duration);
Future _loadCommon(ServiceObjectOwner owner, ServiceMap profile,
- [StreamController<double> progress]) async {
+ [StreamController<double>? progress]) async {
final watch = Stopwatch();
watch.start();
int count = 0;
@@ -883,7 +887,7 @@
if ((owner != null) && (owner is Isolate)) {
isolate = owner;
- isolate.resetCachedProfileData();
+ isolate!.resetCachedProfileData();
}
pid = profile[_kPid];
@@ -957,32 +961,32 @@
int _getProfileFunctionTagIndex(String tag) {
if (_functionTagMapping.containsKey(tag)) {
- return _functionTagMapping[tag];
+ return _functionTagMapping[tag]!;
}
throw ArgumentError('$tag is not a valid tag!');
}
int _getProfileCodeTagIndex(String tag) {
if (_codeTagMapping.containsKey(tag)) {
- return _codeTagMapping[tag];
+ return _codeTagMapping[tag]!;
}
throw ArgumentError('$tag is not a valid tag!');
}
void _buildFunctionTagMapping() {
for (int i = 0; i < functions.length; ++i) {
- final function = functions[i].function;
+ final function = functions[i].function!;
if (function.kind == M.FunctionKind.tag) {
- _functionTagMapping[function.name] = i;
+ _functionTagMapping[function.name!] = i;
}
}
}
void _buildCodeTagMapping() {
for (int i = 0; i < codes.length; ++i) {
- final code = codes[i].code;
+ final code = codes[i].code!;
if (code.kind == M.CodeKind.tag) {
- _codeTagMapping[code.name] = i;
+ _codeTagMapping[code.name!] = i;
}
}
}
@@ -1010,7 +1014,7 @@
final tableIndex = isCode
? _getProfileCodeTagIndex(userTag)
: _getProfileFunctionTagIndex(userTag);
- current = current.getChild(tableIndex);
+ current = current.getChild(tableIndex) as NodeT;
current.tick(sample);
} catch (_) {/* invalid tag */} finally {
return current;
@@ -1024,7 +1028,7 @@
final tableIndex = isCode
? _getProfileCodeTagIndex(kTruncatedTag)
: _getProfileFunctionTagIndex(kTruncatedTag);
- current = current.getChild(tableIndex);
+ current = current.getChild(tableIndex) as NodeT;
current.tick(sample);
// We don't need to tick the tag itself since this is done in the VM for
// the truncated tag, unlike other VM and user tags.
@@ -1140,7 +1144,7 @@
Map sample, List<int> stack, int frameIndex, bool inclusive) {
final child = parent.getChild(stack[frameIndex]);
child.tick(sample, exclusive: (frameIndex == 0));
- return child;
+ return child as NodeT;
}
FunctionCallTreeNode buildFunctionTrie(bool inclusive) {
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index 046513d..7215ef7 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -54,8 +54,8 @@
static const kFileSystemDoesNotExist = 1002;
static const kFileDoesNotExist = 1003;
- int code;
- Map data;
+ int? code;
+ Map? data;
static _getMessage(Map errorMap) {
Map data = errorMap['data'];
@@ -83,12 +83,12 @@
String toString() => 'NetworkRpcException(${message})';
}
-Future<ServiceObject> ignoreNetworkErrors(Object error,
- [ServiceObject resultOnNetworkError = null]) {
+Future<ServiceObject?> ignoreNetworkErrors(Object error, StackTrace st,
+ [ServiceObject? resultOnNetworkError]) {
if (error is NetworkRpcException) {
return new Future.value(resultOnNetworkError);
}
- return new Future.error(error);
+ return new Future.error(error, st);
}
class MalformedResponseRpcException extends RpcException {
@@ -102,7 +102,7 @@
/// A [ServiceObject] represents a persistent object within the vm.
abstract class ServiceObject implements M.ObjectRef {
static int LexicalSortName(ServiceObject o1, ServiceObject o2) {
- return o1.name.compareTo(o2.name);
+ return o1.name!.compareTo(o2.name!);
}
List<T> removeDuplicatesAndSortLexical<T extends ServiceObject>(
@@ -112,26 +112,26 @@
/// The owner of this [ServiceObject]. This can be an [Isolate], a
/// [VM], or null.
- ServiceObjectOwner get owner => _owner;
- ServiceObjectOwner _owner;
+ ServiceObjectOwner? get owner => _owner;
+ ServiceObjectOwner? _owner;
/// The [VM] which owns this [ServiceObject].
- VM get vm => _owner.vm;
+ VM get vm => _owner!.vm;
/// The [Isolate] which owns this [ServiceObject]. May be null.
- Isolate get isolate => _owner.isolate;
+ Isolate? get isolate => _owner!.isolate;
/// The id of this object.
- String get id => _id;
- String _id;
+ String? get id => _id;
+ String? _id;
/// The user-level type of this object.
- String get type => _type;
- String _type;
+ String? get type => _type;
+ String? _type;
/// The vm type of this object.
- String get vmType => _vmType;
- String _vmType;
+ String? get vmType => _vmType;
+ String? _vmType;
bool get isICData => vmType == 'ICData';
bool get isMegamorphicCache => vmType == 'MegamorphicCache';
@@ -169,23 +169,20 @@
/// Is this object cacheable? That is, is it impossible for the [id]
/// of this object to change?
- bool _canCache;
+ late bool _canCache;
bool get canCache => _canCache;
/// Is this object immutable after it is [loaded]?
bool get immutable => false;
- String name;
- String vmName;
+ String? name;
+ String? vmName;
/// Creates an empty [ServiceObject].
- ServiceObject._empty(this._owner);
+ ServiceObject._empty(ServiceObjectOwner? this._owner);
/// Creates a [ServiceObject] initialized from [map].
- factory ServiceObject._fromMap(ServiceObjectOwner owner, Map map) {
- if (map == null) {
- return null;
- }
+ static ServiceObject _fromMap(ServiceObjectOwner? owner, Map map) {
if (!_isServiceMap(map)) {
Logger.root.severe('Malformed service object: $map');
}
@@ -227,10 +224,10 @@
obj = new ServiceMetric._empty(owner);
break;
case 'Isolate':
- obj = new Isolate._empty(owner.vm);
+ obj = new Isolate._empty(owner!.vm);
break;
case 'IsolateGroup':
- obj = new IsolateGroup._empty(owner.vm);
+ obj = new IsolateGroup._empty(owner!.vm);
break;
case 'Library':
obj = new Library._empty(owner);
@@ -316,14 +313,14 @@
return reload();
}
- Future<ServiceObject> _inProgressReload;
+ Future<ServiceObject>? _inProgressReload;
Future<Map> _fetchDirect({int count: kDefaultFieldLimit}) {
Map params = {
'objectId': id,
'count': count,
};
- return isolate.invokeRpcNoUpgrade('getObject', params);
+ return isolate!.invokeRpcNoUpgrade('getObject', params);
}
/// Reload [this]. Returns a future which completes to [this] or
@@ -347,7 +344,7 @@
var mapType = _stripRef(map['type']);
if (mapType == 'Sentinel') {
// An object may have been collected, etc.
- completer.complete(new ServiceObject._fromMap(owner, map));
+ completer.complete(ServiceObject._fromMap(owner, map));
} else {
// TODO(turnidge): Check for vmType changing as well?
assert(mapType == _type);
@@ -363,7 +360,7 @@
_inProgressReload = null;
});
}
- return _inProgressReload;
+ return _inProgressReload!;
}
/// Update [this] using [map] as a source. [map] can be a reference.
@@ -392,7 +389,6 @@
} else {
_vmType = _type;
}
-
_update(map, mapIsRef);
}
@@ -406,11 +402,11 @@
}
abstract class HeapObject extends ServiceObject implements M.Object {
- Class clazz;
- int size;
- int retainedSize;
+ Class? clazz;
+ int? size;
+ int? retainedSize;
- HeapObject._empty(ServiceObjectOwner owner) : super._empty(owner);
+ HeapObject._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
if (map['class'] != null) {
@@ -421,10 +417,12 @@
// Load the full class object if the isolate is runnable.
if (clazz != null) {
- if (clazz.isolate.runnable) {
+ if (clazz!.isolate!.runnable) {
// No one awaits on this request so we silence any network errors
// that occur here but forward other errors.
- clazz.load().catchError((error) => ignoreNetworkErrors(error, clazz));
+ clazz!
+ .load()
+ .catchError((error, st) => ignoreNetworkErrors(error, st, clazz));
}
}
@@ -436,14 +434,14 @@
}
class RetainingObject implements M.RetainingObject {
- int get retainedSize => object.retainedSize;
+ int get retainedSize => object.retainedSize!;
final HeapObject object;
RetainingObject(this.object);
}
abstract class ServiceObjectOwner extends ServiceObject {
/// Creates an empty [ServiceObjectOwner].
- ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner);
+ ServiceObjectOwner._empty(ServiceObjectOwner? owner) : super._empty(owner);
/// Builds a [ServiceObject] corresponding to the [id] from [map].
/// The result may come from the cache. The result will not necessarily
@@ -455,30 +453,30 @@
abstract class Location implements M.Location {
Script get script;
- int get tokenPos;
- Future<int> getLine();
- Future<int> getColumn();
+ int? get tokenPos;
+ Future<int?> getLine();
+ Future<int?> getColumn();
Future<String> toUserString();
}
/// A [SourceLocation] represents a location or range in the source code.
class SourceLocation extends ServiceObject
implements Location, M.SourceLocation {
- Script script;
- int tokenPos;
- int endTokenPos;
+ late Script script;
+ late int tokenPos;
+ int? endTokenPos;
- Future<int> getLine() async {
+ Future<int?> getLine() async {
await script.load();
return script.tokenToLine(tokenPos);
}
- Future<int> getColumn() async {
+ Future<int?> getColumn() async {
await script.load();
return script.tokenToCol(tokenPos);
}
- SourceLocation._empty(ServiceObject owner) : super._empty(owner);
+ SourceLocation._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
assert(!mapIsRef);
@@ -491,8 +489,8 @@
}
Future<String> toUserString() async {
- int line = await getLine();
- int column = await getColumn();
+ int? line = await getLine();
+ int? column = await getColumn();
return '${script.name}:${line}:${column}';
}
@@ -509,13 +507,13 @@
// code which has not been precisely mapped to a token position.
class UnresolvedSourceLocation extends ServiceObject
implements Location, M.UnresolvedSourceLocation {
- Script script;
- String scriptUri;
- int line;
- int column;
- int tokenPos;
+ late Script script;
+ String? scriptUri;
+ int? line;
+ int? column;
+ int? tokenPos;
- Future<int> getLine() async {
+ Future<int?> getLine() async {
if (tokenPos != null) {
await script.load();
return script.tokenToLine(tokenPos);
@@ -524,7 +522,7 @@
}
}
- Future<int> getColumn() async {
+ Future<int?> getColumn() async {
if (tokenPos != null) {
await script.load();
return script.tokenToCol(tokenPos);
@@ -533,7 +531,8 @@
}
}
- UnresolvedSourceLocation._empty(ServiceObject owner) : super._empty(owner);
+ UnresolvedSourceLocation._empty(ServiceObjectOwner? owner)
+ : super._empty(owner);
void _update(Map map, bool mapIsRef) {
assert(!mapIsRef);
@@ -551,8 +550,8 @@
Future<String> toUserString() async {
StringBuffer sb = new StringBuffer();
- int line = await getLine();
- int column = await getColumn();
+ int? line = await getLine();
+ int? column = await getColumn();
if (script != null) {
sb.write('${script.name}:');
@@ -596,10 +595,10 @@
List _controllers = [];
// Completes when the listen rpc is finished.
- Future _listenFuture;
+ Future? _listenFuture;
// Completes when then cancel rpc is finished.
- Future _cancelFuture;
+ Future? _cancelFuture;
_EventStreamState(this._vm, this.streamId, this._onDone);
@@ -609,7 +608,7 @@
assert(_listenFuture != null);
_listenFuture = null;
_cancelFuture = _vm._streamCancel(streamId);
- _cancelFuture.then((_) {
+ _cancelFuture!.then((_) {
if (_controllers.isEmpty) {
// No new listeners showed up during cancelation.
_onDone();
@@ -623,7 +622,7 @@
}
Future<Stream<ServiceEvent>> addStream() async {
- var controller;
+ late StreamController<ServiceEvent> controller;
controller = new StreamController<ServiceEvent>(
onCancel: () => _cancelController(controller));
_controllers.add(controller);
@@ -651,7 +650,7 @@
/// State for a VM being inspected.
abstract class VM extends ServiceObjectOwner implements M.VM {
VM get vm => this;
- Isolate get isolate => null;
+ Isolate? get isolate => null;
WebSocketVMTarget get target;
// TODO(turnidge): The connection should not be stored in the VM object.
@@ -676,34 +675,34 @@
final List<Service> services = <Service>[];
String version = 'unknown';
- String hostCPU;
- String targetCPU;
- String embedder;
- int architectureBits;
+ String hostCPU = 'unknown';
+ String targetCPU = 'unknown';
+ String embedder = 'unknown';
+ int architectureBits = 0;
bool assertsEnabled = false;
bool typeChecksEnabled = false;
int nativeZoneMemoryUsage = 0;
int pid = 0;
int heapAllocatedMemoryUsage = 0;
int heapAllocationCount = 0;
- int currentMemory;
- int maxRSS;
- int currentRSS;
+ int currentMemory = 0;
+ int maxRSS = 0;
+ int currentRSS = 0;
bool profileVM = false;
- DateTime startTime;
- DateTime refreshTime;
- Duration get upTime {
+ DateTime? startTime;
+ DateTime? refreshTime;
+ Duration? get upTime {
if (startTime == null) {
return null;
}
- return (new DateTime.now().difference(startTime));
+ return (new DateTime.now().difference(startTime!));
}
VM() : super._empty(null) {
updateFromServiceMap({'name': 'vm', 'type': '@VM'});
}
- void postServiceEvent(String streamId, Map response, Uint8List data) {
+ void postServiceEvent(String streamId, Map response, Uint8List? data) {
var map = response;
assert(!map.containsKey('_data'));
if (data != null) {
@@ -715,13 +714,13 @@
}
var eventIsolate = map['isolate'];
- var event;
+ ServiceEvent event;
if (eventIsolate == null) {
- event = new ServiceObject._fromMap(vm, map);
+ event = ServiceObject._fromMap(vm, map) as ServiceEvent;
} else {
// getFromMap creates the Isolate if it hasn't been seen already.
- var isolate = getFromMap(map['isolate']);
- event = new ServiceObject._fromMap(isolate, map);
+ var isolate = getFromMap(map['isolate']) as Isolate;
+ event = ServiceObject._fromMap(isolate, map) as ServiceEvent;
if (event.kind == ServiceEvent.kIsolateExit) {
_isolateCache.remove(isolate.id);
_buildIsolateList();
@@ -758,13 +757,13 @@
void _buildIsolateList() {
var isolateList =
- _isolateCache.values.where((i) => !i.isSystemIsolate).toList();
+ _isolateCache.values.where((i) => !i.isSystemIsolate!).toList();
isolateList.sort(_compareIsolates);
isolates.clear();
isolates.addAll(isolateList);
var systemIsolateList =
- _isolateCache.values.where((i) => i.isSystemIsolate).toList();
+ _isolateCache.values.where((i) => i.isSystemIsolate!).toList();
systemIsolateList.sort(_compareIsolates);
systemIsolates.clear();
systemIsolates.addAll(systemIsolateList);
@@ -790,9 +789,6 @@
static final String _isolateGroupIdPrefix = 'isolateGroups/';
ServiceObject getFromMap(Map map) {
- if (map == null) {
- return null;
- }
var type = _stripRef(map['type']);
if (type == 'VM') {
// Update this VM object.
@@ -807,7 +803,7 @@
var isolate = _isolateCache[id];
if (isolate == null) {
// Add new isolate to the cache.
- isolate = ServiceObject._fromMap(this, map);
+ isolate = ServiceObject._fromMap(this, map) as Isolate;
_isolateCache[id] = isolate;
_buildIsolateList();
@@ -825,7 +821,7 @@
var isolateGroup = _isolateGroupCache[id];
if (isolateGroup == null) {
// Add new isolate to the cache.
- isolateGroup = new ServiceObject._fromMap(this, map);
+ isolateGroup = ServiceObject._fromMap(this, map) as IsolateGroup;
_isolateGroupCache[id] = isolateGroup;
_buildIsolateGroupList();
@@ -842,7 +838,7 @@
}
// Build the object from the map directly.
- return new ServiceObject._fromMap(this, map);
+ return ServiceObject._fromMap(this, map);
}
// Note that this function does not reload the isolate if it found
@@ -856,19 +852,20 @@
}
int _compareIsolateGroups(IsolateGroup a, IsolateGroup b) {
- return a.id.compareTo(b.id);
+ return a.id!.compareTo(b.id!);
}
void _buildIsolateGroupList() {
final isolateGroupList = _isolateGroupCache.values
- .where((g) => !g.isSystemIsolateGroup)
+ .where((g) => !g.isSystemIsolateGroup!)
.toList();
isolateGroupList.sort(_compareIsolateGroups);
isolateGroups.clear();
isolateGroups.addAll(isolateGroupList);
- final systemIsolateGroupList =
- _isolateGroupCache.values.where((g) => g.isSystemIsolateGroup).toList();
+ final systemIsolateGroupList = _isolateGroupCache.values
+ .where((g) => g.isSystemIsolateGroup!)
+ .toList();
systemIsolateGroupList.sort(_compareIsolateGroups);
systemIsolateGroups.clear();
systemIsolateGroups.addAll(systemIsolateGroupList);
@@ -890,9 +887,9 @@
Future<Map> invokeRpcNoUpgrade(String method, Map params) {
return invokeRpcRaw(method, params).then<Map>((Map response) {
var map = response;
- if (Tracer.current != null) {
- Tracer.current
- .trace("Received response for ${method}/${params}}", map: map);
+ var tracer = Tracer.current;
+ if (tracer != null) {
+ tracer.trace("Received response for ${method}/${params}}", map: map);
}
if (!_isServiceMap(map)) {
var exception = new MalformedResponseRpcException(
@@ -900,23 +897,23 @@
return new Future.error(exception);
}
return new Future<Map>.value(map);
- }).catchError((e) {
+ }).catchError((e, st) {
// Errors pass through.
- return new Future<Map>.error(e);
+ return new Future<Map>.error(e, st);
});
}
Future<ServiceObject> invokeRpc(String method, Map params) {
return invokeRpcNoUpgrade(method, params)
.then<ServiceObject>((Map response) {
- var obj = new ServiceObject._fromMap(this, response);
+ var obj = ServiceObject._fromMap(this, response);
if ((obj != null) && obj.canCache) {
- String objId = obj.id;
+ String objId = obj.id!;
_cache.putIfAbsent(objId, () => obj);
}
return obj;
- }).catchError((e) {
- return new Future<ServiceObject>.error(e);
+ }).catchError((e, st) {
+ return new Future<ServiceObject>.error(e, st);
});
}
@@ -930,7 +927,7 @@
void _updateService(ServiceEvent event) {
switch (event.kind) {
case ServiceEvent.kServiceRegistered:
- services.add(new Service(event.alias, event.method, event.service));
+ services.add(new Service(event.alias!, event.method!, event.service!));
break;
case ServiceEvent.kServiceUnregistered:
services.removeWhere((s) => s.method == event.method);
@@ -973,7 +970,7 @@
};
// Ignore network errors on stream listen.
return invokeRpc('streamListen', params)
- .catchError((e) => ignoreNetworkErrors(e));
+ .catchError((e, st) => ignoreNetworkErrors(e, st));
}
Future<ServiceObject> _streamCancel(String streamId) {
@@ -982,7 +979,7 @@
};
// Ignore network errors on stream cancel.
return invokeRpc('streamCancel', params)
- .catchError((e) => ignoreNetworkErrors(e));
+ .catchError((e, st) => ignoreNetworkErrors(e, st));
}
// A map from stream id to event stream state.
@@ -1011,7 +1008,7 @@
/// Helper function for listening to an event stream.
Future<StreamSubscription> listenEventStream(
- String streamId, Function function) async {
+ String streamId, void Function(ServiceEvent) function) async {
var stream = await getEventStream(streamId);
return stream.listen(function);
}
@@ -1124,9 +1121,9 @@
class TagProfile {
final List<String> names = <String>[];
final List<TagProfileSnapshot> snapshots = <TagProfileSnapshot>[];
- double get updatedAtSeconds => _seconds;
- double _seconds;
- TagProfileSnapshot _maxSnapshot;
+ double get updatedAtSeconds => _seconds!;
+ double? _seconds;
+ TagProfileSnapshot? _maxSnapshot;
int _historySize;
int _countersLength = 0;
@@ -1146,14 +1143,14 @@
}
// The counters monotonically grow, keep track of the maximum value.
_maxSnapshot = new TagProfileSnapshot(0.0, _countersLength);
- _maxSnapshot.set(counters);
+ _maxSnapshot!.set(counters);
return;
}
var snapshot = new TagProfileSnapshot(seconds, _countersLength);
// We snapshot the delta from the current counters to the maximum counter
// values.
- snapshot.delta(counters, _maxSnapshot.counters);
- _maxSnapshot.max(counters);
+ snapshot.delta(counters, _maxSnapshot!.counters);
+ _maxSnapshot!.max(counters);
snapshots.add(snapshot);
// Only keep _historySize snapshots.
if (snapshots.length > _historySize) {
@@ -1310,7 +1307,7 @@
}
class IsolateGroup extends ServiceObjectOwner implements M.IsolateGroup {
- IsolateGroup._empty(ServiceObjectOwner owner)
+ IsolateGroup._empty(ServiceObjectOwner? owner)
: assert(owner is VM),
super._empty(owner);
@@ -1335,9 +1332,6 @@
@override
ServiceObject getFromMap(Map map) {
- if (map == null) {
- return null;
- }
final mapType = _stripRef(map['type']);
if (mapType == 'IsolateGroup') {
// There are sometimes isolate group refs in ServiceEvents.
@@ -1350,7 +1344,7 @@
return obj;
}
// Build the object from the map directly.
- obj = new ServiceObject._fromMap(this, map);
+ obj = ServiceObject._fromMap(this, map);
if ((obj != null) && obj.canCache) {
_cache[mapId] = obj;
}
@@ -1379,9 +1373,9 @@
final List<Isolate> isolates = <Isolate>[];
@override
- int number;
+ int? number;
- bool isSystemIsolateGroup;
+ bool? isSystemIsolateGroup;
final Map<String, ServiceObject> _cache = Map<String, ServiceObject>();
}
@@ -1391,28 +1385,28 @@
static const kLoggingStream = 'Logging';
static const kExtensionStream = 'Extension';
- VM get vm => owner;
+ VM get vm => owner as VM;
Isolate get isolate => this;
- int number;
- int originNumber;
- DateTime startTime;
- Duration get upTime {
+ int? number;
+ int? originNumber;
+ DateTime? startTime;
+ Duration? get upTime {
if (startTime == null) {
return null;
}
- return (new DateTime.now().difference(startTime));
+ return (new DateTime.now().difference(startTime!));
}
Map counters = {};
void _updateRunState() {
- topFrame = M.topFrame(pauseEvent);
+ topFrame = M.topFrame(pauseEvent) as Frame?;
paused = (pauseEvent != null && !(pauseEvent is M.ResumeEvent));
running = (!paused && topFrame != null);
idle = (!paused && topFrame == null);
}
- M.DebugEvent pauseEvent = null;
+ M.DebugEvent? pauseEvent = null;
bool paused = false;
bool running = false;
bool idle = false;
@@ -1437,7 +1431,7 @@
Map<String, ServiceObject> _cache = new Map<String, ServiceObject>();
final TagProfile tagProfile = new TagProfile(20);
- Isolate._empty(ServiceObjectOwner owner) : super._empty(owner) {
+ Isolate._empty(ServiceObjectOwner? owner) : super._empty(owner) {
assert(owner is VM);
}
@@ -1458,7 +1452,7 @@
static const kProfileReport = '_Profile';
Future<ServiceObject> getSourceReport(List<String> report_kinds,
- [Script script, int startPos, int endPos]) {
+ [Script? script, int? startPos, int? endPos]) {
var params = <String, dynamic>{'reports': report_kinds};
if (script != null) {
params['scriptId'] = script.id;
@@ -1473,7 +1467,7 @@
}
Future<ServiceMap> reloadSources(
- {String rootLibUri, String packagesUri, bool pause}) {
+ {String? rootLibUri, String? packagesUri, bool? pause}) {
Map<String, dynamic> params = <String, dynamic>{};
if (rootLibUri != null) {
params['rootLibUri'] = rootLibUri;
@@ -1504,7 +1498,7 @@
/// Object class object.
Future<Class> getClassHierarchy() async {
var classRefs = await invokeRpc('getClassList', {});
- var classes = await _loadClasses(classRefs);
+ var classes = await _loadClasses(classRefs as ServiceMap);
return _buildClassHierarchy(classes);
}
@@ -1539,7 +1533,7 @@
}
if ((cls.vmName == 'Object') &&
(cls.isPatch == false) &&
- (cls.library.uri == 'dart:core')) {
+ (cls.library!.uri == 'dart:core')) {
objectClass = cls;
}
}
@@ -1548,9 +1542,6 @@
}
ServiceObject getFromMap(Map map) {
- if (map == null) {
- return null;
- }
var mapType = _stripRef(map['type']);
if (mapType == 'Isolate') {
// There are sometimes isolate refs in ServiceEvents.
@@ -1563,7 +1554,7 @@
return obj;
}
// Build the object from the map directly.
- obj = new ServiceObject._fromMap(this, map);
+ obj = ServiceObject._fromMap(this, map);
if ((obj != null) && obj.canCache) {
_cache[mapId] = obj;
}
@@ -1602,31 +1593,29 @@
Future<List<Script>> getScripts() async {
final response = await invokeRpc('getScripts', {}) as ServiceMap;
assert(response.type == 'ScriptList');
- return response['scripts'].cast<Script>();
+ return response['scripts'].cast<Script>() as List<Script>;
}
Future<Map> _fetchDirect({int count: kDefaultFieldLimit}) async {
return invokeRpcNoUpgrade('getIsolate', {});
}
- Class objectClass;
+ Class? objectClass;
final rootClasses = <Class>[];
- Library rootLibrary;
+ late Library rootLibrary;
List<Library> libraries = <Library>[];
- Frame topFrame;
+ Frame? topFrame;
- String name;
- String vmName;
- ServiceFunction entry;
+ String? name;
+ String? vmName;
+ ServiceFunction? entry;
final HeapSpace newSpace = new HeapSpace();
final HeapSpace oldSpace = new HeapSpace();
- String fileAndLine;
-
- DartError error;
- SnapshotReader _snapshotFetch;
+ DartError? error;
+ SnapshotReader? _snapshotFetch;
List<Thread> get threads => _threads;
final List<Thread> _threads = <Thread>[];
@@ -1635,12 +1624,12 @@
int _zoneHighWatermark = 0;
int get numZoneHandles => _numZoneHandles;
- int _numZoneHandles;
+ int _numZoneHandles = 0;
int get numScopedHandles => _numScopedHandles;
- int _numScopedHandles;
+ int _numScopedHandles = 0;
- bool isSystemIsolate;
+ bool? isSystemIsolate;
void _loadHeapSnapshot(ServiceEvent event) {
if (_snapshotFetch == null) {
@@ -1651,9 +1640,9 @@
}
// Occasionally these actually arrive out of order.
- _snapshotFetch.add(event.data);
- if (event.lastChunk) {
- _snapshotFetch.close();
+ _snapshotFetch!.add(event.data!);
+ if (event.lastChunk!) {
+ _snapshotFetch!.close();
_snapshotFetch = null;
}
}
@@ -1664,7 +1653,7 @@
// isolate.vm.streamListen('HeapSnapshot');
isolate.invokeRpcNoUpgrade('requestHeapSnapshot', {});
}
- return _snapshotFetch;
+ return _snapshotFetch!;
}
void updateHeapsFromMap(Map map) {
@@ -1699,7 +1688,7 @@
assert(names.length == counts.length);
var sum = 0;
for (var i = 0; i < counts.length; i++) {
- sum += counts[i];
+ sum += (counts[i] as int);
}
var _counters = {};
if (sum == 0) {
@@ -1726,8 +1715,8 @@
var newPauseEvent = map['pauseEvent'];
assert((pauseEvent == null) ||
(newPauseEvent == null) ||
- !newPauseEvent.timestamp.isBefore(pauseEvent.timestamp));
- pauseEvent = createEventFromServiceEvent(newPauseEvent);
+ !newPauseEvent.timestamp.isBefore(pauseEvent!.timestamp));
+ pauseEvent = createEventFromServiceEvent(newPauseEvent) as M.DebugEvent;
_updateRunState();
error = map['error'];
@@ -1750,7 +1739,7 @@
int currentZoneHighWatermark = 0;
for (var i = 0; i < threads.length; i++) {
- currentZoneHighWatermark += threads[i].zoneHighWatermark;
+ currentZoneHighWatermark += threads[i].zoneHighWatermark!;
}
if (currentZoneHighWatermark > _zoneHighWatermark) {
@@ -1770,7 +1759,7 @@
}
Map<int, Breakpoint> breakpoints = <int, Breakpoint>{};
- String exceptionsPauseInfo;
+ String? exceptionsPauseInfo;
void _updateBreakpoints(List newBpts) {
// Build a set of new breakpoints.
@@ -1791,7 +1780,7 @@
}
void _addBreakpoint(Breakpoint bpt) {
- breakpoints[bpt.number] = bpt;
+ breakpoints[bpt.number!] = bpt;
}
void _removeBreakpoint(Breakpoint bpt) {
@@ -1811,7 +1800,7 @@
_handleIsolateReloadEvent(event);
break;
case ServiceEvent.kBreakpointAdded:
- _addBreakpoint(event.breakpoint);
+ _addBreakpoint(event.breakpoint!);
break;
case ServiceEvent.kIsolateUpdate:
@@ -1821,7 +1810,7 @@
break;
case ServiceEvent.kBreakpointRemoved:
- _removeBreakpoint(event.breakpoint);
+ _removeBreakpoint(event.breakpoint!);
break;
case ServiceEvent.kPauseStart:
@@ -1833,8 +1822,8 @@
case ServiceEvent.kNone:
case ServiceEvent.kResume:
assert((pauseEvent == null) ||
- !event.timestamp.isBefore(pauseEvent.timestamp));
- pauseEvent = createEventFromServiceEvent(event);
+ !event.timestamp!.isBefore(pauseEvent!.timestamp));
+ pauseEvent = createEventFromServiceEvent(event) as M.DebugEvent;
_updateRunState();
break;
@@ -1853,7 +1842,7 @@
}
}
- Future<Breakpoint> addBreakpoint(Script script, int line, [int col]) {
+ Future<Breakpoint> addBreakpoint(Script script, int line, [int? col]) {
Map params = {
'scriptId': script.id,
'line': line,
@@ -1865,7 +1854,8 @@
.then((result) => result as Breakpoint);
}
- Future<Breakpoint> addBreakpointByScriptUri(String uri, int line, [int col]) {
+ Future<Breakpoint> addBreakpointByScriptUri(String uri, int line,
+ [int? col]) {
Map params = {
'scriptUri': uri,
'line': line.toString(),
@@ -1950,7 +1940,7 @@
}
Future<ServiceObject> eval(ServiceObject target, String expression,
- {Map<String, ServiceObject> scope, bool disableBreakpoints: false}) {
+ {Map<String, ServiceObject>? scope, bool disableBreakpoints: false}) {
Map params = {
'targetId': target.id,
'expression': expression,
@@ -1959,7 +1949,7 @@
if (scope != null) {
Map<String, String> scopeWithIds = new Map();
scope.forEach((String name, ServiceObject object) {
- scopeWithIds[name] = object.id;
+ scopeWithIds[name] = object.id!;
});
params["scope"] = scopeWithIds;
}
@@ -1967,7 +1957,7 @@
}
Future<ServiceObject> evalFrame(int frameIndex, String expression,
- {Map<String, ServiceObject> scope,
+ {Map<String, ServiceObject>? scope,
bool disableBreakpoints: false}) async {
Map params = {
'frameIndex': frameIndex,
@@ -1977,7 +1967,7 @@
if (scope != null) {
Map<String, String> scopeWithIds = new Map();
scope.forEach((String name, ServiceObject object) {
- scopeWithIds[name] = object.id;
+ scopeWithIds[name] = object.id!;
});
params["scope"] = scopeWithIds;
}
@@ -1993,7 +1983,7 @@
'exception': null,
'stacktrace': null,
};
- return new ServiceObject._fromMap(null, map);
+ return ServiceObject._fromMap(null, map);
} else
rethrow;
}
@@ -2087,7 +2077,7 @@
class ObjectStore extends ServiceObject implements M.ObjectStore {
List<NamedField> fields = <NamedField>[];
- ObjectStore._empty(ServiceObjectOwner owner) : super._empty(owner);
+ ObjectStore._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
// Extract full properties.
@@ -2113,7 +2103,7 @@
bool get immutable => false;
- ServiceMap._empty(ServiceObjectOwner owner) : super._empty(owner);
+ ServiceMap._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_loaded = !mapIsRef;
@@ -2123,7 +2113,7 @@
// upgrading an already upgraded submap. Is clearing really the
// right thing to do here?
_map.clear();
- _map.addAll(map);
+ map.forEach((k, v) => _map[k] = v);
name = _map['name'];
vmName = (_map.containsKey('_vmName') ? _map['_vmName'] : name);
@@ -2135,19 +2125,20 @@
int get clazz => _map['class'];
// Forward Map interface calls.
- void addAll(Map other) => _map.addAll(other);
+ void addAll(Map<String, dynamic> other) => _map.addAll(other);
void clear() => _map.clear();
- bool containsValue(v) => _map.containsValue(v);
- bool containsKey(k) => _map.containsKey(k);
- void forEach(Function f) => _map.forEach(f);
- putIfAbsent(key, Function ifAbsent) => _map.putIfAbsent(key, ifAbsent);
- void remove(key) => _map.remove(key);
- operator [](k) => _map[k];
- operator []=(k, v) => _map[k] = v;
+ bool containsValue(dynamic v) => _map.containsValue(v);
+ bool containsKey(Object? k) => _map.containsKey(k);
+ void forEach(void f(String key, dynamic value)) => _map.forEach(f);
+ dynamic putIfAbsent(key, dynamic ifAbsent()) =>
+ _map.putIfAbsent(key, ifAbsent);
+ dynamic remove(Object? key) => _map.remove(key);
+ dynamic operator [](Object? k) => _map[k];
+ operator []=(String k, dynamic v) => _map[k] = v;
bool get isEmpty => _map.isEmpty;
bool get isNotEmpty => _map.isNotEmpty;
Iterable<String> get keys => _map.keys;
- Iterable get values => _map.values;
+ Iterable<dynamic> get values => _map.values;
int get length => _map.length;
// Suppress compile-time error about missing Map methods.
@@ -2174,12 +2165,12 @@
/// A [DartError] is peered to a Dart Error object.
class DartError extends HeapObject implements M.Error {
- DartError._empty(ServiceObject owner) : super._empty(owner);
+ DartError._empty(ServiceObjectOwner? owner) : super._empty(owner);
- M.ErrorKind kind;
- String message;
- Instance exception;
- Instance stacktrace;
+ M.ErrorKind? kind;
+ String? message;
+ Instance? exception;
+ Instance? stacktrace;
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, owner);
@@ -2243,46 +2234,46 @@
static const kDartDevelopmentServiceConnected =
'DartDevelopmentServiceConnected';
- ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner);
+ ServiceEvent._empty(ServiceObjectOwner? owner) : super._empty(owner);
ServiceEvent.connectionClosed(this.reason) : super._empty(null) {
kind = kConnectionClosed;
}
- String kind;
- DateTime timestamp;
- String flag;
- String newValue;
- List<M.Breakpoint> pauseBreakpoints;
- Breakpoint breakpoint;
- Frame topFrame;
- DartError error;
- String extensionRPC;
- Instance exception;
- DartError reloadError;
- bool atAsyncSuspension;
- Instance inspectee;
- Uint8List data;
- int count;
- String reason;
- String exceptions;
- String bytesAsString;
- Map logRecord;
- String extensionKind;
- Map extensionData;
- List timelineEvents;
- List<String> updatedStreams;
- String spawnToken;
- String spawnError;
- String editor;
- ServiceObject object;
- String method;
- String service;
- String alias;
- String message;
- Uri uri;
+ String? kind;
+ DateTime? timestamp;
+ String? flag;
+ String? newValue;
+ List<Breakpoint>? pauseBreakpoints;
+ Breakpoint? breakpoint;
+ Frame? topFrame;
+ DartError? error;
+ String? extensionRPC;
+ Instance? exception;
+ DartError? reloadError;
+ bool? atAsyncSuspension;
+ Instance? inspectee;
+ Uint8List? data;
+ int? count;
+ String? reason;
+ String? exceptions;
+ String? bytesAsString;
+ Map? logRecord;
+ String? extensionKind;
+ Map? extensionData;
+ List? timelineEvents;
+ List<String>? updatedStreams;
+ String? spawnToken;
+ String? spawnError;
+ String? editor;
+ ServiceObject? object;
+ String? method;
+ String? service;
+ String? alias;
+ String? message;
+ Uri? uri;
- bool lastChunk;
+ bool? lastChunk;
bool get isPauseEvent {
return (kind == kPauseStart ||
@@ -2308,8 +2299,8 @@
}
if (map['pauseBreakpoints'] != null) {
pauseBreakpoints = new List<Breakpoint>.from(map['pauseBreakpoints']);
- if (pauseBreakpoints.length > 0) {
- breakpoint = pauseBreakpoints[0];
+ if (pauseBreakpoints!.length > 0) {
+ breakpoint = pauseBreakpoints![0];
}
} else {
pauseBreakpoints = const [];
@@ -2346,9 +2337,9 @@
}
if (map['logRecord'] != null) {
logRecord = map['logRecord'];
- logRecord['time'] =
- new DateTime.fromMillisecondsSinceEpoch(logRecord['time']);
- logRecord['level'] = _findLogLevel(logRecord['level']);
+ logRecord!['time'] =
+ new DateTime.fromMillisecondsSinceEpoch(logRecord!['time']);
+ logRecord!['level'] = _findLogLevel(logRecord!['level']);
}
if (map['extensionKind'] != null) {
extensionKind = map['extensionKind'];
@@ -2396,42 +2387,42 @@
}
String toString() {
- var ownerName = owner.id != null ? owner.id.toString() : owner.name;
+ var ownerName = owner!.id != null ? owner!.id.toString() : owner!.name;
if (data == null) {
return "ServiceEvent(owner='${ownerName}', kind='${kind}', "
"time=${timestamp})";
} else {
return "ServiceEvent(owner='${ownerName}', kind='${kind}', "
- "data.lengthInBytes=${data.lengthInBytes}, time=${timestamp})";
+ "data.lengthInBytes=${data!.lengthInBytes}, time=${timestamp})";
}
}
}
class Breakpoint extends ServiceObject implements M.Breakpoint {
- Breakpoint._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Breakpoint._empty(ServiceObjectOwner? owner) : super._empty(owner);
- final M.ClassRef clazz = null;
- final int size = null;
+ final M.ClassRef? clazz = null;
+ final int? size = null;
// TODO(turnidge): Add state to track if a breakpoint has been
// removed from the program. Remove from the cache when deleted.
bool get immutable => false;
// A unique integer identifier for this breakpoint.
- int number;
+ int? number;
// Either SourceLocation or UnresolvedSourceLocation.
- Location location;
+ Location? location;
// The breakpoint is in a file which is not yet loaded.
- bool latent;
+ bool? latent;
// The breakpoint has been assigned to a final source location.
- bool resolved;
+ bool? resolved;
// The breakpoint was synthetically created as part of an
// 'OverAsyncContinuation' resume request.
- bool isSyntheticAsyncContinuation;
+ bool? isSyntheticAsyncContinuation;
void _update(Map map, bool mapIsRef) {
_loaded = true;
@@ -2454,23 +2445,23 @@
}
}
location = newLocation;
- var newScript = location.script;
+ var newScript = location!.script;
if (newScript != null && newScript.loaded) {
newScript._addBreakpoint(this);
}
isSyntheticAsyncContinuation = map['isSyntheticAsyncContinuation'] != null;
- assert(resolved || location is UnresolvedSourceLocation);
+ assert(resolved! || location is UnresolvedSourceLocation);
}
void remove() {
- location.script._removeBreakpoint(this);
+ location!.script._removeBreakpoint(this);
}
String toString() {
if (number != null) {
- if (isSyntheticAsyncContinuation) {
+ if (isSyntheticAsyncContinuation!) {
return 'Synthetic Async Continuation Breakpoint ${number}';
} else {
return 'Breakpoint ${number} at ${location}';
@@ -2496,33 +2487,33 @@
}
class Library extends HeapObject implements M.Library {
- String uri;
+ String? uri;
final List<LibraryDependency> dependencies = <LibraryDependency>[];
final List<Script> scripts = <Script>[];
final List<Class> classes = <Class>[];
final List<Field> variables = <Field>[];
final List<ServiceFunction> functions = <ServiceFunction>[];
- bool _debuggable;
- bool get debuggable => _debuggable;
+ bool? _debuggable;
+ bool get debuggable => _debuggable!;
bool get immutable => false;
bool isDart(String libraryName) {
return uri == 'dart:$libraryName';
}
- Library._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Library._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, isolate);
super._update(map, mapIsRef);
uri = map['uri'];
- var shortUri = uri;
- if (uri.startsWith('file://') || uri.startsWith('http://')) {
- shortUri = uri.substring(uri.lastIndexOf('/') + 1);
+ var shortUri = uri!;
+ if (shortUri.startsWith('file://') || shortUri.startsWith('http://')) {
+ shortUri = shortUri.substring(shortUri.lastIndexOf('/') + 1);
}
- name = map['name'];
- if (name.isEmpty) {
+ name = map['name'] as String;
+ if (name!.isEmpty) {
// When there is no name for a library, use the shortUri.
name = shortUri;
}
@@ -2551,12 +2542,12 @@
}
Future<ServiceObject> evaluate(String expression,
- {Map<String, ServiceObject> scope, bool disableBreakpoints: false}) {
- return isolate.eval(this, expression,
+ {Map<String, ServiceObject>? scope, bool disableBreakpoints: false}) {
+ return isolate!.eval(this, expression,
scope: scope, disableBreakpoints: disableBreakpoints);
}
- Script get rootScript {
+ Script? get rootScript {
for (Script script in scripts) {
if (script.uri == uri) return script;
}
@@ -2593,17 +2584,17 @@
}
class Class extends HeapObject implements M.Class {
- Library library;
+ Library? library;
- bool isAbstract;
- bool isConst;
- bool isFinalized;
- bool isPatch;
- bool isImplemented;
+ bool? isAbstract;
+ bool? isConst;
+ bool? isFinalized;
+ bool? isPatch;
+ bool? isImplemented;
- SourceLocation location;
+ SourceLocation? location;
- DartError error;
+ DartError? error;
final Allocations newSpace = new Allocations();
final Allocations oldSpace = new Allocations();
@@ -2614,16 +2605,16 @@
final List<Field> fields = <Field>[];
final List<ServiceFunction> functions = <ServiceFunction>[];
- Class superclass;
+ Class? superclass;
final List<Instance> interfaces = <Instance>[];
final List<Class> subclasses = <Class>[];
- Instance superType;
- Instance mixin;
+ Instance? superType;
+ Instance? mixin;
bool get immutable => false;
- Class._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Class._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, isolate);
@@ -2635,7 +2626,7 @@
name = 'top-level-class'; // Better than ''
}
var idPrefix = "classes/";
- assert(id.startsWith(idPrefix));
+ assert(id!.startsWith(idPrefix));
if (mapIsRef) {
return;
@@ -2679,8 +2670,8 @@
superclass = map['super'];
// Work-around Object not tracking its subclasses in the VM.
- if (superclass != null && superclass.name == "Object") {
- superclass._addSubclass(this);
+ if (superclass != null && superclass!.name == "Object") {
+ superclass!._addSubclass(this);
}
superType = map['superType'];
mixin = map['mixin'];
@@ -2700,13 +2691,13 @@
}
Future<ServiceObject> evaluate(String expression,
- {Map<String, ServiceObject> scope, disableBreakpoints: false}) {
- return isolate.eval(this, expression,
+ {Map<String, ServiceObject>? scope, disableBreakpoints: false}) {
+ return isolate!.eval(this, expression,
scope: scope, disableBreakpoints: disableBreakpoints);
}
Future<ServiceObject> setTraceAllocations(bool enable) {
- return isolate.invokeRpc('_setTraceClassAllocation', {
+ return isolate!.invokeRpc('_setTraceClassAllocation', {
'enable': enable,
'classId': id,
});
@@ -2716,7 +2707,7 @@
var params = {
'classId': id,
};
- return isolate.invokeRpc('_getAllocationSamples', params);
+ return isolate!.invokeRpc('_getAllocationSamples', params);
}
String toString() => 'Class($vmName)';
@@ -2799,8 +2790,8 @@
class Guarded<T extends ServiceObject> implements M.Guarded<T> {
bool get isValue => asValue != null;
bool get isSentinel => asSentinel != null;
- final Sentinel asSentinel;
- final T asValue;
+ final Sentinel? asSentinel;
+ final T? asValue;
factory Guarded(ServiceObject obj) {
if (obj is Sentinel) {
@@ -2835,41 +2826,41 @@
}
class Instance extends HeapObject implements M.Instance {
- M.InstanceKind kind;
- String valueAsString; // If primitive.
- bool valueAsStringIsTruncated;
- ServiceFunction closureFunction; // If a closure.
- Context closureContext; // If a closure.
- int length; // If a List, Map or TypedData.
- int count;
- int offset;
- Instance pattern; // If a RegExp.
+ M.InstanceKind? kind;
+ String? valueAsString; // If primitive.
+ bool? valueAsStringIsTruncated;
+ ServiceFunction? closureFunction; // If a closure.
+ Context? closureContext; // If a closure.
+ int? length; // If a List, Map or TypedData.
+ int? count;
+ int? offset;
+ Instance? pattern; // If a RegExp.
- String name;
- Class typeClass;
- Class parameterizedClass;
- TypeArguments typeArguments;
- int parameterIndex;
- Instance targetType;
- Instance bound;
+ String? name;
+ Class? typeClass;
+ Class? parameterizedClass;
+ TypeArguments? typeArguments;
+ int? parameterIndex;
+ Instance? targetType;
+ Instance? bound;
- Iterable<BoundField> fields;
+ Iterable<BoundField>? fields;
var nativeFields;
- Iterable<Guarded<HeapObject>> elements; // If a List.
- Iterable<MapAssociation> associations; // If a Map.
- List<dynamic> typedElements; // If a TypedData.
- HeapObject referent; // If a MirrorReference.
- Instance key; // If a WeakProperty.
- Instance value; // If a WeakProperty.
- Breakpoint activationBreakpoint; // If a Closure.
- ServiceFunction oneByteFunction; // If a RegExp.
- ServiceFunction twoByteFunction; // If a RegExp.
- ServiceFunction externalOneByteFunction; // If a RegExp.
- ServiceFunction externalTwoByteFunction; // If a RegExp.
- Instance oneByteBytecode; // If a RegExp.
- Instance twoByteBytecode; // If a RegExp.
- bool isCaseSensitive; // If a RegExp.
- bool isMultiLine; // If a RegExp.
+ Iterable<Guarded<HeapObject>>? elements; // If a List.
+ Iterable<MapAssociation>? associations; // If a Map.
+ List<dynamic>? typedElements; // If a TypedData.
+ HeapObject? referent; // If a MirrorReference.
+ Instance? key; // If a WeakProperty.
+ Instance? value; // If a WeakProperty.
+ Breakpoint? activationBreakpoint; // If a Closure.
+ ServiceFunction? oneByteFunction; // If a RegExp.
+ ServiceFunction? twoByteFunction; // If a RegExp.
+ ServiceFunction? externalOneByteFunction; // If a RegExp.
+ ServiceFunction? externalTwoByteFunction; // If a RegExp.
+ Instance? oneByteBytecode; // If a RegExp.
+ Instance? twoByteBytecode; // If a RegExp.
+ bool? isCaseSensitive; // If a RegExp.
+ bool? isMultiLine; // If a RegExp.
bool get isAbstractType => M.isAbstractType(kind);
bool get isNull => kind == M.InstanceKind.vNull;
@@ -2879,14 +2870,8 @@
bool get isInt => kind == M.InstanceKind.int;
bool get isList => kind == M.InstanceKind.list;
bool get isMap => kind == M.InstanceKind.map;
- bool get isTypedData {
- return M.isTypedData(kind);
- }
-
- bool get isSimdValue {
- return M.isSimdValue(kind);
- }
-
+ bool get isTypedData => M.isTypedData(kind);
+ bool get isSimdValue => M.isSimdValue(kind);
bool get isRegExp => kind == M.InstanceKind.regExp;
bool get isMirrorReference => kind == M.InstanceKind.mirrorReference;
bool get isWeakProperty => kind == M.InstanceKind.weakProperty;
@@ -2896,27 +2881,29 @@
if (clazz == null) {
return false;
}
- if (clazz.library == null) {
+ if (clazz!.library == null) {
return false;
}
- return (clazz.name == 'StackOverflowError') && clazz.library.isDart('core');
+ return (clazz!.name == 'StackOverflowError') &&
+ clazz!.library!.isDart('core');
}
bool get isOutOfMemoryError {
if (clazz == null) {
return false;
}
- if (clazz.library == null) {
+ if (clazz!.library == null) {
return false;
}
- return (clazz.name == 'OutOfMemoryError') && clazz.library.isDart('core');
+ return (clazz!.name == 'OutOfMemoryError') &&
+ clazz!.library!.isDart('core');
}
// TODO(turnidge): Is this properly backwards compatible when new
// instance kinds are added?
bool get isPlainInstance => kind == 'PlainInstance';
- Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Instance._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
// Extract full properties.1
@@ -3060,17 +3047,17 @@
String get shortName {
if (isClosure) {
- return closureFunction.qualifiedName;
+ return closureFunction!.qualifiedName!;
}
if (valueAsString != null) {
- return valueAsString;
+ return valueAsString!;
}
- return 'a ${clazz.name}';
+ return 'a ${clazz!.name}';
}
Future<ServiceObject> evaluate(String expression,
- {Map<String, ServiceObject> scope, bool disableBreakpoints: false}) {
- return isolate.eval(this, expression,
+ {Map<String, ServiceObject>? scope, bool disableBreakpoints: false}) {
+ return isolate!.eval(this, expression,
scope: scope, disableBreakpoints: disableBreakpoints);
}
@@ -3078,11 +3065,11 @@
}
class Context extends HeapObject implements M.Context {
- Context parentContext;
- int length;
- Iterable<ContextElement> variables;
+ Context? parentContext;
+ int? length;
+ Iterable<ContextElement>? variables;
- Context._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Context._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
// Extract full properties.
@@ -3171,31 +3158,31 @@
class ServiceFunction extends HeapObject implements M.ServiceFunction {
// owner is a Library, Class, or ServiceFunction.
- M.ObjectRef dartOwner;
- Library library;
- bool isStatic;
- bool isConst;
- SourceLocation location;
- Code code;
- Code unoptimizedCode;
- Code bytecode;
- bool isOptimizable;
- bool isInlinable;
- bool hasIntrinsic;
- bool isRecognized;
- bool isNative;
- M.FunctionKind kind;
- int deoptimizations;
- String qualifiedName;
- int usageCounter;
- bool isDart;
- ProfileFunction profile;
- Instance icDataArray;
- Field field;
+ M.ObjectRef? dartOwner;
+ Library? library;
+ bool? isStatic;
+ bool? isConst;
+ SourceLocation? location;
+ Code? code;
+ Code? unoptimizedCode;
+ Code? bytecode;
+ bool? isOptimizable;
+ bool? isInlinable;
+ bool? hasIntrinsic;
+ bool? isRecognized;
+ bool? isNative;
+ M.FunctionKind? kind;
+ int? deoptimizations;
+ String? qualifiedName;
+ int? usageCounter;
+ bool? isDart;
+ ProfileFunction? profile;
+ Instance? icDataArray;
+ Field? field;
bool get immutable => false;
- ServiceFunction._empty(ServiceObject owner) : super._empty(owner);
+ ServiceFunction._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, owner);
@@ -3209,15 +3196,15 @@
isDart = M.isDartFunction(kind);
if (dartOwner is ServiceFunction) {
- ServiceFunction ownerFunction = dartOwner;
+ ServiceFunction ownerFunction = dartOwner as ServiceFunction;
library = ownerFunction.library;
qualifiedName = "${ownerFunction.qualifiedName}.${name}";
} else if (dartOwner is Class) {
- Class ownerClass = dartOwner;
+ Class ownerClass = dartOwner as Class;
library = ownerClass.library;
qualifiedName = "${ownerClass.name}.${name}";
} else {
- library = dartOwner;
+ library = dartOwner as Library;
qualifiedName = name;
}
@@ -3247,7 +3234,7 @@
ServiceFunction get homeMethod {
var m = this;
while (m.dartOwner is ServiceFunction) {
- m = m.dartOwner;
+ m = m.dartOwner as ServiceFunction;
}
return m;
}
@@ -3278,10 +3265,10 @@
}
class Sentinel extends ServiceObject implements M.Sentinel {
- M.SentinelKind kind;
- String valueAsString;
+ late M.SentinelKind kind;
+ late String valueAsString;
- Sentinel._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Sentinel._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
// Extract full properties.
@@ -3297,16 +3284,16 @@
}
class Thread extends ServiceObject implements M.Thread {
- M.ThreadKind get kind => _kind;
- M.ThreadKind _kind;
- String get kindString => _kindString;
- String _kindString;
- int get zoneHighWatermark => _zoneHighWatermark;
- int _zoneHighWatermark;
- int get zoneCapacity => _zoneCapacity;
- int _zoneCapacity;
+ M.ThreadKind? get kind => _kind;
+ M.ThreadKind? _kind;
+ String? get kindString => _kindString;
+ String? _kindString;
+ int? get zoneHighWatermark => _zoneHighWatermark;
+ int? _zoneHighWatermark;
+ int? get zoneCapacity => _zoneCapacity;
+ int? _zoneCapacity;
- Thread._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Thread._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
String rawKind = map['kind'];
@@ -3352,23 +3339,23 @@
class Field extends HeapObject implements M.Field {
// Library or Class.
- HeapObject dartOwner;
- Library library;
- Instance declaredType;
- bool isStatic;
- bool isFinal;
- bool isConst;
- ServiceObject staticValue;
- String name;
- String vmName;
+ HeapObject? dartOwner;
+ Library? library;
+ Instance? declaredType;
+ bool? isStatic;
+ bool? isFinal;
+ bool? isConst;
+ ServiceObject? staticValue;
+ String? name;
+ String? vmName;
- bool guardNullable;
- M.GuardClassKind guardClassKind;
- Class guardClass;
- String guardLength;
- SourceLocation location;
+ bool? guardNullable;
+ M.GuardClassKind? guardClassKind;
+ Class? guardClass;
+ String? guardLength;
+ SourceLocation? location;
- Field._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Field._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
// Extract full properties.
@@ -3384,10 +3371,10 @@
isConst = map['const'];
if (dartOwner is Class) {
- Class ownerClass = dartOwner;
+ Class ownerClass = dartOwner as Class;
library = ownerClass.library;
} else {
- library = dartOwner;
+ library = dartOwner as Library;
}
if (mapIsRef) {
@@ -3416,14 +3403,14 @@
_loaded = true;
}
- String toString() => 'Field(${dartOwner.name}.$name)';
+ String toString() => 'Field(${dartOwner!.name}.$name)';
}
class ScriptLine {
final Script script;
final int line;
final String text;
- Set<Breakpoint> breakpoints;
+ Set<Breakpoint>? breakpoints;
ScriptLine(this.script, this.line, this.text);
@@ -3431,12 +3418,12 @@
return text.isEmpty || text.trim().isEmpty;
}
- bool _isTrivial = null;
+ bool? _isTrivial = null;
bool get isTrivial {
if (_isTrivial == null) {
_isTrivial = _isTrivialLine(text);
}
- return _isTrivial;
+ return _isTrivial!;
}
static bool _isTrivialToken(String token) {
@@ -3478,13 +3465,13 @@
if (breakpoints == null) {
breakpoints = new Set<Breakpoint>();
}
- breakpoints.add(bpt);
+ breakpoints!.add(bpt);
}
void removeBreakpoint(Breakpoint bpt) {
- assert(breakpoints != null && breakpoints.contains(bpt));
- breakpoints.remove(bpt);
- if (breakpoints.isEmpty) {
+ assert(breakpoints != null && breakpoints!.contains(bpt));
+ breakpoints!.remove(bpt);
+ if (breakpoints!.isEmpty) {
breakpoints = null;
}
}
@@ -3499,8 +3486,8 @@
CallSite(this.name, this.script, this.tokenPos, this.entries);
- int get line => script.tokenToLine(tokenPos);
- int get column => script.tokenToCol(tokenPos);
+ int get line => script.tokenToLine(tokenPos)!;
+ int get column => script.tokenToCol(tokenPos)!;
int get aggregateCount {
var count = 0;
@@ -3557,46 +3544,46 @@
class Script extends HeapObject implements M.Script {
final lines = <ScriptLine>[];
- String uri;
- String kind;
- DateTime loadTime;
- int firstTokenPos;
- int lastTokenPos;
- int lineOffset;
- int columnOffset;
- Library library;
+ late String uri;
+ late String kind;
+ DateTime? loadTime;
+ int? firstTokenPos;
+ int? lastTokenPos;
+ int? lineOffset;
+ int? columnOffset;
+ Library? library;
- String source;
+ String? source;
bool get immutable => true;
- String _shortUri;
+ String? _shortUri;
- Script._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Script._empty(ServiceObjectOwner? owner) : super._empty(owner);
/// Retrieves line number [line] if it exists.
- ScriptLine getLine(int line) {
+ ScriptLine? getLine(int line) {
assert(_loaded);
assert(line >= 1);
- var index = (line - lineOffset - 1);
+ var index = (line - lineOffset! - 1);
if (lines.length < index) {
return null;
}
- return lines[line - lineOffset - 1];
+ return lines[line - lineOffset! - 1];
}
/// This function maps a token position to a line number.
/// The VM considers the first line to be line 1.
- int tokenToLine(int tokenPos) => _tokenToLine[tokenPos];
+ int? tokenToLine(int? tokenPos) => _tokenToLine[tokenPos];
Map _tokenToLine = {};
/// This function maps a token position to a column number.
/// The VM considers the first column to be column 1.
- int tokenToCol(int tokenPos) => _tokenToCol[tokenPos];
+ int? tokenToCol(int? tokenPos) => _tokenToCol[tokenPos];
Map _tokenToCol = {};
- int guessTokenLength(int line, int column) {
- String source = getLine(line).text;
+ int? guessTokenLength(int line, int column) {
+ String source = getLine(line)!.text;
var pos = column;
if (pos >= source.length) {
@@ -3705,9 +3692,9 @@
} else {
// Keep track of max and min token positions.
firstTokenPos =
- (firstTokenPos <= tokenOffset) ? firstTokenPos : tokenOffset;
+ (firstTokenPos! <= tokenOffset) ? firstTokenPos : tokenOffset;
lastTokenPos =
- (lastTokenPos >= tokenOffset) ? lastTokenPos : tokenOffset;
+ (lastTokenPos! >= tokenOffset) ? lastTokenPos : tokenOffset;
}
_tokenToLine[tokenOffset] = lineNumber;
_tokenToCol[tokenOffset] = colNumber;
@@ -3726,10 +3713,10 @@
lines.clear();
Logger.root.info('Adding ${sourceLines.length} source lines for ${uri}');
for (var i = 0; i < sourceLines.length; i++) {
- lines.add(new ScriptLine(this, i + lineOffset + 1, sourceLines[i]));
+ lines.add(new ScriptLine(this, i + lineOffset! + 1, sourceLines[i]));
}
- for (var bpt in isolate.breakpoints.values) {
- if (bpt.location.script == this) {
+ for (var bpt in isolate!.breakpoints.values) {
+ if (bpt.location!.script == this) {
_addBreakpoint(bpt);
}
}
@@ -3737,19 +3724,19 @@
// Note, this may return source beyond the token length if [guessTokenLength]
// fails.
- String getToken(int tokenPos) {
- final int line = tokenToLine(tokenPos);
- int column = tokenToCol(tokenPos);
+ String? getToken(int tokenPos) {
+ final int? line = tokenToLine(tokenPos);
+ int? column = tokenToCol(tokenPos);
if ((line == null) || (column == null)) {
return null;
}
// Line and column numbers start at 1 in the VM.
column -= 1;
- String sourceLine = getLine(line)?.text;
+ String? sourceLine = getLine(line)?.text;
if (sourceLine == null) {
return null;
}
- final int length = guessTokenLength(line, column);
+ final int? length = guessTokenLength(line, column);
if (length == null) {
return sourceLine.substring(column);
} else {
@@ -3759,21 +3746,21 @@
void _addBreakpoint(Breakpoint bpt) {
var line;
- if (bpt.location.tokenPos != null) {
- line = tokenToLine(bpt.location.tokenPos);
+ if (bpt.location!.tokenPos != null) {
+ line = tokenToLine(bpt.location!.tokenPos);
} else {
- UnresolvedSourceLocation loc = bpt.location;
+ UnresolvedSourceLocation loc = bpt.location as UnresolvedSourceLocation;
line = loc.line;
}
- getLine(line)?.addBreakpoint(bpt);
+ getLine(line!)?.addBreakpoint(bpt);
}
void _removeBreakpoint(Breakpoint bpt) {
var line;
- if (bpt.location.tokenPos != null) {
- line = tokenToLine(bpt.location.tokenPos);
+ if (bpt.location!.tokenPos != null) {
+ line = tokenToLine(bpt.location!.tokenPos);
} else {
- UnresolvedSourceLocation loc = bpt.location;
+ UnresolvedSourceLocation loc = bpt.location as UnresolvedSourceLocation;
line = loc.line;
}
if (line != null) {
@@ -3824,14 +3811,16 @@
return r;
}
// Current scan position.
- var line = tokenToLine(tokenPos);
- if (line == null) {
+ int? maybeLine = tokenToLine(tokenPos);
+ if (maybeLine == null) {
return r;
}
- var column = tokenToCol(tokenPos);
- if (column == null) {
+ int line = maybeLine;
+ int? maybeColumn = tokenToCol(tokenPos);
+ if (maybeColumn == null) {
return r;
}
+ int column = maybeColumn;
// Move back by name length.
// TODO(johnmccutchan): Fix LocalVarDescriptor to set column before the
@@ -3842,44 +3831,44 @@
if (line == lastLine) {
// Only one line.
- if (!getLine(line).isTrivial) {
+ if (!getLine(line)!.isTrivial) {
// TODO(johnmccutchan): end token pos -> column can lie for snapshotted
// code. e.g.:
// io_sink.dart source line 23 ends at column 39
// io_sink.dart snapshotted source line 23 ends at column 35.
- lastColumn = math.min(getLine(line).text.length, lastColumn);
- lineContents = getLine(line).text.substring(column, lastColumn - 1);
+ lastColumn = math.min(getLine(line)!.text.length, lastColumn);
+ lineContents = getLine(line)!.text.substring(column, lastColumn - 1);
return scanLineForLocalVariableLocations(
pattern, name, lineContents, line, column);
}
}
// Scan first line.
- if (!getLine(line).isTrivial) {
- lineContents = getLine(line).text.substring(column);
+ if (!getLine(line)!.isTrivial) {
+ lineContents = getLine(line)!.text.substring(column);
r.addAll(scanLineForLocalVariableLocations(
pattern, name, lineContents, line++, column));
}
// Scan middle lines.
while (line < (lastLine - 1)) {
- if (getLine(line).isTrivial) {
+ if (getLine(line)!.isTrivial) {
line++;
continue;
}
- lineContents = getLine(line).text;
+ lineContents = getLine(line)!.text;
r.addAll(scanLineForLocalVariableLocations(
pattern, name, lineContents, line++, 0));
}
// Scan last line.
- if (!getLine(line).isTrivial) {
+ if (!getLine(line)!.isTrivial) {
// TODO(johnmccutchan): end token pos -> column can lie for snapshotted
// code. e.g.:
// io_sink.dart source line 23 ends at column 39
// io_sink.dart snapshotted source line 23 ends at column 35.
- lastColumn = math.min(getLine(line).text.length, lastColumn);
- lineContents = getLine(line).text.substring(0, lastColumn - 1);
+ lastColumn = math.min(getLine(line)!.text.length, lastColumn);
+ lineContents = getLine(line)!.text.substring(0, lastColumn - 1);
r.addAll(scanLineForLocalVariableLocations(
pattern, name, lineContents, line, 0));
}
@@ -3893,8 +3882,8 @@
final int tokenPos;
final int tryIndex;
final String kind;
- Script script;
- String formattedLine;
+ Script? script;
+ String? formattedLine;
PcDescriptor(
this.pcOffset, this.deoptId, this.tokenPos, this.tryIndex, this.kind);
@@ -3923,17 +3912,17 @@
}
this.script = script;
var scriptLine = script.getLine(line);
- formattedLine = scriptLine.text;
+ formattedLine = scriptLine!.text;
}
}
class PcDescriptors extends ServiceObject implements M.PcDescriptorsRef {
- Class clazz;
- int size;
+ Class? clazz;
+ int? size;
bool get immutable => true;
final List<PcDescriptor> descriptors = <PcDescriptor>[];
- PcDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner) {}
+ PcDescriptors._empty(ServiceObjectOwner? owner) : super._empty(owner) {}
void _update(Map m, bool mapIsRef) {
if (mapIsRef) {
@@ -3970,11 +3959,11 @@
}
class LocalVarDescriptors extends ServiceObject {
- Class clazz;
- int size;
+ Class? clazz;
+ int? size;
bool get immutable => true;
final List<LocalVarDescriptor> descriptors = <LocalVarDescriptor>[];
- LocalVarDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner);
+ LocalVarDescriptors._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map m, bool mapIsRef) {
if (mapIsRef) {
@@ -4002,10 +3991,10 @@
class ObjectPool extends HeapObject implements M.ObjectPool {
bool get immutable => false;
- int length;
- List<ObjectPoolEntry> entries;
+ int? length;
+ List<ObjectPoolEntry>? entries;
- ObjectPool._empty(ServiceObjectOwner owner) : super._empty(owner);
+ ObjectPool._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, isolate);
@@ -4024,8 +4013,8 @@
class ObjectPoolEntry implements M.ObjectPoolEntry {
final int offset;
final M.ObjectPoolEntryKind kind;
- final M.ObjectRef asObject;
- final int asInteger;
+ final M.ObjectRef? asObject;
+ final int? asInteger;
factory ObjectPoolEntry(map) {
M.ObjectPoolEntryKind kind = stringToObjectPoolEntryKind(map['kind']);
@@ -4063,14 +4052,14 @@
}
class ICData extends HeapObject implements M.ICData {
- HeapObject dartOwner;
- String selector;
- Instance argumentsDescriptor;
- Instance entries;
+ HeapObject? dartOwner;
+ String? selector;
+ Instance? argumentsDescriptor;
+ Instance? entries;
bool get immutable => false;
- ICData._empty(ServiceObjectOwner owner) : super._empty(owner);
+ ICData._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, isolate);
@@ -4087,12 +4076,12 @@
}
class UnlinkedCall extends HeapObject implements M.UnlinkedCall {
- String selector;
- Instance argumentsDescriptor;
+ String? selector;
+ Instance? argumentsDescriptor;
bool get immutable => false;
- UnlinkedCall._empty(ServiceObjectOwner owner) : super._empty(owner);
+ UnlinkedCall._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, isolate);
@@ -4107,13 +4096,13 @@
}
class SingleTargetCache extends HeapObject implements M.SingleTargetCache {
- Code target;
- int lowerLimit;
- int upperLimit;
+ Code? target;
+ int? lowerLimit;
+ int? upperLimit;
bool get immutable => false;
- SingleTargetCache._empty(ServiceObjectOwner owner) : super._empty(owner);
+ SingleTargetCache._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, isolate);
@@ -4129,11 +4118,11 @@
}
class SubtypeTestCache extends HeapObject implements M.SubtypeTestCache {
- Instance cache;
+ Instance? cache;
bool get immutable => false;
- SubtypeTestCache._empty(ServiceObjectOwner owner) : super._empty(owner);
+ SubtypeTestCache._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, isolate);
@@ -4147,11 +4136,11 @@
}
class TypeArguments extends HeapObject implements M.TypeArguments {
- HeapObject dartOwner;
- String name;
- Iterable<Instance> types;
+ HeapObject? dartOwner;
+ String? name;
+ Iterable<Instance>? types;
- TypeArguments._empty(ServiceObjectOwner owner) : super._empty(owner);
+ TypeArguments._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, isolate);
@@ -4167,11 +4156,11 @@
}
class InstanceSet extends HeapObject implements M.InstanceSet {
- HeapObject dartOwner;
- int count;
- Iterable<HeapObject> instances;
+ HeapObject? dartOwner;
+ int? count;
+ Iterable<HeapObject>? instances;
- InstanceSet._empty(ServiceObjectOwner owner) : super._empty(owner);
+ InstanceSet._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, isolate);
@@ -4186,14 +4175,14 @@
}
class MegamorphicCache extends HeapObject implements M.MegamorphicCache {
- int mask;
- Instance buckets;
- String selector;
- Instance argumentsDescriptor;
+ int? mask;
+ Instance? buckets;
+ String? selector;
+ Instance? argumentsDescriptor;
bool get immutable => false;
- MegamorphicCache._empty(ServiceObjectOwner owner) : super._empty(owner);
+ MegamorphicCache._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
_upgradeCollection(map, isolate);
@@ -4216,7 +4205,7 @@
final String machine;
final String human;
final ServiceObject object;
- CodeInstruction jumpTarget;
+ CodeInstruction? jumpTarget;
List<PcDescriptor> descriptors = <PcDescriptor>[];
CodeInstruction(
@@ -4249,7 +4238,7 @@
}
void _resolveJumpTarget(
- List<CodeInstruction> instructionsByAddressOffset, int startAddress) {
+ List<CodeInstruction?> instructionsByAddressOffset, int startAddress) {
if (!_isJumpInstruction()) {
return;
}
@@ -4266,7 +4255,7 @@
Logger.root.warning('Bad address resolving jump target $relativeAddress');
return;
}
- jumpTarget = instructionsByAddressOffset[relativeAddress];
+ jumpTarget = instructionsByAddressOffset[relativeAddress]!;
}
}
@@ -4296,26 +4285,26 @@
}
class Code extends HeapObject implements M.Code {
- M.CodeKind kind;
- ObjectPool objectPool;
- ServiceFunction function;
- Script script;
- bool isOptimized;
- bool hasIntrinsic;
- bool isNative;
+ M.CodeKind? kind;
+ ObjectPool? objectPool;
+ ServiceFunction? function;
+ Script? script;
+ bool? isOptimized;
+ bool? hasIntrinsic;
+ bool? isNative;
int startAddress = 0;
int endAddress = 0;
final instructions = <CodeInstruction>[];
- List<CodeInstruction> instructionsByAddressOffset;
+ List<CodeInstruction?>? instructionsByAddressOffset;
- ProfileCode profile;
+ ProfileCode? profile;
final List<CodeInlineInterval> inlineIntervals = <CodeInlineInterval>[];
final List<ServiceFunction> inlinedFunctions = <ServiceFunction>[];
bool get immutable => true;
- Code._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Code._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _updateDescriptors(Script script) {
this.script = script;
@@ -4326,7 +4315,7 @@
}
}
- Future loadScript() {
+ Future loadScript() async {
if (script != null) {
// Already done.
return null;
@@ -4337,10 +4326,10 @@
if (function == null) {
return null;
}
- if ((function.location == null) || (function.location.script == null)) {
+ if ((function!.location == null) || (function!.location!.script == null)) {
// Attempt to load the function.
- return function.load().then((func) {
- var script = function.location.script;
+ return function!.load().then((func) {
+ var script = function!.location!.script;
if (script == null) {
// Function doesn't have an associated script.
return null;
@@ -4351,7 +4340,7 @@
}
{
// Load the script and then update descriptors.
- var script = function.location.script;
+ var script = function!.location!.script;
return script.load().then((_) => _updateDescriptors(script));
}
}
@@ -4380,8 +4369,8 @@
_loaded = true;
startAddress = int.parse(m['_startAddress'], radix: 16);
endAddress = int.parse(m['_endAddress'], radix: 16);
- function = isolate.getFromMap(m['function']);
- objectPool = isolate.getFromMap(m['_objectPool']);
+ function = isolate!.getFromMap(m['function']) as ServiceFunction;
+ objectPool = isolate!.getFromMap(m['_objectPool']) as ObjectPool;
var disassembly = m['_disassembly'];
if (disassembly != null) {
_processDisassembly(disassembly);
@@ -4399,7 +4388,8 @@
// Iterate and upgrade each ServiceFunction.
for (var i = 0; i < inlinedFunctionsTable.length; i++) {
// Upgrade each function and set it back in the list.
- var func = isolate.getFromMap(inlinedFunctionsTable[i]);
+ var func =
+ isolate!.getFromMap(inlinedFunctionsTable[i]) as ServiceFunction;
inlinedFunctionsTable[i] = func;
if (!inlinedFunctions.contains(func)) {
inlinedFunctions.add(func);
@@ -4417,7 +4407,7 @@
super._update(m, mapIsRef);
}
- CodeInlineInterval findInterval(int pc) {
+ CodeInlineInterval? findInterval(int pc) {
for (var i = 0; i < inlineIntervals.length; i++) {
var interval = inlineIntervals[i];
if (interval.contains(pc)) {
@@ -4451,7 +4441,8 @@
void _processDisassembly(List disassembly) {
assert(disassembly != null);
instructions.clear();
- instructionsByAddressOffset = new List(endAddress - startAddress);
+ instructionsByAddressOffset =
+ new List<CodeInstruction?>.filled(endAddress - startAddress, null);
assert((disassembly.length % 4) == 0);
for (var i = 0; i < disassembly.length; i += 4) {
@@ -4460,7 +4451,7 @@
var human = disassembly[i + 2];
var object = disassembly[i + 3];
if (object != null) {
- object = new ServiceObject._fromMap(owner, object);
+ object = ServiceObject._fromMap(owner, object);
}
var pcOffset = 0;
if (disassembly[i] != null) {
@@ -4473,11 +4464,12 @@
instructions.add(instruction);
if (disassembly[i] != null) {
// Not a code comment.
- instructionsByAddressOffset[pcOffset] = instruction;
+ instructionsByAddressOffset![pcOffset] = instruction;
}
}
for (var instruction in instructions) {
- instruction._resolveJumpTarget(instructionsByAddressOffset, startAddress);
+ instruction._resolveJumpTarget(
+ instructionsByAddressOffset!, startAddress);
}
}
@@ -4490,7 +4482,7 @@
var tryIndex = descriptor['tryIndex'];
var kind = descriptor['kind'].trim();
- var instruction = instructionsByAddressOffset[address - startAddress];
+ var instruction = instructionsByAddressOffset![address - startAddress];
if (instruction != null) {
instruction.descriptors
.add(new PcDescriptor(pcOffset, deoptId, tokenPos, tryIndex, kind));
@@ -4553,16 +4545,16 @@
/// OS pipes. Each socket is owned by another ServceObject, for example,
/// a process or an HTTP server.
class Socket extends ServiceObject {
- Socket._empty(ServiceObjectOwner owner) : super._empty(owner);
+ Socket._empty(ServiceObjectOwner? owner) : super._empty(owner);
- ServiceObject socketOwner;
+ ServiceObject? socketOwner;
bool get isPipe => (kind == SocketKind.Pipe);
- SocketStats latest;
- SocketStats previous;
+ SocketStats? latest;
+ SocketStats? previous;
- SocketKind kind;
+ SocketKind? kind;
String protocol = '';
@@ -4573,12 +4565,12 @@
/// Listening for connections.
bool listening = false;
- int fd;
+ int? fd;
- String localAddress;
- int localPort;
- String remoteAddress;
- int remotePort;
+ String? localAddress;
+ int? localPort;
+ String? remoteAddress;
+ int? remotePort;
// Updates internal state from [map]. [map] can be a reference.
void _update(Map map, bool mapIsRef) {
@@ -4613,20 +4605,20 @@
}
class ServiceMetric extends ServiceObject implements M.Metric {
- ServiceMetric._empty(ServiceObjectOwner owner) : super._empty(owner) {}
+ ServiceMetric._empty(ServiceObjectOwner? owner) : super._empty(owner) {}
bool get immutable => false;
Future<Map> _fetchDirect({int count: kDefaultFieldLimit}) {
assert(owner is Isolate);
- return isolate.invokeRpcNoUpgrade('_getIsolateMetric', {'metricId': id});
+ return isolate!.invokeRpcNoUpgrade('_getIsolateMetric', {'metricId': id});
}
- String description;
+ String? description;
double value = 0.0;
// Only a gauge has a non-null min and max.
- double min;
- double max;
+ double? min;
+ double? max;
bool get isGauge => (min != null) && (max != null);
@@ -4652,14 +4644,14 @@
class Frame extends ServiceObject implements M.Frame {
M.FrameKind kind = M.FrameKind.regular;
- int index;
- ServiceFunction function;
- SourceLocation location;
- Code code;
+ int? index;
+ ServiceFunction? function;
+ SourceLocation? location;
+ Code? code;
List<ServiceMap> variables = <ServiceMap>[];
- String marker;
+ String? marker;
- Frame._empty(ServiceObject owner) : super._empty(owner);
+ Frame._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
assert(!mapIsRef);
@@ -4698,7 +4690,7 @@
String toString() {
if (function != null) {
- return "Frame([$kind] ${function.qualifiedName} $location)";
+ return "Frame([$kind] ${function!.qualifiedName} $location)";
} else if (location != null) {
return "Frame([$kind] $location)";
} else {
@@ -4708,10 +4700,10 @@
Future<String> toUserString() async {
if (function != null) {
- return "Frame([$kind] ${function.qualifiedName} "
- "${await location.toUserString()})";
+ return "Frame([$kind] ${function!.qualifiedName} "
+ "${await location!.toUserString()})";
} else if (location != null) {
- return "Frame([$kind] ${await location.toUserString()}";
+ return "Frame([$kind] ${await location!.toUserString()}";
} else {
return "Frame([$kind])";
}
@@ -4719,13 +4711,13 @@
}
class ServiceMessage extends ServiceObject {
- int index;
- String messageObjectId;
- int size;
- ServiceFunction handler;
- SourceLocation location;
+ int? index;
+ String? messageObjectId;
+ int? size;
+ ServiceFunction? handler;
+ SourceLocation? location;
- ServiceMessage._empty(ServiceObject owner) : super._empty(owner);
+ ServiceMessage._empty(ServiceObjectOwner? owner) : super._empty(owner);
void _update(Map map, bool mapIsRef) {
assert(!mapIsRef);
@@ -4766,14 +4758,14 @@
var possibleBpts = range['possibleBreakpoints'];
if (possibleBpts != null) {
for (var tokenPos in possibleBpts) {
- result.add(script.tokenToLine(tokenPos));
+ result.add(script.tokenToLine(tokenPos!)!);
}
}
} else {
- int startLine = script.tokenToLine(range['startPos']);
- int endLine = script.tokenToLine(range['endPos']);
+ int startLine = script.tokenToLine(range['startPos'])!;
+ int endLine = script.tokenToLine(range['endPos'])!;
for (int line = startLine; line <= endLine; line++) {
- if (!script.getLine(line).isTrivial) {
+ if (!script.getLine(line)!.isTrivial) {
result.add(line);
}
}
@@ -4795,7 +4787,7 @@
/// Recursively upgrades all [ServiceObject]s inside [collection] which must
/// be an [Map] or an [List]. Upgraded elements will be
/// associated with [vm] and [isolate].
-void _upgradeCollection(collection, ServiceObjectOwner owner) {
+void _upgradeCollection(collection, ServiceObjectOwner? owner) {
if (collection is ServiceMap) {
return; // Already upgraded.
}
@@ -4807,10 +4799,10 @@
}
}
-void _upgradeMap(Map map, ServiceObjectOwner owner) {
+void _upgradeMap(Map map, ServiceObjectOwner? owner) {
map.forEach((k, v) {
if ((v is Map) && _isServiceMap(v)) {
- map[k] = owner.getFromMap(v);
+ map[k] = owner!.getFromMap(v);
} else if (v is List) {
_upgradeList(v, owner);
} else if (v is Map) {
@@ -4819,7 +4811,7 @@
});
}
-void _upgradeList(List list, ServiceObjectOwner owner) {
+void _upgradeList(List list, ServiceObjectOwner? owner) {
if (list is Uint8List) {
// Nothing to upgrade; avoid slowly visiting every byte
// of large binary responses.
@@ -4829,7 +4821,7 @@
for (var i = 0; i < list.length; i++) {
var v = list[i];
if ((v is Map) && _isServiceMap(v)) {
- list[i] = owner.getFromMap(v);
+ list[i] = owner!.getFromMap(v);
} else if (v is List) {
_upgradeList(v, owner);
} else if (v is Map) {
diff --git a/runtime/observatory/lib/tracer.dart b/runtime/observatory/lib/tracer.dart
index 3a18cfd..3f9a07f 100644
--- a/runtime/observatory/lib/tracer.dart
+++ b/runtime/observatory/lib/tracer.dart
@@ -27,7 +27,7 @@
}
class TraceEvent {
- TraceEvent.msg(this._time, this.message, Map originalMap) {
+ TraceEvent.msg(this._time, this.message, Map? originalMap) {
map = _deepCopy(originalMap);
}
@@ -39,14 +39,14 @@
int _time;
String message;
- Map map;
+ Map? map;
}
class Tracer {
// The current global tracer.
- static Tracer get current => _current;
+ static Tracer? get current => _current;
- static Tracer _current;
+ static Tracer? _current;
static void start() {
if (_current == null) {
@@ -56,23 +56,23 @@
static void stop() {
if (_current != null) {
- _current.cancel();
+ _current!.cancel();
_current = null;
}
}
// The tracer subscribes to all logging events.
- StreamSubscription loggerSub = null;
+ StreamSubscription? loggerSub = null;
// The start time for the current request.
- Stopwatch _time;
+ Stopwatch? _time;
// A list of all tracing events for thre current request.
List<TraceEvent> events = <TraceEvent>[];
Tracer() {
_time = new Stopwatch();
- _time.start();
+ _time!.start();
loggerSub = Logger.root.onRecord.listen((LogRecord rec) {
// Echo all log messages to the trace.
trace('${rec.level.name}: ${rec.message}');
@@ -81,16 +81,16 @@
}
void cancel() {
- loggerSub.cancel();
+ loggerSub!.cancel();
}
void reset() {
- _time.reset();
+ _time!.reset();
events.clear();
}
- TraceEvent trace(String message, {Map map: null}) {
- var event = new TraceEvent.msg(_time.elapsedMicroseconds, message, map);
+ TraceEvent trace(String message, {Map? map}) {
+ var event = new TraceEvent.msg(_time!.elapsedMicroseconds, message, map);
events.add(event);
return event;
}
diff --git a/runtime/observatory/lib/utils.dart b/runtime/observatory/lib/utils.dart
index 821e88f..940a6e1 100644
--- a/runtime/observatory/lib/utils.dart
+++ b/runtime/observatory/lib/utils.dart
@@ -29,7 +29,7 @@
static String zeroPad(int value, int pad) {
String prefix = "";
while (pad > 1) {
- int pow10 = pow(10, pad - 1);
+ int pow10 = pow(10, pad - 1) as int;
if (value < pow10) {
prefix = prefix + "0";
}
@@ -289,7 +289,7 @@
/// A [Task] that can be scheduled on the Dart event queue.
class Task {
- Timer _timer;
+ Timer? _timer;
final Function callback;
Task(this.callback);
diff --git a/runtime/observatory/pubspec.yaml b/runtime/observatory/pubspec.yaml
index efd6952..ba282ab 100644
--- a/runtime/observatory/pubspec.yaml
+++ b/runtime/observatory/pubspec.yaml
@@ -1,6 +1,6 @@
name: observatory
environment:
- sdk: '>=2.2.2 <3.0.0'
+ sdk: '>=2.10.0 <3.0.0'
dependencies:
usage: 'any'
@@ -8,4 +8,3 @@
dev_dependencies:
build_runner: '>=1.6.2 <2.0.0'
build_web_compilers: '>=2.6.1 <3.0.0'
-
diff --git a/runtime/observatory/tests/observatory_ui/app_test.dart b/runtime/observatory/tests/observatory_ui/app_test.dart
index 0fab60c..9622ec4ad 100644
--- a/runtime/observatory/tests/observatory_ui/app_test.dart
+++ b/runtime/observatory/tests/observatory_ui/app_test.dart
@@ -14,7 +14,7 @@
print('${rec.level.name}: ${rec.time}: ${rec.message}');
});
Logger.root.info('Starting Observatory');
- document.body.children
+ document.body!.children
.insert(0, new ObservatoryApplicationElement.created().element);
});
}
diff --git a/runtime/observatory/tests/service/add_breakpoint_rpc_kernel_test.dart b/runtime/observatory/tests/service/add_breakpoint_rpc_kernel_test.dart
index 34feaf0..96ae4b5 100644
--- a/runtime/observatory/tests/service/add_breakpoint_rpc_kernel_test.dart
+++ b/runtime/observatory/tests/service/add_breakpoint_rpc_kernel_test.dart
@@ -38,15 +38,15 @@
var futureBpt1 = await isolate.addBreakpoint(script, LINE_A);
expect(futureBpt1.number, equals(1));
expect(futureBpt1.resolved, isFalse);
- expect(await futureBpt1.location.getLine(), equals(LINE_A));
- expect(await futureBpt1.location.getColumn(), equals(null));
+ expect(await futureBpt1.location!.getLine(), equals(LINE_A));
+ expect(await futureBpt1.location!.getColumn(), equals(null));
// Future breakpoint with specific column.
var futureBpt2 = await isolate.addBreakpoint(script, LINE_A, 3);
expect(futureBpt2.number, equals(2));
expect(futureBpt2.resolved, isFalse);
- expect(await futureBpt2.location.getLine(), equals(LINE_A));
- expect(await futureBpt2.location.getColumn(), equals(3));
+ expect(await futureBpt2.location!.getLine(), equals(LINE_A));
+ expect(await futureBpt2.location!.getColumn(), equals(3));
int resolvedCount =
await resumeAndCountResolvedBreakpointsUntilPause(isolate);
@@ -54,21 +54,21 @@
// After resolution the breakpoints have assigned line & column.
expect(resolvedCount, equals(2));
expect(futureBpt1.resolved, isTrue);
- expect(await futureBpt1.location.getLine(), equals(LINE_A));
- expect(await futureBpt1.location.getColumn(), equals(12));
+ expect(await futureBpt1.location!.getLine(), equals(LINE_A));
+ expect(await futureBpt1.location!.getColumn(), equals(12));
expect(futureBpt2.resolved, isTrue);
- expect(await futureBpt2.location.getLine(), equals(LINE_A));
- expect(await futureBpt2.location.getColumn(), equals(3));
+ expect(await futureBpt2.location!.getLine(), equals(LINE_A));
+ expect(await futureBpt2.location!.getColumn(), equals(3));
// The first breakpoint hits before value is modified.
- Instance result = await rootLib.evaluate('value');
+ Instance result = await rootLib.evaluate('value') as Instance;
expect(result.valueAsString, equals('0'));
isolate.resume();
await hasStoppedAtBreakpoint(isolate);
// The second breakpoint hits after value has been modified once.
- result = await rootLib.evaluate('value');
+ result = await rootLib.evaluate('value') as Instance;
expect(result.valueAsString, equals('1'));
// Remove the breakpoints.
@@ -85,8 +85,8 @@
for (int col = 1; col <= 50; col++) {
var bpt = await isolate.addBreakpoint(script, LINE_A, col);
expect(bpt.resolved, isTrue);
- int resolvedLine = await bpt.location.getLine();
- int resolvedCol = await bpt.location.getColumn();
+ int resolvedLine = await bpt.location!.getLine() as int;
+ int resolvedCol = await bpt.location!.getColumn() as int;
print('$LINE_A:${col} -> ${resolvedLine}:${resolvedCol}');
if (col <= 12) {
expect(resolvedLine, equals(LINE_A));
diff --git a/runtime/observatory/tests/service/allocations_test.dart b/runtime/observatory/tests/service/allocations_test.dart
index b2d9085..6a7d002 100644
--- a/runtime/observatory/tests/service/allocations_test.dart
+++ b/runtime/observatory/tests/service/allocations_test.dart
@@ -13,7 +13,7 @@
// Prevent TFA from removing this static field to ensure the objects are kept
// alive, so the allocation stats will report them via the service api.
@pragma('vm:entry-point')
-List<Foo> foos;
+List<Foo>? foos;
void script() {
foos = [new Foo(), new Foo(), new Foo()];
diff --git a/runtime/observatory/tests/service/async_single_step_exception_test.dart b/runtime/observatory/tests/service/async_single_step_exception_test.dart
index fdc490e..55bd063 100644
--- a/runtime/observatory/tests/service/async_single_step_exception_test.dart
+++ b/runtime/observatory/tests/service/async_single_step_exception_test.dart
@@ -27,7 +27,7 @@
print('mmmmm'); // LINE_C.
try {
await helper(); // LINE_D.
- } catch (e) {
+ } on dynamic catch (e) {
// arrive here on error.
print('error: $e'); // LINE_E.
} finally {
diff --git a/runtime/observatory/tests/service/auth_token_test.dart b/runtime/observatory/tests/service/auth_token_test.dart
index f2ba275..27a0b47 100644
--- a/runtime/observatory/tests/service/auth_token_test.dart
+++ b/runtime/observatory/tests/service/auth_token_test.dart
@@ -17,13 +17,13 @@
ServiceProtocolInfo info = await Service.controlWebServer(enable: true);
Expect.isNotNull(info.serverUri);
// Ensure that we have the auth token in the path segments.
- Expect.isTrue(info.serverUri.pathSegments.length > 1);
+ Expect.isTrue(info.serverUri!.pathSegments.length > 1);
// Sanity check the length of the auth token.
- Expect.isTrue(info.serverUri.pathSegments[0].length > 8);
+ Expect.isTrue(info.serverUri!.pathSegments[0].length > 8);
// Try connecting to the server without the auth token, it should throw
// an exception.
- var port = info.serverUri.port;
+ var port = info.serverUri!.port;
var url = Uri.parse('http://localhost:$port');
var httpClient = new io.HttpClient();
try {
@@ -35,7 +35,7 @@
// Try connecting to the server with the auth token, it should succeed.
try {
- var request = await httpClient.getUrl(info.serverUri);
+ var request = await httpClient.getUrl(info.serverUri!);
} catch (e) {
fail('could not connect');
}
diff --git a/runtime/observatory/tests/service/bad_reload_test.dart b/runtime/observatory/tests/service/bad_reload_test.dart
index 9c4219c..eb40b71 100644
--- a/runtime/observatory/tests/service/bad_reload_test.dart
+++ b/runtime/observatory/tests/service/bad_reload_test.dart
@@ -32,9 +32,9 @@
await isolate.reload();
Library lib = isolate.rootLibrary;
await lib.load();
- Instance result = await lib.evaluate('test()');
+ Instance result = await lib.evaluate('test()') as Instance;
expect(result.isString, isTrue);
- return result.valueAsString;
+ return result.valueAsString as String;
}
var tests = <IsolateTest>[
diff --git a/runtime/observatory/tests/service/bad_web_socket_address_test.dart b/runtime/observatory/tests/service/bad_web_socket_address_test.dart
index b0a3bbb..63d8386 100644
--- a/runtime/observatory/tests/service/bad_web_socket_address_test.dart
+++ b/runtime/observatory/tests/service/bad_web_socket_address_test.dart
@@ -24,5 +24,5 @@
print('${rec.level.name}: ${rec.time}: ${rec.message}');
});
- await test('bad web socket address', testBadWebSocket);
+ test('bad web socket address', testBadWebSocket);
}
diff --git a/runtime/observatory/tests/service/break_on_activation_test.dart b/runtime/observatory/tests/service/break_on_activation_test.dart
index fac2684..1b6191b 100644
--- a/runtime/observatory/tests/service/break_on_activation_test.dart
+++ b/runtime/observatory/tests/service/break_on_activation_test.dart
@@ -48,7 +48,7 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
var breaksHit = 0;
@@ -92,7 +92,7 @@
await cancelFutureSubscription(subscriptionFuture);
},
(Isolate isolate) async {
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
var breaksHit = 0;
@@ -136,7 +136,7 @@
await cancelFutureSubscription(subscriptionFuture);
},
(Isolate isolate) async {
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
var breaksHit = 0;
diff --git a/runtime/observatory/tests/service/break_on_async_function_test.dart b/runtime/observatory/tests/service/break_on_async_function_test.dart
index dd52294..ba6bb18 100644
--- a/runtime/observatory/tests/service/break_on_async_function_test.dart
+++ b/runtime/observatory/tests/service/break_on_async_function_test.dart
@@ -26,7 +26,7 @@
// Add breakpoint at the entry of async function
(Isolate isolate) async {
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
var function =
rootLib.functions.singleWhere((f) => f.name == 'testFunction');
diff --git a/runtime/observatory/tests/service/break_on_default_constructor_test.dart b/runtime/observatory/tests/service/break_on_default_constructor_test.dart
index d968ca2..83e09fa 100644
--- a/runtime/observatory/tests/service/break_on_default_constructor_test.dart
+++ b/runtime/observatory/tests/service/break_on_default_constructor_test.dart
@@ -51,7 +51,7 @@
if (loc.valid) {
if (loc.function != null) {
try {
- await debugger.isolate.addBreakpointAtEntry(loc.function);
+ await debugger.isolate.addBreakpointAtEntry(loc.function!);
} on S.ServerRpcException catch (e) {
if (e.code == S.ServerRpcException.kCannotAddBreakpoint) {
// Expected
diff --git a/runtime/observatory/tests/service/break_on_function_test.dart b/runtime/observatory/tests/service/break_on_function_test.dart
index 89f60fb..acdf910 100644
--- a/runtime/observatory/tests/service/break_on_function_test.dart
+++ b/runtime/observatory/tests/service/break_on_function_test.dart
@@ -32,7 +32,7 @@
// Add breakpoint
(Isolate isolate) async {
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
var function =
rootLib.functions.singleWhere((f) => f.name == 'testFunction');
diff --git a/runtime/observatory/tests/service/breakpoint_async_break_test.dart b/runtime/observatory/tests/service/breakpoint_async_break_test.dart
index b59613e..671577e 100644
--- a/runtime/observatory/tests/service/breakpoint_async_break_test.dart
+++ b/runtime/observatory/tests/service/breakpoint_async_break_test.dart
@@ -33,8 +33,8 @@
var futureBpt = await isolate.addBreakpoint(script, LINE);
expect(futureBpt.number, 1);
expect(futureBpt.resolved, isFalse);
- expect(await futureBpt.location.getLine(), LINE);
- expect(await futureBpt.location.getColumn(), null);
+ expect(await futureBpt.location!.getLine(), LINE);
+ expect(await futureBpt.location!.getColumn(), null);
var stream = await isolate.vm.getEventStream(VM.kDebugStream);
Completer completer = new Completer();
@@ -55,8 +55,8 @@
// After resolution the breakpoints have assigned line & column.
expect(resolvedCount, 1);
expect(futureBpt.resolved, isTrue);
- expect(await futureBpt.location.getLine(), LINE);
- expect(await futureBpt.location.getColumn(), 7);
+ expect(await futureBpt.location!.getLine(), LINE);
+ expect(await futureBpt.location!.getColumn(), 7);
// Remove the breakpoints.
expect((await isolate.removeBreakpoint(futureBpt)).type, 'Success');
diff --git a/runtime/observatory/tests/service/breakpoint_non_debuggable_library_test.dart b/runtime/observatory/tests/service/breakpoint_non_debuggable_library_test.dart
index 1c7af66..e4339b4 100644
--- a/runtime/observatory/tests/service/breakpoint_non_debuggable_library_test.dart
+++ b/runtime/observatory/tests/service/breakpoint_non_debuggable_library_test.dart
@@ -54,7 +54,7 @@
'isDebuggable': false,
};
Map<String, dynamic> result = await isolate.invokeRpcNoUpgrade(
- 'setLibraryDebuggable', setDebugParams);
+ 'setLibraryDebuggable', setDebugParams) as Map<String, dynamic>;
expect(result['type'], 'Success');
await has_part.reload();
expect(has_part.debuggable, false);
@@ -63,7 +63,7 @@
// Breakpoints are not allowed to set on non-debuggable libraries.
try {
await isolate.addBreakpoint(script, LINE_B);
- } catch (e) {
+ } on dynamic catch (e) {
expect(e is ServerRpcException, true);
expect(e.code == ServerRpcException.kCannotAddBreakpoint, true);
print("Set Breakpoint to non-debuggable library is not allowed");
diff --git a/runtime/observatory/tests/service/breakpoint_two_args_checked_test.dart b/runtime/observatory/tests/service/breakpoint_two_args_checked_test.dart
index 4723545..9832fa4 100644
--- a/runtime/observatory/tests/service/breakpoint_two_args_checked_test.dart
+++ b/runtime/observatory/tests/service/breakpoint_two_args_checked_test.dart
@@ -19,7 +19,7 @@
class NotGeneric {}
testeeMain() {
- var x = new List(1);
+ var x = new List<dynamic>.filled(1, null);
var y = 7;
debugger();
print("Statement");
@@ -33,23 +33,23 @@
// Add breakpoints.
(Isolate isolate) async {
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
var script = rootLib.scripts[0];
var bpt1 = await isolate.addBreakpoint(script, LINE_A);
print(bpt1);
expect(bpt1.resolved, isTrue);
- expect(await bpt1.location.getLine(), equals(LINE_A));
+ expect(await bpt1.location!.getLine(), equals(LINE_A));
var bpt2 = await isolate.addBreakpoint(script, LINE_B);
print(bpt2);
expect(bpt2.resolved, isTrue);
- expect(await bpt2.location.getLine(), equals(LINE_B));
+ expect(await bpt2.location!.getLine(), equals(LINE_B));
var bpt3 = await isolate.addBreakpoint(script, LINE_C);
print(bpt3);
expect(bpt3.resolved, isTrue);
- expect(await bpt3.location.getLine(), equals(LINE_C));
+ expect(await bpt3.location!.getLine(), equals(LINE_C));
},
resumeIsolate,
diff --git a/runtime/observatory/tests/service/caching_test.dart b/runtime/observatory/tests/service/caching_test.dart
index 0c89eca..9f374f7 100644
--- a/runtime/observatory/tests/service/caching_test.dart
+++ b/runtime/observatory/tests/service/caching_test.dart
@@ -14,9 +14,9 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
- Script script = await lib.scripts.single.load();
- Script script2 = await isolate.getObject(script.id);
+ Library lib = await isolate.rootLibrary.load() as Library;
+ Script script = await lib.scripts.single.load() as Script;
+ Script script2 = await isolate.getObject(script.id!) as Script;
expect(identical(script, script2), isTrue);
},
];
diff --git a/runtime/observatory/tests/service/client_resume_approvals_approve_then_disconnect_test.dart b/runtime/observatory/tests/service/client_resume_approvals_approve_then_disconnect_test.dart
index 28715a4..af84161 100644
--- a/runtime/observatory/tests/service/client_resume_approvals_approve_then_disconnect_test.dart
+++ b/runtime/observatory/tests/service/client_resume_approvals_approve_then_disconnect_test.dart
@@ -16,13 +16,13 @@
print(i);
}
-WebSocketVM client1;
-WebSocketVM client2;
+late WebSocketVM client1;
+late WebSocketVM client2;
final test = <IsolateTest>[
hasPausedAtStart,
(Isolate isolate) async {
- client1 = await createClient(isolate.owner);
+ client1 = await createClient(isolate.owner as WebSocketVM);
await setRequireApprovalForResume(
client1,
isolate,
@@ -30,7 +30,7 @@
pauseOnExit: true,
);
client2 = await createClient(
- isolate.owner,
+ isolate.owner as WebSocketVM,
clientName: otherClientName,
);
await setRequireApprovalForResume(
diff --git a/runtime/observatory/tests/service/client_resume_approvals_common.dart b/runtime/observatory/tests/service/client_resume_approvals_common.dart
index a2221e5..b6a8006 100644
--- a/runtime/observatory/tests/service/client_resume_approvals_common.dart
+++ b/runtime/observatory/tests/service/client_resume_approvals_common.dart
@@ -81,5 +81,5 @@
}
});
});
- return completer.future;
+ await completer.future;
}
diff --git a/runtime/observatory/tests/service/client_resume_approvals_disconnect_test.dart b/runtime/observatory/tests/service/client_resume_approvals_disconnect_test.dart
index 1ef5273..e94b528 100644
--- a/runtime/observatory/tests/service/client_resume_approvals_disconnect_test.dart
+++ b/runtime/observatory/tests/service/client_resume_approvals_disconnect_test.dart
@@ -16,14 +16,14 @@
print(i);
}
-WebSocketVM client1;
-WebSocketVM client2;
+late WebSocketVM client1;
+late WebSocketVM client2;
final test = <IsolateTest>[
// Multiple clients, disconnect client awaiting approval.
hasPausedAtStart,
(Isolate isolate) async {
- client1 = await createClient(isolate.owner);
+ client1 = await createClient(isolate.owner as WebSocketVM);
await setRequireApprovalForResume(
client1,
isolate,
@@ -31,7 +31,7 @@
pauseOnExit: true,
);
client2 = await createClient(
- isolate.owner,
+ isolate.owner as WebSocketVM,
clientName: otherClientName,
);
await setRequireApprovalForResume(
diff --git a/runtime/observatory/tests/service/client_resume_approvals_identical_names_test.dart b/runtime/observatory/tests/service/client_resume_approvals_identical_names_test.dart
index 06df948..4618441 100644
--- a/runtime/observatory/tests/service/client_resume_approvals_identical_names_test.dart
+++ b/runtime/observatory/tests/service/client_resume_approvals_identical_names_test.dart
@@ -16,22 +16,22 @@
print(i);
}
-WebSocketVM client1;
-WebSocketVM client2;
+late WebSocketVM client1;
+late WebSocketVM client2;
final sameClientNamesTest = <IsolateTest>[
// Multiple clients, same client names.
(Isolate isolate) async {
final resumeFuture = waitForResume(isolate);
- client1 = await createClient(isolate.owner);
+ client1 = await createClient(isolate.owner as WebSocketVM);
await setRequireApprovalForResume(
client1,
isolate,
pauseOnStart: true,
pauseOnExit: true,
);
- client2 = await createClient(isolate.owner);
+ client2 = await createClient(isolate.owner as WebSocketVM);
expect(await isPausedAtStart(isolate), true);
await resume(client2, isolate);
diff --git a/runtime/observatory/tests/service/client_resume_approvals_multiple_names_test.dart b/runtime/observatory/tests/service/client_resume_approvals_multiple_names_test.dart
index 780fe61..60a8282 100644
--- a/runtime/observatory/tests/service/client_resume_approvals_multiple_names_test.dart
+++ b/runtime/observatory/tests/service/client_resume_approvals_multiple_names_test.dart
@@ -16,14 +16,14 @@
print(i);
}
-WebSocketVM client1;
-WebSocketVM client2;
-WebSocketVM client3;
+late WebSocketVM client1;
+late WebSocketVM client2;
+late WebSocketVM client3;
final multipleClientNamesTest = <IsolateTest>[
// Multiple clients, different client names.
(Isolate isolate) async {
- client1 = await createClient(isolate.owner);
+ client1 = await createClient(isolate.owner as WebSocketVM);
await setRequireApprovalForResume(
client1,
isolate,
@@ -31,10 +31,11 @@
pauseOnExit: true,
);
client2 = await createClient(
- isolate.owner,
+ isolate.owner as WebSocketVM,
clientName: otherClientName,
);
- client3 = await createClient(isolate.owner, clientName: 'DummyClient');
+ client3 = await createClient(isolate.owner as WebSocketVM,
+ clientName: 'DummyClient');
final resumeFuture = waitForResume(isolate);
expect(await isPausedAtStart(isolate), true);
diff --git a/runtime/observatory/tests/service/client_resume_approvals_name_change_test.dart b/runtime/observatory/tests/service/client_resume_approvals_name_change_test.dart
index dac6f2b..0d58098 100644
--- a/runtime/observatory/tests/service/client_resume_approvals_name_change_test.dart
+++ b/runtime/observatory/tests/service/client_resume_approvals_name_change_test.dart
@@ -16,9 +16,9 @@
print(i);
}
-WebSocketVM client1;
-WebSocketVM client2;
-WebSocketVM client3;
+late WebSocketVM client1;
+late WebSocketVM client2;
+late WebSocketVM client3;
final nameChangeTest = <IsolateTest>[
// Remove required approvals via name change.
@@ -26,15 +26,16 @@
final resumeFuture = waitForResume(isolate);
// Create two clients with the same name.
- client1 = await createClient(isolate.owner);
- client2 = await createClient(isolate.owner);
+ client1 = await createClient(isolate.owner as WebSocketVM);
+ client2 = await createClient(isolate.owner as WebSocketVM);
await setRequireApprovalForResume(
client1,
isolate,
pauseOnStart: true,
pauseOnExit: true,
);
- client3 = await createClient(isolate.owner, clientName: otherClientName);
+ client3 = await createClient(isolate.owner as WebSocketVM,
+ clientName: otherClientName);
// Check that client3 can't resume the isolate on its own.
expect(await isPausedAtStart(isolate), true);
diff --git a/runtime/observatory/tests/service/client_resume_approvals_reload_test.dart b/runtime/observatory/tests/service/client_resume_approvals_reload_test.dart
index fcd7e72..9731070 100644
--- a/runtime/observatory/tests/service/client_resume_approvals_reload_test.dart
+++ b/runtime/observatory/tests/service/client_resume_approvals_reload_test.dart
@@ -19,22 +19,22 @@
print(i);
}
-WebSocketVM client1;
-WebSocketVM client2;
+late WebSocketVM client1;
+late WebSocketVM client2;
final hotReloadTest = <IsolateTest>[
// Multiple clients, hot reload approval.
(Isolate isolate) async {
final resumeFuture = waitForResume(isolate);
- client1 = await createClient(isolate.owner);
+ client1 = await createClient(isolate.owner as WebSocketVM);
await setRequireApprovalForResume(
client1,
isolate,
pauseOnReload: true,
);
client2 = await createClient(
- isolate.owner,
+ isolate.owner as WebSocketVM,
clientName: otherClientName,
);
await setRequireApprovalForResume(
diff --git a/runtime/observatory/tests/service/code_test.dart b/runtime/observatory/tests/service/code_test.dart
index c08ef61..00bd9da 100644
--- a/runtime/observatory/tests/service/code_test.dart
+++ b/runtime/observatory/tests/service/code_test.dart
@@ -66,15 +66,15 @@
List tests = <IsolateTest>[];
// Load code from frame 0.
- Code code = await isolate.getObject(codeId0);
+ Code code = await isolate.getObject(codeId0) as Code;
expect(code.type, equals('Code'));
- expect(code.function.name, equals('funcB'));
+ expect(code.function!.name, equals('funcB'));
expect(code.hasDisassembly, equals(true));
// Load code from frame 0.
- code = await isolate.getObject(codeId1);
+ code = await isolate.getObject(codeId1) as Code;
expect(code.type, equals('Code'));
- expect(code.function.name, equals('funcA'));
+ expect(code.function!.name, equals('funcA'));
expect(code.hasDisassembly, equals(true));
},
];
diff --git a/runtime/observatory/tests/service/command_test.dart b/runtime/observatory/tests/service/command_test.dart
index a23d6b4..f77ef00 100644
--- a/runtime/observatory/tests/service/command_test.dart
+++ b/runtime/observatory/tests/service/command_test.dart
@@ -9,17 +9,17 @@
class TestCommand extends Command {
TestCommand(this.out, name, children) : super(name, children);
- StringBuffer out;
+ StringBuffer? out;
Future run(List<String> args) {
- out.write('executing ${name}(${args})\n');
+ out!.write('executing ${name}(${args})\n');
return new Future.value(null);
}
}
class TestCompleteCommand extends Command {
TestCompleteCommand(this.out, name, children) : super(name, children);
- StringBuffer out;
+ StringBuffer? out;
Future<List<String>> complete(List<String> args) {
var possibles = ['one ', 'two ', 'three '];
@@ -28,7 +28,7 @@
}
Future run(List<String> args) {
- out.write('executing ${name}(${args})\n');
+ out!.write('executing ${name}(${args})\n');
return new Future.value(null);
}
}
diff --git a/runtime/observatory/tests/service/complex_reload_test.dart b/runtime/observatory/tests/service/complex_reload_test.dart
index f0c8b93..a9cca6a 100644
--- a/runtime/observatory/tests/service/complex_reload_test.dart
+++ b/runtime/observatory/tests/service/complex_reload_test.dart
@@ -34,9 +34,9 @@
await isolate.reload();
Library lib = isolate.rootLibrary;
await lib.load();
- Instance result = await lib.evaluate('test()');
+ Instance result = await lib.evaluate('test()') as Instance;
expect(result.isString, isTrue);
- return result.valueAsString;
+ return result.valueAsString as String;
}
var tests = <IsolateTest>[
diff --git a/runtime/observatory/tests/service/contexts_test.dart b/runtime/observatory/tests/service/contexts_test.dart
index 33021a1..41afedc 100644
--- a/runtime/observatory/tests/service/contexts_test.dart
+++ b/runtime/observatory/tests/service/contexts_test.dart
@@ -58,58 +58,58 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
Field field = lib.variables.singleWhere((v) => v.name == 'cleanBlock');
await field.load();
- Instance block = await field.staticValue.load();
+ Instance block = await field.staticValue!.load() as Instance;
expect(block.isClosure, isTrue);
expect(block.closureContext, isNull);
},
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
Field field = lib.variables.singleWhere((v) => v.name == 'copyingBlock');
await field.load();
- Instance block = await field.staticValue.load();
+ Instance block = await field.staticValue!.load() as Instance;
expect(block.isClosure, isTrue);
- expect(block.closureContext.isContext, isTrue);
- expect(block.closureContext.length, equals(1));
- Context ctxt = await block.closureContext.load();
- expect(ctxt.variables.single.value.asValue.isString, isTrue);
- expect(ctxt.variables.single.value.asValue.valueAsString,
+ expect(block.closureContext!.isContext, isTrue);
+ expect(block.closureContext!.length, equals(1));
+ Context ctxt = await block.closureContext!.load() as Context;
+ expect(ctxt.variables!.single.value.asValue!.isString, isTrue);
+ expect(ctxt.variables!.single.value.asValue!.valueAsString,
equals('I could be copied into the block'));
expect(ctxt.parentContext, isNull);
},
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
Field field = lib.variables.singleWhere((v) => v.name == 'fullBlock');
await field.load();
- Instance block = await field.staticValue.load();
+ Instance block = await field.staticValue!.load() as Instance;
expect(block.isClosure, isTrue);
- expect(block.closureContext.isContext, isTrue);
- expect(block.closureContext.length, equals(1));
- Context ctxt = await block.closureContext.load();
- expect(ctxt.variables.single.value.asValue.isInt, isTrue);
- expect(ctxt.variables.single.value.asValue.valueAsString, equals('43'));
+ expect(block.closureContext!.isContext, isTrue);
+ expect(block.closureContext!.length, equals(1));
+ Context ctxt = await block.closureContext!.load() as Context;
+ expect(ctxt.variables!.single.value.asValue!.isInt, isTrue);
+ expect(ctxt.variables!.single.value.asValue!.valueAsString, equals('43'));
expect(ctxt.parentContext, isNull);
},
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
Field field =
lib.variables.singleWhere((v) => v.name == 'fullBlockWithChain');
await field.load();
- Instance block = await field.staticValue.load();
+ Instance block = await field.staticValue!.load() as Instance;
expect(block.isClosure, isTrue);
- expect(block.closureContext.isContext, isTrue);
- expect(block.closureContext.length, equals(1));
- Context ctxt = await block.closureContext.load();
- expect(ctxt.variables.single.value.asValue.isInt, isTrue);
- expect(ctxt.variables.single.value.asValue.valueAsString, equals('4201'));
- expect(ctxt.parentContext.isContext, isTrue);
- expect(ctxt.parentContext.length, equals(1));
- Context outerCtxt = await ctxt.parentContext.load();
- expect(outerCtxt.variables.single.value.asValue.isInt, isTrue);
- expect(
- outerCtxt.variables.single.value.asValue.valueAsString, equals('421'));
+ expect(block.closureContext!.isContext, isTrue);
+ expect(block.closureContext!.length, equals(1));
+ Context ctxt = await block.closureContext!.load() as Context;
+ expect(ctxt.variables!.single.value.asValue!.isInt, isTrue);
+ expect(ctxt.variables!.single.value.asValue!.valueAsString, equals('4201'));
+ expect(ctxt.parentContext!.isContext, isTrue);
+ expect(ctxt.parentContext!.length, equals(1));
+ Context outerCtxt = await ctxt.parentContext!.load() as Context;
+ expect(outerCtxt.variables!.single.value.asValue!.isInt, isTrue);
+ expect(outerCtxt.variables!.single.value.asValue!.valueAsString,
+ equals('421'));
expect(outerCtxt.parentContext, isNull);
},
];
diff --git a/runtime/observatory/tests/service/coverage_const_field_async_closure_test.dart b/runtime/observatory/tests/service/coverage_const_field_async_closure_test.dart
index a85a9c3..957251b 100644
--- a/runtime/observatory/tests/service/coverage_const_field_async_closure_test.dart
+++ b/runtime/observatory/tests/service/coverage_const_field_async_closure_test.dart
@@ -55,7 +55,7 @@
int match = 0;
for (var range in ranges) {
for (int i in range["coverage"]["hits"]) {
- int line = script.tokenToLine(i);
+ int? line = script.tokenToLine(i);
if (line == null) {
throw FormatException('token ${i} was missing source location');
}
diff --git a/runtime/observatory/tests/service/coverage_leaf_function_test.dart b/runtime/observatory/tests/service/coverage_leaf_function_test.dart
index c36441b..5cd8e12 100644
--- a/runtime/observatory/tests/service/coverage_leaf_function_test.dart
+++ b/runtime/observatory/tests/service/coverage_leaf_function_test.dart
@@ -55,9 +55,9 @@
var params = {
'reports': ['Coverage'],
- 'scriptId': func.location.script.id,
- 'tokenPos': func.location.tokenPos,
- 'endTokenPos': func.location.endTokenPos,
+ 'scriptId': func.location!.script.id,
+ 'tokenPos': func.location!.tokenPos,
+ 'endTokenPos': func.location!.endTokenPos,
'forceCompile': true
};
var report = await isolate.invokeRpcNoUpgrade('getSourceReport', params);
@@ -96,9 +96,9 @@
var params = {
'reports': ['Coverage'],
- 'scriptId': func.location.script.id,
- 'tokenPos': func.location.tokenPos,
- 'endTokenPos': func.location.endTokenPos,
+ 'scriptId': func.location!.script.id,
+ 'tokenPos': func.location!.tokenPos,
+ 'endTokenPos': func.location!.endTokenPos,
'forceCompile': true
};
var report = await isolate.invokeRpcNoUpgrade('getSourceReport', params);
diff --git a/runtime/observatory/tests/service/coverage_optimized_function_test.dart b/runtime/observatory/tests/service/coverage_optimized_function_test.dart
index ad57d161..b6c9823 100644
--- a/runtime/observatory/tests/service/coverage_optimized_function_test.dart
+++ b/runtime/observatory/tests/service/coverage_optimized_function_test.dart
@@ -48,9 +48,9 @@
var params = {
'reports': ['Coverage'],
- 'scriptId': func.location.script.id,
- 'tokenPos': func.location.tokenPos,
- 'endTokenPos': func.location.endTokenPos,
+ 'scriptId': func.location!.script.id,
+ 'tokenPos': func.location!.tokenPos,
+ 'endTokenPos': func.location!.endTokenPos,
'forceCompile': true
};
var report = await isolate.invokeRpcNoUpgrade('getSourceReport', params);
diff --git a/runtime/observatory/tests/service/dds_log_history_size_gigantic_test.dart b/runtime/observatory/tests/service/dds_log_history_size_gigantic_test.dart
index 1bd6136..d8cd47a 100644
--- a/runtime/observatory/tests/service/dds_log_history_size_gigantic_test.dart
+++ b/runtime/observatory/tests/service/dds_log_history_size_gigantic_test.dart
@@ -29,7 +29,7 @@
Future<int> getLogHistorySize(Isolate isolate) async {
final result = await isolate.invokeRpcNoUpgrade('getLogHistorySize', {});
expect(result['type'], 'Size');
- return result['size'];
+ return result['size'] as int;
}
var tests = <IsolateTest>[
@@ -59,7 +59,7 @@
int i = 11;
await subscribeToStream(isolate.vm, 'Logging', (event) async {
expect(
- event.logRecord['message'].valueAsString,
+ event.logRecord!['message'].valueAsString,
'All work and no play makes Ben a dull boy ($i)',
);
i++;
diff --git a/runtime/observatory/tests/service/dds_log_history_size_simple_test.dart b/runtime/observatory/tests/service/dds_log_history_size_simple_test.dart
index 69e0ee2..fc1e0df 100644
--- a/runtime/observatory/tests/service/dds_log_history_size_simple_test.dart
+++ b/runtime/observatory/tests/service/dds_log_history_size_simple_test.dart
@@ -29,7 +29,7 @@
Future<int> getLogHistorySize(Isolate isolate) async {
final result = await isolate.invokeRpcNoUpgrade('getLogHistorySize', {});
expect(result['type'], 'Size');
- return result['size'];
+ return result['size'] as int;
}
var tests = <IsolateTest>[
@@ -45,7 +45,7 @@
int i = 1;
await subscribeToStream(isolate.vm, 'Logging', (event) async {
- expect(event.logRecord['message'].valueAsString, 'log$i');
+ expect(event.logRecord!['message'].valueAsString, 'log$i');
i++;
if (i == 10) {
@@ -69,11 +69,11 @@
// Create a new client as we want to get log messages from the entire
// history buffer.
- final client = await createClient(isolate.vm);
+ final client = await createClient(isolate.vm as WebSocketVM);
int i = 6;
await subscribeToStream(client, 'Logging', (event) async {
- expect(event.logRecord['message'].valueAsString, 'log$i');
+ expect(event.logRecord!['message'].valueAsString, 'log$i');
i++;
if (i == 11) {
@@ -84,7 +84,7 @@
}
});
await completer.future;
- await client.disconnect();
+ client.disconnect();
},
];
diff --git a/runtime/observatory/tests/service/dds_log_history_size_test.dart b/runtime/observatory/tests/service/dds_log_history_size_test.dart
index 98cc6e3..5186f1e 100644
--- a/runtime/observatory/tests/service/dds_log_history_size_test.dart
+++ b/runtime/observatory/tests/service/dds_log_history_size_test.dart
@@ -33,7 +33,7 @@
Future<int> getLogHistorySize(Isolate isolate) async {
final result = await isolate.invokeRpcNoUpgrade('getLogHistorySize', {});
expect(result['type'], 'Size');
- return result['size'];
+ return result['size'] as int;
}
var tests = <IsolateTest>[
@@ -59,7 +59,7 @@
// With the log history set to 20, the first log message should be 'log11'
int i = 11;
await subscribeToStream(isolate.vm, 'Logging', (event) async {
- expect(event.logRecord['message'].valueAsString, 'log$i');
+ expect(event.logRecord!['message'].valueAsString, 'log$i');
i++;
if (i == 30) {
diff --git a/runtime/observatory/tests/service/debugger_inspect_test.dart b/runtime/observatory/tests/service/debugger_inspect_test.dart
index 1501b32..77dc387 100644
--- a/runtime/observatory/tests/service/debugger_inspect_test.dart
+++ b/runtime/observatory/tests/service/debugger_inspect_test.dart
@@ -24,7 +24,7 @@
var subscription;
subscription = stream.listen((ServiceEvent event) {
if (event.kind == ServiceEvent.kInspect) {
- expect(event.inspectee.clazz.name, equals('Point'));
+ expect(event.inspectee!.clazz!.name, equals('Point'));
subscription.cancel();
completer.complete();
}
diff --git a/runtime/observatory/tests/service/debugger_location_second_test.dart b/runtime/observatory/tests/service/debugger_location_second_test.dart
index e8d6739..ba9420d 100644
--- a/runtime/observatory/tests/service/debugger_location_second_test.dart
+++ b/runtime/observatory/tests/service/debugger_location_second_test.dart
@@ -41,7 +41,7 @@
void method() {}
void madness() {}
- int field;
+ int? field;
}
class DebuggerLocationTestBar {}
diff --git a/runtime/observatory/tests/service/debugger_location_test.dart b/runtime/observatory/tests/service/debugger_location_test.dart
index 77b939c..fe66893 100644
--- a/runtime/observatory/tests/service/debugger_location_test.dart
+++ b/runtime/observatory/tests/service/debugger_location_test.dart
@@ -41,7 +41,7 @@
void method() {}
void madness() {}
- int field;
+ late int field;
}
class DebuggerLocationTestBar {}
diff --git a/runtime/observatory/tests/service/debugging_inlined_finally_test.dart b/runtime/observatory/tests/service/debugging_inlined_finally_test.dart
index 9012cf3..e2e1bbb 100644
--- a/runtime/observatory/tests/service/debugging_inlined_finally_test.dart
+++ b/runtime/observatory/tests/service/debugging_inlined_finally_test.dart
@@ -51,8 +51,8 @@
expect(result is Breakpoint, isTrue);
Breakpoint bpt = result;
expect(bpt.type, equals('Breakpoint'));
- expect(bpt.location.script.id, equals(script.id));
- expect(bpt.location.script.tokenToLine(bpt.location.tokenPos),
+ expect(bpt.location!.script.id, equals(script.id));
+ expect(bpt.location!.script.tokenToLine(bpt.location!.tokenPos),
equals(LINE_A));
expect(isolate.breakpoints.length, equals(1));
}
@@ -62,8 +62,8 @@
expect(result is Breakpoint, isTrue);
Breakpoint bpt = result;
expect(bpt.type, equals('Breakpoint'));
- expect(bpt.location.script.id, equals(script.id));
- expect(bpt.location.script.tokenToLine(bpt.location.tokenPos),
+ expect(bpt.location!.script.id, equals(script.id));
+ expect(bpt.location!.script.tokenToLine(bpt.location!.tokenPos),
equals(LINE_B));
expect(isolate.breakpoints.length, equals(2));
}
@@ -73,8 +73,8 @@
expect(result is Breakpoint, isTrue);
Breakpoint bpt = result;
expect(bpt.type, equals('Breakpoint'));
- expect(bpt.location.script.id, equals(script.id));
- expect(bpt.location.script.tokenToLine(bpt.location.tokenPos),
+ expect(bpt.location!.script.id, equals(script.id));
+ expect(bpt.location!.script.tokenToLine(bpt.location!.tokenPos),
equals(LINE_C));
expect(isolate.breakpoints.length, equals(3));
}
diff --git a/runtime/observatory/tests/service/debugging_test.dart b/runtime/observatory/tests/service/debugging_test.dart
index 55a6e05..5d4b630 100644
--- a/runtime/observatory/tests/service/debugging_test.dart
+++ b/runtime/observatory/tests/service/debugging_test.dart
@@ -55,7 +55,7 @@
// Add breakpoint
(Isolate isolate) async {
- await isolate.rootLibrary.load();
+ await isolate.rootLibrary.load() as Library;
// Set up a listener to wait for breakpoint events.
Completer completer = new Completer();
@@ -77,8 +77,9 @@
expect(result is Breakpoint, isTrue);
Breakpoint bpt = result;
expect(bpt.type, equals('Breakpoint'));
- expect(bpt.location.script.id, equals(script.id));
- expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), equals(15));
+ expect(bpt.location!.script.id, equals(script.id));
+ expect(
+ bpt.location!.script.tokenToLine(bpt.location!.tokenPos), equals(15));
expect(isolate.breakpoints.length, equals(1));
await completer.future; // Wait for breakpoint events.
@@ -186,8 +187,9 @@
expect(result is Breakpoint, isTrue);
Breakpoint bpt = result;
expect(bpt.type, equals('Breakpoint'));
- expect(bpt.location.script.name, equals('debugging_test.dart'));
- expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), equals(12));
+ expect(bpt.location!.script.name, equals('debugging_test.dart'));
+ expect(
+ bpt.location!.script.tokenToLine(bpt.location!.tokenPos), equals(12));
expect(isolate.breakpoints.length, equals(1));
await completer.future; // Wait for breakpoint events.
diff --git a/runtime/observatory/tests/service/dev_fs_test.dart b/runtime/observatory/tests/service/dev_fs_test.dart
index cf4ca71..159c499 100644
--- a/runtime/observatory/tests/service/dev_fs_test.dart
+++ b/runtime/observatory/tests/service/dev_fs_test.dart
@@ -23,7 +23,7 @@
expect(result['type'], equals('FileSystemList'));
expect(result['fsNames'].toString(), equals('[alpha]'));
- bool caughtException;
+ bool caughtException = false;
try {
await vm.invokeRpcNoUpgrade('_createDevFS', params);
expect(false, isTrue, reason: 'Unreachable');
diff --git a/runtime/observatory/tests/service/developer_extension_test.dart b/runtime/observatory/tests/service/developer_extension_test.dart
index c5226de..9b18926 100644
--- a/runtime/observatory/tests/service/developer_extension_test.dart
+++ b/runtime/observatory/tests/service/developer_extension_test.dart
@@ -16,7 +16,7 @@
print('Invoked extension: $method');
switch (method) {
case 'ext..delay':
- Completer c = new Completer<ServiceExtensionResponse>();
+ var c = new Completer<ServiceExtensionResponse>();
new Timer(new Duration(seconds: 1), () {
c.complete(new ServiceExtensionResponse.result(jsonEncode({
'type': '_delayedType',
@@ -39,6 +39,7 @@
'parameters': paremeters,
})));
}
+ throw "Unknown extension: $method";
}
void test() {
@@ -74,7 +75,7 @@
expect(event.kind, equals(ServiceEvent.kExtension));
expect(event.extensionKind, equals('ALPHA'));
expect(event.extensionData, isA<Map>());
- expect(event.extensionData['cat'], equals('dog'));
+ expect(event.extensionData!['cat'], equals('dog'));
}),
hasStoppedAtBreakpoint,
resumeIsolateAndAwaitEvent(VM.kIsolateStream, (ServiceEvent event) {
diff --git a/runtime/observatory/tests/service/developer_server_control_test.dart b/runtime/observatory/tests/service/developer_server_control_test.dart
index 03aa74a..f599dc3 100644
--- a/runtime/observatory/tests/service/developer_server_control_test.dart
+++ b/runtime/observatory/tests/service/developer_server_control_test.dart
@@ -8,9 +8,9 @@
import 'package:observatory/service_io.dart' as S;
import 'test_helper.dart';
-int majorVersion;
-int minorVersion;
-Uri serverUri;
+int? majorVersion;
+int? minorVersion;
+Uri? serverUri;
Future<Null> testeeBefore() async {
print('testee before');
diff --git a/runtime/observatory/tests/service/developer_service_get_isolate_id_test.dart b/runtime/observatory/tests/service/developer_service_get_isolate_id_test.dart
index 1539e07..11b61da 100644
--- a/runtime/observatory/tests/service/developer_service_get_isolate_id_test.dart
+++ b/runtime/observatory/tests/service/developer_service_get_isolate_id_test.dart
@@ -12,9 +12,9 @@
import 'test_helper.dart';
// testee state.
-String selfId;
-Core.Isolate childIsolate;
-String childId;
+late String selfId;
+late Core.Isolate childIsolate;
+late String childId;
void spawnEntry(int i) {
dev.debugger();
@@ -26,8 +26,8 @@
childIsolate = await Core.Isolate.spawn(spawnEntry, 0);
// Assign the id for this isolate and it's child to strings so they can
// be read by the tester.
- selfId = dev.Service.getIsolateID(Core.Isolate.current);
- childId = dev.Service.getIsolateID(childIsolate);
+ selfId = dev.Service.getIsolateID(Core.Isolate.current)!;
+ childId = dev.Service.getIsolateID(childIsolate)!;
dev.debugger();
}
@@ -38,8 +38,8 @@
getChildId() => childId;
// tester state:
-Service.Isolate initialIsolate;
-Service.Isolate localChildIsolate;
+late Service.Isolate initialIsolate;
+late Service.Isolate localChildIsolate;
var tests = <VMTest>[
(Service.VM vm) async {
@@ -67,11 +67,12 @@
await initialIsolate.reload();
// Grab the root library.
- Service.Library rootLbirary = await initialIsolate.rootLibrary.load();
+ Service.Library rootLbirary =
+ await initialIsolate.rootLibrary.load() as Service.Library;
// Grab self id.
- Service.Instance localSelfId =
- await initialIsolate.invoke(rootLbirary, 'getSelfId');
+ Service.Instance localSelfId = await initialIsolate.invoke(
+ rootLbirary, 'getSelfId') as Service.Instance;
// Check that the id reported from dart:developer matches the id reported
// from the service protocol.
@@ -79,8 +80,8 @@
expect(initialIsolate.id, equals(localSelfId.valueAsString));
// Grab the child isolate's id.
- Service.Instance localChildId =
- await initialIsolate.invoke(rootLbirary, 'getChildId');
+ Service.Instance localChildId = await initialIsolate.invoke(
+ rootLbirary, 'getChildId') as Service.Instance;
// Check that the id reported from dart:developer matches the id reported
// from the service protocol.
diff --git a/runtime/observatory/tests/service/echo_test.dart b/runtime/observatory/tests/service/echo_test.dart
index 49ebe73..13c8130 100644
--- a/runtime/observatory/tests/service/echo_test.dart
+++ b/runtime/observatory/tests/service/echo_test.dart
@@ -24,10 +24,10 @@
var subscription;
subscription = stream.listen((ServiceEvent event) {
assert(event.kind == '_Echo');
- expect(event.data.lengthInBytes, equals(3));
- expect(event.data[0], equals(0));
- expect(event.data[1], equals(128));
- expect(event.data[2], equals(255));
+ expect(event.data!.lengthInBytes, equals(3));
+ expect(event.data![0], equals(0));
+ expect(event.data![1], equals(128));
+ expect(event.data![2], equals(255));
subscription.cancel();
completer.complete();
});
diff --git a/runtime/observatory/tests/service/enable_service_port_fallback_test.dart b/runtime/observatory/tests/service/enable_service_port_fallback_test.dart
index ea63b8b..ab8d23e 100644
--- a/runtime/observatory/tests/service/enable_service_port_fallback_test.dart
+++ b/runtime/observatory/tests/service/enable_service_port_fallback_test.dart
@@ -18,7 +18,7 @@
}
];
-ServerSocket socket;
+late ServerSocket socket;
int portNumber = -1;
main(args) async {
diff --git a/runtime/observatory/tests/service/eval_internal_class_test.dart b/runtime/observatory/tests/service/eval_internal_class_test.dart
index 98b5840..7c01361 100644
--- a/runtime/observatory/tests/service/eval_internal_class_test.dart
+++ b/runtime/observatory/tests/service/eval_internal_class_test.dart
@@ -8,9 +8,9 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- Library root = await isolate.rootLibrary.load();
+ Library root = await isolate.rootLibrary.load() as Library;
- Class classLibrary = await root.clazz.load();
+ Class classLibrary = await root.clazz!.load() as Class;
print(classLibrary);
{
bool caughtExceptions = false;
@@ -24,7 +24,7 @@
expect(caughtExceptions, isTrue);
}
- Class classClass = await classLibrary.clazz.load();
+ Class classClass = await classLibrary.clazz!.load() as Class;
print(classClass);
{
bool caughtExceptions = false;
@@ -38,10 +38,11 @@
expect(caughtExceptions, isTrue);
}
- Instance someArray = await root.evaluate("new List(2)");
+ Instance someArray =
+ await root.evaluate("new List<dynamic>.filled(2, null)") as Instance;
print(someArray);
expect(someArray is Instance, isTrue);
- Class classArray = await someArray.clazz.load();
+ Class classArray = await someArray.clazz!.load() as Class;
print(classArray);
dynamic result = await classArray.evaluate('3 + 4');
print(result);
diff --git a/runtime/observatory/tests/service/eval_regression_flutter20255_test.dart b/runtime/observatory/tests/service/eval_regression_flutter20255_test.dart
index 28f07d7..0762ae3 100644
--- a/runtime/observatory/tests/service/eval_regression_flutter20255_test.dart
+++ b/runtime/observatory/tests/service/eval_regression_flutter20255_test.dart
@@ -36,7 +36,7 @@
}
class Box<T> {
- T value;
+ late T value;
@pragma('vm:never-inline')
void setValue(T value) {
diff --git a/runtime/observatory/tests/service/evaluate_activation_in_method_class_test.dart b/runtime/observatory/tests/service/evaluate_activation_in_method_class_test.dart
index e1a78c4..621ebd2 100644
--- a/runtime/observatory/tests/service/evaluate_activation_in_method_class_test.dart
+++ b/runtime/observatory/tests/service/evaluate_activation_in_method_class_test.dart
@@ -41,42 +41,42 @@
Instance result;
- result = await isolate.evalFrame(topFrame, '_local');
+ result = await isolate.evalFrame(topFrame, '_local') as Instance;
print(result);
expect(result.valueAsString, equals('Klass'));
- result = await isolate.evalFrame(topFrame, '_instVar');
+ result = await isolate.evalFrame(topFrame, '_instVar') as Instance;
print(result);
expect(result.valueAsString, equals('Klass'));
- result = await isolate.evalFrame(topFrame, 'instVar');
+ result = await isolate.evalFrame(topFrame, 'instVar') as Instance;
print(result);
expect(result.valueAsString, equals('Subclass'));
- result = await isolate.evalFrame(topFrame, 'method()');
+ result = await isolate.evalFrame(topFrame, 'method()') as Instance;
print(result);
expect(result.valueAsString, equals('Subclass'));
- result = await isolate.evalFrame(topFrame, 'super._instVar');
+ result = await isolate.evalFrame(topFrame, 'super._instVar') as Instance;
print(result);
expect(result.valueAsString, equals('Superclass'));
- result = await isolate.evalFrame(topFrame, 'super.instVar');
+ result = await isolate.evalFrame(topFrame, 'super.instVar') as Instance;
print(result);
expect(result.valueAsString, equals('Superclass'));
- result = await isolate.evalFrame(topFrame, 'super.method()');
+ result = await isolate.evalFrame(topFrame, 'super.method()') as Instance;
print(result);
expect(result.valueAsString, equals('Superclass'));
- result = await isolate.evalFrame(topFrame, 'staticMethod()');
+ result = await isolate.evalFrame(topFrame, 'staticMethod()') as Instance;
print(result);
expect(result.valueAsString, equals('Klass'));
// function.Owner verus function.Origin
// The mixin of Superclass is in _other.dart and the mixin
// application is in _test.dart.
- result = await isolate.evalFrame(topFrame, 'topLevel');
+ result = await isolate.evalFrame(topFrame, 'topLevel') as Instance;
print(result);
expect(result.valueAsString, equals('OtherLibrary'));
}
diff --git a/runtime/observatory/tests/service/evaluate_activation_test.dart b/runtime/observatory/tests/service/evaluate_activation_test.dart
index 059d769..bf65d96 100644
--- a/runtime/observatory/tests/service/evaluate_activation_test.dart
+++ b/runtime/observatory/tests/service/evaluate_activation_test.dart
@@ -70,7 +70,7 @@
Future testMethod(Isolate isolate) async {
// silence analyzer.
expect(math.sqrt(4), equals(2));
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
ServiceFunction function =
rootLib.functions.singleWhere((f) => f.name == 'breakHere');
Breakpoint bpt = await isolate.addBreakpointAtEntry(function);
@@ -83,7 +83,7 @@
sub = stream.listen((ServiceEvent event) async {
print("Event $event");
if (event.kind == ServiceEvent.kPauseBreakpoint) {
- var frameNumber = 1, r;
+ dynamic frameNumber = 1, r;
r = await isolate.evalFrame(frameNumber, '123'); /// instance: ok
expect(r.valueAsString, equals('123')); /// instance: continued
r = await isolate.evalFrame(frameNumber, 'this'); /// scope: ok
@@ -119,7 +119,7 @@
}
Future testMethod2(Isolate isolate) async {
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
ServiceFunction function =
rootLib.functions.singleWhere((f) => f.name == 'breakHere');
Breakpoint bpt = await isolate.addBreakpointAtEntry(function);
@@ -132,7 +132,7 @@
sub = stream.listen((ServiceEvent event) async {
print("Event $event");
if (event.kind == ServiceEvent.kPauseBreakpoint) {
- var frameNumber = 1, r;
+ dynamic frameNumber = 1, r;
r = await isolate.evalFrame(frameNumber, '123');
expect(r.valueAsString, equals('123'));
r = await isolate.evalFrame(frameNumber, 'this');
@@ -168,7 +168,7 @@
}
Future testMethod3(Isolate isolate) async {
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
ServiceFunction function =
rootLib.functions.singleWhere((f) => f.name == 'breakHere');
Breakpoint bpt = await isolate.addBreakpointAtEntry(function);
@@ -181,7 +181,7 @@
sub = stream.listen((ServiceEvent event) async {
print("Event $event");
if (event.kind == ServiceEvent.kPauseBreakpoint) {
- var frameNumber = 1, r;
+ dynamic frameNumber = 1, r;
r = await isolate.evalFrame(frameNumber, '123');
expect(r.valueAsString, equals('123'));
r = await isolate.evalFrame(frameNumber, 'this');
@@ -210,7 +210,7 @@
Future testMethod4(Isolate isolate) async {
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
ServiceFunction function =
rootLib.functions.singleWhere((f) => f.name == 'breakHere');
Breakpoint bpt = await isolate.addBreakpointAtEntry(function);
@@ -223,7 +223,7 @@
sub = stream.listen((ServiceEvent event) async {
print("Event $event");
if (event.kind == ServiceEvent.kPauseBreakpoint) {
- var frameNumber = 1, r;
+ dynamic frameNumber = 1, r;
r = await isolate.evalFrame(frameNumber, '123'); /// instance: continued
expect(r.valueAsString, equals('123')); /// instance: continued
r = await isolate.evalFrame(frameNumber, 'this'); /// scope: continued
diff --git a/runtime/observatory/tests/service/evaluate_async_closure_test.dart b/runtime/observatory/tests/service/evaluate_async_closure_test.dart
index 4b64e63..182ee3d 100644
--- a/runtime/observatory/tests/service/evaluate_async_closure_test.dart
+++ b/runtime/observatory/tests/service/evaluate_async_closure_test.dart
@@ -18,7 +18,7 @@
" var w = () async { return await k(); }; "
" return w(); "
"}()";
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
var result = await lib.evaluate(test);
expect("$result", equals("Instance(a _Future)"));
diff --git a/runtime/observatory/tests/service/evaluate_class_type_parameters_test.dart b/runtime/observatory/tests/service/evaluate_class_type_parameters_test.dart
index 48b6530..38b34fc 100644
--- a/runtime/observatory/tests/service/evaluate_class_type_parameters_test.dart
+++ b/runtime/observatory/tests/service/evaluate_class_type_parameters_test.dart
@@ -35,7 +35,7 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 20);
- Instance result = await isolate.evalFrame(topFrame, '"\$S"');
+ Instance result = await isolate.evalFrame(topFrame, '"\$S"') as Instance;
print(result);
expect(result.valueAsString, equals("String"));
},
@@ -48,7 +48,7 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 14);
- Instance result = await isolate.evalFrame(topFrame, '"\$T"');
+ Instance result = await isolate.evalFrame(topFrame, '"\$T"') as Instance;
print(result);
expect(result.valueAsString, equals("int"));
},
diff --git a/runtime/observatory/tests/service/evaluate_function_type_parameters_test.dart b/runtime/observatory/tests/service/evaluate_function_type_parameters_test.dart
index 1f8fcd0..1eb0f4f 100644
--- a/runtime/observatory/tests/service/evaluate_function_type_parameters_test.dart
+++ b/runtime/observatory/tests/service/evaluate_function_type_parameters_test.dart
@@ -49,7 +49,8 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 14);
- Instance result = await isolate.evalFrame(topFrame, "S.toString()");
+ Instance result =
+ await isolate.evalFrame(topFrame, "S.toString()") as Instance;
print(result);
expect(result.valueAsString, equals("String"));
},
@@ -62,27 +63,30 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 16);
- Instance result = await isolate.evalFrame(topFrame, "TBool.toString()");
+ Instance result =
+ await isolate.evalFrame(topFrame, "TBool.toString()") as Instance;
print(result);
expect(result.valueAsString, equals("bool"));
- result = await isolate.evalFrame(topFrame, "TString.toString()");
+ result =
+ await isolate.evalFrame(topFrame, "TString.toString()") as Instance;
print(result);
expect(result.valueAsString, equals("String"));
- result = await isolate.evalFrame(topFrame, "TDouble.toString()");
+ result =
+ await isolate.evalFrame(topFrame, "TDouble.toString()") as Instance;
print(result);
expect(result.valueAsString, equals("double"));
- result = await isolate.evalFrame(topFrame, "TInt.toString()");
+ result = await isolate.evalFrame(topFrame, "TInt.toString()") as Instance;
print(result);
expect(result.valueAsString, equals("int"));
- result = await isolate.evalFrame(topFrame, "S.toString()");
+ result = await isolate.evalFrame(topFrame, "S.toString()") as Instance;
print(result);
expect(result.valueAsString, equals("String"));
- result = await isolate.evalFrame(topFrame, "x");
+ result = await isolate.evalFrame(topFrame, "x") as Instance;
print(result);
expect(result.valueAsString, equals("3"));
},
@@ -95,7 +99,8 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 22);
- Instance result = await isolate.evalFrame(topFrame, "S.toString()");
+ Instance result =
+ await isolate.evalFrame(topFrame, "S.toString()") as Instance;
print(result);
expect(result.valueAsString, equals("String"));
},
@@ -108,11 +113,12 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 30);
- Instance result = await isolate.evalFrame(topFrame, "T.toString()");
+ Instance result =
+ await isolate.evalFrame(topFrame, "T.toString()") as Instance;
print(result);
expect(result.valueAsString, equals("int"));
- result = await isolate.evalFrame(topFrame, "S.toString()");
+ result = await isolate.evalFrame(topFrame, "S.toString()") as Instance;
print(result);
expect(result.valueAsString, equals("bool"));
},
@@ -125,10 +131,11 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 34);
- Instance result = await isolate.evalFrame(topFrame, "T.toString()");
+ Instance result =
+ await isolate.evalFrame(topFrame, "T.toString()") as Instance;
print(result);
expect(result.valueAsString, equals("dynamic"));
- result = await isolate.evalFrame(topFrame, "t");
+ result = await isolate.evalFrame(topFrame, "t") as Instance;
print(result);
expect(result.valueAsString, equals("42"));
},
diff --git a/runtime/observatory/tests/service/evaluate_in_async_activation_test.dart b/runtime/observatory/tests/service/evaluate_in_async_activation_test.dart
index 6607b89..1c41188 100644
--- a/runtime/observatory/tests/service/evaluate_in_async_activation_test.dart
+++ b/runtime/observatory/tests/service/evaluate_in_async_activation_test.dart
@@ -27,7 +27,7 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 16);
- Instance result = await isolate.evalFrame(topFrame, "x");
+ Instance result = await isolate.evalFrame(topFrame, "x") as Instance;
print(result);
expect(result.valueAsString, equals("3"));
},
@@ -40,7 +40,7 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 18);
- Instance result = await isolate.evalFrame(topFrame, "z");
+ Instance result = await isolate.evalFrame(topFrame, "z") as Instance;
print(result);
expect(result.valueAsString, equals("7"));
},
diff --git a/runtime/observatory/tests/service/evaluate_in_async_star_activation_test.dart b/runtime/observatory/tests/service/evaluate_in_async_star_activation_test.dart
index 4d6771a..67b7fd1 100644
--- a/runtime/observatory/tests/service/evaluate_in_async_star_activation_test.dart
+++ b/runtime/observatory/tests/service/evaluate_in_async_star_activation_test.dart
@@ -31,7 +31,7 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 15);
- Instance result = await isolate.evalFrame(topFrame, "x");
+ Instance result = await isolate.evalFrame(topFrame, "x") as Instance;
print(result);
expect(result.valueAsString, equals("3"));
},
@@ -44,7 +44,7 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 18);
- Instance result = await isolate.evalFrame(topFrame, "z");
+ Instance result = await isolate.evalFrame(topFrame, "z") as Instance;
print(result);
expect(result.valueAsString, equals("7"));
},
diff --git a/runtime/observatory/tests/service/evaluate_in_frame_rpc_test.dart b/runtime/observatory/tests/service/evaluate_in_frame_rpc_test.dart
index 2e47197..97df789 100644
--- a/runtime/observatory/tests/service/evaluate_in_frame_rpc_test.dart
+++ b/runtime/observatory/tests/service/evaluate_in_frame_rpc_test.dart
@@ -26,17 +26,17 @@
// Evaluate against library, class, and instance.
(Isolate isolate) async {
- var result;
- result = await isolate.evalFrame(0, 'value');
+ Instance result;
+ result = await isolate.evalFrame(0, 'value') as Instance;
expect(result.valueAsString, equals('10000'));
- result = await isolate.evalFrame(0, '_');
+ result = await isolate.evalFrame(0, '_') as Instance;
expect(result.valueAsString, equals('50'));
- result = await isolate.evalFrame(0, 'value + _');
+ result = await isolate.evalFrame(0, 'value + _') as Instance;
expect(result.valueAsString, equals('10050'));
- result = await isolate.evalFrame(1, 'i');
+ result = await isolate.evalFrame(1, 'i') as Instance;
expect(result.valueAsString, equals('100000000'));
},
];
diff --git a/runtime/observatory/tests/service/evaluate_in_frame_with_scope_test.dart b/runtime/observatory/tests/service/evaluate_in_frame_with_scope_test.dart
index 8eb463a..7a216cb 100644
--- a/runtime/observatory/tests/service/evaluate_in_frame_with_scope_test.dart
+++ b/runtime/observatory/tests/service/evaluate_in_frame_with_scope_test.dart
@@ -34,14 +34,16 @@
expect(stack['frames'].length, greaterThanOrEqualTo(1));
expect(stack['frames'][0].function.name, equals('foo'));
- Library lib = await isolate.rootLibrary.load();
- Field thing1Field =
- await lib.variables.singleWhere((v) => v.name == "thing1").load();
- var thing1 = thing1Field.staticValue;
+ Library lib = await isolate.rootLibrary.load() as Library;
+ Field thing1Field = await lib.variables
+ .singleWhere((v) => v.name == "thing1")
+ .load() as Field;
+ var thing1 = thing1Field.staticValue!;
print(thing1);
- Field thing2Field =
- await lib.variables.singleWhere((v) => v.name == "thing2").load();
- var thing2 = thing2Field.staticValue;
+ Field thing2Field = await lib.variables
+ .singleWhere((v) => v.name == "thing2")
+ .load() as Field;
+ var thing2 = thing2Field.staticValue!;
print(thing2);
ServiceObject result = await isolate.evalFrame(0, "x + y + a + b",
diff --git a/runtime/observatory/tests/service/evaluate_in_sync_star_activation_test.dart b/runtime/observatory/tests/service/evaluate_in_sync_star_activation_test.dart
index bbaf78f..ade6955 100644
--- a/runtime/observatory/tests/service/evaluate_in_sync_star_activation_test.dart
+++ b/runtime/observatory/tests/service/evaluate_in_sync_star_activation_test.dart
@@ -31,7 +31,7 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 15);
- Instance result = await isolate.evalFrame(topFrame, "x");
+ Instance result = await isolate.evalFrame(topFrame, "x") as Instance;
print(result);
expect(result.valueAsString, equals("3"));
},
@@ -44,7 +44,7 @@
expect(stack.type, equals('Stack'));
expect(await stack['frames'][topFrame].location.getLine(), 18);
- Instance result = await isolate.evalFrame(topFrame, "z");
+ Instance result = await isolate.evalFrame(topFrame, "z") as Instance;
print(result);
expect(result.valueAsString, equals("7"));
},
diff --git a/runtime/observatory/tests/service/evaluate_with_escaping_closure_test.dart b/runtime/observatory/tests/service/evaluate_with_escaping_closure_test.dart
index 7849fc7..7320bfa 100644
--- a/runtime/observatory/tests/service/evaluate_with_escaping_closure_test.dart
+++ b/runtime/observatory/tests/service/evaluate_with_escaping_closure_test.dart
@@ -12,14 +12,15 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
- Instance result = await lib.evaluate("escapedClosure = (x, y) => x + y");
+ Instance result =
+ await lib.evaluate("escapedClosure = (x, y) => x + y") as Instance;
print(result);
- expect(result.clazz.name, startsWith('_Closure'));
+ expect(result.clazz!.name, startsWith('_Closure'));
for (var i = 0; i < 100; i++) {
- result = await lib.evaluate("escapedClosure(3, 4)");
+ result = await lib.evaluate("escapedClosure(3, 4)") as Instance;
print(result);
expect(result.valueAsString, equals('7'));
}
diff --git a/runtime/observatory/tests/service/evaluate_with_scope_test.dart b/runtime/observatory/tests/service/evaluate_with_scope_test.dart
index 90ea063..9cfbdd3 100644
--- a/runtime/observatory/tests/service/evaluate_with_scope_test.dart
+++ b/runtime/observatory/tests/service/evaluate_with_scope_test.dart
@@ -16,24 +16,26 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
- Field thing1Field =
- await lib.variables.singleWhere((v) => v.name == "thing1").load();
- var thing1 = thing1Field.staticValue;
+ Library lib = await isolate.rootLibrary.load() as Library;
+ Field thing1Field = await lib.variables
+ .singleWhere((v) => v.name == "thing1")
+ .load() as Field;
+ var thing1 = thing1Field.staticValue!;
print(thing1);
- Field thing2Field =
- await lib.variables.singleWhere((v) => v.name == "thing2").load();
- var thing2 = thing2Field.staticValue;
+ Field thing2Field = await lib.variables
+ .singleWhere((v) => v.name == "thing2")
+ .load() as Field;
+ var thing2 = thing2Field.staticValue!;
print(thing2);
Instance result = await lib.evaluate("x + y",
- scope: <String, ServiceObject>{"x": thing1, "y": thing2});
+ scope: <String, ServiceObject>{"x": thing1, "y": thing2}) as Instance;
expect(result.valueAsString, equals('7'));
bool didThrow = false;
try {
result = await lib.evaluate("x + y",
- scope: <String, ServiceObject>{"x": lib, "y": lib});
+ scope: <String, ServiceObject>{"x": lib, "y": lib}) as Instance;
print(result);
} catch (e) {
didThrow = true;
@@ -45,7 +47,8 @@
didThrow = false;
try {
result = await lib.evaluate("x + y",
- scope: <String, ServiceObject>{"not&an&identifier": thing1});
+ scope: <String, ServiceObject>{"not&an&identifier": thing1})
+ as Instance;
print(result);
} catch (e) {
didThrow = true;
diff --git a/runtime/observatory/tests/service/external_service_asynchronous_invocation_test.dart b/runtime/observatory/tests/service/external_service_asynchronous_invocation_test.dart
index 91f015d..d633c2b 100644
--- a/runtime/observatory/tests/service/external_service_asynchronous_invocation_test.dart
+++ b/runtime/observatory/tests/service/external_service_asynchronous_invocation_test.dart
@@ -11,7 +11,7 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- VM vm = isolate.owner;
+ VM vm = isolate.owner as VM;
final serviceEvents =
(await vm.getEventStream('Service')).asBroadcastStream();
@@ -23,7 +23,7 @@
// Avoid to manually encode and decode messages from the stream
Stream<String> stream = socket.stream.map(jsonEncode);
- stream.cast<Object>().pipe(_socket);
+ stream.cast<dynamic>().pipe(_socket);
dynamic _decoder(dynamic obj) {
return jsonDecode(obj);
}
diff --git a/runtime/observatory/tests/service/external_service_disappear_test.dart b/runtime/observatory/tests/service/external_service_disappear_test.dart
index fec1d31..1efa80e 100644
--- a/runtime/observatory/tests/service/external_service_disappear_test.dart
+++ b/runtime/observatory/tests/service/external_service_disappear_test.dart
@@ -11,7 +11,7 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- VM vm = isolate.owner;
+ VM vm = isolate.owner as VM;
final serviceEvents =
(await vm.getEventStream('Service')).asBroadcastStream();
@@ -23,7 +23,7 @@
// Avoid to manually encode and decode messages from the stream
Stream<String> stream = socket.stream.map(jsonEncode);
- stream.cast<Object>().pipe(_socket);
+ stream.cast<dynamic>().pipe(_socket);
dynamic _decoder(dynamic obj) {
return jsonDecode(obj);
}
diff --git a/runtime/observatory/tests/service/external_service_notification_invocation_test.dart b/runtime/observatory/tests/service/external_service_notification_invocation_test.dart
index 2a659a1..8984526 100644
--- a/runtime/observatory/tests/service/external_service_notification_invocation_test.dart
+++ b/runtime/observatory/tests/service/external_service_notification_invocation_test.dart
@@ -11,7 +11,7 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- VM vm = isolate.owner;
+ VM vm = isolate.owner as VM;
final serviceEvents =
(await vm.getEventStream('Service')).asBroadcastStream();
@@ -26,10 +26,10 @@
// Avoid to manually encode and decode messages from the stream
Stream<String> socket_stream = socket.stream.map(jsonEncode);
- socket_stream.cast<Object>().pipe(_socket);
+ socket_stream.cast<dynamic>().pipe(_socket);
Stream<String> socket_invoker_stream =
socket_invoker.stream.map(jsonEncode);
- socket_invoker_stream.cast<Object>().pipe(_socket_invoker);
+ socket_invoker_stream.cast<dynamic>().pipe(_socket_invoker);
dynamic _decoder(dynamic obj) {
return jsonDecode(obj);
}
diff --git a/runtime/observatory/tests/service/external_service_registration_test.dart b/runtime/observatory/tests/service/external_service_registration_test.dart
index 469facb..7936409 100644
--- a/runtime/observatory/tests/service/external_service_registration_test.dart
+++ b/runtime/observatory/tests/service/external_service_registration_test.dart
@@ -11,7 +11,7 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- VM vm = isolate.owner;
+ VM vm = isolate.owner as VM;
final serviceEvents =
(await vm.getEventStream('Service')).asBroadcastStream();
@@ -26,7 +26,7 @@
// Avoid to manually encode and decode messages from the stream
Stream<String> socket_stream = socket.stream.map(jsonEncode);
- socket_stream.cast<Object>().pipe(_socket);
+ socket_stream.cast<dynamic>().pipe(_socket);
dynamic _decoder(dynamic obj) {
return jsonDecode(obj);
}
diff --git a/runtime/observatory/tests/service/external_service_registration_via_notification_test.dart b/runtime/observatory/tests/service/external_service_registration_via_notification_test.dart
index 008c221..5b2ca8a 100644
--- a/runtime/observatory/tests/service/external_service_registration_via_notification_test.dart
+++ b/runtime/observatory/tests/service/external_service_registration_via_notification_test.dart
@@ -11,7 +11,7 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- VM vm = isolate.owner;
+ VM vm = isolate.owner as VM;
final serviceEvents =
(await vm.getEventStream('Service')).asBroadcastStream();
@@ -26,7 +26,7 @@
// Avoid to manually encode and decode messages from the stream
Stream<String> stream = socket.stream.map(jsonEncode);
- stream.cast<Object>().pipe(_socket);
+ stream.cast<dynamic>().pipe(_socket);
dynamic _decoder(dynamic obj) {
return jsonDecode(obj);
}
diff --git a/runtime/observatory/tests/service/external_service_synchronous_invocation_test.dart b/runtime/observatory/tests/service/external_service_synchronous_invocation_test.dart
index a7cee78..317408d 100644
--- a/runtime/observatory/tests/service/external_service_synchronous_invocation_test.dart
+++ b/runtime/observatory/tests/service/external_service_synchronous_invocation_test.dart
@@ -11,7 +11,7 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- VM vm = isolate.owner;
+ VM vm = isolate.owner as VM;
final serviceEvents =
(await vm.getEventStream('Service')).asBroadcastStream();
@@ -23,7 +23,7 @@
// Avoid to manually encode and decode messages from the stream
Stream<String> stream = socket.stream.map(jsonEncode);
- stream.cast<Object>().pipe(_socket);
+ stream.cast<dynamic>().pipe(_socket);
dynamic _decoder(dynamic obj) {
return jsonDecode(obj);
}
@@ -121,7 +121,7 @@
} on ServerRpcException catch (e) {
expect(e.code, equals(errorCode + iteration));
expect(e.data, isNotNull);
- expect(e.data[errorKey + end], equals(errorValue + end));
+ expect(e.data![errorKey + end], equals(errorValue + end));
}
}
},
diff --git a/runtime/observatory/tests/service/field_script_test.dart b/runtime/observatory/tests/service/field_script_test.dart
index 17be1b1..6e32b95 100644
--- a/runtime/observatory/tests/service/field_script_test.dart
+++ b/runtime/observatory/tests/service/field_script_test.dart
@@ -18,13 +18,13 @@
var tests = <IsolateTest>[
hasPausedAtStart,
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
var fields = lib.variables;
expect(fields.length, 2);
print(lib.variables);
for (Field f in fields) {
await f.load();
- String locationString = await f.location.toUserString();
+ String locationString = await f.location!.toUserString();
if (f.name == "tests") {
expect(locationString, "field_script_test.dart:18:5");
} else if (f.name == "otherField") {
diff --git a/runtime/observatory/tests/service/get_allocation_profile_public_rpc_test.dart b/runtime/observatory/tests/service/get_allocation_profile_public_rpc_test.dart
index 137d44a..2602c50 100644
--- a/runtime/observatory/tests/service/get_allocation_profile_public_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_allocation_profile_public_rpc_test.dart
@@ -99,14 +99,14 @@
var params = {
'reset': 'banana',
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('getAllocationProfile', params);
expect(false, isTrue, reason: 'Unreachable');
} on ServerRpcException catch (e) {
caughtException = true;
expect(e.code, equals(ServerRpcException.kInvalidParams));
- expect(e.data['details'],
+ expect(e.data!['details'],
"getAllocationProfile: invalid \'reset\' parameter: banana");
}
expect(caughtException, isTrue);
@@ -115,14 +115,14 @@
var params = {
'gc': 'banana',
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('getAllocationProfile', params);
expect(false, isTrue, reason: 'Unreachable');
} on ServerRpcException catch (e) {
caughtException = true;
expect(e.code, equals(ServerRpcException.kInvalidParams));
- expect(e.data['details'],
+ expect(e.data!['details'],
"getAllocationProfile: invalid \'gc\' parameter: banana");
}
expect(caughtException, isTrue);
diff --git a/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart b/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart
index 6021980..0dd0423 100644
--- a/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart
@@ -99,14 +99,14 @@
var params = {
'reset': 'banana',
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('_getAllocationProfile', params);
expect(false, isTrue, reason: 'Unreachable');
} on ServerRpcException catch (e) {
caughtException = true;
expect(e.code, equals(ServerRpcException.kInvalidParams));
- expect(e.data['details'],
+ expect(e.data!['details'],
"_getAllocationProfile: invalid \'reset\' parameter: banana");
}
expect(caughtException, isTrue);
@@ -115,14 +115,14 @@
var params = {
'gc': 'banana',
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('_getAllocationProfile', params);
expect(false, isTrue, reason: 'Unreachable');
} on ServerRpcException catch (e) {
caughtException = true;
expect(e.code, equals(ServerRpcException.kInvalidParams));
- expect(e.data['details'],
+ expect(e.data!['details'],
"_getAllocationProfile: invalid \'gc\' parameter: banana");
}
expect(caughtException, isTrue);
diff --git a/runtime/observatory/tests/service/get_allocation_samples_test.dart b/runtime/observatory/tests/service/get_allocation_samples_test.dart
index 2370433..4246154 100644
--- a/runtime/observatory/tests/service/get_allocation_samples_test.dart
+++ b/runtime/observatory/tests/service/get_allocation_samples_test.dart
@@ -32,7 +32,7 @@
// Initial.
(Isolate isolate) async {
// Verify initial state of 'Foo'.
- var fooClass = await getClassFromRootLib(isolate, 'Foo');
+ var fooClass = await getClassFromRootLib(isolate, 'Foo') as Class;
expect(fooClass, isNotNull);
expect(fooClass.name, equals('Foo'));
print(fooClass.id);
@@ -51,7 +51,7 @@
// Allocation profile.
(Isolate isolate) async {
- var fooClass = await getClassFromRootLib(isolate, 'Foo');
+ var fooClass = await getClassFromRootLib(isolate, 'Foo') as Class;
await fooClass.reload();
expect(fooClass.traceAllocations, isTrue);
dynamic profileResponse = await fooClass.getAllocationSamples();
@@ -65,7 +65,7 @@
cpuProfile.buildCodeCallerAndCallees();
cpuProfile.buildFunctionCallerAndCallees();
var tree = cpuProfile.loadCodeTree(M.ProfileTreeDirection.exclusive);
- var node = tree.root;
+ CodeCallTreeNode? node = tree.root;
var expected = [
'Root',
'DRT_AllocateObject',
@@ -75,7 +75,7 @@
'_Closure.call'
];
for (var i = 0; i < expected.length; i++) {
- expect(node.profileCode.code.name, equals(expected[i]));
+ expect(node!.profileCode.code.name, equals(expected[i]));
// Depth first traversal.
if (node.children.length == 0) {
node = null;
diff --git a/runtime/observatory/tests/service/get_client_name_rpc_test.dart b/runtime/observatory/tests/service/get_client_name_rpc_test.dart
index e9f6ae3..e66ac4a 100644
--- a/runtime/observatory/tests/service/get_client_name_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_client_name_rpc_test.dart
@@ -13,7 +13,7 @@
Future<String> getClientName(Isolate isolate) async {
final result = await isolate.vm.invokeRpcNoUpgrade('getClientName', {});
- return result['name'];
+ return result['name'] as String;
}
Future<void> setClientName(Isolate isolate, String name) async =>
diff --git a/runtime/observatory/tests/service/get_flag_list_rpc_test.dart b/runtime/observatory/tests/service/get_flag_list_rpc_test.dart
index f1c2c54..83f6f0c 100644
--- a/runtime/observatory/tests/service/get_flag_list_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_flag_list_rpc_test.dart
@@ -85,7 +85,7 @@
var subscription;
subscription = stream.listen((ServiceEvent event) {
if (event.kind == ServiceEvent.kVMFlagUpdate) {
- expect(event.owner.type, 'VM');
+ expect(event.owner!.type, 'VM');
expect(event.flag, kProfilePeriod);
expect(event.newValue, kValue.toString());
subscription.cancel();
diff --git a/runtime/observatory/tests/service/get_isolate_after_async_error_test.dart b/runtime/observatory/tests/service/get_isolate_after_async_error_test.dart
index 814cb7b..2272969 100644
--- a/runtime/observatory/tests/service/get_isolate_after_async_error_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_after_async_error_test.dart
@@ -16,7 +16,7 @@
(Isolate isolate) async {
await isolate.reload();
expect(isolate.error, isNotNull);
- expect(isolate.error.message.contains('oh no'), isTrue);
+ expect(isolate.error!.message!.contains('oh no'), isTrue);
}
];
diff --git a/runtime/observatory/tests/service/get_isolate_after_stack_overflow_error_test.dart b/runtime/observatory/tests/service/get_isolate_after_stack_overflow_error_test.dart
index ab1c05d..0b01599 100644
--- a/runtime/observatory/tests/service/get_isolate_after_stack_overflow_error_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_after_stack_overflow_error_test.dart
@@ -21,7 +21,7 @@
(Isolate isolate) async {
await isolate.reload();
expect(isolate.error, isNotNull);
- expect(isolate.error.message.contains('Stack Overflow'), isTrue);
+ expect(isolate.error!.message!.contains('Stack Overflow'), isTrue);
}
];
diff --git a/runtime/observatory/tests/service/get_isolate_after_sync_error_test.dart b/runtime/observatory/tests/service/get_isolate_after_sync_error_test.dart
index 8d0db3c..7165a8c 100644
--- a/runtime/observatory/tests/service/get_isolate_after_sync_error_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_after_sync_error_test.dart
@@ -16,7 +16,7 @@
(Isolate isolate) async {
await isolate.reload();
expect(isolate.error, isNotNull);
- expect(isolate.error.message.contains('oh no'), isTrue);
+ expect(isolate.error!.message!.contains('oh no'), isTrue);
}
];
diff --git a/runtime/observatory/tests/service/get_isolate_group_memory_usage.dart b/runtime/observatory/tests/service/get_isolate_group_memory_usage.dart
index 1bdb6bd..ebd2194 100644
--- a/runtime/observatory/tests/service/get_isolate_group_memory_usage.dart
+++ b/runtime/observatory/tests/service/get_isolate_group_memory_usage.dart
@@ -23,7 +23,7 @@
final params = {
'isolateGroupId': 'badid',
};
- bool caughtException;
+ bool caughtException = false;
try {
await vm.invokeRpcNoUpgrade('getIsolateGroupMemoryUsage', params);
expect(false, isTrue, reason: 'Unreachable');
diff --git a/runtime/observatory/tests/service/get_isolate_rpc_test.dart b/runtime/observatory/tests/service/get_isolate_rpc_test.dart
index 4e79317..14a1f09 100644
--- a/runtime/observatory/tests/service/get_isolate_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_rpc_test.dart
@@ -39,7 +39,7 @@
var params = {
'isolateId': 'badid',
};
- bool caughtException;
+ bool caughtException = false;
try {
await vm.invokeRpcNoUpgrade('getIsolate', params);
expect(false, isTrue, reason: 'Unreachable');
diff --git a/runtime/observatory/tests/service/get_memory_usage.dart b/runtime/observatory/tests/service/get_memory_usage.dart
index 19ce0d2..5b9a1c9 100644
--- a/runtime/observatory/tests/service/get_memory_usage.dart
+++ b/runtime/observatory/tests/service/get_memory_usage.dart
@@ -22,7 +22,7 @@
var params = {
'isolateId': 'badid',
};
- bool caughtException;
+ bool caughtException = false;
try {
await vm.invokeRpcNoUpgrade('getMemoryUsage', params);
expect(false, isTrue, reason: 'Unreachable');
diff --git a/runtime/observatory/tests/service/get_native_allocation_samples_test.dart b/runtime/observatory/tests/service/get_native_allocation_samples_test.dart
index 31f5325..ca41a91 100644
--- a/runtime/observatory/tests/service/get_native_allocation_samples_test.dart
+++ b/runtime/observatory/tests/service/get_native_allocation_samples_test.dart
@@ -25,8 +25,8 @@
int exclusiveAllocations = 0;
for (int i = 0; i < root.children.length; i++) {
- inclusiveAllocations += root.children[i].inclusiveNativeAllocations;
- exclusiveAllocations += root.children[i].exclusiveNativeAllocations;
+ inclusiveAllocations += root.children[i].inclusiveNativeAllocations as int;
+ exclusiveAllocations += root.children[i].exclusiveNativeAllocations as int;
}
int rootMemory;
@@ -57,7 +57,8 @@
// Verify inclusive tries.
(VM vm) async {
var response =
- await vm.invokeRpc('_getNativeAllocationSamples', {'_code': true});
+ await vm.invokeRpc('_getNativeAllocationSamples', {'_code': true})
+ as ServiceMap;
SampleProfile cpuProfile = new SampleProfile();
await cpuProfile.load(vm, response);
var codeTree = cpuProfile.loadCodeTree(M.ProfileTreeDirection.inclusive);
@@ -69,7 +70,8 @@
// Verify exclusive tries.
(VM vm) async {
var response =
- await vm.invokeRpc('_getNativeAllocationSamples', {'_code': true});
+ await vm.invokeRpc('_getNativeAllocationSamples', {'_code': true})
+ as ServiceMap;
SampleProfile cpuProfile = new SampleProfile();
await cpuProfile.load(vm, response);
var codeTreeExclusive =
diff --git a/runtime/observatory/tests/service/get_object_rpc_test.dart b/runtime/observatory/tests/service/get_object_rpc_test.dart
index e9e508b..9a3eab8 100644
--- a/runtime/observatory/tests/service/get_object_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_object_rpc_test.dart
@@ -13,7 +13,7 @@
class _DummyClass {
static var dummyVar = 11;
- final List<String> dummyList = new List<String>.filled(20, null);
+ final List<String> dummyList = new List<String>.filled(20, '');
void dummyFunction() {}
}
@@ -693,7 +693,7 @@
var params = {
'objectId': 'libraries/9999999',
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('getObject', params);
expect(false, isTrue, reason: 'Unreachable');
@@ -736,7 +736,7 @@
var params = {
'objectId': 'scripts/9999999',
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('getObject', params);
expect(false, isTrue, reason: 'Unreachable');
@@ -783,7 +783,7 @@
var params = {
'objectId': 'classes/9999999',
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('getObject', params);
expect(false, isTrue, reason: 'Unreachable');
@@ -823,7 +823,7 @@
var params = {
'objectId': id,
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('getObject', params);
expect(false, isTrue, reason: 'Unreachable');
@@ -868,7 +868,7 @@
var params = {
'objectId': id,
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('getObject', params);
expect(false, isTrue, reason: 'Unreachable');
@@ -944,7 +944,7 @@
var params = {
'objectId': id,
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('getObject', params);
expect(false, isTrue, reason: 'Unreachable');
@@ -990,7 +990,7 @@
var params = {
'objectId': 'code/0',
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('getObject', params);
expect(false, isTrue, reason: 'Unreachable');
diff --git a/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart b/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart
index d03bffb..05950a1 100644
--- a/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart
@@ -11,24 +11,24 @@
_TestClass();
// Make sure these fields are not removed by the tree shaker.
@pragma("vm:entry-point")
- var x;
+ dynamic x;
@pragma("vm:entry-point")
- var y;
+ dynamic y;
}
-var target1 = new _TestClass();
-var target2 = new _TestClass();
-var target3 = new _TestClass();
-var target4 = new _TestClass();
-var target5 = new _TestClass();
+dynamic target1 = new _TestClass();
+dynamic target2 = new _TestClass();
+dynamic target3 = new _TestClass();
+dynamic target4 = new _TestClass();
+dynamic target5 = new _TestClass();
@pragma("vm:entry-point") // Prevent obfuscation
-var globalObject = new _TestClass();
+dynamic globalObject = new _TestClass();
@pragma("vm:entry-point") // Prevent obfuscation
-var globalList = new List(100);
+dynamic globalList = new List<dynamic>.filled(100, null);
@pragma("vm:entry-point") // Prevent obfuscation
-var globalMap1 = new Map();
+dynamic globalMap1 = new Map();
@pragma("vm:entry-point") // Prevent obfuscation
-var globalMap2 = new Map();
+dynamic globalMap2 = new Map();
void warmup() {
globalObject.x = target1;
@@ -108,14 +108,14 @@
var params = {
'targetId': obj['id'],
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('getRetainingPath', params);
expect(false, isTrue, reason: 'Unreachable');
} on ServerRpcException catch (e) {
caughtException = true;
expect(e.code, equals(ServerRpcException.kInvalidParams));
- expect(e.data['details'],
+ expect(e.data!['details'],
"getRetainingPath expects the \'limit\' parameter");
}
expect(caughtException, isTrue);
diff --git a/runtime/observatory/tests/service/get_scripts_rpc_test.dart b/runtime/observatory/tests/service/get_scripts_rpc_test.dart
index 9331adb..c27358b 100644
--- a/runtime/observatory/tests/service/get_scripts_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_scripts_rpc_test.dart
@@ -22,7 +22,7 @@
var params = {
'isolateId': 'badid',
};
- bool caughtException;
+ bool caughtException = false;
try {
await vm.invokeRpcNoUpgrade('getScripts', params);
expect(false, isTrue, reason: 'Unreachable');
diff --git a/runtime/observatory/tests/service/get_source_report_with_mixin_test.dart b/runtime/observatory/tests/service/get_source_report_with_mixin_test.dart
index db85b1a..061d85f 100644
--- a/runtime/observatory/tests/service/get_source_report_with_mixin_test.dart
+++ b/runtime/observatory/tests/service/get_source_report_with_mixin_test.dart
@@ -34,7 +34,7 @@
expect(stack['frames'][0].function.name, equals('testFunction'));
final List<Script> scripts = await isolate.getScripts();
- Script foundScript;
+ Script? foundScript;
for (Script script in scripts) {
if (script.uri.contains(lib1Filename)) {
foundScript = script;
@@ -58,7 +58,7 @@
// Now get report for the lib1 only.
final Map<String, Object> params = {
'reports': ['Coverage'],
- 'scriptId': foundScript.id
+ 'scriptId': foundScript!.id!
};
final coverage =
await isolate.invokeRpcNoUpgrade('getSourceReport', params);
diff --git a/runtime/observatory/tests/service/get_stack_rpc_test.dart b/runtime/observatory/tests/service/get_stack_rpc_test.dart
index db1695f..1c7a6e2 100644
--- a/runtime/observatory/tests/service/get_stack_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_stack_rpc_test.dart
@@ -84,7 +84,7 @@
expect(msgHandlerObjectId, isNotNull);
// Get object.
- Instance object = await isolate.getObject(msgHandlerObjectId);
+ Instance object = await isolate.getObject(msgHandlerObjectId) as Instance;
expect(object.valueAsString, equals('34'));
}
];
diff --git a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
index 71a8b61a..269b771 100644
--- a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
@@ -43,7 +43,7 @@
return true;
}
-bool eventsContains(List events, String phase, String name, [Map arguments]) {
+bool eventsContains(List events, String phase, String name, [Map? arguments]) {
for (Map event in events) {
if ((event['ph'] == phase) && (event['name'] == name)) {
if (arguments == null) {
diff --git a/runtime/observatory/tests/service/http_get_isolate_group_rpc_common.dart b/runtime/observatory/tests/service/http_get_isolate_group_rpc_common.dart
index 47ae51c..8e1c598 100644
--- a/runtime/observatory/tests/service/http_get_isolate_group_rpc_common.dart
+++ b/runtime/observatory/tests/service/http_get_isolate_group_rpc_common.dart
@@ -26,9 +26,9 @@
.cast<List<int>>()
.transform(utf8.decoder)
.transform(json.decoder)
- .first;
+ .first as Map;
final result = response['result'];
- return result['isolateGroups'][0]['id'];
+ return result['isolateGroups'][0]['id'] as String;
}
Future<Null> testeeBefore() async {
@@ -41,17 +41,17 @@
// Build the request.
final params = <String, String>{
- 'isolateGroupId': await getIsolateGroupId(httpClient, info.serverUri),
+ 'isolateGroupId': await getIsolateGroupId(httpClient, info.serverUri!),
};
const method = 'getIsolateGroup';
- final pathSegments = <String>[]..addAll(info.serverUri.pathSegments);
+ final pathSegments = <String>[]..addAll(info.serverUri!.pathSegments);
if (pathSegments.isNotEmpty) {
pathSegments[pathSegments.length - 1] = method;
} else {
pathSegments.add(method);
}
- final requestUri = info.serverUri
+ final requestUri = info.serverUri!
.replace(pathSegments: pathSegments, queryParameters: params);
try {
@@ -61,7 +61,7 @@
.cast<List<int>>()
.transform(utf8.decoder)
.transform(json.decoder)
- .first;
+ .first as Map;
final result = jsonResponse['result'];
Expect.equals(result['type'], 'IsolateGroup');
Expect.isTrue(result['id'].startsWith('isolateGroups/'));
diff --git a/runtime/observatory/tests/service/http_get_isolate_rpc_common.dart b/runtime/observatory/tests/service/http_get_isolate_rpc_common.dart
index 6d487c2..3bbc12e 100644
--- a/runtime/observatory/tests/service/http_get_isolate_rpc_common.dart
+++ b/runtime/observatory/tests/service/http_get_isolate_rpc_common.dart
@@ -25,9 +25,9 @@
.cast<List<int>>()
.transform(utf8.decoder)
.transform(json.decoder)
- .first;
+ .first as Map;
Map result = response['result'];
- return result['isolates'][0]['id'];
+ return result['isolates'][0]['id'] as String;
}
Future<Null> testeeBefore() async {
@@ -40,17 +40,17 @@
// Build the request.
final params = <String, String>{
- 'isolateId': await getIsolateId(httpClient, info.serverUri),
+ 'isolateId': await getIsolateId(httpClient, info.serverUri!),
};
String method = 'getIsolate';
- final pathSegments = <String>[]..addAll(info.serverUri.pathSegments);
+ final pathSegments = <String>[]..addAll(info.serverUri!.pathSegments);
if (pathSegments.isNotEmpty) {
pathSegments[pathSegments.length - 1] = method;
} else {
pathSegments.add(method);
}
- final requestUri = info.serverUri
+ final requestUri = info.serverUri!
.replace(pathSegments: pathSegments, queryParameters: params);
try {
@@ -59,7 +59,7 @@
.cast<List<int>>()
.transform(utf8.decoder)
.transform(json.decoder)
- .first;
+ .first as Map;
Map result = response['result'];
Expect.equals(result['type'], 'Isolate');
Expect.isTrue(result['id'].startsWith('isolates/'));
diff --git a/runtime/observatory/tests/service/http_get_vm_rpc_common.dart b/runtime/observatory/tests/service/http_get_vm_rpc_common.dart
index b9b405e..481f567 100644
--- a/runtime/observatory/tests/service/http_get_vm_rpc_common.dart
+++ b/runtime/observatory/tests/service/http_get_vm_rpc_common.dart
@@ -19,14 +19,14 @@
var httpClient = new io.HttpClient();
// Build the request.
- final pathSegments = <String>[]..addAll(info.serverUri.pathSegments);
+ final pathSegments = <String>[]..addAll(info.serverUri!.pathSegments);
String method = 'getVM';
if (pathSegments.isNotEmpty) {
pathSegments[pathSegments.length - 1] = method;
} else {
pathSegments.add(method);
}
- final requestUri = info.serverUri.replace(pathSegments: pathSegments);
+ final requestUri = info.serverUri!.replace(pathSegments: pathSegments);
try {
var request = await httpClient.getUrl(requestUri);
@@ -34,7 +34,7 @@
.cast<List<int>>()
.transform(utf8.decoder)
.transform(json.decoder)
- .first;
+ .first as Map;
Map result = response['result'];
Expect.equals(result['type'], 'VM');
Expect.equals(result['name'], 'vm');
diff --git a/runtime/observatory/tests/service/implicit_getter_setter_test.dart b/runtime/observatory/tests/service/implicit_getter_setter_test.dart
index 30710d5..4b7f96f 100644
--- a/runtime/observatory/tests/service/implicit_getter_setter_test.dart
+++ b/runtime/observatory/tests/service/implicit_getter_setter_test.dart
@@ -20,12 +20,12 @@
}
Future testGetter(Isolate isolate) async {
- Library rootLibrary = await isolate.rootLibrary.load();
+ Library rootLibrary = await isolate.rootLibrary.load() as Library;
expect(rootLibrary.classes.length, equals(1));
- Class classA = await rootLibrary.classes[0].load();
+ Class classA = await rootLibrary.classes[0].load() as Class;
expect(classA.name, equals('A'));
// Find getter.
- ServiceFunction getterFunc;
+ ServiceFunction? getterFunc;
for (ServiceFunction function in classA.functions) {
if (function.name == 'field') {
getterFunc = function;
@@ -33,21 +33,21 @@
}
}
expect(getterFunc, isNotNull);
- await getterFunc.load();
- Field field = await getterFunc.field.load();
+ await getterFunc!.load();
+ Field field = await getterFunc.field!.load() as Field;
expect(field, isNotNull);
expect(field.name, equals('field'));
- Class classDouble = await field.guardClass.load();
+ Class classDouble = await field.guardClass!.load() as Class;
expect(classDouble.name, equals('_Double'));
}
Future testSetter(Isolate isolate) async {
- Library rootLibrary = await isolate.rootLibrary.load();
+ Library rootLibrary = await isolate.rootLibrary.load() as Library;
expect(rootLibrary.classes.length, equals(1));
- Class classA = await rootLibrary.classes[0].load();
+ Class classA = await rootLibrary.classes[0].load() as Class;
expect(classA.name, equals('A'));
// Find setter.
- ServiceFunction setterFunc;
+ ServiceFunction? setterFunc;
for (ServiceFunction function in classA.functions) {
if (function.name == 'field=') {
setterFunc = function;
@@ -55,11 +55,11 @@
}
}
expect(setterFunc, isNotNull);
- await setterFunc.load();
- Field field = await setterFunc.field.load();
+ await setterFunc!.load();
+ Field field = await setterFunc.field!.load() as Field;
expect(field, isNotNull);
expect(field.name, equals('field'));
- Class classDouble = await field.guardClass.load();
+ Class classDouble = await field.guardClass!.load() as Class;
expect(classDouble.name, equals('_Double'));
}
diff --git a/runtime/observatory/tests/service/inbound_references_test.dart b/runtime/observatory/tests/service/inbound_references_test.dart
index 5c10ae1..548aa7e 100644
--- a/runtime/observatory/tests/service/inbound_references_test.dart
+++ b/runtime/observatory/tests/service/inbound_references_test.dart
@@ -22,18 +22,19 @@
n = new Node();
e = new Edge();
n.edge = e;
- array = new List(2);
+ array = new List<dynamic>.filled(2, null);
array[0] = n;
array[1] = e;
}
var tests = <IsolateTest>[
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
Field field = lib.variables.where((v) => v.name == 'e').single;
await field.load();
- Instance e = field.staticValue;
- ServiceMap response = await isolate.getInboundReferences(e, 100);
+ Instance e = field.staticValue as Instance;
+ ServiceMap response =
+ await isolate.getInboundReferences(e, 100) as ServiceMap;
List references = response['references'];
hasReferenceSuchThat(predicate) {
expect(references.any(predicate), isTrue);
diff --git a/runtime/observatory/tests/service/invoke_test.dart b/runtime/observatory/tests/service/invoke_test.dart
index 4d198a7..d1c8466 100644
--- a/runtime/observatory/tests/service/invoke_test.dart
+++ b/runtime/observatory/tests/service/invoke_test.dart
@@ -51,13 +51,13 @@
Field field =
lib.variables.singleWhere((field) => field.name == "instance");
await field.load();
- Instance instance = field.staticValue;
+ Instance instance = field.staticValue as Instance;
field = lib.variables.singleWhere((field) => field.name == "apple");
await field.load();
- Instance apple = field.staticValue;
+ Instance apple = field.staticValue as Instance;
field = lib.variables.singleWhere((field) => field.name == "banana");
await field.load();
- Instance banana = field.staticValue;
+ Instance banana = field.staticValue as Instance;
dynamic result = await isolate.invokeRpc("invoke",
{"targetId": lib.id, "selector": "libraryFunction", "argumentIds": []});
diff --git a/runtime/observatory/tests/service/isolate_lifecycle_test.dart b/runtime/observatory/tests/service/isolate_lifecycle_test.dart
index a4a364b..8b452f1 100644
--- a/runtime/observatory/tests/service/isolate_lifecycle_test.dart
+++ b/runtime/observatory/tests/service/isolate_lifecycle_test.dart
@@ -110,7 +110,7 @@
var resumesIssued = 0;
var isolateList = vm.isolates.toList();
for (var isolate in isolateList) {
- if (isolate.name.endsWith('main')) {
+ if (isolate.name!.endsWith('main')) {
continue;
}
try {
diff --git a/runtime/observatory/tests/service/issue_25465_test.dart b/runtime/observatory/tests/service/issue_25465_test.dart
index 4b17e14..2375be6 100644
--- a/runtime/observatory/tests/service/issue_25465_test.dart
+++ b/runtime/observatory/tests/service/issue_25465_test.dart
@@ -28,8 +28,8 @@
var bpt1 = await isolate.addBreakpoint(script, LINE_A);
var bpt2 = await isolate.addBreakpoint(script, LINE_B);
- expect(await bpt1.location.getLine(), equals(LINE_A));
- expect(await bpt2.location.getLine(), equals(LINE_B));
+ expect(await bpt1.location!.getLine(), equals(LINE_A));
+ expect(await bpt2.location!.getLine(), equals(LINE_B));
var stream = await isolate.vm.getEventStream(VM.kDebugStream);
Completer completer = new Completer();
@@ -41,7 +41,7 @@
print('break count is $breakCount');
if (breakCount == 1) {
// We are stopped at breakpoint 1.
- expect(event.breakpoint.number, equals(bpt1.number));
+ expect(event.breakpoint!.number, equals(bpt1.number));
// Remove both breakpoints
var result = await isolate.removeBreakpoint(bpt1);
diff --git a/runtime/observatory/tests/service/issue_30555_test.dart b/runtime/observatory/tests/service/issue_30555_test.dart
index 22f6a2b..535e01b 100644
--- a/runtime/observatory/tests/service/issue_30555_test.dart
+++ b/runtime/observatory/tests/service/issue_30555_test.dart
@@ -38,36 +38,36 @@
var sub;
final Isolate firstIsolate = isolate;
print("First isolate is: ${firstIsolate.id}");
- Isolate secondIsolate;
+ Isolate? secondIsolate;
sub = await isolate.vm.listenEventStream(VM.kDebugStream, (ServiceEvent c) {
- print("Event ${c.kind} on ${c.isolate.id}");
+ print("Event ${c.kind} on ${c.isolate!.id}");
switch (step) {
case 0:
expect(c.kind, equals(ServiceEvent.kResume),
reason: "First isolate should resume");
- expect(c.isolate.id, equals(firstIsolate.id),
+ expect(c.isolate!.id, equals(firstIsolate.id),
reason: "First isolate should resume");
break;
case 1:
expect(c.kind, equals(ServiceEvent.kPauseStart),
reason: "Second isolate should pause on start");
- expect(c.isolate.id, equals(isolate.vm.isolates[1].id),
+ expect(c.isolate!.id, equals(isolate.vm.isolates[1].id),
reason: "Second isolate should pause on start");
- secondIsolate = c.isolate;
- print("Second isolate is: ${secondIsolate.id}");
+ secondIsolate = c.isolate!;
+ print("Second isolate is: ${secondIsolate!.id}");
print("Resuming second isolate");
- secondIsolate.resume();
+ secondIsolate!.resume();
break;
case 2:
expect(c.kind, equals(ServiceEvent.kResume),
reason: "Second isolate should resume");
- expect(c.isolate.id, equals(secondIsolate.id),
+ expect(c.isolate!.id, equals(secondIsolate!.id),
reason: "Second isolate should resume");
break;
case 3:
expect(c.kind, equals(ServiceEvent.kPauseBreakpoint),
reason: "First isolate should stop at debugger()");
- expect(c.isolate.id, equals(firstIsolate.id),
+ expect(c.isolate!.id, equals(firstIsolate.id),
reason: "First isolate should stop at debugger()");
print("Resuming first isolate");
firstIsolate.resume();
@@ -75,7 +75,7 @@
case 4:
expect(c.kind, equals(ServiceEvent.kResume),
reason: "First isolate should resume (1)");
- expect(c.isolate.id, equals(firstIsolate.id),
+ expect(c.isolate!.id, equals(firstIsolate.id),
reason: "First isolate should resume (1)");
break;
case 5:
@@ -86,18 +86,18 @@
expect(c.kind, equals(ServiceEvent.kPauseBreakpoint),
reason: "First & Second isolate should stop at debugger()");
print("Resuming second isolate");
- secondIsolate.resume();
+ secondIsolate!.resume();
break;
case 7:
expect(c.kind, equals(ServiceEvent.kResume),
reason: "Second isolate should resume before the exception");
- expect(c.isolate.id, equals(secondIsolate.id),
+ expect(c.isolate!.id, equals(secondIsolate!.id),
reason: "Second isolate should resume before the exception");
break;
case 8:
expect(c.kind, equals(ServiceEvent.kPauseExit),
reason: "Second isolate should exit at the exception");
- expect(c.isolate.id, equals(secondIsolate.id),
+ expect(c.isolate!.id, equals(secondIsolate!.id),
reason: "Second isolate should exit at the exception");
print("Resuming first isolate");
firstIsolate.resume();
@@ -105,11 +105,11 @@
case 9:
expect(c.kind, equals(ServiceEvent.kResume),
reason: "First isolate should resume after the exception");
- expect(c.isolate.id, equals(firstIsolate.id),
+ expect(c.isolate!.id, equals(firstIsolate.id),
reason: "First isolate should resume after the exception");
break;
case 10:
- expect(c.isolate.id, equals(firstIsolate.id),
+ expect(c.isolate!.id, equals(firstIsolate.id),
reason: "First "
"isolate should stop at debugger() after exception.\n"
"Probably the second resumed even though it was not expect "
diff --git a/runtime/observatory/tests/service/local_variable_declaration_test.dart b/runtime/observatory/tests/service/local_variable_declaration_test.dart
index f7e696a..162f311 100644
--- a/runtime/observatory/tests/service/local_variable_declaration_test.dart
+++ b/runtime/observatory/tests/service/local_variable_declaration_test.dart
@@ -9,12 +9,12 @@
import 'test_helper.dart';
import 'dart:developer';
-testParameters(int jjjj, int oooo, [int hhhh, int nnnn]) {
+testParameters(int jjjj, int oooo, [int? hhhh, int? nnnn]) {
debugger();
}
testMain() {
- int xxx, yyyy, zzzzz;
+ int? xxx, yyyy, zzzzz;
for (int i = 0; i < 1; i++) {
var foo = () {};
debugger();
@@ -38,7 +38,7 @@
// Grab the top frame.
Frame frame = stack['frames'][0];
// Grab the script.
- Script script = frame.location.script;
+ Script script = frame.location!.script;
await script.load();
// Ensure that the token at each declaration position is the name of the
@@ -46,7 +46,7 @@
for (var variable in frame.variables) {
final int declarationTokenPos = variable['declarationTokenPos'];
final String name = variable['name'];
- final String token = script.getToken(declarationTokenPos);
+ final String? token = script.getToken(declarationTokenPos);
// When running from an appjit snapshot, sources aren't available so the returned token will
// be null.
if (token != null) {
@@ -65,14 +65,14 @@
// Grab the top frame.
Frame frame = stack['frames'][0];
// Grab the script.
- Script script = frame.location.script;
+ Script script = frame.location!.script;
await script.load();
print(frame);
expect(frame.variables.length, greaterThanOrEqualTo(1));
for (var variable in frame.variables) {
final int declarationTokenPos = variable['declarationTokenPos'];
final String name = variable['name'];
- final String token = script.getToken(declarationTokenPos);
+ final String? token = script.getToken(declarationTokenPos);
// When running from an appjit snapshot, sources aren't available so the returned token will
// be null.
if (token != null) {
@@ -90,7 +90,7 @@
// Grab the top frame.
Frame frame = stack['frames'][0];
// Grab the script.
- Script script = frame.location.script;
+ Script script = frame.location!.script;
await script.load();
// Ensure that the token at each declaration position is the name of the
@@ -99,7 +99,7 @@
for (var variable in frame.variables) {
final int declarationTokenPos = variable['declarationTokenPos'];
final String name = variable['name'];
- final String token = script.getToken(declarationTokenPos);
+ final String? token = script.getToken(declarationTokenPos);
// When running from an appjit snapshot, sources aren't available so the returned token will
// be null.
if (token != null) {
diff --git a/runtime/observatory/tests/service/logging_test.dart b/runtime/observatory/tests/service/logging_test.dart
index 84fa6b1..ba585a8 100644
--- a/runtime/observatory/tests/service/logging_test.dart
+++ b/runtime/observatory/tests/service/logging_test.dart
@@ -34,18 +34,18 @@
hasStoppedAtBreakpoint,
resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) {
expect(event.kind, equals(ServiceEvent.kLogging));
- expect(event.logRecord['sequenceNumber'], equals(0));
- expect(event.logRecord['message'].valueAsString, equals('Hey Buddy!'));
- expect(event.logRecord['level'], equals(Level.FINE));
- expect(event.logRecord['time'], isA<DateTime>());
+ expect(event.logRecord!['sequenceNumber'], equals(0));
+ expect(event.logRecord!['message'].valueAsString, equals('Hey Buddy!'));
+ expect(event.logRecord!['level'], equals(Level.FINE));
+ expect(event.logRecord!['time'], isA<DateTime>());
}),
hasStoppedAtBreakpoint,
resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) {
expect(event.kind, equals(ServiceEvent.kLogging));
- expect(event.logRecord['sequenceNumber'], equals(1));
- expect(event.logRecord['level'], equals(Level.INFO));
- expect(event.logRecord['message'].valueAsString, equals('YES'));
- expect(event.logRecord['time'], isA<DateTime>());
+ expect(event.logRecord!['sequenceNumber'], equals(1));
+ expect(event.logRecord!['level'], equals(Level.INFO));
+ expect(event.logRecord!['message'].valueAsString, equals('YES'));
+ expect(event.logRecord!['time'], isA<DateTime>());
}),
];
diff --git a/runtime/observatory/tests/service/malformed_test.dart b/runtime/observatory/tests/service/malformed_test.dart
index 9e277c8..27b1456 100644
--- a/runtime/observatory/tests/service/malformed_test.dart
+++ b/runtime/observatory/tests/service/malformed_test.dart
@@ -8,7 +8,7 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpc('_respondWithMalformedObject', {});
expect(false, isTrue, reason: 'Unreachable');
@@ -21,7 +21,7 @@
// Do this test last... it kills the vm connection.
(Isolate isolate) async {
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpc('_respondWithMalformedJson', {});
expect(false, isTrue, reason: 'Unreachable');
diff --git a/runtime/observatory/tests/service/metrics_test.dart b/runtime/observatory/tests/service/metrics_test.dart
index b35806c..95c0e1f 100644
--- a/runtime/observatory/tests/service/metrics_test.dart
+++ b/runtime/observatory/tests/service/metrics_test.dart
@@ -25,12 +25,12 @@
(Isolate isolate) async {
var params = {'metricId': 'metrics/a.b.c'};
ServiceMetric counter =
- await isolate.invokeRpc('_getIsolateMetric', params);
+ await isolate.invokeRpc('_getIsolateMetric', params) as ServiceMetric;
expect(counter.name, equals('a.b.c'));
expect(counter.value, equals(1234.5));
},
(Isolate isolate) async {
- bool caughtException;
+ bool caughtException = false;
try {
await isolate
.invokeRpc('_getIsolateMetric', {'metricId': 'metrics/a.b.d'});
diff --git a/runtime/observatory/tests/service/mirror_references_test.dart b/runtime/observatory/tests/service/mirror_references_test.dart
index 1567d2d..9dc5fb7 100644
--- a/runtime/observatory/tests/service/mirror_references_test.dart
+++ b/runtime/observatory/tests/service/mirror_references_test.dart
@@ -11,14 +11,14 @@
class Foo {}
-Foo foo;
-var /*MirrorReference*/ ref;
+dynamic /*Foo*/ foo;
+dynamic /*MirrorReference*/ ref;
void script() {
foo = new Foo();
ClassMirror fooClassMirror = reflectClass(Foo);
InstanceMirror fooClassMirrorMirror = reflect(fooClassMirror);
- LibraryMirror libmirrors = fooClassMirrorMirror.type.owner;
+ LibraryMirror libmirrors = fooClassMirrorMirror.type.owner as LibraryMirror;
ref = reflect(fooClassMirror)
.getField(MirrorSystem.getSymbol('_reflectee', libmirrors))
.reflectee;
@@ -26,20 +26,20 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
Field fooField = lib.variables.singleWhere((v) => v.name == 'foo');
await fooField.load();
- Instance foo = fooField.staticValue;
+ Instance foo = fooField.staticValue as Instance;
Field refField = lib.variables.singleWhere((v) => v.name == 'ref');
await refField.load();
- Instance ref = refField.staticValue;
+ Instance ref = refField.staticValue as Instance;
expect(foo.isMirrorReference, isFalse);
expect(ref.isMirrorReference, isTrue);
expect(ref.referent, isNull);
- Instance loadedRef = await ref.load();
+ Instance loadedRef = await ref.load() as Instance;
expect(loadedRef.referent, isNotNull);
- expect(loadedRef.referent.name, equals('Foo'));
+ expect(loadedRef.referent!.name, equals('Foo'));
expect(loadedRef.referent, equals(foo.clazz));
},
];
diff --git a/runtime/observatory/tests/service/native_metrics_test.dart b/runtime/observatory/tests/service/native_metrics_test.dart
index 0cb1394..c200a4a 100644
--- a/runtime/observatory/tests/service/native_metrics_test.dart
+++ b/runtime/observatory/tests/service/native_metrics_test.dart
@@ -26,12 +26,12 @@
(Isolate isolate) async {
var params = {'metricId': 'metrics/native/heap.old.used'};
ServiceMetric counter =
- await isolate.invokeRpc('_getIsolateMetric', params);
+ await isolate.invokeRpc('_getIsolateMetric', params) as ServiceMetric;
expect(counter.type, equals('Counter'));
expect(counter.name, equals('heap.old.used'));
},
(Isolate isolate) async {
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpc(
'_getIsolateMetric', {'metricId': 'metrics/native/doesnotexist'});
diff --git a/runtime/observatory/tests/service/network_profiling_test.dart b/runtime/observatory/tests/service/network_profiling_test.dart
index 352d1b2..d68fbeb 100644
--- a/runtime/observatory/tests/service/network_profiling_test.dart
+++ b/runtime/observatory/tests/service/network_profiling_test.dart
@@ -32,14 +32,14 @@
var socket = await io.Socket.connect(localhost, serverSocket.port);
socket.write(content);
await socket.flush();
- await socket.destroy();
+ socket.destroy();
// rawDatagram
final doneCompleter = Completer<void>();
var server = await io.RawDatagramSocket.bind(localhost, 0);
server.listen((io.RawSocketEvent event) {
if (event == io.RawSocketEvent.read) {
- io.Datagram dg = server.receive();
+ io.Datagram dg = server.receive()!;
if (!doneCompleter.isCompleted) {
doneCompleter.complete();
}
@@ -56,11 +56,11 @@
postEvent('socketTest', {'socket': 'test'});
}
-Future<void> checkFinishEvent(ServiceEvent event) {
+void checkFinishEvent(ServiceEvent event) {
expect(event.kind, equals(ServiceEvent.kExtension));
expect(event.extensionKind, equals('socketTest'));
expect(event.extensionData, isA<Map>());
- expect(event.extensionData['socket'], equals('test'));
+ expect(event.extensionData!['socket'], equals('test'));
}
var tests = <IsolateTest>[
diff --git a/runtime/observatory/tests/service/next_through_assign_call_test.dart b/runtime/observatory/tests/service/next_through_assign_call_test.dart
index 3b815d2..439d2eb 100644
--- a/runtime/observatory/tests/service/next_through_assign_call_test.dart
+++ b/runtime/observatory/tests/service/next_through_assign_call_test.dart
@@ -9,16 +9,16 @@
const String file = "next_through_assign_call_test.dart";
code() {
- int a;
- int b;
+ int? a;
+ int? b;
a = b = foo();
print(a);
print(b);
a = foo();
print(a);
- int d = foo();
+ int? d = foo();
print(d);
- int e = foo(), f, g = foo();
+ int? e = foo(), f, g = foo();
print(e);
print(f);
print(g);
@@ -30,18 +30,18 @@
List<String> stops = [];
List<String> expected = [
- "$file:${LINE_A+0}:7", // on variable 'a'
- "$file:${LINE_A+1}:7", // on variable 'b'
+ "$file:${LINE_A+0}:8", // on variable 'a'
+ "$file:${LINE_A+1}:8", // on variable 'b'
"$file:${LINE_A+2}:11", // on call to 'foo'
"$file:${LINE_A+3}:3", // on call to 'print'
"$file:${LINE_A+4}:3", // on call to 'print'
"$file:${LINE_A+5}:7", // on call to 'foo'
"$file:${LINE_A+6}:3", // on call to 'print'
- "$file:${LINE_A+7}:11", // on call to 'foo'
+ "$file:${LINE_A+7}:12", // on call to 'foo'
"$file:${LINE_A+8}:3", // on call to 'print'
- "$file:${LINE_A+9}:11", // on first call to 'foo'
- "$file:${LINE_A+9}:18", // on variable 'f'
- "$file:${LINE_A+9}:25", // on second call to 'foo'
+ "$file:${LINE_A+9}:12", // on first call to 'foo'
+ "$file:${LINE_A+9}:19", // on variable 'f'
+ "$file:${LINE_A+9}:26", // on second call to 'foo'
"$file:${LINE_A+10}:3", // on call to 'print'
"$file:${LINE_A+11}:3", // on call to 'print'
"$file:${LINE_A+12}:3", // on call to 'print'
diff --git a/runtime/observatory/tests/service/next_through_assign_int_test.dart b/runtime/observatory/tests/service/next_through_assign_int_test.dart
index c57fd84..d5029e2 100644
--- a/runtime/observatory/tests/service/next_through_assign_int_test.dart
+++ b/runtime/observatory/tests/service/next_through_assign_int_test.dart
@@ -9,16 +9,16 @@
const String file = "next_through_assign_int_test.dart";
code() {
- int a;
- int b;
+ int? a;
+ int? b;
a = b = 42;
print(a);
print(b);
a = 42;
print(a);
- int d = 42;
+ int? d = 42;
print(d);
- int e = 41, f, g = 42;
+ int? e = 41, f, g = 42;
print(e);
print(f);
print(g);
@@ -26,18 +26,18 @@
List<String> stops = [];
List<String> expected = [
- "$file:${LINE_A+0}:7", // on variable 'a'
- "$file:${LINE_A+1}:7", // on variable 'b'
+ "$file:${LINE_A+0}:8", // on variable 'a'
+ "$file:${LINE_A+1}:8", // on variable 'b'
"$file:${LINE_A+2}:7", // on 'b'
"$file:${LINE_A+3}:3", // on call to 'print'
"$file:${LINE_A+4}:3", // on call to 'print'
"$file:${LINE_A+5}:3", // on 'a'
"$file:${LINE_A+6}:3", // on call to 'print'
- "$file:${LINE_A+7}:9", // on '='
+ "$file:${LINE_A+7}:10", // on '='
"$file:${LINE_A+8}:3", // on call to 'print'
- "$file:${LINE_A+9}:9", // on first '='
- "$file:${LINE_A+9}:15", // on 'f'
- "$file:${LINE_A+9}:20", // on second '='
+ "$file:${LINE_A+9}:10", // on first '='
+ "$file:${LINE_A+9}:16", // on 'f'
+ "$file:${LINE_A+9}:21", // on second '='
"$file:${LINE_A+10}:3", // on call to 'print'
"$file:${LINE_A+11}:3", // on call to 'print'
"$file:${LINE_A+12}:3", // on call to 'print'
diff --git a/runtime/observatory/tests/service/next_through_create_list_and_map_test.dart b/runtime/observatory/tests/service/next_through_create_list_and_map_test.dart
index 523ef13..5dddf49 100644
--- a/runtime/observatory/tests/service/next_through_create_list_and_map_test.dart
+++ b/runtime/observatory/tests/service/next_through_create_list_and_map_test.dart
@@ -37,7 +37,7 @@
};
print(myList);
print(myConstList);
- int lookup = myMap[1];
+ int lookup = myMap[1]!;
print(lookup);
print(myMap);
print(myConstMap);
diff --git a/runtime/observatory/tests/service/object_graph_vm_test.dart b/runtime/observatory/tests/service/object_graph_vm_test.dart
index 9414709..a4bf3fe 100644
--- a/runtime/observatory/tests/service/object_graph_vm_test.dart
+++ b/runtime/observatory/tests/service/object_graph_vm_test.dart
@@ -16,9 +16,9 @@
dynamic right;
}
-Foo r;
+late Foo r;
-List lst;
+late List lst;
void script() {
// Create 3 instances of Foo, with out-degrees
@@ -30,10 +30,10 @@
r.right = b;
a.left = b;
- lst = new List(2);
+ lst = new List<dynamic>.filled(2, null);
lst[0] = lst; // Self-loop.
// Larger than any other fixed-size list in a fresh heap.
- lst[1] = new List(1234569);
+ lst[1] = new List<dynamic>.filled(1234569, null);
}
var tests = <IsolateTest>[
diff --git a/runtime/observatory/tests/service/observatory_test_package/pubspec.yaml b/runtime/observatory/tests/service/observatory_test_package/pubspec.yaml
index db61a01f..20169fd 100644
--- a/runtime/observatory/tests/service/observatory_test_package/pubspec.yaml
+++ b/runtime/observatory/tests/service/observatory_test_package/pubspec.yaml
@@ -1,4 +1,4 @@
name: observatory_test_package
publish_to: none
environment:
- sdk: '^2.7.0'
+ sdk: '>=2.9.0 <3.0.0'
diff --git a/runtime/observatory/tests/service/parameters_in_scope_at_entry_test.dart b/runtime/observatory/tests/service/parameters_in_scope_at_entry_test.dart
index 03285f4..48cacd2 100644
--- a/runtime/observatory/tests/service/parameters_in_scope_at_entry_test.dart
+++ b/runtime/observatory/tests/service/parameters_in_scope_at_entry_test.dart
@@ -43,7 +43,7 @@
var stack = await isolate.getStack();
Frame top = stack['frames'][0];
print(top);
- expect(top.function.name, equals("foo"));
+ expect(top.function!.name, equals("foo"));
print(top.variables);
expect(top.variables.length, equals(1));
var param = top.variables[0];
@@ -59,7 +59,7 @@
var stack = await isolate.getStack();
Frame top = stack['frames'][0];
print(top);
- expect(top.function.name, equals("theClosureFunction"));
+ expect(top.function!.name, equals("theClosureFunction"));
print(top.variables);
expect(top.variables.length, equals(1));
var param = top.variables[0];
diff --git a/runtime/observatory/tests/service/pause_on_exceptions_test.dart b/runtime/observatory/tests/service/pause_on_exceptions_test.dart
index 05dae04..35bd59e 100644
--- a/runtime/observatory/tests/service/pause_on_exceptions_test.dart
+++ b/runtime/observatory/tests/service/pause_on_exceptions_test.dart
@@ -25,7 +25,7 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.reload();
+ Library lib = await isolate.rootLibrary.reload() as Library;
var onPaused = null;
var onResume = null;
diff --git a/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart b/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
index f1aff65..508d7a8 100644
--- a/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
+++ b/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
@@ -41,13 +41,13 @@
print('Done waiting for pause event.');
// Grab the timestamp.
- var pausetime1 = isolate.pauseEvent.timestamp;
+ var pausetime1 = isolate.pauseEvent!.timestamp;
expect(pausetime1, isNotNull);
// Reload the isolate.
await isolate.reload();
// Verify that it is the same.
expect(pausetime1.millisecondsSinceEpoch,
- equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
+ equals(isolate.pauseEvent!.timestamp.millisecondsSinceEpoch));
completer = new Completer();
stream = await isolate.vm.getEventStream(VM.kDebugStream);
@@ -66,13 +66,13 @@
await completer.future;
// Grab the timestamp.
- var pausetime2 = isolate.pauseEvent.timestamp;
+ var pausetime2 = isolate.pauseEvent!.timestamp;
expect(pausetime2, isNotNull);
// Reload the isolate.
await isolate.reload();
// Verify that it is the same.
expect(pausetime2.millisecondsSinceEpoch,
- equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
+ equals(isolate.pauseEvent!.timestamp.millisecondsSinceEpoch));
expect(pausetime2.millisecondsSinceEpoch,
greaterThan(pausetime1.millisecondsSinceEpoch));
},
diff --git a/runtime/observatory/tests/service/pause_on_start_then_step_test.dart b/runtime/observatory/tests/service/pause_on_start_then_step_test.dart
index 93cefb4..17707c6 100644
--- a/runtime/observatory/tests/service/pause_on_start_then_step_test.dart
+++ b/runtime/observatory/tests/service/pause_on_start_then_step_test.dart
@@ -41,13 +41,13 @@
print('Done waiting for pause event.');
// Grab the timestamp.
- var pausetime1 = isolate.pauseEvent.timestamp;
+ var pausetime1 = isolate.pauseEvent!.timestamp;
expect(pausetime1, isNotNull);
// Reload the isolate.
await isolate.reload();
// Verify that it is the same.
expect(pausetime1.millisecondsSinceEpoch,
- equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
+ equals(isolate.pauseEvent!.timestamp.millisecondsSinceEpoch));
completer = new Completer();
stream = await isolate.vm.getEventStream(VM.kDebugStream);
@@ -69,7 +69,7 @@
// Grab the timestamp.
print('Getting pausevent timestamp');
- var pausetime2 = isolate.pauseEvent.timestamp;
+ var pausetime2 = isolate.pauseEvent!.timestamp;
expect(pausetime2, isNotNull);
// Reload the isolate.
print('Reloading isolate');
@@ -77,7 +77,7 @@
print('Reload finished');
// Verify that it is the same.
expect(pausetime2.millisecondsSinceEpoch,
- equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
+ equals(isolate.pauseEvent!.timestamp.millisecondsSinceEpoch));
expect(pausetime2.millisecondsSinceEpoch,
greaterThan(pausetime1.millisecondsSinceEpoch));
diff --git a/runtime/observatory/tests/service/process_service_test.dart b/runtime/observatory/tests/service/process_service_test.dart
index 8840ef1..c9f2a85 100644
--- a/runtime/observatory/tests/service/process_service_test.dart
+++ b/runtime/observatory/tests/service/process_service_test.dart
@@ -24,19 +24,19 @@
'--pause_isolates_on_start',
io.Platform.script.toFilePath(),
];
- io.Process process1;
- io.Process process2;
- io.Process process3;
+ io.Process? process1;
+ io.Process? process2;
+ io.Process? process3;
void closeDown() {
if (process1 != null) {
- process1.kill();
+ process1!.kill();
}
if (process2 != null) {
- process2.kill();
+ process2!.kill();
}
if (process3 != null) {
- process3.kill();
+ process3!.kill();
}
dir.deleteSync(recursive: true);
}
@@ -70,14 +70,14 @@
final result = jsonEncode({
'type': 'foobar',
- 'pids': [process1.pid, process2.pid, process3.pid]
+ 'pids': [process1!.pid, process2!.pid, process3!.pid]
});
return Future.value(ServiceExtensionResponse.result(result));
}
Future<ServiceExtensionResponse> closeStdin(ignored_a, ignored_b) {
- process3.stdin.close();
- return process3.exitCode.then<ServiceExtensionResponse>((int exit) {
+ process3!.stdin.close();
+ return process3!.exitCode.then<ServiceExtensionResponse>((int exit) {
final result = jsonEncode({'type': 'foobar'});
return ServiceExtensionResponse.result(result);
});
diff --git a/runtime/observatory/tests/service/reachable_size_test.dart b/runtime/observatory/tests/service/reachable_size_test.dart
index bca88d8..8cf9f9e 100644
--- a/runtime/observatory/tests/service/reachable_size_test.dart
+++ b/runtime/observatory/tests/service/reachable_size_test.dart
@@ -11,34 +11,34 @@
class Pair {
// Make sure these fields are not removed by the tree shaker.
@pragma("vm:entry-point")
- var x;
+ dynamic x;
@pragma("vm:entry-point")
- var y;
+ dynamic y;
}
-var p1;
-var p2;
+dynamic p1;
+dynamic p2;
buildGraph() {
p1 = new Pair();
p2 = new Pair();
// Adds to both reachable and retained size.
- p1.x = new List();
- p2.x = new List();
+ p1.x = <dynamic>[];
+ p2.x = <dynamic>[];
// Adds to reachable size only.
- p1.y = p2.y = new List();
+ p1.y = p2.y = <dynamic>[];
}
Future<int> getReachableSize(ServiceObject obj) async {
- Instance size = await obj.isolate.getReachableSize(obj);
- return int.parse(size.valueAsString);
+ Instance size = await obj.isolate!.getReachableSize(obj) as Instance;
+ return int.parse(size.valueAsString!);
}
Future<int> getRetainedSize(ServiceObject obj) async {
- Instance size = await obj.isolate.getRetainedSize(obj);
- return int.parse(size.valueAsString);
+ Instance size = await obj.isolate!.getRetainedSize(obj) as Instance;
+ return int.parse(size.valueAsString!);
}
var tests = <IsolateTest>[
@@ -49,7 +49,7 @@
// In general, shallow <= retained <= reachable. In this program,
// 0 < shallow < retained < reachable.
- int p1_shallow = p1.size;
+ int p1_shallow = p1.size!;
int p1_retained = await getRetainedSize(p1);
int p1_reachable = await getReachableSize(p1);
@@ -57,7 +57,7 @@
expect(p1_shallow, lessThan(p1_retained));
expect(p1_retained, lessThan(p1_reachable));
- int p2_shallow = p2.size;
+ int p2_shallow = p2.size!;
int p2_retained = await getRetainedSize(p2);
int p2_reachable = await getReachableSize(p2);
diff --git a/runtime/observatory/tests/service/regexp_function_test.dart b/runtime/observatory/tests/service/regexp_function_test.dart
index d11abe0..bf2e5be 100644
--- a/runtime/observatory/tests/service/regexp_function_test.dart
+++ b/runtime/observatory/tests/service/regexp_function_test.dart
@@ -34,26 +34,26 @@
Field field = lib.variables.singleWhere((v) => v.name == 'regex');
await field.load();
- Instance regex = field.staticValue;
+ Instance regex = field.staticValue as Instance;
expect(regex.isInstance, isTrue);
expect(regex.isRegExp, isTrue);
await regex.load();
if (regex.oneByteFunction == null) {
// Running with interpreted regexp.
- var b1 = await regex.oneByteBytecode.load();
+ var b1 = await regex.oneByteBytecode!.load();
expect(b1.isTypedData, isTrue);
- var b2 = await regex.twoByteBytecode.load();
+ var b2 = await regex.twoByteBytecode!.load();
expect(b2.isTypedData, isFalse); // No two-byte string subject was used.
} else {
// Running with compiled regexp.
- var f1 = await regex.oneByteFunction.load();
+ var f1 = await regex.oneByteFunction!.load();
expect(f1 is ServiceFunction, isTrue);
- var f2 = await regex.twoByteFunction.load();
+ var f2 = await regex.twoByteFunction!.load();
expect(f2 is ServiceFunction, isTrue);
- var f3 = await regex.externalOneByteFunction.load();
+ var f3 = await regex.externalOneByteFunction!.load();
expect(f3 is ServiceFunction, isTrue);
- var f4 = await regex.externalTwoByteFunction.load();
+ var f4 = await regex.externalTwoByteFunction!.load();
expect(f4 is ServiceFunction, isTrue);
}
}
diff --git a/runtime/observatory/tests/service/regress_34841_test.dart b/runtime/observatory/tests/service/regress_34841_test.dart
index 05bb56a..6a7310e 100644
--- a/runtime/observatory/tests/service/regress_34841_test.dart
+++ b/runtime/observatory/tests/service/regress_34841_test.dart
@@ -57,8 +57,8 @@
// Make sure we can translate it all.
for (int place in coveragePlaces) {
- int line = script.tokenToLine(place);
- int column = script.tokenToCol(place);
+ int? line = script.tokenToLine(place);
+ int? column = script.tokenToCol(place);
if (line == null || column == null) {
throw "Token $place translated to $line:$column";
}
diff --git a/runtime/observatory/tests/service/rewind_optimized_out_test.dart b/runtime/observatory/tests/service/rewind_optimized_out_test.dart
index 97aca1c..21cf92a 100644
--- a/runtime/observatory/tests/service/rewind_optimized_out_test.dart
+++ b/runtime/observatory/tests/service/rewind_optimized_out_test.dart
@@ -16,7 +16,7 @@
int global = 0;
@pragma('vm:never-inline')
-b3(x) {
+b3(int x) {
int sum = 0;
try {
for (int i = 0; i < x; i++) {
@@ -49,13 +49,13 @@
stoppedAtLine(LINE_A),
(Isolate isolate) async {
// We are at our breakpoint with global=100.
- Instance result = await isolate.rootLibrary.evaluate('global');
+ Instance result = await isolate.rootLibrary.evaluate('global') as Instance;
print('global is $result');
expect(result.type, equals('Instance'));
expect(result.valueAsString, equals('100'));
// Rewind the top stack frame.
- bool caughtException;
+ bool caughtException = false;
try {
result = await isolate.rewind(1);
expect(false, isTrue, reason: 'Unreachable');
diff --git a/runtime/observatory/tests/service/rewind_test.dart b/runtime/observatory/tests/service/rewind_test.dart
index 87e46ec..5ec932d 100644
--- a/runtime/observatory/tests/service/rewind_test.dart
+++ b/runtime/observatory/tests/service/rewind_test.dart
@@ -16,7 +16,7 @@
int global = 0;
@pragma('vm:never-inline')
-b3(x) {
+b3(int x) {
int sum = 0;
try {
for (int i = 0; i < x; i++) {
@@ -49,7 +49,7 @@
stoppedAtLine(LINE_A),
(Isolate isolate) async {
// We are not able to rewind frame 0.
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.rewind(0);
expect(false, isTrue, reason: 'Unreachable');
@@ -62,7 +62,7 @@
},
(Isolate isolate) async {
// We are not able to rewind frame 13.
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.rewind(13);
expect(false, isTrue, reason: 'Unreachable');
@@ -75,7 +75,7 @@
},
(Isolate isolate) async {
// We are at our breakpoint with global=100.
- Instance result = await isolate.rootLibrary.evaluate('global');
+ Instance result = await isolate.rootLibrary.evaluate('global') as Instance;
print('global is $result');
expect(result.type, equals('Instance'));
expect(result.valueAsString, equals('100'));
@@ -94,7 +94,7 @@
stoppedAtLine(LINE_A),
(Isolate isolate) async {
// global still is equal to 100. We did not execute "global++".
- Instance result = await isolate.rootLibrary.evaluate('global');
+ Instance result = await isolate.rootLibrary.evaluate('global') as Instance;
print('global is $result');
expect(result.type, equals('Instance'));
expect(result.valueAsString, equals('100'));
@@ -107,7 +107,8 @@
stoppedAtLine(LINE_D),
(Isolate isolate) async {
// Reset global to 0 and start again.
- Instance result = await isolate.rootLibrary.evaluate('global=0');
+ Instance result =
+ await isolate.rootLibrary.evaluate('global=0') as Instance;
print('set global to $result');
expect(result.type, equals('Instance'));
expect(result.valueAsString, equals('0'));
@@ -119,7 +120,7 @@
stoppedAtLine(LINE_A),
(Isolate isolate) async {
// We are at our breakpoint with global=100.
- Instance result = await isolate.rootLibrary.evaluate('global');
+ Instance result = await isolate.rootLibrary.evaluate('global') as Instance;
print('global is $result');
expect(result.type, equals('Instance'));
expect(result.valueAsString, equals('100'));
diff --git a/runtime/observatory/tests/service/service_test_common.dart b/runtime/observatory/tests/service/service_test_common.dart
index 4c4a087..e127bde 100644
--- a/runtime/observatory/tests/service/service_test_common.dart
+++ b/runtime/observatory/tests/service/service_test_common.dart
@@ -29,7 +29,7 @@
}
Future cancelStreamSubscription(String streamName) async {
- StreamSubscription subscription = streamSubscriptions[streamName];
+ StreamSubscription subscription = streamSubscriptions[streamName]!;
subscription.cancel();
streamSubscriptions.remove(streamName);
}
@@ -73,12 +73,12 @@
Future asyncStepOver(Isolate isolate) async {
final Completer pausedAtSyntheticBreakpoint = new Completer();
- StreamSubscription subscription;
+ StreamSubscription? subscription;
// Cancel the subscription.
cancelSubscription() {
if (subscription != null) {
- subscription.cancel();
+ subscription!.cancel();
subscription = null;
}
}
@@ -99,13 +99,13 @@
return pausedAtSyntheticBreakpoint.future;
}
- Breakpoint syntheticBreakpoint;
+ Breakpoint? syntheticBreakpoint;
subscription = stream.listen((ServiceEvent event) async {
// Synthetic breakpoint add event. This is the first event we will
// receive.
bool isAdd = (event.kind == ServiceEvent.kBreakpointAdded) &&
- (event.breakpoint.isSyntheticAsyncContinuation) &&
+ (event.breakpoint!.isSyntheticAsyncContinuation!) &&
(event.owner == isolate);
// Resume after synthetic breakpoint added. This is the second event
// we will receive.
@@ -140,7 +140,7 @@
return pausedAtSyntheticBreakpoint.future;
}
-bool isEventOfKind(M.Event event, String kind) {
+bool isEventOfKind(M.Event? event, String kind) {
switch (kind) {
case ServiceEvent.kPauseBreakpoint:
return event is M.PauseBreakpointEvent;
@@ -159,7 +159,7 @@
Future hasPausedFor(Isolate isolate, String kind) {
// Set up a listener to wait for breakpoint events.
- Completer completer = new Completer();
+ Completer? completer = new Completer();
isolate.vm.getEventStream(VM.kDebugStream).then((stream) {
var subscription;
subscription = stream.listen((ServiceEvent event) {
@@ -168,7 +168,7 @@
// Reload to update isolate.pauseEvent.
print('Paused with $kind');
subscription.cancel();
- completer.complete(isolate.reload());
+ completer!.complete(isolate.reload());
completer = null;
}
}
@@ -177,19 +177,19 @@
// Pause may have happened before we subscribed.
isolate.reload().then((_) {
if ((isolate.pauseEvent != null) &&
- isEventOfKind(isolate.pauseEvent, kind)) {
+ isEventOfKind(isolate.pauseEvent!, kind)) {
// Already waiting at a breakpoint.
if (completer != null) {
print('Paused with $kind');
subscription.cancel();
- completer.complete(isolate);
+ completer!.complete(isolate);
completer = null;
}
}
});
});
- return completer.future; // Will complete when breakpoint hit.
+ return completer!.future; // Will complete when breakpoint hit.
}
Future hasStoppedAtBreakpoint(Isolate isolate) {
@@ -216,13 +216,12 @@
await isolate.reload();
for (Library lib in isolate.libraries) {
await lib.load();
- if (lib.uri.startsWith('dart:') && !lib.uri.startsWith('dart:_')) {
+ if (lib.uri!.startsWith('dart:') && !lib.uri!.startsWith('dart:_')) {
var setDebugParams = {
'libraryId': lib.id,
'isDebuggable': true,
};
- Map<String, dynamic> result = await isolate.invokeRpcNoUpgrade(
- 'setLibraryDebuggable', setDebugParams);
+ await isolate.invokeRpcNoUpgrade('setLibraryDebuggable', setDebugParams);
}
}
return isolate;
@@ -242,7 +241,7 @@
IsolateTest setBreakpointAtLine(int line) {
return (Isolate isolate) async {
print("Setting breakpoint for line $line");
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
Script script = lib.scripts.firstWhere((s) => s.uri == lib.uri);
Breakpoint bpt = await isolate.addBreakpoint(script, line);
@@ -255,7 +254,7 @@
IsolateTest setBreakpointAtLineColumn(int line, int column) {
return (Isolate isolate) async {
print("Setting breakpoint for line $line column $column");
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
Script script = lib.scripts.firstWhere((s) => s.uri == lib.uri);
Breakpoint bpt = await isolate.addBreakpoint(script, line, column);
@@ -290,14 +289,14 @@
expect(frames.length, greaterThanOrEqualTo(1));
Frame top = frames[0];
- Script script = await top.location.script.load();
- int actualLine = script.tokenToLine(top.location.tokenPos);
+ Script script = await top.location!.script.load() as Script;
+ int? actualLine = script.tokenToLine(top.location!.tokenPos);
if (actualLine != line) {
StringBuffer sb = new StringBuffer();
sb.write("Expected to be at line $line but actually at line $actualLine");
sb.write("\nFull stack trace:\n");
for (Frame f in stack['frames']) {
- sb.write(" $f [${await f.location.getLine()}]\n");
+ sb.write(" $f [${await f.location!.getLine()}]\n");
}
throw sb.toString();
} else {
@@ -318,11 +317,12 @@
expect(frames.length, greaterThanOrEqualTo(1));
Frame topFrame = frames[0];
- ServiceFunction function = await topFrame.function.load();
- String name = function.name;
+ ServiceFunction function =
+ await topFrame.function!.load() as ServiceFunction;
+ String name = function.name!;
if (includeOwner) {
ServiceFunction owner =
- await (function.dartOwner as ServiceObject).load();
+ await (function.dartOwner as ServiceObject).load() as ServiceFunction;
name = '${owner.name}.$name';
}
final bool matches =
@@ -333,10 +333,10 @@
"actually in function $name");
sb.write("\nFull stack trace:\n");
for (Frame f in frames) {
- await f.function.load();
- await (f.function.dartOwner as ServiceObject).load();
- String name = f.function.name;
- String ownerName = (f.function.dartOwner as ServiceObject).name;
+ await f.function!.load();
+ await (f.function!.dartOwner as ServiceObject).load();
+ String name = f.function!.name!;
+ String ownerName = (f.function!.dartOwner as ServiceObject).name!;
sb.write(" $f [$name] [$ownerName]\n");
}
throw sb.toString();
@@ -436,8 +436,8 @@
expect(isolate.running, true);
}
-Future<Class> getClassFromRootLib(Isolate isolate, String className) async {
- Library rootLib = await isolate.rootLibrary.load();
+Future<Class?> getClassFromRootLib(Isolate isolate, String className) async {
+ Library rootLib = await isolate.rootLibrary.load() as Library;
for (Class cls in rootLib.classes) {
if (cls.name == className) {
return cls;
@@ -448,10 +448,10 @@
Future<Instance> rootLibraryFieldValue(
Isolate isolate, String fieldName) async {
- Library rootLib = await isolate.rootLibrary.load();
+ Library rootLib = await isolate.rootLibrary.load() as Library;
Field field = rootLib.variables.singleWhere((v) => v.name == fieldName);
await field.load();
- Instance value = field.staticValue;
+ Instance value = field.staticValue as Instance;
await value.load();
return value;
}
@@ -465,9 +465,9 @@
if (event.kind == ServiceEvent.kPauseBreakpoint) {
await isolate.reload();
// We are paused: Step further.
- Frame frame = isolate.topFrame;
- recordStops.add(await frame.location.toUserString());
- if (event.atAsyncSuspension) {
+ Frame frame = isolate.topFrame!;
+ recordStops.add(await frame.location!.toUserString());
+ if (event.atAsyncSuspension!) {
isolate.stepOverAsyncSuspension();
} else {
isolate.stepOver();
@@ -498,10 +498,10 @@
List frames = stack['frames'];
expect(frames.length, greaterThanOrEqualTo(2));
Frame frame = frames[0];
- String brokeAt = await frame.location.toUserString();
+ String brokeAt = await frame.location!.toUserString();
if (includeCaller) {
frame = frames[1];
- String calledFrom = await frame.location.toUserString();
+ String calledFrom = await frame.location!.toUserString();
recordStops.add("$brokeAt ($calledFrom)");
} else {
recordStops.add(brokeAt);
@@ -529,8 +529,8 @@
if (event.kind == ServiceEvent.kPauseBreakpoint) {
await isolate.reload();
// We are paused: Step into further.
- Frame frame = isolate.topFrame;
- recordStops.add(await frame.location.toUserString());
+ Frame frame = isolate.topFrame!;
+ recordStops.add(await frame.location!.toUserString());
isolate.stepInto();
} else if (event.kind == ServiceEvent.kPauseExit) {
// We are at the exit: The test is done.
@@ -547,8 +547,8 @@
List<String> recordStops, List<String> expectedStops,
{bool removeDuplicates = false,
bool debugPrint = false,
- String debugPrintFile,
- int debugPrintLine}) {
+ String? debugPrintFile,
+ int? debugPrintLine}) {
return (Isolate isolate) async {
if (debugPrint) {
for (int i = 0; i < recordStops.length; i++) {
@@ -608,7 +608,7 @@
List<String> removeAdjacentDuplicates(List<String> fromList) {
List<String> result = <String>[];
- String latestLine;
+ String? latestLine;
for (String s in fromList) {
if (s == latestLine) continue;
latestLine = s;
diff --git a/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart b/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart
index 1e2753e..c94aa2d 100644
--- a/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart
+++ b/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart
@@ -40,7 +40,7 @@
'libraryId': 'libraries/9999999',
'isDebuggable': false,
};
- bool caughtException;
+ bool caughtException = false;
try {
await isolate.invokeRpcNoUpgrade('setLibraryDebuggable', params);
expect(false, isTrue, reason: 'Unreachable');
diff --git a/runtime/observatory/tests/service/set_library_debuggable_test.dart b/runtime/observatory/tests/service/set_library_debuggable_test.dart
index 4ffbcb6..7431778 100644
--- a/runtime/observatory/tests/service/set_library_debuggable_test.dart
+++ b/runtime/observatory/tests/service/set_library_debuggable_test.dart
@@ -49,8 +49,8 @@
'libraryId': dartCore.id,
'isDebuggable': false,
};
- Map<String, dynamic> result = await isolate.invokeRpcNoUpgrade(
- 'setLibraryDebuggable', setDebugParams);
+ var result = await isolate.invokeRpcNoUpgrade(
+ 'setLibraryDebuggable', setDebugParams) as Map<String, dynamic>;
expect(result['type'], equals('Success'));
await dartCore.reload();
expect(dartCore.debuggable, equals(false));
diff --git a/runtime/observatory/tests/service/set_name_rpc_test.dart b/runtime/observatory/tests/service/set_name_rpc_test.dart
index 1e4253d..5214832 100644
--- a/runtime/observatory/tests/service/set_name_rpc_test.dart
+++ b/runtime/observatory/tests/service/set_name_rpc_test.dart
@@ -16,8 +16,8 @@
var subscription;
subscription = stream.listen((ServiceEvent event) {
if (event.kind == ServiceEvent.kIsolateUpdate) {
- expect(event.owner.type, equals('Isolate'));
- expect(event.owner.name, equals('Barbara'));
+ expect(event.owner!.type, equals('Isolate'));
+ expect(event.owner!.name, equals('Barbara'));
subscription.cancel();
completer.complete();
}
diff --git a/runtime/observatory/tests/service/set_vm_name_rpc_test.dart b/runtime/observatory/tests/service/set_vm_name_rpc_test.dart
index 67ad461..0254209 100644
--- a/runtime/observatory/tests/service/set_vm_name_rpc_test.dart
+++ b/runtime/observatory/tests/service/set_vm_name_rpc_test.dart
@@ -17,8 +17,8 @@
var subscription;
subscription = stream.listen((ServiceEvent event) {
if (event.kind == ServiceEvent.kVMUpdate) {
- expect(event.owner.type, equals('VM'));
- expect(event.owner.name, equals('Barbara'));
+ expect(event.owner!.type, equals('VM'));
+ expect(event.owner!.name, equals('Barbara'));
subscription.cancel();
completer.complete();
}
diff --git a/runtime/observatory/tests/service/simple_reload_test.dart b/runtime/observatory/tests/service/simple_reload_test.dart
index f67c95d..e67c429 100644
--- a/runtime/observatory/tests/service/simple_reload_test.dart
+++ b/runtime/observatory/tests/service/simple_reload_test.dart
@@ -34,9 +34,9 @@
await isolate.reload();
Library lib = isolate.rootLibrary;
await lib.load();
- Instance result = await lib.evaluate('test()');
+ Instance result = await lib.evaluate('test()') as Instance;
expect(result.isString, isTrue);
- return result.valueAsString;
+ return result.valueAsString as String;
}
var tests = <IsolateTest>[
diff --git a/runtime/observatory/tests/service/string_escaping_test.dart b/runtime/observatory/tests/service/string_escaping_test.dart
index 31729de..d306186 100644
--- a/runtime/observatory/tests/service/string_escaping_test.dart
+++ b/runtime/observatory/tests/service/string_escaping_test.dart
@@ -57,15 +57,15 @@
expectFullString(String varName, String varValueAsString) {
Field field = lib.variables.singleWhere((v) => v.name == varName);
- Instance value = field.staticValue;
+ Instance value = field.staticValue as Instance;
expect(value.valueAsString, equals(varValueAsString));
expect(value.valueAsStringIsTruncated, isFalse);
}
expectTruncatedString(String varName, String varValueAsString) {
Field field = lib.variables.singleWhere((v) => v.name == varName);
- Instance value = field.staticValue;
- expect(varValueAsString, startsWith(value.valueAsString));
+ Instance value = field.staticValue as Instance;
+ expect(varValueAsString, startsWith(value.valueAsString!));
expect(value.valueAsStringIsTruncated, isTrue);
}
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart
index ecf4736..805e7fe 100644
--- a/runtime/observatory/tests/service/test_helper.dart
+++ b/runtime/observatory/tests/service/test_helper.dart
@@ -27,8 +27,8 @@
/// Will be set to the http address of the VM's service protocol before
/// any tests are invoked.
-String serviceHttpAddress;
-String serviceWebsocketAddress;
+late String serviceHttpAddress;
+late String serviceWebsocketAddress;
const String _TESTEE_ENV_KEY = 'SERVICE_TEST_TESTEE';
const Map<String, String> _TESTEE_SPAWN_ENV = const {_TESTEE_ENV_KEY: 'true'};
@@ -41,14 +41,14 @@
return Platform.environment.containsKey(_SKY_SHELL_ENV_KEY);
}
-String _skyShellPath() {
+String? _skyShellPath() {
return Platform.environment[_SKY_SHELL_ENV_KEY];
}
class _ServiceTesteeRunner {
Future run(
- {testeeBefore(): null,
- testeeConcurrent(): null,
+ {Function? testeeBefore: null,
+ Function? testeeConcurrent: null,
bool pause_on_start: false,
bool pause_on_exit: false}) async {
if (!pause_on_start) {
@@ -73,8 +73,8 @@
}
void runSync(
- {void testeeBeforeSync(): null,
- void testeeConcurrentSync(): null,
+ {Function? testeeBeforeSync: null,
+ Function? testeeConcurrentSync: null,
bool pause_on_start: false,
bool pause_on_exit: false}) {
if (!pause_on_start) {
@@ -94,7 +94,7 @@
}
class _ServiceTesteeLauncher {
- Process process;
+ Process? process;
final List<String> args;
Future<void> get exited => _processCompleter.future;
final _processCompleter = Completer<void>();
@@ -111,8 +111,8 @@
bool testeeControlsServer,
Uri serviceInfoUri,
int port,
- List<String> extraArgs,
- List<String> executableArgs) {
+ List<String>? extraArgs,
+ List<String>? executableArgs) {
assert(pause_on_start != null);
assert(pause_on_exit != null);
assert(pause_on_unhandled_exceptions != null);
@@ -148,8 +148,8 @@
bool testeeControlsServer,
Uri serviceInfoUri,
int port,
- List<String> extraArgs,
- List<String> executableArgs) {
+ List<String>? extraArgs,
+ List<String>? executableArgs) {
assert(!_shouldLaunchSkyShell());
final String dartExecutable = Platform.executable;
@@ -175,7 +175,9 @@
if (extraArgs != null) {
fullArgs.addAll(extraArgs);
}
- fullArgs.addAll(executableArgs);
+ if (executableArgs != null) {
+ fullArgs.addAll(executableArgs);
+ }
if (!testeeControlsServer) {
fullArgs.add('--enable-vm-service:$port');
}
@@ -189,11 +191,11 @@
bool pause_on_exit,
bool pause_on_unhandled_exceptions,
bool testeeControlsServer,
- List<String> extraArgs,
- List<String> executableArgs) {
+ List<String>? extraArgs,
+ List<String>? executableArgs) {
assert(_shouldLaunchSkyShell());
- final String dartExecutable = _skyShellPath();
+ final String dartExecutable = _skyShellPath()!;
final dartFlags = <String>[];
final fullArgs = <String>[];
@@ -213,7 +215,9 @@
if (extraArgs != null) {
fullArgs.addAll(extraArgs);
}
- fullArgs.addAll(executableArgs);
+ if (executableArgs != null) {
+ fullArgs.addAll(executableArgs);
+ }
if (!testeeControlsServer) {
fullArgs.add('--observatory-port=0');
}
@@ -244,8 +248,8 @@
bool enable_service_port_fallback,
bool testeeControlsServer,
int port,
- List<String> extraArgs,
- List<String> executableArgs) async {
+ List<String>? extraArgs,
+ List<String>? executableArgs) async {
final completer = new Completer<Uri>();
final serviceInfoDir =
await Directory.systemTemp.createTemp('dart_service');
@@ -266,7 +270,7 @@
Uri uri;
final blankCompleter = Completer();
bool blankLineReceived = false;
- process.stdout
+ p.stdout
.transform(utf8.decoder)
.transform(new LineSplitter())
.listen((line) {
@@ -277,13 +281,13 @@
}
print('>testee>out> $line');
});
- process.stderr
+ p.stderr
.transform(utf8.decoder)
.transform(new LineSplitter())
.listen((line) {
print('>testee>err> ${line.trim()}');
});
- process.exitCode.then((exitCode) async {
+ p.exitCode.then((exitCode) async {
await serviceInfoDir.delete(recursive: true);
if ((exitCode != 0) && !killedByTester) {
throw "Testee exited with $exitCode";
@@ -316,7 +320,7 @@
void requestExit() {
if (process != null) {
print('** Killing script');
- if (process.kill()) {
+ if (process!.kill()) {
killedByTester = true;
}
}
@@ -331,12 +335,12 @@
class _ServiceTesterRunner {
void run({
- List<String> mainArgs,
- List<String> extraArgs,
- List<String> executableArgs,
- List<DDSTest> ddsTests,
- List<IsolateTest> isolateTests,
- List<VMTest> vmTests,
+ List<String>? mainArgs,
+ List<String>? extraArgs,
+ List<String>? executableArgs,
+ List<DDSTest>? ddsTests,
+ List<IsolateTest>? isolateTests,
+ List<VMTest>? vmTests,
bool pause_on_start: false,
bool pause_on_exit: false,
bool verbose_vm: false,
@@ -350,9 +354,9 @@
if (executableArgs == null) {
executableArgs = Platform.executableArguments;
}
- DartDevelopmentService dds;
- WebSocketVM vm;
- _ServiceTesteeLauncher process;
+ late DartDevelopmentService dds;
+ late WebSocketVM vm;
+ late _ServiceTesteeLauncher process;
bool testsDone = false;
ignoreLateException(Function f) async {
@@ -383,8 +387,8 @@
extraArgs,
executableArgs)
.then((Uri serverAddress) async {
- if (mainArgs.contains("--gdb")) {
- final pid = process.process.pid;
+ if (mainArgs != null && mainArgs.contains("--gdb")) {
+ final pid = process.process!.pid;
final wait = new Duration(seconds: 10);
print("Testee has pid $pid, waiting $wait before continuing");
sleep(wait);
@@ -412,7 +416,7 @@
() => ignoreLateException(
() async {
if (useDds) {
- await dds?.shutdown();
+ await dds.shutdown();
}
process.requestExit();
},
@@ -490,7 +494,7 @@
}
}
- Completer completer = new Completer();
+ Completer<Isolate>? completer = new Completer<Isolate>();
vm.getEventStream(VM.kIsolateStream).then((stream) {
var subscription;
subscription = stream.listen((ServiceEvent event) async {
@@ -503,7 +507,7 @@
vm.isolates.first.load().then((result) {
if (result is Isolate) {
subscription.cancel();
- completer.complete(result);
+ completer!.complete(result);
completer = null;
}
});
@@ -516,12 +520,12 @@
if (vm.isolates.isNotEmpty) {
vm.isolates.first.reload().then((result) async {
if (completer != null && result is Isolate) {
- completer.complete(result);
+ completer!.complete(result);
completer = null;
}
});
}
- return await completer.future;
+ return await completer!.future;
}
}
@@ -530,8 +534,8 @@
/// concurrently with the tests. Uses [mainArgs] to determine whether
/// to run tests or testee in this invocation of the script.
Future runIsolateTests(List<String> mainArgs, List<IsolateTest> tests,
- {testeeBefore(),
- testeeConcurrent(),
+ {Function? testeeBefore,
+ Function? testeeConcurrent,
bool pause_on_start: false,
bool pause_on_exit: false,
bool verbose_vm: false,
@@ -539,7 +543,7 @@
bool testeeControlsServer: false,
bool enableDds: true,
bool enableService: true,
- List<String> extraArgs}) async {
+ List<String>? extraArgs}) async {
assert(!pause_on_start || testeeBefore == null);
if (_isTestee()) {
new _ServiceTesteeRunner().run(
@@ -573,13 +577,13 @@
/// in an async context (because exceptions are *always* handled in async
/// functions).
void runIsolateTestsSynchronous(List<String> mainArgs, List<IsolateTest> tests,
- {void testeeBefore(),
- void testeeConcurrent(),
+ {Function? testeeBefore,
+ Function? testeeConcurrent,
bool pause_on_start: false,
bool pause_on_exit: false,
bool verbose_vm: false,
bool pause_on_unhandled_exceptions: false,
- List<String> extraArgs}) {
+ List<String>? extraArgs}) {
assert(!pause_on_start || testeeBefore == null);
if (_isTestee()) {
new _ServiceTesteeRunner().runSync(
@@ -604,8 +608,8 @@
/// concurrently with the tests. Uses [mainArgs] to determine whether
/// to run tests or testee in this invocation of the script.
Future runVMTests(List<String> mainArgs, List<VMTest> tests,
- {testeeBefore(),
- testeeConcurrent(),
+ {Function? testeeBefore,
+ Function? testeeConcurrent,
bool pause_on_start: false,
bool pause_on_exit: false,
bool verbose_vm: false,
@@ -614,8 +618,8 @@
bool enableDds: true,
bool enableService: true,
int port = 0,
- List<String> extraArgs,
- List<String> executableArgs}) async {
+ List<String>? extraArgs,
+ List<String>? executableArgs}) async {
if (_isTestee()) {
new _ServiceTesteeRunner().run(
testeeBefore: testeeBefore,
@@ -646,16 +650,16 @@
/// determine whether to run tests or testee in this invocation of the
/// script.
Future runDDSTests(List<String> mainArgs, List<DDSTest> tests,
- {testeeBefore(),
- testeeConcurrent(),
+ {Function? testeeBefore,
+ Function? testeeConcurrent,
bool pause_on_start: false,
bool pause_on_exit: false,
bool verbose_vm: false,
bool pause_on_unhandled_exceptions: false,
bool enable_service_port_fallback: false,
int port = 0,
- List<String> extraArgs,
- List<String> executableArgs}) async {
+ List<String>? extraArgs,
+ List<String>? executableArgs}) async {
if (_isTestee()) {
new _ServiceTesteeRunner().run(
testeeBefore: testeeBefore,
diff --git a/runtime/observatory/tests/service/type_arguments_test.dart b/runtime/observatory/tests/service/type_arguments_test.dart
index 1c2a6ac..92ec78f 100644
--- a/runtime/observatory/tests/service/type_arguments_test.dart
+++ b/runtime/observatory/tests/service/type_arguments_test.dart
@@ -36,7 +36,7 @@
// Check that we can 'get' this object again.
var firstType = allTypeArgsList[0];
return isolate.getObject(firstType.id).then((ServiceObject object) {
- TypeArguments type = object;
+ TypeArguments type = object as TypeArguments;
expect(firstType.name, type.name);
});
});
diff --git a/runtime/observatory/tests/service/typed_data_test.dart b/runtime/observatory/tests/service/typed_data_test.dart
index d96583a..9c4ba3b 100644
--- a/runtime/observatory/tests/service/typed_data_test.dart
+++ b/runtime/observatory/tests/service/typed_data_test.dart
@@ -78,18 +78,18 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
script();
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
// Pre-load all the fields so we don't use await below and get better
// stacktraces.
for (var v in lib.variables) {
await v.load();
- await v.staticValue.load();
+ await v.staticValue!.load();
}
expectTypedData(name, expectedValue) {
var variable = lib.variables.singleWhere((v) => v.name == name);
- var actualValue = (variable.staticValue as Instance).typedElements;
+ var actualValue = (variable.staticValue as Instance).typedElements!;
if (expectedValue is Int32x4List) {
expect(actualValue.length, equals(expectedValue.length));
for (var i = 0; i < actualValue.length; i++) {
diff --git a/runtime/observatory/tests/service/valid_source_locations_test.dart b/runtime/observatory/tests/service/valid_source_locations_test.dart
index 8512479..d4c4771 100644
--- a/runtime/observatory/tests/service/valid_source_locations_test.dart
+++ b/runtime/observatory/tests/service/valid_source_locations_test.dart
@@ -14,16 +14,16 @@
debugger();
}
-Future validateLocation(Location location, Object object) async {
+Future validateLocation(Location? location, Object object) async {
if (location == null) return;
- if (location.tokenPos < 0) return;
+ if (location.tokenPos! < 0) return;
if (location.script.uri == 'dart:_internal-patch/class_id_fasta.dart') {
// Injected fields from this script cannot be reloaded.
return;
}
// Ensure the script is loaded.
- final Script script = await location.script.load();
+ final Script script = await location.script.load() as Script;
// Use the more low-level functions.
final line = script.tokenToLine(location.tokenPos);
@@ -39,17 +39,17 @@
}
Future validateFieldLocation(Field field) async {
- field = await field.load();
+ field = await field.load() as Field;
await validateLocation(field.location, field);
}
Future validateFunctionLocation(ServiceFunction fun) async {
- fun = await fun.load();
+ fun = await fun.load() as ServiceFunction;
await validateLocation(fun.location, fun);
}
Future validateClassLocation(Class klass) async {
- klass = await klass.load();
+ klass = await klass.load() as Class;
await validateLocation(klass.location, klass);
for (Field field in klass.fields) {
@@ -72,7 +72,7 @@
// Loop over all libraries, classes, functions and fields to ensure .
for (Library lib in isolate.libraries) {
- lib = await lib.load();
+ lib = await lib.load() as Library;
for (Field field in lib.variables) {
await validateFieldLocation(field);
diff --git a/runtime/observatory/tests/service/verify_http_timeline_test.dart b/runtime/observatory/tests/service/verify_http_timeline_test.dart
index f7959e4..7c9d7c8 100644
--- a/runtime/observatory/tests/service/verify_http_timeline_test.dart
+++ b/runtime/observatory/tests/service/verify_http_timeline_test.dart
@@ -182,9 +182,9 @@
final id = event['id'];
events.putIfAbsent(id, () => 0);
if (isStartEvent(event)) {
- events[id]++;
+ events[id] = events[id]! + 1;
} else if (isFinishEvent(event)) {
- events[id]--;
+ events[id] = events[id]! - 1;
}
}
bool valid = true;
diff --git a/runtime/observatory/tests/service/vm_test.dart b/runtime/observatory/tests/service/vm_test.dart
index f4417c4..137270a 100644
--- a/runtime/observatory/tests/service/vm_test.dart
+++ b/runtime/observatory/tests/service/vm_test.dart
@@ -7,8 +7,8 @@
import 'test_helper.dart';
var tests = <IsolateTest>[
- (Isolate isolate) {
- VM vm = isolate.owner;
+ (Isolate isolate) async {
+ VM vm = isolate.owner as VM;
expect(vm.targetCPU, isNotNull);
expect(vm.architectureBits == 32 || vm.architectureBits == 64, isTrue);
expect(vm.embedder, equals("Dart VM"));
diff --git a/runtime/observatory/tests/service/vm_timeline_events_test.dart b/runtime/observatory/tests/service/vm_timeline_events_test.dart
index 5ae3e8b..062a0c1 100644
--- a/runtime/observatory/tests/service/vm_timeline_events_test.dart
+++ b/runtime/observatory/tests/service/vm_timeline_events_test.dart
@@ -26,15 +26,15 @@
return events.where(filter).toList();
}
-Completer completer;
-int eventCount;
+late Completer<void> completer;
+int eventCount = 0;
onTimelineEvent(ServiceEvent event) {
if (event.kind != ServiceEvent.kTimelineEvents) {
return;
}
eventCount++;
- expect(filterEvents(event.timelineEvents, isDart).length, greaterThan(0));
+ expect(filterEvents(event.timelineEvents!, isDart).length, greaterThan(0));
if (eventCount == 5) {
completer.complete(eventCount);
}
diff --git a/runtime/observatory/tests/service/vm_timeline_flags_test.dart b/runtime/observatory/tests/service/vm_timeline_flags_test.dart
index 9553054..cc433af 100644
--- a/runtime/observatory/tests/service/vm_timeline_flags_test.dart
+++ b/runtime/observatory/tests/service/vm_timeline_flags_test.dart
@@ -26,7 +26,7 @@
return events.where(filter).toList();
}
-int dartEventCount;
+int dartEventCount = 0;
var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
@@ -51,8 +51,8 @@
final completer = Completer<void>();
await subscribeToStream(isolate.vm, 'Timeline', (event) async {
expect(event.kind, ServiceEvent.kTimelineStreamSubscriptionsUpdate);
- expect(event.updatedStreams.length, 1);
- expect(event.updatedStreams.first, 'Dart');
+ expect(event.updatedStreams!.length, 1);
+ expect(event.updatedStreams!.first, 'Dart');
await cancelStreamSubscription('Timeline');
completer.complete();
});
@@ -90,7 +90,7 @@
final completer = Completer<void>();
await subscribeToStream(isolate.vm, 'Timeline', (event) async {
expect(event.kind, ServiceEvent.kTimelineStreamSubscriptionsUpdate);
- expect(event.updatedStreams.length, 0);
+ expect(event.updatedStreams!.length, 0);
await cancelStreamSubscription('Timeline');
completer.complete();
});
diff --git a/runtime/observatory/tests/service/weak_properties_test.dart b/runtime/observatory/tests/service/weak_properties_test.dart
index bc08b35..7e557d1 100644
--- a/runtime/observatory/tests/service/weak_properties_test.dart
+++ b/runtime/observatory/tests/service/weak_properties_test.dart
@@ -25,7 +25,7 @@
expando[key] = value;
InstanceMirror expandoMirror = reflect(expando);
- LibraryMirror libcore = expandoMirror.type.owner;
+ LibraryMirror libcore = expandoMirror.type.owner as LibraryMirror;
var entries = expandoMirror
.getField(MirrorSystem.getSymbol('_data', libcore))
@@ -36,31 +36,31 @@
var tests = <IsolateTest>[
(Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
+ Library lib = await isolate.rootLibrary.load() as Library;
Field keyField = lib.variables.singleWhere((v) => v.name == 'key');
await keyField.load();
- Instance key = keyField.staticValue;
+ Instance key = keyField.staticValue as Instance;
Field valueField = lib.variables.singleWhere((v) => v.name == 'value');
await valueField.load();
- Instance value = valueField.staticValue;
+ Instance value = valueField.staticValue as Instance;
Field propField =
lib.variables.singleWhere((v) => v.name == 'weak_property');
await propField.load();
- Instance prop = propField.staticValue;
+ Instance prop = propField.staticValue as Instance;
expect(key.isWeakProperty, isFalse);
expect(value.isWeakProperty, isFalse);
expect(prop.isWeakProperty, isTrue);
expect(prop.key, isNull);
expect(prop.value, isNull);
- Instance loadedProp = await prop.load();
+ Instance loadedProp = await prop.load() as Instance;
// Object ids are not canonicalized, so we rely on the key and value
// being the sole instances of their classes to test we got the objects
// we expect.
expect(loadedProp.key, isNotNull);
- expect(loadedProp.key.clazz, equals(key.clazz));
+ expect(loadedProp.key!.clazz, equals(key.clazz));
expect(loadedProp.value, isNotNull);
- expect(loadedProp.value.clazz, equals(value.clazz));
+ expect(loadedProp.value!.clazz, equals(value.clazz));
},
];
diff --git a/runtime/observatory/tests/ui/inspector.dart b/runtime/observatory/tests/ui/inspector.dart
index 7849381..e8fc90a 100644
--- a/runtime/observatory/tests/ui/inspector.dart
+++ b/runtime/observatory/tests/ui/inspector.dart
@@ -18,9 +18,8 @@
var uninitialized = new Object();
extractPrivateField(obj, name) {
- return reflect(obj)
- .getField(MirrorSystem.getSymbol(name, reflect(obj).type.owner))
- .reflectee;
+ var lib = reflect(obj).type.owner as LibraryMirror;
+ return reflect(obj).getField(MirrorSystem.getSymbol(name, lib)).reflectee;
}
class A<T> {}
@@ -138,7 +137,7 @@
mixedType = "2";
mixedType = false;
- array = new List(3);
+ array = new List<dynamic>.filled(3, null);
array[0] = 1;
array[1] = 2;
array[2] = 3;
@@ -156,7 +155,7 @@
float64 = 3.14;
float64x2 = new Float64x2(0.0, 3.14);
gauge = new Gauge("GaugeName", "Gauge description", 0.0, 100.0);
- growableList = new List();
+ growableList = <dynamic>[];
int32x4 = new Int32x4(0, 1, 10, 11);
map = {
"x-key": "x-value",
diff --git a/runtime/observatory/tests/ui/retainingPath.dart b/runtime/observatory/tests/ui/retainingPath.dart
index 0a2c30f..238ab4c 100644
--- a/runtime/observatory/tests/ui/retainingPath.dart
+++ b/runtime/observatory/tests/ui/retainingPath.dart
@@ -11,7 +11,7 @@
}
main() {
- var list = new List<Foo>.filled(10, null);
+ var list = new List<dynamic>.filled(10, null);
list[5] = new Foo(42.toString(), new Foo(87.toString(), 17.toString()));
while (true) {}
}
diff --git a/runtime/observatory/web/main.dart b/runtime/observatory/web/main.dart
index b09362d..820c74a 100644
--- a/runtime/observatory/web/main.dart
+++ b/runtime/observatory/web/main.dart
@@ -14,7 +14,7 @@
print('${rec.level.name}: ${rec.time}: ${rec.message}');
});
Logger.root.info('Starting Observatory');
- document.body.children
+ document.body!.children
.insert(0, new ObservatoryApplicationElement.created().element);
});
}
diff --git a/runtime/vm/compiler/write_barrier_elimination.cc b/runtime/vm/compiler/write_barrier_elimination.cc
index 10b18c5..efc79e8 100644
--- a/runtime/vm/compiler/write_barrier_elimination.cc
+++ b/runtime/vm/compiler/write_barrier_elimination.cc
@@ -192,6 +192,8 @@
void WriteBarrierElimination::IndexDefinitions(Zone* zone) {
BitmapBuilder array_allocations;
+ GrowableArray<Definition*> create_array_worklist;
+
for (intptr_t i = 0; i < block_order_->length(); ++i) {
BlockEntryInstr* const block = block_order_->At(i);
if (auto join_block = block->AsJoinEntry()) {
@@ -209,8 +211,12 @@
for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
if (Definition* current = it.Current()->AsDefinition()) {
if (IsUsable(current)) {
- array_allocations.Set(definition_count_, current->IsCreateArray());
+ const bool is_create_array = current->IsCreateArray();
+ array_allocations.Set(definition_count_, is_create_array);
definition_indices_.Insert({current, definition_count_++});
+ if (is_create_array) {
+ create_array_worklist.Add(current);
+ }
#if defined(DEBUG)
if (tracing_) {
THR_Print("Definition (%" Pd ") has index %" Pd ".\n",
@@ -222,6 +228,20 @@
}
}
+ while (!create_array_worklist.is_empty()) {
+ auto instr = create_array_worklist.RemoveLast();
+ for (Value::Iterator it(instr->input_use_list()); !it.Done();
+ it.Advance()) {
+ if (auto phi_use = it.Current()->instruction()->AsPhi()) {
+ const intptr_t index = Index(phi_use);
+ if (!array_allocations.Get(index)) {
+ array_allocations.Set(index, /*can_be_create_array=*/true);
+ create_array_worklist.Add(phi_use);
+ }
+ }
+ }
+ }
+
vector_ = new (zone) BitVector(zone, definition_count_);
vector_->SetAll();
array_allocations_mask_ = new (zone) BitVector(zone, definition_count_);
diff --git a/runtime/vm/compiler/write_barrier_elimination_test.cc b/runtime/vm/compiler/write_barrier_elimination_test.cc
index 88d4e7c..b86e827 100644
--- a/runtime/vm/compiler/write_barrier_elimination_test.cc
+++ b/runtime/vm/compiler/write_barrier_elimination_test.cc
@@ -12,7 +12,8 @@
DEBUG_ONLY(DECLARE_FLAG(bool, trace_write_barrier_elimination);)
ISOLATE_UNIT_TEST_CASE(IRTest_WriteBarrierElimination_JoinSuccessors) {
- DEBUG_ONLY(FLAG_trace_write_barrier_elimination = true);
+ DEBUG_ONLY(
+ SetFlagScope<bool> sfs(&FLAG_trace_write_barrier_elimination, true));
const char* nullable_tag = TestCase::NullableTag();
const char* null_assert_tag = TestCase::NullAssertTag();
@@ -82,7 +83,8 @@
}
ISOLATE_UNIT_TEST_CASE(IRTest_WriteBarrierElimination_AtLeastOnce) {
- DEBUG_ONLY(FLAG_trace_write_barrier_elimination = true);
+ DEBUG_ONLY(
+ SetFlagScope<bool> sfs(&FLAG_trace_write_barrier_elimination, true));
// Ensure that we process every block at least once during the analysis
// phase so that the out-sets will be initialized. If we don't process
// each block at least once, the store "c.next = n" will be marked
@@ -137,7 +139,8 @@
}
ISOLATE_UNIT_TEST_CASE(IRTest_WriteBarrierElimination_Arrays) {
- DEBUG_ONLY(FLAG_trace_write_barrier_elimination = true);
+ DEBUG_ONLY(
+ SetFlagScope<bool> sfs(&FLAG_trace_write_barrier_elimination, true));
const char* nullable_tag = TestCase::NullableTag();
// Test that array allocations are not considered usable after a
@@ -204,4 +207,49 @@
EXPECT(store_into_array->ShouldEmitStoreBarrier() == true);
}
+ISOLATE_UNIT_TEST_CASE(IRTest_WriteBarrierElimination_Regress43786) {
+ DEBUG_ONLY(
+ SetFlagScope<bool> sfs(&FLAG_trace_write_barrier_elimination, true));
+ const char* kScript = R"(
+ foo() {
+ final root = List<dynamic>.filled(128, null);
+ List<dynamic> last = root;
+ for (int i = 0; i < 10 * 1024; ++i) {
+ final nc = List(128);
+ last[0] = nc;
+ last = nc;
+ }
+ }
+
+ main() { foo(); }
+ )";
+
+ const auto& root_library = Library::Handle(LoadTestScript(kScript));
+
+ Invoke(root_library, "main");
+
+ const auto& function = Function::Handle(GetFunction(root_library, "foo"));
+ TestPipeline pipeline(function, CompilerPass::kJIT);
+ FlowGraph* flow_graph = pipeline.RunPasses({});
+
+ auto entry = flow_graph->graph_entry()->normal_entry();
+ EXPECT(entry != nullptr);
+
+ StoreIndexedInstr* store_into_phi = nullptr;
+
+ ILMatcher cursor(flow_graph, entry);
+ RELEASE_ASSERT(cursor.TryMatch(
+ {
+ kMatchAndMoveCreateArray,
+ kMatchAndMoveGoto,
+ kMatchAndMoveBranchTrue,
+ kMatchAndMoveCreateArray,
+ {kMatchAndMoveStoreIndexed, &store_into_phi},
+ },
+ kMoveGlob));
+
+ EXPECT(store_into_phi->array()->definition()->IsPhi());
+ EXPECT(store_into_phi->ShouldEmitStoreBarrier());
+}
+
} // namespace dart
diff --git a/sdk/lib/_internal/allowed_experiments.json b/sdk/lib/_internal/allowed_experiments.json
index aadacfe..cda7feb 100644
--- a/sdk/lib/_internal/allowed_experiments.json
+++ b/sdk/lib/_internal/allowed_experiments.json
@@ -94,6 +94,12 @@
"native_stack_traces": {
"experimentSet": "nullSafety"
},
+ "observatory": {
+ "experimentSet": "nullSafety"
+ },
+ "observatory_test_package": {
+ "experimentSet": "nullSafety"
+ },
"path": {
"experimentSet": "nullSafety"
},
diff --git a/sdk/lib/internal/internal.dart b/sdk/lib/internal/internal.dart
index f86652e..401777d 100644
--- a/sdk/lib/internal/internal.dart
+++ b/sdk/lib/internal/internal.dart
@@ -119,6 +119,163 @@
return digit1 * 16 + digit2 - (digit2 & 256);
}
+/// A default hash function used by the platform in various places.
+///
+/// This is currently the [Jenkins hash function][1] but using masking to keep
+/// values in SMI range.
+///
+/// [1]: http://en.wikipedia.org/wiki/Jenkins_hash_function
+///
+/// Usage:
+/// Hash each value with the hash of the previous value, then get the final
+/// hash by calling finish.
+/// ```
+/// var hash = 0;
+/// for (var value in values) {
+/// hash = SystemHash.combine(hash, value.hashCode);
+/// }
+/// hash = SystemHash.finish(hash);
+/// ```
+// TODO(lrn): Consider specializing this code per platform,
+// so the VM can use its 64-bit integers directly.
+@Since("2.11")
+class SystemHash {
+ static int combine(int hash, int value) {
+ hash = 0x1fffffff & (hash + value);
+ hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
+ return hash ^ (hash >> 6);
+ }
+
+ static int finish(int hash) {
+ hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
+ hash = hash ^ (hash >> 11);
+ return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
+ }
+
+ static int hash2(int v1, int v2) {
+ int hash = 0;
+ hash = combine(hash, v1);
+ hash = combine(hash, v2);
+ return finish(hash);
+ }
+
+ static int hash3(int v1, int v2, int v3) {
+ int hash = 0;
+ hash = combine(hash, v1);
+ hash = combine(hash, v2);
+ hash = combine(hash, v3);
+ return finish(hash);
+ }
+
+ static int hash4(int v1, int v2, int v3, int v4) {
+ int hash = 0;
+ hash = combine(hash, v1);
+ hash = combine(hash, v2);
+ hash = combine(hash, v3);
+ hash = combine(hash, v4);
+ return finish(hash);
+ }
+
+ static int hash5(int v1, int v2, int v3, int v4, int v5) {
+ int hash = 0;
+ hash = combine(hash, v1);
+ hash = combine(hash, v2);
+ hash = combine(hash, v3);
+ hash = combine(hash, v4);
+ hash = combine(hash, v5);
+ return finish(hash);
+ }
+
+ static int hash6(int v1, int v2, int v3, int v4, int v5, int v6) {
+ int hash = 0;
+ hash = combine(hash, v1);
+ hash = combine(hash, v2);
+ hash = combine(hash, v3);
+ hash = combine(hash, v4);
+ hash = combine(hash, v5);
+ hash = combine(hash, v6);
+ return finish(hash);
+ }
+
+ static int hash7(int v1, int v2, int v3, int v4, int v5, int v6, int v7) {
+ int hash = 0;
+ hash = combine(hash, v1);
+ hash = combine(hash, v2);
+ hash = combine(hash, v3);
+ hash = combine(hash, v4);
+ hash = combine(hash, v5);
+ hash = combine(hash, v6);
+ hash = combine(hash, v7);
+ return finish(hash);
+ }
+
+ static int hash8(
+ int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8) {
+ int hash = 0;
+ hash = combine(hash, v1);
+ hash = combine(hash, v2);
+ hash = combine(hash, v3);
+ hash = combine(hash, v4);
+ hash = combine(hash, v5);
+ hash = combine(hash, v6);
+ hash = combine(hash, v7);
+ hash = combine(hash, v8);
+ return finish(hash);
+ }
+
+ static int hash9(
+ int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9) {
+ int hash = 0;
+ hash = combine(hash, v1);
+ hash = combine(hash, v2);
+ hash = combine(hash, v3);
+ hash = combine(hash, v4);
+ hash = combine(hash, v5);
+ hash = combine(hash, v6);
+ hash = combine(hash, v7);
+ hash = combine(hash, v8);
+ hash = combine(hash, v9);
+ return finish(hash);
+ }
+
+ static int hash10(int v1, int v2, int v3, int v4, int v5, int v6, int v7,
+ int v8, int v9, int v10) {
+ int hash = 0;
+ hash = combine(hash, v1);
+ hash = combine(hash, v2);
+ hash = combine(hash, v3);
+ hash = combine(hash, v4);
+ hash = combine(hash, v5);
+ hash = combine(hash, v6);
+ hash = combine(hash, v7);
+ hash = combine(hash, v8);
+ hash = combine(hash, v9);
+ hash = combine(hash, v10);
+ return finish(hash);
+ }
+
+ /// Bit shuffling operation to improve hash codes.
+ ///
+ /// Dart integers have very simple hash codes (their value),
+ /// which is acceptable for the hash above because it smears the bits
+ /// as part of the combination.
+ /// However, for the unordered hash based on xor, we need to improve
+ /// the hash code of, e.g., integers, so a set containing the integers
+ /// from zero to 2^n won't always have a zero hashcode.
+ ///
+ /// Assumes the input hash code is an unsigned 32-bit integer.
+ /// Found by Christopher Wellons [https://github.com/skeeto/hash-prospector].
+ static int smear(int x) {
+ // TODO: Use >>> instead of >> when available.
+ x ^= x >> 16;
+ x = (x * 0x7feb352d) & 0xFFFFFFFF;
+ x ^= x >> 15;
+ x = (x * 0x846ca68b) & 0xFFFFFFFF;
+ x ^= x >> 16;
+ return x;
+ }
+}
+
/// Given an [instance] of some generic type [T], and [extract], a first-class
/// generic function that takes the same number of type parameters as [T],
/// invokes the function with the same type arguments that were passed to T
diff --git a/sdk/lib/math/jenkins_smi_hash.dart b/sdk/lib/math/jenkins_smi_hash.dart
deleted file mode 100644
index deca56c..0000000
--- a/sdk/lib/math/jenkins_smi_hash.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2013, 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.
-
-part of dart.math;
-
-/// This is the [Jenkins hash function][1] but using masking to keep
-/// values in SMI range.
-///
-/// [1]: http://en.wikipedia.org/wiki/Jenkins_hash_function
-///
-/// Use:
-/// Hash each value with the hash of the previous value, then get the final
-/// hash by calling finish.
-///
-/// var hash = 0;
-/// for (var value in values) {
-/// hash = JenkinsSmiHash.combine(hash, value.hashCode);
-/// }
-/// hash = JenkinsSmiHash.finish(hash);
-class _JenkinsSmiHash {
- // TODO(11617): This class should be optimized and standardized elsewhere.
-
- static int combine(int hash, int value) {
- hash = 0x1fffffff & (hash + value);
- hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
- return hash ^ (hash >> 6);
- }
-
- static int finish(int hash) {
- hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
- hash = hash ^ (hash >> 11);
- return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
- }
-
- static int hash2(int a, int b) => finish(combine(combine(0, a), b));
-
- static int hash4(int a, int b, int c, int d) =>
- finish(combine(combine(combine(combine(0, a), b), c), d));
-}
diff --git a/sdk/lib/math/math.dart b/sdk/lib/math/math.dart
index b335669..8f847b1 100644
--- a/sdk/lib/math/math.dart
+++ b/sdk/lib/math/math.dart
@@ -11,7 +11,8 @@
/// {@category Core}
library dart.math;
-part "jenkins_smi_hash.dart";
+import "dart:_internal" show SystemHash;
+
part "point.dart";
part "random.dart";
part "rectangle.dart";
diff --git a/sdk/lib/math/math_sources.gni b/sdk/lib/math/math_sources.gni
index ff8f3fa..c06aead 100644
--- a/sdk/lib/math/math_sources.gni
+++ b/sdk/lib/math/math_sources.gni
@@ -6,7 +6,6 @@
"math.dart",
# The above file needs to be first as it lists the parts below.
- "jenkins_smi_hash.dart",
"point.dart",
"random.dart",
"rectangle.dart",
diff --git a/sdk/lib/math/point.dart b/sdk/lib/math/point.dart
index 4b0fed5..f092fc8 100644
--- a/sdk/lib/math/point.dart
+++ b/sdk/lib/math/point.dart
@@ -23,7 +23,7 @@
bool operator ==(Object other) =>
other is Point && x == other.x && y == other.y;
- int get hashCode => _JenkinsSmiHash.hash2(x.hashCode, y.hashCode);
+ int get hashCode => SystemHash.hash2(x.hashCode, y.hashCode);
/// Add [other] to `this`, as if both points were vectors.
///
diff --git a/sdk/lib/math/rectangle.dart b/sdk/lib/math/rectangle.dart
index 2ee86c9..e80d790 100644
--- a/sdk/lib/math/rectangle.dart
+++ b/sdk/lib/math/rectangle.dart
@@ -48,7 +48,7 @@
right == other.right &&
bottom == other.bottom;
- int get hashCode => _JenkinsSmiHash.hash4(
+ int get hashCode => SystemHash.hash4(
left.hashCode, top.hashCode, right.hashCode, bottom.hashCode);
/// Computes the intersection of `this` and [other].
diff --git a/sdk/lib/vmservice/vmservice.dart b/sdk/lib/vmservice/vmservice.dart
index 755e934..98ce332 100644
--- a/sdk/lib/vmservice/vmservice.dart
+++ b/sdk/lib/vmservice/vmservice.dart
@@ -258,7 +258,7 @@
}
acceptNewWebSocketConnections(false);
_ddsUri = Uri.parse(uri);
- await VMServiceEmbedderHooks?.ddsConnected!();
+ await VMServiceEmbedderHooks.ddsConnected!();
return encodeSuccess(message);
}
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 8319487..6bb5259 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -17,6 +17,8 @@
Language/Expressions/Shift/integer_t01: SkipByDesign # big integer cannot be represented in JavaScript
Language/Expressions/Shift/integer_t02: SkipByDesign # big integer cannot be represented in JavaScript
Language/Expressions/Spawning_an_Isolate/new_isolate_t01: SkipByDesign
+Language/Libraries_and_Scripts/Scripts/main_optional_parameters_t01: SkipByDesign # https://github.com/dart-lang/co19/issues/952
+Language/Libraries_and_Scripts/Scripts/main_optional_parameters_t03: SkipByDesign # https://github.com/dart-lang/co19/issues/952
Language/Metadata/before*: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/523.
Language/Reference/Operator_Precedence/precedence_15_unary_prefix_t08: SkipByDesign # binary '~' produces different results in JavaScript and Dart
LibTest/core/DateTime/DateTime.fromMicrosecondsSinceEpoch_A01_t01: SkipByDesign # microseconds are not supported in JavaScript
diff --git a/tests/language/if_null/assignment_behavior_test.dart b/tests/language/if_null/assignment_behavior_test.dart
index 9bbfe18..144ff7d 100644
--- a/tests/language/if_null/assignment_behavior_test.dart
+++ b/tests/language/if_null/assignment_behavior_test.dart
@@ -118,8 +118,10 @@
void instanceTest() {
// v ??= e is equivalent to ((x) => x == null ? v = e : x)(v)
- vGetValue = 1; check(1, () => v ??= bad(), ['$s.v']);
- yGetValue = 1; check(1, () => v ??= y, ['$s.v', 'y', '$s.v=1']);
+ vGetValue = 1;
+ check(1, () => v ??= bad(), ['$s.v']);
+ yGetValue = 1;
+ check(1, () => v ??= y, ['$s.v', 'y', '$s.v=1']);
finalOne ??= null;
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL
@@ -144,8 +146,10 @@
void derivedInstanceTest() {
// super.v ??= e is equivalent to
// ((x) => x == null ? super.v = e : x)(super.v)
- vGetValue = 1; check(1, () => super.v ??= bad(), ['$s.v']);
- yGetValue = 1; check(1, () => super.v ??= y, ['$s.v', 'y', '$s.v=1']);
+ vGetValue = 1;
+ check(1, () => super.v ??= bad(), ['$s.v']);
+ yGetValue = 1;
+ check(1, () => super.v ??= y, ['$s.v', 'y', '$s.v=1']);
}
}
@@ -159,26 +163,41 @@
new D('d').derivedInstanceTest();
// v ??= e is equivalent to ((x) => x == null ? v = e : x)(v)
- xGetValue = 1; check(1, () => x ??= bad(), ['x']);
- yGetValue = 1; check(1, () => x ??= y, ['x', 'y', 'x=1']);
- h.xGetValue = 1; check(1, () => h.x ??= bad(), ['h.x']);
- yGetValue = 1; check(1, () => h.x ??= y, ['h.x', 'y', 'h.x=1']);
- { var l = 1; check(1, () => l ??= bad(), []); }
- // ^
- // [cfe] Operand of null-aware operation '??=' has type 'int' which excludes null.
- // ^^^^^
- // [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION
- { var l; yGetValue = 1; check(1, () => l ??= y, ['y']); Expect.equals(1, l); }
- { final l = 1; l ??= null; }
- // ^
- // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_LOCAL
- // [cfe] Can't assign to the final variable 'l'.
- // ^
- // [cfe] Operand of null-aware operation '??=' has type 'int' which excludes null.
- // ^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^^^^
- // [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION
+ xGetValue = 1;
+ check(1, () => x ??= bad(), ['x']);
+ yGetValue = 1;
+ check(1, () => x ??= y, ['x', 'y', 'x=1']);
+ h.xGetValue = 1;
+ check(1, () => h.x ??= bad(), ['h.x']);
+ yGetValue = 1;
+ check(1, () => h.x ??= y, ['h.x', 'y', 'h.x=1']);
+ {
+ var l = 1;
+ check(1, () => l ??= bad(), []);
+ // ^
+ // [cfe] Operand of null-aware operation '??=' has type 'int' which excludes null.
+ // ^^^^^
+ // [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION
+ }
+ {
+ var l;
+ yGetValue = 1;
+ check(1, () => l ??= y, ['y']);
+ Expect.equals(1, l);
+ }
+ {
+ final l = 1;
+ l ??= null;
+// ^
+// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_LOCAL
+// [cfe] Can't assign to the final variable 'l'.
+// ^
+// [cfe] Operand of null-aware operation '??=' has type 'int' which excludes null.
+ // ^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^^^^
+ // [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION
+ }
C ??= null;
//^
// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_TYPE
@@ -195,39 +214,55 @@
// [cfe] A prefix can't be used as an expression.
// C.v ??= e is equivalent to ((x) => x == null ? C.v = e : x)(C.v)
- C.xGetValue = 1; check(1, () => C.x ??= bad(), ['C.x']);
- yGetValue = 1; check(1, () => C.x ??= y, ['C.x', 'y', 'C.x=1']);
- h.C.xGetValue = 1; check(1, () => h.C.x ??= bad(), ['h.C.x']);
- yGetValue = 1; check(1, () => h.C.x ??= y, ['h.C.x', 'y', 'h.C.x=1']);
+ C.xGetValue = 1;
+ check(1, () => C.x ??= bad(), ['C.x']);
+ yGetValue = 1;
+ check(1, () => C.x ??= y, ['C.x', 'y', 'C.x=1']);
+ h.C.xGetValue = 1;
+ check(1, () => h.C.x ??= bad(), ['h.C.x']);
+ yGetValue = 1;
+ check(1, () => h.C.x ??= y, ['h.C.x', 'y', 'h.C.x=1']);
// e1.v ??= e2 is equivalent to
// ((x) => ((y) => y == null ? x.v = e2 : y)(x.v))(e1)
- xGetValue = new C('x'); xGetValue.vGetValue = 1;
+ xGetValue = new C('x');
+ xGetValue.vGetValue = 1;
check(1, () => x.v ??= bad(), ['x', 'x.v']);
- xGetValue = new C('x'); yGetValue = 1;
+ xGetValue = new C('x');
+ yGetValue = 1;
check(1, () => x.v ??= y, ['x', 'x.v', 'y', 'x.v=1']);
- fValue = new C('f()'); fValue.vGetValue = 1;
+ fValue = new C('f()');
+ fValue.vGetValue = 1;
check(1, () => f().v ??= bad(), ['f()', 'f().v']);
- fValue = new C('f()'); yGetValue = 1;
+ fValue = new C('f()');
+ yGetValue = 1;
check(1, () => f().v ??= y, ['f()', 'f().v', 'y', 'f().v=1']);
// e1[e2] ??= e3 is equivalent to
// ((a, i) => ((x) => x == null ? a[i] = e3 : x)(a[i]))(e1, e2)
- xGetValue = new C('x'); yGetValue = 1; xGetValue.indexGetValue = 2;
+ xGetValue = new C('x');
+ yGetValue = 1;
+ xGetValue.indexGetValue = 2;
check(2, () => x[y] ??= bad(), ['x', 'y', 'x[1]']);
- xGetValue = new C('x'); yGetValue = 1; zGetValue = 2;
+ xGetValue = new C('x');
+ yGetValue = 1;
+ zGetValue = 2;
check(2, () => x[y] ??= z, ['x', 'y', 'x[1]', 'z', 'x[1]=2']);
// e1?.v ??= e2 is equivalent to ((x) => x == null ? null : x.v ??= e2)(e1).
check(null, () => x?.v ??= bad(), ['x']);
- xGetValue = new C('x'); xGetValue.vGetValue = 1;
+ xGetValue = new C('x');
+ xGetValue.vGetValue = 1;
check(1, () => x?.v ??= bad(), ['x', 'x.v']);
- xGetValue = new C('x'); yGetValue = 1;
+ xGetValue = new C('x');
+ yGetValue = 1;
check(1, () => x?.v ??= y, ['x', 'x.v', 'y', 'x.v=1']);
// C?.v ??= e2 is equivalent to C.v ??= e2.
C.xGetValue = 1;
check(1, () => C?.x ??= bad(), ['C.x']);
+ // ^
+ // [cfe] The class 'C' cannot be null.
h.C.xgetValue = 1;
// ^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SETTER
@@ -238,6 +273,10 @@
// [cfe] Getter not found: 'c'.
yGetValue = 1;
check(1, () => C?.x ??= y, ['C.x', 'y', 'C.x=1']);
+ // ^
+ // [cfe] The class 'C' cannot be null.
yGetValue = 1;
check(1, () => h.C?.x ??= y, ['h.C.x', 'y', 'h.C.x=1']);
+ // ^
+ // [cfe] The class 'C' cannot be null.
}
diff --git a/tests/language/null_aware/access_test.dart b/tests/language/null_aware/access_test.dart
index b2d1bc0..488a0df 100644
--- a/tests/language/null_aware/access_test.dart
+++ b/tests/language/null_aware/access_test.dart
@@ -32,36 +32,75 @@
// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
// C?.id is equivalent to C.id.
- { C.staticInt = 1; Expect.equals(1, C?.staticInt); }
- { h.C.staticInt = 1; Expect.equals(1, h.C?.staticInt); }
+ {
+ C.staticInt = 1;
+ Expect.equals(1, C?.staticInt);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ }
+ {
+ h.C.staticInt = 1;
+ Expect.equals(1, h.C?.staticInt);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ }
// The static type of e1?.d is the static type of e1.id.
- { int? i = new C(1)?.v; Expect.equals(1, i); }
- // ^
- // [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null.
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
- { String? s = new C(null)?.v; Expect.equals(null, s); }
- // ^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'int?' can't be assigned to a variable of type 'String?'.
- // ^
- // [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null.
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
- { C.staticInt = 1; int? i = C?.staticInt; Expect.equals(1, i); }
- { h.C.staticInt = 1; int? i = h.C?.staticInt; Expect.equals(1, i); }
- { C.staticInt = null; String? s = C?.staticInt; Expect.equals(null, s); }
- // ^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'int?' can't be assigned to a variable of type 'String?'.
- { h.C.staticNullable = null; String? s = h.C?.staticNullable; Expect.equals(null, s); }
- // ^^^^^^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'int?' can't be assigned to a variable of type 'String?'.
+ {
+ int? i = new C(1)?.v;
+ // ^
+ // [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null.
+ // ^^
+ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ Expect.equals(1, i);
+ }
+ {
+ String? s = new C(null)?.v;
+ // ^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'String?'.
+ // ^
+ // [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null.
+ // ^^
+ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ Expect.equals(null, s);
+ }
+ {
+ C.staticInt = 1;
+ int? i = C?.staticInt;
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(1, i);
+ }
+ {
+ h.C.staticInt = 1;
+ int? i = h.C?.staticInt;
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(1, i);
+ }
+ {
+ C.staticInt = null;
+ String? s = C?.staticInt;
+ // ^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // [cfe] The class 'C' cannot be null.
+ // ^
+ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'String?'.
+ Expect.equals(null, s);
+ }
+ {
+ h.C.staticNullable = null;
+ String? s = h.C?.staticNullable;
+ // ^^^^^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ // ^
+ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'String?'.
+ Expect.equals(null, s);
+ }
// Let T be the static type of e1 and let y be a fresh variable of type T.
// Exactly the same static warnings that would be caused by y.id are also
@@ -70,10 +109,13 @@
// ^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER
// [cfe] The getter 'bad' isn't defined for the class 'C'.
- { var b = new C(1) as B?; Expect.equals(1, b?.v); }
- // ^
- // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER
- // [cfe] The getter 'v' isn't defined for the class 'B'.
+ {
+ var b = new C(1) as B?;
+ Expect.equals(1, b?.v);
+ // ^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER
+ // [cfe] The getter 'v' isn't defined for the class 'B'.
+ }
// '?.' cannot be used to access toplevel properties in libraries imported via
// prefix.
diff --git a/tests/language/null_aware/assignment_test.dart b/tests/language/null_aware/assignment_test.dart
index d7bf2f4..1d7f71a 100644
--- a/tests/language/null_aware/assignment_test.dart
+++ b/tests/language/null_aware/assignment_test.dart
@@ -48,34 +48,84 @@
// e1?.v = e2 is equivalent to ((x) => x == null ? null : x.v = e2)(e1).
Expect.equals(null, nullC()?.v = bad());
- { C c = new C(1); Expect.equals(2, c?.v = 2); Expect.equals(2, c.v); }
- // ^
- // [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null.
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ {
+ C c = new C(1);
+ Expect.equals(2, c?.v = 2);
+ // ^
+ // [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null.
+ // ^^
+ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ Expect.equals(2, c.v);
+ }
// C?.v = e2 is equivalent to C.v = e2.
- { C.staticInt = 1; Expect.equals(2, C?.staticInt = 2); Expect.equals(2, C.staticInt); }
- { h.C.staticInt = 1; Expect.equals(2, h.C?.staticInt = 2); Expect.equals(2, h.C.staticInt); }
+ {
+ C.staticInt = 1;
+ Expect.equals(2, C?.staticInt = 2);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(2, C.staticInt);
+ }
+ {
+ h.C.staticInt = 1;
+ Expect.equals(2, h.C?.staticInt = 2);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(2, h.C.staticInt);
+ }
// The static type of e1?.v = e2 is the static type of e2.
- { var d = new D(new E()) as D?; G g = new G(); F? f = (d?.v = g); Expect.identical(f, g); }
- { var d = new D(new E()) as D?; E e = new G(); F? f = (d?.v = e); }
- // ^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // [cfe] A value of type 'E?' can't be assigned to a variable of type 'F?'.
- { D.staticE = new E(); G g = new G(); F? f = (D?.staticE = g); Expect.identical(f, g); }
- { h.D.staticE = new h.E(); h.G g = new h.G(); h.F? f = (h.D?.staticE = g); Expect.identical(f, g); }
- { D.staticE = new E(); E e = new G(); F? f = (D?.staticE = e); }
- // ^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'E' can't be assigned to a variable of type 'F?'.
- { h.D.staticE = new h.E(); h.E e = new h.G(); h.F f = (h.D?.staticE = e); }
- // ^^^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'E' can't be assigned to a variable of type 'F'.
+ {
+ var d = new D(new E()) as D?;
+ G g = new G();
+ F? f = (d?.v = g);
+ Expect.identical(f, g);
+ }
+ {
+ var d = new D(new E()) as D?;
+ E e = new G();
+ F? f = (d?.v = e);
+ // ^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // [cfe] A value of type 'E?' can't be assigned to a variable of type 'F?'.
+ }
+ {
+ D.staticE = new E();
+ G g = new G();
+ F? f = (D?.staticE = g);
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(f, g);
+ }
+ {
+ h.D.staticE = new h.E();
+ h.G g = new h.G();
+ h.F? f = (h.D?.staticE = g);
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(f, g);
+ }
+ {
+ D.staticE = new E();
+ E e = new G();
+ F? f = (D?.staticE = e);
+ // ^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'E' can't be assigned to a variable of type 'F?'.
+ }
+ {
+ h.D.staticE = new h.E();
+ h.E e = new h.G();
+ h.F f = (h.D?.staticE = e);
+ // ^^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'E' can't be assigned to a variable of type 'F'.
+ }
// Exactly the same errors that would be caused by e1.v = e2 are
// also generated in the case of e1?.v = e2.
@@ -83,34 +133,65 @@
// ^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SETTER
// [cfe] The setter 'bad' isn't defined for the class 'C'.
- { B b = new C(1); Expect.equals(2, b?.v = 2); }
- // ^
- // [cfe] Operand of null-aware operation '?.' has type 'B' which excludes null.
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
- // ^
- // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SETTER
- // [cfe] The setter 'v' isn't defined for the class 'B'.
+ {
+ B b = new C(1);
+ Expect.equals(2, b?.v = 2);
+ // ^
+ // [cfe] Operand of null-aware operation '?.' has type 'B' which excludes null.
+ // ^^
+ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ // ^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SETTER
+ // [cfe] The setter 'v' isn't defined for the class 'B'.
+ }
// e1?.v op= e2 is equivalent to ((x) => x?.v = x.v op e2)(e1).
Expect.equals(null, nullC()?.v += bad());
- { C c = new C(1); Expect.equals(3, c?.v += 2); Expect.equals(3, c.v); }
- // ^
- // [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null.
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ {
+ C c = new C(1);
+ Expect.equals(3, c?.v += 2);
+ // ^
+ // [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null.
+ // ^^
+ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ Expect.equals(3, c.v);
+ }
// C?.v op= e2 is equivalent to C.v op= e2.
- { C.staticInt = 1; Expect.equals(3, C?.staticInt += 2); Expect.equals(3, C?.staticInt); }
+ {
+ C.staticInt = 1;
+ Expect.equals(3, C?.staticInt += 2);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(3, C?.staticInt);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ }
// The static type of e1?.v op= e2 is the static type of e1.v op e2.
- { D d = new D(new E()); F? f = (d?.v += 1); Expect.identical(d.v, f); }
- // ^
- // [cfe] Operand of null-aware operation '?.' has type 'D' which excludes null.
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
- { D.staticE = new E(); F? f = (D?.staticE += 1); Expect.identical(D.staticE, f); }
- { h.D.staticE = new h.E(); h.F? f = (h.D?.staticE += 1); Expect.identical(h.D.staticE, f); }
+ {
+ D d = new D(new E());
+ F? f = (d?.v += 1);
+ // ^
+ // [cfe] Operand of null-aware operation '?.' has type 'D' which excludes null.
+ // ^^
+ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ Expect.identical(d.v, f);
+ }
+ {
+ D.staticE = new E();
+ F? f = (D?.staticE += 1);
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(D.staticE, f);
+ }
+ {
+ h.D.staticE = new h.E();
+ h.F? f = (h.D?.staticE += 1);
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(h.D.staticE, f);
+ }
// Let T be the static type of e1 and let y be a fresh variable of type T.
// Exactly the same errors that would be caused by y.v op e2 are
@@ -119,51 +200,79 @@
// ^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SETTER
// [cfe] The setter 'bad' isn't defined for the class 'C'.
- { B b = new C(1); b?.v += 2; }
- // ^
- // [cfe] Operand of null-aware operation '?.' has type 'B' which excludes null.
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
- // ^
- // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER
- // [cfe] The getter 'v' isn't defined for the class 'B'.
- // ^
- // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SETTER
- // [cfe] The setter 'v' isn't defined for the class 'B'.
- { D d = new D(new E()); F? f = (d?.v += nullC()); }
- // ^
- // [cfe] Operand of null-aware operation '?.' has type 'D' which excludes null.
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
- // ^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
- // [cfe] A value of type 'C?' can't be assigned to a variable of type 'int'.
- { D d = new D(new E()); H? h = (d?.v += 1); }
- // ^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // [cfe] A value of type 'G?' can't be assigned to a variable of type 'H?'.
- // ^
- // [cfe] Operand of null-aware operation '?.' has type 'D' which excludes null.
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
- { D.staticE = new E(); F? f = (D?.staticE += nullC()); }
- // ^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
- // [cfe] A value of type 'C?' can't be assigned to a variable of type 'int'.
- { h.D.staticE = new h.E(); h.F? f = (h.D?.staticE += h.nullC()); }
- // ^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
- // [cfe] A value of type 'C?' can't be assigned to a variable of type 'int'.
- { D.staticE = new E(); H? h = (D?.staticE += 1); }
- // ^^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
- { h.D.staticE = new h.E(); h.H? hh = (h.D?.staticE += 1); }
- // ^^^^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
+ {
+ B b = new C(1);
+ b?.v += 2;
+// ^
+// [cfe] Operand of null-aware operation '?.' has type 'B' which excludes null.
+// ^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ // ^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER
+ // [cfe] The getter 'v' isn't defined for the class 'B'.
+ // ^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SETTER
+ // [cfe] The setter 'v' isn't defined for the class 'B'.
+ }
+ {
+ D d = new D(new E());
+ F? f = (d?.v += nullC());
+ // ^
+ // [cfe] Operand of null-aware operation '?.' has type 'D' which excludes null.
+ // ^^
+ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ // ^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
+ // [cfe] A value of type 'C?' can't be assigned to a variable of type 'int'.
+ }
+ {
+ D d = new D(new E());
+ H? h = (d?.v += 1);
+ // ^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // [cfe] A value of type 'G?' can't be assigned to a variable of type 'H?'.
+ // ^
+ // [cfe] Operand of null-aware operation '?.' has type 'D' which excludes null.
+ // ^^
+ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ }
+ {
+ D.staticE = new E();
+ F? f = (D?.staticE += nullC());
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ // ^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
+ // [cfe] A value of type 'C?' can't be assigned to a variable of type 'int'.
+ }
+ {
+ h.D.staticE = new h.E();
+ h.F? f = (h.D?.staticE += h.nullC());
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ // ^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
+ // [cfe] A value of type 'C?' can't be assigned to a variable of type 'int'.
+ }
+ {
+ D.staticE = new E();
+ H? h = (D?.staticE += 1);
+ // ^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
+ }
+ {
+ h.D.staticE = new h.E();
+ h.H? hh = (h.D?.staticE += 1);
+ // ^^^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
+ }
// '?.' cannot be used to assign to toplevel properties in libraries imported
// via prefix.
diff --git a/tests/language/null_aware/increment_decrement_test.dart b/tests/language/null_aware/increment_decrement_test.dart
index 7e80690..d1916b6 100644
--- a/tests/language/null_aware/increment_decrement_test.dart
+++ b/tests/language/null_aware/increment_decrement_test.dart
@@ -42,111 +42,313 @@
// e1?.v++ is equivalent to ((x) => x == null ? null : x.v++)(e1).
Expect.equals(null, nullC()?.v++);
- { var c = new C(1) as C?; Expect.equals(1, c?.v++); Expect.equals(2, c!.v); }
+ {
+ var c = new C(1) as C?;
+ Expect.equals(1, c?.v++);
+ Expect.equals(2, c!.v);
+ }
// C?.v++ is equivalent to C.v++.
- { C.staticInt = 1; Expect.equals(1, C?.staticInt++); Expect.equals(2, C.staticInt); }
- { h.C.staticInt = 1; Expect.equals(1, h.C?.staticInt++); Expect.equals(2, h.C.staticInt); }
+ {
+ C.staticInt = 1;
+ Expect.equals(1, C?.staticInt++);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(2, C.staticInt);
+ }
+ {
+ h.C.staticInt = 1;
+ Expect.equals(1, h.C?.staticInt++);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(2, h.C.staticInt);
+ }
// The static type of e1?.v++ is the same as the static type of e1.v.
- { E e1 = new E(); var d = new D(e1) as D?; E? e2 = d?.v++; Expect.identical(e1, e2); }
- { G g = new G(); var d = new D(g) as D?; F? f = d?.v++; Expect.identical(f, g); }
- // ^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // [cfe] A value of type 'E?' can't be assigned to a variable of type 'F?'.
- { E e1 = new E(); D.staticE = e1; E? e2 = D?.staticE++; Expect.identical(e1, e2); }
- { h.E e1 = new h.E(); h.D.staticE = e1; h.E? e2 = h.D?.staticE++; Expect.identical(e1, e2); }
- { G g = new G(); D.staticE = g; F? f = D?.staticE++; Expect.identical(f, g); }
- // ^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'E' can't be assigned to a variable of type 'F?'.
- { h.G g = new h.G(); h.D.staticE = g; h.F? f = h.D?.staticE++; Expect.identical(f, g); }
- // ^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'E' can't be assigned to a variable of type 'F?'.
+ {
+ E e1 = new E();
+ var d = new D(e1) as D?;
+ E? e2 = d?.v++;
+ Expect.identical(e1, e2);
+ }
+ {
+ G g = new G();
+ var d = new D(g) as D?;
+ F? f = d?.v++;
+ // ^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // [cfe] A value of type 'E?' can't be assigned to a variable of type 'F?'.
+ Expect.identical(f, g);
+ }
+ {
+ E e1 = new E();
+ D.staticE = e1;
+ E? e2 = D?.staticE++;
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(e1, e2);
+ }
+ {
+ h.E e1 = new h.E();
+ h.D.staticE = e1;
+ h.E? e2 = h.D?.staticE++;
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(e1, e2);
+ }
+ {
+ G g = new G();
+ D.staticE = g;
+ F? f = D?.staticE++;
+ // ^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'E' can't be assigned to a variable of type 'F?'.
+ Expect.identical(f, g);
+ }
+ {
+ h.G g = new h.G();
+ h.D.staticE = g;
+ h.F? f = h.D?.staticE++;
+ // ^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'E' can't be assigned to a variable of type 'F?'.
+ Expect.identical(f, g);
+ }
// e1?.v-- is equivalent to ((x) => x == null ? null : x.v--)(e1).
Expect.equals(null, nullC()?.v--);
- { var c = new C(1) as C?; Expect.equals(1, c?.v--); Expect.equals(0, c!.v); }
+ {
+ var c = new C(1) as C?;
+ Expect.equals(1, c?.v--);
+ Expect.equals(0, c!.v);
+ }
// C?.v-- is equivalent to C.v--.
- { C.staticInt = 1; Expect.equals(1, C?.staticInt--); Expect.equals(0, C.staticInt); }
- { h.C.staticInt = 1; Expect.equals(1, h.C?.staticInt--); Expect.equals(0, h.C.staticInt); }
+ {
+ C.staticInt = 1;
+ Expect.equals(1, C?.staticInt--);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(0, C.staticInt);
+ }
+ {
+ h.C.staticInt = 1;
+ Expect.equals(1, h.C?.staticInt--);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(0, h.C.staticInt);
+ }
// The static type of e1?.v-- is the same as the static type of e1.v.
- { E e1 = new E(); var d = new D(e1) as D?; E? e2 = d?.v--; Expect.identical(e1, e2); }
- { G g = new G(); var d = new D(g) as D?; F? f = d?.v--; Expect.identical(f, g); }
- // ^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // [cfe] A value of type 'E?' can't be assigned to a variable of type 'F?'.
- { E e1 = new E(); D.staticE = e1; E? e2 = D?.staticE--; Expect.identical(e1, e2); }
- { h.E e1 = new h.E(); h.D.staticE = e1; h.E? e2 = h.D?.staticE--; Expect.identical(e1, e2); }
- { G g = new G(); D.staticE = g; F? f = D?.staticE--; Expect.identical(f, g); }
- // ^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'E' can't be assigned to a variable of type 'F?'.
- { h.G g = new h.G(); h.D.staticE = g; h.F? f = h.D?.staticE--; Expect.identical(f, g); }
- // ^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'E' can't be assigned to a variable of type 'F?'.
+ {
+ E e1 = new E();
+ var d = new D(e1) as D?;
+ E? e2 = d?.v--;
+ Expect.identical(e1, e2);
+ }
+ {
+ G g = new G();
+ var d = new D(g) as D?;
+ F? f = d?.v--;
+ // ^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // [cfe] A value of type 'E?' can't be assigned to a variable of type 'F?'.
+ Expect.identical(f, g);
+ }
+ {
+ E e1 = new E();
+ D.staticE = e1;
+ E? e2 = D?.staticE--;
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(e1, e2);
+ }
+ {
+ h.E e1 = new h.E();
+ h.D.staticE = e1;
+ h.E? e2 = h.D?.staticE--;
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(e1, e2);
+ }
+ {
+ G g = new G();
+ D.staticE = g;
+ F? f = D?.staticE--;
+ // ^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'E' can't be assigned to a variable of type 'F?'.
+ Expect.identical(f, g);
+ }
+ {
+ h.G g = new h.G();
+ h.D.staticE = g;
+ h.F? f = h.D?.staticE--;
+ // ^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'E' can't be assigned to a variable of type 'F?'.
+ Expect.identical(f, g);
+ }
// ++e1?.v is equivalent to e1?.v += 1.
Expect.equals(null, ++nullC()?.v);
- { var c = new C(1) as C?; Expect.equals(2, ++c?.v); Expect.equals(2, c!.v); }
+ {
+ var c = new C(1) as C?;
+ Expect.equals(2, ++c?.v);
+ Expect.equals(2, c!.v);
+ }
// ++C?.v is equivalent to C?.v += 1.
- { C.staticInt = 1; Expect.equals(2, ++C?.staticInt); Expect.equals(2, C.staticInt); }
- { h.C.staticInt = 1; Expect.equals(2, ++h.C?.staticInt); Expect.equals(2, h.C.staticInt); }
+ {
+ C.staticInt = 1;
+ Expect.equals(2, ++C?.staticInt);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(2, C.staticInt);
+ }
+ {
+ h.C.staticInt = 1;
+ Expect.equals(2, ++h.C?.staticInt);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(2, h.C.staticInt);
+ }
// The static type of ++e1?.v is the same as the static type of e1.v + 1.
- { var d = new D(new E()) as D?; F? f = ++d?.v; Expect.identical(d!.v, f); }
- { var d = new D(new E()) as D?; H? h = ++d?.v; Expect.identical(d!.v, h); }
- // ^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'G?' can't be assigned to a variable of type 'H?'.
- { D.staticE = new E(); F? f = ++D?.staticE; Expect.identical(D.staticE, f); }
- { h.D.staticE = new h.E(); h.F? f = ++h.D?.staticE; Expect.identical(h.D.staticE, f); }
- { D.staticE = new E(); H? h = ++D?.staticE; Expect.identical(D.staticE, h); }
- // ^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
- { h.D.staticE = new h.E(); h.H? hh = ++h.D?.staticE; Expect.identical(h.D.staticE, hh); }
- // ^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
+ {
+ var d = new D(new E()) as D?;
+ F? f = ++d?.v;
+ Expect.identical(d!.v, f);
+ }
+ {
+ var d = new D(new E()) as D?;
+ H? h = ++d?.v;
+ // ^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] A value of type 'G?' can't be assigned to a variable of type 'H?'.
+ Expect.identical(d!.v, h);
+ }
+ {
+ D.staticE = new E();
+ F? f = ++D?.staticE;
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(D.staticE, f);
+ }
+ {
+ h.D.staticE = new h.E();
+ h.F? f = ++h.D?.staticE;
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(h.D.staticE, f);
+ }
+ {
+ D.staticE = new E();
+ H? h = ++D?.staticE;
+ // ^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
+ Expect.identical(D.staticE, h);
+ }
+ {
+ h.D.staticE = new h.E();
+ h.H? hh = ++h.D?.staticE;
+ // ^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
+ Expect.identical(h.D.staticE, hh);
+ }
// --e1?.v is equivalent to e1?.v -= 1.
Expect.equals(null, --nullC()?.v);
- { var c = new C(1) as C?; Expect.equals(0, --c?.v); Expect.equals(0, c!.v); }
+ {
+ var c = new C(1) as C?;
+ Expect.equals(0, --c?.v);
+ Expect.equals(0, c!.v);
+ }
// --C?.v is equivalent to C?.v -= 1.
- { C.staticInt = 1; Expect.equals(0, --C?.staticInt); Expect.equals(0, C.staticInt); }
- { h.C.staticInt = 1; Expect.equals(0, --h.C?.staticInt); Expect.equals(0, h.C.staticInt); }
+ {
+ C.staticInt = 1;
+ Expect.equals(0, --C?.staticInt);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(0, C.staticInt);
+ }
+ {
+ h.C.staticInt = 1;
+ Expect.equals(0, --h.C?.staticInt);
+ // ^
+ // [cfe] The class 'C' cannot be null.
+ Expect.equals(0, h.C.staticInt);
+ }
// The static type of --e1?.v is the same as the static type of e1.v - 1.
- { var d = new D(new E()) as D?; F? f = --d?.v; Expect.identical(d!.v, f); }
- { var d = new D(new E()) as D?; H? h = --d?.v; Expect.identical(d!.v, h); }
- // ^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'G?' can't be assigned to a variable of type 'H?'.
- { D.staticE = new E(); F? f = --D?.staticE; Expect.identical(D.staticE, f); }
- { h.D.staticE = new h.E(); h.F? f = --h.D?.staticE; Expect.identical(h.D.staticE, f); }
- { D.staticE = new E(); H? h = --D?.staticE; Expect.identical(D.staticE, h); }
- // ^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
- { h.D.staticE = new h.E(); h.H? hh = --h.D?.staticE; Expect.identical(h.D.staticE, hh); }
- // ^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
- // ^
- // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
+ {
+ var d = new D(new E()) as D?;
+ F? f = --d?.v;
+ Expect.identical(d!.v, f);
+ }
+ {
+ var d = new D(new E()) as D?;
+ H? h = --d?.v;
+ // ^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] A value of type 'G?' can't be assigned to a variable of type 'H?'.
+ Expect.identical(d!.v, h);
+ }
+ {
+ D.staticE = new E();
+ F? f = --D?.staticE;
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(D.staticE, f);
+ }
+ {
+ h.D.staticE = new h.E();
+ h.F? f = --h.D?.staticE;
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ Expect.identical(h.D.staticE, f);
+ }
+ {
+ D.staticE = new E();
+ H? h = --D?.staticE;
+ // ^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
+ Expect.identical(D.staticE, h);
+ }
+ {
+ h.D.staticE = new h.E();
+ h.H? hh = --h.D?.staticE;
+ // ^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] The class 'D' cannot be null.
+ // ^
+ // [cfe] A value of type 'G' can't be assigned to a variable of type 'H?'.
+ Expect.identical(h.D.staticE, hh);
+ }
}
diff --git a/tests/language/super/conditional_operator_test.dart b/tests/language/super/conditional_operator_test.dart
index dcbc633..5ae030d 100644
--- a/tests/language/super/conditional_operator_test.dart
+++ b/tests/language/super/conditional_operator_test.dart
@@ -51,15 +51,15 @@
-super?.field;
// ^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
- // ^^
- // [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
- // [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
+// ^^
+// [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
+// [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
~super?.field;
// ^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
- // ^^
- // [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
- // [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
+// ^^
+// [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
+// [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
!super?.field;
// ^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_NEGATION_EXPRESSION
@@ -77,26 +77,38 @@
// [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
// [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
super?.method();
+// ^
+// [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
// [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
1 * super?.method();
+ // ^
+ // [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
// [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
-super?.method();
+// ^
+// [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
// [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
~super?.method();
+// ^
+// [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
// [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
!super?.method();
+// ^
+// [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
// [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
--super?.method();
+ //^
+ // [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
// [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
@@ -105,6 +117,8 @@
// ^
// [analyzer] SYNTACTIC_ERROR.MISSING_ASSIGNABLE_SELECTOR
++super?.method();
+ //^
+ // [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] SYNTACTIC_ERROR.INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER
// [cfe] The operator '?.' cannot be used with 'super' because 'super' cannot be null.
diff --git a/tests/language/this/conditional_operator_runtime_test.dart b/tests/language/this/conditional_operator_runtime_test.dart
index cf48394..ccecb55 100644
--- a/tests/language/this/conditional_operator_runtime_test.dart
+++ b/tests/language/this/conditional_operator_runtime_test.dart
@@ -14,21 +14,27 @@
var field = 1;
method() => 1;
- B.forward()
-
- ;
+ B.forward();
test() {
this?.field = 1;
+// ^
+// [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
this?.field += 1;
+// ^
+// [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
this?.field;
+// ^
+// [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
this?.method();
+// ^
+// [cfe] The receiver 'this' cannot be null.
// ^^
// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
}
diff --git a/tests/language/this/conditional_operator_test.dart b/tests/language/this/conditional_operator_test.dart
index 5254ea2..cda4689 100644
--- a/tests/language/this/conditional_operator_test.dart
+++ b/tests/language/this/conditional_operator_test.dart
@@ -30,17 +30,25 @@
test() {
this?.field = 1;
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+// ^
+// [cfe] The receiver 'this' cannot be null.
+// ^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
this?.field += 1;
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+// ^
+// [cfe] The receiver 'this' cannot be null.
+// ^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
this?.field;
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+// ^
+// [cfe] The receiver 'this' cannot be null.
+// ^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
this?.method();
- // ^^
- // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+// ^
+// [cfe] The receiver 'this' cannot be null.
+// ^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
}
}
diff --git a/tools/VERSION b/tools/VERSION
index dade2bf..5634bb0 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 11
PATCH 0
-PRERELEASE 222
+PRERELEASE 223
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 6f1f168..4490eea 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -941,7 +941,8 @@
"corelib",
"ffi",
"language",
- "lib"
+ "lib",
+ "service"
]
},
{
@@ -1114,6 +1115,7 @@
"language",
"lib",
"samples",
+ "service",
"standalone",
"utils",
"vm"
@@ -1439,8 +1441,7 @@
"vm-kernel-win-debug-ia32",
"vm-kernel-win-debug-x64",
"vm-kernel-win-product-x64",
- "vm-kernel-win-release-ia32",
- "vm-kernel-win-release-x64"
+ "vm-kernel-win-release-ia32"
],
"meta": {
"description": "This configuration is for the kernel builder group."
@@ -1499,6 +1500,7 @@
"language",
"lib",
"samples",
+ "service",
"standalone",
"utils",
"vm"
@@ -1551,7 +1553,8 @@
"vm-kernel-linux-debug-x64",
"vm-kernel-mac-product-x64",
"vm-kernel-mac-release-x64",
- "vm-kernel-mac-debug-x64"
+ "vm-kernel-mac-debug-x64",
+ "vm-kernel-win-release-x64"
],
"meta": {
"description": "This configuration is for the co19_2 kernel builder group."
@@ -2138,6 +2141,8 @@
"arguments": [
"-ndart2js-hostasserts-linux-ia32-d8",
"--dart2js-batch",
+ "--enable-experiment=non-nullable",
+ "--dart2js-options=--no-sound-null-safety",
"observatory_ui"
]
},
@@ -2210,6 +2215,8 @@
"-ndart2js-${system}-${runtime}",
"--dart2js-batch",
"--reset-browser-configuration",
+ "--enable-experiment=non-nullable",
+ "--dart2js-options=--no-sound-null-safety",
"observatory_ui"
]
},
@@ -2262,6 +2269,8 @@
"arguments": [
"-ndart2js-minified-linux-d8",
"--dart2js-batch",
+ "--enable-experiment=non-nullable",
+ "--dart2js-options=--no-sound-null-safety",
"observatory_ui"
]
},
@@ -2334,6 +2343,8 @@
"-ndart2js-minified-csp-linux-chrome",
"--dart2js-batch",
"--reset-browser-configuration",
+ "--enable-experiment=non-nullable",
+ "--dart2js-options=--no-sound-null-safety",
"observatory_ui"
]
},
@@ -2732,6 +2743,7 @@
"ffi",
"language",
"lib",
+ "service",
"standalone"
]
},
@@ -2835,6 +2847,7 @@
"script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
"arguments": [
"--fatal-warnings",
+ "--enable-experiment=non-nullable",
"pkg/compiler"
]
},
@@ -3012,7 +3025,7 @@
"name": "analyze runtime/observatory",
"script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
"arguments": [
- "--fatal-warnings",
+ "--enable-experiment=non-nullable",
"runtime/observatory"
]
},