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

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

Issue 1067363003: Tweaks for Element encoding and decoding. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 6824 matching lines...) Expand 10 before | Expand all | Expand 10 after
6835 6835
6836 /** 6836 /**
6837 * The element representing the synthetic function `loadLibrary` that is 6837 * The element representing the synthetic function `loadLibrary` that is
6838 * 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 .
6839 */ 6839 */
6840 FunctionElement _loadLibraryFunction; 6840 FunctionElement _loadLibraryFunction;
6841 6841
6842 /** 6842 /**
6843 * A map from offsets to elements of this library at these offsets. 6843 * A map from offsets to elements of this library at these offsets.
6844 */ 6844 */
6845 final Map<int, Element> _elementMap = new HashMap<int, Element>(); 6845 final Map<int, Element> _offsetToElementMap = new HashMap<int, Element>();
6846 6846
6847 /** 6847 /**
6848 * 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
6849 * computed yet. 6849 * computed yet.
6850 */ 6850 */
6851 @override 6851 @override
6852 Namespace exportNamespace; 6852 Namespace exportNamespace;
6853 6853
6854 /** 6854 /**
6855 * 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
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
7112 return new List.from(visibleLibraries); 7112 return new List.from(visibleLibraries);
7113 } 7113 }
7114 7114
7115 @override 7115 @override
7116 bool operator ==(Object object) => object is LibraryElementImpl && 7116 bool operator ==(Object object) => object is LibraryElementImpl &&
7117 _definingCompilationUnit == object.definingCompilationUnit; 7117 _definingCompilationUnit == object.definingCompilationUnit;
7118 7118
7119 @override 7119 @override
7120 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this); 7120 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this);
7121 7121
7122 /**
7123 * This method is invoked after this library was incrementally resolved.
7124 */
7125 void afterIncrementalResolution() {
7126 _offsetToElementMap.clear();
7127 }
7128
7122 @override 7129 @override
7123 ElementImpl getChild(String identifier) { 7130 ElementImpl getChild(String identifier) {
7124 if ((_definingCompilationUnit as CompilationUnitElementImpl).identifier == 7131 if ((_definingCompilationUnit as CompilationUnitElementImpl).identifier ==
7125 identifier) { 7132 identifier) {
7126 return _definingCompilationUnit as CompilationUnitElementImpl; 7133 return _definingCompilationUnit as CompilationUnitElementImpl;
7127 } 7134 }
7128 for (CompilationUnitElement part in _parts) { 7135 for (CompilationUnitElement part in _parts) {
7129 if ((part as CompilationUnitElementImpl).identifier == identifier) { 7136 if ((part as CompilationUnitElementImpl).identifier == identifier) {
7130 return part as CompilationUnitElementImpl; 7137 return part as CompilationUnitElementImpl;
7131 } 7138 }
7132 } 7139 }
7133 for (ImportElement importElement in _imports) { 7140 for (ImportElement importElement in _imports) {
7134 if ((importElement as ImportElementImpl).identifier == identifier) { 7141 if ((importElement as ImportElementImpl).identifier == identifier) {
7135 return importElement as ImportElementImpl; 7142 return importElement as ImportElementImpl;
7136 } 7143 }
7137 } 7144 }
7138 for (ExportElement exportElement in _exports) { 7145 for (ExportElement exportElement in _exports) {
7139 if ((exportElement as ExportElementImpl).identifier == identifier) { 7146 if ((exportElement as ExportElementImpl).identifier == identifier) {
7140 return exportElement as ExportElementImpl; 7147 return exportElement as ExportElementImpl;
7141 } 7148 }
7142 } 7149 }
7143 return null; 7150 return null;
7144 } 7151 }
7145 7152
7146 @override 7153 @override
7147 Element getElementAt(int offset) { 7154 Element getElementAt(int offset) {
7148 if (_elementMap.isEmpty) { 7155 if (_offsetToElementMap.isEmpty) {
7149 accept(new _BuildOffsetToElementMap(_elementMap)); 7156 accept(new _BuildOffsetToElementMap(_offsetToElementMap));
7150 } 7157 }
7151 return _elementMap[offset]; 7158 return _offsetToElementMap[offset];
7152 } 7159 }
7153 7160
7154 @override 7161 @override
7155 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) { 7162 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) {
7156 int count = _imports.length; 7163 int count = _imports.length;
7157 List<ImportElement> importList = new List<ImportElement>(); 7164 List<ImportElement> importList = new List<ImportElement>();
7158 for (int i = 0; i < count; i++) { 7165 for (int i = 0; i < count; i++) {
7159 if (identical(_imports[i].prefix, prefixElement)) { 7166 if (identical(_imports[i].prefix, prefixElement)) {
7160 importList.add(_imports[i]); 7167 importList.add(_imports[i]);
7161 } 7168 }
(...skipping 2972 matching lines...) Expand 10 before | Expand all | Expand 10 after
10134 10141
10135 @override 10142 @override
10136 void visitElement(Element element) { 10143 void visitElement(Element element) {
10137 int offset = element.nameOffset; 10144 int offset = element.nameOffset;
10138 if (offset != -1) { 10145 if (offset != -1) {
10139 map[offset] = element; 10146 map[offset] = element;
10140 } 10147 }
10141 super.visitElement(element); 10148 super.visitElement(element);
10142 } 10149 }
10143 } 10150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698