@@ -24,7 +24,6 @@ import 'package:analyzer/src/dart/element/extensions.dart';
2424import 'package:analyzer/src/dart/element/type.dart' ;
2525import 'package:analyzer/src/dart/element/type_system.dart' ;
2626import 'package:analyzer/src/error/codes.dart' ;
27- import 'package:analyzer/src/utilities/extensions/element.dart' ;
2827import 'package:meta/meta.dart' ;
2928
3029/// The state of an object representing a boolean value.
@@ -183,24 +182,24 @@ class DartObjectImpl implements DartObject, Constant {
183182 /// The state of the object.
184183 final InstanceState state;
185184
186- /// If this object is the value of a constant variable, the variable.
187- final VariableFragmentImpl ? variable ;
185+ @override
186+ final VariableElementImpl ? variable2 ;
188187
189188 /// Initialize a newly created object to have the given [type] and [state] .
190189 factory DartObjectImpl (
191190 TypeSystemImpl typeSystem,
192191 TypeImpl type,
193192 InstanceState state, {
194- VariableFragmentImpl ? variable,
193+ VariableElementImpl ? variable,
195194 }) {
196195 type = type.extensionTypeErasure;
197- return DartObjectImpl ._(typeSystem, type, state, variable : variable);
196+ return DartObjectImpl ._(typeSystem, type, state, variable2 : variable);
198197 }
199198
200199 /// Creates a duplicate instance of [other] , tied to [variable] .
201200 factory DartObjectImpl .forVariable (
202201 DartObjectImpl other,
203- VariableFragmentImpl variable,
202+ VariableElementImpl variable,
204203 ) {
205204 return DartObjectImpl (
206205 other._typeSystem,
@@ -249,7 +248,7 @@ class DartObjectImpl implements DartObject, Constant {
249248 }
250249
251250 /// Initialize a newly created object to have the given [type] and [state] .
252- DartObjectImpl ._(this ._typeSystem, this .type, this .state, {this .variable }) {
251+ DartObjectImpl ._(this ._typeSystem, this .type, this .state, {this .variable2 }) {
253252 if (state case GenericState state) {
254253 state._object = this ;
255254 }
@@ -290,9 +289,6 @@ class DartObjectImpl implements DartObject, Constant {
290289 @visibleForTesting
291290 List <DartType >? get typeArguments => (state as FunctionState ).typeArguments;
292291
293- @override
294- VariableElement ? get variable2 => variable.asElement2 as VariableElement ? ;
295-
296292 @override
297293 bool operator == (Object other) {
298294 if (other is DartObjectImpl ) {
@@ -951,16 +947,6 @@ class DartObjectImpl implements DartObject, Constant {
951947 return null ;
952948 }
953949
954- /// Return an element corresponding to the value of the object being
955- /// represented, or `null`
956- /// if
957- /// * this object is not of a function type,
958- /// * the value of the object being represented is not known, or
959- /// * the value of the object being represented is `null` .
960- ExecutableElementOrMember ? toFunctionValue () {
961- return toFunctionValue2 ()? .asElement;
962- }
963-
964950 @override
965951 ExecutableElement2OrMember ? toFunctionValue2 () {
966952 var state = this .state;
0 commit comments