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

Unified Diff: pkg/compiler/lib/src/js_backend/native_emitter.dart

Issue 830703004: Emit to StreamCodeOutput instead of CodeBuffer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments 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/js_backend/codegen/task.dart ('k') | pkg/compiler/lib/src/js_emitter/js_emitter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/native_emitter.dart
diff --git a/pkg/compiler/lib/src/js_backend/native_emitter.dart b/pkg/compiler/lib/src/js_backend/native_emitter.dart
index f945fef64d469d12f30d5ede702ec6ea305bae3e..60f11553430e71639cbfa93dd9780a1d1020a973 100644
--- a/pkg/compiler/lib/src/js_backend/native_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/native_emitter.dart
@@ -9,7 +9,6 @@ class NativeEmitter {
final Map<Element, ClassBuilder> cachedBuilders;
final CodeEmitterTask emitterTask;
- CodeBuffer nativeBuffer;
// Native classes found in the application.
Set<ClassElement> nativeClasses = new Set<ClassElement>();
@@ -33,7 +32,6 @@ class NativeEmitter {
subtypes = new Map<ClassElement, List<ClassElement>>(),
directSubtypes = new Map<ClassElement, List<ClassElement>>(),
nativeMethods = new Set<FunctionElement>(),
- nativeBuffer = new CodeBuffer(),
cachedBuilders = emitterTask.compiler.cacheStrategy.newMap();
Compiler get compiler => emitterTask.compiler;
@@ -45,7 +43,6 @@ class NativeEmitter {
}
/**
- * Writes the class definitions for the interceptors to [mainBuffer].
* Writes code to associate dispatch tags with interceptors to [nativeBuffer].
*
* The interceptors are filtered to avoid emitting trivial interceptors. For
@@ -68,7 +65,6 @@ class NativeEmitter {
*/
void generateNativeClasses(
List<ClassElement> classes,
- CodeBuffer mainBuffer,
Map<ClassElement, Map<String, jsAst.Expression>> additionalProperties) {
// Compute a pre-order traversal of the subclass forest. We actually want a
// post-order traversal but it is easier to compute the pre-order and use it
@@ -442,7 +438,7 @@ class NativeEmitter {
return isSupertypeOfNativeClass(element);
}
- void assembleCode(CodeBuffer targetBuffer) {
+ void assembleCode(CodeOutput targetOutput) {
List<jsAst.Property> objectProperties = <jsAst.Property>[];
jsAst.Property addProperty(String name, jsAst.Expression value) {
@@ -470,13 +466,14 @@ class NativeEmitter {
[ defPropFunction,
new jsAst.ObjectInitializer(objectProperties)]);
- if (emitterTask.compiler.enableMinification) targetBuffer.write(';');
- targetBuffer.write(jsAst.prettyPrint(
+ if (emitterTask.compiler.enableMinification) {
+ targetOutput.add(';');
+ }
+ targetOutput.addBuffer(jsAst.prettyPrint(
new jsAst.ExpressionStatement(init), compiler));
- targetBuffer.write('\n');
+ targetOutput.add('\n');
}
- targetBuffer.write(nativeBuffer);
- targetBuffer.write('\n');
+ targetOutput.add('\n');
}
}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | pkg/compiler/lib/src/js_emitter/js_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698