Version 2.19.0-53.0.dev

Merge commit 'e9ee4621cbca3fe73c0400e2ba0cbf3e22c201a2' into 'dev'
diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart
index f451cf8..f90a02e 100644
--- a/pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart
+++ b/pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart
@@ -134,6 +134,8 @@
           path: file,
           uri: Uri.file(file),
           lineInfo: lineInfo,
+          isAugmentation: false,
+          isLibrary: true,
           isPart: false,
           errors: errors,
         );
@@ -240,6 +242,8 @@
           path: file,
           uri: Uri.file(file),
           lineInfo: lineInfo,
+          isAugmentation: false,
+          isLibrary: true,
           isPart: false,
           errors: errors,
         );
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 388e79e..47a4e0c 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
@@ -256,12 +256,6 @@
         unit = resolvedResult.unit,
         utils = CorrectionUtils(resolvedResult);
 
-  /// Return `true` if the lint with the given [name] is enabled.
-  bool isLintEnabled(String name) {
-    var analysisOptions = session.analysisContext.analysisOptions;
-    return analysisOptions.isLintEnabled(name);
-  }
-
   static CorrectionProducerContext? create({
     required ResolvedUnitResult resolvedResult,
     required ChangeWorkspace workspace,
@@ -500,11 +494,6 @@
     return _context.dartFixContext!.getTopLevelDeclarations(baseName);
   }
 
-  /// Return `true` the lint with the given [name] is enabled.
-  bool isLintEnabled(String name) {
-    return _context.isLintEnabled(name);
-  }
-
   /// Return `true` if the selection covers an operator of the given
   /// [binaryExpression].
   bool isOperatorSelected(BinaryExpression binaryExpression) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart
index 82c63b7..a37027c 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart
@@ -5,7 +5,6 @@
 import 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
-import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/ast/syntactic_entity.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
@@ -42,8 +41,7 @@
         if (executable.returnType != null) {
           return;
         }
-        if (isLintEnabled(LintNames.avoid_return_types_on_setters) &&
-            executable.isSetter) {
+        if (executable.isSetter) {
           return;
         }
         insertBeforeEntity = executable.propertyKeyword ?? executable.name;
@@ -52,8 +50,7 @@
         if (executable.returnType != null) {
           return;
         }
-        if (isLintEnabled(LintNames.avoid_return_types_on_setters) &&
-            executable.isSetter) {
+        if (executable.isSetter) {
           return;
         }
         insertBeforeEntity = executable.propertyKeyword ?? executable.name;
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index bd14c30..8fc4dc7 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -7,7 +7,6 @@
 import 'package:_fe_analyzer_shared/src/scanner/token.dart';
 import 'package:analysis_server/src/protocol_server.dart'
     show doSourceChange_addElementEdit;
-import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analysis_server/src/utilities/extensions/ast.dart';
 import 'package:analysis_server/src/utilities/strings.dart';
 import 'package:analyzer/dart/analysis/features.dart';
@@ -1069,8 +1068,8 @@
 
   InsertionLocation? prepareNewConstructorLocation(
       AnalysisSession session, ClassDeclaration classDeclaration) {
-    final sortConstructorsFirst = session.analysisContext.analysisOptions
-        .isLintEnabled(LintNames.sort_constructors_first);
+    final sortConstructorsFirst = session
+        .analysisContext.analysisOptions.codeStyleOptions.sortConstructorsFirst;
     // If sort_constructors_first is enabled, don't skip over the fields.
     final shouldSkip = sortConstructorsFirst
         ? (member) => member is ConstructorDeclaration
diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/for_in_statement.dart b/pkg/analysis_server/lib/src/services/snippets/dart/for_in_statement.dart
index c9c481b..06d1e0d 100644
--- a/pkg/analysis_server/lib/src/services/snippets/dart/for_in_statement.dart
+++ b/pkg/analysis_server/lib/src/services/snippets/dart/for_in_statement.dart
@@ -2,7 +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:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analysis_server/src/services/snippets/snippet.dart';
 import 'package:analysis_server/src/services/snippets/snippet_producer.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
@@ -18,8 +17,7 @@
   Future<Snippet> compute() async {
     final builder = ChangeBuilder(session: request.analysisSession);
     final indent = utils.getLinePrefix(request.offset);
-    final varOrFinal =
-        isLintEnabled(LintNames.prefer_final_locals) ? 'final' : 'var';
+    final varOrFinal = codeStyleOptions.makeLocalsFinal ? 'final' : 'var';
 
     await builder.addDartFileEdit(request.filePath, (builder) {
       builder.addReplacement(request.replacementRange, (builder) {
diff --git a/pkg/analysis_server/lib/src/services/snippets/snippet_producer.dart b/pkg/analysis_server/lib/src/services/snippets/snippet_producer.dart
index 52c1307..eec21be 100644
--- a/pkg/analysis_server/lib/src/services/snippets/snippet_producer.dart
+++ b/pkg/analysis_server/lib/src/services/snippets/snippet_producer.dart
@@ -6,6 +6,7 @@
 import 'package:analysis_server/src/services/snippets/dart_snippet_request.dart';
 import 'package:analysis_server/src/services/snippets/snippet.dart';
 import 'package:analysis_server/src/utilities/flutter.dart';
+import 'package:analyzer/dart/analysis/code_style_options.dart';
 import 'package:analyzer/dart/analysis/features.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/nullability_suffix.dart';
@@ -28,6 +29,9 @@
         useSuperParams = request.unit.libraryElement.featureSet
             .isEnabled(Feature.super_parameters);
 
+  CodeStyleOptions get codeStyleOptions =>
+      sessionHelper.session.analysisContext.analysisOptions.codeStyleOptions;
+
   bool get isInTestDirectory {
     final path = request.unit.path;
     return LinterContextImpl.testDirectories
@@ -38,11 +42,6 @@
   NullabilitySuffix get nullableSuffix => libraryElement.isNonNullableByDefault
       ? NullabilitySuffix.question
       : NullabilitySuffix.none;
-
-  bool isLintEnabled(String name) {
-    var analysisOptions = sessionHelper.session.analysisContext.analysisOptions;
-    return analysisOptions.isLintEnabled(name);
-  }
 }
 
 abstract class FlutterSnippetProducer extends DartSnippetProducer {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart
index c288dd0..ba8ade5 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart
@@ -153,13 +153,7 @@
   }
 }
 ''');
-    await assertHasAssist('''
-class A {
-  void set foo(int a) {
-    if (a == 0) return;
-  }
-}
-''');
+    await assertNoAssist();
   }
 
   Future<void> test_method_setter_lint_avoidReturnTypesOnSetters() async {
@@ -222,11 +216,7 @@
   if (a == 0) return;
 }
 ''');
-    await assertHasAssist('''
-void set foo(int a) {
-  if (a == 0) return;
-}
-''');
+    await assertNoAssist();
   }
 
   Future<void>
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index b3d3e24..3a74a43 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -13,6 +13,7 @@
 * Deprecated `Configuration.uriSource`, use `resolvedUri` instead.
 * Deprecated `CatchClause.exceptionParameter` and `CatchClause.stackTraceParameter`.
   Use `exceptionParameter2` and `stackTraceParameter2` instead.
+* Added `FileResult.isAugmentation` and `isLibrary` to complement `isPart`.
 
 ## 4.3.1
 * Fix `identifier` for `LibraryExportElement` and `LibraryImportElement`.
diff --git a/pkg/analyzer/lib/dart/analysis/code_style_options.dart b/pkg/analyzer/lib/dart/analysis/code_style_options.dart
index ba25c9e..b0e7804 100644
--- a/pkg/analyzer/lib/dart/analysis/code_style_options.dart
+++ b/pkg/analyzer/lib/dart/analysis/code_style_options.dart
@@ -14,6 +14,10 @@
   /// Return `true` if local variables should be `final` whenever possible.
   bool get makeLocalsFinal;
 
+  /// Return `true` if constructors should be sorted first, before other
+  /// class members.
+  bool get sortConstructorsFirst;
+
   /// Return `true` if the formatter should be used on code changes in this
   /// context.
   bool get useFormatter;
diff --git a/pkg/analyzer/lib/dart/analysis/results.dart b/pkg/analyzer/lib/dart/analysis/results.dart
index 604cf8f..a47b13c 100644
--- a/pkg/analyzer/lib/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/dart/analysis/results.dart
@@ -68,7 +68,16 @@
 ///
 /// Clients may not extend, implement or mix-in this class.
 abstract class FileResult implements SomeFileResult, AnalysisResult {
+  /// Whether the file is a library augmentation.
+  /// When `true`, [isLibrary] and [isPart] are `false`.
+  bool get isAugmentation;
+
+  /// Whether the file is a library.
+  /// When `true`, [isAugmentation] and [isPart] are `false`.
+  bool get isLibrary;
+
   /// Whether the file is a part.
+  /// When `true`, [isAugmentation] and [isLibrary] are `false`.
   bool get isPart;
 
   /// Information about lines in the content.
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 38f2281..f1e1596 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -848,26 +848,37 @@
   Token get name;
 }
 
+/// The declaration of a class augmentation.
+///
+///    classAugmentationDeclaration ::=
+///        'augment' 'class' [SimpleIdentifier] [TypeParameterList]?
+///        [ExtendsClause]? [WithClause]? [ImplementsClause]?
+///        '{' [ClassMember]* '}'
+///
+/// Clients may not extend, implement or mix-in this class.
+@experimental
+abstract class ClassAugmentationDeclaration
+    implements ClassOrAugmentationDeclaration {
+  /// The token representing the 'augment' keyword.
+  Token get augmentKeyword;
+
+  @override
+  ClassAugmentationElement? get declaredElement;
+}
+
 /// The declaration of a class.
 ///
 ///    classDeclaration ::=
 ///        'abstract'? 'class' [SimpleIdentifier] [TypeParameterList]?
-///        ([ExtendsClause] [WithClause]?)?
-///        [ImplementsClause]?
+///        [ExtendsClause]? [WithClause]? [ImplementsClause]?
 ///        '{' [ClassMember]* '}'
 ///
 /// Clients may not extend, implement or mix-in this class.
-abstract class ClassDeclaration implements ClassOrMixinDeclaration {
-  /// Return the 'abstract' keyword, or `null` if the keyword was absent.
-  Token? get abstractKeyword;
-
-  /// Return the token representing the 'class' keyword.
-  Token get classKeyword;
-
-  /// Return the extends clause for this class, or `null` if the class does not
-  /// extend any other class.
-  ExtendsClause? get extendsClause;
-
+//
+// TODO(scheglov) Add `ClassOrAugmentationElement get declaredElement`,
+// when [ClassOrMixinDeclaration] is gone.
+abstract class ClassDeclaration
+    implements ClassOrAugmentationDeclaration, ClassOrMixinDeclaration {
   /// Return `true` if this class is declared to be an abstract class.
   @Deprecated('Use abstractKeyword instead')
   bool get isAbstract;
@@ -876,10 +887,6 @@
   /// have a native clause.
   NativeClause? get nativeClause;
 
-  /// Return the with clause for the class, or `null` if the class does not have
-  /// a with clause.
-  WithClause? get withClause;
-
   /// Return the constructor declared in the class with the given [name], or
   /// `null` if there is no such constructor.
   ///
@@ -897,9 +904,53 @@
 /// Clients may not extend, implement or mix-in this class.
 abstract class ClassMember implements Declaration {}
 
+/// Shared interface between [ClassDeclaration] and
+/// [ClassAugmentationDeclaration].
+///
+/// Clients may not extend, implement or mix-in this class.
+@experimental
+abstract class ClassOrAugmentationDeclaration
+    implements NamedCompilationUnitMember {
+  /// Return the 'abstract' keyword, or `null` if the keyword was absent.
+  ///
+  /// In valid code only [ClassDeclaration] can specify it.
+  Token? get abstractKeyword;
+
+  /// Returns the token representing the 'class' keyword.
+  Token get classKeyword;
+
+  /// Returns the `extends` clause for this class, or `null` if the class
+  /// does not extend any other class.
+  ///
+  /// In valid code only [ClassDeclaration] can specify it.
+  ExtendsClause? get extendsClause;
+
+  /// Returns the `implements` clause for the class, or `null` if the class
+  /// does not implement any interfaces.
+  ImplementsClause? get implementsClause;
+
+  /// Returns the left curly bracket.
+  Token get leftBracket;
+
+  /// Returns the members defined by the class.
+  NodeList<ClassMember> get members;
+
+  /// Returns the right curly bracket.
+  Token get rightBracket;
+
+  /// Returns the type parameters for the class, or `null` if the class does
+  /// not have any type parameters.
+  TypeParameterList? get typeParameters;
+
+  /// Returns the `with` clause for the class, or `null` if the class does not
+  /// have a `with` clause.
+  WithClause? get withClause;
+}
+
 /// The declaration of a class or mixin.
 ///
 /// Clients may not extend, implement or mix-in this class.
+// TODO(scheglov) Deprecate and remove.
 abstract class ClassOrMixinDeclaration implements NamedCompilationUnitMember {
   @override
   ClassElement? get declaredElement;
@@ -914,9 +965,6 @@
   /// Returns the members defined by the class/mixin.
   NodeList<ClassMember> get members;
 
-  @override
-  SimpleIdentifier get name;
-
   /// Returns the right curly bracket.
   Token get rightBracket;
 
diff --git a/pkg/analyzer/lib/src/analysis_options/code_style_options.dart b/pkg/analyzer/lib/src/analysis_options/code_style_options.dart
index daaf072..283d133 100644
--- a/pkg/analyzer/lib/src/analysis_options/code_style_options.dart
+++ b/pkg/analyzer/lib/src/analysis_options/code_style_options.dart
@@ -23,6 +23,9 @@
   bool get makeLocalsFinal => _isLintEnabled('prefer_final_locals');
 
   @override
+  bool get sortConstructorsFirst => _isLintEnabled('sort_constructors_first');
+
+  @override
   bool get useRelativeUris => _isLintEnabled('prefer_relative_imports');
 
   /// Return `true` if the lint with the given [name] is enabled.
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index d8fcdce..e0e7658 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -689,7 +689,9 @@
       path: path,
       uri: file.uri,
       lineInfo: file.lineInfo,
-      isPart: file.isPart,
+      isAugmentation: file.kind is AugmentationFileKind,
+      isLibrary: file.kind is LibraryFileKind,
+      isPart: file.kind is PartFileKind,
     );
   }
 
@@ -1030,7 +1032,9 @@
       uri: file.uri,
       content: file.content,
       lineInfo: file.lineInfo,
-      isPart: file.isPart,
+      isAugmentation: file.kind is AugmentationFileKind,
+      isLibrary: file.kind is LibraryFileKind,
+      isPart: file.kind is PartFileKind,
       unit: unit,
       errors: listener.errors,
     );
@@ -1445,7 +1449,9 @@
             exists: unitFile.exists,
             content: unitFile.content,
             lineInfo: unitFile.lineInfo,
-            isPart: unitFile.isPart,
+            isAugmentation: unitFile.kind is AugmentationFileKind,
+            isLibrary: unitFile.kind is LibraryFileKind,
+            isPart: unitFile.kind is PartFileKind,
             unit: unitResult.unit,
             errors: unitResult.errors,
           ),
@@ -1479,7 +1485,9 @@
         path: path,
         uri: file.uri,
         lineInfo: file.lineInfo,
-        isPart: file.isPart,
+        isAugmentation: file.kind is AugmentationFileKind,
+        isLibrary: file.kind is LibraryFileKind,
+        isPart: file.kind is PartFileKind,
         element: element,
       );
     });
@@ -1619,7 +1627,9 @@
         exists: file.exists,
         content: content,
         lineInfo: file.lineInfo,
-        isPart: file.isPart,
+        isAugmentation: file.kind is AugmentationFileKind,
+        isLibrary: file.kind is LibraryFileKind,
+        isPart: file.kind is PartFileKind,
         unit: resolvedUnit,
         errors: errors,
       );
@@ -1630,7 +1640,9 @@
         path: file.path,
         uri: file.uri,
         lineInfo: file.lineInfo,
-        isPart: file.isPart,
+        isAugmentation: file.kind is AugmentationFileKind,
+        isLibrary: file.kind is LibraryFileKind,
+        isPart: file.kind is PartFileKind,
         errors: errors,
       );
       return AnalysisResult.errors(signature, errorsResult, index);
