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

Unified Diff: dart/frog/leg/emitter.dart

Issue 9453021: Start supporting fixed length and immutable lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Handle constant list expressions. Created 8 years, 10 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 | « dart/frog/leg/compile_time_constants.dart ('k') | dart/frog/leg/lib/js_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/emitter.dart
diff --git a/dart/frog/leg/emitter.dart b/dart/frog/leg/emitter.dart
index f76b68ec196c99e7dc842bb25831f9e5820e096e..5d00bcd4f138434a56deac12f40a90bbb5691ca1 100644
--- a/dart/frog/leg/emitter.dart
+++ b/dart/frog/leg/emitter.dart
@@ -526,6 +526,7 @@ $prototype.toString = function() {
CompileTimeConstantHandler handler = compiler.compileTimeConstantHandler;
List<Constant> constants = handler.getConstantsForEmission();
String prototype = "${namer.ISOLATE}.prototype";
+ emitMakeConstantList(prototype, buffer);
for (Constant constant in constants) {
String name = handler.getNameForConstant(constant);
buffer.add('$prototype.$name = ');
@@ -534,6 +535,16 @@ $prototype.toString = function() {
}
}
+ void emitMakeConstantList(String prototype, StringBuffer buffer) {
+ buffer.add(prototype);
+ buffer.add(@'''.makeConstantList = function(list) {
+ list.immutable$list = true;
+ list.fixed$length = true;
+ return list;
+};
+''');
+ }
+
void emitStaticFinalFieldInitializations(StringBuffer buffer) {
CompileTimeConstantHandler constants = compiler.compileTimeConstantHandler;
List<VariableElement> staticFinalFields =
« no previous file with comments | « dart/frog/leg/compile_time_constants.dart ('k') | dart/frog/leg/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698