@@ -11,7 +11,6 @@ import 'package:analysis_server_plugin/src/utilities/selection.dart';
1111import 'package:analyzer/dart/analysis/analysis_options.dart' ;
1212import 'package:analyzer/dart/analysis/code_style_options.dart' ;
1313import 'package:analyzer/dart/analysis/results.dart' ;
14- import 'package:analyzer/dart/element/element.dart' ;
1514import 'package:analyzer/dart/element/element2.dart' ;
1615import 'package:analyzer/dart/element/nullability_suffix.dart' ;
1716import 'package:analyzer/dart/element/type.dart' ;
@@ -339,10 +338,6 @@ abstract class MultiCorrectionProducer
339338
340339 CorrectionProducerContext get context => _context;
341340
342- /// The library element for the library in which a correction is being
343- /// produced.
344- LibraryElement get libraryElement => unitResult.libraryElement;
345-
346341 /// The library element for the library in which a correction is being
347342 /// produced.
348343 LibraryElement2 get libraryElement2 => unitResult.libraryElement2;
@@ -375,7 +370,7 @@ abstract class ResolvedCorrectionProducer
375370 .getAnalysisOptionsForFile (unitResult.file);
376371
377372 InheritanceManager3 get inheritanceManager {
378- return (libraryElement as LibraryElementImpl ).session.inheritanceManager;
373+ return (libraryElement2 as LibraryElementImpl ).session.inheritanceManager;
379374 }
380375
381376 /// Whether [node] is in a static context.
@@ -394,10 +389,6 @@ abstract class ResolvedCorrectionProducer
394389 return method != null && method.isStatic;
395390 }
396391
397- /// The library element for the library in which a correction is being
398- /// produced.
399- LibraryElement get libraryElement => unitResult.libraryElement;
400-
401392 /// The library element for the library in which a correction is being
402393 /// produced.
403394 LibraryElement2 get libraryElement2 => unitResult.libraryElement2;
@@ -464,21 +455,6 @@ abstract class ResolvedCorrectionProducer
464455 return null ;
465456 }
466457
467- /// Returns the class element associated with the [target] , or `null` if there
468- /// is no such element.
469- InterfaceElement ? getTargetInterfaceElement (Expression target) {
470- var type = target.staticType;
471- if (type is InterfaceType ) {
472- return type.element;
473- } else if (target is Identifier ) {
474- var element = target.staticElement;
475- if (element is InterfaceElement ) {
476- return element;
477- }
478- }
479- return null ;
480- }
481-
482458 /// Returns the class element associated with the [target] , or `null` if there
483459 /// is no such element.
484460 InterfaceElement2 ? getTargetInterfaceElement2 (Expression target) {
@@ -512,7 +488,7 @@ abstract class ResolvedCorrectionProducer
512488 if (conditionalExpression.condition == expression) {
513489 return _coreTypeBool;
514490 } else {
515- var type = conditionalExpression.staticParameterElement ? .type;
491+ var type = conditionalExpression.correspondingParameter ? .type;
516492 if (type is InterfaceType && type.isDartCoreFunction) {
517493 return FunctionTypeImpl (
518494 typeFormals: const [],
@@ -526,19 +502,19 @@ abstract class ResolvedCorrectionProducer
526502 }
527503 // `=> myFunction();`.
528504 if (parent is ExpressionFunctionBody ) {
529- var executable = expression.enclosingExecutableElement ;
505+ var executable = expression.enclosingExecutableElement2 ;
530506 return executable? .returnType;
531507 }
532508 // `return myFunction();`.
533509 if (parent is ReturnStatement ) {
534- var executable = expression.enclosingExecutableElement ;
510+ var executable = expression.enclosingExecutableElement2 ;
535511 return executable? .returnType;
536512 }
537513 // `int v = myFunction();`.
538514 if (parent is VariableDeclaration ) {
539515 var variableDeclaration = parent;
540516 if (variableDeclaration.initializer == expression) {
541- var variableElement = variableDeclaration.declaredElement ;
517+ var variableElement = variableDeclaration.declaredFragment ? .element ;
542518 if (variableElement != null ) {
543519 return variableElement.type;
544520 }
@@ -561,9 +537,9 @@ abstract class ResolvedCorrectionProducer
561537 return assignment.writeType;
562538 } else {
563539 // `v += myFunction();`.
564- var method = assignment.staticElement ;
540+ var method = assignment.element ;
565541 if (method != null ) {
566- var parameters = method.parameters ;
542+ var parameters = method.formalParameters ;
567543 if (parameters.length == 1 ) {
568544 return parameters[0 ].type;
569545 }
@@ -574,17 +550,17 @@ abstract class ResolvedCorrectionProducer
574550 // `v + myFunction();`.
575551 if (parent is BinaryExpression ) {
576552 var binary = parent;
577- var method = binary.staticElement ;
553+ var method = binary.element ;
578554 if (method != null ) {
579555 if (binary.rightOperand == expression) {
580- var parameters = method.parameters ;
556+ var parameters = method.formalParameters ;
581557 return parameters.length == 1 ? parameters[0 ].type : null ;
582558 }
583559 }
584560 }
585561 // `foo( myFunction() );`.
586562 if (parent is ArgumentList ) {
587- var parameter = expression.staticParameterElement ;
563+ var parameter = expression.correspondingParameter ;
588564 return parameter? .type;
589565 }
590566 // `bool`.
0 commit comments