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

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

Issue 9447100: Return null from stringValue and call slowToString() instead of toString(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: changes Created 8 years, 9 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 | « dart/frog/leg/namer.dart ('k') | dart/frog/leg/native_handler.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) 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 Compiler compiler; 7 Compiler compiler;
8 bool addedDynamicFunction = false; 8 bool addedDynamicFunction = false;
9 9
10 NativeEmitter(this.compiler); 10 NativeEmitter(this.compiler);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 buffer.add('$dynamicName = '); 123 buffer.add('$dynamicName = ');
124 buffer.add(buildDynamicFunctionCode()); 124 buffer.add(buildDynamicFunctionCode());
125 buffer.add('\n'); 125 buffer.add('\n');
126 buffer.add(buildDynamicMetadataCode()); 126 buffer.add(buildDynamicMetadataCode());
127 buffer.add('\n'); 127 buffer.add('\n');
128 } 128 }
129 129
130 void generateNativeClass(ClassElement classElement, StringBuffer buffer) { 130 void generateNativeClass(ClassElement classElement, StringBuffer buffer) {
131 addDynamicFunctionIfNecessary(buffer); 131 addDynamicFunctionIfNecessary(buffer);
132 assert(classElement.backendMembers.isEmpty()); 132 assert(classElement.backendMembers.isEmpty());
133 String nativeName = classElement.nativeName.stringValue; 133 String nativeName = classElement.nativeName.slowToString();
134 nativeName = nativeName.substring(2, nativeName.length - 1); 134 nativeName = nativeName.substring(2, nativeName.length - 1);
135 for (Element member in classElement.members) { 135 for (Element member in classElement.members) {
136 if (member.isInstanceMember()) { 136 if (member.isInstanceMember()) {
137 String memberName = compiler.namer.getName(member); 137 String memberName = compiler.namer.getName(member);
138 if (member.kind === ElementKind.FUNCTION 138 if (member.kind === ElementKind.FUNCTION
139 || member.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY 139 || member.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY
140 || member.kind === ElementKind.GETTER 140 || member.kind === ElementKind.GETTER
141 || member.kind === ElementKind.SETTER) { 141 || member.kind === ElementKind.SETTER) {
142 String codeBlock = compiler.universe.generatedCode[member]; 142 String codeBlock = compiler.universe.generatedCode[member];
143 if (codeBlock == null) continue; 143 if (codeBlock == null) continue;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // method does not have subclasses. 190 // method does not have subclasses.
191 buffer.add(' if (Object.getPrototypeOf(this).hasOwnProperty('); 191 buffer.add(' if (Object.getPrototypeOf(this).hasOwnProperty(');
192 buffer.add("'$invocationName')) {\n"); 192 buffer.add("'$invocationName')) {\n");
193 buffer.add(' return this.${compiler.namer.getName(member)}($arguments)'); 193 buffer.add(' return this.${compiler.namer.getName(member)}($arguments)');
194 buffer.add('\n }\n'); 194 buffer.add('\n }\n');
195 buffer.add(' return Object.prototype.$invocationName.call(this'); 195 buffer.add(' return Object.prototype.$invocationName.call(this');
196 buffer.add(arguments == '' ? '' : ', $arguments'); 196 buffer.add(arguments == '' ? '' : ', $arguments');
197 buffer.add(');'); 197 buffer.add(');');
198 } 198 }
199 } 199 }
OLDNEW
« no previous file with comments | « dart/frog/leg/namer.dart ('k') | dart/frog/leg/native_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698