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

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

Issue 2628973003: Add preliminary parser support for generic function types (Closed)
Patch Set: Created 3 years, 11 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/error/error.dart ('k') | pkg/analyzer/lib/src/generated/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
index 594ba19dfa09aa2bb362a9aed9205815742ad8c4..18fef4cb1080f9546e80018da3cea0a2f7ff98ca 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
@@ -142,11 +142,11 @@ class ParserErrorCode extends ErrorCode {
"A continue statement in a switch statement must have a label as a target.",
"Try adding a label associated with one of the case clauses to the continue statement.");
- static const ParserErrorCode DEPRECATED_CLASS_TYPE_ALIAS =
+ static const ParserErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE =
const ParserErrorCode(
- 'DEPRECATED_CLASS_TYPE_ALIAS',
- "The 'typedef' mixin application was replaced with 'class'.",
- "Try re-writing the typedef as 'class C = S with M'.");
+ 'DEFAULT_VALUE_IN_FUNCTION_TYPE',
+ "Parameters in a function type cannot have default values",
+ "Try removing the default value.");
static const ParserErrorCode DIRECTIVE_AFTER_DECLARATION =
const ParserErrorCode(
@@ -523,18 +523,17 @@ class ParserErrorCode extends ErrorCode {
"A function body must be provided.",
"Try adding a function body.");
+ static const ParserErrorCode MISSING_FUNCTION_KEYWORD = const ParserErrorCode(
+ 'MISSING_FUNCTION_KEYWORD',
+ "Function types must have the keyword 'Function' before the parameter list.",
+ "Try adding the keyword 'Function'.");
+
static const ParserErrorCode MISSING_FUNCTION_PARAMETERS =
const ParserErrorCode(
'MISSING_FUNCTION_PARAMETERS',
"Functions must have an explicit list of parameters.",
"Try adding a parameter list.");
- static const ParserErrorCode MISSING_METHOD_PARAMETERS =
- const ParserErrorCode(
- 'MISSING_METHOD_PARAMETERS',
- "Methods must have an explicit list of parameters.",
- "Try adding a parameter list.");
-
static const ParserErrorCode MISSING_GET = const ParserErrorCode(
'MISSING_GET',
"Getters must have the keyword 'get' before the getter name.",
@@ -551,6 +550,18 @@ class ParserErrorCode extends ErrorCode {
"Operator declarations must be preceeded by the keyword 'operator'.",
"Try adding the keyword 'operator'.");
+ static const ParserErrorCode MISSING_METHOD_PARAMETERS =
+ const ParserErrorCode(
+ 'MISSING_METHOD_PARAMETERS',
+ "Methods must have an explicit list of parameters.",
+ "Try adding a parameter list.");
+
+ static const ParserErrorCode MISSING_NAME_FOR_NAMED_PARAMETER =
+ const ParserErrorCode(
+ 'MISSING_NAME_FOR_NAMED_PARAMETER',
+ "Named parameters in a function type must have a name",
+ "Try providing a name for the parameter or removing the curly braces.");
+
static const ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE =
const ParserErrorCode(
'MISSING_NAME_IN_LIBRARY_DIRECTIVE',
@@ -661,6 +672,11 @@ class ParserErrorCode extends ErrorCode {
"Try removing the name, or "
"moving the function expression to a function declaration statement.");
+ static const ParserErrorCode NAMED_FUNCTION_TYPE = const ParserErrorCode(
+ 'NAMED_FUNCTION_TYPE',
+ "Function types can't be named.",
+ "Try replacing the name with the keyword 'Function'.");
+
static const ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP =
const ParserErrorCode(
'NAMED_PARAMETER_OUTSIDE_GROUP',
« no previous file with comments | « pkg/analyzer/lib/error/error.dart ('k') | pkg/analyzer/lib/src/generated/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698