| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 void emitBoundClosureClassHeader(String mangledName, | 62 void emitBoundClosureClassHeader(String mangledName, |
| 63 String superName, | 63 String superName, |
| 64 String extraArgument, |
| 64 CodeBuffer buffer) { | 65 CodeBuffer buffer) { |
| 65 buffer.add(""" | 66 if (!extraArgument.isEmpty) { |
| 67 buffer.add(""" |
| 68 $classesCollector.$mangledName = {'': function $mangledName( |
| 69 self, $extraArgument, target) { |
| 70 this.self = self; |
| 71 this.$extraArgument = $extraArgument, |
| 72 this.target = target; |
| 73 }, |
| 74 'super': '$superName', |
| 75 """); |
| 76 } else { |
| 77 buffer.add(""" |
| 66 $classesCollector.$mangledName = {'': function $mangledName(self, target) { | 78 $classesCollector.$mangledName = {'': function $mangledName(self, target) { |
| 67 this.self = self; | 79 this.self = self; |
| 68 this.target = target; | 80 this.target = target; |
| 69 }, | 81 }, |
| 70 'super': '$superName', | 82 'super': '$superName', |
| 71 """); | 83 """); |
| 84 } |
| 72 } | 85 } |
| 73 | 86 |
| 74 void emitClassConstructor(ClassElement classElement, CodeBuffer buffer) { | 87 void emitClassConstructor(ClassElement classElement, CodeBuffer buffer) { |
| 75 // Say we have a class A with fields b, c and d, where c needs a getter and | 88 // Say we have a class A with fields b, c and d, where c needs a getter and |
| 76 // d needs both a getter and a setter. Then we produce: | 89 // d needs both a getter and a setter. Then we produce: |
| 77 // - a constructor (directly into the given [buffer]): | 90 // - a constructor (directly into the given [buffer]): |
| 78 // function A(b, c, d) { this.b = b, this.c = c, this.d = d; } | 91 // function A(b, c, d) { this.b = b, this.c = c, this.d = d; } |
| 79 // - getters and setters (stored in the [explicitGettersSetters] list): | 92 // - getters and setters (stored in the [explicitGettersSetters] list): |
| 80 // get$c : function() { return this.c; } | 93 // get$c : function() { return this.c; } |
| 81 // get$d : function() { return this.d; } | 94 // get$d : function() { return this.d; } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 generateSetter(member, name, buffer); | 148 generateSetter(member, name, buffer); |
| 136 } | 149 } |
| 137 if (needsCheckedSetter) { | 150 if (needsCheckedSetter) { |
| 138 assert(!needsSetter); | 151 assert(!needsSetter); |
| 139 emitComma(); | 152 emitComma(); |
| 140 generateCheckedSetter(member, name, buffer); | 153 generateCheckedSetter(member, name, buffer); |
| 141 } | 154 } |
| 142 }); | 155 }); |
| 143 } | 156 } |
| 144 } | 157 } |
| OLD | NEW |