Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.dart

Issue 1062913003: Extract CallStructure from Selector. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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].
11 class ContainerBuilder extends CodeEmitterHelper { 11 class ContainerBuilder extends CodeEmitterHelper {
12 12
13 void addMemberMethod(DartMethod method, ClassBuilder builder) { 13 void addMemberMethod(DartMethod method, ClassBuilder builder) {
14 FunctionElement member = method.element; 14 MethodElement member = method.element;
15 String name = method.name; 15 String name = method.name;
16 FunctionSignature parameters = member.functionSignature; 16 FunctionSignature parameters = member.functionSignature;
17 jsAst.Expression code = method.code; 17 jsAst.Expression code = method.code;
18 bool needsStubs = method.parameterStubs.isNotEmpty; 18 bool needsStubs = method.parameterStubs.isNotEmpty;
19 bool canBeApplied = method.canBeApplied; 19 bool canBeApplied = method.canBeApplied;
20 bool canBeReflected = method.canBeReflected; 20 bool canBeReflected = method.canBeReflected;
21 bool canTearOff = method.needsTearOff; 21 bool canTearOff = method.needsTearOff;
22 String tearOffName = method.tearOffName; 22 String tearOffName = method.tearOffName;
23 bool isClosure = method is InstanceMethod && method.isClosure; 23 bool isClosure = method is InstanceMethod && method.isClosure;
24 String superAlias = method is InstanceMethod ? method.aliasName : null; 24 String superAlias = method is InstanceMethod ? method.aliasName : null;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 if (canBeReflected) { 157 if (canBeReflected) {
158 jsAst.LiteralString reflectionName; 158 jsAst.LiteralString reflectionName;
159 if (member.isConstructor) { 159 if (member.isConstructor) {
160 String reflectionNameString = emitter.getReflectionName(member, name); 160 String reflectionNameString = emitter.getReflectionName(member, name);
161 reflectionName = 161 reflectionName =
162 new jsAst.LiteralString( 162 new jsAst.LiteralString(
163 '"new ${Elements.reconstructConstructorName(member)}"'); 163 '"new ${Elements.reconstructConstructorName(member)}"');
164 } else { 164 } else {
165 reflectionName = 165 reflectionName =
166 js.string(namer.privateName(member.library, member.name)); 166 js.string(namer.privateName(member.memberName));
167 } 167 }
168 expressions 168 expressions
169 ..add(reflectionName) 169 ..add(reflectionName)
170 ..addAll(task.metadataCollector 170 ..addAll(task.metadataCollector
171 .computeMetadata(member).map(js.number)); 171 .computeMetadata(member).map(js.number));
172 } else if (isClosure && canBeApplied) { 172 } else if (isClosure && canBeApplied) {
173 expressions.add(js.string(namer.privateName(member.library, 173 expressions.add(js.string(namer.privateName(member.memberName)));
174 member.name)));
175 } 174 }
176 175
177 jsAst.ArrayInitializer arrayInit = 176 jsAst.ArrayInitializer arrayInit =
178 new jsAst.ArrayInitializer(expressions.toList()); 177 new jsAst.ArrayInitializer(expressions.toList());
179 compiler.dumpInfoTask.registerElementAst(member, 178 compiler.dumpInfoTask.registerElementAst(member,
180 builder.addProperty(name, arrayInit)); 179 builder.addProperty(name, arrayInit));
181 } 180 }
182 181
183 void addMemberField(Field field, ClassBuilder builder) { 182 void addMemberField(Field field, ClassBuilder builder) {
184 // For now, do nothing. 183 // For now, do nothing.
185 } 184 }
186 } 185 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698