| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 if (!expression.isPotential) { | 399 if (!expression.isPotential) { |
| 400 // Enforce evaluation of [expression]. | 400 // Enforce evaluation of [expression]. |
| 401 backend.constants.getConstantValue(expression); | 401 backend.constants.getConstantValue(expression); |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 | 404 |
| 405 // Explicitly depend on the backend constants. | 405 // Explicitly depend on the backend constants. |
| 406 if (backend.constants.hasConstantValue(expression)) { | 406 if (backend.constants.hasConstantValue(expression)) { |
| 407 ConstantValue value = | 407 ConstantValue value = |
| 408 backend.constants.getConstantValue(expression); | 408 backend.constants.getConstantValue(expression); |
| 409 assert(invariant(node, value != null, | 409 assert( |
| 410 message: "Constant expression without value: " | 410 value != null, |
| 411 failedAt( |
| 412 node, |
| 413 "Constant expression without value: " |
| 411 "${expression.toStructuredText()}.")); | 414 "${expression.toStructuredText()}.")); |
| 412 constants.add(value); | 415 constants.add(value); |
| 413 } else { | 416 } else { |
| 414 assert( | 417 assert( |
| 415 invariant(node, expression.isImplicit || expression.isPotential, | 418 expression.isImplicit || expression.isPotential, |
| 416 message: "Unexpected unevaluated constant expression: " | 419 failedAt( |
| 417 "${expression.toStructuredText()}.")); | 420 node, |
| 421 "Unexpected unevaluated constant expression: " |
| 422 "${expression.toStructuredText()}.")); |
| 418 } | 423 } |
| 419 }); | 424 }); |
| 420 } | 425 } |
| 421 } | 426 } |
| 422 | 427 |
| 423 // TODO(sigurdm): How is metadata on a patch-class handled? | 428 // TODO(sigurdm): How is metadata on a patch-class handled? |
| 424 for (MetadataAnnotation metadata in element.metadata) { | 429 for (MetadataAnnotation metadata in element.metadata) { |
| 425 ConstantValue constant = | 430 ConstantValue constant = |
| 426 backend.constants.getConstantValueForMetadata(metadata); | 431 backend.constants.getConstantValueForMetadata(metadata); |
| 427 if (constant != null) { | 432 if (constant != null) { |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 | 1095 |
| 1091 bool operator ==(other) { | 1096 bool operator ==(other) { |
| 1092 if (other is! _DeclaredDeferredImport) return false; | 1097 if (other is! _DeclaredDeferredImport) return false; |
| 1093 return declaration == other.declaration; | 1098 return declaration == other.declaration; |
| 1094 } | 1099 } |
| 1095 | 1100 |
| 1096 int get hashCode => declaration.hashCode * 17; | 1101 int get hashCode => declaration.hashCode * 17; |
| 1097 | 1102 |
| 1098 String toString() => '$declaration'; | 1103 String toString() => '$declaration'; |
| 1099 } | 1104 } |
| OLD | NEW |