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.full_emitter; | 5 part of dart2js.js_emitter.full_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 MethodElement member = method.element; | 14 MethodElement member = method.element; |
15 jsAst.Name name = method.name; | 15 jsAst.Name 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 jsAst.Name tearOffName = method.tearOffName; | 22 jsAst.Name tearOffName = method.tearOffName; |
23 bool isClosure = method is InstanceMethod && method.isClosure; | 23 bool isClosure = method is InstanceMethod && method.isClosureCallMethod; |
24 jsAst.Name superAlias = method is InstanceMethod ? method.aliasName : null; | 24 jsAst.Name superAlias = method is InstanceMethod ? method.aliasName : null; |
25 bool hasSuperAlias = superAlias != null; | 25 bool hasSuperAlias = superAlias != null; |
26 jsAst.Expression memberTypeExpression = method.functionType; | 26 jsAst.Expression memberTypeExpression = method.functionType; |
27 | 27 |
28 bool needStructuredInfo = | 28 bool needStructuredInfo = |
29 canTearOff || canBeReflected || canBeApplied || hasSuperAlias; | 29 canTearOff || canBeReflected || canBeApplied || hasSuperAlias; |
30 | 30 |
31 emitter.interceptorEmitter.recordMangledNameOfMemberMethod(member, name); | 31 emitter.interceptorEmitter.recordMangledNameOfMemberMethod(member, name); |
32 | 32 |
33 if (!needStructuredInfo) { | 33 if (!needStructuredInfo) { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 jsAst.ArrayInitializer arrayInit = | 172 jsAst.ArrayInitializer arrayInit = |
173 new jsAst.ArrayInitializer(expressions.toList()); | 173 new jsAst.ArrayInitializer(expressions.toList()); |
174 compiler.dumpInfoTask.registerElementAst(member, | 174 compiler.dumpInfoTask.registerElementAst(member, |
175 builder.addProperty(name, arrayInit)); | 175 builder.addProperty(name, arrayInit)); |
176 } | 176 } |
177 | 177 |
178 void addMemberField(Field field, ClassBuilder builder) { | 178 void addMemberField(Field field, ClassBuilder builder) { |
179 // For now, do nothing. | 179 // For now, do nothing. |
180 } | 180 } |
181 } | 181 } |
OLD | NEW |