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

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
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 Usager usager = new Usager(compiler);
74 resolvedElements.forEach((element, treeElements) {
75 if (!shouldOutput(element)
76 || element is SynthesizedConstructorElement
Anton Muhin 2012/08/07 12:32:11 why this is not a part of shouldOutput? and we ha
Roman 2012/08/07 15:44:03 We should, but I'm not sure what would be the nice
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698