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

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

Issue 9223012: Small changes to get code generation of getters and setters working. Resolution is not fully corr... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' 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
« no previous file with comments | « frog/leg/compiler.dart ('k') | frog/leg/namer.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.GENERATIVE_CONSTRUCTOR_BODY) { 45 || member.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY
46 || member.kind === ElementKind.GETTER
47 || member.kind === ElementKind.SETTER) {
46 String codeBlock = compiler.universe.generatedCode[member]; 48 String codeBlock = compiler.universe.generatedCode[member];
47 if (codeBlock !== null) { 49 if (codeBlock !== null) {
48 buffer.add('$prototype.${namer.getName(member)} = $codeBlock;\n'); 50 buffer.add('$prototype.${namer.getName(member)} = $codeBlock;\n');
49 } 51 }
50 codeBlock = compiler.universe.generatedBailoutCode[member]; 52 codeBlock = compiler.universe.generatedBailoutCode[member];
51 if (codeBlock !== null) { 53 if (codeBlock !== null) {
52 String name = namer.getBailoutName(member); 54 String name = namer.getBailoutName(member);
53 buffer.add('$prototype.$name = $codeBlock;\n'); 55 buffer.add('$prototype.$name = $codeBlock;\n');
54 } 56 }
55 } else if (member.kind === ElementKind.FIELD) { 57 } else if (member.kind === ElementKind.FIELD) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 emitStaticFunctions(buffer); 245 emitStaticFunctions(buffer);
244 emitStaticFinalFieldInitializations(buffer); 246 emitStaticFinalFieldInitializations(buffer);
245 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); 247 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n');
246 Element main = compiler.universe.find(Compiler.MAIN); 248 Element main = compiler.universe.find(Compiler.MAIN);
247 buffer.add('${namer.isolateAccess(main)}();\n'); 249 buffer.add('${namer.isolateAccess(main)}();\n');
248 compiler.assembledCode = buffer.toString(); 250 compiler.assembledCode = buffer.toString();
249 }); 251 });
250 return compiler.assembledCode; 252 return compiler.assembledCode;
251 } 253 }
252 } 254 }
OLDNEW
« no previous file with comments | « frog/leg/compiler.dart ('k') | frog/leg/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698