Version 2.12.0-67.0.dev
Merge commit '5bf19170ba83c2c31ab3668bd728bf4221fb5d4d' into 'dev'
diff --git a/pkg/analysis_server/lib/src/computer/import_elements_computer.dart b/pkg/analysis_server/lib/src/computer/import_elements_computer.dart
index 7f5a9a4..2229f6f 100644
--- a/pkg/analysis_server/lib/src/computer/import_elements_computer.dart
+++ b/pkg/analysis_server/lib/src/computer/import_elements_computer.dart
@@ -341,7 +341,7 @@
/// [importedElements]. They will match if they import the same library using
/// the same prefix.
bool _matches(ImportDirective import, ImportedElements importedElements) {
- var library = (import.element as ImportElement).importedLibrary;
+ var library = import.element.importedLibrary;
return library != null &&
library.source.fullName == importedElements.path &&
(import.prefix?.name ?? '') == importedElements.prefix;
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 306312f..2b53b99 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
@@ -30,7 +30,7 @@
return;
}
// prepare whole import namespace
- ImportElement importElement = importDirective.element;
+ var importElement = importDirective.element;
if (importElement == null) {
return;
}
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 9f49d07..fdbd60f 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -1978,7 +1978,10 @@
/// [Annotation] 'export' [StringLiteral] [Combinator]* ';'
///
/// Clients may not extend, implement or mix-in this class.
-abstract class ExportDirective implements NamespaceDirective {}
+abstract class ExportDirective implements NamespaceDirective {
+ @override
+ ExportElement get element;
+}
/// A node that represents an expression.
///
@@ -3223,6 +3226,9 @@
/// Set the token representing the 'deferred' keyword to the given [token].
set deferredKeyword(Token token);
+ @override
+ ImportElement get element;
+
/// Return the prefix to be used with the imported names, or `null` if the
/// imported names are not prefixed.
SimpleIdentifier get prefix;
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index 4fc82c5..f7927d6 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -928,7 +928,7 @@
return;
}
- var importElement = node.element as ImportElement;
+ var importElement = node.element;
var importedLibrary = importElement.importedLibrary;
if (importedLibrary == null || importedLibrary.isNonNullableByDefault) {
return;
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 69814c4..4c70fa8 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -569,7 +569,7 @@
@override
void visitExportDirective(ExportDirective node) {
- var exportElement = node.element as ExportElement;
+ var exportElement = node.element;
if (exportElement != null) {
LibraryElement exportedLibrary = exportElement.exportedLibrary;
_checkForAmbiguousExport(node, exportElement, exportedLibrary);
@@ -824,7 +824,7 @@
@override
void visitImportDirective(ImportDirective node) {
- var importElement = node.element as ImportElement;
+ var importElement = node.element;
if (node.prefix != null) {
_checkForBuiltInIdentifierAsName(
node.prefix, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_PREFIX_NAME);
@@ -2410,7 +2410,7 @@
return;
}
- var element = node.element as ExportElement;
+ var element = node.element;
// TODO(scheglov) Expose from ExportElement.
var namespace =
NamespaceBuilder().createExportNamespaceForDirective(element);
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 16cf839..e47b257 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -3325,7 +3325,7 @@
ImportElement _getImportElement(CompilationUnit unit, int directiveIndex) {
var import = unit.directives[directiveIndex] as ImportDirective;
- return import.element as ImportElement;
+ return import.element;
}
Source _getImportSource(CompilationUnit unit, int directiveIndex) {
diff --git a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
index b5f2d6c..1fe66bc 100644
--- a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
+++ b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
@@ -277,7 +277,7 @@
@override
void visitExportDirective(ExportDirective node) {
- var exportElement = node.element as ExportElement;
+ var exportElement = node.element;
if (exportElement != null) {
Element libraryElement = exportElement.exportedLibrary;
_addUriDirectiveRegion(node, libraryElement);
@@ -287,7 +287,7 @@
@override
void visitImportDirective(ImportDirective node) {
- var importElement = node.element as ImportElement;
+ var importElement = node.element;
if (importElement != null) {
Element libraryElement = importElement.importedLibrary;
_addUriDirectiveRegion(node, libraryElement);
diff --git a/pkg/dartdev/doc/dart-fix.md b/pkg/dartdev/doc/dart-fix.md
new file mode 100644
index 0000000..95dbf1a
--- /dev/null
+++ b/pkg/dartdev/doc/dart-fix.md
@@ -0,0 +1,44 @@
+# `dart fix`
+
+## What is it?
+
+`dart fix` is a command line tool and part of the regular `dart` tool. It is used
+to batch apply fixes for analysis issues.
+
+## How does it work?
+
+`dart fix` runs over your project looking for analysis issues. For each issue
+it checks whether there is an automated fix that can be applied. These fixes
+are generaly either in response to a lint or hint in your code, or part of
+upgrading your source to newer package APIs.
+
+For the first type of change, the fixes are generally in response to the set
+of lints and analysis configuration specified in your [analysis_options.yaml]
+file.
+
+The second type of change - upgrading to newer package APIs - is performed
+based on API changes defined for specific packages. This declarative definition
+of the API changes lives in a `fix_data.yaml` file in the package's `lib/`
+directory (documentation forthcoming).
+
+## Command line usage
+
+```
+Fix Dart source code.
+
+This tool looks for and fixes analysis issues that have associated automated
+fixes or issues that have associated package API migration information.
+
+To use the tool, run one of:
+- 'dart fix --dry-run' for a preview of the proposed changes for a project
+- 'dart fix --apply' to apply the changes
+
+Usage: dart fix [arguments]
+-h, --help Print this usage information.
+-n, --dry-run Show which files would be modified but make no changes.
+ --apply Apply the proposed changes.
+
+Run "dart help" to see global options.
+```
+
+[analysis_options.yaml]: https://dart.dev/guides/language/analysis-options
diff --git a/pkg/kernel/lib/transformations/track_widget_constructor_locations.dart b/pkg/kernel/lib/transformations/track_widget_constructor_locations.dart
index 12901a9..f68a5b6 100644
--- a/pkg/kernel/lib/transformations/track_widget_constructor_locations.dart
+++ b/pkg/kernel/lib/transformations/track_widget_constructor_locations.dart
@@ -381,6 +381,9 @@
isFinal: true,
getterReference: clazz.reference.canonicalName
?.getChildFromFieldWithName(fieldName)
+ ?.reference,
+ setterReference: clazz.reference.canonicalName
+ ?.getChildFromFieldSetterWithName(fieldName)
?.reference);
clazz.addField(locationField);
diff --git a/tools/VERSION b/tools/VERSION
index e3c9cca..af266e6 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 12
PATCH 0
-PRERELEASE 66
+PRERELEASE 67
PRERELEASE_PATCH 0
\ No newline at end of file