Index: pkg/analyzer/lib/src/generated/error.dart |
diff --git a/pkg/analyzer/lib/src/generated/error.dart b/pkg/analyzer/lib/src/generated/error.dart |
index 9fb06c563b6c2893336d98d27a9ef6cd9e533403..633243af35e04f2098448e380f96d2cb98d81137 100644 |
--- a/pkg/analyzer/lib/src/generated/error.dart |
+++ b/pkg/analyzer/lib/src/generated/error.dart |
@@ -11,6 +11,7 @@ import 'package:analyzer/dart/ast/token.dart'; |
import 'package:analyzer/dart/element/element.dart'; |
import 'package:analyzer/dart/element/type.dart'; |
import 'package:analyzer/source/error_processor.dart'; |
+import 'package:analyzer/src/dart/element/element.dart'; |
import 'package:analyzer/src/dart/element/type.dart'; |
import 'package:analyzer/src/dart/scanner/scanner.dart' show ScannerErrorCode; |
import 'package:analyzer/src/generated/generated/shared_messages.dart' |
@@ -21,7 +22,6 @@ import 'package:analyzer/src/generated/source.dart'; |
import 'package:analyzer/src/task/model.dart'; |
import 'package:analyzer/task/model.dart'; |
import 'package:source_span/source_span.dart'; |
-import 'package:analyzer/src/dart/element/element.dart'; |
/** |
* The descriptor used to associate error processors with analysis contexts in |
@@ -123,6 +123,12 @@ class AnalysisError { |
} |
/** |
+ * Initialize a newly created analysis error with given values. |
+ */ |
+ AnalysisError.forValues(this.source, this.offset, this.length, this.errorCode, |
+ this._message, this._correction); |
+ |
+ /** |
* Return the template used to create the correction to be displayed for this |
* error, or `null` if there is no correction information for this error. The |
* correction should indicate how the user can fix the error. |
@@ -3023,6 +3029,11 @@ abstract class ErrorCode { |
]; |
/** |
+ * The lazy initialized map from [uniqueName] to the [ErrorCode] instance. |
+ */ |
+ static HashMap<String, ErrorCode> _uniqueNameToCodeMap; |
+ |
+ /** |
* An empty list of error codes. |
*/ |
static const List<ErrorCode> EMPTY_LIST = const <ErrorCode>[]; |
@@ -3070,6 +3081,20 @@ abstract class ErrorCode { |
@override |
String toString() => uniqueName; |
+ |
+ /** |
+ * Return the [ErrorCode] with the given [uniqueName], or `null` if not |
+ * found. |
+ */ |
+ static ErrorCode byUniqueName(String uniqueName) { |
+ if (_uniqueNameToCodeMap == null) { |
+ _uniqueNameToCodeMap = new HashMap<String, ErrorCode>(); |
+ for (ErrorCode errorCode in values) { |
+ _uniqueNameToCodeMap[errorCode.uniqueName] = errorCode; |
+ } |
+ } |
+ return _uniqueNameToCodeMap[uniqueName]; |
+ } |
} |
/** |