Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: pkg/compiler/lib/src/js_emitter/model.dart

Issue 889643002: dart2js: emit metadata in new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Metadata must be emitted after constants. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f88eded80c8617bde1d9ef4d09bda590d1e8eb56 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,32 @@ 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.
+ /// The list references constants and must hence be emitted after constants
+ /// have been initialized.
+ ///
+ /// 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);
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698