| 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 typedef ItemCompilationContext ItemCompilationContextCreator(); | 7 typedef ItemCompilationContext ItemCompilationContextCreator(); |
| 8 | 8 |
| 9 class EnqueueTask extends CompilerTask { | 9 class EnqueueTask extends CompilerTask { |
| 10 final ResolutionEnqueuer resolution; | 10 final ResolutionEnqueuer resolution; |
| 11 final CodegenEnqueuer codegen; | 11 final CodegenEnqueuer codegen; |
| 12 | 12 |
| 13 /// A reverse map from name to *all* elements with that name, not | 13 /// A reverse map from name to *all* elements with that name, not |
| 14 /// just instance members of instantiated classes. | 14 /// just instance members of instantiated classes. |
| 15 final Map<String, Link<Element>> allElementsByName | 15 final Map<String, Link<Element>> allElementsByName |
| 16 = new Map<String, Link<Element>>(); | 16 = new Map<String, Link<Element>>(); |
| 17 | 17 |
| 18 void ensureAllElementsByName() { | 18 void ensureAllElementsByName() { |
| 19 if (!allElementsByName.isEmpty) return; | 19 if (!allElementsByName.isEmpty) return; |
| 20 | 20 |
| 21 void addMemberByName(Element element) { | 21 void addMemberByName(Element element) { |
| 22 element = element.declaration; | 22 element = element.declaration; |
| 23 String name = element.name; | 23 String name = element.name; |
| 24 ScopeContainerElement container = null; | 24 ScopeContainerElement container = null; |
| 25 if (element.isLibrary) { | 25 if (element.isLibrary) { |
| 26 LibraryElement library = element; | 26 LibraryElement library = element; |
| 27 // Don't include private implementation libraries. These | 27 container = library; |
| 28 // libraries contain special classes that cause problems | 28 // TODO(ahe): Is this right? Is this necessary? |
| 29 // in other parts of the resolver (in particular Null and Void). | 29 name = library.getLibraryOrScriptName(); |
| 30 // TODO(ahe): Consider lifting this restriction. | |
| 31 if (!library.isInternalLibrary) { | |
| 32 container = library; | |
| 33 // TODO(ahe): Is this right? Is this necessary? | |
| 34 name = library.getLibraryOrScriptName(); | |
| 35 } | |
| 36 } else if (element.isClass) { | 30 } else if (element.isClass) { |
| 37 ClassElement cls = element; | 31 ClassElement cls = element; |
| 38 cls.ensureResolved(compiler); | 32 cls.ensureResolved(compiler); |
| 39 container = cls; | 33 container = cls; |
| 40 for (var link = cls.computeTypeParameters(compiler); | 34 for (var link = cls.computeTypeParameters(compiler); |
| 41 !link.isEmpty; | 35 !link.isEmpty; |
| 42 link = link.tail) { | 36 link = link.tail) { |
| 43 addMemberByName(link.head.element); | 37 addMemberByName(link.head.element); |
| 44 } | 38 } |
| 45 } | 39 } |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 } | 766 } |
| 773 CodegenWorkItem workItem = new CodegenWorkItem( | 767 CodegenWorkItem workItem = new CodegenWorkItem( |
| 774 element, itemCompilationContextCreator()); | 768 element, itemCompilationContextCreator()); |
| 775 queue.add(workItem); | 769 queue.add(workItem); |
| 776 } | 770 } |
| 777 | 771 |
| 778 void _logSpecificSummary(log(message)) { | 772 void _logSpecificSummary(log(message)) { |
| 779 log('Compiled ${generatedCode.length} methods.'); | 773 log('Compiled ${generatedCode.length} methods.'); |
| 780 } | 774 } |
| 781 } | 775 } |
| OLD | NEW |