| Index: sdk/lib/_internal/compiler/implementation/deferred_load.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/deferred_load.dart b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
|
| index 8585c4825134d354927f55558c5f9eff19717d6f..294fb34711d5617e3d287a62db580380720d297f 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/deferred_load.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
|
| @@ -5,6 +5,7 @@
|
| library deferred_load;
|
|
|
| import 'dart2jslib.dart' show
|
| + Backend,
|
| Compiler,
|
| CompilerTask,
|
| Constant,
|
| @@ -150,6 +151,8 @@ class DeferredLoadTask extends CompilerTask {
|
|
|
| DeferredLoadTask(Compiler compiler) : super(compiler);
|
|
|
| + Backend get backend => compiler.backend;
|
| +
|
| /// Returns the [OutputUnit] where [element] belongs.
|
| OutputUnit outputUnitForElement(Element element) {
|
| if (!splitProgram) return mainOutputUnit;
|
| @@ -292,7 +295,11 @@ class DeferredLoadTask extends CompilerTask {
|
| if (dependency.isStatement()) continue;
|
| elementDependencies.add(dependency);
|
| }
|
| - constantDependencies.addAll(elements.allConstants);
|
| + elements.forEachConstantNode((Node n, _) {
|
| + // Explicitly depend on the backend constants.
|
| + constantDependencies.add(
|
| + backend.constants.getConstantForNode(n, elements));
|
| + });
|
| elementDependencies.addAll(elements.otherDependencies);
|
| }
|
|
|
| @@ -305,9 +312,10 @@ class DeferredLoadTask extends CompilerTask {
|
| Set<Constant> constants) {
|
| // TODO(sigurdm): How is metadata on a patch-class handled?
|
| for (MetadataAnnotation metadata in element.metadata) {
|
| - if (metadata.value != null) {
|
| - constants.add(metadata.value);
|
| - elements.add(metadata.value.computeType(compiler).element);
|
| + Constant constant = backend.constants.getConstantForMetadata(metadata);
|
| + if (constant != null) {
|
| + constants.add(constant);
|
| + elements.add(constant.computeType(compiler).element);
|
| }
|
| }
|
| if (element.isClass()) {
|
| @@ -419,15 +427,19 @@ class DeferredLoadTask extends CompilerTask {
|
| // TODO(sigurdm): The metadata should go to the right output unit.
|
| // For now they all go to the main output unit.
|
| for (MetadataAnnotation metadata in library.metadata) {
|
| - if (metadata.value != null) {
|
| - _mapDependencies(metadata.value.computeType(compiler).element,
|
| + Constant constant =
|
| + backend.constants.getConstantForMetadata(metadata);
|
| + if (constant != null) {
|
| + _mapDependencies(constant.computeType(compiler).element,
|
| _fakeMainImport);
|
| }
|
| }
|
| for (LibraryTag tag in library.tags) {
|
| for (MetadataAnnotation metadata in tag.metadata) {
|
| - if (metadata.value != null) {
|
| - _mapDependencies(metadata.value.computeType(compiler).element,
|
| + Constant constant =
|
| + backend.constants.getConstantForMetadata(metadata);
|
| + if (constant != null) {
|
| + _mapDependencies(constant.computeType(compiler).element,
|
| _fakeMainImport);
|
| }
|
| }
|
| @@ -596,8 +608,7 @@ class DeferredLoadTask extends CompilerTask {
|
| for (MetadataAnnotation metadata in metadatas) {
|
| metadata.ensureResolved(compiler);
|
| Element element = metadata.value.computeType(compiler).element;
|
| - if (metadata.value.computeType(compiler).element ==
|
| - deferredLibraryClass) {
|
| + if (element == deferredLibraryClass) {
|
| ConstructedConstant constant = metadata.value;
|
| StringConstant s = constant.fields[0];
|
| result = s.value.slowToString();
|
| @@ -766,7 +777,7 @@ class DeferredLoadTask extends CompilerTask {
|
| }
|
| });
|
| }
|
| - if (splitProgram && compiler.backend is DartBackend) {
|
| + if (splitProgram && backend is DartBackend) {
|
| // TODO(sigurdm): Implement deferred loading for dart2dart.
|
| splitProgram = false;
|
| compiler.reportInfo(
|
|
|