| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.js_emitter.runtime_type_generator; | 5 library dart2js.js_emitter.runtime_type_generator; |
| 6 | 6 |
| 7 import '../closure.dart' | 7 import '../closure.dart' |
| 8 show ClosureRepresentationInfo, ClosureFieldElement, ClosureConversionTask; | 8 show ClosureRepresentationInfo, ClosureFieldElement, ClosureConversionTask; |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 /// | 98 /// |
| 99 /// If [storeFunctionTypeInMetadata] is `true`, stores the reified function | 99 /// If [storeFunctionTypeInMetadata] is `true`, stores the reified function |
| 100 /// type (if class has one) in the metadata object and stores its index in | 100 /// type (if class has one) in the metadata object and stores its index in |
| 101 /// the result. This is only possible for function types that do not contain | 101 /// the result. This is only possible for function types that do not contain |
| 102 /// type variables. | 102 /// type variables. |
| 103 TypeTestProperties generateIsTests(ClassEntity cls, | 103 TypeTestProperties generateIsTests(ClassEntity cls, |
| 104 {bool storeFunctionTypeInMetadata: true}) { | 104 {bool storeFunctionTypeInMetadata: true}) { |
| 105 TypeTestProperties result = new TypeTestProperties(); | 105 TypeTestProperties result = new TypeTestProperties(); |
| 106 if (cls is! ClassElement) return result; | 106 if (cls is! ClassElement) return result; |
| 107 | 107 |
| 108 // TODO(johnniwinther): Handle class entities. | 108 // TODO(redemption): Handle class entities. |
| 109 ClassElement classElement = cls; | 109 ClassElement classElement = cls; |
| 110 assert(classElement.isDeclaration, failedAt(classElement)); | 110 assert(classElement.isDeclaration, failedAt(classElement)); |
| 111 | 111 |
| 112 /// Generates an is-test if the test is not inherited from a superclass | 112 /// Generates an is-test if the test is not inherited from a superclass |
| 113 /// This assumes that for every class an is-tests is generated | 113 /// This assumes that for every class an is-tests is generated |
| 114 /// dynamically at runtime. We also always generate tests against | 114 /// dynamically at runtime. We also always generate tests against |
| 115 /// native classes. | 115 /// native classes. |
| 116 /// TODO(herhut): Generate tests for native classes dynamically, as well. | 116 /// TODO(herhut): Generate tests for native classes dynamically, as well. |
| 117 void generateIsTest(ClassElement other) { | 117 void generateIsTest(ClassElement other) { |
| 118 if (_nativeData.isNativeClass(classElement) || | 118 if (_nativeData.isNativeClass(classElement) || |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 341 |
| 342 // We need to also emit "is checks" for the superclass and its supertypes. | 342 // We need to also emit "is checks" for the superclass and its supertypes. |
| 343 ClassElement superclass = cls.superclass; | 343 ClassElement superclass = cls.superclass; |
| 344 if (superclass != null) { | 344 if (superclass != null) { |
| 345 tryEmitTest(superclass); | 345 tryEmitTest(superclass); |
| 346 _generateInterfacesIsTests( | 346 _generateInterfacesIsTests( |
| 347 superclass, generateIsTest, generateSubstitution, alreadyGenerated); | 347 superclass, generateIsTest, generateSubstitution, alreadyGenerated); |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 } | 350 } |
| OLD | NEW |