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.dart'; | 9 import 'common.dart'; |
10 import 'common/names.dart' show | 10 import 'common/names.dart' show |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 bool importsDartCore = false; | 378 bool importsDartCore = false; |
379 LinkBuilder<LibraryDependencyElementX> libraryDependencies = | 379 LinkBuilder<LibraryDependencyElementX> libraryDependencies = |
380 new LinkBuilder<LibraryDependencyElementX>(); | 380 new LinkBuilder<LibraryDependencyElementX>(); |
381 Uri base = library.entryCompilationUnit.script.readableUri; | 381 Uri base = library.entryCompilationUnit.script.readableUri; |
382 | 382 |
383 return Future.forEach(library.tags, (LibraryTag tag) { | 383 return Future.forEach(library.tags, (LibraryTag tag) { |
384 return reporter.withCurrentElement(library, () { | 384 return reporter.withCurrentElement(library, () { |
385 | 385 |
386 Uri computeUri(LibraryDependency node) { | 386 Uri computeUri(LibraryDependency node) { |
387 String tagUriString = node.uri.dartString.slowToString(); | 387 StringNode uriNode = node.uri; |
| 388 if (node.conditionalUris != null) { |
| 389 for (ConditionalUri conditionalUri in node.conditionalUris) { |
| 390 String key = conditionalUri.key.slowNameString; |
| 391 String value = conditionalUri.value == null |
| 392 ? "true" |
| 393 : conditionalUri.value.dartString.slowToString(); |
| 394 String actual = compiler.fromEnvironment(key); |
| 395 if (value == actual) { |
| 396 uriNode = conditionalUri.uri; |
| 397 break; |
| 398 } |
| 399 } |
| 400 } |
| 401 String tagUriString = uriNode.dartString.slowToString(); |
388 try { | 402 try { |
389 return Uri.parse(tagUriString); | 403 return Uri.parse(tagUriString); |
390 } on FormatException { | 404 } on FormatException { |
391 reporter.reportErrorMessage( | 405 reporter.reportErrorMessage( |
392 node.uri, | 406 node.uri, |
393 MessageKind.INVALID_URI, {'uri': tagUriString}); | 407 MessageKind.INVALID_URI, {'uri': tagUriString}); |
394 return null; | 408 return null; |
395 } | 409 } |
396 } | 410 } |
397 | 411 |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 } | 1369 } |
1356 suffixes.add(const Link<Uri>().prepend(canonicalUri)); | 1370 suffixes.add(const Link<Uri>().prepend(canonicalUri)); |
1357 } | 1371 } |
1358 suffixChainMap[library] = suffixes; | 1372 suffixChainMap[library] = suffixes; |
1359 return; | 1373 return; |
1360 } | 1374 } |
1361 | 1375 |
1362 computeSuffixes(rootLibrary, const Link<Uri>()); | 1376 computeSuffixes(rootLibrary, const Link<Uri>()); |
1363 } | 1377 } |
1364 } | 1378 } |
OLD | NEW |