@@ -1701,7 +1713,9 @@
       path: file.path,
       uri: file.uri,
       lineInfo: file.lineInfo,
-      isPart: file.isPart,
+      isAugmentation: file.kind is AugmentationFileKind,
+      isLibrary: file.kind is LibraryFileKind,
+      isPart: file.kind is PartFileKind,
       errors: [
         AnalysisError(file.source, 0, 0,
             CompileTimeErrorCode.MISSING_DART_LIBRARY, [missingUri])
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index 742a16a..08bc00e 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -449,16 +449,6 @@
   @override
   int get hashCode => uri.hashCode;
 
-  /// Return `true` if the file does not have a `library` directive, and has a
-  /// `part of` directive, so is probably a part.
-  bool get isPart {
-    if (_unlinked2!.libraryDirective != null) {
-      return false;
-    }
-    return _unlinked2!.partOfNameDirective != null ||
-        _unlinked2!.partOfUriDirective != null;
-  }
-
   FileKind get kind => _kind!;
 
   /// Return information about line in the file.
diff --git a/pkg/analyzer/lib/src/dart/analysis/results.dart b/pkg/analyzer/lib/src/dart/analysis/results.dart
index be68147..a3d06bb 100644
--- a/pkg/analyzer/lib/src/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/results.dart
@@ -47,6 +47,8 @@
     required super.path,
     required super.uri,
     required super.lineInfo,
+    required super.isAugmentation,
+    required super.isLibrary,
     required super.isPart,
     required this.errors,
   });
