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

Unified Diff: compiler/java/com/google/dart/compiler/backend/js/AbstractJsBackend.java

Issue 8218022: Correct class sort order. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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: compiler/java/com/google/dart/compiler/backend/js/AbstractJsBackend.java
===================================================================
--- compiler/java/com/google/dart/compiler/backend/js/AbstractJsBackend.java (revision 305)
+++ compiler/java/com/google/dart/compiler/backend/js/AbstractJsBackend.java (working copy)
@@ -31,6 +31,7 @@
import com.google.dart.compiler.resolver.ClassElement;
import com.google.dart.compiler.resolver.CoreTypeProvider;
import com.google.dart.compiler.resolver.MethodElement;
+import com.google.dart.compiler.type.InterfaceType;
import com.google.dart.compiler.util.DefaultTextOutput;
import com.google.dart.compiler.util.TextOutput;
@@ -161,14 +162,16 @@
DartNode norm = node.getNormalizedNode();
if (norm instanceof DartClass) {
DartClass clasz = (DartClass)norm;
+ ClassElement selfElement = clasz.getSymbol();
+ InterfaceType superType = selfElement.getSupertype();
ClassElement superElement = null;
- DartTypeNode superType = clasz.getSuperclass();
if (superType != null) {
- superElement = (ClassElement) clasz.getSuperclass().getSymbol();
+ superElement = superType.getElement();
+ assert(superElement != null);
}
parts.add(new Part(libUnit, unit,
- clasz.getClassName(), clasz.getSymbol(), superElement));
+ clasz.getClassName(), selfElement, superElement));
}
}
@@ -238,7 +241,10 @@
final Map<ClassElement, Part> elementToPartMap = Maps.newHashMap();
for (Part part : parts) {
- elementToPartMap.put(part.element, part);
+ if (part.element != null) {
+ Part previous = elementToPartMap.put(part.element, part);
+ assert(previous == null);
+ }
}
// Get the direct dependencies.
@@ -246,9 +252,8 @@
for (Part part : parts) {
if (part.superElement != null) {
Part superPart = elementToPartMap.get(part.superElement);
- if (superPart != null) {
- deps.put(part, superPart);
- }
+ assert(superPart != null);
+ deps.put(part, superPart);
}
// Don't add a dependency on itself.

Powered by Google App Engine
This is Rietveld 408576698