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

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

Issue 739643003: Cache ElementLocation instance and index key/location ids. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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/lib/src/services/index/store/codec.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 3436 matching lines...) Expand 10 before | Expand all | Expand 10 after
3447 * An array containing all of the metadata associated with this element. 3447 * An array containing all of the metadata associated with this element.
3448 */ 3448 */
3449 List<ElementAnnotation> metadata = ElementAnnotationImpl.EMPTY_ARRAY; 3449 List<ElementAnnotation> metadata = ElementAnnotationImpl.EMPTY_ARRAY;
3450 3450
3451 /** 3451 /**
3452 * A cached copy of the calculated hashCode for this element. 3452 * A cached copy of the calculated hashCode for this element.
3453 */ 3453 */
3454 int _cachedHashCode = 0; 3454 int _cachedHashCode = 0;
3455 3455
3456 /** 3456 /**
3457 * A cached copy of the calculated location for this element.
3458 */
3459 ElementLocation _cachedLocation;
3460
3461 /**
3457 * Initialize a newly created element to have the given name. 3462 * Initialize a newly created element to have the given name.
3458 * 3463 *
3459 * @param name the name of this element 3464 * @param name the name of this element
3460 * @param nameOffset the offset of the name of this element in the file that c ontains the 3465 * @param nameOffset the offset of the name of this element in the file that c ontains the
3461 * declaration of this element 3466 * declaration of this element
3462 */ 3467 */
3463 ElementImpl(String name, this.nameOffset) { 3468 ElementImpl(String name, this.nameOffset) {
3464 this._name = StringUtilities.intern(name); 3469 this._name = StringUtilities.intern(name);
3465 } 3470 }
3466 3471
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3552 bool get isPublic => !isPrivate; 3557 bool get isPublic => !isPrivate;
3553 3558
3554 @override 3559 @override
3555 bool get isSynthetic => hasModifier(Modifier.SYNTHETIC); 3560 bool get isSynthetic => hasModifier(Modifier.SYNTHETIC);
3556 3561
3557 @override 3562 @override
3558 LibraryElement get library => 3563 LibraryElement get library =>
3559 getAncestor((element) => element is LibraryElement); 3564 getAncestor((element) => element is LibraryElement);
3560 3565
3561 @override 3566 @override
3562 ElementLocation get location => new ElementLocationImpl.con1(this); 3567 ElementLocation get location {
3568 if (_cachedLocation == null) {
3569 _cachedLocation = new ElementLocationImpl.con1(this);
3570 }
3571 return _cachedLocation;
3572 }
3563 3573
3564 @override 3574 @override
3565 String get name => _name; 3575 String get name => _name;
3566 3576
3567 @override 3577 @override
3568 AstNode get node => getNodeMatching((node) => node is AstNode); 3578 AstNode get node => getNodeMatching((node) => node is AstNode);
3569 3579
3570 @override 3580 @override
3571 Source get source { 3581 Source get source {
3572 if (_enclosingElement == null) { 3582 if (_enclosingElement == null) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
3942 * The character used to separate components in the encoded form. 3952 * The character used to separate components in the encoded form.
3943 */ 3953 */
3944 static int _SEPARATOR_CHAR = 0x3B; 3954 static int _SEPARATOR_CHAR = 0x3B;
3945 3955
3946 /** 3956 /**
3947 * The path to the element whose location is represented by this object. 3957 * The path to the element whose location is represented by this object.
3948 */ 3958 */
3949 List<String> _components; 3959 List<String> _components;
3950 3960
3951 /** 3961 /**
3962 * The object managing [indexKeyId] and [indexLocationId].
3963 */
3964 Object indexOwner;
3965
3966 /**
3967 * A cached id of this location in index.
3968 */
3969 int indexKeyId;
3970
3971 /**
3972 * A cached id of this location in index.
3973 */
3974 int indexLocationId;
3975
3976 /**
3952 * Initialize a newly created location to represent the given element. 3977 * Initialize a newly created location to represent the given element.
3953 * 3978 *
3954 * @param element the element whose location is being represented 3979 * @param element the element whose location is being represented
3955 */ 3980 */
3956 ElementLocationImpl.con1(Element element) { 3981 ElementLocationImpl.con1(Element element) {
3957 List<String> components = new List<String>(); 3982 List<String> components = new List<String>();
3958 Element ancestor = element; 3983 Element ancestor = element;
3959 while (ancestor != null) { 3984 while (ancestor != null) {
3960 components.insert(0, (ancestor as ElementImpl).identifier); 3985 components.insert(0, (ancestor as ElementImpl).identifier);
3961 ancestor = ancestor.enclosingElement; 3986 ancestor = ancestor.enclosingElement;
(...skipping 8501 matching lines...) Expand 10 before | Expand all | Expand 10 after
12463 // bottom <: void (as bottom is a subtype of all types). 12488 // bottom <: void (as bottom is a subtype of all types).
12464 // void <: dynamic (as dynamic is a supertype of all types) 12489 // void <: dynamic (as dynamic is a supertype of all types)
12465 return identical(type, this) || type.isDynamic; 12490 return identical(type, this) || type.isDynamic;
12466 } 12491 }
12467 12492
12468 @override 12493 @override
12469 VoidTypeImpl substitute2(List<DartType> argumentTypes, 12494 VoidTypeImpl substitute2(List<DartType> argumentTypes,
12470 List<DartType> parameterTypes) => 12495 List<DartType> parameterTypes) =>
12471 this; 12496 this;
12472 } 12497 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/index/store/codec.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698