Version 2.11.0-234.0.dev

Merge commit 'b155af244282a612ff4f5fff4919c904a2922df5' into 'dev'
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index 1848bff..2656b09 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -697,8 +697,14 @@
   @Deprecated('Use computeConstantValue() instead')
   DartObject get constantValue;
 
-  /// Return the element representing the field, variable, or const constructor
-  /// being used as an annotation.
+  /// Return the element referenced by this annotation.
+  ///
+  /// In valid code this element can be a [PropertyAccessorElement] getter
+  /// of a constant top-level variable, or a constant static field of a
+  /// class; or a constant [ConstructorElement].
+  ///
+  /// In invalid code this element can be `null`, or a reference to any
+  /// other element.
   Element get element;
 
   /// Return `true` if this annotation marks the associated function as always
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 7320f05..36a2ff1 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -174,6 +174,14 @@
   /// The list of tasks to compute files referencing a name.
   final _referencingNameTasks = <_FilesReferencingNameTask>[];
 
+  /// The mapping from the files for which errors were requested using
+  /// [getErrors] to the [Completer]s to report the result.
+  final _errorsRequestedFiles = <String, List<Completer<ErrorsResult>>>{};
+
+  /// The requests from [_errorsRequestedFiles] for files which were found to
+  /// be parts without known libraries, so delayed.
+  final _errorsRequestedParts = <String, List<Completer<ErrorsResult>>>{};
+
   /// The mapping from the files for which the index was requested using
   /// [getIndex] to the [Completer]s to report the result.
   final _indexRequestedFiles =
@@ -385,6 +393,9 @@
         _referencingNameTasks.isNotEmpty) {
       return AnalysisDriverPriority.interactive;
     }
+    if (_errorsRequestedFiles.isNotEmpty) {
+      return AnalysisDriverPriority.interactive;
+    }
     if (_indexRequestedFiles.isNotEmpty) {
       return AnalysisDriverPriority.interactive;
     }
@@ -416,7 +427,8 @@
     if (_fileTracker.hasPendingFiles) {
       return AnalysisDriverPriority.general;
     }
-    if (_requestedParts.isNotEmpty ||
+    if (_errorsRequestedParts.isNotEmpty ||
+        _requestedParts.isNotEmpty ||
         _partsToAnalyze.isNotEmpty ||
         _unitElementSignatureParts.isNotEmpty ||
         _unitElementRequestedParts.isNotEmpty) {
@@ -547,19 +559,12 @@
       return null;
     }
 
-    // Ask the analysis result without unit, so return cached errors.
-    // If no cached analysis result, it will be computed.
-    ResolvedUnitResult analysisResult = _computeAnalysisResult(path);
-
-    // If not computed yet, because a part file without a known library,
-    // we have to compute the full analysis result, with the unit.
-    analysisResult ??= await getResult(path);
-    if (analysisResult == null) {
-      return null;
-    }
-
-    return ErrorsResultImpl(currentSession, path, analysisResult.uri,
-        analysisResult.lineInfo, analysisResult.isPart, analysisResult.errors);
+    var completer = Completer<ErrorsResult>();
+    _errorsRequestedFiles
+        .putIfAbsent(path, () => <Completer<ErrorsResult>>[])
+        .add(completer);
+    _scheduler.notify(this);
+    return completer.future;
   }
 
   /// Return a [Future] that completes with the list of added files that
@@ -967,6 +972,21 @@
       return;
     }
 
+    // Process an error request.
+    if (_errorsRequestedFiles.isNotEmpty) {
+      var path = _errorsRequestedFiles.keys.first;
+      var completers = _errorsRequestedFiles.remove(path);
+      var result = _computeErrors(path: path, asIsIfPartWithoutLibrary: false);
+      if (result != null) {
+        completers.forEach((completer) {
+          completer.complete(result);
+        });
+      } else {
+        _errorsRequestedParts.putIfAbsent(path, () => []).addAll(completers);
+      }
+      return;
+    }
+
     // Process an index request.
     if (_indexRequestedFiles.isNotEmpty) {
       String path = _indexRequestedFiles.keys.first;
@@ -1147,6 +1167,17 @@
       });
       return;
     }
