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: lib/compiler/implementation/js_backend/native_emitter.dart

Issue 10911211: Runtime support for the new parameter specification. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // Because of native classes, we have to generate some is checks 405 // Because of native classes, we have to generate some is checks
406 // by calling a method, instead of accessing a property. So we 406 // by calling a method, instead of accessing a property. So we
407 // attach to the JS Object prototype these methods that return 407 // attach to the JS Object prototype these methods that return
408 // false, and will be overridden by subclasses when they have to 408 // false, and will be overridden by subclasses when they have to
409 // return true. 409 // return true.
410 Map<String, String> objectProperties = new Map<String, String>(); 410 Map<String, String> objectProperties = new Map<String, String>();
411 emitIsChecks(objectProperties); 411 emitIsChecks(objectProperties);
412 412
413 // In order to have the toString method on every native class, 413 // In order to have the toString method on every native class,
414 // we must patch the JS Object prototype with a helper method. 414 // we must patch the JS Object prototype with a helper method.
415 String toStringName = backend.namer.instanceMethodName( 415 String toStringName = backend.namer.instanceMethodNameByArity(
416 null, const SourceString('toString'), 0); 416 const SourceString('toString'), 0);
417 objectProperties[toStringName] = 417 objectProperties[toStringName] =
418 'function() { return $toStringHelperName(this); }'; 418 'function() { return $toStringHelperName(this); }';
419 419
420 // If the native emitter has been asked to take care of the 420 // If the native emitter has been asked to take care of the
421 // noSuchMethod handlers, we do that now. 421 // noSuchMethod handlers, we do that now.
422 if (handleNoSuchMethod) { 422 if (handleNoSuchMethod) {
423 emitter.emitNoSuchMethodHandlers((String name, CodeBuffer buffer) { 423 emitter.emitNoSuchMethodHandlers((String name, CodeBuffer buffer) {
424 objectProperties[name] = buffer.toString(); 424 objectProperties[name] = buffer.toString();
425 }); 425 });
426 } 426 }
(...skipping 11 matching lines...) Expand all
438 if (!first) targetBuffer.add(",\n"); 438 if (!first) targetBuffer.add(",\n");
439 targetBuffer.add(" $name: $function"); 439 targetBuffer.add(" $name: $function");
440 first = false; 440 first = false;
441 }); 441 });
442 targetBuffer.add("\n});\n\n"); 442 targetBuffer.add("\n});\n\n");
443 } 443 }
444 targetBuffer.add('$nativeBuffer'); 444 targetBuffer.add('$nativeBuffer');
445 targetBuffer.add('\n'); 445 targetBuffer.add('\n');
446 } 446 }
447 } 447 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698