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

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

Issue 1933763002: Use null-aware operators to clean up the code (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Additional clean-up Created 4 years, 8 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/type.dart
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index 14e459e9d8608d47d361740f93d6dc64032cf93a..7d08ca8d4638f7d68607841b99ec0ce9b46506fd 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -1564,8 +1564,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
}
HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
InterfaceType supertype = superclass;
- ClassElement supertypeElement =
- supertype == null ? null : supertype.element;
+ ClassElement supertypeElement = supertype?.element;
while (supertype != null && !visitedClasses.contains(supertypeElement)) {
visitedClasses.add(supertypeElement);
PropertyAccessorElement element = supertype.getGetter(getterName);
@@ -1579,7 +1578,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
}
}
supertype = supertype.superclass;
- supertypeElement = supertype == null ? null : supertype.element;
+ supertypeElement = supertype?.element;
}
return null;
}
@@ -1669,8 +1668,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
}
HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
InterfaceType supertype = superclass;
- ClassElement supertypeElement =
- supertype == null ? null : supertype.element;
+ ClassElement supertypeElement = supertype?.element;
while (supertype != null && !visitedClasses.contains(supertypeElement)) {
visitedClasses.add(supertypeElement);
MethodElement element = supertype.getMethod(methodName);
@@ -1684,7 +1682,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
}
}
supertype = supertype.superclass;
- supertypeElement = supertype == null ? null : supertype.element;
+ supertypeElement = supertype?.element;
}
return null;
}
@@ -1710,8 +1708,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
}
HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
InterfaceType supertype = superclass;
- ClassElement supertypeElement =
- supertype == null ? null : supertype.element;
+ ClassElement supertypeElement = supertype?.element;
while (supertype != null && !visitedClasses.contains(supertypeElement)) {
visitedClasses.add(supertypeElement);
PropertyAccessorElement element = supertype.getSetter(setterName);
@@ -1725,7 +1722,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
}
}
supertype = supertype.superclass;
- supertypeElement = supertype == null ? null : supertype.element;
+ supertypeElement = supertype?.element;
}
return null;
}
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698