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

Unified Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 1814453002: Remove more calls to safelyVisit methods (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/lib/src/dart/element/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 24241df84beef19222e2b07cd8f24fed4508f8e5..da248938d0da3cc8d85c8151f21e848ad166dd17 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -2091,15 +2091,6 @@ abstract class ElementImpl implements Element {
}
/**
- * If the given [child] is not `null`, use the given [visitor] to visit it.
- */
- void safelyVisitChild(Element child, ElementVisitor visitor) {
- if (child != null) {
- child.accept(visitor);
- }
- }
-
- /**
* Use the given [visitor] to visit all of the [children] in the given array.
*/
void safelyVisitChildren(List<Element> children, ElementVisitor visitor) {
@@ -3048,7 +3039,7 @@ class ImportElementImpl extends UriReferencedElementImpl
@override
void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
- safelyVisitChild(prefix, visitor);
+ prefix?.accept(visitor);
}
}
@@ -3621,7 +3612,7 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
@override
void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
- safelyVisitChild(_definingCompilationUnit, visitor);
+ _definingCompilationUnit?.accept(visitor);
safelyVisitChildren(_exports, visitor);
safelyVisitChildren(_imports, visitor);
safelyVisitChildren(_parts, visitor);
@@ -4917,7 +4908,7 @@ abstract class VariableElementImpl extends ElementImpl
@override
void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
- safelyVisitChild(_initializer, visitor);
+ _initializer?.accept(visitor);
}
}
« no previous file with comments | « pkg/analysis_server/lib/src/domains/analysis/navigation_dart.dart ('k') | pkg/analyzer/lib/src/dart/element/member.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698