OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 /// This class should morph into something that makes it easy to build | 7 /// This class should morph into something that makes it easy to build |
8 /// JavaScript representations of libraries, class-sides, and instance-sides. | 8 /// JavaScript representations of libraries, class-sides, and instance-sides. |
9 /// Initially, it is just a placeholder for code that is moved from | 9 /// Initially, it is just a placeholder for code that is moved from |
10 /// [CodeEmitterTask]. | 10 /// [CodeEmitterTask]. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 backend.constants.addCompileTimeConstantForEmission(constant); | 143 backend.constants.addCompileTimeConstantForEmission(constant); |
144 return task.metadataCollector.reifyMetadata(annotation); | 144 return task.metadataCollector.reifyMetadata(annotation); |
145 }); | 145 }); |
146 expressions.add(new jsAst.ArrayInitializer(metadataIndices.toList())); | 146 expressions.add(new jsAst.ArrayInitializer(metadataIndices.toList())); |
147 } | 147 } |
148 }); | 148 }); |
149 } | 149 } |
150 if (canBeReflected) { | 150 if (canBeReflected) { |
151 jsAst.LiteralString reflectionName; | 151 jsAst.LiteralString reflectionName; |
152 if (member.isConstructor) { | 152 if (member.isConstructor) { |
153 String reflectionNameString = emitter.getReflectionName(member, name); | 153 // TODO(herhut): This registers name as a mangled name. Do we need this |
| 154 // given that we use a different name below? |
| 155 emitter.getReflectionName(member, name); |
154 reflectionName = | 156 reflectionName = |
155 new jsAst.LiteralString( | 157 new jsAst.LiteralString( |
156 '"new ${Elements.reconstructConstructorName(member)}"'); | 158 '"new ${Elements.reconstructConstructorName(member)}"'); |
157 } else { | 159 } else { |
158 reflectionName = | 160 reflectionName = |
159 js.string(namer.privateName(member.memberName)); | 161 js.string(namer.privateName(member.memberName)); |
160 } | 162 } |
161 expressions | 163 expressions |
162 ..add(reflectionName) | 164 ..add(reflectionName) |
163 ..addAll(task.metadataCollector.computeMetadata(member)); | 165 ..addAll(task.metadataCollector.computeMetadata(member)); |
164 } else if (isClosure && canBeApplied) { | 166 } else if (isClosure && canBeApplied) { |
165 expressions.add(js.string(namer.privateName(member.memberName))); | 167 expressions.add(js.string(namer.privateName(member.memberName))); |
166 } | 168 } |
167 | 169 |
168 jsAst.ArrayInitializer arrayInit = | 170 jsAst.ArrayInitializer arrayInit = |
169 new jsAst.ArrayInitializer(expressions.toList()); | 171 new jsAst.ArrayInitializer(expressions.toList()); |
170 compiler.dumpInfoTask.registerElementAst(member, | 172 compiler.dumpInfoTask.registerElementAst(member, |
171 builder.addProperty(name, arrayInit)); | 173 builder.addProperty(name, arrayInit)); |
172 } | 174 } |
173 | 175 |
174 void addMemberField(Field field, ClassBuilder builder) { | 176 void addMemberField(Field field, ClassBuilder builder) { |
175 // For now, do nothing. | 177 // For now, do nothing. |
176 } | 178 } |
177 } | 179 } |
OLD | NEW |