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

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

Issue 10837025: Properly emit variable declarations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « no previous file | lib/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart_backend/emitter.dart
diff --git a/lib/compiler/implementation/dart_backend/emitter.dart b/lib/compiler/implementation/dart_backend/emitter.dart
index 58d2b6aac991f55c37bdf8d44b6bc8794ab47187..f5264e6f097900918c2fdbc1b604f13ceb4e7014 100644
--- a/lib/compiler/implementation/dart_backend/emitter.dart
+++ b/lib/compiler/implementation/dart_backend/emitter.dart
@@ -10,11 +10,13 @@ class Emitter {
final Compiler compiler;
final StringBuffer sb;
final ConflictingRenamer renamer;
+ final Set<VariableListElement> processedVariableLists;
Emitter(Compiler compiler) :
this.compiler = compiler,
sb = new StringBuffer(),
- renamer = new ConflictingRenamer(compiler);
+ renamer = new ConflictingRenamer(compiler),
+ processedVariableLists = new Set<VariableListElement>();
/**
* Outputs given class element with selected inner elements.
@@ -66,7 +68,13 @@ class Emitter {
|| element is AbstractFieldElement) return;
if (element.isField()) {
assert(element is VariableElement);
- sb.add(unparser.unparse(element.variables.parseNode(compiler)));
+ // Different VariableElement's may refer to the same VariableListElement.
+ // Output this list only once.
+ final variableList = element.variables;
+ if (!processedVariableLists.contains(variableList)) {
Roman 2012/07/31 18:45:03 Hmm, I just thought about it in another way - we o
Anton Muhin 2012/07/31 18:55:37 Good point, todo added. On 2012/07/31 18:45:03, R
+ processedVariableLists.add(variableList);
+ sb.add(unparser.unparse(variableList.parseNode(compiler)));
+ }
} else {
sb.add(unparser.unparse(element.parseNode(compiler)));
}
« no previous file with comments | « no previous file | lib/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698