| 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class NativeEmitter { | 7 class NativeEmitter { |
| 8 | 8 |
| 9 final Map<Element, ClassBuilder> cachedBuilders; | 9 final Map<Element, ClassBuilder> cachedBuilders; |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // needed class. | 98 // needed class. |
| 99 | 99 |
| 100 Set<ClassElement> neededClasses = new Set<ClassElement>(); | 100 Set<ClassElement> neededClasses = new Set<ClassElement>(); |
| 101 Set<ClassElement> nonleafClasses = new Set<ClassElement>(); | 101 Set<ClassElement> nonleafClasses = new Set<ClassElement>(); |
| 102 | 102 |
| 103 Map<ClassElement, List<ClassElement>> extensionPoints = | 103 Map<ClassElement, List<ClassElement>> extensionPoints = |
| 104 computeExtensionPoints(preOrder); | 104 computeExtensionPoints(preOrder); |
| 105 | 105 |
| 106 neededClasses.add(compiler.objectClass); | 106 neededClasses.add(compiler.objectClass); |
| 107 | 107 |
| 108 Set<ClassElement> neededByConstant = | 108 Set<ClassElement> neededByConstant = emitterTask |
| 109 emitterTask.interceptorsReferencedFromConstants(); | 109 .computeInterceptorsReferencedFromConstants(); |
| 110 Set<ClassElement> modifiedClasses = | 110 Set<ClassElement> modifiedClasses = emitterTask.typeTestRegistry |
| 111 emitterTask.typeTestRegistry.classesModifiedByEmitRuntimeTypeSupport(); | 111 .computeClassesModifiedByEmitRuntimeTypeSupport(); |
| 112 | 112 |
| 113 for (ClassElement classElement in preOrder.reversed) { | 113 for (ClassElement classElement in preOrder.reversed) { |
| 114 // Post-order traversal ensures we visit the subclasses before their | 114 // Post-order traversal ensures we visit the subclasses before their |
| 115 // superclass. This makes it easy to tell if a class is needed because a | 115 // superclass. This makes it easy to tell if a class is needed because a |
| 116 // subclass is needed. | 116 // subclass is needed. |
| 117 ClassBuilder builder = builders[classElement]; | 117 ClassBuilder builder = builders[classElement]; |
| 118 bool needed = false; | 118 bool needed = false; |
| 119 if (builder == null) { | 119 if (builder == null) { |
| 120 // Mixin applications (native+mixin) are non-native, so [classElement] | 120 // Mixin applications (native+mixin) are non-native, so [classElement] |
| 121 // has already been emitted as a regular class. Mark [classElement] as | 121 // has already been emitted as a regular class. Mark [classElement] as |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 targetOutput.add(';'); | 470 targetOutput.add(';'); |
| 471 } | 471 } |
| 472 targetOutput.addBuffer(jsAst.prettyPrint( | 472 targetOutput.addBuffer(jsAst.prettyPrint( |
| 473 new jsAst.ExpressionStatement(init), compiler)); | 473 new jsAst.ExpressionStatement(init), compiler)); |
| 474 targetOutput.add('\n'); | 474 targetOutput.add('\n'); |
| 475 } | 475 } |
| 476 | 476 |
| 477 targetOutput.add('\n'); | 477 targetOutput.add('\n'); |
| 478 } | 478 } |
| 479 } | 479 } |
| OLD | NEW |