| 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 /** | 5 /** |
| 6 * A function element that represents a closure call. The signature is copied | 6 * A function element that represents a closure call. The signature is copied |
| 7 * from the given element. | 7 * from the given element. |
| 8 */ | 8 */ |
| 9 class ClosureInvocationElement extends FunctionElement { | 9 class ClosureInvocationElement extends FunctionElement { |
| 10 ClosureInvocationElement(SourceString name, | 10 ClosureInvocationElement(SourceString name, |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 compiler.emitter.emitDynamicFunctionGetter( | 538 compiler.emitter.emitDynamicFunctionGetter( |
| 539 buffer, attachTo, member); | 539 buffer, attachTo, member); |
| 540 } | 540 } |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 | 543 |
| 544 void emitNoSuchMethodCalls(StringBuffer buffer) { | 544 void emitNoSuchMethodCalls(StringBuffer buffer) { |
| 545 // Do not generate no such method calls if there is no class. | 545 // Do not generate no such method calls if there is no class. |
| 546 if (compiler.universe.instantiatedClasses.isEmpty()) return; | 546 if (compiler.universe.instantiatedClasses.isEmpty()) return; |
| 547 | 547 |
| 548 // TODO(ngeoffray): We don't need to generate these methods if | |
| 549 // nobody overwrites noSuchMethod. | |
| 550 | |
| 551 ClassElement objectClass = | 548 ClassElement objectClass = |
| 552 compiler.coreLibrary.find(const SourceString('Object')); | 549 compiler.coreLibrary.find(const SourceString('Object')); |
| 553 String className = namer.isolatePropertyAccess(objectClass); | 550 String className = namer.isolatePropertyAccess(objectClass); |
| 554 String prototype = '$className.prototype'; | 551 String prototype = '$className.prototype'; |
| 555 String noSuchMethodName = | 552 String noSuchMethodName = |
| 556 namer.instanceMethodName(Compiler.NO_SUCH_METHOD, 2); | 553 namer.instanceMethodName(Compiler.NO_SUCH_METHOD, 2); |
| 557 | 554 |
| 558 void generateMethod(String methodName, String jsName, Selector selector) { | 555 void generateMethod(String methodName, String jsName, Selector selector) { |
| 559 buffer.add('$prototype.$jsName = function'); | 556 buffer.add('$prototype.$jsName = function'); |
| 560 StringBuffer args = new StringBuffer(); | 557 StringBuffer args = new StringBuffer(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 emitStaticFinalFieldInitializations(buffer); | 609 emitStaticFinalFieldInitializations(buffer); |
| 613 nativeEmitter.emitDynamicDispatchMetadata(buffer); | 610 nativeEmitter.emitDynamicDispatchMetadata(buffer); |
| 614 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); | 611 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); |
| 615 Element main = compiler.mainApp.find(Compiler.MAIN); | 612 Element main = compiler.mainApp.find(Compiler.MAIN); |
| 616 buffer.add('${namer.isolateAccess(main)}();\n'); | 613 buffer.add('${namer.isolateAccess(main)}();\n'); |
| 617 compiler.assembledCode = buffer.toString(); | 614 compiler.assembledCode = buffer.toString(); |
| 618 }); | 615 }); |
| 619 return compiler.assembledCode; | 616 return compiler.assembledCode; |
| 620 } | 617 } |
| 621 } | 618 } |
| OLD | NEW |