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

Unified Diff: pkg/analyzer/lib/src/generated/error.dart

Issue 712083003: Create fewer unnecessary lists (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bee9bd800ed6d9cfd3d57470abdb672985167131..76d9d493e1d4915504e7b7a409e55d5b5a7195bb 100644
--- a/pkg/analyzer/lib/src/generated/error.dart
+++ b/pkg/analyzer/lib/src/generated/error.dart
@@ -21,7 +21,7 @@ class AnalysisError {
/**
* An empty array of errors used when no errors are expected.
*/
- static List<AnalysisError> NO_ERRORS = new List<AnalysisError>(0);
+ static const List<AnalysisError> NO_ERRORS = const <AnalysisError>[];
/**
* A [Comparator] that sorts by the name of the file that the [AnalysisError] was
@@ -93,7 +93,7 @@ class AnalysisError {
* @param errorCode the error code to be associated with this error
* @param arguments the arguments used to build the error message
*/
- AnalysisError.con1(this.source, this.errorCode, List<Object> arguments) {
+ AnalysisError.con1(this.source, this.errorCode, [List<Object> arguments]) {
this._message = formatList(errorCode.message, arguments);
}
@@ -106,7 +106,7 @@ class AnalysisError {
* @param errorCode the error code to be associated with this error
* @param arguments the arguments used to build the error message
*/
- AnalysisError.con2(this.source, int offset, int length, this.errorCode, List<Object> arguments) {
+ AnalysisError.con2(this.source, int offset, int length, this.errorCode, [List<Object> arguments]) {
this._offset = offset;
this._length = length;
this._message = formatList(errorCode.message, arguments);
@@ -2044,6 +2044,11 @@ abstract class ErrorCode {
final String correction;
/**
+ * An empty list of error codes.
+ */
+ static const List<ErrorCode> EMPTY_LIST = const <ErrorCode>[];
+
+ /**
* Initialize a newly created error code to have the given [name]. The message
* associated with the error will be created from the given [message]
* template. The correction associated with the error will be created from the
@@ -2160,7 +2165,7 @@ class ErrorReporter {
* @param node the node specifying the location of the error
* @param arguments the arguments to the error, used to compose the error message
*/
- void reportErrorForNode(ErrorCode errorCode, AstNode node, List<Object> arguments) {
+ void reportErrorForNode(ErrorCode errorCode, AstNode node, [List<Object> arguments]) {
reportErrorForOffset(errorCode, node.offset, node.length, arguments);
}
@@ -2172,7 +2177,7 @@ class ErrorReporter {
* @param length the length of the location of the error
* @param arguments the arguments to the error, used to compose the error message
*/
- void reportErrorForOffset(ErrorCode errorCode, int offset, int length, List<Object> arguments) {
+ void reportErrorForOffset(ErrorCode errorCode, int offset, int length, [List<Object> arguments]) {
_errorListener.onError(new AnalysisError.con2(_source, offset, length, errorCode, arguments));
}
@@ -2183,7 +2188,7 @@ class ErrorReporter {
* @param token the token specifying the location of the error
* @param arguments the arguments to the error, used to compose the error message
*/
- void reportErrorForToken(ErrorCode errorCode, Token token, List<Object> arguments) {
+ void reportErrorForToken(ErrorCode errorCode, Token token, [List<Object> arguments]) {
reportErrorForOffset(errorCode, token.offset, token.length, arguments);
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698