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

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 final bool cutDeclarationTypes;
8 9
9 Map<Element, TreeElements> get resolvedElements => 10 Map<Element, TreeElements> get resolvedElements =>
10 compiler.enqueuer.resolution.resolvedElements; 11 compiler.enqueuer.resolution.resolvedElements;
11 12
12 DartBackend(Compiler compiler, this.minify) 13 DartBackend(Compiler compiler, this.minify, this.cutDeclarationTypes)
13 : tasks = <CompilerTask>[], 14 : tasks = <CompilerTask>[],
14 super(compiler); 15 super(compiler);
15 16
16 void enqueueHelpers(Enqueuer world) { } 17 void enqueueHelpers(Enqueuer world) { }
17 void codegen(WorkItem work) { } 18 void codegen(WorkItem work) { }
18 void processNativeClasses(Enqueuer world, 19 void processNativeClasses(Enqueuer world,
19 Collection<LibraryElement> libraries) { } 20 Collection<LibraryElement> libraries) { }
20 21
21 void assembleProgram() { 22 void assembleProgram() {
22 /** 23 /**
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 collector.collect(element, treeElements); 96 collector.collect(element, treeElements);
96 if (element is ClassElement) { 97 if (element is ClassElement) {
97 classMembers[element].forEach(makePlaceholders); 98 classMembers[element].forEach(makePlaceholders);
98 } 99 }
99 } 100 }
100 topLevelElements.forEach(makePlaceholders); 101 topLevelElements.forEach(makePlaceholders);
101 102
102 // Create renames. 103 // Create renames.
103 Map<Node, String> renames = new Map<Node, String>(); 104 Map<Node, String> renames = new Map<Node, String>();
104 Map<LibraryElement, String> imports = new Map<LibraryElement, String>(); 105 Map<LibraryElement, String> imports = new Map<LibraryElement, String>();
105 renamePlaceholders(compiler, collector, renames, imports, minify); 106 renamePlaceholders(
107 compiler, collector, renames, imports, minify, cutDeclarationTypes);
106 108
107 // Sort elements. 109 // Sort elements.
108 final sortedTopLevels = sortElements(topLevelElements); 110 final sortedTopLevels = sortElements(topLevelElements);
109 final sortedClassMembers = new Map<ClassElement, List<Element>>(); 111 final sortedClassMembers = new Map<ClassElement, List<Element>>();
110 classMembers.forEach((classElement, members) { 112 classMembers.forEach((classElement, members) {
111 sortedClassMembers[classElement] = sortElements(members); 113 sortedClassMembers[classElement] = sortElements(members);
112 }); 114 });
113 115
114 final unparser = new Unparser.withRenamer((Node node) => renames[node]); 116 final unparser = new Unparser.withRenamer((Node node) => renames[node]);
115 compiler.assembledCode = emitCode( 117 compiler.assembledCode = emitCode(
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 194
193 List<Element> sortElements(Collection<Element> elements) { 195 List<Element> sortElements(Collection<Element> elements) {
194 compareElements(e0, e1) { 196 compareElements(e0, e1) {
195 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); 197 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1);
196 if (result != 0) return result; 198 if (result != 0) return result;
197 return compareBy((e) => e.position().charOffset)(e0, e1); 199 return compareBy((e) => e.position().charOffset)(e0, e1);
198 } 200 }
199 201
200 return sorted(elements, compareElements); 202 return sorted(elements, compareElements);
201 } 203 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/compiler.dart ('k') | lib/compiler/implementation/dart_backend/placeholder_collector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698