Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(990)

Unified Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 2967203002: Remove CompilationUnitElement.getElementAt(). (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/dart/element/element.dart ('k') | pkg/analyzer/lib/src/dart/element/handle.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/element/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 1986171013491f1f9f176447c1101a4d65c3aa01..b5cafba90bab2cc4029e97d0e8fdd722e89df391 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -12,7 +12,6 @@ import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/constant/value.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/dart/element/visitor.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/constant/value.dart';
import 'package:analyzer/src/dart/element/handle.dart';
@@ -1336,11 +1335,6 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
List<TopLevelVariableElement> _variables;
/**
- * A map from offsets to elements of this unit at these offsets.
- */
- final Map<int, Element> _offsetToElementMap = new HashMap<int, Element>();
-
- /**
* Resynthesized explicit top-level property accessors.
*/
UnitExplicitTopLevelAccessors _explicitTopLevelAccessors;
@@ -1614,13 +1608,6 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
T accept<T>(ElementVisitor<T> visitor) =>
visitor.visitCompilationUnitElement(this);
- /**
- * This method is invoked after this unit was incrementally resolved.
- */
- void afterIncrementalResolution() {
- _offsetToElementMap.clear();
- }
-
@override
void appendTo(StringBuffer buffer) {
if (source == null) {
@@ -1692,14 +1679,6 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
}
@override
- Element getElementAt(int offset) {
- if (_offsetToElementMap.isEmpty) {
- accept(new _BuildOffsetToElementMap(_offsetToElementMap));
- }
- return _offsetToElementMap[offset];
- }
-
- @override
ClassElement getEnum(String enumName) {
for (ClassElement enumDeclaration in _enums) {
if (enumDeclaration.name == enumName) {
@@ -9069,21 +9048,3 @@ abstract class VariableElementImpl extends ElementImpl
_initializer?.accept(visitor);
}
}
-
-/**
- * A visitor that visit all the elements recursively and fill the given [map].
- */
-class _BuildOffsetToElementMap extends GeneralizingElementVisitor {
- final Map<int, Element> map;
-
- _BuildOffsetToElementMap(this.map);
-
- @override
- void visitElement(Element element) {
- int offset = element.nameOffset;
- if (offset != -1) {
- map[offset] = element;
- }
- super.visitElement(element);
- }
-}
« no previous file with comments | « pkg/analyzer/lib/dart/element/element.dart ('k') | pkg/analyzer/lib/src/dart/element/handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698