| 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 class BailoutException { | 5 class BailoutException { |
| 6 final String reason; | 6 final String reason; |
| 7 | 7 |
| 8 const BailoutException(this.reason); | 8 const BailoutException(this.reason); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 final LIBS_TO_IGNORE = [ | 63 final LIBS_TO_IGNORE = [ |
| 64 compiler.jsHelperLibrary, | 64 compiler.jsHelperLibrary, |
| 65 compiler.interceptorsLibrary, | 65 compiler.interceptorsLibrary, |
| 66 ]; | 66 ]; |
| 67 bool shouldOutput(Element element) => | 67 bool shouldOutput(Element element) => |
| 68 element.kind !== ElementKind.VOID && | 68 element.kind !== ElementKind.VOID && |
| 69 LIBS_TO_IGNORE.indexOf(element.getLibrary()) == -1 && | 69 LIBS_TO_IGNORE.indexOf(element.getLibrary()) == -1 && |
| 70 !isDartCoreLib(compiler, element.getLibrary()); | 70 !isDartCoreLib(compiler, element.getLibrary()); |
| 71 | 71 |
| 72 try { | 72 try { |
| 73 Emitter emitter = new Emitter(compiler); | 73 PlaceholderCollector collector = new PlaceholderCollector(compiler); |
| 74 resolvedElements.forEach((element, treeElements) { |
| 75 if (!shouldOutput(element)) return; |
| 76 collector.collect(element, treeElements); |
| 77 }); |
| 78 |
| 79 ConflictingRenamer renamer = |
| 80 new ConflictingRenamer(compiler, collector.placeholders); |
| 81 Emitter emitter = new Emitter(compiler, renamer); |
| 74 resolvedElements.forEach((element, treeElements) { | 82 resolvedElements.forEach((element, treeElements) { |
| 75 if (!shouldOutput(element)) return; | 83 if (!shouldOutput(element)) return; |
| 76 if (element.isMember()) { | 84 if (element.isMember()) { |
| 77 var enclosingClass = element.enclosingElement; | 85 var enclosingClass = element.enclosingElement; |
| 78 assert(enclosingClass.isClass()); | 86 assert(enclosingClass.isClass()); |
| 79 assert(enclosingClass.isTopLevel()); | 87 assert(enclosingClass.isTopLevel()); |
| 80 addMemberToClass(element, enclosingClass); | 88 addMemberToClass(element, enclosingClass); |
| 81 return; | 89 return; |
| 82 } | 90 } |
| 83 if (!element.isTopLevel()) { | 91 if (!element.isTopLevel()) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 108 */ | 116 */ |
| 109 bool isDartCoreLib(Compiler compiler, LibraryElement libraryElement) { | 117 bool isDartCoreLib(Compiler compiler, LibraryElement libraryElement) { |
| 110 final libraries = compiler.libraries; | 118 final libraries = compiler.libraries; |
| 111 for (final uri in libraries.getKeys()) { | 119 for (final uri in libraries.getKeys()) { |
| 112 if (libraryElement === libraries[uri]) { | 120 if (libraryElement === libraries[uri]) { |
| 113 if (uri.startsWith('dart:')) return true; | 121 if (uri.startsWith('dart:')) return true; |
| 114 } | 122 } |
| 115 } | 123 } |
| 116 return false; | 124 return false; |
| 117 } | 125 } |
| OLD | NEW |