Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3097 /** | 3097 /** |
| 3098 * Return the element that either physically or logically encloses this elemen t. This will be | 3098 * Return the element that either physically or logically encloses this elemen t. This will be |
| 3099 * `null` if this element is a library because libraries are the top-level ele ments in the | 3099 * `null` if this element is a library because libraries are the top-level ele ments in the |
| 3100 * model. | 3100 * model. |
| 3101 * | 3101 * |
| 3102 * @return the element that encloses this element | 3102 * @return the element that encloses this element |
| 3103 */ | 3103 */ |
| 3104 Element get enclosingElement; | 3104 Element get enclosingElement; |
| 3105 | 3105 |
| 3106 /** | 3106 /** |
| 3107 * The unique integer identifier of this element. | |
| 3108 */ | |
| 3109 int get id; | |
| 3110 | |
| 3111 /** | |
| 3107 * Return `true` if this element has an annotation of the form '@deprecated' o r | 3112 * Return `true` if this element has an annotation of the form '@deprecated' o r |
| 3108 * '@Deprecated('..')'. | 3113 * '@Deprecated('..')'. |
| 3109 * | 3114 * |
| 3110 * @return `true` if this element is deprecated | 3115 * @return `true` if this element is deprecated |
| 3111 */ | 3116 */ |
| 3112 bool get isDeprecated; | 3117 bool get isDeprecated; |
| 3113 | 3118 |
| 3114 /** | 3119 /** |
| 3115 * Return `true` if this element has an annotation of the form '@override'. | 3120 * Return `true` if this element has an annotation of the form '@override'. |
| 3116 * | 3121 * |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3217 * Return the resolved [CompilationUnit] that declares this [Element]. | 3222 * Return the resolved [CompilationUnit] that declares this [Element]. |
| 3218 * | 3223 * |
| 3219 * This method is expensive, because resolved AST might have been already evic ted from cache, so | 3224 * This method is expensive, because resolved AST might have been already evic ted from cache, so |
| 3220 * parsing and resolving will be performed. | 3225 * parsing and resolving will be performed. |
| 3221 * | 3226 * |
| 3222 * @return the resolved [CompilationUnit], maybe `null` if synthetic [Element] . | 3227 * @return the resolved [CompilationUnit], maybe `null` if synthetic [Element] . |
| 3223 */ | 3228 */ |
| 3224 CompilationUnit get unit; | 3229 CompilationUnit get unit; |
| 3225 | 3230 |
| 3226 /** | 3231 /** |
| 3232 * Identifies of the elements that use this elements. | |
| 3233 */ | |
| 3234 IntSet get users; | |
|
Brian Wilkerson
2014/12/05 23:05:57
I'm concerned about keeping around unnecessary emp
scheglov
2014/12/05 23:49:05
Acknowledged.
| |
| 3235 | |
| 3236 /** | |
| 3227 * Use the given visitor to visit this element. | 3237 * Use the given visitor to visit this element. |
| 3228 * | 3238 * |
| 3229 * @param visitor the visitor that will visit this element | 3239 * @param visitor the visitor that will visit this element |
| 3230 * @return the value returned by the visitor as a result of visiting this elem ent | 3240 * @return the value returned by the visitor as a result of visiting this elem ent |
| 3231 */ | 3241 */ |
| 3232 accept(ElementVisitor visitor); | 3242 accept(ElementVisitor visitor); |
| 3233 | 3243 |
| 3234 /** | 3244 /** |
| 3245 * Remember the given [element] as a user of this element. | |
| 3246 */ | |
| 3247 void addUser(Element element); | |
| 3248 | |
| 3249 /** | |
| 3235 * Return the documentation comment for this element as it appears in the orig inal source | 3250 * Return the documentation comment for this element as it appears in the orig inal source |
| 3236 * (complete with the beginning and ending delimiters), or `null` if this elem ent does not | 3251 * (complete with the beginning and ending delimiters), or `null` if this elem ent does not |
| 3237 * have a documentation comment associated with it. This can be a long-running operation if the | 3252 * have a documentation comment associated with it. This can be a long-running operation if the |
| 3238 * information needed to access the comment is not cached. | 3253 * information needed to access the comment is not cached. |
| 3239 * | 3254 * |
| 3240 * @return this element's documentation comment | 3255 * @return this element's documentation comment |
| 3241 * @throws AnalysisException if the documentation comment could not be determi ned because the | 3256 * @throws AnalysisException if the documentation comment could not be determi ned because the |
| 3242 * analysis could not be performed | 3257 * analysis could not be performed |
| 3243 */ | 3258 */ |
| 3244 String computeDocumentationComment(); | 3259 String computeDocumentationComment(); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3422 | 3437 |
| 3423 @override | 3438 @override |
| 3424 String toString() => '@$element'; | 3439 String toString() => '@$element'; |
| 3425 } | 3440 } |
| 3426 | 3441 |
| 3427 /** | 3442 /** |
| 3428 * The abstract class `ElementImpl` implements the behavior common to objects th at implement | 3443 * The abstract class `ElementImpl` implements the behavior common to objects th at implement |
| 3429 * an [Element]. | 3444 * an [Element]. |
| 3430 */ | 3445 */ |
| 3431 abstract class ElementImpl implements Element { | 3446 abstract class ElementImpl implements Element { |
| 3447 static int _NEXT_ID = 0; | |
| 3448 | |
| 3449 final int id = _NEXT_ID++; | |
| 3450 | |
| 3432 /** | 3451 /** |
| 3433 * The enclosing element of this element, or `null` if this element is at the root of the | 3452 * The enclosing element of this element, or `null` if this element is at the root of the |
| 3434 * element structure. | 3453 * element structure. |
| 3435 */ | 3454 */ |
| 3436 ElementImpl _enclosingElement; | 3455 ElementImpl _enclosingElement; |
| 3437 | 3456 |
| 3438 /** | 3457 /** |
| 3439 * The name of this element. | 3458 * The name of this element. |
| 3440 */ | 3459 */ |
| 3441 String _name; | 3460 String _name; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 3460 * A cached copy of the calculated hashCode for this element. | 3479 * A cached copy of the calculated hashCode for this element. |
| 3461 */ | 3480 */ |
| 3462 int _cachedHashCode; | 3481 int _cachedHashCode; |
| 3463 | 3482 |
| 3464 /** | 3483 /** |
| 3465 * A cached copy of the calculated location for this element. | 3484 * A cached copy of the calculated location for this element. |
| 3466 */ | 3485 */ |
| 3467 ElementLocation _cachedLocation; | 3486 ElementLocation _cachedLocation; |
| 3468 | 3487 |
| 3469 /** | 3488 /** |
| 3489 * Identifies of the elements that use this elements. | |
| 3490 */ | |
| 3491 final IntSet users = new IntSet(); | |
| 3492 | |
| 3493 /** | |
| 3470 * Initialize a newly created element to have the given name. | 3494 * Initialize a newly created element to have the given name. |
| 3471 * | 3495 * |
| 3472 * @param name the name of this element | 3496 * @param name the name of this element |
| 3473 * @param nameOffset the offset of the name of this element in the file that c ontains the | 3497 * @param nameOffset the offset of the name of this element in the file that c ontains the |
| 3474 * declaration of this element | 3498 * declaration of this element |
| 3475 */ | 3499 */ |
| 3476 ElementImpl(String name, this.nameOffset) { | 3500 ElementImpl(String name, this.nameOffset) { |
| 3477 this._name = StringUtilities.intern(name); | 3501 this._name = StringUtilities.intern(name); |
| 3478 } | 3502 } |
| 3479 | 3503 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 3499 @override | 3523 @override |
| 3500 Element get enclosingElement => _enclosingElement; | 3524 Element get enclosingElement => _enclosingElement; |
| 3501 | 3525 |
| 3502 /** | 3526 /** |
| 3503 * Set the enclosing element of this element to the given element. | 3527 * Set the enclosing element of this element to the given element. |
| 3504 * | 3528 * |
| 3505 * @param element the enclosing element of this element | 3529 * @param element the enclosing element of this element |
| 3506 */ | 3530 */ |
| 3507 void set enclosingElement(Element element) { | 3531 void set enclosingElement(Element element) { |
| 3508 _enclosingElement = element as ElementImpl; | 3532 _enclosingElement = element as ElementImpl; |
| 3533 _cachedLocation = null; | |
| 3534 _cachedHashCode = null; | |
| 3509 } | 3535 } |
| 3510 | 3536 |
| 3511 @override | 3537 @override |
| 3512 int get hashCode { | 3538 int get hashCode { |
| 3513 // TODO: We might want to re-visit this optimization in the future. | 3539 // TODO: We might want to re-visit this optimization in the future. |
| 3514 // We cache the hash code value as this is a very frequently called method. | 3540 // We cache the hash code value as this is a very frequently called method. |
| 3515 if (_cachedHashCode == null) { | 3541 if (_cachedHashCode == null) { |
| 3516 int hashIdentifier = identifier.hashCode; | 3542 int hashIdentifier = identifier.hashCode; |
| 3517 Element enclosing = enclosingElement; | 3543 Element enclosing = enclosingElement; |
| 3518 if (enclosing != null) { | 3544 if (enclosing != null) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3616 if (identical(this, object)) { | 3642 if (identical(this, object)) { |
| 3617 return true; | 3643 return true; |
| 3618 } | 3644 } |
| 3619 if (object == null || hashCode != object.hashCode) { | 3645 if (object == null || hashCode != object.hashCode) { |
| 3620 return false; | 3646 return false; |
| 3621 } | 3647 } |
| 3622 return object.runtimeType == runtimeType && | 3648 return object.runtimeType == runtimeType && |
| 3623 (object as Element).location == location; | 3649 (object as Element).location == location; |
| 3624 } | 3650 } |
| 3625 | 3651 |
| 3652 @override | |
| 3653 void addUser(Element element) { | |
| 3654 users.add(element.id); | |
| 3655 } | |
| 3656 | |
| 3626 /** | 3657 /** |
| 3627 * Append a textual representation of this element to the given [buffer]. | 3658 * Append a textual representation of this element to the given [buffer]. |
| 3628 */ | 3659 */ |
| 3629 void appendTo(StringBuffer buffer) { | 3660 void appendTo(StringBuffer buffer) { |
| 3630 if (_name == null) { | 3661 if (_name == null) { |
| 3631 buffer.write("<unnamed "); | 3662 buffer.write("<unnamed "); |
| 3632 buffer.write(runtimeType.toString()); | 3663 buffer.write(runtimeType.toString()); |
| 3633 buffer.write(">"); | 3664 buffer.write(">"); |
| 3634 } else { | 3665 } else { |
| 3635 buffer.write(_name); | 3666 buffer.write(_name); |
| (...skipping 5309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8945 /** | 8976 /** |
| 8946 * Return the type in which the element is defined. | 8977 * Return the type in which the element is defined. |
| 8947 * | 8978 * |
| 8948 * @return the type in which the element is defined | 8979 * @return the type in which the element is defined |
| 8949 */ | 8980 */ |
| 8950 ParameterizedType get definingType => _definingType; | 8981 ParameterizedType get definingType => _definingType; |
| 8951 | 8982 |
| 8952 @override | 8983 @override |
| 8953 String get displayName => _baseElement.displayName; | 8984 String get displayName => _baseElement.displayName; |
| 8954 | 8985 |
| 8986 int get id => _baseElement.id; | |
| 8987 | |
| 8955 @override | 8988 @override |
| 8956 bool get isDeprecated => _baseElement.isDeprecated; | 8989 bool get isDeprecated => _baseElement.isDeprecated; |
| 8957 | 8990 |
| 8958 @override | 8991 @override |
| 8959 bool get isOverride => _baseElement.isOverride; | 8992 bool get isOverride => _baseElement.isOverride; |
| 8960 | 8993 |
| 8961 @override | 8994 @override |
| 8962 bool get isPrivate => _baseElement.isPrivate; | 8995 bool get isPrivate => _baseElement.isPrivate; |
| 8963 | 8996 |
| 8964 @override | 8997 @override |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 8987 | 9020 |
| 8988 @override | 9021 @override |
| 8989 AstNode get node => _baseElement.node; | 9022 AstNode get node => _baseElement.node; |
| 8990 | 9023 |
| 8991 @override | 9024 @override |
| 8992 Source get source => _baseElement.source; | 9025 Source get source => _baseElement.source; |
| 8993 | 9026 |
| 8994 @override | 9027 @override |
| 8995 CompilationUnit get unit => _baseElement.unit; | 9028 CompilationUnit get unit => _baseElement.unit; |
| 8996 | 9029 |
| 9030 IntSet get users => _baseElement.users; | |
| 9031 | |
| 9032 @override | |
| 9033 void addUser(Element element) { | |
| 9034 _baseElement.addUser(element); | |
| 9035 } | |
| 9036 | |
| 8997 @override | 9037 @override |
| 8998 String computeDocumentationComment() => | 9038 String computeDocumentationComment() => |
| 8999 _baseElement.computeDocumentationComment(); | 9039 _baseElement.computeDocumentationComment(); |
| 9000 | 9040 |
| 9001 @override | 9041 @override |
| 9002 Element getAncestor(Predicate<Element> predicate) => | 9042 Element getAncestor(Predicate<Element> predicate) => |
| 9003 baseElement.getAncestor(predicate); | 9043 baseElement.getAncestor(predicate); |
| 9004 | 9044 |
| 9005 @override | 9045 @override |
| 9006 String getExtendedDisplayName(String shortName) => | 9046 String getExtendedDisplayName(String shortName) => |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9445 */ | 9485 */ |
| 9446 DartType get type; | 9486 DartType get type; |
| 9447 } | 9487 } |
| 9448 | 9488 |
| 9449 /** | 9489 /** |
| 9450 * Instances of the class `MultiplyDefinedElementImpl` represent a collection of elements that | 9490 * Instances of the class `MultiplyDefinedElementImpl` represent a collection of elements that |
| 9451 * have the same name within the same scope. | 9491 * have the same name within the same scope. |
| 9452 */ | 9492 */ |
| 9453 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { | 9493 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { |
| 9454 /** | 9494 /** |
| 9495 * The unique integer identifier of this element. | |
| 9496 */ | |
| 9497 final int id = ElementImpl._NEXT_ID++; | |
| 9498 | |
| 9499 /** | |
| 9455 * The analysis context in which the multiply defined elements are defined. | 9500 * The analysis context in which the multiply defined elements are defined. |
| 9456 */ | 9501 */ |
| 9457 final AnalysisContext context; | 9502 final AnalysisContext context; |
| 9458 | 9503 |
| 9459 /** | 9504 /** |
| 9460 * The name of the conflicting elements. | 9505 * The name of the conflicting elements. |
| 9461 */ | 9506 */ |
| 9462 String _name; | 9507 String _name; |
| 9463 | 9508 |
| 9464 /** | 9509 /** |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9527 @override | 9572 @override |
| 9528 Source get source => null; | 9573 Source get source => null; |
| 9529 | 9574 |
| 9530 @override | 9575 @override |
| 9531 DartType get type => DynamicTypeImpl.instance; | 9576 DartType get type => DynamicTypeImpl.instance; |
| 9532 | 9577 |
| 9533 @override | 9578 @override |
| 9534 CompilationUnit get unit => null; | 9579 CompilationUnit get unit => null; |
| 9535 | 9580 |
| 9536 @override | 9581 @override |
| 9582 IntSet get users => new IntSet(); | |
| 9583 | |
| 9584 @override | |
| 9537 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); | 9585 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); |
| 9538 | 9586 |
| 9587 void addUser(Element element) { | |
| 9588 } | |
| 9589 | |
| 9539 @override | 9590 @override |
| 9540 String computeDocumentationComment() => null; | 9591 String computeDocumentationComment() => null; |
| 9541 | 9592 |
| 9542 @override | 9593 @override |
| 9543 Element getAncestor(Predicate<Element> predicate) => null; | 9594 Element getAncestor(Predicate<Element> predicate) => null; |
| 9544 | 9595 |
| 9545 @override | 9596 @override |
| 9546 String getExtendedDisplayName(String shortName) { | 9597 String getExtendedDisplayName(String shortName) { |
| 9547 if (shortName != null) { | 9598 if (shortName != null) { |
| 9548 return shortName; | 9599 return shortName; |
| (...skipping 2961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12510 // bottom <: void (as bottom is a subtype of all types). | 12561 // bottom <: void (as bottom is a subtype of all types). |
| 12511 // void <: dynamic (as dynamic is a supertype of all types) | 12562 // void <: dynamic (as dynamic is a supertype of all types) |
| 12512 return identical(type, this) || type.isDynamic; | 12563 return identical(type, this) || type.isDynamic; |
| 12513 } | 12564 } |
| 12514 | 12565 |
| 12515 @override | 12566 @override |
| 12516 VoidTypeImpl substitute2(List<DartType> argumentTypes, | 12567 VoidTypeImpl substitute2(List<DartType> argumentTypes, |
| 12517 List<DartType> parameterTypes) => | 12568 List<DartType> parameterTypes) => |
| 12518 this; | 12569 this; |
| 12519 } | 12570 } |
| OLD | NEW |