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 import 'dart:collection' show Queue; | 5 import 'dart:collection' show Queue; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/backend_api.dart' show ForeignResolver; | 8 import '../common/backend_api.dart' show ForeignResolver; |
9 import '../common/registry.dart' show Registry; | 9 import '../common/registry.dart' show Registry; |
10 import '../common/resolution.dart' show Resolution; | 10 import '../common/resolution.dart' show Resolution; |
(...skipping 29 matching lines...) Expand all Loading... |
40 // something like `computeNativeField`. | 40 // something like `computeNativeField`. |
41 /// Process the potentially native [field]. Adds information from metadata | 41 /// Process the potentially native [field]. Adds information from metadata |
42 /// attributes. | 42 /// attributes. |
43 void handleFieldAnnotations(Element field) {} | 43 void handleFieldAnnotations(Element field) {} |
44 | 44 |
45 /// Process the potentially native [method]. Adds information from metadata | 45 /// Process the potentially native [method]. Adds information from metadata |
46 /// attributes. | 46 /// attributes. |
47 void handleMethodAnnotations(Element method) {} | 47 void handleMethodAnnotations(Element method) {} |
48 | 48 |
49 /// Returns whether native classes are being used. | 49 /// Returns whether native classes are being used. |
50 bool get hasInstantiatedNativeClasses => false; | 50 bool hasInstantiatedNativeClasses() => false; |
51 | 51 |
52 /// Emits a summary information using the [log] function. | 52 /// Emits a summary information using the [log] function. |
53 void logSummary(log(message)) {} | 53 void logSummary(log(message)) {} |
54 | 54 |
55 // Do not use annotations in dart2dart. | 55 // Do not use annotations in dart2dart. |
56 ClassElement get annotationCreatesClass => null; | 56 ClassElement get annotationCreatesClass => null; |
57 ClassElement get annotationReturnsClass => null; | 57 ClassElement get annotationReturnsClass => null; |
58 ClassElement get annotationJsNameClass => null; | 58 ClassElement get annotationJsNameClass => null; |
59 } | 59 } |
60 | 60 |
61 abstract class NativeEnqueuerBase implements NativeEnqueuer { | 61 abstract class NativeEnqueuerBase implements NativeEnqueuer { |
62 static final RegExp _identifier = new RegExp(r'^[a-zA-Z_$][a-zA-Z0-9_$]*$'); | 62 static final RegExp _identifier = new RegExp(r'^[a-zA-Z_$][a-zA-Z0-9_$]*$'); |
63 | 63 |
64 /** | 64 /** |
65 * The set of all native classes. Each native class is in [nativeClasses] and | 65 * The set of all native classes. Each native class is in [nativeClasses] and |
66 * exactly one of [unusedClasses], [pendingClasses] and [registeredClasses]. | 66 * exactly one of [unusedClasses], [pendingClasses] and [registeredClasses]. |
67 */ | 67 */ |
68 final Set<ClassElement> nativeClasses = new Set<ClassElement>(); | 68 final Set<ClassElement> nativeClasses = new Set<ClassElement>(); |
69 | 69 |
70 final Set<ClassElement> registeredClasses = new Set<ClassElement>(); | 70 final Set<ClassElement> registeredClasses = new Set<ClassElement>(); |
71 final Set<ClassElement> pendingClasses = new Set<ClassElement>(); | 71 final Set<ClassElement> pendingClasses = new Set<ClassElement>(); |
72 final Set<ClassElement> unusedClasses = new Set<ClassElement>(); | 72 final Set<ClassElement> unusedClasses = new Set<ClassElement>(); |
73 | 73 |
74 final Set<LibraryElement> processedLibraries; | 74 final Set<LibraryElement> processedLibraries; |
75 | 75 |
76 bool get hasInstantiatedNativeClasses => !registeredClasses.isEmpty; | 76 bool hasInstantiatedNativeClasses() => !registeredClasses.isEmpty; |
77 | 77 |
78 final Set<ClassElement> nativeClassesAndSubclasses = new Set<ClassElement>(); | 78 final Set<ClassElement> nativeClassesAndSubclasses = new Set<ClassElement>(); |
79 | 79 |
80 final Map<ClassElement, Set<ClassElement>> nonNativeSubclasses = | 80 final Map<ClassElement, Set<ClassElement>> nonNativeSubclasses = |
81 new Map<ClassElement, Set<ClassElement>>(); | 81 new Map<ClassElement, Set<ClassElement>>(); |
82 | 82 |
83 /** | 83 /** |
84 * Records matched constraints ([SpecialType] or [DartType]). Once a type | 84 * Records matched constraints ([SpecialType] or [DartType]). Once a type |
85 * constraint has been matched, there is no need to match it again. | 85 * constraint has been matched, there is no need to match it again. |
86 */ | 86 */ |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 List<Element> directSubtypes = | 673 List<Element> directSubtypes = |
674 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]); | 674 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]); |
675 directSubtypes.add(cls); | 675 directSubtypes.add(cls); |
676 } | 676 } |
677 | 677 |
678 void logSummary(log(message)) { | 678 void logSummary(log(message)) { |
679 log('Compiled ${registeredClasses.length} native classes, ' | 679 log('Compiled ${registeredClasses.length} native classes, ' |
680 '${unusedClasses.length} native classes omitted.'); | 680 '${unusedClasses.length} native classes omitted.'); |
681 } | 681 } |
682 } | 682 } |
OLD | NEW |