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

Unified Diff: pkg/analyzer_experimental/lib/src/generated/html.dart

Issue 16381003: Quick check for self in InterfaceTypeImpl.getLeastUpperBound() (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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: pkg/analyzer_experimental/lib/src/generated/html.dart
diff --git a/pkg/analyzer_experimental/lib/src/generated/html.dart b/pkg/analyzer_experimental/lib/src/generated/html.dart
index 90b52886d305037489c2f7a2126b8f73f709994d..741c07f84b1d0d12b30a7ee41415c766e6f3c253 100644
--- a/pkg/analyzer_experimental/lib/src/generated/html.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/html.dart
@@ -300,10 +300,54 @@ abstract class XmlNode {
}
/**
+ * This method exists for debugging purposes only.
+ */
+ void appendIdentifier(JavaStringBuilder builder, XmlNode node) {
+ if (node is XmlTagNode) {
+ builder.append(((node as XmlTagNode)).tag.lexeme);
+ } else if (node is XmlAttributeNode) {
+ builder.append(((node as XmlAttributeNode)).name.lexeme);
+ } else {
+ builder.append("htmlUnit");
+ }
+ }
+
+ /**
+ * This method exists for debugging purposes only.
+ */
+ String buildRecursiveStructureMessage(XmlNode newParent) {
+ JavaStringBuilder builder = new JavaStringBuilder();
+ builder.append("Attempt to create recursive structure: ");
+ XmlNode current = newParent;
+ while (current != null) {
+ if (current != newParent) {
+ builder.append(" -> ");
+ }
+ if (identical(current, this)) {
+ builder.appendChar(0x2A);
+ appendIdentifier(builder, current);
+ builder.appendChar(0x2A);
+ } else {
+ appendIdentifier(builder, current);
+ }
+ current = current.parent;
+ }
+ return builder.toString();
+ }
+
+ /**
* Set the parent of this node to the given node.
* @param newParent the node that is to be made the parent of this node
*/
void set parent(XmlNode newParent) {
+ XmlNode current = newParent;
+ while (current != null) {
+ if (identical(current, this)) {
+ AnalysisEngine.instance.logger.logError3(new IllegalArgumentException(buildRecursiveStructureMessage(newParent)));
+ return;
+ }
+ current = current.parent;
+ }
_parent = newParent;
}
}
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/error.dart ('k') | pkg/analyzer_experimental/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698