| 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 analyzer.src.summary.summary_sdk; | 5 library analyzer.src.summary.summary_sdk; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
| 9 import 'package:analyzer/src/context/cache.dart' show CacheEntry; | 9 import 'package:analyzer/src/context/cache.dart' show CacheEntry; |
| 10 import 'package:analyzer/src/context/context.dart'; | 10 import 'package:analyzer/src/context/context.dart'; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 /** | 131 /** |
| 132 * The implementation of [SummaryResynthesizer] for Dart SDK. | 132 * The implementation of [SummaryResynthesizer] for Dart SDK. |
| 133 */ | 133 */ |
| 134 class SdkSummaryResynthesizer extends SummaryResynthesizer { | 134 class SdkSummaryResynthesizer extends SummaryResynthesizer { |
| 135 final SdkBundle bundle; | 135 final SdkBundle bundle; |
| 136 final Map<String, UnlinkedUnit> unlinkedSummaries = <String, UnlinkedUnit>{}; | 136 final Map<String, UnlinkedUnit> unlinkedSummaries = <String, UnlinkedUnit>{}; |
| 137 final Map<String, LinkedLibrary> linkedSummaries = <String, LinkedLibrary>{}; | 137 final Map<String, LinkedLibrary> linkedSummaries = <String, LinkedLibrary>{}; |
| 138 | 138 |
| 139 SdkSummaryResynthesizer(AnalysisContext context, TypeProvider typeProvider, | 139 SdkSummaryResynthesizer(AnalysisContext context, TypeProvider typeProvider, |
| 140 SourceFactory sourceFactory, this.bundle) | 140 SourceFactory sourceFactory, this.bundle) |
| 141 : super(null, context, typeProvider, sourceFactory) { | 141 : super(null, context, typeProvider, sourceFactory, false) { |
| 142 // TODO(paulberry): we always resynthesize the summary in weak mode. Is |
| 143 // this ok? |
| 142 for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) { | 144 for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) { |
| 143 unlinkedSummaries[bundle.unlinkedUnitUris[i]] = bundle.unlinkedUnits[i]; | 145 unlinkedSummaries[bundle.unlinkedUnitUris[i]] = bundle.unlinkedUnits[i]; |
| 144 } | 146 } |
| 145 for (int i = 0; i < bundle.linkedLibraryUris.length; i++) { | 147 for (int i = 0; i < bundle.linkedLibraryUris.length; i++) { |
| 146 linkedSummaries[bundle.linkedLibraryUris[i]] = bundle.linkedLibraries[i]; | 148 linkedSummaries[bundle.linkedLibraryUris[i]] = bundle.linkedLibraries[i]; |
| 147 } | 149 } |
| 148 } | 150 } |
| 149 | 151 |
| 150 @override | 152 @override |
| 151 LinkedLibrary getLinkedSummary(String uri) { | 153 LinkedLibrary getLinkedSummary(String uri) { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 * throw a [StateError] if there is no class with the given name. | 403 * throw a [StateError] if there is no class with the given name. |
| 402 */ | 404 */ |
| 403 InterfaceType _getType(LibraryElement library, String name) { | 405 InterfaceType _getType(LibraryElement library, String name) { |
| 404 Element element = library.getType(name); | 406 Element element = library.getType(name); |
| 405 if (element == null) { | 407 if (element == null) { |
| 406 throw new StateError("No definition of type $name"); | 408 throw new StateError("No definition of type $name"); |
| 407 } | 409 } |
| 408 return (element as ClassElement).type; | 410 return (element as ClassElement).type; |
| 409 } | 411 } |
| 410 } | 412 } |
| OLD | NEW |