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

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

Issue 11191078: Make hashCode a getter and not a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 emitIsChecks(objectProperties); 440 emitIsChecks(objectProperties);
441 441
442 // In order to have the toString method on every native class, 442 // In order to have the toString method on every native class,
443 // we must patch the JS Object prototype with a helper method. 443 // we must patch the JS Object prototype with a helper method.
444 String toStringName = backend.namer.publicInstanceMethodNameByArity( 444 String toStringName = backend.namer.publicInstanceMethodNameByArity(
445 const SourceString('toString'), 0); 445 const SourceString('toString'), 0);
446 objectProperties[toStringName] = 446 objectProperties[toStringName] =
447 'function() { return $toStringHelperName(this); }'; 447 'function() { return $toStringHelperName(this); }';
448 448
449 // Same as above, but for hashCode. 449 // Same as above, but for hashCode.
450 String hashCodeName = backend.namer.publicInstanceMethodNameByArity( 450 String hashCodeName = backend.namer.publicGetterName(
451 const SourceString('hashCode'), 0); 451 const SourceString('hashCode'));
452 objectProperties[hashCodeName] = 452 objectProperties[hashCodeName] =
453 'function() { return $hashCodeHelperName(this); }'; 453 'function() { return $hashCodeHelperName(this); }';
454 454
455 // If the native emitter has been asked to take care of the 455 // If the native emitter has been asked to take care of the
456 // noSuchMethod handlers, we do that now. 456 // noSuchMethod handlers, we do that now.
457 if (handleNoSuchMethod) { 457 if (handleNoSuchMethod) {
458 emitter.emitNoSuchMethodHandlers((String name, CodeBuffer buffer) { 458 emitter.emitNoSuchMethodHandlers((String name, CodeBuffer buffer) {
459 objectProperties[name] = buffer.toString(); 459 objectProperties[name] = buffer.toString();
460 }); 460 });
461 } 461 }
(...skipping 11 matching lines...) Expand all
473 if (!first) targetBuffer.add(",\n"); 473 if (!first) targetBuffer.add(",\n");
474 targetBuffer.add(" $name: $function"); 474 targetBuffer.add(" $name: $function");
475 first = false; 475 first = false;
476 }); 476 });
477 targetBuffer.add("\n});\n\n"); 477 targetBuffer.add("\n});\n\n");
478 } 478 }
479 targetBuffer.add(nativeBuffer); 479 targetBuffer.add(nativeBuffer);
480 targetBuffer.add('\n'); 480 targetBuffer.add('\n');
481 } 481 }
482 } 482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698