| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.startup_emitter.model_emitter; | 5 part of dart2js.js_emitter.startup_emitter.model_emitter; |
| 6 | 6 |
| 7 /// The name of the property that stores the tear-off getter on a static | 7 /// The name of the property that stores the tear-off getter on a static |
| 8 /// function. | 8 /// function. |
| 9 /// | 9 /// |
| 10 /// This property is only used when isolates are used. | 10 /// This property is only used when isolates are used. |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 } | 787 } |
| 788 | 788 |
| 789 /// Emits the inheritance block of the fragment. | 789 /// Emits the inheritance block of the fragment. |
| 790 /// | 790 /// |
| 791 /// In this section prototype chains are updated and mixin functions are | 791 /// In this section prototype chains are updated and mixin functions are |
| 792 /// copied. | 792 /// copied. |
| 793 js.Statement emitInheritance(Fragment fragment) { | 793 js.Statement emitInheritance(Fragment fragment) { |
| 794 List<js.Expression> inheritCalls = <js.Expression>[]; | 794 List<js.Expression> inheritCalls = <js.Expression>[]; |
| 795 List<js.Expression> mixinCalls = <js.Expression>[]; | 795 List<js.Expression> mixinCalls = <js.Expression>[]; |
| 796 | 796 |
| 797 Set<Class> classesInFragment = new Set<Class>(); |
| 798 for (Library library in fragment.libraries) { |
| 799 classesInFragment.addAll(library.classes); |
| 800 } |
| 801 |
| 797 Set<Class> emittedClasses = new Set<Class>(); | 802 Set<Class> emittedClasses = new Set<Class>(); |
| 798 | 803 |
| 799 void emitInheritanceForClass(cls) { | 804 void emitInheritanceForClass(cls) { |
| 800 if (cls == null || emittedClasses.contains(cls)) return; | 805 if (cls == null || emittedClasses.contains(cls)) return; |
| 801 | 806 |
| 802 Class superclass = cls.superclass; | 807 Class superclass = cls.superclass; |
| 803 emitInheritanceForClass(superclass); | 808 if (classesInFragment.contains(superclass)) { |
| 809 emitInheritanceForClass(superclass); |
| 810 } |
| 804 | 811 |
| 805 js.Expression superclassReference = (superclass == null) | 812 js.Expression superclassReference = (superclass == null) |
| 806 ? new js.LiteralNull() | 813 ? new js.LiteralNull() |
| 807 : classReference(superclass); | 814 : classReference(superclass); |
| 808 | 815 |
| 809 inheritCalls.add( | 816 inheritCalls.add( |
| 810 js.js('inherit(#, #)', [classReference(cls), superclassReference])); | 817 js.js('inherit(#, #)', [classReference(cls), superclassReference])); |
| 811 | 818 |
| 812 emittedClasses.add(cls); | 819 emittedClasses.add(cls); |
| 813 } | 820 } |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 } | 1348 } |
| 1342 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", | 1349 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", |
| 1343 js.objectLiteral(interceptorsByTag))); | 1350 js.objectLiteral(interceptorsByTag))); |
| 1344 statements.add( | 1351 statements.add( |
| 1345 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags))); | 1352 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags))); |
| 1346 statements.add(subclassAssignment); | 1353 statements.add(subclassAssignment); |
| 1347 | 1354 |
| 1348 return new js.Block(statements); | 1355 return new js.Block(statements); |
| 1349 } | 1356 } |
| 1350 } | 1357 } |
| OLD | NEW |