OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'parser_helper.dart'; | 6 import 'parser_helper.dart'; |
7 import 'package:compiler/src/tree/tree.dart'; | 7 import 'package:compiler/src/tree/tree.dart'; |
8 | 8 |
9 void testStatement(String statement) { | 9 void testStatement(String statement) { |
10 Node node = parseStatement(statement); | 10 Node node = parseStatement(statement); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 class Collector extends DiagnosticReporter { | 299 class Collector extends DiagnosticReporter { |
300 int token = -1; | 300 int token = -1; |
301 | 301 |
302 void reportFatalError(Token token) { | 302 void reportFatalError(Token token) { |
303 this.token = token.kind; | 303 this.token = token.kind; |
304 throw this; | 304 throw this; |
305 } | 305 } |
306 | 306 |
307 void reportError(DiagnosticMessage message, | 307 void reportError(DiagnosticMessage message, |
308 [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) { | 308 [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) { |
309 reportFatalError(message.spannable); | 309 assert(token != -1); |
| 310 throw this; |
| 311 } |
| 312 |
| 313 spanFromToken(Token token) { |
| 314 this.token = token.kind; |
310 } | 315 } |
311 | 316 |
312 void log(message) { | 317 void log(message) { |
313 print(message); | 318 print(message); |
314 } | 319 } |
315 | 320 |
316 noSuchMethod(Invocation invocation) { | 321 noSuchMethod(Invocation invocation) { |
317 throw 'unsupported operation'; | 322 throw 'unsupported operation'; |
318 } | 323 } |
319 | 324 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 testConditionalExpression(); | 385 testConditionalExpression(); |
381 testNullOperators(); | 386 testNullOperators(); |
382 testAssignment(); | 387 testAssignment(); |
383 testIndex(); | 388 testIndex(); |
384 testPostfix(); | 389 testPostfix(); |
385 testOperatorParse(); | 390 testOperatorParse(); |
386 testMissingCloseParen(); | 391 testMissingCloseParen(); |
387 testMissingCloseBraceInClass(); | 392 testMissingCloseBraceInClass(); |
388 testUnmatchedAngleBracket(); | 393 testUnmatchedAngleBracket(); |
389 } | 394 } |
OLD | NEW |