Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d189db6

Browse files
author
Dart CI
committed
Version 2.12.0-67.0.dev
Merge commit '5bf19170ba83c2c31ab3668bd728bf4221fb5d4d' into 'dev'
2 parents 1adf3d5 + 5bf1917 commit d189db6

10 files changed

Lines changed: 64 additions & 11 deletions

File tree

pkg/analysis_server/lib/src/computer/import_elements_computer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class ImportElementsComputer {
341341
/// [importedElements]. They will match if they import the same library using
342342
/// the same prefix.
343343
bool _matches(ImportDirective import, ImportedElements importedElements) {
344-
var library = (import.element as ImportElement).importedLibrary;
344+
var library = import.element.importedLibrary;
345345
return library != null &&
346346
library.source.fullName == importedElements.path &&
347347
(import.prefix?.name ?? '') == importedElements.prefix;

pkg/analysis_server/lib/src/services/correction/dart/import_add_show.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ImportAddShow extends CorrectionProducer {
3030
return;
3131
}
3232
// prepare whole import namespace
33-
ImportElement importElement = importDirective.element;
33+
var importElement = importDirective.element;
3434
if (importElement == null) {
3535
return;
3636
}

pkg/analyzer/lib/dart/ast/ast.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,10 @@ abstract class EnumDeclaration implements NamedCompilationUnitMember {
19781978
/// [Annotation] 'export' [StringLiteral] [Combinator]* ';'
19791979
///
19801980
/// Clients may not extend, implement or mix-in this class.
1981-
abstract class ExportDirective implements NamespaceDirective {}
1981+
abstract class ExportDirective implements NamespaceDirective {
1982+
@override
1983+
ExportElement get element;
1984+
}
19821985

19831986
/// A node that represents an expression.
19841987
///
@@ -3223,6 +3226,9 @@ abstract class ImportDirective implements NamespaceDirective {
32233226
/// Set the token representing the 'deferred' keyword to the given [token].
32243227
set deferredKeyword(Token token);
32253228

3229+
@override
3230+
ImportElement get element;
3231+
32263232
/// Return the prefix to be used with the imported names, or `null` if the
32273233
/// imported names are not prefixed.
32283234
SimpleIdentifier get prefix;

pkg/analyzer/lib/src/error/best_practices_verifier.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
928928
return;
929929
}
930930

931-
var importElement = node.element as ImportElement;
931+
var importElement = node.element;
932932
var importedLibrary = importElement.importedLibrary;
933933
if (importedLibrary == null || importedLibrary.isNonNullableByDefault) {
934934
return;

pkg/analyzer/lib/src/generated/error_verifier.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void> {
569569

570570
@override
571571
void visitExportDirective(ExportDirective node) {
572-
var exportElement = node.element as ExportElement;
572+
var exportElement = node.element;
573573
if (exportElement != null) {
574574
LibraryElement exportedLibrary = exportElement.exportedLibrary;
575575
_checkForAmbiguousExport(node, exportElement, exportedLibrary);
@@ -824,7 +824,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void> {
824824

825825
@override
826826
void visitImportDirective(ImportDirective node) {
827-
var importElement = node.element as ImportElement;
827+
var importElement = node.element;
828828
if (node.prefix != null) {
829829
_checkForBuiltInIdentifierAsName(
830830
node.prefix, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_PREFIX_NAME);
@@ -2410,7 +2410,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void> {
24102410
return;
24112411
}
24122412

2413-
var element = node.element as ExportElement;
2413+
var element = node.element;
24142414
// TODO(scheglov) Expose from ExportElement.
24152415
var namespace =
24162416
NamespaceBuilder().createExportNamespaceForDirective(element);

pkg/analyzer/test/src/dart/analysis/driver_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3325,7 +3325,7 @@ var v = 0
33253325

33263326
ImportElement _getImportElement(CompilationUnit unit, int directiveIndex) {
33273327
var import = unit.directives[directiveIndex] as ImportDirective;
3328-
return import.element as ImportElement;
3328+
return import.element;
33293329
}
33303330

33313331
Source _getImportSource(CompilationUnit unit, int directiveIndex) {

pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor<void> {
277277

278278
@override
279279
void visitExportDirective(ExportDirective node) {
280-
var exportElement = node.element as ExportElement;
280+
var exportElement = node.element;
281281
if (exportElement != null) {
282282
Element libraryElement = exportElement.exportedLibrary;
283283
_addUriDirectiveRegion(node, libraryElement);
@@ -287,7 +287,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor<void> {
287287

288288
@override
289289
void visitImportDirective(ImportDirective node) {
290-
var importElement = node.element as ImportElement;
290+
var importElement = node.element;
291291
if (importElement != null) {
292292
Element libraryElement = importElement.importedLibrary;
293293
_addUriDirectiveRegion(node, libraryElement);

pkg/dartdev/doc/dart-fix.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# `dart fix`
2+
3+
## What is it?
4+
5+
`dart fix` is a command line tool and part of the regular `dart` tool. It is used
6+
to batch apply fixes for analysis issues.
7+
8+
## How does it work?
9+
10+
`dart fix` runs over your project looking for analysis issues. For each issue
11+
it checks whether there is an automated fix that can be applied. These fixes
12+
are generaly either in response to a lint or hint in your code, or part of
13+
upgrading your source to newer package APIs.
14+
15+
For the first type of change, the fixes are generally in response to the set
16+
of lints and analysis configuration specified in your [analysis_options.yaml]
17+
file.
18+
19+
The second type of change - upgrading to newer package APIs - is performed
20+
based on API changes defined for specific packages. This declarative definition
21+
of the API changes lives in a `fix_data.yaml` file in the package's `lib/`
22+
directory (documentation forthcoming).
23+
24+
## Command line usage
25+
26+
```
27+
Fix Dart source code.
28+
29+
This tool looks for and fixes analysis issues that have associated automated
30+
fixes or issues that have associated package API migration information.
31+
32+
To use the tool, run one of:
33+
- 'dart fix --dry-run' for a preview of the proposed changes for a project
34+
- 'dart fix --apply' to apply the changes
35+
36+
Usage: dart fix [arguments]
37+
-h, --help Print this usage information.
38+
-n, --dry-run Show which files would be modified but make no changes.
39+
--apply Apply the proposed changes.
40+
41+
Run "dart help" to see global options.
42+
```
43+
44+
[analysis_options.yaml]: https://dart.dev/guides/language/analysis-options

pkg/kernel/lib/transformations/track_widget_constructor_locations.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ class WidgetCreatorTracker {
381381
isFinal: true,
382382
getterReference: clazz.reference.canonicalName
383383
?.getChildFromFieldWithName(fieldName)
384+
?.reference,
385+
setterReference: clazz.reference.canonicalName
386+
?.getChildFromFieldSetterWithName(fieldName)
384387
?.reference);
385388
clazz.addField(locationField);
386389

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 12
2929
PATCH 0
30-
PRERELEASE 66
30+
PRERELEASE 67
3131
PRERELEASE_PATCH 0

0 commit comments

Comments
 (0)