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 17 matching lines...) Expand all Loading... | |
28 directSubtypes = new Map<ClassElement, List<ClassElement>>(), | 28 directSubtypes = new Map<ClassElement, List<ClassElement>>(), |
29 nativeMethods = new Set<FunctionElement>(), | 29 nativeMethods = new Set<FunctionElement>(), |
30 cachedBuilders = emitterTask.compiler.cacheStrategy.newMap(); | 30 cachedBuilders = emitterTask.compiler.cacheStrategy.newMap(); |
31 | 31 |
32 Compiler get compiler => emitterTask.compiler; | 32 Compiler get compiler => emitterTask.compiler; |
33 | 33 |
34 JavaScriptBackend get backend => compiler.backend; | 34 JavaScriptBackend get backend => compiler.backend; |
35 | 35 |
36 BackendHelpers get helpers => backend.helpers; | 36 BackendHelpers get helpers => backend.helpers; |
37 | 37 |
38 jsAst.Expression get defPropFunction { | |
Johnni Winther
2016/04/19 11:04:59
Unused (found while investigating why 'definePrope
| |
39 Element element = helpers.defineProperty; | |
40 return emitterTask.staticFunctionAccess(element); | |
41 } | |
42 | |
43 /** | 38 /** |
44 * Prepares native classes for emission. Returns the unneeded classes. | 39 * Prepares native classes for emission. Returns the unneeded classes. |
45 * | 40 * |
46 * Removes trivial classes (that can be represented by a super type) and | 41 * Removes trivial classes (that can be represented by a super type) and |
47 * generates properties that have to be added to classes (native or not). | 42 * generates properties that have to be added to classes (native or not). |
48 * | 43 * |
49 * Updates the `nativeLeafTags`, `nativeNonLeafTags` and `nativeExtensions` | 44 * Updates the `nativeLeafTags`, `nativeNonLeafTags` and `nativeExtensions` |
50 * fields of the given classes. This data must be emitted with the | 45 * fields of the given classes. This data must be emitted with the |
51 * corresponding classes. | 46 * corresponding classes. |
52 * | 47 * |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 // used. We should also use an interceptor if the check can't be satisfied | 349 // used. We should also use an interceptor if the check can't be satisfied |
355 // by a native class in case we get a native instance that tries to spoof | 350 // by a native class in case we get a native instance that tries to spoof |
356 // the type info. i.e the criteria for whether or not to use an interceptor | 351 // the type info. i.e the criteria for whether or not to use an interceptor |
357 // is whether the receiver can be native, not the type of the test. | 352 // is whether the receiver can be native, not the type of the test. |
358 if (element == null || !element.isClass) return false; | 353 if (element == null || !element.isClass) return false; |
359 ClassElement cls = element; | 354 ClassElement cls = element; |
360 if (backend.isNativeOrExtendsNative(cls)) return true; | 355 if (backend.isNativeOrExtendsNative(cls)) return true; |
361 return isSupertypeOfNativeClass(element); | 356 return isSupertypeOfNativeClass(element); |
362 } | 357 } |
363 } | 358 } |
OLD | NEW |