OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library fasta.stack_listener; | 5 library fasta.stack_listener; |
6 | 6 |
7 import '../parser.dart' show ErrorKind, Listener; | 7 import '../fasta_codes.dart' show FastaMessage; |
| 8 |
| 9 import '../parser.dart' show Listener; |
8 | 10 |
9 import '../parser/identifier_context.dart' show IdentifierContext; | 11 import '../parser/identifier_context.dart' show IdentifierContext; |
10 | 12 |
11 import '../scanner.dart' show BeginGroupToken, Token; | 13 import '../scanner.dart' show BeginGroupToken, Token; |
12 | 14 |
13 import 'package:kernel/ast.dart' show AsyncMarker; | 15 import 'package:kernel/ast.dart' show AsyncMarker; |
14 | 16 |
15 import '../errors.dart' show inputError, internalError; | 17 import '../errors.dart' show inputError, internalError; |
16 | 18 |
17 import '../quote.dart' show unescapeString; | 19 import '../quote.dart' show unescapeString; |
(...skipping 27 matching lines...) Expand all Loading... |
45 Type, | 47 Type, |
46 TypeArguments, | 48 TypeArguments, |
47 TypeList, | 49 TypeList, |
48 TypeVariable, | 50 TypeVariable, |
49 TypeVariables, | 51 TypeVariables, |
50 } | 52 } |
51 | 53 |
52 abstract class StackListener extends Listener { | 54 abstract class StackListener extends Listener { |
53 final Stack stack = new Stack(); | 55 final Stack stack = new Stack(); |
54 | 56 |
| 57 @override |
55 Uri get uri; | 58 Uri get uri; |
56 | 59 |
57 // TODO(ahe): This doesn't belong here. Only implemented by body_builder.dart | 60 // TODO(ahe): This doesn't belong here. Only implemented by body_builder.dart |
58 // and ast_builder.dart. | 61 // and ast_builder.dart. |
59 void finishFunction( | 62 void finishFunction( |
60 covariant formals, AsyncMarker asyncModifier, covariant body) { | 63 covariant formals, AsyncMarker asyncModifier, covariant body) { |
61 return internalError("Unsupported operation"); | 64 return internalError("Unsupported operation"); |
62 } | 65 } |
63 | 66 |
64 // TODO(ahe): This doesn't belong here. Only implemented by body_builder.dart | 67 // TODO(ahe): This doesn't belong here. Only implemented by body_builder.dart |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 void handleRecoverExpression(Token token) { | 234 void handleRecoverExpression(Token token) { |
232 debugEvent("RecoverExpression"); | 235 debugEvent("RecoverExpression"); |
233 } | 236 } |
234 | 237 |
235 @override | 238 @override |
236 void endCatchClause(Token token) { | 239 void endCatchClause(Token token) { |
237 debugEvent("CatchClause"); | 240 debugEvent("CatchClause"); |
238 } | 241 } |
239 | 242 |
240 @override | 243 @override |
241 void handleRecoverableError(Token token, ErrorKind kind, Map arguments) { | 244 void handleRecoverableError(Token token, FastaMessage message) { |
242 super.handleRecoverableError(token, kind, arguments); | 245 debugEvent("Error: ${message.message}"); |
243 debugEvent("Error: ${recoverableErrors.last}"); | 246 super.handleRecoverableError(token, message); |
244 } | 247 } |
245 | 248 |
246 @override | 249 @override |
247 Token handleUnrecoverableError(Token token, ErrorKind kind, Map arguments) { | 250 Token handleUnrecoverableError(Token token, FastaMessage message) { |
248 throw inputError(uri, token.charOffset, "$kind $arguments"); | 251 throw inputError(uri, token.charOffset, message.message); |
249 } | 252 } |
250 | 253 |
251 void nit(String message, [int charOffset = -1]) { | 254 void nit(String message, [int charOffset = -1]) { |
252 messages.nit(uri, charOffset, message); | 255 messages.nit(uri, charOffset, message); |
253 } | 256 } |
254 | 257 |
255 void warning(String message, [int charOffset = -1]) { | 258 void warning(String message, [int charOffset = -1]) { |
256 messages.warning(uri, charOffset, message); | 259 messages.warning(uri, charOffset, message); |
257 } | 260 } |
258 } | 261 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 list.setRange(0, arrayLength, array); | 309 list.setRange(0, arrayLength, array); |
307 return list; | 310 return list; |
308 } | 311 } |
309 | 312 |
310 void _grow() { | 313 void _grow() { |
311 final List newTable = new List(array.length * 2); | 314 final List newTable = new List(array.length * 2); |
312 newTable.setRange(0, array.length, array, 0); | 315 newTable.setRange(0, array.length, array, 0); |
313 array = newTable; | 316 array = newTable; |
314 } | 317 } |
315 } | 318 } |
OLD | NEW |