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

Unified Diff: pkg/compiler/lib/src/dart_backend/outputter.dart

Issue 832363002: Remove Compiler.assembledCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix unittest Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/backend.dart ('k') | pkg/compiler/lib/src/dump_info.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/dart_backend/outputter.dart
diff --git a/pkg/compiler/lib/src/dart_backend/outputter.dart b/pkg/compiler/lib/src/dart_backend/outputter.dart
index 4b8f22d9735c504f8449d01a6a82563fb1bd7975..d41d604bb1e88cfb0a96a00de47f2ec54bf97e03 100644
--- a/pkg/compiler/lib/src/dart_backend/outputter.dart
+++ b/pkg/compiler/lib/src/dart_backend/outputter.dart
@@ -55,7 +55,9 @@ class DartOutputter {
///
/// The [sortElements] function is used to sort [instantiatedClasses] and
/// [resolvedElements] in the generated output.
- String assembleProgram({
+ ///
+ /// Returns the total size of the generated code.
+ int assembleProgram({
MirrorRenamer mirrorRenamer: const MirrorRenamer(),
Iterable<LibraryElement> libraries,
Iterable<Element> instantiatedClasses,
@@ -120,12 +122,15 @@ class DartOutputter {
forceStripTypes: forceStripTypes,
isSafeToRemoveTypeDeclarations: isSafeToRemoveTypeDeclarations);
- String assembledCode;
if (outputAst) {
- assembledCode = astOutput(listener, elementInfo);
+ String code = astOutput(listener, elementInfo);
+ outputProvider("", "dart")
+ ..add(code)
+ ..close();
+ return code.length;
} else {
output = new MainOutputGenerator();
- assembledCode = output.generateCode(
+ return output.generateCode(
libraryInfo,
elementInfo,
collector,
@@ -138,7 +143,6 @@ class DartOutputter {
forceStripTypes: forceStripTypes,
enableMinification: enableMinification);
}
- return assembledCode;
}
static PlaceholderCollector collectPlaceholders(
@@ -431,7 +435,8 @@ class MainOutputGenerator {
new Map<ClassNode, List<Node>>();
final List<Node> topLevelNodes = <Node>[];
- String generateCode(
+ /// Generates the code and returns the total size.
+ int generateCode(
LibraryInfo libraryInfo,
ElementInfo elementInfo,
PlaceholderCollector collector,
@@ -539,7 +544,6 @@ class MainOutputGenerator {
}
int totalSize = 0;
- String assembledCode;
if (multiFile) {
for(LibraryElement outputLibrary in libraryInfo.userLibraries) {
// TODO(sigurdm): Make the unparser output directly into the buffer
@@ -550,17 +554,15 @@ class MainOutputGenerator {
..add(code)
..close();
}
- // TODO(sigurdm): We should get rid of compiler.assembledCode.
- assembledCode = unparsers[mainFunction.library].result;
} else {
- assembledCode = mainUnparser.result;
+ String code = mainUnparser.result;
outputProvider("", "dart")
- ..add(assembledCode)
+ ..add(code)
..close();
- totalSize = assembledCode.length;
+ totalSize = code.length;
}
- return assembledCode;
+ return totalSize;
}
}
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/backend.dart ('k') | pkg/compiler/lib/src/dump_info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698