@@ -3975,6 +3975,11 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
3975
3975
*/
3976
3976
Namespace _publicNamespace;
3977
3977
3978
+ /**
3979
+ * A bit-encoded form of the capabilities associated with this library.
3980
+ */
3981
+ int _resolutionCapabilities = 0 ;
3982
+
3978
3983
/**
3979
3984
* Initialize a newly created library element in the given [context] to have
3980
3985
* the given [name] and [offset] .
@@ -4002,6 +4007,10 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
4002
4007
: super .forSerialized (null ) {
4003
4008
_name = name;
4004
4009
_nameOffset = offset;
4010
+ setResolutionCapability (
4011
+ LibraryResolutionCapability .resolvedTypeNames, true );
4012
+ setResolutionCapability (
4013
+ LibraryResolutionCapability .constantExpressions, true );
4005
4014
}
4006
4015
4007
4016
@override
@@ -4507,6 +4516,16 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
4507
4516
return _safeIsUpToDate (this , timeStamp, visitedLibraries);
4508
4517
}
4509
4518
4519
+ /**
4520
+ * Set whether the library has the given [capability] to
4521
+ * correspond to the given [value] .
4522
+ */
4523
+ void setResolutionCapability (
4524
+ LibraryResolutionCapability capability, bool value) {
4525
+ _resolutionCapabilities =
4526
+ BooleanArray .set (_resolutionCapabilities, capability.index, value);
4527
+ }
4528
+
4510
4529
@override
4511
4530
void visitChildren (ElementVisitor visitor) {
4512
4531
super .visitChildren (visitor);
@@ -4546,6 +4565,15 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
4546
4565
}
4547
4566
}
4548
4567
4568
+ /**
4569
+ * Return `true` if the [library] has the given [capability] .
4570
+ */
4571
+ static bool hasResolutionCapability (
4572
+ LibraryElement library, LibraryResolutionCapability capability) {
4573
+ return library is LibraryElementImpl &&
4574
+ BooleanArray .get (library._resolutionCapabilities, capability.index);
4575
+ }
4576
+
4549
4577
/**
4550
4578
* Return `true` if the given [library] is up to date with respect to the
4551
4579
* given [timeStamp] . The set of [visitedLibraries] is used to prevent
@@ -4585,6 +4613,22 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
4585
4613
}
4586
4614
}
4587
4615
4616
+ /**
4617
+ * Enum of possible resolution capabilities that a [LibraryElementImpl] has.
4618
+ */
4619
+ enum LibraryResolutionCapability {
4620
+ /**
4621
+ * All elements have their types resolved.
4622
+ */
4623
+ resolvedTypeNames,
4624
+
4625
+ /**
4626
+ * All (potentially) constants expressions are set into corresponding
4627
+ * elements.
4628
+ */
4629
+ constantExpressions,
4630
+ }
4631
+
4588
4632
/**
4589
4633
* The context in which the library is resynthesized.
4590
4634
*/
0 commit comments