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

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

Issue 2664313002: Catch Uri.parse() FormatException and skip the URI. (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 | « no previous file | pkg/analyzer/test/src/dart/analysis/file_state_test.dart » ('j') | 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 } 482 }
483 483
484 // Return whether the API signature changed. 484 // Return whether the API signature changed.
485 return apiSignatureChanged; 485 return apiSignatureChanged;
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]. 492 * Return the [FileState] for the given [relativeUri].
Brian Wilkerson 2017/01/31 21:51:23 Maybe mention that `null` is an expected result.
493 */ 493 */
494 FileState _fileForRelativeUri(String relativeUri) { 494 FileState _fileForRelativeUri(String relativeUri) {
495 Uri absoluteUri = resolveRelativeUri(uri, Uri.parse(relativeUri)); 495 Uri absoluteUri;
496 try {
497 absoluteUri = resolveRelativeUri(uri, Uri.parse(relativeUri));
498 } on FormatException catch (e) {
499 return null;
500 }
496 return _fsState.getFileForUri(absoluteUri); 501 return _fsState.getFileForUri(absoluteUri);
497 } 502 }
498 503
499 /** 504 /**
500 * Return `true` if the given byte lists are equal. 505 * Return `true` if the given byte lists are equal.
501 */ 506 */
502 static bool _equalByteLists(List<int> a, List<int> b) { 507 static bool _equalByteLists(List<int> a, List<int> b) {
503 if (a == null) { 508 if (a == null) {
504 return b == null; 509 return b == null;
505 } else if (b == null) { 510 } else if (b == null) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 .where((f) => f._transitiveFiles == null) 710 .where((f) => f._transitiveFiles == null)
706 .toSet(); 711 .toSet();
707 } 712 }
708 713
709 Set<FileState> get filesWithoutTransitiveSignature { 714 Set<FileState> get filesWithoutTransitiveSignature {
710 return state._uriToFile.values 715 return state._uriToFile.values
711 .where((f) => f._transitiveSignature == null) 716 .where((f) => f._transitiveSignature == null)
712 .toSet(); 717 .toSet();
713 } 718 }
714 } 719 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/file_state_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698