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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart

Issue 11602016: Emit classes using ASTs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 12 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: sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
index 6810dac58a35977f4427438c65ba11aea82a3fe2..ac5968b9029dec8f52907b1bb68105130b83fd70 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
@@ -88,14 +88,12 @@ $lazyInitializerLogic
void emitBoundClosureClassHeader(String mangledName,
String superName,
List<String> fieldNames,
- CodeBuffer buffer) {
- buffer.add("$classesCollector.$mangledName = {'': ");
- buffer.add(
- js.prettyPrint(buildConstructor(mangledName, fieldNames), compiler));
- buffer.add(",\n 'super': '$superName',\n");
+ ClassBuilder builder) {
+ builder.addProperty('', buildConstructor(mangledName, fieldNames));
+ builder.addProperty('super', js.string(superName));
}
- void emitClassConstructor(ClassElement classElement, CodeBuffer buffer) {
+ void emitClassConstructor(ClassElement classElement, ClassBuilder builder) {
// Say we have a class A with fields b, c and d, where c needs a getter and
// d needs both a getter and a setter. Then we produce:
// - a constructor (directly into the given [buffer]):
@@ -114,23 +112,20 @@ $lazyInitializerLogic
fields.add(name);
});
String constructorName = namer.safeName(classElement.name.slowToString());
- buffer.add("'': ");
- buffer.add(
- js.prettyPrint(buildConstructor(constructorName, fields), compiler));
+
+ builder.addProperty('', buildConstructor(constructorName, fields));
}
- void emitSuper(String superName, CodeBuffer buffer) {
+ void emitSuper(String superName, ClassBuilder builder) {
if (superName != '') {
- buffer.add(",\n 'super': '$superName'");
+ builder.addProperty('super', js.string(superName));
}
}
void emitClassFields(ClassElement classElement,
- CodeBuffer buffer,
- bool emitEndingComma,
+ ClassBuilder builder,
{ String superClass: "",
bool classIsNative: false}) {
- if (emitEndingComma) buffer.add(', ');
}
bool get getterAndSetterCanBeImplementedByFieldSpec => false;

Powered by Google App Engine
This is Rietveld 408576698