@@ -63,6 +65,12 @@
   final LineInfo lineInfo;
 
   @override
+  final bool isAugmentation;
+
+  @override
+  final bool isLibrary;
+
+  @override
   final bool isPart;
 
   FileResultImpl({
@@ -70,6 +78,8 @@
     required this.path,
     required this.uri,
     required this.lineInfo,
+    required this.isAugmentation,
+    required this.isLibrary,
     required this.isPart,
   });
 }
@@ -138,6 +148,8 @@
     required super.uri,
     required this.content,
     required super.lineInfo,
+    required super.isAugmentation,
+    required super.isLibrary,
     required super.isPart,
     required this.unit,
     required this.errors,
@@ -273,6 +285,8 @@
     required this.exists,
     required this.content,
     required super.lineInfo,
+    required super.isAugmentation,
+    required super.isLibrary,
     required super.isPart,
     required this.unit,
     required this.errors,
@@ -300,6 +314,8 @@
     required super.path,
     required super.uri,
     required super.lineInfo,
+    required super.isAugmentation,
+    required super.isLibrary,
     required super.isPart,
     required this.element,
   });
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
index 60118ed..c12a470 100644
--- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
+++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -351,7 +351,9 @@
         path: path,
         uri: file.uri,
         lineInfo: file.lineInfo,
