Index: dart/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart |
=================================================================== |
--- dart/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart (revision 36615) |
+++ dart/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart (working copy) |
@@ -135,6 +135,8 @@ |
String get lazyInitializerName |
=> '${namer.isolateName}.\$lazy'; |
String get initName => 'init'; |
+ String get makeConstListProperty |
+ => namer.getMappedInstanceName('makeConstantList'); |
jsAst.FunctionDeclaration get generateAccessorFunction { |
const RANGE1_SIZE = RANGE1_LAST - RANGE1_FIRST + 1; |
@@ -538,7 +540,7 @@ |
if (#) |
Isolate.$finishClassesProperty = oldIsolate.$finishClassesProperty; |
if (#) |
- Isolate.makeConstantList = oldIsolate.makeConstantList; |
+ Isolate.$makeConstListProperty = oldIsolate.$makeConstListProperty; |
return Isolate; |
}''', |
[ needsDefineClass, hasMakeConstantList ]); |
@@ -956,14 +958,16 @@ |
void emitMakeConstantListIfNotEmitted(CodeBuffer buffer) { |
if (hasMakeConstantList) return; |
hasMakeConstantList = true; |
- buffer |
- ..write(namer.isolateName) |
- ..write('''.makeConstantList = function(list) { |
- list.immutable\$list = $initName; |
- list.fixed\$length = $initName; |
- return list; |
-}; |
-'''); |
+ jsAst.Statement value = new jsAst.ExpressionStatement(new jsAst.Assignment( |
+ new jsAst.PropertyAccess.field( |
+ new jsAst.VariableUse(namer.isolateName), |
+ makeConstListProperty), |
+ js('''function(list) { |
+ list.immutable\$list = $initName; |
+ list.fixed\$length = $initName; |
+ return list; |
+ }'''))); |
+ buffer.write(jsAst.prettyPrint(value, compiler)); |
} |
/// Returns the code equivalent to: |