Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: lib/compiler/implementation/dart_backend/backend.dart

Issue 10836128: A visitor that builds a map from node to "Usage". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/compiler/implementation/dart_backend/dart_backend.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/dart_backend/dart_backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698