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

Unified Diff: pkg/analysis_server/lib/src/computer/error.dart

Issue 415263002: Drop 'errorToJson', use server's AnalysisError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/computer/error.dart
diff --git a/pkg/analysis_server/lib/src/computer/error.dart b/pkg/analysis_server/lib/src/computer/error.dart
index 5db2e2a769453ea9170f02e4dd3ed0bf22ed6def..21960c5eb67d8cd6f8e6f3d6bfb62d96bfbe90ea 100644
--- a/pkg/analysis_server/lib/src/computer/error.dart
+++ b/pkg/analysis_server/lib/src/computer/error.dart
@@ -7,11 +7,31 @@ library computer.error;
import 'package:analysis_server/src/computer/element.dart';
import 'package:analysis_services/constants.dart';
import 'package:analysis_services/json.dart';
+import 'package:analyzer/src/generated/engine.dart' as engine;
import 'package:analyzer/src/generated/error.dart' as engine;
import 'package:analyzer/src/generated/source.dart' as engine;
/**
+ * Returns a JSON correponding to the given list of Engine errors.
+ */
+List<Map<String, Object>> engineErrorInfoToJson(engine.AnalysisErrorInfo info) {
+ return engineErrorsToJson(info.lineInfo, info.errors);
+}
+
+
+/**
+ * Returns a JSON correponding to the given list of Engine errors.
+ */
+List<Map<String, Object>> engineErrorsToJson(engine.LineInfo lineInfo,
+ List<engine.AnalysisError> errors) {
+ return errors.map((engine.AnalysisError error) {
+ return new AnalysisError.fromEngine(lineInfo, error).toJson();
+ }).toList();
+}
+
+
+/**
* An indication of an error, warning, or hint that was produced by the
* analysis. 
*/
@@ -49,7 +69,7 @@ class AnalysisError implements HasToJson {
String severity = errorCode.errorSeverity.toString();
String type = errorCode.type.toString();
String message = error.message;
- String correction = errorCode.correction;
+ String correction = error.correction;
return new AnalysisError(severity, type, location, message, correction);
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698