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

Unified Diff: lib/compiler/implementation/emitter.dart

Issue 10388069: Don't emit dangling comma in object literal. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo and more cosmetic changes. Created 8 years, 7 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 | « frog/tests/leg/class_codegen2_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/emitter.dart
diff --git a/lib/compiler/implementation/emitter.dart b/lib/compiler/implementation/emitter.dart
index 6fe915dfbbe5486a24f273b962eb0bcb62994022..1ae5782e7d0dd11637bf2731096a1b280a9af947 100644
--- a/lib/compiler/implementation/emitter.dart
+++ b/lib/compiler/implementation/emitter.dart
@@ -466,8 +466,12 @@ function() {
}
void emitInstanceMembers(ClassElement classElement, StringBuffer buffer) {
+ bool isFirst = true;
void defineInstanceMember(String name, String value) {
- buffer.add(' $name: $value,\n');
+ if (!isFirst) buffer.add(',');
+ isFirst = false;
+ buffer.add('\n');
+ buffer.add(' $name: $value');
}
classElement.forEachMember(includeBackendMembers: true,
@@ -521,9 +525,9 @@ function() {
buffer.add('$defineClassName("$className", "$superName", [');
emitClassFields(classElement, buffer);
- buffer.add('], {\n');
+ buffer.add('], {');
emitInstanceMembers(classElement, buffer);
- buffer.add('});\n\n');
+ buffer.add('\n});\n\n');
}
void generateTypeTests(ClassElement cls,
« no previous file with comments | « frog/tests/leg/class_codegen2_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698