| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 leg_apiimpl; | 5 library leg_apiimpl; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:package_config/packages.dart'; | 10 import 'package:package_config/packages.dart'; |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 notFound: (Uri notFound) { | 375 notFound: (Uri notFound) { |
| 376 reportError( | 376 reportError( |
| 377 node, | 377 node, |
| 378 MessageKind.LIBRARY_NOT_FOUND, | 378 MessageKind.LIBRARY_NOT_FOUND, |
| 379 {'resolvedUri': uri} | 379 {'resolvedUri': uri} |
| 380 ); | 380 ); |
| 381 return null; | 381 return null; |
| 382 }); | 382 }); |
| 383 } | 383 } |
| 384 | 384 |
| 385 Future<elements.LibraryElement> analyzeUri( |
| 386 Uri uri, |
| 387 {bool skipLibraryWithPartOfTag: true}) { |
| 388 if (packages == null) { |
| 389 return setupPackages(uri).then((_) => super.analyzeUri(uri)); |
| 390 } |
| 391 return super.analyzeUri( |
| 392 uri, skipLibraryWithPartOfTag: skipLibraryWithPartOfTag); |
| 393 } |
| 394 |
| 385 Future setupPackages(Uri uri) { | 395 Future setupPackages(Uri uri) { |
| 386 if (packageRoot != null) { | 396 if (packageRoot != null) { |
| 387 // Use "non-file" packages because the file version requires a [Directory] | 397 // Use "non-file" packages because the file version requires a [Directory] |
| 388 // and we can't depend on 'dart:io' classes. | 398 // and we can't depend on 'dart:io' classes. |
| 389 packages = new NonFilePackagesDirectoryPackages(packageRoot); | 399 packages = new NonFilePackagesDirectoryPackages(packageRoot); |
| 390 } else if (packageConfig != null) { | 400 } else if (packageConfig != null) { |
| 391 return callUserProvider(packageConfig).then((packageConfigContents) { | 401 return callUserProvider(packageConfig).then((packageConfigContents) { |
| 392 if (packageConfigContents is String) { | 402 if (packageConfigContents is String) { |
| 393 packageConfigContents = UTF8.encode(packageConfigContents); | 403 packageConfigContents = UTF8.encode(packageConfigContents); |
| 394 } | 404 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 print('$message: ${tryToString(exception)}'); | 512 print('$message: ${tryToString(exception)}'); |
| 503 print(tryToString(stackTrace)); | 513 print(tryToString(stackTrace)); |
| 504 } | 514 } |
| 505 | 515 |
| 506 fromEnvironment(String name) => environment[name]; | 516 fromEnvironment(String name) => environment[name]; |
| 507 | 517 |
| 508 LibraryInfo lookupLibraryInfo(String libraryName) { | 518 LibraryInfo lookupLibraryInfo(String libraryName) { |
| 509 return library_info.LIBRARIES[libraryName]; | 519 return library_info.LIBRARIES[libraryName]; |
| 510 } | 520 } |
| 511 } | 521 } |
| OLD | NEW |