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

Side by Side Diff: frog/leg/emitter.dart

Issue 9243011: Implement named constructors and resolving of redirecting constructors and super-initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move constructor name creation to lookup function. Created 8 years, 11 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 5 /**
6 * Generates the code for all used classes in the program. Static fields (even 6 * Generates the code for all used classes in the program. Static fields (even
7 * in classes) are ignored, since they can be treated as non-class elements. 7 * in classes) are ignored, since they can be treated as non-class elements.
8 * 8 *
9 * The code for the containing (used) methods must exist in the [:universe:]. 9 * The code for the containing (used) methods must exist in the [:universe:].
10 */ 10 */
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 StringBuffer buffer) { 42 StringBuffer buffer) {
43 assert(member.isInstanceMember()); 43 assert(member.isInstanceMember());
44 if (member.kind === ElementKind.FUNCTION 44 if (member.kind === ElementKind.FUNCTION
45 || member.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { 45 || member.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY) {
46 String codeBlock = compiler.universe.generatedCode[member]; 46 String codeBlock = compiler.universe.generatedCode[member];
47 if (codeBlock !== null) { 47 if (codeBlock !== null) {
48 buffer.add('$prototype.${namer.getName(member)} = $codeBlock;\n'); 48 buffer.add('$prototype.${namer.getName(member)} = $codeBlock;\n');
49 } 49 }
50 codeBlock = compiler.universe.generatedBailoutCode[member]; 50 codeBlock = compiler.universe.generatedBailoutCode[member];
51 if (codeBlock !== null) { 51 if (codeBlock !== null) {
52 String name = namer.getBailoutName(member);; 52 String name = namer.getBailoutName(member);
53 buffer.add('$prototype.$name = $codeBlock;\n'); 53 buffer.add('$prototype.$name = $codeBlock;\n');
54 } 54 }
55 } else { 55 } else {
56 // TODO(ngeoffray): Have another class generate the code for the 56 // TODO(ngeoffray): Have another class generate the code for the
57 // fields. 57 // fields.
58 assert(member.kind === ElementKind.FIELD); 58 assert(member.kind === ElementKind.FIELD);
59 String setterName = namer.setterName(member.name); 59 String setterName = namer.setterName(member.name);
60 String getterName = namer.getterName(member.name); 60 String getterName = namer.getterName(member.name);
61 if (compiler.universe.invokedNames.contains(setterName)) { 61 if (compiler.universe.invokedNames.contains(setterName)) {
62 buffer.add('$prototype.$setterName = function(v){\n' + 62 buffer.add('$prototype.$setterName = function(v){\n' +
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 emitClasses(buffer); 192 emitClasses(buffer);
193 emitStaticFunctions(buffer); 193 emitStaticFunctions(buffer);
194 emitStaticFinalFieldInitializations(buffer); 194 emitStaticFinalFieldInitializations(buffer);
195 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); 195 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n');
196 buffer.add('${namer.CURRENT_ISOLATE}.main();\n'); 196 buffer.add('${namer.CURRENT_ISOLATE}.main();\n');
197 compiler.assembledCode = buffer.toString(); 197 compiler.assembledCode = buffer.toString();
198 }); 198 });
199 return compiler.assembledCode; 199 return compiler.assembledCode;
200 } 200 }
201 } 201 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698