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

Side by Side Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 1075773002: Use file/offset/kind triplet as elements id. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks for review comments. Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/test/services/index/store/split_store_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.element; 8 library engine.element;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 6748 matching lines...) Expand 10 before | Expand all | Expand 10 after
6759 * the `part` directive. 6759 * the `part` directive.
6760 */ 6760 */
6761 List<CompilationUnitElement> get units; 6761 List<CompilationUnitElement> get units;
6762 6762
6763 /** 6763 /**
6764 * Return a list containing all directly and indirectly imported libraries. 6764 * Return a list containing all directly and indirectly imported libraries.
6765 */ 6765 */
6766 List<LibraryElement> get visibleLibraries; 6766 List<LibraryElement> get visibleLibraries;
6767 6767
6768 /** 6768 /**
6769 * Return the element at the given [offset], maybe `null` if no such element.
6770 */
6771 Element getElementAt(int offset);
6772
6773 /**
6769 * Return a list containing all of the imports that share the given [prefix], 6774 * Return a list containing all of the imports that share the given [prefix],
6770 * or an empty array if there are no such imports. 6775 * or an empty array if there are no such imports.
6771 */ 6776 */
6772 List<ImportElement> getImportsWithPrefix(PrefixElement prefix); 6777 List<ImportElement> getImportsWithPrefix(PrefixElement prefix);
6773 6778
6774 /** 6779 /**
6775 * Return the class defined in this library that has the given [name], or 6780 * Return the class defined in this library that has the given [name], or
6776 * `null` if this library does not define a class with the given name. 6781 * `null` if this library does not define a class with the given name.
6777 */ 6782 */
6778 ClassElement getType(String className); 6783 ClassElement getType(String className);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
6828 */ 6833 */
6829 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; 6834 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY;
6830 6835
6831 /** 6836 /**
6832 * The element representing the synthetic function `loadLibrary` that is 6837 * The element representing the synthetic function `loadLibrary` that is
6833 * defined for this library, or `null` if the element has not yet been created . 6838 * defined for this library, or `null` if the element has not yet been created .
6834 */ 6839 */
6835 FunctionElement _loadLibraryFunction; 6840 FunctionElement _loadLibraryFunction;
6836 6841
6837 /** 6842 /**
6843 * A map from offsets to elements of this library at these offsets.
6844 */
6845 final Map<int, Element> _elementMap = new HashMap<int, Element>();
6846
6847 /**
6838 * The export [Namespace] of this library, `null` if it has not been 6848 * The export [Namespace] of this library, `null` if it has not been
6839 * computed yet. 6849 * computed yet.
6840 */ 6850 */
6841 @override 6851 @override
6842 Namespace exportNamespace; 6852 Namespace exportNamespace;
6843 6853
6844 /** 6854 /**
6845 * The public [Namespace] of this library, `null` if it has not been 6855 * The public [Namespace] of this library, `null` if it has not been
6846 * computed yet. 6856 * computed yet.
6847 */ 6857 */
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
7127 } 7137 }
7128 for (ExportElement exportElement in _exports) { 7138 for (ExportElement exportElement in _exports) {
7129 if ((exportElement as ExportElementImpl).identifier == identifier) { 7139 if ((exportElement as ExportElementImpl).identifier == identifier) {
7130 return exportElement as ExportElementImpl; 7140 return exportElement as ExportElementImpl;
7131 } 7141 }
7132 } 7142 }
7133 return null; 7143 return null;
7134 } 7144 }
7135 7145
7136 @override 7146 @override
7147 Element getElementAt(int offset) {
7148 if (_elementMap.isEmpty) {
7149 accept(new _BuildOffsetToElementMap(_elementMap));
7150 }
7151 return _elementMap[offset];
7152 }
7153
7154 @override
7137 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) { 7155 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) {
7138 int count = _imports.length; 7156 int count = _imports.length;
7139 List<ImportElement> importList = new List<ImportElement>(); 7157 List<ImportElement> importList = new List<ImportElement>();
7140 for (int i = 0; i < count; i++) { 7158 for (int i = 0; i < count; i++) {
7141 if (identical(_imports[i].prefix, prefixElement)) { 7159 if (identical(_imports[i].prefix, prefixElement)) {
7142 importList.add(_imports[i]); 7160 importList.add(_imports[i]);
7143 } 7161 }
7144 } 7162 }
7145 return importList; 7163 return importList;
7146 } 7164 }
(...skipping 2951 matching lines...) Expand 10 before | Expand all | Expand 10 after
10098 // void <: void (by reflexivity) 10116 // void <: void (by reflexivity)
10099 // bottom <: void (as bottom is a subtype of all types). 10117 // bottom <: void (as bottom is a subtype of all types).
10100 // void <: dynamic (as dynamic is a supertype of all types) 10118 // void <: dynamic (as dynamic is a supertype of all types)
10101 return identical(type, this) || type.isDynamic; 10119 return identical(type, this) || type.isDynamic;
10102 } 10120 }
10103 10121
10104 @override 10122 @override
10105 VoidTypeImpl substitute2( 10123 VoidTypeImpl substitute2(
10106 List<DartType> argumentTypes, List<DartType> parameterTypes) => this; 10124 List<DartType> argumentTypes, List<DartType> parameterTypes) => this;
10107 } 10125 }
10126
10127 /**
10128 * A visitor that visit all the elements recursively and fill the given [map].
10129 */
10130 class _BuildOffsetToElementMap extends GeneralizingElementVisitor {
10131 final Map<int, Element> map;
10132
10133 _BuildOffsetToElementMap(this.map);
10134
10135 @override
10136 void visitElement(Element element) {
10137 int offset = element.nameOffset;
10138 if (offset != -1) {
10139 map[offset] = element;
10140 }
10141 super.visitElement(element);
10142 }
10143 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/index/store/split_store_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698