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 |
11 final CodeEmitterTask emitterTask; | 11 final CodeEmitterTask emitterTask; |
12 | 12 |
13 // Whether the application contains native classes. | 13 // Whether the application contains native classes. |
14 bool hasNativeClasses = false; | 14 bool hasNativeClasses = false; |
15 | 15 |
16 // Caches the native subtypes of a native class. | 16 // Caches the native subtypes of a native class. |
17 Map<ClassElement, List<ClassElement>> subtypes; | 17 Map<ClassElement, List<ClassElement>> subtypes; |
18 | 18 |
19 // Caches the direct native subtypes of a native class. | 19 // Caches the direct native subtypes of a native class. |
20 Map<ClassElement, List<ClassElement>> directSubtypes; | 20 Map<ClassElement, List<ClassElement>> directSubtypes; |
21 | 21 |
22 // Caches the methods that have a native body. | 22 // Caches the methods that have a native body. |
23 Set<FunctionElement> nativeMethods; | 23 Set<FunctionElement> nativeMethods; |
24 | 24 |
25 // Do we need the native emitter to take care of handling | |
26 // noSuchMethod for us? This flag is set to true in the emitter if | |
27 // it finds any native class that needs noSuchMethod handling. | |
28 bool handleNoSuchMethod = false; | |
29 | |
30 NativeEmitter(CodeEmitterTask emitterTask) | 25 NativeEmitter(CodeEmitterTask emitterTask) |
31 : this.emitterTask = emitterTask, | 26 : this.emitterTask = emitterTask, |
32 subtypes = new Map<ClassElement, List<ClassElement>>(), | 27 subtypes = new Map<ClassElement, List<ClassElement>>(), |
33 directSubtypes = new Map<ClassElement, List<ClassElement>>(), | 28 directSubtypes = new Map<ClassElement, List<ClassElement>>(), |
34 nativeMethods = new Set<FunctionElement>(), | 29 nativeMethods = new Set<FunctionElement>(), |
35 cachedBuilders = emitterTask.compiler.cacheStrategy.newMap(); | 30 cachedBuilders = emitterTask.compiler.cacheStrategy.newMap(); |
36 | 31 |
37 Compiler get compiler => emitterTask.compiler; | 32 Compiler get compiler => emitterTask.compiler; |
38 JavaScriptBackend get backend => compiler.backend; | 33 JavaScriptBackend get backend => compiler.backend; |
39 | 34 |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 } | 466 } |
472 ''', {'info': infoAccess, | 467 ''', {'info': infoAccess, |
473 'constructor': constructorAccess, | 468 'constructor': constructorAccess, |
474 'subclassRead': subclassRead, | 469 'subclassRead': subclassRead, |
475 'interceptorsByTagAccess': interceptorsByTagAccess, | 470 'interceptorsByTagAccess': interceptorsByTagAccess, |
476 'leafTagsAccess': leafTagsAccess, | 471 'leafTagsAccess': leafTagsAccess, |
477 'nativeSuperclassTagName': embeddedNames.NATIVE_SUPERCLASS_TAG_NAME, | 472 'nativeSuperclassTagName': embeddedNames.NATIVE_SUPERCLASS_TAG_NAME, |
478 'allowNativesSubclassing': true}); | 473 'allowNativesSubclassing': true}); |
479 } | 474 } |
480 } | 475 } |
OLD | NEW |