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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_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
Index: pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart
index a33b9c6e7312f41f923d95b50b40598027c8ed77..bd4e03bf72b9328bfdb43f9de988f42a66c48c0c 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart
@@ -13,7 +13,7 @@ class InterceptorEmitter extends CodeEmitterHelper {
}
}
- void emitGetInterceptorMethod(CodeBuffer buffer,
+ void emitGetInterceptorMethod(CodeOutput output,
String key,
Set<ClassElement> classes) {
InterceptorStubGenerator stubGenerator =
@@ -21,27 +21,27 @@ class InterceptorEmitter extends CodeEmitterHelper {
jsAst.Expression function =
stubGenerator.generateGetInterceptorMethod(classes);
- buffer.write(jsAst.prettyPrint(
+ output.addBuffer(jsAst.prettyPrint(
js('${namer.globalObjectFor(backend.interceptorsLibrary)}.# = #',
[key, function]),
compiler));
- buffer.write(N);
+ output.add(N);
}
/**
* Emit all versions of the [:getInterceptor:] method.
*/
- void emitGetInterceptorMethods(CodeBuffer buffer) {
- emitter.addComment('getInterceptor methods', buffer);
+ void emitGetInterceptorMethods(CodeOutput output) {
+ emitter.addComment('getInterceptor methods', output);
Map<String, Set<ClassElement>> specializedGetInterceptors =
backend.specializedGetInterceptors;
for (String name in specializedGetInterceptors.keys.toList()..sort()) {
Set<ClassElement> classes = specializedGetInterceptors[name];
- emitGetInterceptorMethod(buffer, name, classes);
+ emitGetInterceptorMethod(output, name, classes);
}
}
- void emitOneShotInterceptors(CodeBuffer buffer) {
+ void emitOneShotInterceptors(CodeOutput output) {
List<String> names = backend.oneShotInterceptors.keys.toList();
names.sort();
@@ -54,8 +54,8 @@ class InterceptorEmitter extends CodeEmitterHelper {
jsAst.Expression assignment =
js('${globalObject}.# = #', [name, function]);
- buffer.write(jsAst.prettyPrint(assignment, compiler));
- buffer.write(N);
+ output.addBuffer(jsAst.prettyPrint(assignment, compiler));
+ output.add(N);
}
}
@@ -66,7 +66,7 @@ class InterceptorEmitter extends CodeEmitterHelper {
* [_invokeOn] will use it to determine whether it should call the
* method with an extra parameter.
*/
- void emitInterceptedNames(CodeBuffer buffer) {
+ void emitInterceptedNames(CodeOutput output) {
// TODO(ahe): We should not generate the list of intercepted names at
// compile time, it can be generated automatically at runtime given
// subclasses of Interceptor (which can easily be identified).
@@ -85,8 +85,8 @@ class InterceptorEmitter extends CodeEmitterHelper {
jsAst.Expression assignment =
js('${emitter.isolateProperties}.# = #', [name, array]);
- buffer.write(jsAst.prettyPrint(assignment, compiler));
- buffer.write(N);
+ output.addBuffer(jsAst.prettyPrint(assignment, compiler));
+ output.add(N);
}
/**
@@ -94,7 +94,7 @@ class InterceptorEmitter extends CodeEmitterHelper {
* [findInterceptorForType]. See declaration of [mapTypeToInterceptor] in
* `interceptors.dart`.
*/
- void emitMapTypeToInterceptor(CodeBuffer buffer) {
+ void emitMapTypeToInterceptor(CodeOutput output) {
// TODO(sra): Perhaps inject a constant instead?
CustomElementsAnalysis analysis = backend.customElementsAnalysis;
if (!analysis.needsTable) return;
@@ -149,7 +149,7 @@ class InterceptorEmitter extends CodeEmitterHelper {
jsAst.Expression assignment =
js('${emitter.isolateProperties}.# = #', [name, array]);
- buffer.write(jsAst.prettyPrint(assignment, compiler));
- buffer.write(N);
+ output.addBuffer(jsAst.prettyPrint(assignment, compiler));
+ output.add(N);
}
}

Powered by Google App Engine
This is Rietveld 408576698