| 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 7275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7286 directive.element = libraryElement; | 7286 directive.element = libraryElement; |
| 7287 } | 7287 } |
| 7288 library.libraryElement = libraryElement; | 7288 library.libraryElement = libraryElement; |
| 7289 if (sourcedUnitCount > 0) { | 7289 if (sourcedUnitCount > 0) { |
| 7290 _patchTopLevelAccessors(libraryElement); | 7290 _patchTopLevelAccessors(libraryElement); |
| 7291 } | 7291 } |
| 7292 return libraryElement; | 7292 return libraryElement; |
| 7293 } | 7293 } |
| 7294 | 7294 |
| 7295 /** | 7295 /** |
| 7296 * Build the library element for the given library. | 7296 * Build the library element for the given library. The resulting element is |
| 7297 * stored in the [ResolvableLibrary] structure. |
| 7297 * | 7298 * |
| 7298 * @param library the library for which an element model is to be built | 7299 * @param library the library for which an element model is to be built |
| 7299 * @return the library element that was built | |
| 7300 * @throws AnalysisException if the analysis could not be performed | 7300 * @throws AnalysisException if the analysis could not be performed |
| 7301 */ | 7301 */ |
| 7302 LibraryElementImpl buildLibrary2(ResolvableLibrary library) { | 7302 void buildLibrary2(ResolvableLibrary library) { |
| 7303 CompilationUnitBuilder builder = new CompilationUnitBuilder(); | 7303 CompilationUnitBuilder builder = new CompilationUnitBuilder(); |
| 7304 Source librarySource = library.librarySource; | 7304 Source librarySource = library.librarySource; |
| 7305 CompilationUnit definingCompilationUnit = library.definingCompilationUnit; | 7305 CompilationUnit definingCompilationUnit = library.definingCompilationUnit; |
| 7306 CompilationUnitElementImpl definingCompilationUnitElement = | 7306 CompilationUnitElementImpl definingCompilationUnitElement = |
| 7307 builder.buildCompilationUnit(librarySource, definingCompilationUnit); | 7307 builder.buildCompilationUnit(librarySource, definingCompilationUnit); |
| 7308 NodeList<Directive> directives = definingCompilationUnit.directives; | 7308 NodeList<Directive> directives = definingCompilationUnit.directives; |
| 7309 LibraryIdentifier libraryNameNode = null; | 7309 LibraryIdentifier libraryNameNode = null; |
| 7310 bool hasPartDirective = false; | 7310 bool hasPartDirective = false; |
| 7311 FunctionElement entryPoint = | 7311 FunctionElement entryPoint = |
| 7312 _findEntryPoint(definingCompilationUnitElement); | 7312 _findEntryPoint(definingCompilationUnitElement); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7394 } | 7394 } |
| 7395 int sourcedUnitCount = sourcedCompilationUnits.length; | 7395 int sourcedUnitCount = sourcedCompilationUnits.length; |
| 7396 libraryElement.parts = sourcedCompilationUnits; | 7396 libraryElement.parts = sourcedCompilationUnits; |
| 7397 for (Directive directive in directivesToResolve) { | 7397 for (Directive directive in directivesToResolve) { |
| 7398 directive.element = libraryElement; | 7398 directive.element = libraryElement; |
| 7399 } | 7399 } |
| 7400 library.libraryElement = libraryElement; | 7400 library.libraryElement = libraryElement; |
| 7401 if (sourcedUnitCount > 0) { | 7401 if (sourcedUnitCount > 0) { |
| 7402 _patchTopLevelAccessors(libraryElement); | 7402 _patchTopLevelAccessors(libraryElement); |
| 7403 } | 7403 } |
| 7404 return libraryElement; | |
| 7405 } | 7404 } |
| 7406 | 7405 |
| 7407 /** | 7406 /** |
| 7408 * Add all of the non-synthetic getters and setters defined in the given compi
lation unit that | 7407 * Add all of the non-synthetic getters and setters defined in the given compi
lation unit that |
| 7409 * have no corresponding accessor to one of the given collections. | 7408 * have no corresponding accessor to one of the given collections. |
| 7410 * | 7409 * |
| 7411 * @param getters the map to which getters are to be added | 7410 * @param getters the map to which getters are to be added |
| 7412 * @param setters the list to which setters are to be added | 7411 * @param setters the list to which setters are to be added |
| 7413 * @param unit the compilation unit defining the accessors that are potentiall
y being added | 7412 * @param unit the compilation unit defining the accessors that are potentiall
y being added |
| 7414 */ | 7413 */ |
| (...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8881 | 8880 |
| 8882 /** | 8881 /** |
| 8883 * Build element models for all of the libraries in the current cycle. | 8882 * Build element models for all of the libraries in the current cycle. |
| 8884 * | 8883 * |
| 8885 * @throws AnalysisException if any of the element models cannot be built | 8884 * @throws AnalysisException if any of the element models cannot be built |
| 8886 */ | 8885 */ |
| 8887 void _buildElementModels() { | 8886 void _buildElementModels() { |
| 8888 for (ResolvableLibrary library in _librariesInCycle) { | 8887 for (ResolvableLibrary library in _librariesInCycle) { |
| 8889 LibraryElementBuilder builder = | 8888 LibraryElementBuilder builder = |
| 8890 new LibraryElementBuilder(analysisContext, errorListener); | 8889 new LibraryElementBuilder(analysisContext, errorListener); |
| 8891 LibraryElementImpl libraryElement = builder.buildLibrary2(library); | 8890 builder.buildLibrary2(library); |
| 8892 library.libraryElement = libraryElement; | |
| 8893 } | 8891 } |
| 8894 } | 8892 } |
| 8895 | 8893 |
| 8896 /** | 8894 /** |
| 8897 * Build the members in enum declarations. This cannot be done while building
the rest of the | 8895 * Build the members in enum declarations. This cannot be done while building
the rest of the |
| 8898 * element model because it depends on being able to access core types, which
cannot happen until | 8896 * element model because it depends on being able to access core types, which
cannot happen until |
| 8899 * the rest of the element model has been built (when resolving the core libra
ry). | 8897 * the rest of the element model has been built (when resolving the core libra
ry). |
| 8900 * | 8898 * |
| 8901 * @throws AnalysisException if any of the enum members could not be built | 8899 * @throws AnalysisException if any of the enum members could not be built |
| 8902 */ | 8900 */ |
| (...skipping 6604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15507 * library. | 15505 * library. |
| 15508 */ | 15506 */ |
| 15509 final HashSet<String> members = new HashSet<String>(); | 15507 final HashSet<String> members = new HashSet<String>(); |
| 15510 | 15508 |
| 15511 /** | 15509 /** |
| 15512 * Names of resolved or unresolved class members that are read in the | 15510 * Names of resolved or unresolved class members that are read in the |
| 15513 * library. | 15511 * library. |
| 15514 */ | 15512 */ |
| 15515 final HashSet<String> readMembers = new HashSet<String>(); | 15513 final HashSet<String> readMembers = new HashSet<String>(); |
| 15516 } | 15514 } |
| OLD | NEW |