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 if (uri.scheme != 'dart' || !uri.path.startsWith('_')) { |
Johnni Winther
2013/05/27 05:38:49
Please add a comment. Something like "Don't includ
ahe
2013/05/27 06:46:04
Done.
| |
27 members = library.localMembers; | 27 members = library.localMembers; |
28 // TODO(ahe): Is this right? Is this necessary? | 28 // TODO(ahe): Is this right? Is this necessary? |
29 name = library.getLibraryOrScriptName(); | 29 name = library.getLibraryOrScriptName(); |
30 } | 30 } |
31 } else if (element.isClass() && !element.isMixinApplication) { | 31 } else if (element.isClass() && !element.isMixinApplication) { |
32 // TODO(ahe): Investigate what makes mixin applications crash | 32 // TODO(ahe): Investigate what makes mixin applications crash |
33 // this method. | 33 // this method. |
34 ClassElementX cls = element; | 34 ClassElementX cls = element; |
35 cls.ensureResolved(compiler); | 35 cls.ensureResolved(compiler); |
36 members = cls.localMembers; | 36 members = cls.localMembers; |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 while(!queue.isEmpty) { | 711 while(!queue.isEmpty) { |
712 // TODO(johnniwinther): Find an optimal process order for codegen. | 712 // TODO(johnniwinther): Find an optimal process order for codegen. |
713 f(queue.removeLast()); | 713 f(queue.removeLast()); |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 void _logSpecificSummary(log(message)) { | 717 void _logSpecificSummary(log(message)) { |
718 log('Compiled ${generatedCode.length} methods.'); | 718 log('Compiled ${generatedCode.length} methods.'); |
719 } | 719 } |
720 } | 720 } |
OLD | NEW |