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

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

Issue 10891004: [dart2dart] Optionally cut types in variable declarations: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 DartBackend extends Backend { 5 class DartBackend extends Backend {
6 final List<CompilerTask> tasks; 6 final List<CompilerTask> tasks;
7 final bool minify; 7 final bool minify;
8 8
9 Map<Element, TreeElements> get resolvedElements => 9 Map<Element, TreeElements> get resolvedElements =>
10 compiler.enqueuer.resolution.resolvedElements; 10 compiler.enqueuer.resolution.resolvedElements;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 collector.collect(element, treeElements); 95 collector.collect(element, treeElements);
96 if (element is ClassElement) { 96 if (element is ClassElement) {
97 classMembers[element].forEach(makePlaceholders); 97 classMembers[element].forEach(makePlaceholders);
98 } 98 }
99 } 99 }
100 topLevelElements.forEach(makePlaceholders); 100 topLevelElements.forEach(makePlaceholders);
101 101
102 // Create renames. 102 // Create renames.
103 Map<Node, String> renames = new Map<Node, String>(); 103 Map<Node, String> renames = new Map<Node, String>();
104 Map<LibraryElement, String> imports = new Map<LibraryElement, String>(); 104 Map<LibraryElement, String> imports = new Map<LibraryElement, String>();
105 renamePlaceholders(compiler, collector, renames, imports, minify); 105 renamePlaceholders(compiler, collector, renames, imports, minify, false);
Anton Muhin 2012/08/28 09:13:37 please, make it a field, default to false
Roman 2012/08/28 12:49:30 Done.
106 106
107 // Sort elements. 107 // Sort elements.
108 final sortedTopLevels = sortElements(topLevelElements); 108 final sortedTopLevels = sortElements(topLevelElements);
109 final sortedClassMembers = new Map<ClassElement, List<Element>>(); 109 final sortedClassMembers = new Map<ClassElement, List<Element>>();
110 classMembers.forEach((classElement, members) { 110 classMembers.forEach((classElement, members) {
111 sortedClassMembers[classElement] = sortElements(members); 111 sortedClassMembers[classElement] = sortElements(members);
112 }); 112 });
113 113
114 final unparser = new Unparser.withRenamer((Node node) => renames[node]); 114 final unparser = new Unparser.withRenamer((Node node) => renames[node]);
115 compiler.assembledCode = emitCode( 115 compiler.assembledCode = emitCode(
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 List<Element> sortElements(Collection<Element> elements) { 193 List<Element> sortElements(Collection<Element> elements) {
194 compareElements(e0, e1) { 194 compareElements(e0, e1) {
195 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); 195 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1);
196 if (result != 0) return result; 196 if (result != 0) return result;
197 return compareBy((e) => e.position().charOffset)(e0, e1); 197 return compareBy((e) => e.position().charOffset)(e0, e1);
198 } 198 }
199 199
200 return sorted(elements, compareElements); 200 return sorted(elements, compareElements);
201 } 201 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698