| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 summary_resynthesizer; | 5 library summary_resynthesizer; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/element_handle.dart'; | 9 import 'package:analyzer/src/generated/element_handle.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 new NamespaceBuilder().createPublicNamespaceForLibrary(libraryElement); | 711 new NamespaceBuilder().createPublicNamespaceForLibrary(libraryElement); |
| 712 // TODO(paulberry): compute the export namespace from prelinked data, so | 712 // TODO(paulberry): compute the export namespace from prelinked data, so |
| 713 // that exported libraries won't be unnecessarily resynthesized. | 713 // that exported libraries won't be unnecessarily resynthesized. |
| 714 libraryElement.exportNamespace = | 714 libraryElement.exportNamespace = |
| 715 new NamespaceBuilder().createExportNamespaceForLibrary(libraryElement); | 715 new NamespaceBuilder().createExportNamespaceForLibrary(libraryElement); |
| 716 // Find the entry point. | 716 // Find the entry point. |
| 717 libraryElement.entryPoint = | 717 libraryElement.entryPoint = |
| 718 libraryElement.exportNamespace.definedNames.values.firstWhere( | 718 libraryElement.exportNamespace.definedNames.values.firstWhere( |
| 719 (element) => element is FunctionElement && element.isEntryPoint, | 719 (element) => element is FunctionElement && element.isEntryPoint, |
| 720 orElse: () => null); | 720 orElse: () => null); |
| 721 // Create the synthetic element for `loadLibrary`. |
| 722 libraryElement.createLoadLibraryFunction(summaryResynthesizer.typeProvider); |
| 721 // Done. | 723 // Done. |
| 722 return libraryElement; | 724 return libraryElement; |
| 723 } | 725 } |
| 724 | 726 |
| 725 /** | 727 /** |
| 726 * Resynthesize a [ParameterElement]. | 728 * Resynthesize a [ParameterElement]. |
| 727 */ | 729 */ |
| 728 ParameterElement buildParameter(UnlinkedParam serializedParameter) { | 730 ParameterElement buildParameter(UnlinkedParam serializedParameter) { |
| 729 ParameterElementImpl parameterElement = new ParameterElementImpl( | 731 ParameterElementImpl parameterElement = new ParameterElementImpl( |
| 730 serializedParameter.name, serializedParameter.nameOffset); | 732 serializedParameter.name, serializedParameter.nameOffset); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 } | 1004 } |
| 1003 for (FunctionTypeAliasElement typeAlias in unit.functionTypeAliases) { | 1005 for (FunctionTypeAliasElement typeAlias in unit.functionTypeAliases) { |
| 1004 elementMap[typeAlias.name] = typeAlias; | 1006 elementMap[typeAlias.name] = typeAlias; |
| 1005 } | 1007 } |
| 1006 resummarizedElements[absoluteUri] = elementMap; | 1008 resummarizedElements[absoluteUri] = elementMap; |
| 1007 unitHolder = null; | 1009 unitHolder = null; |
| 1008 prelinkedUnit = null; | 1010 prelinkedUnit = null; |
| 1009 unlinkedUnit = null; | 1011 unlinkedUnit = null; |
| 1010 } | 1012 } |
| 1011 } | 1013 } |
| OLD | NEW |