OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 test_utils; | 5 library test_utils; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 | 8 |
9 import 'package:analyzer_experimental/src/generated/java_core.dart' show CharSeq
uence; | 9 import 'package:analyzer/src/generated/java_core.dart' show CharSequence; |
10 import 'package:analyzer_experimental/src/generated/engine.dart' show AnalysisCo
ntext, AnalysisContextImpl; | 10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext, Analys
isContextImpl; |
11 import 'package:analyzer_experimental/src/generated/source.dart'; | 11 import 'package:analyzer/src/generated/source.dart'; |
12 import 'package:analyzer_experimental/src/generated/error.dart'; | 12 import 'package:analyzer/src/generated/error.dart'; |
13 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 13 import 'package:analyzer/src/generated/scanner.dart'; |
14 import 'package:analyzer_experimental/src/generated/ast.dart'; | 14 import 'package:analyzer/src/generated/ast.dart'; |
15 import 'package:analyzer_experimental/src/generated/parser.dart'; | 15 import 'package:analyzer/src/generated/parser.dart'; |
16 | 16 |
17 | 17 |
18 /// Instances of the class [_GatheringErrorListener] implement an error listener | 18 /// Instances of the class [_GatheringErrorListener] implement an error listener |
19 /// that collects all of the errors passed to it for later examination. | 19 /// that collects all of the errors passed to it for later examination. |
20 class _GatheringErrorListener implements AnalysisErrorListener { | 20 class _GatheringErrorListener implements AnalysisErrorListener { |
21 | 21 |
22 /// The source being parsed. | 22 /// The source being parsed. |
23 String _rawSource; | 23 String _rawSource; |
24 | 24 |
25 /// The source being parsed after inserting a marker at the beginning and end | 25 /// The source being parsed after inserting a marker at the beginning and end |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 var parser = new Parser(null, listener); | 206 var parser = new Parser(null, listener); |
207 var statement = parser.parseStatement(token); | 207 var statement = parser.parseStatement(token); |
208 expect(statement, isNotNull); | 208 expect(statement, isNotNull); |
209 | 209 |
210 if (expectedErrorCodes != null) { | 210 if (expectedErrorCodes != null) { |
211 listener.expectErrors(expectedErrorCodes); | 211 listener.expectErrors(expectedErrorCodes); |
212 } | 212 } |
213 | 213 |
214 return statement; | 214 return statement; |
215 } | 215 } |
OLD | NEW |