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; | 5 part of dart2js; |
6 | 6 |
7 class EnqueueTask extends CompilerTask { | 7 class EnqueueTask extends CompilerTask { |
8 final ResolutionEnqueuer resolution; | 8 final ResolutionEnqueuer resolution; |
9 final CodegenEnqueuer codegen; | 9 final CodegenEnqueuer codegen; |
10 | 10 |
11 /// A reverse map from name to *all* elements with that name, not | 11 /// A reverse map from name to *all* elements with that name, not |
12 /// just instance members of instantiated classes. | 12 /// just instance members of instantiated classes. |
13 final Map<String, Link<Element>> allElementsByName | 13 final Map<String, Link<Element>> allElementsByName |
14 = new Map<String, Link<Element>>(); | 14 = new Map<String, Link<Element>>(); |
15 | 15 |
16 void ensureAllElementsByName() { | 16 void ensureAllElementsByName() { |
17 if (!allElementsByName.isEmpty) return; | 17 if (!allElementsByName.isEmpty) return; |
18 | 18 |
19 void addMemberByName(Element element) { | 19 void addMemberByName(Element element) { |
20 element = element.declaration; | 20 element = element.declaration; |
21 String name = element.name.slowToString(); | 21 String name = element.name.slowToString(); |
22 Link<Element> members = const Link<Element>(); | 22 Link<Element> members = const Link<Element>(); |
23 if (element.isLibrary()) { | 23 if (element.isLibrary()) { |
24 LibraryElementX library = element; | 24 LibraryElementX library = element; |
25 Uri uri = library.canonicalUri; | 25 Uri uri = library.canonicalUri; |
26 if (uri.scheme != 'dart' && !uri.path.startsWith('_')) { | 26 // Don't include private implementation libraries. These |
| 27 // libraries contain special classes that cause problems |
| 28 // in other parts of the resolver (in particular Null and Void). |
| 29 // TODO(ahe): Consider lifting this restriction. |
| 30 if (uri.scheme != 'dart' || !uri.path.startsWith('_')) { |
27 members = library.localMembers; | 31 members = library.localMembers; |
28 // TODO(ahe): Is this right? Is this necessary? | 32 // TODO(ahe): Is this right? Is this necessary? |
29 name = library.getLibraryOrScriptName(); | 33 name = library.getLibraryOrScriptName(); |
30 } | 34 } |
31 } else if (element.isClass() && !element.isMixinApplication) { | 35 } else if (element.isClass() && !element.isMixinApplication) { |
32 // TODO(ahe): Investigate what makes mixin applications crash | 36 // TODO(ahe): Investigate what makes mixin applications crash |
33 // this method. | 37 // this method. |
34 ClassElementX cls = element; | 38 ClassElementX cls = element; |
35 cls.ensureResolved(compiler); | 39 cls.ensureResolved(compiler); |
36 members = cls.localMembers; | 40 members = cls.localMembers; |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 while(!queue.isEmpty) { | 715 while(!queue.isEmpty) { |
712 // TODO(johnniwinther): Find an optimal process order for codegen. | 716 // TODO(johnniwinther): Find an optimal process order for codegen. |
713 f(queue.removeLast()); | 717 f(queue.removeLast()); |
714 } | 718 } |
715 } | 719 } |
716 | 720 |
717 void _logSpecificSummary(log(message)) { | 721 void _logSpecificSummary(log(message)) { |
718 log('Compiled ${generatedCode.length} methods.'); | 722 log('Compiled ${generatedCode.length} methods.'); |
719 } | 723 } |
720 } | 724 } |
OLD | NEW |