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

Side by Side Diff: lib/compiler/implementation/js_backend/native_emitter.dart

Issue 10905305: Patch refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Replaced includeInjectedMembers by implementation Created 8 years, 2 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class NativeEmitter { 5 class NativeEmitter {
6 6
7 CodeEmitterTask emitter; 7 CodeEmitterTask emitter;
8 CodeBuffer nativeBuffer; 8 CodeBuffer nativeBuffer;
9 9
10 // Classes that participate in dynamic dispatch. These are the 10 // Classes that participate in dynamic dispatch. These are the
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 String className = backend.namer.getName(classElement); 112 String className = backend.namer.getName(classElement);
113 nativeBuffer.add(className); 113 nativeBuffer.add(className);
114 nativeBuffer.add(' = '); 114 nativeBuffer.add(' = ');
115 nativeBuffer.add(nativeCode); 115 nativeBuffer.add(nativeCode);
116 nativeBuffer.add(';\n'); 116 nativeBuffer.add(';\n');
117 117
118 void defineInstanceMember(String name, CodeBuffer value) { 118 void defineInstanceMember(String name, CodeBuffer value) {
119 nativeBuffer.add("$className.$name = $value;\n"); 119 nativeBuffer.add("$className.$name = $value;\n");
120 } 120 }
121 121
122 for (Element member in classElement.localMembers) { 122 classElement.implementation.forEachMember((_, Element member) {
123 if (member.isInstanceMember()) { 123 if (member.isInstanceMember()) {
124 emitter.addInstanceMember(member, defineInstanceMember); 124 emitter.addInstanceMember(member, defineInstanceMember);
125 } 125 }
126 } 126 });
127 } 127 }
128 128
129 bool isNativeLiteral(String quotedName) { 129 bool isNativeLiteral(String quotedName) {
130 return quotedName[1] === '='; 130 return quotedName[1] === '=';
131 } 131 }
132 132
133 bool isNativeGlobal(String quotedName) { 133 bool isNativeGlobal(String quotedName) {
134 return quotedName[1] === '@'; 134 return quotedName[1] === '@';
135 } 135 }
136 136
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 if (!first) targetBuffer.add(",\n"); 450 if (!first) targetBuffer.add(",\n");
451 targetBuffer.add(" $name: $function"); 451 targetBuffer.add(" $name: $function");
452 first = false; 452 first = false;
453 }); 453 });
454 targetBuffer.add("\n});\n\n"); 454 targetBuffer.add("\n});\n\n");
455 } 455 }
456 targetBuffer.add('$nativeBuffer'); 456 targetBuffer.add('$nativeBuffer');
457 targetBuffer.add('\n'); 457 targetBuffer.add('\n');
458 } 458 }
459 } 459 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698