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 dart2js.library_loader; | 5 library dart2js.library_loader; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'dart2jslib.dart' show | 9 import 'dart2jslib.dart' show |
10 Compiler, | 10 Compiler, |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 | 498 |
499 /** | 499 /** |
500 * Handle an import/export tag by loading the referenced library and | 500 * Handle an import/export tag by loading the referenced library and |
501 * registering its dependency in [handler] for the computation of the import/ | 501 * registering its dependency in [handler] for the computation of the import/ |
502 * export scope. | 502 * export scope. |
503 */ | 503 */ |
504 Future registerLibraryFromTag(LibraryDependencyHandler handler, | 504 Future registerLibraryFromTag(LibraryDependencyHandler handler, |
505 LibraryElement library, | 505 LibraryElement library, |
506 LibraryDependency tag) { | 506 LibraryDependency tag) { |
507 Uri base = library.canonicalUri; | 507 Uri base = library.canonicalUri; |
508 Uri resolvedUri = base.resolve(tag.uri.dartString.slowToString()); | 508 String tagUriString = tag.uri.dartString.slowToString(); |
509 Uri resolvedUri; | |
510 try { | |
511 resolvedUri = base.resolve(tagUriString); | |
512 } on FormatException { | |
513 compiler.reportError( | |
514 tag, MessageKind.INVALID_URI, {'uri': tagUriString}); | |
515 return new Future.value(); | |
floitsch
2015/05/06 21:19:00
This return feels fishy.
Is the convention that th
| |
516 } | |
509 return createLibrary(handler, library, resolvedUri, tag.uri) | 517 return createLibrary(handler, library, resolvedUri, tag.uri) |
510 .then((LibraryElement loadedLibrary) { | 518 .then((LibraryElement loadedLibrary) { |
511 if (loadedLibrary == null) return; | 519 if (loadedLibrary == null) return; |
512 compiler.withCurrentElement(library, () { | 520 compiler.withCurrentElement(library, () { |
513 handler.registerDependency(library, tag, loadedLibrary); | 521 handler.registerDependency(library, tag, loadedLibrary); |
514 }); | 522 }); |
515 }); | 523 }); |
516 } | 524 } |
517 | 525 |
518 /** | 526 /** |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1186 } | 1194 } |
1187 suffixes.add(const Link<Uri>().prepend(canonicalUri)); | 1195 suffixes.add(const Link<Uri>().prepend(canonicalUri)); |
1188 } | 1196 } |
1189 suffixChainMap[library] = suffixes; | 1197 suffixChainMap[library] = suffixes; |
1190 return; | 1198 return; |
1191 } | 1199 } |
1192 | 1200 |
1193 computeSuffixes(rootLibrary, const Link<Uri>()); | 1201 computeSuffixes(rootLibrary, const Link<Uri>()); |
1194 } | 1202 } |
1195 } | 1203 } |
OLD | NEW |