mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:07:49 +00:00
[dart2js] Migrate other abstract value domains
Change-Id: I7ede2113f8520ade4713f2bd64266a6090060255 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260800 Reviewed-by: Mayank Patke <fishythefish@google.com>
This commit is contained in:
parent
eb1f864540
commit
c0b449667a
|
@ -544,7 +544,7 @@ abstract class AbstractValueDomain {
|
|||
///
|
||||
/// Specializations are created through [createPrimitiveValue],
|
||||
/// [createMapValue], [createDictionaryValue] and [createContainerValue].
|
||||
AbstractValue? getGeneralization(AbstractValue value);
|
||||
AbstractValue? getGeneralization(AbstractValue? value);
|
||||
|
||||
/// Return the object identifying the allocation of [value] if it is an
|
||||
/// allocation based specialization. Otherwise returns `null`.
|
||||
|
|
|
@ -2,8 +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.
|
||||
|
||||
// @dart = 2.10
|
||||
|
||||
import '../../constants/values.dart' show ConstantValue, PrimitiveConstantValue;
|
||||
import '../../elements/entities.dart';
|
||||
import '../../elements/names.dart';
|
||||
|
@ -13,7 +11,7 @@ import '../../serialization/serialization.dart';
|
|||
import '../../universe/selector.dart';
|
||||
import '../../universe/world_builder.dart';
|
||||
import '../../universe/use.dart';
|
||||
import '../../world.dart';
|
||||
import '../../world_interfaces.dart';
|
||||
import '../abstract_value_domain.dart';
|
||||
import '../abstract_value_strategy.dart';
|
||||
import 'powerset_bits.dart';
|
||||
|
@ -30,10 +28,8 @@ class PowersetValue implements AbstractValue {
|
|||
bool operator ==(var other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (other is! PowersetValue) return false;
|
||||
PowersetValue otherPowerset = other;
|
||||
return other is PowersetValue &&
|
||||
_abstractValue == otherPowerset._abstractValue &&
|
||||
_powersetBits == otherPowerset._powersetBits;
|
||||
return _abstractValue == other._abstractValue &&
|
||||
_powersetBits == other._powersetBits;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -47,11 +43,11 @@ class PowersetValue implements AbstractValue {
|
|||
'${_abstractValue}';
|
||||
}
|
||||
|
||||
AbstractValue unwrapOrNull(PowersetValue powerset) {
|
||||
AbstractValue? unwrapOrNull(PowersetValue? powerset) {
|
||||
return powerset?._abstractValue;
|
||||
}
|
||||
|
||||
PowersetValue wrapOrNull(AbstractValue abstractValue, int powersetBits) {
|
||||
PowersetValue? wrapOrNull(AbstractValue? abstractValue, int powersetBits) {
|
||||
return abstractValue == null
|
||||
? null
|
||||
: PowersetValue(abstractValue, powersetBits);
|
||||
|
@ -115,7 +111,7 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
: _abstractValueDomain.isJsIndexable(value._abstractValue);
|
||||
|
||||
@override
|
||||
MemberEntity locateSingleMember(
|
||||
MemberEntity? locateSingleMember(
|
||||
covariant PowersetValue receiver, Selector selector) =>
|
||||
_abstractValueDomain.locateSingleMember(
|
||||
receiver._abstractValue, selector);
|
||||
|
@ -155,7 +151,7 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
}
|
||||
|
||||
@override
|
||||
PrimitiveConstantValue getPrimitiveValue(covariant PowersetValue value) =>
|
||||
PrimitiveConstantValue? getPrimitiveValue(covariant PowersetValue value) =>
|
||||
_powersetBitsDomain.getPrimitiveValue(value.powersetBits) ??
|
||||
_abstractValueDomain.getPrimitiveValue(value._abstractValue);
|
||||
|
||||
|
@ -174,18 +170,18 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isPrimitiveValue(value._abstractValue);
|
||||
|
||||
@override
|
||||
MemberEntity getAllocationElement(covariant PowersetValue value) =>
|
||||
MemberEntity? getAllocationElement(covariant PowersetValue value) =>
|
||||
_abstractValueDomain.getAllocationElement(value._abstractValue);
|
||||
|
||||
@override
|
||||
Object getAllocationNode(covariant PowersetValue value) =>
|
||||
Object? getAllocationNode(covariant PowersetValue value) =>
|
||||
_abstractValueDomain.getAllocationNode(value._abstractValue);
|
||||
|
||||
@override
|
||||
AbstractValue getGeneralization(covariant PowersetValue value) {
|
||||
int powersetBits = _powersetBitsDomain.powersetTop;
|
||||
AbstractValue abstractValue =
|
||||
_abstractValueDomain.getGeneralization(unwrapOrNull(value));
|
||||
final abstractValue =
|
||||
_abstractValueDomain.getGeneralization(unwrapOrNull(value))!;
|
||||
return PowersetValue(abstractValue, powersetBits);
|
||||
}
|
||||
|
||||
|
@ -214,12 +210,12 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValue createDictionaryValue(
|
||||
covariant PowersetValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant PowersetValue key,
|
||||
covariant PowersetValue value,
|
||||
covariant Map<String, AbstractValue> mappings) {
|
||||
int powersetBits = originalValue._powersetBits;
|
||||
final powersetBits = originalValue._powersetBits;
|
||||
AbstractValue abstractValue = _abstractValueDomain.createDictionaryValue(
|
||||
originalValue._abstractValue,
|
||||
allocationNode,
|
||||
|
@ -260,8 +256,8 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValue createMapValue(
|
||||
covariant PowersetValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant PowersetValue key,
|
||||
covariant PowersetValue value) {
|
||||
int powersetBits = originalValue._powersetBits;
|
||||
|
@ -292,8 +288,8 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValue createSetValue(
|
||||
covariant PowersetValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant PowersetValue elementType) {
|
||||
int powersetBits = originalValue._powersetBits;
|
||||
AbstractValue abstractValue = _abstractValueDomain.createSetValue(
|
||||
|
@ -310,7 +306,7 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isSet(value._abstractValue);
|
||||
|
||||
@override
|
||||
int getContainerLength(covariant PowersetValue value) =>
|
||||
int? getContainerLength(covariant PowersetValue value) =>
|
||||
_powersetBitsDomain.isOther(value._powersetBits).isDefinitelyFalse
|
||||
? null
|
||||
: _abstractValueDomain.getContainerLength(value._abstractValue);
|
||||
|
@ -328,10 +324,10 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValue createContainerValue(
|
||||
covariant PowersetValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant PowersetValue elementType,
|
||||
int length) {
|
||||
int? length) {
|
||||
int powersetBits = originalValue._powersetBits;
|
||||
AbstractValue abstractValue = _abstractValueDomain.createContainerValue(
|
||||
originalValue._abstractValue,
|
||||
|
@ -359,9 +355,9 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
}
|
||||
|
||||
@override
|
||||
AbstractValue getAbstractValueForNativeMethodParameterType(DartType type) {
|
||||
AbstractValue? getAbstractValueForNativeMethodParameterType(DartType type) {
|
||||
int powersetBits = _powersetBitsDomain.powersetTop;
|
||||
AbstractValue abstractValue =
|
||||
final abstractValue =
|
||||
_abstractValueDomain.getAbstractValueForNativeMethodParameterType(type);
|
||||
return wrapOrNull(abstractValue, powersetBits);
|
||||
}
|
||||
|
@ -389,17 +385,17 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
}
|
||||
|
||||
@override
|
||||
AbstractValue unionOfMany(covariant Iterable<AbstractValue> values) {
|
||||
AbstractValue unionOfMany(Iterable<AbstractValue> values) {
|
||||
PowersetValue result = PowersetValue(
|
||||
_abstractValueDomain.emptyType, _powersetBitsDomain.powersetBottom);
|
||||
for (PowersetValue value in values) {
|
||||
result = union(result, value);
|
||||
for (final value in values) {
|
||||
result = union(result, value as PowersetValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
AbstractValue union(covariant PowersetValue a, covariant PowersetValue b) {
|
||||
PowersetValue union(covariant PowersetValue a, covariant PowersetValue b) {
|
||||
int powersetBits =
|
||||
_powersetBitsDomain.union(a._powersetBits, b._powersetBits);
|
||||
AbstractValue abstractValue =
|
||||
|
@ -563,7 +559,7 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isLateSentinel(value._abstractValue));
|
||||
|
||||
@override
|
||||
ClassEntity getExactClass(covariant PowersetValue value) =>
|
||||
ClassEntity? getExactClass(covariant PowersetValue value) =>
|
||||
_abstractValueDomain.getExactClass(value._abstractValue);
|
||||
|
||||
@override
|
||||
|
@ -688,7 +684,8 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValueWithPrecision createFromStaticType(DartType type,
|
||||
{ClassRelation classRelation = ClassRelation.subtype, bool nullable}) {
|
||||
{ClassRelation classRelation = ClassRelation.subtype,
|
||||
required bool nullable}) {
|
||||
int powersetBits = _powersetBitsDomain.createFromStaticType(type,
|
||||
classRelation: classRelation, nullable: nullable);
|
||||
var unwrapped = _abstractValueDomain.createFromStaticType(type,
|
||||
|
@ -833,7 +830,7 @@ class PowersetsSelectorStrategy implements SelectorConstraintsStrategy {
|
|||
|
||||
@override
|
||||
UniverseSelectorConstraints createSelectorConstraints(
|
||||
Selector selector, Object initialConstraint) {
|
||||
Selector selector, Object? initialConstraint) {
|
||||
return PowersetsUniverseSelectorConstraints(
|
||||
_selectorConstraintsStrategy.createSelectorConstraints(
|
||||
selector,
|
||||
|
@ -847,7 +844,7 @@ class PowersetsSelectorStrategy implements SelectorConstraintsStrategy {
|
|||
covariant JClosedWorld world) {
|
||||
return _selectorConstraintsStrategy.appliedUnnamed(
|
||||
dynamicUse.withReceiverConstraint(
|
||||
unwrapOrNull(dynamicUse.receiverConstraint)),
|
||||
unwrapOrNull(dynamicUse.receiverConstraint as PowersetValue?)),
|
||||
member,
|
||||
world);
|
||||
}
|
||||
|
@ -859,7 +856,7 @@ class PowersetsUniverseSelectorConstraints
|
|||
const PowersetsUniverseSelectorConstraints(this._universeSelectorConstraints);
|
||||
|
||||
@override
|
||||
bool addReceiverConstraint(Object constraint) =>
|
||||
bool addReceiverConstraint(Object? constraint) =>
|
||||
_universeSelectorConstraints.addReceiverConstraint(constraint == null
|
||||
? null
|
||||
: (constraint as PowersetValue)._abstractValue);
|
||||
|
|
|
@ -2,8 +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.
|
||||
|
||||
// @dart = 2.10
|
||||
|
||||
import '../constants/values.dart' show ConstantValue, PrimitiveConstantValue;
|
||||
import '../elements/entities.dart';
|
||||
import '../elements/names.dart';
|
||||
|
@ -13,7 +11,7 @@ import '../serialization/serialization.dart';
|
|||
import '../universe/selector.dart';
|
||||
import '../universe/world_builder.dart';
|
||||
import '../universe/use.dart';
|
||||
import '../world.dart';
|
||||
import '../world_interfaces.dart';
|
||||
import 'abstract_value_domain.dart';
|
||||
import 'abstract_value_strategy.dart';
|
||||
|
||||
|
@ -55,7 +53,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
AbstractBool isJsIndexable(AbstractValue value) => AbstractBool.Maybe;
|
||||
|
||||
@override
|
||||
MemberEntity locateSingleMember(AbstractValue receiver, Selector selector) =>
|
||||
MemberEntity? locateSingleMember(AbstractValue receiver, Selector selector) =>
|
||||
null;
|
||||
|
||||
@override
|
||||
|
@ -77,7 +75,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
const TrivialAbstractValue();
|
||||
|
||||
@override
|
||||
PrimitiveConstantValue getPrimitiveValue(AbstractValue value) => null;
|
||||
PrimitiveConstantValue? getPrimitiveValue(AbstractValue value) => null;
|
||||
|
||||
@override
|
||||
AbstractValue createPrimitiveValue(
|
||||
|
@ -88,13 +86,13 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
bool isPrimitiveValue(AbstractValue value) => false;
|
||||
|
||||
@override
|
||||
MemberEntity getAllocationElement(AbstractValue value) => null;
|
||||
MemberEntity? getAllocationElement(AbstractValue value) => null;
|
||||
|
||||
@override
|
||||
Object getAllocationNode(AbstractValue value) => null;
|
||||
Object? getAllocationNode(AbstractValue value) => null;
|
||||
|
||||
@override
|
||||
AbstractValue getGeneralization(AbstractValue value) =>
|
||||
AbstractValue getGeneralization(AbstractValue? value) =>
|
||||
const TrivialAbstractValue();
|
||||
|
||||
@override
|
||||
|
@ -115,9 +113,9 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createDictionaryValue(
|
||||
AbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
AbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
AbstractValue key,
|
||||
AbstractValue value,
|
||||
Map<String, AbstractValue> mappings) =>
|
||||
|
@ -138,9 +136,9 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createMapValue(
|
||||
AbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
AbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
AbstractValue key,
|
||||
AbstractValue value) =>
|
||||
const TrivialAbstractValue();
|
||||
|
@ -155,9 +153,9 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createSetValue(
|
||||
AbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
AbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
AbstractValue elementType) =>
|
||||
const TrivialAbstractValue();
|
||||
|
||||
|
@ -165,7 +163,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
bool isSet(AbstractValue value) => false;
|
||||
|
||||
@override
|
||||
int getContainerLength(AbstractValue value) => null;
|
||||
int? getContainerLength(AbstractValue value) => null;
|
||||
|
||||
@override
|
||||
AbstractValue getContainerElementType(AbstractValue value) {
|
||||
|
@ -175,11 +173,11 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createContainerValue(
|
||||
AbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
AbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
AbstractValue elementType,
|
||||
int length) =>
|
||||
int? length) =>
|
||||
const TrivialAbstractValue();
|
||||
|
||||
@override
|
||||
|
@ -190,7 +188,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
const TrivialAbstractValue();
|
||||
|
||||
@override
|
||||
AbstractValue getAbstractValueForNativeMethodParameterType(DartType type) =>
|
||||
AbstractValue? getAbstractValueForNativeMethodParameterType(DartType type) =>
|
||||
null;
|
||||
|
||||
@override
|
||||
|
@ -295,7 +293,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
AbstractBool isLateSentinel(AbstractValue value) => AbstractBool.Maybe;
|
||||
|
||||
@override
|
||||
ClassEntity getExactClass(AbstractValue value) => null;
|
||||
ClassEntity? getExactClass(AbstractValue value) => null;
|
||||
|
||||
@override
|
||||
AbstractBool isExact(AbstractValue value) => AbstractBool.Maybe;
|
||||
|
@ -364,8 +362,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValueWithPrecision createFromStaticType(DartType type,
|
||||
{ClassRelation classRelation = ClassRelation.subtype,
|
||||
/* required */ bool nullable}) {
|
||||
assert(nullable != null);
|
||||
required bool nullable}) {
|
||||
return const AbstractValueWithPrecision(TrivialAbstractValue(), false);
|
||||
}
|
||||
|
||||
|
@ -467,7 +464,7 @@ class TrivialSelectorStrategy implements SelectorConstraintsStrategy {
|
|||
|
||||
@override
|
||||
UniverseSelectorConstraints createSelectorConstraints(
|
||||
Selector selector, Object initialConstraint) {
|
||||
Selector selector, Object? initialConstraint) {
|
||||
return const TrivialUniverseSelectorConstraints();
|
||||
}
|
||||
|
||||
|
|
|
@ -898,7 +898,7 @@ class CommonMasks implements AbstractValueDomain {
|
|||
}
|
||||
|
||||
@override
|
||||
AbstractValue? getGeneralization(AbstractValue value) {
|
||||
AbstractValue? getGeneralization(AbstractValue? value) {
|
||||
return value is AllocationTypeMask ? value.forwardTo : null;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +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.
|
||||
|
||||
// @dart = 2.10
|
||||
|
||||
import '../constants/values.dart' show ConstantValue, PrimitiveConstantValue;
|
||||
import '../elements/entities.dart';
|
||||
import '../elements/names.dart';
|
||||
|
@ -13,7 +11,7 @@ import '../serialization/serialization.dart';
|
|||
import '../universe/selector.dart';
|
||||
import '../universe/world_builder.dart';
|
||||
import '../universe/use.dart';
|
||||
import '../world.dart';
|
||||
import '../world_interfaces.dart';
|
||||
import 'abstract_value_domain.dart';
|
||||
import 'abstract_value_strategy.dart';
|
||||
|
||||
|
@ -25,9 +23,7 @@ class WrappedAbstractValue implements AbstractValue {
|
|||
bool operator ==(var other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (other is! WrappedAbstractValue) return false;
|
||||
WrappedAbstractValue otherWrapped = other;
|
||||
return other is WrappedAbstractValue &&
|
||||
_abstractValue == otherWrapped._abstractValue;
|
||||
return _abstractValue == other._abstractValue;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -39,11 +35,11 @@ class WrappedAbstractValue implements AbstractValue {
|
|||
String toString() => _abstractValue.toString();
|
||||
}
|
||||
|
||||
AbstractValue unwrapOrNull(WrappedAbstractValue wrapped) {
|
||||
AbstractValue? unwrapOrNull(WrappedAbstractValue? wrapped) {
|
||||
return wrapped?._abstractValue;
|
||||
}
|
||||
|
||||
WrappedAbstractValue wrapOrNull(AbstractValue abstractValue) {
|
||||
WrappedAbstractValue? wrapOrNull(AbstractValue? abstractValue) {
|
||||
return abstractValue == null ? null : WrappedAbstractValue(abstractValue);
|
||||
}
|
||||
|
||||
|
@ -88,7 +84,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isJsIndexable(value._abstractValue);
|
||||
|
||||
@override
|
||||
MemberEntity locateSingleMember(
|
||||
MemberEntity? locateSingleMember(
|
||||
covariant WrappedAbstractValue receiver, Selector selector) =>
|
||||
_abstractValueDomain.locateSingleMember(
|
||||
receiver._abstractValue, selector);
|
||||
|
@ -115,7 +111,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
WrappedAbstractValue(_abstractValueDomain.computeReceiver(members));
|
||||
|
||||
@override
|
||||
PrimitiveConstantValue getPrimitiveValue(
|
||||
PrimitiveConstantValue? getPrimitiveValue(
|
||||
covariant WrappedAbstractValue value) =>
|
||||
_abstractValueDomain.getPrimitiveValue(value._abstractValue);
|
||||
|
||||
|
@ -131,17 +127,17 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isPrimitiveValue(value._abstractValue);
|
||||
|
||||
@override
|
||||
MemberEntity getAllocationElement(covariant WrappedAbstractValue value) =>
|
||||
MemberEntity? getAllocationElement(covariant WrappedAbstractValue value) =>
|
||||
_abstractValueDomain.getAllocationElement(value._abstractValue);
|
||||
|
||||
@override
|
||||
Object getAllocationNode(covariant WrappedAbstractValue value) =>
|
||||
Object? getAllocationNode(covariant WrappedAbstractValue value) =>
|
||||
_abstractValueDomain.getAllocationNode(value._abstractValue);
|
||||
|
||||
@override
|
||||
AbstractValue getGeneralization(covariant WrappedAbstractValue value) =>
|
||||
WrappedAbstractValue(
|
||||
_abstractValueDomain.getGeneralization(unwrapOrNull(value)));
|
||||
_abstractValueDomain.getGeneralization(unwrapOrNull(value))!);
|
||||
|
||||
@override
|
||||
bool isSpecializationOf(covariant WrappedAbstractValue specialization,
|
||||
|
@ -162,14 +158,14 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createDictionaryValue(
|
||||
covariant WrappedAbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
covariant WrappedAbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant WrappedAbstractValue key,
|
||||
covariant WrappedAbstractValue value,
|
||||
covariant Map<String, AbstractValue> mappings) {
|
||||
return WrappedAbstractValue(_abstractValueDomain.createDictionaryValue(
|
||||
originalValue._abstractValue,
|
||||
originalValue?._abstractValue,
|
||||
allocationNode,
|
||||
allocationElement,
|
||||
key._abstractValue,
|
||||
|
@ -195,13 +191,13 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createMapValue(
|
||||
covariant WrappedAbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
covariant WrappedAbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant WrappedAbstractValue key,
|
||||
covariant WrappedAbstractValue value) =>
|
||||
WrappedAbstractValue(_abstractValueDomain.createMapValue(
|
||||
originalValue._abstractValue,
|
||||
originalValue?._abstractValue,
|
||||
allocationNode,
|
||||
allocationElement,
|
||||
key._abstractValue,
|
||||
|
@ -218,12 +214,12 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createSetValue(
|
||||
covariant WrappedAbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
covariant WrappedAbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant WrappedAbstractValue elementType) =>
|
||||
WrappedAbstractValue(_abstractValueDomain.createSetValue(
|
||||
originalValue._abstractValue,
|
||||
originalValue?._abstractValue,
|
||||
allocationNode,
|
||||
allocationElement,
|
||||
elementType._abstractValue));
|
||||
|
@ -233,7 +229,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isSet(value._abstractValue);
|
||||
|
||||
@override
|
||||
int getContainerLength(covariant WrappedAbstractValue value) =>
|
||||
int? getContainerLength(covariant WrappedAbstractValue value) =>
|
||||
_abstractValueDomain.getContainerLength(value._abstractValue);
|
||||
|
||||
@override
|
||||
|
@ -243,13 +239,13 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createContainerValue(
|
||||
covariant WrappedAbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
covariant WrappedAbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant WrappedAbstractValue elementType,
|
||||
int length) =>
|
||||
int? length) =>
|
||||
WrappedAbstractValue(_abstractValueDomain.createContainerValue(
|
||||
originalValue._abstractValue,
|
||||
originalValue?._abstractValue,
|
||||
allocationNode,
|
||||
allocationElement,
|
||||
elementType._abstractValue,
|
||||
|
@ -266,7 +262,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.computeAbstractValueForConstant(value));
|
||||
|
||||
@override
|
||||
AbstractValue getAbstractValueForNativeMethodParameterType(DartType type) {
|
||||
AbstractValue? getAbstractValueForNativeMethodParameterType(DartType type) {
|
||||
return wrapOrNull(_abstractValueDomain
|
||||
.getAbstractValueForNativeMethodParameterType(type));
|
||||
}
|
||||
|
@ -410,7 +406,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isLateSentinel(value._abstractValue);
|
||||
|
||||
@override
|
||||
ClassEntity getExactClass(covariant WrappedAbstractValue value) =>
|
||||
ClassEntity? getExactClass(covariant WrappedAbstractValue value) =>
|
||||
_abstractValueDomain.getExactClass(value._abstractValue);
|
||||
|
||||
@override
|
||||
|
@ -492,7 +488,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValueWithPrecision createFromStaticType(DartType type,
|
||||
{ClassRelation classRelation = ClassRelation.subtype,
|
||||
/* required */ bool nullable}) {
|
||||
required bool nullable}) {
|
||||
var unwrapped = _abstractValueDomain.createFromStaticType(type,
|
||||
classRelation: classRelation, nullable: nullable);
|
||||
return AbstractValueWithPrecision(
|
||||
|
@ -627,7 +623,7 @@ class WrappedSelectorStrategy implements SelectorConstraintsStrategy {
|
|||
|
||||
@override
|
||||
UniverseSelectorConstraints createSelectorConstraints(
|
||||
Selector selector, Object initialConstraint) {
|
||||
Selector selector, Object? initialConstraint) {
|
||||
return WrappedUniverseSelectorConstraints(
|
||||
_selectorConstraintsStrategy.createSelectorConstraints(
|
||||
selector,
|
||||
|
@ -640,8 +636,8 @@ class WrappedSelectorStrategy implements SelectorConstraintsStrategy {
|
|||
bool appliedUnnamed(DynamicUse dynamicUse, MemberEntity member,
|
||||
covariant JClosedWorld world) {
|
||||
return _selectorConstraintsStrategy.appliedUnnamed(
|
||||
dynamicUse.withReceiverConstraint(
|
||||
unwrapOrNull(dynamicUse.receiverConstraint)),
|
||||
dynamicUse.withReceiverConstraint(unwrapOrNull(
|
||||
dynamicUse.receiverConstraint as WrappedAbstractValue?)),
|
||||
member,
|
||||
world);
|
||||
}
|
||||
|
@ -653,7 +649,7 @@ class WrappedUniverseSelectorConstraints
|
|||
const WrappedUniverseSelectorConstraints(this._universeSelectorConstraints);
|
||||
|
||||
@override
|
||||
bool addReceiverConstraint(Object constraint) =>
|
||||
bool addReceiverConstraint(Object? constraint) =>
|
||||
_universeSelectorConstraints.addReceiverConstraint(constraint == null
|
||||
? null
|
||||
: (constraint as WrappedAbstractValue)._abstractValue);
|
||||
|
|
|
@ -2,8 +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.
|
||||
|
||||
// @dart = 2.10
|
||||
|
||||
import '../../constants/values.dart' show ConstantValue, PrimitiveConstantValue;
|
||||
import '../../elements/entities.dart';
|
||||
import '../../elements/names.dart';
|
||||
|
@ -13,7 +11,7 @@ import '../../serialization/serialization.dart';
|
|||
import '../../universe/selector.dart';
|
||||
import '../../universe/world_builder.dart';
|
||||
import '../../universe/use.dart';
|
||||
import '../../world.dart';
|
||||
import '../../world_interfaces.dart';
|
||||
import '../../inferrer/abstract_value_domain.dart';
|
||||
import '../../inferrer/abstract_value_strategy.dart';
|
||||
import 'powerset_bits.dart';
|
||||
|
@ -30,10 +28,8 @@ class PowersetValue implements AbstractValue {
|
|||
bool operator ==(var other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (other is! PowersetValue) return false;
|
||||
PowersetValue otherPowerset = other;
|
||||
return other is PowersetValue &&
|
||||
_abstractValue == otherPowerset._abstractValue &&
|
||||
_powersetBits == otherPowerset._powersetBits;
|
||||
return _abstractValue == other._abstractValue &&
|
||||
_powersetBits == other._powersetBits;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -47,11 +43,11 @@ class PowersetValue implements AbstractValue {
|
|||
'${_abstractValue}';
|
||||
}
|
||||
|
||||
AbstractValue unwrapOrNull(PowersetValue powerset) {
|
||||
AbstractValue? unwrapOrNull(PowersetValue? powerset) {
|
||||
return powerset?._abstractValue;
|
||||
}
|
||||
|
||||
PowersetValue wrapOrNull(AbstractValue abstractValue, int powersetBits) {
|
||||
PowersetValue? wrapOrNull(AbstractValue? abstractValue, int powersetBits) {
|
||||
return abstractValue == null
|
||||
? null
|
||||
: PowersetValue(abstractValue, powersetBits);
|
||||
|
@ -115,7 +111,7 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
: _abstractValueDomain.isJsIndexable(value._abstractValue);
|
||||
|
||||
@override
|
||||
MemberEntity locateSingleMember(
|
||||
MemberEntity? locateSingleMember(
|
||||
covariant PowersetValue receiver, Selector selector) =>
|
||||
_abstractValueDomain.locateSingleMember(
|
||||
receiver._abstractValue, selector);
|
||||
|
@ -155,7 +151,7 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
}
|
||||
|
||||
@override
|
||||
PrimitiveConstantValue getPrimitiveValue(covariant PowersetValue value) =>
|
||||
PrimitiveConstantValue? getPrimitiveValue(covariant PowersetValue value) =>
|
||||
_powersetBitsDomain.getPrimitiveValue(value.powersetBits) ??
|
||||
_abstractValueDomain.getPrimitiveValue(value._abstractValue);
|
||||
|
||||
|
@ -174,18 +170,18 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isPrimitiveValue(value._abstractValue);
|
||||
|
||||
@override
|
||||
MemberEntity getAllocationElement(covariant PowersetValue value) =>
|
||||
MemberEntity? getAllocationElement(covariant PowersetValue value) =>
|
||||
_abstractValueDomain.getAllocationElement(value._abstractValue);
|
||||
|
||||
@override
|
||||
Object getAllocationNode(covariant PowersetValue value) =>
|
||||
Object? getAllocationNode(covariant PowersetValue value) =>
|
||||
_abstractValueDomain.getAllocationNode(value._abstractValue);
|
||||
|
||||
@override
|
||||
AbstractValue getGeneralization(covariant PowersetValue value) {
|
||||
int powersetBits = _powersetBitsDomain.powersetTop;
|
||||
AbstractValue abstractValue =
|
||||
_abstractValueDomain.getGeneralization(unwrapOrNull(value));
|
||||
final abstractValue =
|
||||
_abstractValueDomain.getGeneralization(unwrapOrNull(value))!;
|
||||
return PowersetValue(abstractValue, powersetBits);
|
||||
}
|
||||
|
||||
|
@ -214,12 +210,12 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValue createDictionaryValue(
|
||||
covariant PowersetValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant PowersetValue key,
|
||||
covariant PowersetValue value,
|
||||
covariant Map<String, AbstractValue> mappings) {
|
||||
int powersetBits = originalValue._powersetBits;
|
||||
final powersetBits = originalValue._powersetBits;
|
||||
AbstractValue abstractValue = _abstractValueDomain.createDictionaryValue(
|
||||
originalValue._abstractValue,
|
||||
allocationNode,
|
||||
|
@ -260,8 +256,8 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValue createMapValue(
|
||||
covariant PowersetValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant PowersetValue key,
|
||||
covariant PowersetValue value) {
|
||||
int powersetBits = originalValue._powersetBits;
|
||||
|
@ -292,8 +288,8 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValue createSetValue(
|
||||
covariant PowersetValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant PowersetValue elementType) {
|
||||
int powersetBits = originalValue._powersetBits;
|
||||
AbstractValue abstractValue = _abstractValueDomain.createSetValue(
|
||||
|
@ -310,7 +306,7 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isSet(value._abstractValue);
|
||||
|
||||
@override
|
||||
int getContainerLength(covariant PowersetValue value) =>
|
||||
int? getContainerLength(covariant PowersetValue value) =>
|
||||
_powersetBitsDomain.isOther(value._powersetBits).isDefinitelyFalse
|
||||
? null
|
||||
: _abstractValueDomain.getContainerLength(value._abstractValue);
|
||||
|
@ -328,10 +324,10 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValue createContainerValue(
|
||||
covariant PowersetValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant PowersetValue elementType,
|
||||
int length) {
|
||||
int? length) {
|
||||
int powersetBits = originalValue._powersetBits;
|
||||
AbstractValue abstractValue = _abstractValueDomain.createContainerValue(
|
||||
originalValue._abstractValue,
|
||||
|
@ -359,9 +355,9 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
}
|
||||
|
||||
@override
|
||||
AbstractValue getAbstractValueForNativeMethodParameterType(DartType type) {
|
||||
AbstractValue? getAbstractValueForNativeMethodParameterType(DartType type) {
|
||||
int powersetBits = _powersetBitsDomain.powersetTop;
|
||||
AbstractValue abstractValue =
|
||||
final abstractValue =
|
||||
_abstractValueDomain.getAbstractValueForNativeMethodParameterType(type);
|
||||
return wrapOrNull(abstractValue, powersetBits);
|
||||
}
|
||||
|
@ -389,11 +385,11 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
}
|
||||
|
||||
@override
|
||||
AbstractValue unionOfMany(covariant Iterable<AbstractValue> values) {
|
||||
AbstractValue unionOfMany(covariant Iterable<PowersetValue> values) {
|
||||
PowersetValue result = PowersetValue(
|
||||
_abstractValueDomain.emptyType, _powersetBitsDomain.powersetBottom);
|
||||
for (PowersetValue value in values) {
|
||||
result = union(result, value);
|
||||
for (final value in values) {
|
||||
result = union(result, value) as PowersetValue;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -563,7 +559,7 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isLateSentinel(value._abstractValue));
|
||||
|
||||
@override
|
||||
ClassEntity getExactClass(covariant PowersetValue value) =>
|
||||
ClassEntity? getExactClass(covariant PowersetValue value) =>
|
||||
_abstractValueDomain.getExactClass(value._abstractValue);
|
||||
|
||||
@override
|
||||
|
@ -688,7 +684,8 @@ class PowersetDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValueWithPrecision createFromStaticType(DartType type,
|
||||
{ClassRelation classRelation = ClassRelation.subtype, bool nullable}) {
|
||||
{ClassRelation classRelation = ClassRelation.subtype,
|
||||
required bool nullable}) {
|
||||
int powersetBits = _powersetBitsDomain.createFromStaticType(type,
|
||||
classRelation: classRelation, nullable: nullable);
|
||||
var unwrapped = _abstractValueDomain.createFromStaticType(type,
|
||||
|
@ -833,7 +830,7 @@ class PowersetsSelectorStrategy implements SelectorConstraintsStrategy {
|
|||
|
||||
@override
|
||||
UniverseSelectorConstraints createSelectorConstraints(
|
||||
Selector selector, Object initialConstraint) {
|
||||
Selector selector, Object? initialConstraint) {
|
||||
return PowersetsUniverseSelectorConstraints(
|
||||
_selectorConstraintsStrategy.createSelectorConstraints(
|
||||
selector,
|
||||
|
@ -847,7 +844,7 @@ class PowersetsSelectorStrategy implements SelectorConstraintsStrategy {
|
|||
covariant JClosedWorld world) {
|
||||
return _selectorConstraintsStrategy.appliedUnnamed(
|
||||
dynamicUse.withReceiverConstraint(
|
||||
unwrapOrNull(dynamicUse.receiverConstraint)),
|
||||
unwrapOrNull(dynamicUse.receiverConstraint as PowersetValue?)),
|
||||
member,
|
||||
world);
|
||||
}
|
||||
|
@ -859,7 +856,7 @@ class PowersetsUniverseSelectorConstraints
|
|||
const PowersetsUniverseSelectorConstraints(this._universeSelectorConstraints);
|
||||
|
||||
@override
|
||||
bool addReceiverConstraint(Object constraint) =>
|
||||
bool addReceiverConstraint(Object? constraint) =>
|
||||
_universeSelectorConstraints.addReceiverConstraint(constraint == null
|
||||
? null
|
||||
: (constraint as PowersetValue)._abstractValue);
|
||||
|
|
|
@ -2,8 +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.
|
||||
|
||||
// @dart = 2.10
|
||||
|
||||
import '../constants/values.dart' show ConstantValue, PrimitiveConstantValue;
|
||||
import '../elements/entities.dart';
|
||||
import '../elements/names.dart';
|
||||
|
@ -13,7 +11,7 @@ import '../serialization/serialization.dart';
|
|||
import '../universe/selector.dart';
|
||||
import '../universe/world_builder.dart';
|
||||
import '../universe/use.dart';
|
||||
import '../world.dart';
|
||||
import '../world_interfaces.dart';
|
||||
import '../inferrer/abstract_value_domain.dart';
|
||||
import '../inferrer/abstract_value_strategy.dart';
|
||||
|
||||
|
@ -55,7 +53,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
AbstractBool isJsIndexable(AbstractValue value) => AbstractBool.Maybe;
|
||||
|
||||
@override
|
||||
MemberEntity locateSingleMember(AbstractValue receiver, Selector selector) =>
|
||||
MemberEntity? locateSingleMember(AbstractValue receiver, Selector selector) =>
|
||||
null;
|
||||
|
||||
@override
|
||||
|
@ -77,7 +75,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
const TrivialAbstractValue();
|
||||
|
||||
@override
|
||||
PrimitiveConstantValue getPrimitiveValue(AbstractValue value) => null;
|
||||
PrimitiveConstantValue? getPrimitiveValue(AbstractValue value) => null;
|
||||
|
||||
@override
|
||||
AbstractValue createPrimitiveValue(
|
||||
|
@ -88,13 +86,13 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
bool isPrimitiveValue(AbstractValue value) => false;
|
||||
|
||||
@override
|
||||
MemberEntity getAllocationElement(AbstractValue value) => null;
|
||||
MemberEntity? getAllocationElement(AbstractValue value) => null;
|
||||
|
||||
@override
|
||||
Object getAllocationNode(AbstractValue value) => null;
|
||||
Object? getAllocationNode(AbstractValue value) => null;
|
||||
|
||||
@override
|
||||
AbstractValue getGeneralization(AbstractValue value) =>
|
||||
AbstractValue getGeneralization(AbstractValue? value) =>
|
||||
const TrivialAbstractValue();
|
||||
|
||||
@override
|
||||
|
@ -115,9 +113,9 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createDictionaryValue(
|
||||
AbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
AbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
AbstractValue key,
|
||||
AbstractValue value,
|
||||
Map<String, AbstractValue> mappings) =>
|
||||
|
@ -138,9 +136,9 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createMapValue(
|
||||
AbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
AbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
AbstractValue key,
|
||||
AbstractValue value) =>
|
||||
const TrivialAbstractValue();
|
||||
|
@ -155,9 +153,9 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createSetValue(
|
||||
AbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
AbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
AbstractValue elementType) =>
|
||||
const TrivialAbstractValue();
|
||||
|
||||
|
@ -165,7 +163,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
bool isSet(AbstractValue value) => false;
|
||||
|
||||
@override
|
||||
int getContainerLength(AbstractValue value) => null;
|
||||
int? getContainerLength(AbstractValue value) => null;
|
||||
|
||||
@override
|
||||
AbstractValue getContainerElementType(AbstractValue value) {
|
||||
|
@ -175,11 +173,11 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createContainerValue(
|
||||
AbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
AbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
AbstractValue elementType,
|
||||
int length) =>
|
||||
int? length) =>
|
||||
const TrivialAbstractValue();
|
||||
|
||||
@override
|
||||
|
@ -190,7 +188,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
const TrivialAbstractValue();
|
||||
|
||||
@override
|
||||
AbstractValue getAbstractValueForNativeMethodParameterType(DartType type) =>
|
||||
AbstractValue? getAbstractValueForNativeMethodParameterType(DartType type) =>
|
||||
null;
|
||||
|
||||
@override
|
||||
|
@ -295,7 +293,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
AbstractBool isLateSentinel(AbstractValue value) => AbstractBool.Maybe;
|
||||
|
||||
@override
|
||||
ClassEntity getExactClass(AbstractValue value) => null;
|
||||
ClassEntity? getExactClass(AbstractValue value) => null;
|
||||
|
||||
@override
|
||||
AbstractBool isExact(AbstractValue value) => AbstractBool.Maybe;
|
||||
|
@ -364,8 +362,7 @@ class TrivialAbstractValueDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValueWithPrecision createFromStaticType(DartType type,
|
||||
{ClassRelation classRelation = ClassRelation.subtype,
|
||||
/* required */ bool nullable}) {
|
||||
assert(nullable != null);
|
||||
required bool nullable}) {
|
||||
return const AbstractValueWithPrecision(TrivialAbstractValue(), false);
|
||||
}
|
||||
|
||||
|
@ -467,7 +464,7 @@ class TrivialSelectorStrategy implements SelectorConstraintsStrategy {
|
|||
|
||||
@override
|
||||
UniverseSelectorConstraints createSelectorConstraints(
|
||||
Selector selector, Object initialConstraint) {
|
||||
Selector selector, Object? initialConstraint) {
|
||||
return const TrivialUniverseSelectorConstraints();
|
||||
}
|
||||
|
||||
|
|
|
@ -818,7 +818,7 @@ class CommonMasks implements AbstractValueDomain {
|
|||
Map<TypeMask, AbstractBool> _isInterceptorCacheSecondChance = {};
|
||||
|
||||
@override
|
||||
bool isMap(TypeMask value) => value is ValueTypeMask;
|
||||
bool isMap(TypeMask value) => value is MapTypeMask;
|
||||
|
||||
@override
|
||||
bool isSet(TypeMask value) => value is SetTypeMask;
|
||||
|
@ -898,7 +898,7 @@ class CommonMasks implements AbstractValueDomain {
|
|||
}
|
||||
|
||||
@override
|
||||
AbstractValue? getGeneralization(AbstractValue value) {
|
||||
AbstractValue? getGeneralization(AbstractValue? value) {
|
||||
return value is AllocationTypeMask ? value.forwardTo : null;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +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.
|
||||
|
||||
// @dart = 2.10
|
||||
|
||||
import '../constants/values.dart' show ConstantValue, PrimitiveConstantValue;
|
||||
import '../elements/entities.dart';
|
||||
import '../elements/names.dart';
|
||||
|
@ -13,7 +11,7 @@ import '../serialization/serialization.dart';
|
|||
import '../universe/selector.dart';
|
||||
import '../universe/world_builder.dart';
|
||||
import '../universe/use.dart';
|
||||
import '../world.dart';
|
||||
import '../world_interfaces.dart';
|
||||
import '../inferrer/abstract_value_domain.dart';
|
||||
import '../inferrer/abstract_value_strategy.dart';
|
||||
|
||||
|
@ -25,9 +23,7 @@ class WrappedAbstractValue implements AbstractValue {
|
|||
bool operator ==(var other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (other is! WrappedAbstractValue) return false;
|
||||
WrappedAbstractValue otherWrapped = other;
|
||||
return other is WrappedAbstractValue &&
|
||||
_abstractValue == otherWrapped._abstractValue;
|
||||
return _abstractValue == other._abstractValue;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -39,11 +35,11 @@ class WrappedAbstractValue implements AbstractValue {
|
|||
String toString() => _abstractValue.toString();
|
||||
}
|
||||
|
||||
AbstractValue unwrapOrNull(WrappedAbstractValue wrapped) {
|
||||
AbstractValue? unwrapOrNull(WrappedAbstractValue? wrapped) {
|
||||
return wrapped?._abstractValue;
|
||||
}
|
||||
|
||||
WrappedAbstractValue wrapOrNull(AbstractValue abstractValue) {
|
||||
WrappedAbstractValue? wrapOrNull(AbstractValue? abstractValue) {
|
||||
return abstractValue == null ? null : WrappedAbstractValue(abstractValue);
|
||||
}
|
||||
|
||||
|
@ -88,7 +84,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isJsIndexable(value._abstractValue);
|
||||
|
||||
@override
|
||||
MemberEntity locateSingleMember(
|
||||
MemberEntity? locateSingleMember(
|
||||
covariant WrappedAbstractValue receiver, Selector selector) =>
|
||||
_abstractValueDomain.locateSingleMember(
|
||||
receiver._abstractValue, selector);
|
||||
|
@ -115,7 +111,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
WrappedAbstractValue(_abstractValueDomain.computeReceiver(members));
|
||||
|
||||
@override
|
||||
PrimitiveConstantValue getPrimitiveValue(
|
||||
PrimitiveConstantValue? getPrimitiveValue(
|
||||
covariant WrappedAbstractValue value) =>
|
||||
_abstractValueDomain.getPrimitiveValue(value._abstractValue);
|
||||
|
||||
|
@ -131,17 +127,17 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isPrimitiveValue(value._abstractValue);
|
||||
|
||||
@override
|
||||
MemberEntity getAllocationElement(covariant WrappedAbstractValue value) =>
|
||||
MemberEntity? getAllocationElement(covariant WrappedAbstractValue value) =>
|
||||
_abstractValueDomain.getAllocationElement(value._abstractValue);
|
||||
|
||||
@override
|
||||
Object getAllocationNode(covariant WrappedAbstractValue value) =>
|
||||
Object? getAllocationNode(covariant WrappedAbstractValue value) =>
|
||||
_abstractValueDomain.getAllocationNode(value._abstractValue);
|
||||
|
||||
@override
|
||||
AbstractValue getGeneralization(covariant WrappedAbstractValue value) =>
|
||||
WrappedAbstractValue(
|
||||
_abstractValueDomain.getGeneralization(unwrapOrNull(value)));
|
||||
_abstractValueDomain.getGeneralization(unwrapOrNull(value))!);
|
||||
|
||||
@override
|
||||
bool isSpecializationOf(covariant WrappedAbstractValue specialization,
|
||||
|
@ -162,14 +158,14 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createDictionaryValue(
|
||||
covariant WrappedAbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
covariant WrappedAbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant WrappedAbstractValue key,
|
||||
covariant WrappedAbstractValue value,
|
||||
covariant Map<String, AbstractValue> mappings) {
|
||||
return WrappedAbstractValue(_abstractValueDomain.createDictionaryValue(
|
||||
originalValue._abstractValue,
|
||||
originalValue?._abstractValue,
|
||||
allocationNode,
|
||||
allocationElement,
|
||||
key._abstractValue,
|
||||
|
@ -195,13 +191,13 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createMapValue(
|
||||
covariant WrappedAbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
covariant WrappedAbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant WrappedAbstractValue key,
|
||||
covariant WrappedAbstractValue value) =>
|
||||
WrappedAbstractValue(_abstractValueDomain.createMapValue(
|
||||
originalValue._abstractValue,
|
||||
originalValue?._abstractValue,
|
||||
allocationNode,
|
||||
allocationElement,
|
||||
key._abstractValue,
|
||||
|
@ -218,12 +214,12 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createSetValue(
|
||||
covariant WrappedAbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
covariant WrappedAbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant WrappedAbstractValue elementType) =>
|
||||
WrappedAbstractValue(_abstractValueDomain.createSetValue(
|
||||
originalValue._abstractValue,
|
||||
originalValue?._abstractValue,
|
||||
allocationNode,
|
||||
allocationElement,
|
||||
elementType._abstractValue));
|
||||
|
@ -233,7 +229,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isSet(value._abstractValue);
|
||||
|
||||
@override
|
||||
int getContainerLength(covariant WrappedAbstractValue value) =>
|
||||
int? getContainerLength(covariant WrappedAbstractValue value) =>
|
||||
_abstractValueDomain.getContainerLength(value._abstractValue);
|
||||
|
||||
@override
|
||||
|
@ -243,13 +239,13 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
|
||||
@override
|
||||
AbstractValue createContainerValue(
|
||||
covariant WrappedAbstractValue originalValue,
|
||||
Object allocationNode,
|
||||
MemberEntity allocationElement,
|
||||
covariant WrappedAbstractValue? originalValue,
|
||||
Object? allocationNode,
|
||||
MemberEntity? allocationElement,
|
||||
covariant WrappedAbstractValue elementType,
|
||||
int length) =>
|
||||
int? length) =>
|
||||
WrappedAbstractValue(_abstractValueDomain.createContainerValue(
|
||||
originalValue._abstractValue,
|
||||
originalValue?._abstractValue,
|
||||
allocationNode,
|
||||
allocationElement,
|
||||
elementType._abstractValue,
|
||||
|
@ -266,7 +262,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.computeAbstractValueForConstant(value));
|
||||
|
||||
@override
|
||||
AbstractValue getAbstractValueForNativeMethodParameterType(DartType type) {
|
||||
AbstractValue? getAbstractValueForNativeMethodParameterType(DartType type) {
|
||||
return wrapOrNull(_abstractValueDomain
|
||||
.getAbstractValueForNativeMethodParameterType(type));
|
||||
}
|
||||
|
@ -410,7 +406,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
_abstractValueDomain.isLateSentinel(value._abstractValue);
|
||||
|
||||
@override
|
||||
ClassEntity getExactClass(covariant WrappedAbstractValue value) =>
|
||||
ClassEntity? getExactClass(covariant WrappedAbstractValue value) =>
|
||||
_abstractValueDomain.getExactClass(value._abstractValue);
|
||||
|
||||
@override
|
||||
|
@ -492,7 +488,7 @@ class WrappedAbstractValueDomain implements AbstractValueDomain {
|
|||
@override
|
||||
AbstractValueWithPrecision createFromStaticType(DartType type,
|
||||
{ClassRelation classRelation = ClassRelation.subtype,
|
||||
/* required */ bool nullable}) {
|
||||
required bool nullable}) {
|
||||
var unwrapped = _abstractValueDomain.createFromStaticType(type,
|
||||
classRelation: classRelation, nullable: nullable);
|
||||
return AbstractValueWithPrecision(
|
||||
|
@ -627,7 +623,7 @@ class WrappedSelectorStrategy implements SelectorConstraintsStrategy {
|
|||
|
||||
@override
|
||||
UniverseSelectorConstraints createSelectorConstraints(
|
||||
Selector selector, Object initialConstraint) {
|
||||
Selector selector, Object? initialConstraint) {
|
||||
return WrappedUniverseSelectorConstraints(
|
||||
_selectorConstraintsStrategy.createSelectorConstraints(
|
||||
selector,
|
||||
|
@ -640,8 +636,8 @@ class WrappedSelectorStrategy implements SelectorConstraintsStrategy {
|
|||
bool appliedUnnamed(DynamicUse dynamicUse, MemberEntity member,
|
||||
covariant JClosedWorld world) {
|
||||
return _selectorConstraintsStrategy.appliedUnnamed(
|
||||
dynamicUse.withReceiverConstraint(
|
||||
unwrapOrNull(dynamicUse.receiverConstraint)),
|
||||
dynamicUse.withReceiverConstraint(unwrapOrNull(
|
||||
dynamicUse.receiverConstraint as WrappedAbstractValue?)),
|
||||
member,
|
||||
world);
|
||||
}
|
||||
|
@ -653,7 +649,7 @@ class WrappedUniverseSelectorConstraints
|
|||
const WrappedUniverseSelectorConstraints(this._universeSelectorConstraints);
|
||||
|
||||
@override
|
||||
bool addReceiverConstraint(Object constraint) =>
|
||||
bool addReceiverConstraint(Object? constraint) =>
|
||||
_universeSelectorConstraints.addReceiverConstraint(constraint == null
|
||||
? null
|
||||
: (constraint as WrappedAbstractValue)._abstractValue);
|
||||
|
|
|
@ -52,7 +52,7 @@ class DynamicUse {
|
|||
"${selector.callStructure.typeArgumentCount} but "
|
||||
"${_typeArguments?.length ?? 0} were passed.");
|
||||
|
||||
DynamicUse withReceiverConstraint(Object otherReceiverConstraint) {
|
||||
DynamicUse withReceiverConstraint(Object? otherReceiverConstraint) {
|
||||
if (otherReceiverConstraint == receiverConstraint) {
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue