| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 String uri = target.uri.toString(); | 72 String uri = target.uri.toString(); |
| 73 LibraryElement libraryElement = resynthesizer.getLibraryElement(uri); | 73 LibraryElement libraryElement = resynthesizer.getLibraryElement(uri); |
| 74 entry.setValue(result, libraryElement, TargetedResult.EMPTY_LIST); | 74 entry.setValue(result, libraryElement, TargetedResult.EMPTY_LIST); |
| 75 return true; | 75 return true; |
| 76 } else if (result == READY_LIBRARY_ELEMENT2 || | 76 } else if (result == READY_LIBRARY_ELEMENT2 || |
| 77 result == READY_LIBRARY_ELEMENT5 || | 77 result == READY_LIBRARY_ELEMENT5 || |
| 78 result == READY_LIBRARY_ELEMENT6) { | 78 result == READY_LIBRARY_ELEMENT6) { |
| 79 entry.setValue(result, true, TargetedResult.EMPTY_LIST); | 79 entry.setValue(result, true, TargetedResult.EMPTY_LIST); |
| 80 return true; | 80 return true; |
| 81 } else if (result == SOURCE_KIND) { | 81 } else if (result == SOURCE_KIND) { |
| 82 // TODO(scheglov) not every source is a library | 82 String uri = target.uri.toString(); |
| 83 entry.setValue(result, SourceKind.LIBRARY, TargetedResult.EMPTY_LIST); | 83 if (bundle.prelinkedLibraryUris.contains(uri)) { |
| 84 return true; | 84 entry.setValue(result, SourceKind.LIBRARY, TargetedResult.EMPTY_LIST); |
| 85 return true; |
| 86 } |
| 87 if (bundle.unlinkedUnitUris.contains(uri)) { |
| 88 entry.setValue(result, SourceKind.PART, TargetedResult.EMPTY_LIST); |
| 89 return true; |
| 90 } |
| 91 return false; |
| 85 } else { | 92 } else { |
| 86 // throw new UnimplementedError('$result of $target'); | 93 // throw new UnimplementedError('$result of $target'); |
| 87 } | 94 } |
| 88 } | 95 } |
| 89 return false; | 96 return false; |
| 90 } | 97 } |
| 91 | 98 |
| 92 void _buildAsyncLibrary() { | 99 void _buildAsyncLibrary() { |
| 93 LibraryElement library = resynthesizer.getLibraryElement('dart:async'); | 100 LibraryElement library = resynthesizer.getLibraryElement('dart:async'); |
| 94 typeProvider.initializeAsync(library); | 101 typeProvider.initializeAsync(library); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 * throw a [StateError] if there is no class with the given name. | 353 * throw a [StateError] if there is no class with the given name. |
| 347 */ | 354 */ |
| 348 InterfaceType _getType(LibraryElement library, String name) { | 355 InterfaceType _getType(LibraryElement library, String name) { |
| 349 Element element = library.getType(name); | 356 Element element = library.getType(name); |
| 350 if (element == null) { | 357 if (element == null) { |
| 351 throw new StateError("No definition of type $name"); | 358 throw new StateError("No definition of type $name"); |
| 352 } | 359 } |
| 353 return (element as ClassElement).type; | 360 return (element as ClassElement).type; |
| 354 } | 361 } |
| 355 } | 362 } |
| OLD | NEW |