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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 List<String> argumentNames = fields; | 117 List<String> argumentNames = fields; |
118 if (fields.length < ($z - $a)) { | 118 if (fields.length < ($z - $a)) { |
119 argumentNames = new List<String>(fields.length); | 119 argumentNames = new List<String>(fields.length); |
120 for (int i = 0; i < fields.length; i++) { | 120 for (int i = 0; i < fields.length; i++) { |
121 argumentNames[i] = new String.fromCharCodes([$a + i]); | 121 argumentNames[i] = new String.fromCharCodes([$a + i]); |
122 } | 122 } |
123 } | 123 } |
124 String constructorName = namer.safeName(classElement.name.slowToString()); | 124 String constructorName = namer.safeName(classElement.name.slowToString()); |
125 // Generate the constructor. | 125 // Generate the constructor. |
126 buffer.add("'': function $constructorName("); | 126 buffer.add('"": function $constructorName('); |
127 buffer.add(Strings.join(argumentNames, ", ")); | 127 buffer.add(Strings.join(argumentNames, ", ")); |
128 buffer.add(") {\n"); | 128 buffer.add(") {\n"); |
129 for (int i = 0; i < fields.length; i++) { | 129 for (int i = 0; i < fields.length; i++) { |
130 buffer.add(" this.${fields[i]} = ${argumentNames[i]};\n"); | 130 buffer.add(" this.${fields[i]} = ${argumentNames[i]};\n"); |
131 } | 131 } |
132 buffer.add(' }'); | 132 buffer.add(' }'); |
133 } | 133 } |
134 | 134 |
| 135 void emitSuper(String superName, CodeBuffer buffer) { |
| 136 if (superName != '') { |
| 137 buffer.add(",\n 'super': '$superName'"); |
| 138 } |
| 139 } |
| 140 |
135 void emitClassFields(ClassElement classElement, | 141 void emitClassFields(ClassElement classElement, |
136 CodeBuffer buffer, | 142 CodeBuffer buffer, |
137 bool emitEndingComma, | 143 bool emitEndingComma, |
138 { String superClass: "", | 144 { String superClass: "", |
139 bool isNative: false}) { | 145 bool isNative: false}) { |
140 if (emitEndingComma) buffer.add(', '); | 146 if (emitEndingComma) buffer.add(', '); |
141 } | 147 } |
142 | 148 |
143 bool getterAndSetterCanBeImplementedByFieldSpec(Element member, | 149 bool getterAndSetterCanBeImplementedByFieldSpec(Element member, |
144 String name, | 150 String name, |
145 bool needsGetter, | 151 bool needsGetter, |
146 bool needsSetter) { | 152 bool needsSetter) { |
147 return false; | 153 return false; |
148 } | 154 } |
149 } | 155 } |
OLD | NEW |