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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/file_state.dart

Issue 2665393002: Small tweaks for AnalysisDriver and FileState. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:convert'; 5 import 'dart:convert';
6 import 'dart:typed_data'; 6 import 'dart:typed_data';
7 7
8 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
9 import 'package:analyzer/dart/ast/token.dart'; 9 import 'package:analyzer/dart/ast/token.dart';
10 import 'package:analyzer/error/listener.dart'; 10 import 'package:analyzer/error/listener.dart';
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 /** 188 /**
189 * The list of files this file imports. 189 * The list of files this file imports.
190 */ 190 */
191 List<FileState> get importedFiles => _importedFiles; 191 List<FileState> get importedFiles => _importedFiles;
192 192
193 /** 193 /**
194 * Return `true` if the file does not have a `library` directive, and has a 194 * Return `true` if the file does not have a `library` directive, and has a
195 * `part of` directive, so is probably a part. 195 * `part of` directive, so is probably a part.
196 */ 196 */
197 bool get isPart => _unlinked.libraryNameOffset == 0 && _unlinked.isPartOf; 197 bool get isPart => _unlinked.libraryNameOffset == 0 && _unlinked.isPartOf;
198 198
199 /** 199 /**
200 * If the file [isPart], return a currently know library the file is a part 200 * If the file [isPart], return a currently know library the file is a part
201 * of. Return `null` if a library is not known, for example because we have 201 * of. Return `null` if a library is not known, for example because we have
202 * not processed a library file yet. 202 * not processed a library file yet.
203 */ 203 */
204 FileState get library { 204 FileState get library {
205 List<FileState> libraries = _fsState._partToLibraries[this]; 205 List<FileState> libraries = _fsState._partToLibraries[this];
206 if (libraries == null || libraries.isEmpty) { 206 if (libraries == null || libraries.isEmpty) {
207 return null; 207 return null;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 } 486 }
487 487
488 @override 488 @override
489 String toString() => path; 489 String toString() => path;
490 490
491 /** 491 /**
492 * Return the [FileState] for the given [relativeUri], or `null` if the URI 492 * Return the [FileState] for the given [relativeUri], or `null` if the URI
493 * cannot be parsed, cannot correspond any file, etc. 493 * cannot be parsed, cannot correspond any file, etc.
494 */ 494 */
495 FileState _fileForRelativeUri(String relativeUri) { 495 FileState _fileForRelativeUri(String relativeUri) {
496 Uri absoluteUri; 496 Uri absoluteUri = resolveRelativeUri(uri, Uri.parse(relativeUri));
497 try {
498 absoluteUri = resolveRelativeUri(uri, Uri.parse(relativeUri));
499 } on FormatException catch (e) {
500 return null;
501 }
502 return _fsState.getFileForUri(absoluteUri); 497 return _fsState.getFileForUri(absoluteUri);
503 } 498 }
504 499
505 /** 500 /**
506 * Return `true` if the given byte lists are equal. 501 * Return `true` if the given byte lists are equal.
507 */ 502 */
508 static bool _equalByteLists(List<int> a, List<int> b) { 503 static bool _equalByteLists(List<int> a, List<int> b) {
509 if (a == null) { 504 if (a == null) {
510 return b == null; 505 return b == null;
511 } else if (b == null) { 506 } else if (b == null) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 .where((f) => f._transitiveFiles == null) 706 .where((f) => f._transitiveFiles == null)
712 .toSet(); 707 .toSet();
713 } 708 }
714 709
715 Set<FileState> get filesWithoutTransitiveSignature { 710 Set<FileState> get filesWithoutTransitiveSignature {
716 return state._uriToFile.values 711 return state._uriToFile.values
717 .where((f) => f._transitiveSignature == null) 712 .where((f) => f._transitiveSignature == null)
718 .toSet(); 713 .toSet();
719 } 714 }
720 } 715 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698