-        isPart: false,
+        isAugmentation: file.kind is AugmentationFileKind,
+        isLibrary: file.kind is LibraryFileKind,
+        isPart: file.kind is PartFileKind,
         errors: errors,
       );
     });
@@ -665,7 +667,9 @@
           exists: file.exists,
           content: file.content,
           lineInfo: file.lineInfo,
-          isPart: file.isPart,
+          isAugmentation: file.kind is AugmentationFileKind,
+          isLibrary: file.kind is LibraryFileKind,
+          isPart: file.kind is PartFileKind,
           unit: fileResult.unit,
           errors: fileResult.errors,
         );
diff --git a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
index ec86bb6..e55fc00 100644
--- a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
@@ -1461,6 +1461,34 @@
 ''');
   }
 
+  test_newFile_hasLibraryDirective_hasPartOfDirective() async {
+    final a = newFile('$testPackageLibPath/a.dart', r'''
+library L;
+part of L;
+''');
+
+    fileStateFor(a);
+
+    assertDriverStateString(testFile, r'''
+files
+  /home/test/lib/a.dart
+    uri: package:test/a.dart
+    current
+      id: file_0
+      kind: library_0
+        name: L
+        libraryImports
+          library_1 dart:core synthetic
+        cycle_0
+          dependencies: dart:core
+          libraries: library_0
+          apiSignature_0
+      unlinkedKey: k00
+libraryCycles
+elementFactory
+''');
+  }
+
   test_newFile_library_augmentations_emptyUri() {
     final a = newFile('$testPackageLibPath/a.dart', r'''
 import augment '';
