| 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 Usager usager = new Usager(compiler); |
| 74 resolvedElements.forEach((element, treeElements) { |
| 75 if (!shouldOutput(element) |
| 76 || element is SynthesizedConstructorElement |
| 77 || element is AbstractFieldElement) return; |
| 78 usager.process(element, treeElements); |
| 79 }); |
| 80 ConflictingRenamer renamer = |
| 81 new ConflictingRenamer(compiler, usager.usages); |
| 82 Emitter emitter = new Emitter(compiler, renamer); |
| 74 resolvedElements.forEach((element, treeElements) { | 83 resolvedElements.forEach((element, treeElements) { |
| 75 if (!shouldOutput(element)) return; | 84 if (!shouldOutput(element)) return; |
| 76 if (element.isMember()) { | 85 if (element.isMember()) { |
| 77 var enclosingClass = element.enclosingElement; | 86 var enclosingClass = element.enclosingElement; |
| 78 assert(enclosingClass.isClass()); | 87 assert(enclosingClass.isClass()); |
| 79 assert(enclosingClass.isTopLevel()); | 88 assert(enclosingClass.isTopLevel()); |
| 80 addMemberToClass(element, enclosingClass); | 89 addMemberToClass(element, enclosingClass); |
| 81 return; | 90 return; |
| 82 } | 91 } |
| 83 if (!element.isTopLevel()) { | 92 if (!element.isTopLevel()) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 108 */ | 117 */ |
| 109 bool isDartCoreLib(Compiler compiler, LibraryElement libraryElement) { | 118 bool isDartCoreLib(Compiler compiler, LibraryElement libraryElement) { |
| 110 final libraries = compiler.libraries; | 119 final libraries = compiler.libraries; |
| 111 for (final uri in libraries.getKeys()) { | 120 for (final uri in libraries.getKeys()) { |
| 112 if (libraryElement === libraries[uri]) { | 121 if (libraryElement === libraries[uri]) { |
| 113 if (uri.startsWith('dart:')) return true; | 122 if (uri.startsWith('dart:')) return true; |
| 114 } | 123 } |
| 115 } | 124 } |
| 116 return false; | 125 return false; |
| 117 } | 126 } |
| OLD | NEW |