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

Unified Diff: dart/lib/compiler/implementation/scanner/class_element_parser.dart

Issue 10855125: Ensure supertypes are loaded safely. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: More cleanup of ClassElement.cloneMembersTo Created 8 years, 4 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: dart/lib/compiler/implementation/scanner/class_element_parser.dart
diff --git a/dart/lib/compiler/implementation/scanner/class_element_parser.dart b/dart/lib/compiler/implementation/scanner/class_element_parser.dart
index 2620f9830ac78bd6f78c516eb07775f43941c30f..cb728bc61d89224468d7206b07e9138dc39c250e 100644
--- a/dart/lib/compiler/implementation/scanner/class_element_parser.dart
+++ b/dart/lib/compiler/implementation/scanner/class_element_parser.dart
@@ -37,9 +37,30 @@ class PartialClassElement extends ClassElement {
PartialClassElement cloneTo(Element enclosing, DiagnosticListener listener) {
parseNode(listener);
+ // TODO(lrn): Is copying id acceptable?
+ // TODO(ahe): No.
PartialClassElement result =
new PartialClassElement(name, beginToken, endToken, enclosing, id);
- cloneMembersTo(result, listener);
+
+ assert(this.supertypeLoadState == ClassElement.STATE_NOT_STARTED);
+ assert(this.resolutionState == ClassElement.STATE_NOT_STARTED);
+ assert(this.type === null);
+ assert(this.supertype === null);
+ assert(this.defaultClass === null);
+ assert(this.interfaces === null);
+ assert(this.allSupertypes === null);
+ assert(this.backendMembers.isEmpty());
+
+ // Native is only used in DOM/HTML library for which we don't
+ // support patching.
+ assert(this.nativeName === null);
+
+ Link<Element> elementList = this.members;
+ while (!elementList.isEmpty()) {
+ result.addMember(elementList.head.cloneTo(result, listener), listener);
+ elementList = elementList.tail;
+ }
+
result.cachedNode = cachedNode;
return result;
}

Powered by Google App Engine
This is Rietveld 408576698