@@ -5794,16 +5822,6 @@
         unorderedEquals(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']));
   }
 
-  test_getFileForPath_hasLibraryDirective_hasPartOfDirective() {
-    String a = convertPath('/test/lib/a.dart');
-    newFile(a, r'''
-library L;
-part of L;
-''');
-    FileState file = fileSystemState.getFileForPath(a);
-    expect(file.isPart, isFalse);
-  }
-
   test_getFileForPath_samePath() {
     String path = convertPath('/aaa/lib/a.dart');
     FileState file1 = fileSystemState.getFileForPath(path);
diff --git a/pkg/analyzer_cli/lib/src/analyzer_impl.dart b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
index 06fe1f4..361fd6b 100644
--- a/pkg/analyzer_cli/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
@@ -134,7 +134,7 @@
   Future<ErrorSeverity> _analyze(
       int printMode, ErrorFormatter formatter) async {
     // Don't try to analyze parts.
-    if (libraryFile.isPart) {
+    if (libraryFile.kind is! LibraryFileKind) {
       var libraryPath = libraryFile.path;
       stderr.writeln('Only libraries can be analyzed.');
       stderr.writeln('$libraryPath is a part and cannot be analyzed.');
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index cfaeac2..47e983f 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -256,6 +256,8 @@
               path: path,
               uri: pathContext.toUri(path),
               lineInfo: lineInfo,
+              isAugmentation: false,
+              isLibrary: true,
               isPart: false,
               errors: errors,
             )
@@ -318,6 +320,8 @@
                   path: path,
                   uri: pathContext.toUri(path),
                   lineInfo: lineInfo,
+                  isAugmentation: false,
+                  isLibrary: true,
                   isPart: false,
                   errors: errors,
                 ),
@@ -340,6 +344,8 @@
                 path: path,
                 uri: pathContext.toUri(path),
                 lineInfo: lineInfo,
+                isAugmentation: false,
+                isLibrary: true,
                 isPart: false,
                 errors: errors,
               ),
diff --git a/pkg/analyzer_cli/test/reporter_test.dart b/pkg/analyzer_cli/test/reporter_test.dart
index e54bfca..99188b1 100644
--- a/pkg/analyzer_cli/test/reporter_test.dart
+++ b/pkg/analyzer_cli/test/reporter_test.dart
@@ -112,6 +112,8 @@
     path: source.fullName,
     uri: Uri.file('/'),
     lineInfo: lineInfo,
+    isAugmentation: false,
+    isLibrary: true,
     isPart: false,
     errors: [error],
   );
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index f567bfb..8385afe 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -231,10 +231,13 @@
   Future<bool> run() => selfTask.measureSubtask("run", () async {
         measurer.startWallClock();
         var setupDuration = measurer.elapsedWallClock;
-        await runInternal()
-            .onError((error, stackTrace) =>
-                _reporter.onError(options.compilationTarget, error, stackTrace))
-            .whenComplete(() => measurer.stopWallClock());
+        try {
+          await runInternal();
+        } catch (error, stackTrace) {
+          await _reporter.onError(options.compilationTarget, error, stackTrace);
+        } finally {
+          measurer.stopWallClock();
+        }
         if (options.verbose) {
           var timings = StringBuffer();
           computeTimings(setupDuration, timings);
diff --git a/tools/VERSION b/tools/VERSION
index 74a7ffc..5d5842a 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 19
 PATCH 0
-PRERELEASE 52
+PRERELEASE 53
 PRERELEASE_PATCH 0
\ No newline at end of file