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

Side by Side Diff: pkg/front_end/lib/src/fasta/problems.dart

Issue 2765253002: Report error on only-try block. (Closed)
Patch Set: Created 3 years, 9 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/front_end/lib/src/fasta/parser/parser.dart ('k') | pkg/front_end/messages.yaml » ('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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 // NOTE: THIS FILE IS GENERATED. DO NOT EDIT. 5 // NOTE: THIS FILE IS GENERATED. DO NOT EDIT.
6 // 6 //
7 // Instead modify 'pkg/front_end/messages.yaml' and run 7 // Instead modify 'pkg/front_end/messages.yaml' and run
8 // 'pkg/front_end/tool/_fasta/generate_messages.dart' to update. 8 // 'pkg/front_end/tool/_fasta/generate_messages.dart' to update.
9 9
10 library fasta.problems; 10 library fasta.problems;
11 11
12 import 'package:front_end/src/fasta/scanner/token.dart' show Token; 12 import 'package:front_end/src/fasta/scanner/token.dart' show Token;
13 13
14 import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind; 14 import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind;
15 15
16 problemExpectedClassBodyToSkip(Token token) { 16 problemExpectedClassBodyToSkip(Token token) {
17 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 17 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
18 String lexeme = token.lexeme; 18 String lexeme = token.lexeme;
19 return { 19 return {
20 'message': "Expected a class body, but got '$lexeme'.", 20 'message': "Expected a class body, but got '$lexeme'.",
21
22 'code': ErrorKind.ExpectedClassBodyToSkip, 21 'code': ErrorKind.ExpectedClassBodyToSkip,
23 'arguments': { 22 'arguments': {
24 'token': token, 23 'token': token,
25 }, 24 },
26 }; 25 };
27 } 26 }
28 27
29 problemStackOverflow() { 28 problemStackOverflow() {
30 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 29 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
31 30
32 return { 31 return {
33 'message': "Stack overflow.", 32 'message': "Stack overflow.",
34
35 'code': ErrorKind.StackOverflow, 33 'code': ErrorKind.StackOverflow,
36 'arguments': { 34 'arguments': {},
37
38 },
39 }; 35 };
40 } 36 }
41 37
42 problemUnexpectedToken(Token token) { 38 problemUnexpectedToken(Token token) {
43 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 39 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
44 String lexeme = token.lexeme; 40 String lexeme = token.lexeme;
45 return { 41 return {
46 'message': "Unexpected token '$lexeme'.", 42 'message': "Unexpected token '$lexeme'.",
47
48 'code': ErrorKind.UnexpectedToken, 43 'code': ErrorKind.UnexpectedToken,
49 'arguments': { 44 'arguments': {
50 'token': token, 45 'token': token,
51 }, 46 },
52 }; 47 };
53 } 48 }
54 49
55 problemAwaitAsIdentifier() { 50 problemAwaitAsIdentifier() {
56 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 51 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
57 52
58 return { 53 return {
59 'message': "'await' can't be used as an identifier in 'async', 'async*', or 'sync*' methods.", 54 'message':
60 55 "'await' can't be used as an identifier in 'async', 'async*', or 'sync*' methods.",
61 'code': ErrorKind.AwaitAsIdentifier, 56 'code': ErrorKind.AwaitAsIdentifier,
62 'arguments': { 57 'arguments': {},
63
64 },
65 }; 58 };
66 } 59 }
67 60
68 problemFactoryNotSync() { 61 problemFactoryNotSync() {
69 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 62 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
70 63
71 return { 64 return {
72 'message': "Factories can't use 'async', 'async*', or 'sync*'.", 65 'message': "Factories can't use 'async', 'async*', or 'sync*'.",
73
74 'code': ErrorKind.FactoryNotSync, 66 'code': ErrorKind.FactoryNotSync,
75 'arguments': { 67 'arguments': {},
76
77 },
78 }; 68 };
79 } 69 }
80 70
81 problemYieldNotGenerator() { 71 problemYieldNotGenerator() {
82 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 72 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
83 73
84 return { 74 return {
85 'message': "'yield' can only be used in 'sync*' or 'async*' methods.", 75 'message': "'yield' can only be used in 'sync*' or 'async*' methods.",
86
87 'code': ErrorKind.YieldNotGenerator, 76 'code': ErrorKind.YieldNotGenerator,
88 'arguments': { 77 'arguments': {},
89
90 },
91 }; 78 };
92 } 79 }
93 80
94 problemSetterNotSync() { 81 problemSetterNotSync() {
95 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 82 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
96 83
97 return { 84 return {
98 'message': "Setters can't use 'async', 'async*', or 'sync*'.", 85 'message': "Setters can't use 'async', 'async*', or 'sync*'.",
99
100 'code': ErrorKind.SetterNotSync, 86 'code': ErrorKind.SetterNotSync,
101 'arguments': { 87 'arguments': {},
102
103 },
104 }; 88 };
105 } 89 }
106 90
107 problemNonAsciiWhitespace(int codePoint) { 91 problemNonAsciiWhitespace(int codePoint) {
108 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 92 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
109 String unicode = "(U+${codePoint.toRadixString(16).padLeft(4, '0')})"; 93 String unicode = "(U+${codePoint.toRadixString(16).padLeft(4, '0')})";
110 return { 94 return {
111 'message': "The non-ASCII space character $unicode can only be used in strin gs and comments.", 95 'message':
112 96 "The non-ASCII space character $unicode can only be used in strings and comments.",
113 'code': ErrorKind.NonAsciiWhitespace, 97 'code': ErrorKind.NonAsciiWhitespace,
114 'arguments': { 98 'arguments': {
115 'codePoint': codePoint, 99 'codePoint': codePoint,
116 }, 100 },
117 }; 101 };
118 } 102 }
119 103
120 problemExpectedIdentifier(Token token) { 104 problemExpectedIdentifier(Token token) {
121 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 105 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
122 String lexeme = token.lexeme; 106 String lexeme = token.lexeme;
123 return { 107 return {
124 'message': "'$lexeme' is a reserved word and can't be used here.", 108 'message': "'$lexeme' is a reserved word and can't be used here.",
125 'tip': "Try using a different name.", 109 'tip': "Try using a different name.",
126 'code': ErrorKind.ExpectedIdentifier, 110 'code': ErrorKind.ExpectedIdentifier,
127 'arguments': { 111 'arguments': {
128 'token': token, 112 'token': token,
129 }, 113 },
130 }; 114 };
131 } 115 }
132 116
133 problemExpectedBlockToSkip() { 117 problemExpectedBlockToSkip() {
134 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 118 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
135 119
136 return { 120 return {
137 'message': "Expected a function body or '=>'.", 121 'message': "Expected a function body or '=>'.",
138 'tip': "Try adding {}.", 122 'tip': "Try adding {}.",
139 'code': ErrorKind.ExpectedBlockToSkip, 123 'code': ErrorKind.ExpectedBlockToSkip,
140 'arguments': { 124 'arguments': {},
141
142 },
143 }; 125 };
144 } 126 }
145 127
146 problemRequiredParameterWithDefault() { 128 problemRequiredParameterWithDefault() {
147 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 129 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
148 130
149 return { 131 return {
150 'message': "Non-optional parameters can't have a default value.", 132 'message': "Non-optional parameters can't have a default value.",
151 'tip': "Try removing the default value or making the parameter optional.", 133 'tip': "Try removing the default value or making the parameter optional.",
152 'code': ErrorKind.RequiredParameterWithDefault, 134 'code': ErrorKind.RequiredParameterWithDefault,
153 'arguments': { 135 'arguments': {},
154
155 },
156 }; 136 };
157 } 137 }
158 138
159 problemUnspecified() { 139 problemUnspecified(String string) {
160 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 140 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
161 141
162 return { 142 return {
163 'message': "$string", 143 'message': "$string",
164
165 'code': ErrorKind.Unspecified, 144 'code': ErrorKind.Unspecified,
166 'arguments': { 145 'arguments': {
167 146 'string': string,
168 }, 147 },
169 }; 148 };
170 } 149 }
171 150
172 problemMissingExponent() { 151 problemMissingExponent() {
173 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 152 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
174 153
175 return { 154 return {
176 'message': "Numbers in exponential notation should always contain an exponen t (an integer number with an optional sign).", 155 'message':
177 'tip': "Make sure there is an exponent, and remove any whitespace before it. ", 156 "Numbers in exponential notation should always contain an exponent (an i nteger number with an optional sign).",
157 'tip':
158 "Make sure there is an exponent, and remove any whitespace before it.",
178 'code': ErrorKind.MissingExponent, 159 'code': ErrorKind.MissingExponent,
179 'arguments': { 160 'arguments': {},
180
181 },
182 }; 161 };
183 } 162 }
184 163
185 problemPositionalParameterWithEquals() { 164 problemPositionalParameterWithEquals() {
186 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 165 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
187 166
188 return { 167 return {
189 'message': "Positional optional parameters can't use ':' to specify a defaul t value.", 168 'message':
169 "Positional optional parameters can't use ':' to specify a default value .",
190 'tip': "Try replacing ':' with '='.", 170 'tip': "Try replacing ':' with '='.",
191 'code': ErrorKind.PositionalParameterWithEquals, 171 'code': ErrorKind.PositionalParameterWithEquals,
192 'arguments': { 172 'arguments': {},
193
194 },
195 }; 173 };
196 } 174 }
197 175
198 problemUnexpectedDollarInString() { 176 problemUnexpectedDollarInString() {
199 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 177 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
200 178
201 return { 179 return {
202 'message': "A '\$' has special meaning inside a string, and must be followed by an identifier or an expression in curly braces ({}).", 180 'message':
181 "A '\$' has special meaning inside a string, and must be followed by an identifier or an expression in curly braces ({}).",
203 'tip': "Try adding a backslash (\) to escape the '\$'.", 182 'tip': "Try adding a backslash (\) to escape the '\$'.",
204 'code': ErrorKind.UnexpectedDollarInString, 183 'code': ErrorKind.UnexpectedDollarInString,
205 'arguments': { 184 'arguments': {},
206
207 },
208 }; 185 };
209 } 186 }
210 187
211 problemExtraneousModifier(Token token) { 188 problemExtraneousModifier(Token token) {
212 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 189 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
213 String lexeme = token.lexeme; 190 String lexeme = token.lexeme;
214 return { 191 return {
215 'message': "Can't have modifier '$lexeme' here.", 192 'message': "Can't have modifier '$lexeme' here.",
216 'tip': "Try removing '$lexeme'.", 193 'tip': "Try removing '$lexeme'.",
217 'code': ErrorKind.ExtraneousModifier, 194 'code': ErrorKind.ExtraneousModifier,
218 'arguments': { 195 'arguments': {
219 'token': token, 196 'token': token,
220 }, 197 },
221 }; 198 };
222 } 199 }
223 200
224 problemEmptyOptionalParameterList() { 201 problemEmptyOptionalParameterList() {
225 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 202 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
226 203
227 return { 204 return {
228 'message': "Optional parameter lists cannot be empty.", 205 'message': "Optional parameter lists cannot be empty.",
229 'tip': "Try adding an optional parameter to the list.", 206 'tip': "Try adding an optional parameter to the list.",
230 'code': ErrorKind.EmptyOptionalParameterList, 207 'code': ErrorKind.EmptyOptionalParameterList,
231 'arguments': { 208 'arguments': {},
232
233 },
234 }; 209 };
235 } 210 }
236 211
237 problemUnterminatedString(String string) { 212 problemUnterminatedString(String string) {
238 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 213 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
239 214
240 return { 215 return {
241 'message': "String must end with $string.", 216 'message': "String must end with $string.",
242
243 'code': ErrorKind.UnterminatedString, 217 'code': ErrorKind.UnterminatedString,
244 'arguments': { 218 'arguments': {
245 'string': string, 219 'string': string,
246 }, 220 },
247 }; 221 };
248 } 222 }
249 223
250 problemAwaitNotAsync() { 224 problemAwaitNotAsync() {
251 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 225 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
252 226
253 return { 227 return {
254 'message': "'await' can only be used in 'async' or 'async*' methods.", 228 'message': "'await' can only be used in 'async' or 'async*' methods.",
255
256 'code': ErrorKind.AwaitNotAsync, 229 'code': ErrorKind.AwaitNotAsync,
257 'arguments': { 230 'arguments': {},
258
259 },
260 }; 231 };
261 } 232 }
262 233
263 problemExpectedFunctionBody(Token token) { 234 problemExpectedFunctionBody(Token token) {
264 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 235 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
265 String lexeme = token.lexeme; 236 String lexeme = token.lexeme;
266 return { 237 return {
267 'message': "Expected a function body, but got '$lexeme'.", 238 'message': "Expected a function body, but got '$lexeme'.",
268
269 'code': ErrorKind.ExpectedFunctionBody, 239 'code': ErrorKind.ExpectedFunctionBody,
270 'arguments': { 240 'arguments': {
271 'token': token, 241 'token': token,
272 }, 242 },
273 }; 243 };
274 } 244 }
275 245
276 problemExpectedHexDigit() { 246 problemExpectedHexDigit() {
277 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 247 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
278 248
279 return { 249 return {
280 'message': "A hex digit (0-9 or A-F) must follow '0x'.", 250 'message': "A hex digit (0-9 or A-F) must follow '0x'.",
281
282 'code': ErrorKind.ExpectedHexDigit, 251 'code': ErrorKind.ExpectedHexDigit,
283 'arguments': { 252 'arguments': {},
284
285 },
286 }; 253 };
287 } 254 }
288 255
289 problemEmptyNamedParameterList() { 256 problemEmptyNamedParameterList() {
290 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 257 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
291 258
292 return { 259 return {
293 'message': "Named parameter lists cannot be empty.", 260 'message': "Named parameter lists cannot be empty.",
294 'tip': "Try adding a named parameter to the list.", 261 'tip': "Try adding a named parameter to the list.",
295 'code': ErrorKind.EmptyNamedParameterList, 262 'code': ErrorKind.EmptyNamedParameterList,
296 'arguments': { 263 'arguments': {},
297
298 },
299 }; 264 };
300 } 265 }
301 266
302 problemUnsupportedPrefixPlus() { 267 problemUnsupportedPrefixPlus() {
303 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 268 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
304 269
305 return { 270 return {
306 'message': "'+' is not a prefix operator. ", 271 'message': "'+' is not a prefix operator. ",
307 'tip': "Try removing '+'.", 272 'tip': "Try removing '+'.",
308 'code': ErrorKind.UnsupportedPrefixPlus, 273 'code': ErrorKind.UnsupportedPrefixPlus,
309 'arguments': { 274 'arguments': {},
310
311 },
312 }; 275 };
313 } 276 }
314 277
315 problemExpectedString(Token token) { 278 problemExpectedString(Token token) {
316 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 279 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
317 String lexeme = token.lexeme; 280 String lexeme = token.lexeme;
318 return { 281 return {
319 'message': "Expected a String, but got '$lexeme'.", 282 'message': "Expected a String, but got '$lexeme'.",
320
321 'code': ErrorKind.ExpectedString, 283 'code': ErrorKind.ExpectedString,
322 'arguments': { 284 'arguments': {
323 'token': token, 285 'token': token,
324 }, 286 },
325 }; 287 };
326 } 288 }
327 289
328 problemAbstractNotSync() { 290 problemAbstractNotSync() {
329 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 291 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
330 292
331 return { 293 return {
332 'message': "Abstract methods can't use 'async', 'async*', or 'sync*'.", 294 'message': "Abstract methods can't use 'async', 'async*', or 'sync*'.",
333
334 'code': ErrorKind.AbstractNotSync, 295 'code': ErrorKind.AbstractNotSync,
335 'arguments': { 296 'arguments': {},
336
337 },
338 }; 297 };
339 } 298 }
340 299
341 problemExpectedDeclaration(Token token) { 300 problemExpectedDeclaration(Token token) {
342 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 301 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
343 String lexeme = token.lexeme; 302 String lexeme = token.lexeme;
344 return { 303 return {
345 'message': "Expected a declaration, but got '$lexeme'.", 304 'message': "Expected a declaration, but got '$lexeme'.",
346
347 'code': ErrorKind.ExpectedDeclaration, 305 'code': ErrorKind.ExpectedDeclaration,
348 'arguments': { 306 'arguments': {
349 'token': token, 307 'token': token,
350 }, 308 },
351 }; 309 };
352 } 310 }
353 311
354 problemAsciiControlCharacter(int codePoint) { 312 problemAsciiControlCharacter(int codePoint) {
355 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 313 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
356 String unicode = "(U+${codePoint.toRadixString(16).padLeft(4, '0')})"; 314 String unicode = "(U+${codePoint.toRadixString(16).padLeft(4, '0')})";
357 return { 315 return {
358 'message': "The control character $unicode can only be used in strings and c omments.", 316 'message':
359 317 "The control character $unicode can only be used in strings and comments .",
360 'code': ErrorKind.AsciiControlCharacter, 318 'code': ErrorKind.AsciiControlCharacter,
361 'arguments': { 319 'arguments': {
362 'codePoint': codePoint, 320 'codePoint': codePoint,
363 }, 321 },
364 }; 322 };
365 } 323 }
366 324
367 problemUnmatchedToken(String string, Token token) { 325 problemUnmatchedToken(String string, Token token) {
368 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 326 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
369 String lexeme = token.lexeme; 327 String lexeme = token.lexeme;
370 return { 328 return {
371 'message': "Can't find '$string' to match '$lexeme'.", 329 'message': "Can't find '$string' to match '$lexeme'.",
372
373 'code': ErrorKind.UnmatchedToken, 330 'code': ErrorKind.UnmatchedToken,
374 'arguments': { 331 'arguments': {
375 'string': string, 332 'string': string,
376 'token': token, 333 'token': token,
377 }, 334 },
378 }; 335 };
379 } 336 }
380 337
381 problemInvalidSyncModifier() { 338 problemInvalidSyncModifier() {
382 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 339 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
383 340
384 return { 341 return {
385 'message': "Invalid modifier 'sync'.", 342 'message': "Invalid modifier 'sync'.",
386 'tip': "Try replacing 'sync' with 'sync*'.", 343 'tip': "Try replacing 'sync' with 'sync*'.",
387 'code': ErrorKind.InvalidSyncModifier, 344 'code': ErrorKind.InvalidSyncModifier,
388 'arguments': { 345 'arguments': {},
389
390 },
391 }; 346 };
392 } 347 }
393 348
394 problemExpectedOpenParens() { 349 problemExpectedOpenParens() {
395 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 350 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
396 351
397 return { 352 return {
398 'message': "Expected '('.", 353 'message': "Expected '('.",
399
400 'code': ErrorKind.ExpectedOpenParens, 354 'code': ErrorKind.ExpectedOpenParens,
401 'arguments': { 355 'arguments': {},
402
403 },
404 }; 356 };
405 } 357 }
406 358
407 problemUnterminatedComment() { 359 problemUnterminatedComment() {
408 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 360 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
409 361
410 return { 362 return {
411 'message': "Comment starting with '/*' must end with '*/'.", 363 'message': "Comment starting with '/*' must end with '*/'.",
412
413 'code': ErrorKind.UnterminatedComment, 364 'code': ErrorKind.UnterminatedComment,
414 'arguments': { 365 'arguments': {},
415
416 },
417 }; 366 };
418 } 367 }
419 368
420 problemExpectedClassBody(Token token) { 369 problemExpectedClassBody(Token token) {
421 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 370 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
422 String lexeme = token.lexeme; 371 String lexeme = token.lexeme;
423 return { 372 return {
424 'message': "Expected a class body, but got '$lexeme'.", 373 'message': "Expected a class body, but got '$lexeme'.",
425
426 'code': ErrorKind.ExpectedClassBody, 374 'code': ErrorKind.ExpectedClassBody,
427 'arguments': { 375 'arguments': {
428 'token': token, 376 'token': token,
429 }, 377 },
430 }; 378 };
431 } 379 }
432 380
433 problemExpectedExpression(Token token) { 381 problemExpectedExpression(Token token) {
434 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 382 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
435 String lexeme = token.lexeme; 383 String lexeme = token.lexeme;
436 return { 384 return {
437 'message': "Expected an expression, but got '$lexeme'.", 385 'message': "Expected an expression, but got '$lexeme'.",
438
439 'code': ErrorKind.ExpectedExpression, 386 'code': ErrorKind.ExpectedExpression,
440 'arguments': { 387 'arguments': {
441 'token': token, 388 'token': token,
442 }, 389 },
443 }; 390 };
444 } 391 }
445 392
446 problemInvalidAwaitFor() { 393 problemInvalidAwaitFor() {
447 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 394 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
448 395
449 return { 396 return {
450 'message': "'await' is only supported in methods with an 'async' or 'async*' body modifier.", 397 'message':
451 'tip': "Try adding 'async' or 'async*' to the method body or removing the 'a wait' keyword.", 398 "'await' is only supported in methods with an 'async' or 'async*' body m odifier.",
399 'tip':
400 "Try adding 'async' or 'async*' to the method body or removing the 'awai t' keyword.",
452 'code': ErrorKind.InvalidAwaitFor, 401 'code': ErrorKind.InvalidAwaitFor,
453 'arguments': { 402 'arguments': {},
454
455 },
456 }; 403 };
457 } 404 }
458 405
459 problemExpectedType(Token token) { 406 problemExpectedType(Token token) {
460 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 407 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
461 String lexeme = token.lexeme; 408 String lexeme = token.lexeme;
462 return { 409 return {
463 'message': "Expected a type, but got '$lexeme'.", 410 'message': "Expected a type, but got '$lexeme'.",
464
465 'code': ErrorKind.ExpectedType, 411 'code': ErrorKind.ExpectedType,
466 'arguments': { 412 'arguments': {
467 'token': token, 413 'token': token,
468 }, 414 },
469 }; 415 };
470 } 416 }
471 417
472 problemUnterminatedToken() { 418 problemUnterminatedToken() {
473 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 419 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
474 420
475 return { 421 return {
476 'message': "Incomplete token.", 422 'message': "Incomplete token.",
477
478 'code': ErrorKind.UnterminatedToken, 423 'code': ErrorKind.UnterminatedToken,
479 'arguments': { 424 'arguments': {},
480
481 },
482 }; 425 };
483 } 426 }
484 427
485 problemExpectedButGot(Token token) { 428 problemExpectedButGot(Token token) {
486 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 429 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
487 String lexeme = token.lexeme; 430 String lexeme = token.lexeme;
488 return { 431 return {
489 'message': "Expected '$lexeme' before this.", 432 'message': "Expected '$lexeme' before this.",
490 'tip': "DONT_KNOW_HOW_TO_FIX,", 433 'tip': "DONT_KNOW_HOW_TO_FIX,",
491 'code': ErrorKind.ExpectedButGot, 434 'code': ErrorKind.ExpectedButGot,
492 'arguments': { 435 'arguments': {
493 'token': token, 436 'token': token,
494 }, 437 },
495 }; 438 };
496 } 439 }
497 440
498 problemAwaitForNotAsync() { 441 problemAwaitForNotAsync() {
499 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 442 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
500 443
501 return { 444 return {
502 'message': "Asynchronous for-loop can only be used in 'async' or 'async*' me thods.", 445 'message':
503 446 "Asynchronous for-loop can only be used in 'async' or 'async*' methods." ,
504 'code': ErrorKind.AwaitForNotAsync, 447 'code': ErrorKind.AwaitForNotAsync,
505 'arguments': { 448 'arguments': {},
506
507 },
508 }; 449 };
509 } 450 }
510 451
511 problemEncoding() { 452 problemEncoding() {
512 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 453 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
513 454
514 return { 455 return {
515 'message': "Unable to decode bytes as UTF-8.", 456 'message': "Unable to decode bytes as UTF-8.",
516
517 'code': ErrorKind.Encoding, 457 'code': ErrorKind.Encoding,
518 'arguments': { 458 'arguments': {},
519
520 },
521 }; 459 };
522 } 460 }
523 461
524 problemAsyncAsIdentifier() { 462 problemAsyncAsIdentifier() {
525 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 463 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
526 464
527 return { 465 return {
528 'message': "'async' can't be used as an identifier in 'async', 'async*', or 'sync*' methods.", 466 'message':
529 467 "'async' can't be used as an identifier in 'async', 'async*', or 'sync*' methods.",
530 'code': ErrorKind.AsyncAsIdentifier, 468 'code': ErrorKind.AsyncAsIdentifier,
531 'arguments': { 469 'arguments': {},
532
533 },
534 }; 470 };
535 } 471 }
536 472
537 problemYieldAsIdentifier() { 473 problemYieldAsIdentifier() {
538 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 474 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
539 475
540 return { 476 return {
541 'message': "'yield' can't be used as an identifier in 'async', 'async*', or 'sync*' methods.", 477 'message':
542 478 "'yield' can't be used as an identifier in 'async', 'async*', or 'sync*' methods.",
543 'code': ErrorKind.YieldAsIdentifier, 479 'code': ErrorKind.YieldAsIdentifier,
544 'arguments': { 480 'arguments': {},
545 481 };
546 }, 482 }
483
484 problemOnlyTry() {
485 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
486
487 return {
488 'message':
489 "Try block should be followed by 'on', 'catch', or 'finally' block.",
490 'tip': "Did you forget to add a 'finally' block?",
491 'code': ErrorKind.OnlyTry,
492 'arguments': {},
547 }; 493 };
548 } 494 }
549 495
550 problemInvalidInlineFunctionType() { 496 problemInvalidInlineFunctionType() {
551 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 497 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
552 498
553 return { 499 return {
554 'message': "Invalid inline function type.", 500 'message': "Invalid inline function type.",
555 'tip': "Try changing the inline function type (as in 'int f()') to a prefixe d function type using the `Function` keyword (as in 'int Function() f').", 501 'tip':
502 "Try changing the inline function type (as in 'int f()') to a prefixed f unction type using the `Function` keyword (as in 'int Function() f').",
556 'code': ErrorKind.InvalidInlineFunctionType, 503 'code': ErrorKind.InvalidInlineFunctionType,
557 'arguments': { 504 'arguments': {},
558
559 },
560 }; 505 };
561 } 506 }
562 507
563 problemExpectedBody() { 508 problemExpectedBody() {
564 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 509 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
565 510
566 return { 511 return {
567 'message': "Expected a function body or '=>'.", 512 'message': "Expected a function body or '=>'.",
568 'tip': "Try adding {}.", 513 'tip': "Try adding {}.",
569 'code': ErrorKind.ExpectedBody, 514 'code': ErrorKind.ExpectedBody,
570 'arguments': { 515 'arguments': {},
571
572 },
573 }; 516 };
574 } 517 }
575 518
576 problemInvalidVoid() { 519 problemInvalidVoid() {
577 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 520 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
578 521
579 return { 522 return {
580 'message': "Type 'void' can't be used here because it isn't a return type.", 523 'message': "Type 'void' can't be used here because it isn't a return type.",
581 'tip': "Try removing 'void' keyword or replace it with 'var', 'final', or a type.", 524 'tip':
525 "Try removing 'void' keyword or replace it with 'var', 'final', or a typ e.",
582 'code': ErrorKind.InvalidVoid, 526 'code': ErrorKind.InvalidVoid,
583 'arguments': { 527 'arguments': {},
584
585 },
586 }; 528 };
587 } 529 }
588 530
589 problemBuiltInIdentifierAsType(Token token) { 531 problemBuiltInIdentifierAsType(Token token) {
590 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 532 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
591 String lexeme = token.lexeme; 533 String lexeme = token.lexeme;
592 return { 534 return {
593 'message': "Can't use '$lexeme' as a type.", 535 'message': "Can't use '$lexeme' as a type.",
594
595 'code': ErrorKind.BuiltInIdentifierAsType, 536 'code': ErrorKind.BuiltInIdentifierAsType,
596 'arguments': { 537 'arguments': {
597 'token': token, 538 'token': token,
598 }, 539 },
599 }; 540 };
600 } 541 }
601 542
602 problemGeneratorReturnsValue() { 543 problemGeneratorReturnsValue() {
603 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 544 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
604 545
605 return { 546 return {
606 'message': "'sync*' and 'async*' can't return a value.", 547 'message': "'sync*' and 'async*' can't return a value.",
607
608 'code': ErrorKind.GeneratorReturnsValue, 548 'code': ErrorKind.GeneratorReturnsValue,
609 'arguments': { 549 'arguments': {},
610
611 },
612 }; 550 };
613 } 551 }
614 552
615 problemBuiltInIdentifierInDeclaration(Token token) { 553 problemBuiltInIdentifierInDeclaration(Token token) {
616 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 554 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
617 String lexeme = token.lexeme; 555 String lexeme = token.lexeme;
618 return { 556 return {
619 'message': "Can't use '$lexeme' as a name here.", 557 'message': "Can't use '$lexeme' as a name here.",
620
621 'code': ErrorKind.BuiltInIdentifierInDeclaration, 558 'code': ErrorKind.BuiltInIdentifierInDeclaration,
622 'arguments': { 559 'arguments': {
623 'token': token, 560 'token': token,
624 }, 561 },
625 }; 562 };
626 } 563 }
627 564
628 problemNonAsciiIdentifier(String character, int codePoint) { 565 problemNonAsciiIdentifier(String character, int codePoint) {
629 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 566 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
630 String unicode = "(U+${codePoint.toRadixString(16).padLeft(4, '0')})"; 567 String unicode = "(U+${codePoint.toRadixString(16).padLeft(4, '0')})";
631 return { 568 return {
632 'message': "The non-ASCII character '$character' ($unicode) can't be used in identifiers, only in strings and comments.", 569 'message':
633 'tip': "Try using an US-ASCII letter, a digit, '_' (an underscore), or '\$' (a dollar sign).", 570 "The non-ASCII character '$character' ($unicode) can't be used in identi fiers, only in strings and comments.",
571 'tip':
572 "Try using an US-ASCII letter, a digit, '_' (an underscore), or '\$' (a dollar sign).",
634 'code': ErrorKind.NonAsciiIdentifier, 573 'code': ErrorKind.NonAsciiIdentifier,
635 'arguments': { 574 'arguments': {
636 'character': character, 575 'character': character,
637 'codePoint': codePoint, 576 'codePoint': codePoint,
638 }, 577 },
639 }; 578 };
640 } 579 }
641 580
642 problemExtraneousModifierReplace(Token token) { 581 problemExtraneousModifierReplace(Token token) {
643 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 582 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
644 String lexeme = token.lexeme; 583 String lexeme = token.lexeme;
645 return { 584 return {
646 'message': "Can't have modifier '$lexeme' here.", 585 'message': "Can't have modifier '$lexeme' here.",
647 'tip': "Try replacing modifier '$lexeme' with 'var', 'final', or a type.", 586 'tip': "Try replacing modifier '$lexeme' with 'var', 'final', or a type.",
648 'code': ErrorKind.ExtraneousModifierReplace, 587 'code': ErrorKind.ExtraneousModifierReplace,
649 'arguments': { 588 'arguments': {
650 'token': token, 589 'token': token,
651 }, 590 },
652 }; 591 };
653 } 592 }
654
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/parser.dart ('k') | pkg/front_end/messages.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698