@@ -146,7 +146,7 @@ sealed class Constant {}
146146/// Information about a const constructor invocation.
147147class ConstructorInvocation {
148148 /// The constructor that was called.
149- final ConstructorElement constructor ;
149+ final ConstructorElement2 constructor2 ;
150150
151151 /// Values of specified arguments, actual values for positional, and `null`
152152 /// for named (which are provided as [namedArguments] ).
@@ -156,10 +156,9 @@ class ConstructorInvocation {
156156 final Map <String , DartObjectImpl > namedArguments;
157157
158158 ConstructorInvocation (
159- this .constructor , this ._argumentValues, this .namedArguments);
159+ this .constructor2 , this ._argumentValues, this .namedArguments);
160160
161- /// The constructor that was called.
162- ConstructorElement2 get constructor2 => constructor.asElement2;
161+ ConstructorElement get constructor => constructor2.asElement;
163162
164163 /// The positional arguments passed to the constructor.
165164 List <DartObjectImpl > get positionalArguments {
@@ -906,13 +905,13 @@ class DartObjectImpl implements DartObject, Constant {
906905
907906 @override
908907 ExecutableElement ? toFunctionValue () {
909- var state = this .state;
910- return state is FunctionState ? state.element : null ;
908+ return toFunctionValue2 ().asElement;
911909 }
912910
913911 @override
914912 ExecutableElement2 ? toFunctionValue2 () {
915- return toFunctionValue ().asElement2;
913+ var state = this .state;
914+ return state is FunctionState ? state.element : null ;
916915 }
917916
918917 @override
@@ -1354,7 +1353,7 @@ class EvaluationException {
13541353/// The state of an object representing a function.
13551354class FunctionState extends InstanceState {
13561355 /// The element representing the function being modeled.
1357- final ExecutableElementImpl element;
1356+ final ExecutableElementImpl2 element;
13581357
13591358 final List <DartType >? typeArguments;
13601359
@@ -1366,12 +1365,12 @@ class FunctionState extends InstanceState {
13661365 /// aliased class.
13671366 ///
13681367 /// Otherwise null.
1369- final TypeDefiningElement ? _viaTypeAlias;
1368+ final TypeDefiningElement2 ? _viaTypeAlias;
13701369
13711370 /// Initialize a newly created state to represent the function with the given
13721371 /// [element] .
13731372 FunctionState (this .element,
1374- {this .typeArguments, TypeDefiningElement ? viaTypeAlias})
1373+ {this .typeArguments, TypeDefiningElement2 ? viaTypeAlias})
13751374 : _viaTypeAlias = viaTypeAlias;
13761375
13771376 @override
@@ -1408,7 +1407,7 @@ class FunctionState extends InstanceState {
14081407 }
14091408
14101409 @override
1411- StringState convertToString () => StringState (element.name );
1410+ StringState convertToString () => StringState (element.name3 );
14121411
14131412 @override
14141413 BoolState equalEqual (TypeSystemImpl typeSystem, InstanceState rightOperand) {
@@ -1422,7 +1421,7 @@ class FunctionState extends InstanceState {
14221421 BoolState isIdentical (TypeSystemImpl typeSystem, InstanceState rightOperand) {
14231422 if (rightOperand is FunctionState ) {
14241423 var otherElement = rightOperand.element;
1425- if (element.declaration != otherElement.declaration ) {
1424+ if (element.baseElement != otherElement.baseElement ) {
14261425 return BoolState .FALSE_STATE ;
14271426 }
14281427 if (_viaTypeAlias != rightOperand._viaTypeAlias) {
@@ -1451,7 +1450,7 @@ class FunctionState extends InstanceState {
14511450 }
14521451
14531452 @override
1454- String toString () => element.name ;
1453+ String toString () => element.name3 ?? '<unnamed>' ;
14551454}
14561455
14571456/// The state of an object representing a Dart object for which there is no more
@@ -1526,21 +1525,21 @@ class GenericState extends InstanceState {
15261525 bool hasPrimitiveEquality (FeatureSet featureSet) {
15271526 var type = _object.type;
15281527 if (type is InterfaceType ) {
1529- bool isFromDartCoreObject (ExecutableElement ? element) {
1530- var enclosing = element? .enclosingElement3 ;
1531- return enclosing is ClassElement && enclosing.isDartCoreObject;
1528+ bool isFromDartCoreObject (ExecutableElement2 ? element) {
1529+ var enclosing = element? .enclosingElement2 ;
1530+ return enclosing is ClassElement2 && enclosing.isDartCoreObject;
15321531 }
15331532
1534- var element = type.element ;
1535- var library = element.library ;
1533+ var element = type.element3 ;
1534+ var library = element.library2 ;
15361535
1537- var eqEq = type.lookUpMethod2 ('==' , library, concrete: true );
1536+ var eqEq = type.lookUpMethod3 ('==' , library, concrete: true );
15381537 if (! isFromDartCoreObject (eqEq)) {
15391538 return false ;
15401539 }
15411540
15421541 if (featureSet.isEnabled (Feature .patterns)) {
1543- var hash = type.lookUpGetter2 ('hashCode' , library, concrete: true );
1542+ var hash = type.lookUpGetter3 ('hashCode' , library, concrete: true );
15441543 if (! isFromDartCoreObject (hash)) {
15451544 return false ;
15461545 }
@@ -2462,15 +2461,15 @@ class InvalidConstant implements Constant {
24622461 }
24632462
24642463 /// Creates a constant evaluation error associated with an [element] .
2465- InvalidConstant .forElement (Element element, ErrorCode errorCode,
2464+ InvalidConstant .forElement (Element2 element, ErrorCode errorCode,
24662465 {List <Object >? arguments,
24672466 List <DiagnosticMessage >? contextMessages,
24682467 bool avoidReporting = false ,
24692468 bool isUnresolved = false ,
24702469 bool isRuntimeException = false })
24712470 : this ._(
2472- element.nameLength ,
2473- element.nameOffset ,
2471+ element.name3 ! .length ,
2472+ element.firstFragment.nameOffset2 ?? - 1 ,
24742473 errorCode,
24752474 arguments: arguments,
24762475 contextMessages: contextMessages,
0 commit comments