Version 2.14.0-274.0.dev
Merge commit 'adcef136a69aa36fca0236ac83b2515d847a6901' into 'dev'
diff --git a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
index 8e46598..b43cfbc 100644
--- a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
@@ -168,7 +168,8 @@
for (var context in contexts) {
var pathContext = context.contextRoot.resourceProvider.pathContext;
for (var path in context.contextRoot.analyzedFiles()) {
- if (!file_paths.isDart(pathContext, path)) {
+ if (!file_paths.isDart(pathContext, path) ||
+ file_paths.isGenerated(path)) {
continue;
}
var library = await context.currentSession.getResolvedLibrary2(path);
diff --git a/pkg/analyzer/lib/src/context/source.dart b/pkg/analyzer/lib/src/context/source.dart
index 86b91e6..554eb1a 100644
--- a/pkg/analyzer/lib/src/context/source.dart
+++ b/pkg/analyzer/lib/src/context/source.dart
@@ -11,6 +11,7 @@
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_dart.dart' as utils;
import 'package:analyzer/src/source/package_map_resolver.dart';
+import 'package:analyzer/src/util/file_paths.dart' as file_paths;
import 'package:analyzer/src/workspace/package_build.dart';
/// Return `true` if the given [source] refers to a file that is assumed to be
@@ -19,22 +20,7 @@
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;
+ return file_paths.isGenerated(source.fullName);
}
/// Instances of the class `SourceFactory` resolve possibly relative URI's
diff --git a/pkg/analyzer/lib/src/util/file_paths.dart b/pkg/analyzer/lib/src/util/file_paths.dart
index 6420a36..08b1e22 100644
--- a/pkg/analyzer/lib/src/util/file_paths.dart
+++ b/pkg/analyzer/lib/src/util/file_paths.dart
@@ -4,7 +4,7 @@
/// The set of constants and utilities to check file paths.
///
-/// The recommended import prefix in `file_paths`.
+/// The recommended import prefix is `file_paths`.
import 'package:path/path.dart' as p;
/// The file name used for analysis options files.
@@ -70,6 +70,26 @@
return pathContext.basename(path) == fixDataYaml;
}
+/// Return `true` if the given [path] refers to a file that is assumed to be
+/// generated.
+bool isGenerated(String path) {
+ // TODO(brianwilkerson) Generalize this mechanism.
+ const List<String> suffixes = <String>[
+ '.g.dart',
+ '.pb.dart',
+ '.pbenum.dart',
+ '.pbserver.dart',
+ '.pbjson.dart',
+ '.template.dart'
+ ];
+ for (var suffix in suffixes) {
+ if (path.endsWith(suffix)) {
+ return true;
+ }
+ }
+ return false;
+}
+
/// Return `true` if [path] is a `.dart_tool/package_config.json` file.
bool isPackageConfigJson(p.Context pathContext, String path) {
var components = pathContext.split(path);
diff --git a/tools/VERSION b/tools/VERSION
index f2fc2a46..65fd8e1 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 273
+PRERELEASE 274
PRERELEASE_PATCH 0
\ No newline at end of file