| OLD | NEW | 
|---|
| 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 part of js_backend; | 5 part of js_backend; | 
| 6 | 6 | 
| 7 class NativeEmitter { | 7 class NativeEmitter { | 
| 8 | 8 | 
| 9   CodeEmitterTask emitter; | 9   CodeEmitterTask emitter; | 
| 10   CodeBuffer nativeBuffer; | 10   CodeBuffer nativeBuffer; | 
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 533     emitIsChecks(objectProperties); | 533     emitIsChecks(objectProperties); | 
| 534 | 534 | 
| 535     // In order to have the toString method on every native class, | 535     // In order to have the toString method on every native class, | 
| 536     // we must patch the JS Object prototype with a helper method. | 536     // we must patch the JS Object prototype with a helper method. | 
| 537     String toStringName = backend.namer.publicInstanceMethodNameByArity( | 537     String toStringName = backend.namer.publicInstanceMethodNameByArity( | 
| 538         const SourceString('toString'), 0); | 538         const SourceString('toString'), 0); | 
| 539     objectProperties[toStringName] = | 539     objectProperties[toStringName] = | 
| 540         'function() { return $toStringHelperName(this); }'; | 540         'function() { return $toStringHelperName(this); }'; | 
| 541 | 541 | 
| 542     // Same as above, but for hashCode. | 542     // Same as above, but for hashCode. | 
| 543     String hashCodeName = backend.namer.publicGetterName( | 543     String hashCodeName = | 
| 544         const SourceString('hashCode')); | 544         backend.namer.publicGetterName(const SourceString('hashCode')); | 
| 545     objectProperties[hashCodeName] = | 545     objectProperties[hashCodeName] = | 
| 546         'function() { return $hashCodeHelperName(this); }'; | 546         'function() { return $hashCodeHelperName(this); }'; | 
| 547 | 547 | 
| 548     // If the native emitter has been asked to take care of the | 548     // If the native emitter has been asked to take care of the | 
| 549     // noSuchMethod handlers, we do that now. | 549     // noSuchMethod handlers, we do that now. | 
| 550     if (handleNoSuchMethod) { | 550     if (handleNoSuchMethod) { | 
| 551       emitter.emitNoSuchMethodHandlers((String name, CodeBuffer buffer) { | 551       emitter.emitNoSuchMethodHandlers((String name, CodeBuffer buffer) { | 
| 552         objectProperties[name] = buffer.toString(); | 552         objectProperties[name] = buffer.toString(); | 
| 553       }); | 553       }); | 
| 554     } | 554     } | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 566         if (!first) targetBuffer.add(",\n"); | 566         if (!first) targetBuffer.add(",\n"); | 
| 567         targetBuffer.add(" $name: $function"); | 567         targetBuffer.add(" $name: $function"); | 
| 568         first = false; | 568         first = false; | 
| 569       }); | 569       }); | 
| 570       targetBuffer.add("\n});\n\n"); | 570       targetBuffer.add("\n});\n\n"); | 
| 571     } | 571     } | 
| 572     targetBuffer.add(nativeBuffer); | 572     targetBuffer.add(nativeBuffer); | 
| 573     targetBuffer.add('\n'); | 573     targetBuffer.add('\n'); | 
| 574   } | 574   } | 
| 575 } | 575 } | 
| OLD | NEW | 
|---|