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

Side by Side Diff: pkg/analyzer/lib/file_system/memory_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.memory_file_system; 5 library analyzer.file_system.memory_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:core' hide Resource; 9 import 'dart:core' hide Resource;
10 10
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 _notifyWatchers(newPath, ChangeType.ADD); 181 _notifyWatchers(newPath, ChangeType.ADD);
182 return newFile; 182 return newFile;
183 } 183 }
184 184
185 File updateFile(String path, String content, [int stamp]) { 185 File updateFile(String path, String content, [int stamp]) {
186 path = pathContext.normalize(path); 186 path = pathContext.normalize(path);
187 newFolder(pathContext.dirname(path)); 187 newFolder(pathContext.dirname(path));
188 _MemoryFile file = new _MemoryFile(this, path); 188 _MemoryFile file = new _MemoryFile(this, path);
189 _pathToResource[path] = file; 189 _pathToResource[path] = file;
190 _pathToContent[path] = content; 190 _pathToContent[path] = content;
191 _pathToTimestamp[path] = stamp != null ? stamp : nextStamp++; 191 _pathToTimestamp[path] = stamp ?? nextStamp++;
192 _notifyWatchers(path, ChangeType.MODIFY); 192 _notifyWatchers(path, ChangeType.MODIFY);
193 return file; 193 return file;
194 } 194 }
195 195
196 void _checkFileAtPath(String path) { 196 void _checkFileAtPath(String path) {
197 _MemoryResource resource = _pathToResource[path]; 197 _MemoryResource resource = _pathToResource[path];
198 if (resource is! _MemoryFile) { 198 if (resource is! _MemoryFile) {
199 throw new ArgumentError( 199 throw new ArgumentError(
200 'File expected at "$path" but ${resource.runtimeType} found'); 200 'File expected at "$path" but ${resource.runtimeType} found');
201 } 201 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 bool operator ==(other) { 570 bool operator ==(other) {
571 if (runtimeType != other.runtimeType) { 571 if (runtimeType != other.runtimeType) {
572 return false; 572 return false;
573 } 573 }
574 return path == other.path; 574 return path == other.path;
575 } 575 }
576 576
577 @override 577 @override
578 String toString() => path; 578 String toString() => path;
579 } 579 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/file_system/file_system.dart ('k') | pkg/analyzer/lib/source/analysis_options_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698