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

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

Issue 9027002: Support factory methods. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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
« no previous file with comments | « frog/leg/elements/elements.dart ('k') | frog/leg/lib/core.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 24 matching lines...) Expand all
35 buffer.add('$inheritsName = '); 35 buffer.add('$inheritsName = ');
36 buffer.add(INHERIT_FUNCTION); 36 buffer.add(INHERIT_FUNCTION);
37 buffer.add(';\n'); 37 buffer.add(';\n');
38 } 38 }
39 39
40 void addInstanceMember(Element member, 40 void addInstanceMember(Element member,
41 String prototype, 41 String prototype,
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.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 } else { 50 } else {
51 // TODO(ngeoffray): Have another class generate the code for the 51 // TODO(ngeoffray): Have another class generate the code for the
52 // fields. 52 // fields.
53 assert(member.kind === ElementKind.FIELD); 53 assert(member.kind === ElementKind.FIELD);
54 String setterName = namer.setterName(member.name); 54 String setterName = namer.setterName(member.name);
55 String getterName = namer.getterName(member.name); 55 String getterName = namer.getterName(member.name);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 buffer.add(';\n\n'); 144 buffer.add(';\n\n');
145 } 145 }
146 }); 146 });
147 buffer.add('var ${namer.currentIsolate} = new ${namer.isolate}();\n'); 147 buffer.add('var ${namer.currentIsolate} = new ${namer.isolate}();\n');
148 buffer.add('${namer.currentIsolate}.main();\n'); 148 buffer.add('${namer.currentIsolate}.main();\n');
149 compiler.assembledCode = buffer.toString(); 149 compiler.assembledCode = buffer.toString();
150 }); 150 });
151 return compiler.assembledCode; 151 return compiler.assembledCode;
152 } 152 }
153 } 153 }
OLDNEW
« no previous file with comments | « frog/leg/elements/elements.dart ('k') | frog/leg/lib/core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698