Index: pkg/analyzer/lib/src/dart/element/element.dart |
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart |
index 721918f655b3c41c20556433c6c7fbce2d5c2916..43cda9ec5fcc39eaf510d2f94ab1cfa93d0b6ba0 100644 |
--- a/pkg/analyzer/lib/src/dart/element/element.dart |
+++ b/pkg/analyzer/lib/src/dart/element/element.dart |
@@ -3976,6 +3976,11 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement { |
Namespace _publicNamespace; |
/** |
+ * A bit-encoded form of the capabilities associated with this library. |
+ */ |
+ int _resolutionCapabilities = 0; |
+ |
+ /** |
* Initialize a newly created library element in the given [context] to have |
* the given [name] and [offset]. |
*/ |
@@ -4002,6 +4007,10 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement { |
: super.forSerialized(null) { |
_name = name; |
_nameOffset = offset; |
+ setResolutionCapability( |
+ LibraryResolutionCapability.resolvedTypeNames, true); |
+ setResolutionCapability( |
+ LibraryResolutionCapability.constantExpressions, true); |
} |
@override |
@@ -4507,6 +4516,16 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement { |
return _safeIsUpToDate(this, timeStamp, visitedLibraries); |
} |
+ /** |
+ * Set whether the library has the given [capability] to |
+ * correspond to the given [value]. |
+ */ |
+ void setResolutionCapability( |
+ LibraryResolutionCapability capability, bool value) { |
+ _resolutionCapabilities = |
+ BooleanArray.set(_resolutionCapabilities, capability.index, value); |
+ } |
+ |
@override |
void visitChildren(ElementVisitor visitor) { |
super.visitChildren(visitor); |
@@ -4547,6 +4566,15 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement { |
} |
/** |
+ * Return `true` if the [library] has the given [capability]. |
+ */ |
+ static bool hasResolutionCapability( |
+ LibraryElement library, LibraryResolutionCapability capability) { |
+ return library is LibraryElementImpl && |
+ BooleanArray.get(library._resolutionCapabilities, capability.index); |
+ } |
+ |
+ /** |
* Return `true` if the given [library] is up to date with respect to the |
* given [timeStamp]. The set of [visitedLibraries] is used to prevent |
* infinite recursion in the case of mutually dependent libraries. |
@@ -4586,6 +4614,22 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement { |
} |
/** |
+ * Enum of possible resolution capabilities that a [LibraryElementImpl] has. |
+ */ |
+enum LibraryResolutionCapability { |
+ /** |
+ * All elements have their types resolved. |
+ */ |
+ resolvedTypeNames, |
+ |
+ /** |
+ * All (potentially) constants expressions are set into corresponding |
+ * elements. |
+ */ |
+ constantExpressions, |
+} |
+ |
+/** |
* The context in which the library is resynthesized. |
*/ |
abstract class LibraryResynthesizerContext { |