Chromium Code Reviews| Index: lib/src/codegen/js_module_item_order.dart |
| diff --git a/lib/src/codegen/js_module_item_order.dart b/lib/src/codegen/js_module_item_order.dart |
| index 072e170d1d76f7f102b33be933af148fa0abdbe4..48626a574e4cb45a19476b59da3a51a1c7018ee2 100644 |
| --- a/lib/src/codegen/js_module_item_order.dart |
| +++ b/lib/src/codegen/js_module_item_order.dart |
| @@ -182,9 +182,9 @@ class ModuleItemLoadOrder { |
| assert(library != _currentLibrary); |
| // The SDK is a special case: we optimize the order to prevent laziness. |
| - if (library.isInSdk) { |
| + if (_isDartUri(library)) { |
| // SDK is loaded before non-SDK libraries |
| - if (!_currentLibrary.isInSdk) return true; |
| + if (!_isDartUri(_currentLibrary)) return true; |
| // Compute the order of both SDK libraries. If unknown, assume it's after. |
| var order = corelibOrder.indexOf(library.name); |
| @@ -209,7 +209,7 @@ class ModuleItemLoadOrder { |
| bool _inLibraryCycle(LibraryElement library) { |
| // SDK libs don't depend on things outside the SDK. |
| // (We can reach this via the recursive call below.) |
| - if (library.isInSdk && !_currentLibrary.isInSdk) return false; |
| + if (_isDartUri(library) && !_isDartUri(_currentLibrary)) return false; |
| var result = _libraryCycleMemo[library]; |
| if (result != null) return result; |
| @@ -226,4 +226,10 @@ class ModuleItemLoadOrder { |
| } |
| return _libraryCycleMemo[library] = result; |
| } |
| + |
| + /// Returns whether this is a library imported with 'dart:' URI. |
| + /// |
| + /// This is similar to [LibraryElement.isInSdk], but checking the URI instead |
| + /// of the library naming convention, because the URI is reliable. |
| + static bool _isDartUri(LibraryElement e) => e.source.uri.scheme == 'dart'; |
|
vsm
2015/06/10 16:41:15
Do you want to assert e.isInSdk == _isDartUri(e)?
Jennifer Messerly
2015/06/10 16:46:04
We can't assert it, because user can name their li
|
| } |