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

Side by Side Diff: pkg/analysis_server/lib/src/operation/operation_analysis.dart

Issue 402493002: Remove 'errorCode' field from AnalysisError in the analysis server API. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library operation.analysis; 5 library operation.analysis;
6 6
7 import 'package:analysis_server/src/analysis_server.dart'; 7 import 'package:analysis_server/src/analysis_server.dart';
8 import 'package:analysis_server/src/computer/computer_highlights.dart'; 8 import 'package:analysis_server/src/computer/computer_highlights.dart';
9 import 'package:analysis_server/src/computer/computer_navigation.dart'; 9 import 'package:analysis_server/src/computer/computer_navigation.dart';
10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; 10 import 'package:analysis_server/src/computer/computer_occurrences.dart';
11 import 'package:analysis_server/src/computer/computer_outline.dart'; 11 import 'package:analysis_server/src/computer/computer_outline.dart';
12 import 'package:analysis_server/src/computer/computer_overrides.dart'; 12 import 'package:analysis_server/src/computer/computer_overrides.dart';
13 import 'package:analysis_server/src/constants.dart'; 13 import 'package:analysis_server/src/constants.dart';
14 import 'package:analysis_server/src/operation/operation.dart'; 14 import 'package:analysis_server/src/operation/operation.dart';
15 import 'package:analysis_server/src/protocol.dart'; 15 import 'package:analysis_server/src/protocol.dart';
16 import 'package:analysis_services/index/index.dart'; 16 import 'package:analysis_services/index/index.dart';
17 import 'package:analyzer/src/generated/ast.dart'; 17 import 'package:analyzer/src/generated/ast.dart';
18 import 'package:analyzer/src/generated/engine.dart'; 18 import 'package:analyzer/src/generated/engine.dart';
19 import 'package:analyzer/src/generated/error.dart'; 19 import 'package:analyzer/src/generated/error.dart';
20 import 'package:analyzer/src/generated/html.dart'; 20 import 'package:analyzer/src/generated/html.dart';
21 import 'package:analyzer/src/generated/java_core.dart';
22 import 'package:analyzer/src/generated/source.dart'; 21 import 'package:analyzer/src/generated/source.dart';
23 22
24 23
25 Map<String, Object> errorToJson(LineInfo lineInfo, AnalysisError analysisError) 24 Map<String, Object> errorToJson(LineInfo lineInfo, AnalysisError analysisError)
26 { 25 {
27 ErrorCode errorCode = analysisError.errorCode; 26 ErrorCode errorCode = analysisError.errorCode;
28 // prepare location 27 // prepare location
29 int offset = analysisError.offset; 28 int offset = analysisError.offset;
30 Map<String, Object> location = { 29 Map<String, Object> location = {
31 FILE: analysisError.source.fullName, 30 FILE: analysisError.source.fullName,
32 OFFSET: offset, 31 OFFSET: offset,
33 LENGTH: analysisError.length 32 LENGTH: analysisError.length
34 }; 33 };
35 if (lineInfo != null) { 34 if (lineInfo != null) {
36 LineInfo_Location lineLocation = lineInfo.getLocation(offset); 35 LineInfo_Location lineLocation = lineInfo.getLocation(offset);
37 if (lineLocation != null) { 36 if (lineLocation != null) {
38 location[START_LINE] = lineLocation.lineNumber; 37 location[START_LINE] = lineLocation.lineNumber;
39 location[START_COLUMN] = lineLocation.columnNumber; 38 location[START_COLUMN] = lineLocation.columnNumber;
40 } 39 }
41 } 40 }
42 // fill JSON 41 // fill JSON
43 Map<String, Object> result = { 42 Map<String, Object> result = {
44 // TODO(scheglov) add Enum.fullName ? 43 // TODO(scheglov) add Enum.fullName ?
45 ERROR_CODE: '${errorCode.runtimeType}.${(errorCode as Enum).name}',
46 SEVERITY: errorCode.errorSeverity.name, 44 SEVERITY: errorCode.errorSeverity.name,
47 TYPE: errorCode.type.name, 45 TYPE: errorCode.type.name,
48 LOCATION: location, 46 LOCATION: location,
49 MESSAGE: analysisError.message 47 MESSAGE: analysisError.message
50 }; 48 };
51 if (analysisError.correction != null) { 49 if (analysisError.correction != null) {
52 result[CORRECTION] = analysisError.correction; 50 result[CORRECTION] = analysisError.correction;
53 } 51 }
54 return result; 52 return result;
55 } 53 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // HTML 205 // HTML
208 { 206 {
209 HtmlUnit htmlUnit = notice.htmlUnit; 207 HtmlUnit htmlUnit = notice.htmlUnit;
210 if (htmlUnit != null) { 208 if (htmlUnit != null) {
211 index.indexHtmlUnit(context, htmlUnit); 209 index.indexHtmlUnit(context, htmlUnit);
212 } 210 }
213 } 211 }
214 } 212 }
215 } 213 }
216 } 214 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/domain_edit.dart ('k') | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698