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

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

Issue 2709633009: Always return computed errors, even for not added files. (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/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:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 8
9 import 'package:analyzer/context/declared_variables.dart'; 9 import 'package:analyzer/context/declared_variables.dart';
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 // Store the result into the cache. 779 // Store the result into the cache.
780 bytes = _serializeResolvedUnit(resolvedUnit, errors); 780 bytes = _serializeResolvedUnit(resolvedUnit, errors);
781 _byteStore.put(key, bytes); 781 _byteStore.put(key, bytes);
782 } 782 }
783 783
784 // Return the result, full or partial. 784 // Return the result, full or partial.
785 _logger.writeln('Computed new analysis result.'); 785 _logger.writeln('Computed new analysis result.');
786 AnalysisResult result = _getAnalysisResultFromBytes( 786 AnalysisResult result = _getAnalysisResultFromBytes(
787 file, signature, bytes, 787 file, signature, bytes,
788 content: withUnit ? file.content : null, 788 content: withUnit ? file.content : null,
789 withErrors: _fileTracker.addedFiles.contains(path),
790 resolvedUnit: withUnit ? resolvedUnit : null); 789 resolvedUnit: withUnit ? resolvedUnit : null);
791 if (withUnit && _priorityFiles.contains(path)) { 790 if (withUnit && _priorityFiles.contains(path)) {
792 _priorityResults[path] = result; 791 _priorityResults[path] = result;
793 } 792 }
794 return result; 793 return result;
795 } finally { 794 } finally {
796 libraryContext.dispose(); 795 libraryContext.dispose();
797 } 796 }
798 } catch (exception, stackTrace) { 797 } catch (exception, stackTrace) {
799 String contextKey = 798 String contextKey =
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 _salt[i + 1] = crossContextOptions[i]; 869 _salt[i + 1] = crossContextOptions[i];
871 } 870 }
872 } 871 }
873 872
874 /** 873 /**
875 * Load the [AnalysisResult] for the given [file] from the [bytes]. Set 874 * Load the [AnalysisResult] for the given [file] from the [bytes]. Set
876 * optional [content] and [resolvedUnit]. 875 * optional [content] and [resolvedUnit].
877 */ 876 */
878 AnalysisResult _getAnalysisResultFromBytes( 877 AnalysisResult _getAnalysisResultFromBytes(
879 FileState file, String signature, List<int> bytes, 878 FileState file, String signature, List<int> bytes,
880 {String content, bool withErrors: true, CompilationUnit resolvedUnit}) { 879 {String content, CompilationUnit resolvedUnit}) {
881 var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes); 880 var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes);
882 List<AnalysisError> errors = withErrors 881 List<AnalysisError> errors = _getErrorsFromSerialized(file, unit.errors);
883 ? _getErrorsFromSerialized(file, unit.errors)
884 : const <AnalysisError>[];
885 return new AnalysisResult( 882 return new AnalysisResult(
886 this, 883 this,
887 _sourceFactory, 884 _sourceFactory,
888 file.path, 885 file.path,
889 file.uri, 886 file.uri,
890 file.exists, 887 file.exists,
891 content, 888 content,
892 file.contentHash, 889 file.contentHash,
893 file.lineInfo, 890 file.lineInfo,
894 signature, 891 signature,
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 libraryDeclarations.add(new TopLevelDeclarationInSource( 1901 libraryDeclarations.add(new TopLevelDeclarationInSource(
1905 file.source, declaration, isExported)); 1902 file.source, declaration, isExported));
1906 } 1903 }
1907 } 1904 }
1908 } 1905 }
1909 1906
1910 // We're not done yet. 1907 // We're not done yet.
1911 return false; 1908 return false;
1912 } 1909 }
1913 } 1910 }
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