| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:collection' show HashMap; | 5 import 'dart:collection' show HashMap; |
| 6 import 'package:analyzer/src/generated/ast.dart'; | 6 import 'package:analyzer/src/generated/ast.dart'; |
| 7 import 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/src/generated/element.dart'; |
| 8 import 'package:dev_compiler/src/compiler.dart' show corelibOrder; | 8 import 'package:dev_compiler/src/compiler.dart' show corelibOrder; |
| 9 | 9 |
| 10 typedef void ModuleItemEmitter(AstNode item); | 10 typedef void ModuleItemEmitter(AstNode item); |
| 11 | 11 |
| 12 /// Helper that tracks order of elements visited by the compiler, detecting | 12 /// Helper that tracks order of elements visited by the compiler, detecting |
| 13 /// if the top level item can be loaded eagerly or not. | 13 /// if the top level item can be loaded eagerly or not. |
| 14 class ModuleItemLoadOrder { | 14 class ModuleItemLoadOrder { |
| 15 | |
| 16 /// The order that elements should be emitted in, with a bit indicating if | 15 /// The order that elements should be emitted in, with a bit indicating if |
| 17 /// the element should be generated lazily. The value will be `false` if | 16 /// the element should be generated lazily. The value will be `false` if |
| 18 /// the item could not be loaded, and needs to be made lazy. | 17 /// the item could not be loaded, and needs to be made lazy. |
| 19 /// | 18 /// |
| 20 /// The order will match the original source order, unless something needed to | 19 /// The order will match the original source order, unless something needed to |
| 21 /// be moved sooner to satisfy dependencies. | 20 /// be moved sooner to satisfy dependencies. |
| 22 /// | 21 /// |
| 23 /// Sometimes it's impossible to ensure an ordering when confronting library | 22 /// Sometimes it's impossible to ensure an ordering when confronting library |
| 24 /// cycles. In that case, we mark the definition as lazy. | 23 /// cycles. In that case, we mark the definition as lazy. |
| 25 final _loaded = new Map<Element, bool>(); | 24 final _loaded = new Map<Element, bool>(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 225 } |
| 227 return _libraryCycleMemo[library] = result; | 226 return _libraryCycleMemo[library] = result; |
| 228 } | 227 } |
| 229 | 228 |
| 230 /// Returns whether this is a library imported with 'dart:' URI. | 229 /// Returns whether this is a library imported with 'dart:' URI. |
| 231 /// | 230 /// |
| 232 /// This is similar to [LibraryElement.isInSdk], but checking the URI instead | 231 /// This is similar to [LibraryElement.isInSdk], but checking the URI instead |
| 233 /// of the library naming convention, because the URI is reliable. | 232 /// of the library naming convention, because the URI is reliable. |
| 234 static bool _isDartUri(LibraryElement e) => e.source.uri.scheme == 'dart'; | 233 static bool _isDartUri(LibraryElement e) => e.source.uri.scheme == 'dart'; |
| 235 } | 234 } |
| OLD | NEW |