@@ -14,6 +14,7 @@ import 'package:analyzer/error/error.dart';
1414import 'package:analyzer/file_system/file_system.dart' ;
1515import 'package:analyzer/source/line_info.dart' ;
1616import 'package:analyzer/src/dart/analysis/file_state.dart' ;
17+ import 'package:analyzer/src/dart/element/element.dart' ;
1718import 'package:analyzer/src/dart/element/type_system.dart' ;
1819import 'package:analyzer/src/generated/engine.dart' ;
1920
@@ -266,12 +267,12 @@ class FileResultImpl extends AnalysisResultImpl implements FileResult {
266267
267268class LibraryElementResultImpl implements LibraryElementResult {
268269 @override
269- final LibraryElement element;
270+ final LibraryElementImpl element;
270271
271272 LibraryElementResultImpl (this .element);
272273
273274 @override
274- LibraryElement2 get element2 => element as LibraryElement2 ;
275+ LibraryElementImpl get element2 => element;
275276}
276277
277278class ParsedLibraryResultImpl extends AnalysisResultImpl
@@ -486,8 +487,9 @@ class ResolvedUnitResultImpl extends FileResultImpl
486487 bool get exists => fileState.exists;
487488
488489 @override
489- LibraryElement get libraryElement {
490- return unit.declaredElement! .library;
490+ LibraryElementImpl get libraryElement {
491+ var element = unit.declaredElement as CompilationUnitElementImpl ;
492+ return element.library;
491493 }
492494
493495 @override
@@ -500,13 +502,13 @@ class ResolvedUnitResultImpl extends FileResultImpl
500502 TypeProvider get typeProvider => libraryElement.typeProvider;
501503
502504 @override
503- TypeSystemImpl get typeSystem => libraryElement.typeSystem as TypeSystemImpl ;
505+ TypeSystemImpl get typeSystem => libraryElement.typeSystem;
504506}
505507
506508class UnitElementResultImpl extends FileResultImpl
507509 implements UnitElementResult {
508510 @override
509- final CompilationUnitElement element;
511+ final CompilationUnitElementImpl element;
510512
511513 UnitElementResultImpl ({
512514 required super .session,
@@ -515,5 +517,5 @@ class UnitElementResultImpl extends FileResultImpl
515517 });
516518
517519 @override
518- LibraryFragment get fragment => element as LibraryFragment ;
520+ LibraryFragment get fragment => element;
519521}
0 commit comments