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

Unified Diff: pkg/analyzer/lib/src/generated/source_io.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.dart ('k') | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/source_io.dart
diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
index a4ccf0f94ff05e0a1533f8e789986915f8b60d1b..5b25c2cced179560f528d198578939b7ac420d7c 100644
--- a/pkg/analyzer/lib/src/generated/source_io.dart
+++ b/pkg/analyzer/lib/src/generated/source_io.dart
@@ -176,11 +176,10 @@ class FileBasedSource extends Source {
* derived, otherwise a `file:` URI will be created based on the [file].
*/
FileBasedSource(JavaFile file, [Uri uri])
- : this.uri = (uri == null ? file.toURI() : uri),
+ : this.uri = uri ?? file.toURI(),
this.file = file,
id = _idTable.putIfAbsent(
- '${uri == null ? file.toURI() : uri}@${file.getPath()}',
- () => _idTable.length);
+ '${uri ?? file.toURI()}@${file.getPath()}', () => _idTable.length);
@override
TimestampedData<String> get contents {
@@ -269,8 +268,7 @@ class FileUriResolver extends UriResolver {
if (!isFileUri(uri)) {
return null;
}
- return new FileBasedSource(
- new JavaFile.fromUri(uri), actualUri != null ? actualUri : uri);
+ return new FileBasedSource(new JavaFile.fromUri(uri), actualUri ?? uri);
}
@override
@@ -456,7 +454,7 @@ class PackageUriResolver extends UriResolver {
}
return new FileBasedSource(
getCanonicalFile(_packagesDirectories[0], pkgName, relPath),
- actualUri != null ? actualUri : uri);
+ actualUri ?? uri);
}
@override
@@ -545,7 +543,7 @@ class RelativeFileUriResolver extends UriResolver {
for (JavaFile dir in _relativeDirectories) {
JavaFile file = new JavaFile.relative(dir, filePath);
if (file.exists()) {
- return new FileBasedSource(file, actualUri != null ? actualUri : uri);
+ return new FileBasedSource(file, actualUri ?? uri);
}
}
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/source.dart ('k') | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698