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

Unified Diff: compiler/java/com/google/dart/compiler/ast/DartNode.java

Issue 10702054: Issue 3931. Visit children nodes safely. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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: compiler/java/com/google/dart/compiler/ast/DartNode.java
diff --git a/compiler/java/com/google/dart/compiler/ast/DartNode.java b/compiler/java/com/google/dart/compiler/ast/DartNode.java
index cfb8830bd544ece709b3b925694bb3751ade92fb..736882285e84743e399e7ab5ec71df7d7eace1d6 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartNode.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartNode.java
@@ -109,5 +109,17 @@ public abstract class DartNode extends AbstractNode {
public String getObjectIdentifier(){
return super.toString();
}
+
+ /**
+ * If the given child is not <code>null</code>, use the given visitor to visit it.
+ *
+ * @param child the child to be visited
+ * @param visitor the visitor that will be used to visit the child
+ */
+ protected void safelyVisitChild(DartNode child, ASTVisitor<?> visitor) {
+ if (child != null) {
+ child.accept(visitor);
+ }
+ }
}

Powered by Google App Engine
This is Rietveld 408576698