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

Side by Side Diff: dart/frog/leg/native_handler.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/native_emitter.dart ('k') | dart/frog/leg/resolver.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 #library('native'); 5 #library('native');
6 #import('leg.dart'); 6 #import('leg.dart');
7 #import('elements/elements.dart'); 7 #import('elements/elements.dart');
8 #import('scanner/scannerlib.dart'); 8 #import('scanner/scannerlib.dart');
9 #import('ssa/ssa.dart'); 9 #import('ssa/ssa.dart');
10 #import('tree/tree.dart'); 10 #import('tree/tree.dart');
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 i++; 127 i++;
128 }); 128 });
129 String foreignParameters = Strings.join(arguments, ','); 129 String foreignParameters = Strings.join(arguments, ',');
130 130
131 String methodName = builder.compiler.namer.instanceMethodName( 131 String methodName = builder.compiler.namer.instanceMethodName(
132 element.name, parameters.parameterCount); 132 element.name, parameters.parameterCount);
133 133
134 HInstruction thenInstruction; 134 HInstruction thenInstruction;
135 void visitThen() { 135 void visitThen() {
136 SourceString jsCode = new SourceString( 136 SourceString jsCode = new SourceString(
137 '$receiver${element.name}($foreignParameters)'); 137 '$receiver${element.name.slowToString()}($foreignParameters)');
138 thenInstruction = 138 thenInstruction =
139 new HForeign(jsCode, const SourceString('Object'), inputs); 139 new HForeign(jsCode, const SourceString('Object'), inputs);
140 builder.add(thenInstruction); 140 builder.add(thenInstruction);
141 } 141 }
142 142
143 if (!element.isInstanceMember()) { 143 if (!element.isInstanceMember()) {
144 // If the method is a non-instance method, we just generate a direct 144 // If the method is a non-instance method, we just generate a direct
145 // call to the native method. 145 // call to the native method.
146 visitThen(); 146 visitThen();
147 builder.stack.add(thenInstruction); 147 builder.stack.add(thenInstruction);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 } else if (!node.arguments.tail.isEmpty()) { 193 } else if (!node.arguments.tail.isEmpty()) {
194 builder.compiler.cancel('More than one argument to native'); 194 builder.compiler.cancel('More than one argument to native');
195 } else { 195 } else {
196 LiteralString jsCode = node.arguments.head; 196 LiteralString jsCode = node.arguments.head;
197 builder.push(new HForeign(builder.unquote(jsCode, 0), 197 builder.push(new HForeign(builder.unquote(jsCode, 0),
198 const SourceString('Object'), 198 const SourceString('Object'),
199 <HInstruction>[])); 199 <HInstruction>[]));
200 } 200 }
201 } 201 }
OLDNEW
« no previous file with comments | « dart/frog/leg/native_emitter.dart ('k') | dart/frog/leg/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698