Chromium Code Reviews| 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 /** | 7 /** |
| 8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
| 9 * from the given element. | 9 * from the given element. |
| 10 */ | 10 */ |
| (...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1705 buffer.add("if (typeof receiver == 'function')"); | 1705 buffer.add("if (typeof receiver == 'function')"); |
| 1706 } | 1706 } |
| 1707 buffer.add(' return ${namer.isolateAccess(cls)}.prototype;'); | 1707 buffer.add(' return ${namer.isolateAccess(cls)}.prototype;'); |
| 1708 } | 1708 } |
| 1709 | 1709 |
| 1710 /** | 1710 /** |
| 1711 * Emit all versions of the [:getInterceptor:] method. | 1711 * Emit all versions of the [:getInterceptor:] method. |
| 1712 */ | 1712 */ |
| 1713 void emitGetInterceptorMethods(CodeBuffer buffer) { | 1713 void emitGetInterceptorMethods(CodeBuffer buffer) { |
| 1714 JavaScriptBackend backend = compiler.backend; | 1714 JavaScriptBackend backend = compiler.backend; |
| 1715 // If no class needs to be intercepted, just return. | |
| 1716 if (backend.objectInterceptorClass == null) return; | |
|
ahe
2012/11/28 11:17:36
I would think it was an internal error if backend.
ngeoffray
2012/11/28 11:42:03
Not in case there is no class being instantiated.
| |
| 1715 String objectName = namer.isolateAccess(backend.objectInterceptorClass); | 1717 String objectName = namer.isolateAccess(backend.objectInterceptorClass); |
| 1716 backend.specializedGetInterceptors.forEach( | 1718 backend.specializedGetInterceptors.forEach( |
| 1717 (String key, Collection<ClassElement> classes) { | 1719 (String key, Collection<ClassElement> classes) { |
| 1718 buffer.add('$isolateProperties.$key = function(receiver) {'); | 1720 buffer.add('$isolateProperties.$key = function(receiver) {'); |
| 1719 for (ClassElement cls in classes) { | 1721 for (ClassElement cls in classes) { |
| 1720 if (compiler.codegenWorld.instantiatedClasses.contains(cls)) { | 1722 if (compiler.codegenWorld.instantiatedClasses.contains(cls)) { |
| 1721 buffer.add('\n '); | 1723 buffer.add('\n '); |
| 1722 emitInterceptorCheck(cls, buffer); | 1724 emitInterceptorCheck(cls, buffer); |
| 1723 } | 1725 } |
| 1724 } | 1726 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1802 const String HOOKS_API_USAGE = """ | 1804 const String HOOKS_API_USAGE = """ |
| 1803 // Generated by dart2js, the Dart to JavaScript compiler. | 1805 // Generated by dart2js, the Dart to JavaScript compiler. |
| 1804 // The code supports the following hooks: | 1806 // The code supports the following hooks: |
| 1805 // dartPrint(message) - if this function is defined it is called | 1807 // dartPrint(message) - if this function is defined it is called |
| 1806 // instead of the Dart [print] method. | 1808 // instead of the Dart [print] method. |
| 1807 // dartMainRunner(main) - if this function is defined, the Dart [main] | 1809 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 1808 // method will not be invoked directly. | 1810 // method will not be invoked directly. |
| 1809 // Instead, a closure that will invoke [main] is | 1811 // Instead, a closure that will invoke [main] is |
| 1810 // passed to [dartMainRunner]. | 1812 // passed to [dartMainRunner]. |
| 1811 """; | 1813 """; |
| OLD | NEW |