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 // TODO(floitsch): the native-emitter should not know about ClassBuilders. | 8 // TODO(floitsch): the native-emitter should not know about ClassBuilders. |
9 final Map<Element, full_js_emitter.ClassBuilder> cachedBuilders; | 9 final Map<Element, full_js_emitter.ClassBuilder> cachedBuilders; |
10 | 10 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 cls.nativeLeafTags = leafTags[cls].toList(growable: false); | 184 cls.nativeLeafTags = leafTags[cls].toList(growable: false); |
185 } | 185 } |
186 if (nonleafTags[cls] != null) { | 186 if (nonleafTags[cls] != null) { |
187 cls.nativeNonLeafTags = nonleafTags[cls].toList(growable: false); | 187 cls.nativeNonLeafTags = nonleafTags[cls].toList(growable: false); |
188 } | 188 } |
189 cls.nativeExtensions = extensionPoints[cls]; | 189 cls.nativeExtensions = extensionPoints[cls]; |
190 } | 190 } |
191 | 191 |
192 // Add properties containing the information needed to construct maps used | 192 // Add properties containing the information needed to construct maps used |
193 // by getNativeInterceptor and custom elements. | 193 // by getNativeInterceptor and custom elements. |
194 if (compiler.enqueuer.codegen.nativeEnqueuer | 194 if (compiler.enqueuer.codegen.nativeEnqueuer.hasInstantiatedNativeClasses) { |
195 .hasInstantiatedNativeClasses()) { | |
196 fillNativeInfo(jsInterceptorClass); | 195 fillNativeInfo(jsInterceptorClass); |
197 for (Class cls in classes) { | 196 for (Class cls in classes) { |
198 if (!cls.isNative || neededClasses.contains(cls)) { | 197 if (!cls.isNative || neededClasses.contains(cls)) { |
199 fillNativeInfo(cls); | 198 fillNativeInfo(cls); |
200 } | 199 } |
201 } | 200 } |
202 } | 201 } |
203 | 202 |
204 // TODO(sra): Issue #13731- this is commented out as part of custom | 203 // TODO(sra): Issue #13731- this is commented out as part of custom |
205 // element constructor work. | 204 // element constructor work. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // used. We should also use an interceptor if the check can't be satisfied | 350 // used. We should also use an interceptor if the check can't be satisfied |
352 // by a native class in case we get a native instance that tries to spoof | 351 // by a native class in case we get a native instance that tries to spoof |
353 // the type info. i.e the criteria for whether or not to use an interceptor | 352 // the type info. i.e the criteria for whether or not to use an interceptor |
354 // is whether the receiver can be native, not the type of the test. | 353 // is whether the receiver can be native, not the type of the test. |
355 if (element == null || !element.isClass) return false; | 354 if (element == null || !element.isClass) return false; |
356 ClassElement cls = element; | 355 ClassElement cls = element; |
357 if (backend.isNativeOrExtendsNative(cls)) return true; | 356 if (backend.isNativeOrExtendsNative(cls)) return true; |
358 return isSupertypeOfNativeClass(element); | 357 return isSupertypeOfNativeClass(element); |
359 } | 358 } |
360 } | 359 } |
OLD | NEW |