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

Side by Side Diff: pkg/analyzer/lib/src/dart/error/syntactic_errors.dart

Issue 2639883005: Add parser support for covariant parameters (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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/error/error.dart ('k') | pkg/analyzer/lib/src/error/codes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * The errors produced during syntactic analysis (scanning and parsing). 6 * The errors produced during syntactic analysis (scanning and parsing).
7 */ 7 */
8 library analyzer.src.dart.error.syntactic_errors; 8 library analyzer.src.dart.error.syntactic_errors;
9 9
10 import 'package:analyzer/error/error.dart'; 10 import 'package:analyzer/error/error.dart';
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 static const ParserErrorCode CLASS_IN_CLASS = const ParserErrorCode( 75 static const ParserErrorCode CLASS_IN_CLASS = const ParserErrorCode(
76 'CLASS_IN_CLASS', 76 'CLASS_IN_CLASS',
77 "Classes can't be declared inside other classes.", 77 "Classes can't be declared inside other classes.",
78 "Try moving the class to the top-level."); 78 "Try moving the class to the top-level.");
79 79
80 static const ParserErrorCode COLON_IN_PLACE_OF_IN = const ParserErrorCode( 80 static const ParserErrorCode COLON_IN_PLACE_OF_IN = const ParserErrorCode(
81 'COLON_IN_PLACE_OF_IN', 81 'COLON_IN_PLACE_OF_IN',
82 "For-in loops use 'in' rather than a colon.", 82 "For-in loops use 'in' rather than a colon.",
83 "Try replacing the colon with the keyword 'in'."); 83 "Try replacing the colon with the keyword 'in'.");
84 84
85 static const ParserErrorCode CONST_AND_COVARIANT = const ParserErrorCode(
86 'CONST_AND_COVARIANT',
87 "Members can't be declared to be both 'const' and 'covariant'.",
88 "Try removing either the 'const' or 'covariant' keyword.");
89
85 static const ParserErrorCode CONST_AND_FINAL = const ParserErrorCode( 90 static const ParserErrorCode CONST_AND_FINAL = const ParserErrorCode(
86 'CONST_AND_FINAL', 91 'CONST_AND_FINAL',
87 "Members can't be declared to be both 'const' and 'final'.", 92 "Members can't be declared to be both 'const' and 'final'.",
88 "Try removing either the 'const' or 'final' keyword."); 93 "Try removing either the 'const' or 'final' keyword.");
89 94
90 static const ParserErrorCode CONST_AND_VAR = const ParserErrorCode( 95 static const ParserErrorCode CONST_AND_VAR = const ParserErrorCode(
91 'CONST_AND_VAR', 96 'CONST_AND_VAR',
92 "Members can't be declared to be both 'const' and 'var'.", 97 "Members can't be declared to be both 'const' and 'var'.",
93 "Try removing either the 'const' or 'var' keyword."); 98 "Try removing either the 'const' or 'var' keyword.");
94 99
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 static const ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = const ParserErrorCode( 140 static const ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = const ParserErrorCode(
136 'CONTINUE_OUTSIDE_OF_LOOP', 141 'CONTINUE_OUTSIDE_OF_LOOP',
137 "A continue statement can't be used outside of a loop or switch statement. ", 142 "A continue statement can't be used outside of a loop or switch statement. ",
138 "Try removing the continue statement."); 143 "Try removing the continue statement.");
139 144
140 static const ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = const ParserErro rCode( 145 static const ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = const ParserErro rCode(
141 'CONTINUE_WITHOUT_LABEL_IN_CASE', 146 'CONTINUE_WITHOUT_LABEL_IN_CASE',
142 "A continue statement in a switch statement must have a label as a target. ", 147 "A continue statement in a switch statement must have a label as a target. ",
143 "Try adding a label associated with one of the case clauses to the continu e statement."); 148 "Try adding a label associated with one of the case clauses to the continu e statement.");
144 149
150 static const ParserErrorCode COVARIANT_AFTER_VAR = const ParserErrorCode(
151 'COVARIANT_AFTER_VAR',
152 "The modifier 'covariant' should be before the modifier 'var'.",
153 "Try re-ordering the modifiers.");
154
155 static const ParserErrorCode COVARIANT_AND_STATIC = const ParserErrorCode(
156 'COVARIANT_AND_STATIC',
157 "Members can't be declared to be both 'covariant' and 'static'.",
158 "Try removing either the 'covariant' or 'static' keyword.");
159
160 static const ParserErrorCode COVARIANT_TOP_LEVEL_DECLARATION =
161 const ParserErrorCode(
162 'COVARIANT_TOP_LEVEL_DECLARATION',
163 "Top-level declarations can't be declared to be covariant.",
164 "Try removing the keyword 'covariant'.");
165
166 static const ParserErrorCode COVARIANT_CONSTRUCTOR = const ParserErrorCode(
167 'COVARIANT_CONSTRUCTOR',
168 "A constructor can't be declared to be 'covariant'.",
169 "Try removing the keyword 'covariant'.");
170
145 static const ParserErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE = 171 static const ParserErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE =
146 const ParserErrorCode( 172 const ParserErrorCode(
147 'DEFAULT_VALUE_IN_FUNCTION_TYPE', 173 'DEFAULT_VALUE_IN_FUNCTION_TYPE',
148 "Parameters in a function type cannot have default values", 174 "Parameters in a function type cannot have default values",
149 "Try removing the default value."); 175 "Try removing the default value.");
150 176
151 static const ParserErrorCode DIRECTIVE_AFTER_DECLARATION = 177 static const ParserErrorCode DIRECTIVE_AFTER_DECLARATION =
152 const ParserErrorCode( 178 const ParserErrorCode(
153 'DIRECTIVE_AFTER_DECLARATION', 179 'DIRECTIVE_AFTER_DECLARATION',
154 "Directives must appear before any declarations.", 180 "Directives must appear before any declarations.",
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 'FACTORY_WITHOUT_BODY', 341 'FACTORY_WITHOUT_BODY',
316 "A non-redirecting 'factory' constructor must have a body.", 342 "A non-redirecting 'factory' constructor must have a body.",
317 "Try adding a body to the constructor."); 343 "Try adding a body to the constructor.");
318 344
319 static const ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = 345 static const ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR =
320 const ParserErrorCode( 346 const ParserErrorCode(
321 'FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 347 'FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR',
322 "Field formal parameters can only be used in a constructor.", 348 "Field formal parameters can only be used in a constructor.",
323 "Try replacing the field formal parameter with a normal parameter."); 349 "Try replacing the field formal parameter with a normal parameter.");
324 350
351 static const ParserErrorCode FINAL_AND_COVARIANT = const ParserErrorCode(
352 'FINAL_AND_COVARIANT',
353 "Members can't be declared to be both 'final' and 'covariant'.",
354 "Try removing either the 'final' or 'covariant' keyword.");
355
325 static const ParserErrorCode FINAL_AND_VAR = const ParserErrorCode( 356 static const ParserErrorCode FINAL_AND_VAR = const ParserErrorCode(
326 'FINAL_AND_VAR', 357 'FINAL_AND_VAR',
327 "Members can't be declared to be both 'final' and 'var'.", 358 "Members can't be declared to be both 'final' and 'var'.",
328 "Try removing the keyword 'var'."); 359 "Try removing the keyword 'var'.");
329 360
330 static const ParserErrorCode FINAL_CLASS = const ParserErrorCode( 361 static const ParserErrorCode FINAL_CLASS = const ParserErrorCode(
331 'FINAL_CLASS', 362 'FINAL_CLASS',
332 "Classes can't be declared to be 'final'.", 363 "Classes can't be declared to be 'final'.",
333 "Try removing the keyword 'final'."); 364 "Try removing the keyword 'final'.");
334 365
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 */ 981 */
951 const ParserErrorCode(String name, String message, [String correction]) 982 const ParserErrorCode(String name, String message, [String correction])
952 : super(name, message, correction); 983 : super(name, message, correction);
953 984
954 @override 985 @override
955 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; 986 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
956 987
957 @override 988 @override
958 ErrorType get type => ErrorType.SYNTACTIC_ERROR; 989 ErrorType get type => ErrorType.SYNTACTIC_ERROR;
959 } 990 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/error/error.dart ('k') | pkg/analyzer/lib/src/error/codes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698