OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 class CodeEmitterNoEvalTask extends CodeEmitterTask { | 7 class CodeEmitterNoEvalTask extends CodeEmitterTask { |
8 CodeEmitterNoEvalTask(Compiler compiler, | 8 CodeEmitterNoEvalTask(Compiler compiler, |
9 Namer namer, | 9 Namer namer, |
10 bool generateSourceMap) | 10 bool generateSourceMap) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 ForceEfficientMap.prototype = this; | 52 ForceEfficientMap.prototype = this; |
53 new ForceEfficientMap; | 53 new ForceEfficientMap; |
54 } | 54 } |
55 Isolate.prototype = oldIsolate.prototype; | 55 Isolate.prototype = oldIsolate.prototype; |
56 Isolate.prototype.constructor = Isolate; | 56 Isolate.prototype.constructor = Isolate; |
57 Isolate.${namer.ISOLATE_PROPERTIES} = isolateProperties; | 57 Isolate.${namer.ISOLATE_PROPERTIES} = isolateProperties; |
58 return Isolate; | 58 return Isolate; |
59 }"""; | 59 }"""; |
60 } | 60 } |
61 | 61 |
| 62 String get lazyInitializerFunction { |
| 63 return """ |
| 64 function(prototype, staticName, fieldName, getterName, lazyValue, getter) { |
| 65 $lazyInitializerLogic |
| 66 }"""; |
| 67 } |
| 68 |
| 69 void emitLazyInitializedGetter(VariableElement element, CodeBuffer buffer) { |
| 70 String isolate = namer.CURRENT_ISOLATE; |
| 71 buffer.add(', function() { return $isolate.${namer.getName(element)}; }'); |
| 72 } |
| 73 |
62 void emitBoundClosureClassHeader(String mangledName, | 74 void emitBoundClosureClassHeader(String mangledName, |
63 String superName, | 75 String superName, |
64 String extraArgument, | 76 String extraArgument, |
65 CodeBuffer buffer) { | 77 CodeBuffer buffer) { |
66 if (!extraArgument.isEmpty) { | 78 if (!extraArgument.isEmpty) { |
67 buffer.add(""" | 79 buffer.add(""" |
68 $classesCollector.$mangledName = {'': function $mangledName( | 80 $classesCollector.$mangledName = {'': function $mangledName( |
69 self, $extraArgument, target) { | 81 self, $extraArgument, target) { |
70 this.self = self; | 82 this.self = self; |
71 this.$extraArgument = $extraArgument, | 83 this.$extraArgument = $extraArgument, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 generateSetter(member, name, accessorName, buffer); | 162 generateSetter(member, name, accessorName, buffer); |
151 } | 163 } |
152 if (needsCheckedSetter) { | 164 if (needsCheckedSetter) { |
153 assert(!needsSetter); | 165 assert(!needsSetter); |
154 emitComma(); | 166 emitComma(); |
155 generateCheckedSetter(member, name, accessorName, buffer); | 167 generateCheckedSetter(member, name, accessorName, buffer); |
156 } | 168 } |
157 }); | 169 }); |
158 } | 170 } |
159 } | 171 } |
OLD | NEW |