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'; |
11 | 11 |
12 import 'ast.dart'; | 12 import 'ast.dart'; |
13 import 'constant.dart' show EvaluationResultImpl; | 13 import 'constant.dart' show EvaluationResultImpl; |
14 import 'engine.dart' show AnalysisContext, AnalysisEngine, AnalysisException; | 14 import 'engine.dart' show AnalysisContext, AnalysisEngine, AnalysisException; |
15 import 'html.dart' show XmlAttributeNode, XmlTagNode; | 15 import 'html.dart' show XmlAttributeNode, XmlTagNode; |
16 import 'java_core.dart'; | 16 import 'java_core.dart'; |
17 import 'java_engine.dart'; | 17 import 'java_engine.dart'; |
18 import 'resolver.dart'; | 18 import 'resolver.dart'; |
19 import 'scanner.dart' show Keyword; | 19 import 'scanner.dart' show Keyword; |
20 import 'sdk.dart' show DartSdk; | 20 import 'sdk.dart' show DartSdk; |
21 import 'source.dart'; | 21 import 'source.dart'; |
22 import 'utilities_collection.dart'; | 22 import 'utilities_collection.dart'; |
23 import 'utilities_dart.dart'; | 23 import 'utilities_dart.dart'; |
| 24 import 'package:analyzer/src/generated/utilities_general.dart'; |
24 | 25 |
25 | 26 |
26 /** | 27 /** |
27 * For AST nodes that could be in both the getter and setter contexts ([IndexExp
ression]s and | 28 * For AST nodes that could be in both the getter and setter contexts ([IndexExp
ression]s and |
28 * [SimpleIdentifier]s), the additional resolved elements are stored in the AST
node, in an | 29 * [SimpleIdentifier]s), the additional resolved elements are stored in the AST
node, in an |
29 * [AuxiliaryElements]. Since resolved elements are either statically resolved o
r resolved | 30 * [AuxiliaryElements]. Since resolved elements are either statically resolved o
r resolved |
30 * using propagated type information, this class is a wrapper for a pair of | 31 * using propagated type information, this class is a wrapper for a pair of |
31 * [ExecutableElement]s, not just a single [ExecutableElement]. | 32 * [ExecutableElement]s, not just a single [ExecutableElement]. |
32 */ | 33 */ |
33 class AuxiliaryElements { | 34 class AuxiliaryElements { |
(...skipping 3238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3272 } | 3273 } |
3273 } | 3274 } |
3274 } | 3275 } |
3275 | 3276 |
3276 /** | 3277 /** |
3277 * The class `ElementPair` is a pair of [Element]s. [Object.==] and | 3278 * The class `ElementPair` is a pair of [Element]s. [Object.==] and |
3278 * [Object.hashCode] so this class can be used in hashed data structures. | 3279 * [Object.hashCode] so this class can be used in hashed data structures. |
3279 */ | 3280 */ |
3280 class ElementPair { | 3281 class ElementPair { |
3281 /** | 3282 /** |
3282 * The first [Element] | 3283 * The first [Element]. |
3283 */ | 3284 */ |
3284 final Element _first; | 3285 final Element _first; |
3285 | 3286 |
3286 /** | 3287 /** |
3287 * The second [Element] | 3288 * The second [Element]. |
3288 */ | 3289 */ |
3289 final Element _second; | 3290 final Element _second; |
3290 | 3291 |
3291 /** | 3292 /** |
| 3293 * A cached copy of the calculated hashCode for this element. |
| 3294 */ |
| 3295 int _cachedHashCode; |
| 3296 |
| 3297 /** |
3292 * The sole constructor for this class, taking two [Element]s. | 3298 * The sole constructor for this class, taking two [Element]s. |
3293 * | 3299 * |
3294 * @param first the first element | 3300 * @param first the first element |
3295 * @param second the second element | 3301 * @param second the second element |
3296 */ | 3302 */ |
3297 ElementPair(this._first, this._second); | 3303 ElementPair(this._first, this._second) { |
| 3304 _cachedHashCode = JenkinsSmiHash.hash2(_first.hashCode, _second.hashCode); |
| 3305 } |
3298 | 3306 |
3299 /** | 3307 /** |
3300 * Return the first element. | 3308 * Return the first element. |
3301 * | 3309 * |
3302 * @return the first element | 3310 * @return the first element |
3303 */ | 3311 */ |
3304 Element get firstElt => _first; | 3312 Element get firstElt => _first; |
3305 | 3313 |
3306 @override | 3314 @override |
3307 int get hashCode => | 3315 int get hashCode { |
3308 ObjectUtilities.combineHashCodes(_first.hashCode, _second.hashCode); | 3316 return _cachedHashCode; |
| 3317 } |
3309 | 3318 |
3310 /** | 3319 /** |
3311 * Return the second element | 3320 * Return the second element |
3312 * | 3321 * |
3313 * @return the second element | 3322 * @return the second element |
3314 */ | 3323 */ |
3315 Element get secondElt => _second; | 3324 Element get secondElt => _second; |
3316 | 3325 |
3317 @override | 3326 @override |
3318 bool operator ==(Object object) { | 3327 bool operator ==(Object object) { |
3319 if (identical(object, this)) { | 3328 if (identical(object, this)) { |
3320 return true; | 3329 return true; |
3321 } | 3330 } |
3322 if (object is ElementPair) { | 3331 return object is ElementPair && |
3323 ElementPair elementPair = object; | 3332 _first == object._first && |
3324 return (_first == elementPair._first) && (_second == elementPair._second); | 3333 _second == object._second; |
3325 } | |
3326 return false; | |
3327 } | 3334 } |
3328 } | 3335 } |
3329 | 3336 |
3330 /** | 3337 /** |
3331 * The interface `ElementVisitor` defines the behavior of objects that can be us
ed to visit an | 3338 * The interface `ElementVisitor` defines the behavior of objects that can be us
ed to visit an |
3332 * element structure. | 3339 * element structure. |
3333 */ | 3340 */ |
3334 abstract class ElementVisitor<R> { | 3341 abstract class ElementVisitor<R> { |
3335 R visitClassElement(ClassElement element); | 3342 R visitClassElement(ClassElement element); |
3336 | 3343 |
(...skipping 5938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9275 /** | 9282 /** |
9276 * Set whether this accessor is a getter to correspond to the given value. | 9283 * Set whether this accessor is a getter to correspond to the given value. |
9277 * | 9284 * |
9278 * @param isGetter `true` if the accessor is a getter | 9285 * @param isGetter `true` if the accessor is a getter |
9279 */ | 9286 */ |
9280 void set getter(bool isGetter) { | 9287 void set getter(bool isGetter) { |
9281 setModifier(Modifier.GETTER, isGetter); | 9288 setModifier(Modifier.GETTER, isGetter); |
9282 } | 9289 } |
9283 | 9290 |
9284 @override | 9291 @override |
9285 int get hashCode => | 9292 int get hashCode => JenkinsSmiHash.hash2(super.hashCode, isGetter ? 1 : 2); |
9286 ObjectUtilities.combineHashCodes(super.hashCode, isGetter ? 1 : 2); | |
9287 | 9293 |
9288 @override | 9294 @override |
9289 String get identifier { | 9295 String get identifier { |
9290 String name = displayName; | 9296 String name = displayName; |
9291 String suffix = isGetter ? "?" : "="; | 9297 String suffix = isGetter ? "?" : "="; |
9292 return "$name$suffix"; | 9298 return "$name$suffix"; |
9293 } | 9299 } |
9294 | 9300 |
9295 @override | 9301 @override |
9296 bool get isAbstract => hasModifier(Modifier.ABSTRACT); | 9302 bool get isAbstract => hasModifier(Modifier.ABSTRACT); |
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11154 // bottom <: void (as bottom is a subtype of all types). | 11160 // bottom <: void (as bottom is a subtype of all types). |
11155 // void <: dynamic (as dynamic is a supertype of all types) | 11161 // void <: dynamic (as dynamic is a supertype of all types) |
11156 return identical(type, this) || type.isDynamic; | 11162 return identical(type, this) || type.isDynamic; |
11157 } | 11163 } |
11158 | 11164 |
11159 @override | 11165 @override |
11160 VoidTypeImpl substitute2(List<DartType> argumentTypes, | 11166 VoidTypeImpl substitute2(List<DartType> argumentTypes, |
11161 List<DartType> parameterTypes) => | 11167 List<DartType> parameterTypes) => |
11162 this; | 11168 this; |
11163 } | 11169 } |
OLD | NEW |