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 'common/names.dart' show | 9 import 'common/names.dart' show |
10 Uris; | 10 Uris; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 bool importsDartCore = false; | 385 bool importsDartCore = false; |
386 LinkBuilder<LibraryDependencyElementX> libraryDependencies = | 386 LinkBuilder<LibraryDependencyElementX> libraryDependencies = |
387 new LinkBuilder<LibraryDependencyElementX>(); | 387 new LinkBuilder<LibraryDependencyElementX>(); |
388 Uri base = library.entryCompilationUnit.script.readableUri; | 388 Uri base = library.entryCompilationUnit.script.readableUri; |
389 | 389 |
390 return Future.forEach(library.tags, (LibraryTag tag) { | 390 return Future.forEach(library.tags, (LibraryTag tag) { |
391 return compiler.withCurrentElement(library, () { | 391 return compiler.withCurrentElement(library, () { |
392 | 392 |
393 Uri computeUri(LibraryDependency node) { | 393 Uri computeUri(LibraryDependency node) { |
394 String tagUriString = node.uri.dartString.slowToString(); | 394 StringNode uriNode = node.uri; |
| 395 if (node.conditionalUris != null) { |
| 396 for (ConditionalUri conditionalUri in node.conditionalUris) { |
| 397 String key = conditionalUri.key.slowNameString; |
| 398 String value = conditionalUri.value == null |
| 399 ? "true" |
| 400 : conditionalUri.value.dartString.slowToString(); |
| 401 String actual = compiler.fromEnvironment(key); |
| 402 if (value == actual) { |
| 403 uriNode = conditionalUri.uri; |
| 404 break; |
| 405 } |
| 406 } |
| 407 } |
| 408 String tagUriString = uriNode.dartString.slowToString(); |
395 try { | 409 try { |
396 return Uri.parse(tagUriString); | 410 return Uri.parse(tagUriString); |
397 } on FormatException { | 411 } on FormatException { |
398 compiler.reportErrorMessage( | 412 compiler.reportErrorMessage( |
399 node.uri, | 413 node.uri, |
400 MessageKind.INVALID_URI, {'uri': tagUriString}); | 414 MessageKind.INVALID_URI, {'uri': tagUriString}); |
401 return null; | 415 return null; |
402 } | 416 } |
403 } | 417 } |
404 | 418 |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 } | 1340 } |
1327 suffixes.add(const Link<Uri>().prepend(canonicalUri)); | 1341 suffixes.add(const Link<Uri>().prepend(canonicalUri)); |
1328 } | 1342 } |
1329 suffixChainMap[library] = suffixes; | 1343 suffixChainMap[library] = suffixes; |
1330 return; | 1344 return; |
1331 } | 1345 } |
1332 | 1346 |
1333 computeSuffixes(rootLibrary, const Link<Uri>()); | 1347 computeSuffixes(rootLibrary, const Link<Uri>()); |
1334 } | 1348 } |
1335 } | 1349 } |
OLD | NEW |