+
+    // Compute errors in a part.
+    if (_errorsRequestedParts.isNotEmpty) {
+      var path = _errorsRequestedParts.keys.first;
+      var completers = _errorsRequestedParts.remove(path);
+      var result = _computeErrors(path: path, asIsIfPartWithoutLibrary: true);
+      completers.forEach((completer) {
+        completer.complete(result);
+      });
+      return;
+    }
   }
 
   /// Remove the file with the given [path] from the list of files to analyze.
@@ -1334,6 +1365,21 @@
     return Uint8List.fromList(bytes).buffer.asUint32List();
   }
 
+  ErrorsResult _computeErrors({
+    @required String path,
+    @required bool asIsIfPartWithoutLibrary,
+  }) {
+    ResolvedUnitResult analysisResult = _computeAnalysisResult(path,
+        withUnit: false, asIsIfPartWithoutLibrary: asIsIfPartWithoutLibrary);
+
+    if (analysisResult == null) {
+      return null;
+    }
+
+    return ErrorsResultImpl(currentSession, path, analysisResult.uri,
+        analysisResult.lineInfo, analysisResult.isPart, analysisResult.errors);
+  }
+
   AnalysisDriverUnitIndex _computeIndex(String path) {
     AnalysisResult analysisResult = _computeAnalysisResult(path,
         withUnit: false, asIsIfPartWithoutLibrary: true);
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index b20f3f8..df5d425 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -2418,8 +2418,6 @@
   /// visible for testing.
   static const String _VISIBLE_FOR_TESTING_VARIABLE_NAME = "visibleForTesting";
 
-  /// The element representing the field, variable, or constructor being used as
-  /// an annotation.
   @override
   Element element;
 
@@ -3731,7 +3729,7 @@
       var context = enclosingUnit.linkedContext;
       var containerRef = reference.getChild('@parameter');
       var formalParameters = context.getFormalParameters(linkedNode);
-      _parameters = ParameterElementImpl.forLinkedNodeList(
+      return _parameters = ParameterElementImpl.forLinkedNodeList(
         this,
         context,
         containerRef,
@@ -4537,11 +4535,11 @@
   GenericFunctionTypeElementImpl get function {
     if (_function != null) return _function;
 
-    if (linkedNode != null) {
-      LazyAst.applyResolution(linkedNode);
-      if (linkedNode is GenericTypeAlias) {
-        var context = enclosingUnit.linkedContext;
-        var function = context.getGeneticTypeAliasFunction(linkedNode);
+    var node = linkedNode;
+    if (node != null) {
+      LazyAst.applyResolution(node);
+      if (node is GenericTypeAlias) {
+        var function = node.functionType;
         if (function != null) {
           return _function = GenericFunctionTypeElementImpl.forLinkedNode(
             this,
@@ -4742,17 +4740,20 @@
 
   @override
   List<ParameterElement> get parameters {
-    if (_parameters == null) {
-      if (linkedNode != null) {
-        var context = enclosingUnit.linkedContext;
-        return _parameters = ParameterElementImpl.forLinkedNodeList(
-          this,
-          context,
-          reference.getChild('@parameter'),
-          context.getFormalParameters(linkedNode),
-        );
-      }
+    if (_parameters != null) return _parameters;
+
+    if (linkedNode != null) {
+      var context = enclosingUnit.linkedContext;
+      var containerRef = reference.getChild('@parameter');
+      var formalParameters = context.getFormalParameters(linkedNode);
+      return _parameters = ParameterElementImpl.forLinkedNodeList(
+        this,
+        context,
+        containerRef,
+        formalParameters,
+      );
     }
+
     return _parameters ?? const <ParameterElement>[];
   }
 
@@ -6569,18 +6570,14 @@
 
     if (linkedNode != null) {
       var context = enclosingUnit.linkedContext;
+      var containerRef = reference.getChild('@parameter');
       var formalParameters = context.getFormalParameters(linkedNode);
-      if (formalParameters != null) {
-        var containerRef = reference.getChild('@parameter');
-        return _parameters = ParameterElementImpl.forLinkedNodeList(
-          this,
-          context,
-          containerRef,
-          formalParameters,
-        );
-      } else {
-        return _parameters ??= const <ParameterElement>[];
-      }
+      return _parameters = ParameterElementImpl.forLinkedNodeList(
+        this,
+        context,
+        containerRef,
+        formalParameters,
+      );
     }
 
     return _parameters ??= const <ParameterElement>[];
@@ -6614,7 +6611,7 @@
     if (_typeParameters != null) return _typeParameters;
 
     if (linkedNode != null) {
-      var typeParameters = linkedContext.getTypeParameters2(linkedNode);
+      var typeParameters = linkedContext.getTypeParameters(linkedNode);
       if (typeParameters == null) {
         return _typeParameters = const [];
       }
@@ -7429,8 +7426,8 @@
     if (_bound != null) return _bound;
 
     if (linkedNode != null) {
-      var context = enclosingUnit.linkedContext;
-      return _bound = context.getTypeParameterBound(linkedNode)?.type;
+      var node = linkedNode as TypeParameter;
+      return _bound = node.bound?.type;
     }
 
     return _bound;
@@ -7565,7 +7562,7 @@
 
     if (linkedNode != null) {
       LazyAst.applyResolution(linkedNode);
-      var typeParameters = linkedContext.getTypeParameters2(linkedNode);
+      var typeParameters = linkedContext.getTypeParameters(linkedNode);
       if (typeParameters == null) {
         return _typeParameterElements = const [];
       }
diff --git a/pkg/analyzer/lib/src/summary2/linked_unit_context.dart b/pkg/analyzer/lib/src/summary2/linked_unit_context.dart
index 13ceb21..8666757 100644
--- a/pkg/analyzer/lib/src/summary2/linked_unit_context.dart
+++ b/pkg/analyzer/lib/src/summary2/linked_unit_context.dart
@@ -320,50 +320,32 @@
 
   List<FormalParameter> getFormalParameters(AstNode node) {
     if (node is ConstructorDeclaration) {
-      // LazyConstructorDeclaration.readFormalParameters(_astReader, node);
       return node.parameters.parameters;
     } else if (node is FunctionDeclaration) {
-      // LazyFunctionDeclaration.readFunctionExpression(_astReader, node);
       return getFormalParameters(node.functionExpression);
     } else if (node is FunctionExpression) {
-      // LazyFunctionExpression.readFormalParameters(_astReader, node);
       return node.parameters?.parameters;
     } else if (node is FormalParameter) {
       if (node is DefaultFormalParameter) {
         return getFormalParameters(node.parameter);
       } else if (node is FieldFormalParameter) {
-        // LazyFormalParameter.readFormalParameters(_astReader, node);
         return node.parameters?.parameters;
       } else if (node is FunctionTypedFormalParameter) {
-        // LazyFormalParameter.readFormalParameters(_astReader, node);
         return node.parameters.parameters;
       } else {
         return null;
       }
     } else if (node is FunctionTypeAlias) {
-      // LazyFunctionTypeAlias.readFormalParameters(_astReader, node);
       return node.parameters.parameters;
     } else if (node is GenericFunctionType) {
       return node.parameters.parameters;
     } else if (node is MethodDeclaration) {
-      // LazyMethodDeclaration.readFormalParameters(_astReader, node);
       return node.parameters?.parameters;
     } else {
       throw UnimplementedError('${node.runtimeType}');
     }
   }
 
-  Reference getGenericFunctionTypeReference(GenericFunctionType node) {
-    var containerRef = reference.getChild('@genericFunctionType');
-    var id = LazyAst.getGenericFunctionTypeId(node);
-    return containerRef.getChild('$id');
-  }
-
-  GenericFunctionType getGeneticTypeAliasFunction(GenericTypeAlias node) {
-    // LazyGenericTypeAlias.readFunctionType(_astReader, node);
-    return node.functionType;
-  }
-
   bool getHasTypedefSelfReference(AstNode node) {
     if (node is FunctionTypeAlias) {
       return LazyFunctionTypeAlias.getHasSelfReference(node);
@@ -375,13 +357,10 @@
 
   ImplementsClause getImplementsClause(AstNode node) {
     if (node is ClassDeclaration) {
-      // LazyClassDeclaration.readImplementsClause(_astReader, node);
       return node.implementsClause;
     } else if (node is ClassTypeAlias) {
-      // LazyClassTypeAlias.readImplementsClause(_astReader, node);
       return node.implementsClause;
     } else if (node is MixinDeclaration) {
-      // LazyMixinDeclaration.readImplementsClause(_astReader, node);
       return node.implementsClause;
     } else {
       throw UnimplementedError('${node.runtimeType}');
@@ -434,10 +413,8 @@
 
   List<Annotation> getMetadata(AstNode node) {
     if (node is ClassDeclaration) {
-      // LazyClassDeclaration.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is ClassTypeAlias) {
-      // LazyClassTypeAlias.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is CompilationUnit) {
       assert(node == _unit);
@@ -447,50 +424,36 @@
         return const <Annotation>[];
       }
     } else if (node is ConstructorDeclaration) {
-      // LazyConstructorDeclaration.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is DefaultFormalParameter) {
       return getMetadata(node.parameter);
     } else if (node is Directive) {
-      // LazyDirective.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is EnumConstantDeclaration) {
-      // LazyEnumConstantDeclaration.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is EnumDeclaration) {
-      // LazyEnumDeclaration.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is ExtensionDeclaration) {
-      // LazyExtensionDeclaration.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is FormalParameter) {
-      // LazyFormalParameter.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is FunctionDeclaration) {
-      // LazyFunctionDeclaration.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is FunctionTypeAlias) {
-      // LazyFunctionTypeAlias.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is GenericTypeAlias) {
-      // LazyGenericTypeAlias.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is MethodDeclaration) {
-      // LazyMethodDeclaration.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is MixinDeclaration) {
-      // LazyMixinDeclaration.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is TypeParameter) {
-      // LazyTypeParameter.readMetadata(_astReader, node);
       return node.metadata;
     } else if (node is VariableDeclaration) {
       var parent2 = node.parent.parent;
       if (parent2 is FieldDeclaration) {
-        // LazyFieldDeclaration.readMetadata(_astReader, parent2);
         return parent2.metadata;
       } else if (parent2 is TopLevelVariableDeclaration) {
-        // LazyTopLevelVariableDeclaration.readMetadata(_astReader, parent2);
         return parent2.metadata;
       }
     }
@@ -539,15 +502,12 @@
   DartType getReturnType(AstNode node) {
     if (node is FunctionDeclaration) {
       return LazyAst.getReturnType(node);
-      // return LazyFunctionDeclaration.getReturnType(_astReader, node);
     } else if (node is FunctionTypeAlias) {
       return LazyAst.getReturnType(node);
-      // return LazyFunctionTypeAlias.getReturnType(_astReader, node);
     } else if (node is GenericFunctionType) {
       return node.returnType?.type ?? DynamicTypeImpl.instance;
     } else if (node is MethodDeclaration) {
       return LazyAst.getReturnType(node);
-      // return LazyMethodDeclaration.getReturnType(_astReader, node);
     } else {
       throw UnimplementedError('${node.runtimeType}');
     }
@@ -573,10 +533,8 @@
 
   TypeName getSuperclass(AstNode node) {
     if (node is ClassDeclaration) {
-      // LazyClassDeclaration.readExtendsClause(_astReader, node);
       return node.extendsClause?.superclass;
     } else if (node is ClassTypeAlias) {
-      // LazyClassTypeAlias.readSuperclass(_astReader, node);
       return node.superclass;
     } else {
       throw StateError('${node.runtimeType}');
@@ -589,10 +547,8 @@
       return getType(node.parameter);
     } else if (node is FormalParameter) {
       return LazyAst.getType(node);
-      // return LazyFormalParameter.getType(_astReader, node);
     } else if (node is VariableDeclaration) {
       return LazyAst.getType(node);
-      // return LazyVariableDeclaration.getType(_astReader, node);
     } else {
       throw UnimplementedError('${node.runtimeType}');
     }
@@ -608,12 +564,7 @@
     }
   }
 
-  TypeAnnotation getTypeParameterBound(TypeParameter node) {
-    // LazyTypeParameter.readBound(_astReader, node);
-    return node.bound;
-  }
-
-  TypeParameterList getTypeParameters2(AstNode node) {
+  TypeParameterList getTypeParameters(AstNode node) {
     if (node is ClassDeclaration) {
       return node.typeParameters;
     } else if (node is ClassTypeAlias) {
@@ -621,14 +572,13 @@
     } else if (node is ConstructorDeclaration) {
       return null;
     } else if (node is DefaultFormalParameter) {
-      return getTypeParameters2(node.parameter);
+      return getTypeParameters(node.parameter);
     } else if (node is ExtensionDeclaration) {
       return node.typeParameters;
     } else if (node is FieldFormalParameter) {
       return node.typeParameters;
     } else if (node is FunctionDeclaration) {
-      // LazyFunctionDeclaration.readFunctionExpression(_astReader, node);
-      return getTypeParameters2(node.functionExpression);
+      return getTypeParameters(node.functionExpression);
     } else if (node is FunctionExpression) {
       return node.typeParameters;
     } else if (node is FunctionTypedFormalParameter) {
@@ -656,10 +606,8 @@
 
   WithClause getWithClause(AstNode node) {
     if (node is ClassDeclaration) {
-      // LazyClassDeclaration.readWithClause(_astReader, node);
       return node.withClause;
     } else if (node is ClassTypeAlias) {
-      // LazyClassTypeAlias.readWithClause(_astReader, node);
       return node.withClause;
     } else {
       throw UnimplementedError('${node.runtimeType}');
@@ -744,7 +692,6 @@
     if (node is ConstructorDeclaration) {
       return false;
     } else if (node is FunctionDeclaration) {
-      // LazyFunctionDeclaration.readFunctionExpression(_astReader, node);
       return isAsynchronous(node.functionExpression);
     } else if (node is FunctionExpression) {
       return LazyFunctionExpression.isAsynchronous(node);
@@ -824,7 +771,6 @@
     if (node is ConstructorDeclaration) {
       return false;
     } else if (node is FunctionDeclaration) {
-      // LazyFunctionDeclaration.readFunctionExpression(_astReader, node);
       return isGenerator(node.functionExpression);
     } else if (node is FunctionExpression) {
       return LazyFunctionExpression.isGenerator(node);
@@ -906,10 +852,8 @@
 
   Expression readInitializer(AstNode node) {
     if (node is DefaultFormalParameter) {
-      // LazyFormalParameter.readDefaultValue(_astReader, node);
       return node.defaultValue;
     } else if (node is VariableDeclaration) {
-      // LazyVariableDeclaration.readInitializer(_astReader, node);
       return node.initializer;
     } else {
       throw StateError('${node.runtimeType}');
@@ -1118,7 +1062,6 @@
         partDirectiveIndex++;
         if (partDirectiveIndex == indexInLibrary) {
           LazyAst.applyResolution(directive);
-          // LazyDirective.readMetadata(definingContext._astReader, directive);
           return directive.metadata;
         }
       }
diff --git a/tools/VERSION b/tools/VERSION
index bb98264..dd27b8e 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 11
 PATCH 0
-PRERELEASE 233
+PRERELEASE 234
 PRERELEASE_PATCH 0
\ No newline at end of file