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

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

Issue 1309543011: Add support for assert statements with messages to the analyzer. Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 5 years, 3 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 | « 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 93d1ce8dd482f5e2609772ff409387a1386a3766..67cb0fdaa663fa5c684ea02dceadacc38cc15bfe 100644
--- a/pkg/analyzer/lib/src/generated/error.dart
+++ b/pkg/analyzer/lib/src/generated/error.dart
@@ -28,14 +28,15 @@ class AnalysisError {
* was found.
*/
static Comparator<AnalysisError> FILE_COMPARATOR = (AnalysisError o1,
- AnalysisError o2) => o1.source.shortName.compareTo(o2.source.shortName);
+ AnalysisError o2) =>
+ o1.source.shortName.compareTo(o2.source.shortName);
/**
* A [Comparator] that sorts error codes first by their severity (errors
* first, warnings second), and then by the the error code type.
*/
- static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = (AnalysisError o1,
- AnalysisError o2) {
+ static Comparator<AnalysisError> ERROR_CODE_COMPARATOR =
+ (AnalysisError o1, AnalysisError o2) {
ErrorCode errorCode1 = o1.errorCode;
ErrorCode errorCode2 = o2.errorCode;
ErrorSeverity errorSeverity1 = errorCode1.errorSeverity;
@@ -1037,6 +1038,15 @@ class CompileTimeErrorCode extends ErrorCode {
"This class cannot extend the deferred class '{0}'");
/**
+ * DEP 37 extends the syntax for assert() to allow a second "message"
+ * argument. We issue this error if the user tries to supply a "message"
+ * argument but the DEP is not enabled.
+ */
+ static const CompileTimeErrorCode EXTRA_ARGUMENT_TO_ASSERT =
+ const CompileTimeErrorCode('EXTRA_ARGUMENT_TO_ASSERT',
+ "Assertions only accept a single argument");
+
+ /**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt;
* h</i> or if <i>m &gt; n</i>.
*
@@ -1560,7 +1570,8 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the constant that is missing
*/
static const CompileTimeErrorCode MISSING_ENUM_CONSTANT_IN_SWITCH =
- const CompileTimeErrorCode('MISSING_ENUM_CONSTANT_IN_SWITCH',
+ const CompileTimeErrorCode(
+ 'MISSING_ENUM_CONSTANT_IN_SWITCH',
"Missing case clause for '{0}'",
"Add a case clause for the missing constant or add a default clause.");
@@ -1596,7 +1607,8 @@ class CompileTimeErrorCode extends ErrorCode {
* https://code.google.com/p/dart/issues/detail?id=15101#c4
*/
static const CompileTimeErrorCode MIXIN_HAS_NO_CONSTRUCTORS =
- const CompileTimeErrorCode('MIXIN_HAS_NO_CONSTRUCTORS',
+ const CompileTimeErrorCode(
+ 'MIXIN_HAS_NO_CONSTRUCTORS',
"This mixin application is invalid because all of the constructors "
"in the base class '{0}' have optional parameters.");
@@ -2885,7 +2897,8 @@ class HintCode extends ErrorCode {
* Parameters:
* 0: the name of the declared return type
*/
- static const HintCode MISSING_RETURN = const HintCode('MISSING_RETURN',
+ static const HintCode MISSING_RETURN = const HintCode(
+ 'MISSING_RETURN',
"This function declares a return type of '{0}', but does not end with a return statement",
"Either add a return statement or change the return type to 'void'");
@@ -3203,6 +3216,14 @@ class LintCode extends ErrorCode {
*/
class StaticTypeWarningCode extends ErrorCode {
/**
+ * 17.17 Assert: It is a static type warning if the type of s may not be
+ * assigned to String.
+ */
+ static const StaticTypeWarningCode ASSERT_MESSAGE_NON_STRING =
+ const StaticTypeWarningCode('ASSERT_MESSAGE_NON_STRING',
+ "Assertion messages must be assignable to String");
+
+ /**
* 12.7 Lists: A fresh instance (7.6.1) <i>a</i>, of size <i>n</i>, whose
* class implements the built-in class <i>List&lt;E></i> is allocated.
*
@@ -3728,7 +3749,8 @@ class StaticWarningCode extends ErrorCode {
* 2: the name of the second library that the type is found
*/
static const StaticWarningCode AMBIGUOUS_IMPORT = const StaticWarningCode(
- 'AMBIGUOUS_IMPORT', "The name '{0}' is defined in the libraries {1}",
+ 'AMBIGUOUS_IMPORT',
+ "The name '{0}' is defined in the libraries {1}",
"Consider using 'as prefix' for one of the import directives "
"or hiding the name from all but one of the imports.");
« 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