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 StringNode uriNode = node.uri; | 387 String tagUriString = node.uri.dartString.slowToString(); |
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(); | |
402 try { | 388 try { |
403 return Uri.parse(tagUriString); | 389 return Uri.parse(tagUriString); |
404 } on FormatException { | 390 } on FormatException { |
405 reporter.reportErrorMessage( | 391 reporter.reportErrorMessage( |
406 node.uri, | 392 node.uri, |
407 MessageKind.INVALID_URI, {'uri': tagUriString}); | 393 MessageKind.INVALID_URI, {'uri': tagUriString}); |
408 return null; | 394 return null; |
409 } | 395 } |
410 } | 396 } |
411 | 397 |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 } | 1355 } |
1370 suffixes.add(const Link<Uri>().prepend(canonicalUri)); | 1356 suffixes.add(const Link<Uri>().prepend(canonicalUri)); |
1371 } | 1357 } |
1372 suffixChainMap[library] = suffixes; | 1358 suffixChainMap[library] = suffixes; |
1373 return; | 1359 return; |
1374 } | 1360 } |
1375 | 1361 |
1376 computeSuffixes(rootLibrary, const Link<Uri>()); | 1362 computeSuffixes(rootLibrary, const Link<Uri>()); |
1377 } | 1363 } |
1378 } | 1364 } |
OLD | NEW |