Chromium Code Reviews| Index: pkg/compiler/lib/src/js_emitter/model.dart |
| diff --git a/pkg/compiler/lib/src/js_emitter/model.dart b/pkg/compiler/lib/src/js_emitter/model.dart |
| index 1c3f80d72cbbf1e8885d7ab12b17cb6ece405431..248a7b85c25a322f57ea85f2ec768a573036707d 100644 |
| --- a/pkg/compiler/lib/src/js_emitter/model.dart |
| +++ b/pkg/compiler/lib/src/js_emitter/model.dart |
| @@ -9,6 +9,8 @@ import '../constants/values.dart' show ConstantValue; |
| import '../deferred_load.dart' show OutputUnit; |
| +import 'js_emitter.dart' show MetadataCollector; |
| + |
| import '../common.dart'; |
| class Program { |
| @@ -22,15 +24,34 @@ class Program { |
| // global `TYPE_TO_INTERCEPTOR_MAP`. The map references constants and classes. |
| final js.Expression typeToInterceptorMap; |
| + // TODO(floitsch): we should store the metadata directly instead of storing |
| + // the collector. However, the old emitter still updates the data. |
| + final MetadataCollector _metadataCollector; |
| + |
| Program(this.fragments, |
| this.loadMap, |
| this.typeToInterceptorMap, |
| + this._metadataCollector, |
| {this.outputContainsNativeClasses, |
| this.outputContainsConstantList}) { |
| assert(outputContainsNativeClasses != null); |
| assert(outputContainsConstantList != null); |
| } |
| + /// A list of pretty-printed JavaScript expressions. |
| + /// |
| + /// This list must be emitted in the `METADATA` embedded global. |
| + /// References to classes or constants are wrapped into functions (that are |
|
floitsch
2015/01/29 17:06:31
I'm not yet 100% sure of these claims. If necessar
floitsch
2015/01/29 17:12:18
Already updated...
|
| + /// only executed at runtime). It is safe to emit the data before classes |
| + /// and constants are completely set up. In fact, the data must be emitted |
| + /// before any class (including constant) is constructed. |
| + /// |
| + /// Note: the metadata is derived from the task's `metadataCollector`. The |
| + /// list must not be emitted before all operations on it are done. For |
| + /// example, the old emitter generates metadata when emitting reflection |
| + /// data. |
| + List<String> get metadata => _metadataCollector.globalMetadata; |
| + |
| bool get isSplit => fragments.length > 1; |
| Iterable<Fragment> get deferredFragments => fragments.skip(1); |
| } |