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

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

Issue 2613683005: Issue 28149. Don't include non-Dart file into FileState. (Closed)
Patch Set: Created 3 years, 11 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/driver_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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 } 430 }
431 431
432 // Build the graph. 432 // Build the graph.
433 _importedFiles = <FileState>[]; 433 _importedFiles = <FileState>[];
434 _exportedFiles = <FileState>[]; 434 _exportedFiles = <FileState>[];
435 _partedFiles = <FileState>[]; 435 _partedFiles = <FileState>[];
436 _exportFilters = <NameFilter>[]; 436 _exportFilters = <NameFilter>[];
437 for (UnlinkedImport import in _unlinked.imports) { 437 for (UnlinkedImport import in _unlinked.imports) {
438 if (!import.isImplicit) { 438 if (!import.isImplicit) {
439 String uri = import.uri; 439 String uri = import.uri;
440 if (!_isDartUri(uri)) { 440 if (_isDartFileUri(uri)) {
441 FileState file = _fileForRelativeUri(uri); 441 FileState file = _fileForRelativeUri(uri);
442 if (file != null) { 442 if (file != null) {
443 _importedFiles.add(file); 443 _importedFiles.add(file);
444 } 444 }
445 } 445 }
446 } 446 }
447 } 447 }
448 for (UnlinkedExportPublic export in _unlinked.publicNamespace.exports) { 448 for (UnlinkedExportPublic export in _unlinked.publicNamespace.exports) {
449 String uri = export.uri; 449 String uri = export.uri;
450 if (!_isDartUri(uri)) { 450 if (_isDartFileUri(uri)) {
451 FileState file = _fileForRelativeUri(uri); 451 FileState file = _fileForRelativeUri(uri);
452 if (file != null) { 452 if (file != null) {
453 _exportedFiles.add(file); 453 _exportedFiles.add(file);
454 _exportFilters 454 _exportFilters
455 .add(new NameFilter.forUnlinkedCombinators(export.combinators)); 455 .add(new NameFilter.forUnlinkedCombinators(export.combinators));
456 } 456 }
457 } 457 }
458 } 458 }
459 for (String uri in _unlinked.publicNamespace.parts) { 459 for (String uri in _unlinked.publicNamespace.parts) {
460 if (!_isDartUri(uri)) { 460 if (_isDartFileUri(uri)) {
461 FileState file = _fileForRelativeUri(uri); 461 FileState file = _fileForRelativeUri(uri);
462 if (file != null) { 462 if (file != null) {
463 _partedFiles.add(file); 463 _partedFiles.add(file);
464 // TODO(scheglov) Sort for stable results? 464 // TODO(scheglov) Sort for stable results?
465 _fsState._partToLibraries 465 _fsState._partToLibraries
466 .putIfAbsent(file, () => <FileState>[]) 466 .putIfAbsent(file, () => <FileState>[])
467 .add(this); 467 .add(this);
468 } 468 }
469 } 469 }
470 } 470 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 return false; 517 return false;
518 } 518 }
519 for (int i = 0; i < a.length; i++) { 519 for (int i = 0; i < a.length; i++) {
520 if (a[i] != b[i]) { 520 if (a[i] != b[i]) {
521 return false; 521 return false;
522 } 522 }
523 } 523 }
524 return true; 524 return true;
525 } 525 }
526 526
527 static bool _isDartUri(String uri) { 527 static bool _isDartFileUri(String uri) {
528 return uri.startsWith('dart:'); 528 return !uri.startsWith('dart:') && AnalysisEngine.isDartFileName(uri);
529 } 529 }
530 } 530 }
531 531
532 /** 532 /**
533 * Information about known file system state. 533 * Information about known file system state.
534 */ 534 */
535 class FileSystemState { 535 class FileSystemState {
536 final PerformanceLog _logger; 536 final PerformanceLog _logger;
537 final ResourceProvider _resourceProvider; 537 final ResourceProvider _resourceProvider;
538 final ByteStore _byteStore; 538 final ByteStore _byteStore;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 .where((f) => f._transitiveFiles == null) 694 .where((f) => f._transitiveFiles == null)
695 .toSet(); 695 .toSet();
696 } 696 }
697 697
698 Set<FileState> get filesWithoutTransitiveSignature { 698 Set<FileState> get filesWithoutTransitiveSignature {
699 return state._uriToFile.values 699 return state._uriToFile.values
700 .where((f) => f._transitiveSignature == null) 700 .where((f) => f._transitiveSignature == null)
701 .toSet(); 701 .toSet();
702 } 702 }
703 } 703 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698