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

Side by Side Diff: pkg/analyzer/lib/file_system/file_system.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, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.file_system.file_system; 5 library analyzer.file_system.file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:analyzer/src/util/absolute_path.dart'; 10 import 'package:analyzer/src/util/absolute_path.dart';
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 ResourceUriResolver(this._provider); 211 ResourceUriResolver(this._provider);
212 212
213 @override 213 @override
214 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 214 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
215 if (!_isFileUri(uri)) { 215 if (!_isFileUri(uri)) {
216 return null; 216 return null;
217 } 217 }
218 Resource resource = 218 Resource resource =
219 _provider.getResource(_provider.pathContext.fromUri(uri)); 219 _provider.getResource(_provider.pathContext.fromUri(uri));
220 if (resource is File) { 220 if (resource is File) {
221 return resource.createSource(actualUri != null ? actualUri : uri); 221 return resource.createSource(actualUri ?? uri);
222 } 222 }
223 return null; 223 return null;
224 } 224 }
225 225
226 @override 226 @override
227 Uri restoreAbsolute(Source source) => 227 Uri restoreAbsolute(Source source) =>
228 _provider.pathContext.toUri(source.fullName); 228 _provider.pathContext.toUri(source.fullName);
229 229
230 /** 230 /**
231 * Return `true` if the given [uri] is a `file` URI. 231 * Return `true` if the given [uri] is a `file` URI.
232 */ 232 */
233 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME; 233 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME;
234 } 234 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/dart/ast/ast.dart ('k') | pkg/analyzer/lib/file_system/memory_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698