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

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

Issue 2527423002: Filter out AnalysisErrors with null 'errorCode'. (Closed)
Patch Set: Throw an exception if cannot find ErrorCode by its uniqueName. Created 4 years 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 | 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: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/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement; 10 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement;
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 } 709 }
710 710
711 /** 711 /**
712 * Load the [AnalysisResult] for the given [file] from the [bytes]. Set 712 * Load the [AnalysisResult] for the given [file] from the [bytes]. Set
713 * optional [content] and [resolvedUnit]. 713 * optional [content] and [resolvedUnit].
714 */ 714 */
715 AnalysisResult _getAnalysisResultFromBytes( 715 AnalysisResult _getAnalysisResultFromBytes(
716 FileState libraryFile, FileState file, List<int> bytes, 716 FileState libraryFile, FileState file, List<int> bytes,
717 {String content, CompilationUnit resolvedUnit}) { 717 {String content, CompilationUnit resolvedUnit}) {
718 var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes); 718 var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes);
719 List<AnalysisError> errors = unit.errors 719 List<AnalysisError> errors = unit.errors.map((error) {
720 .map((error) => new AnalysisError.forValues( 720 String errorName = error.uniqueName;
721 file.source, 721 ErrorCode errorCode = errorCodeByUniqueName(errorName);
722 error.offset, 722 if (errorCode == null) {
723 error.length, 723 throw new StateError('No ErrorCode for $errorName in $file');
724 errorCodeByUniqueName(error.uniqueName), 724 }
725 error.message, 725 return new AnalysisError.forValues(file.source, error.offset,
726 error.correction)) 726 error.length, errorCode, error.message, error.correction);
727 .toList(); 727 }).toList();
728 return new AnalysisResult( 728 return new AnalysisResult(
729 libraryFile, 729 libraryFile,
730 file, 730 file,
731 _sourceFactory, 731 _sourceFactory,
732 file.path, 732 file.path,
733 file.uri, 733 file.uri,
734 content, 734 content,
735 file.contentHash, 735 file.contentHash,
736 file.lineInfo, 736 file.lineInfo,
737 resolvedUnit, 737 resolvedUnit,
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 } 1288 }
1289 1289
1290 /** 1290 /**
1291 * TODO(scheglov) document 1291 * TODO(scheglov) document
1292 */ 1292 */
1293 class _LibraryContext { 1293 class _LibraryContext {
1294 final FileState file; 1294 final FileState file;
1295 final SummaryDataStore store; 1295 final SummaryDataStore store;
1296 _LibraryContext(this.file, this.store); 1296 _LibraryContext(this.file, this.store);
1297 } 1297 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698