| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 deferred_load; | 5 library deferred_load; |
| 6 | 6 |
| 7 import 'common/tasks.dart' show CompilerTask; | 7 import 'common/tasks.dart' show CompilerTask; |
| 8 import 'common.dart'; | 8 import 'common.dart'; |
| 9 import 'compiler.dart' show Compiler; | 9 import 'compiler.dart' show Compiler; |
| 10 import 'constants/expressions.dart' show ConstantExpression; | 10 import 'constants/expressions.dart' show ConstantExpression; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 OutputUnit outputUnitForConstant(ConstantValue constant) { | 205 OutputUnit outputUnitForConstant(ConstantValue constant) { |
| 206 if (!isProgramSplit) return mainOutputUnit; | 206 if (!isProgramSplit) return mainOutputUnit; |
| 207 return _constantToOutputUnit[constant]; | 207 return _constantToOutputUnit[constant]; |
| 208 } | 208 } |
| 209 | 209 |
| 210 /// Direct access to the output-unit to constants map used for testing. | 210 /// Direct access to the output-unit to constants map used for testing. |
| 211 Map<ConstantValue, OutputUnit> get outputUnitForConstantsForTesting { | 211 Map<ConstantValue, OutputUnit> get outputUnitForConstantsForTesting { |
| 212 return _constantToOutputUnit; | 212 return _constantToOutputUnit; |
| 213 } | 213 } |
| 214 | 214 |
| 215 bool isDeferred(Element element) { | 215 bool isDeferred(Entity element) { |
| 216 return outputUnitForElement(element) != mainOutputUnit; | 216 return outputUnitForElement(element) != mainOutputUnit; |
| 217 } | 217 } |
| 218 | 218 |
| 219 bool isDeferredClass(ClassElement element) { | 219 bool isDeferredClass(ClassEntity element) { |
| 220 return outputUnitForElement(element) != mainOutputUnit; | 220 return outputUnitForElement(element) != mainOutputUnit; |
| 221 } | 221 } |
| 222 | 222 |
| 223 /// Returns the unique name for the deferred import of [prefix]. | 223 /// Returns the unique name for the deferred import of [prefix]. |
| 224 String getImportDeferName(Spannable node, PrefixElement prefix) { | 224 String getImportDeferName(Spannable node, PrefixElement prefix) { |
| 225 String name = | 225 String name = |
| 226 importDeferName[new _DeclaredDeferredImport(prefix.deferredImport)]; | 226 importDeferName[new _DeclaredDeferredImport(prefix.deferredImport)]; |
| 227 if (name == null) { | 227 if (name == null) { |
| 228 reporter.internalError(node, "No deferred name for $prefix."); | 228 reporter.internalError(node, "No deferred name for $prefix."); |
| 229 } | 229 } |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 | 1118 |
| 1119 bool operator ==(other) { | 1119 bool operator ==(other) { |
| 1120 if (other is! _DeclaredDeferredImport) return false; | 1120 if (other is! _DeclaredDeferredImport) return false; |
| 1121 return declaration == other.declaration; | 1121 return declaration == other.declaration; |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 int get hashCode => declaration.hashCode * 17; | 1124 int get hashCode => declaration.hashCode * 17; |
| 1125 | 1125 |
| 1126 String toString() => '$declaration'; | 1126 String toString() => '$declaration'; |
| 1127 } | 1127 } |
| OLD | NEW |