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

Side by Side Diff: lib/compiler/implementation/native_handler.dart

Issue 10202018: Fix bug http://code.google.com/p/dart/issues/detail?id=2718: methods that are implemented by the ht… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | « lib/compiler/implementation/native_emitter.dart ('k') | no next file » | 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('dart:uri'); 6 #import('dart:uri');
7 #import('leg.dart'); 7 #import('leg.dart');
8 #import('elements/elements.dart'); 8 #import('elements/elements.dart');
9 #import('scanner/scannerlib.dart'); 9 #import('scanner/scannerlib.dart');
10 #import('ssa/ssa.dart'); 10 #import('ssa/ssa.dart');
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 LiteralString jsCode = node.arguments.head; 239 LiteralString jsCode = node.arguments.head;
240 String str = jsCode.dartString.slowToString(); 240 String str = jsCode.dartString.slowToString();
241 if (nativeRedirectionRegExp.hasMatch(str)) { 241 if (nativeRedirectionRegExp.hasMatch(str)) {
242 nativeMethodName = str; 242 nativeMethodName = str;
243 isRedirecting = true; 243 isRedirecting = true;
244 } else { 244 } else {
245 hasBody = true; 245 hasBody = true;
246 } 246 }
247 } 247 }
248 248
249 if (!hasBody) {
250 compiler.emitter.nativeEmitter.nativeMethods.add(element);
251 }
252
249 FunctionParameters parameters = element.computeParameters(builder.compiler); 253 FunctionParameters parameters = element.computeParameters(builder.compiler);
250 if (!hasBody) { 254 if (!hasBody) {
251 List<String> arguments = <String>[]; 255 List<String> arguments = <String>[];
252 List<HInstruction> inputs = <HInstruction>[]; 256 List<HInstruction> inputs = <HInstruction>[];
253 String receiver = ''; 257 String receiver = '';
254 if (element.isInstanceMember()) { 258 if (element.isInstanceMember()) {
255 receiver = '#.'; 259 receiver = '#.';
256 inputs.add(builder.localsHandler.readThis()); 260 inputs.add(builder.localsHandler.readThis());
257 } 261 }
258 parameters.forEachParameter((Element parameter) { 262 parameters.forEachParameter((Element parameter) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 String parameters) { 347 String parameters) {
344 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty"); 348 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty");
345 buffer.add("('$methodName')) {\n"); 349 buffer.add("('$methodName')) {\n");
346 buffer.add(" $code"); 350 buffer.add(" $code");
347 buffer.add(" } else {\n"); 351 buffer.add(" } else {\n");
348 buffer.add(" return Object.prototype.$methodName.call(this"); 352 buffer.add(" return Object.prototype.$methodName.call(this");
349 buffer.add(parameters == '' ? '' : ', $parameters'); 353 buffer.add(parameters == '' ? '' : ', $parameters');
350 buffer.add(");\n"); 354 buffer.add(");\n");
351 buffer.add(" }\n"); 355 buffer.add(" }\n");
352 } 356 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/native_emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698