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

Unified Diff: pkg/analyzer/lib/src/task/strong/checker.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
« no previous file with comments | « pkg/analyzer/lib/src/generated/source_io.dart ('k') | pkg/analyzer/lib/src/task/strong/info.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/strong/checker.dart
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index cf6b2f1ae8635123209e5307312d15fac116bdb6..3e6f6f52196978450f264947e8b879ab49b9179a 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -325,9 +325,7 @@ class CodeChecker extends RecursiveAstVisitor {
@override
void visitForEachStatement(ForEachStatement node) {
- var loopVariable = node.identifier != null
- ? node.identifier
- : node.loopVariable?.identifier;
+ var loopVariable = node.identifier ?? node.loopVariable?.identifier;
// Safely handle malformed statements.
if (loopVariable != null) {
@@ -1134,8 +1132,7 @@ class _OverrideChecker {
// Check overrides from its mixins
for (int i = 0; i < type.mixins.length; i++) {
- var loc =
- errorLocation != null ? errorLocation : node.withClause.mixinTypes[i];
+ var loc = errorLocation ?? node.withClause.mixinTypes[i];
for (var interfaceType in interfaces) {
// We copy [seen] so we can report separately if more than one mixin or
// the base class have an invalid override.
@@ -1147,8 +1144,10 @@ class _OverrideChecker {
// Check overrides from its superclasses
if (includeParents) {
var parent = type.superclass;
- if (parent.isObject) return;
- var loc = errorLocation != null ? errorLocation : node.extendsClause;
+ if (parent.isObject) {
+ return;
+ }
+ var loc = errorLocation ?? node.extendsClause;
// No need to copy [seen] here because we made copies above when reporting
// errors on mixins.
_checkInterfacesOverrides(parent, interfaces, seen,
« no previous file with comments | « pkg/analyzer/lib/src/generated/source_io.dart ('k') | pkg/analyzer/lib/src/task/strong/info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698