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 library engine.resolver; | 5 library engine.resolver; |
6 | 6 |
7 import "dart:math" as math; | 7 import "dart:math" as math; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/src/generated/utilities_collection.dart'; | 10 import 'package:analyzer/src/generated/utilities_collection.dart'; |
(...skipping 10067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10078 static List<ResolvableLibrary> _EMPTY_ARRAY = new List<ResolvableLibrary>(0); | 10078 static List<ResolvableLibrary> _EMPTY_ARRAY = new List<ResolvableLibrary>(0); |
10079 | 10079 |
10080 /** | 10080 /** |
10081 * The next artificial hash code. | 10081 * The next artificial hash code. |
10082 */ | 10082 */ |
10083 static int _NEXT_HASH_CODE = 0; | 10083 static int _NEXT_HASH_CODE = 0; |
10084 | 10084 |
10085 /** | 10085 /** |
10086 * The artifitial hash code for this object. | 10086 * The artifitial hash code for this object. |
10087 */ | 10087 */ |
10088 final int _hashCode = _NEXT_HASH_CODE++; | 10088 final int _hashCode = _nextHashCode(); |
10089 | 10089 |
10090 /** | 10090 /** |
10091 * The source specifying the defining compilation unit of this library. | 10091 * The source specifying the defining compilation unit of this library. |
10092 */ | 10092 */ |
10093 final Source librarySource; | 10093 final Source librarySource; |
10094 | 10094 |
10095 /** | 10095 /** |
10096 * A list containing all of the libraries that are imported into this library. | 10096 * A list containing all of the libraries that are imported into this library. |
10097 */ | 10097 */ |
10098 List<ResolvableLibrary> _importedLibraries = _EMPTY_ARRAY; | 10098 List<ResolvableLibrary> _importedLibraries = _EMPTY_ARRAY; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10318 for (int i = 0; i < count; i++) { | 10318 for (int i = 0; i < count; i++) { |
10319 if (_compilationUnits[i].source == source) { | 10319 if (_compilationUnits[i].source == source) { |
10320 return _compilationUnits[i].compilationUnit; | 10320 return _compilationUnits[i].compilationUnit; |
10321 } | 10321 } |
10322 } | 10322 } |
10323 return null; | 10323 return null; |
10324 } | 10324 } |
10325 | 10325 |
10326 @override | 10326 @override |
10327 String toString() => librarySource.shortName; | 10327 String toString() => librarySource.shortName; |
| 10328 |
| 10329 static int _nextHashCode() { |
| 10330 int next = (_NEXT_HASH_CODE + 1) & 0xFFFFFF; |
| 10331 _NEXT_HASH_CODE = next; |
| 10332 return next; |
| 10333 } |
10328 } | 10334 } |
10329 | 10335 |
10330 /** | 10336 /** |
10331 * The enumeration `ResolverErrorCode` defines the error codes used for errors | 10337 * The enumeration `ResolverErrorCode` defines the error codes used for errors |
10332 * detected by the resolver. The convention for this class is for the name of | 10338 * detected by the resolver. The convention for this class is for the name of |
10333 * the error code to indicate the problem that caused the error to be generated | 10339 * the error code to indicate the problem that caused the error to be generated |
10334 * and for the error message to explain what is wrong and, when appropriate, how | 10340 * and for the error message to explain what is wrong and, when appropriate, how |
10335 * the problem can be corrected. | 10341 * the problem can be corrected. |
10336 */ | 10342 */ |
10337 class ResolverErrorCode extends ErrorCode { | 10343 class ResolverErrorCode extends ErrorCode { |
(...skipping 5349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15687 * library. | 15693 * library. |
15688 */ | 15694 */ |
15689 final HashSet<String> members = new HashSet<String>(); | 15695 final HashSet<String> members = new HashSet<String>(); |
15690 | 15696 |
15691 /** | 15697 /** |
15692 * Names of resolved or unresolved class members that are read in the | 15698 * Names of resolved or unresolved class members that are read in the |
15693 * library. | 15699 * library. |
15694 */ | 15700 */ |
15695 final HashSet<String> readMembers = new HashSet<String>(); | 15701 final HashSet<String> readMembers = new HashSet<String>(); |
15696 } | 15702 } |
OLD | NEW |