| OLD | NEW |
| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.parser_test; | 8 library engine.parser_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| (...skipping 3177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3188 * @return the compilation unit that was parsed | 3188 * @return the compilation unit that was parsed |
| 3189 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do | 3189 * @throws Exception if the source could not be parsed, if the compilation err
ors in the source do |
| 3190 * not match those that are expected, or if the result would have be
en `null` | 3190 * not match those that are expected, or if the result would have be
en `null` |
| 3191 */ | 3191 */ |
| 3192 static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> err
orCodes) { | 3192 static CompilationUnit parseCompilationUnit(String source, List<ErrorCode> err
orCodes) { |
| 3193 GatheringErrorListener listener = new GatheringErrorListener(); | 3193 GatheringErrorListener listener = new GatheringErrorListener(); |
| 3194 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener
); | 3194 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener
); |
| 3195 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 3195 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 3196 Token token = scanner.tokenize(); | 3196 Token token = scanner.tokenize(); |
| 3197 Parser parser = new Parser(null, listener); | 3197 Parser parser = new Parser(null, listener); |
| 3198 parser.parseDeferredLibraries = true; |
| 3198 CompilationUnit unit = parser.parseCompilationUnit(token); | 3199 CompilationUnit unit = parser.parseCompilationUnit(token); |
| 3199 JUnitTestCase.assertNotNull(unit); | 3200 JUnitTestCase.assertNotNull(unit); |
| 3200 listener.assertErrorsWithCodes(errorCodes); | 3201 listener.assertErrorsWithCodes(errorCodes); |
| 3201 return unit; | 3202 return unit; |
| 3202 } | 3203 } |
| 3203 | 3204 |
| 3204 /** | 3205 /** |
| 3205 * Parse the given source as an expression. | 3206 * Parse the given source as an expression. |
| 3206 * | 3207 * |
| 3207 * @param source the source to be parsed | 3208 * @param source the source to be parsed |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3287 // Scan the source. | 3288 // Scan the source. |
| 3288 // | 3289 // |
| 3289 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener
); | 3290 Scanner scanner = new Scanner(null, new CharSequenceReader(source), listener
); |
| 3290 Token tokenStream = scanner.tokenize(); | 3291 Token tokenStream = scanner.tokenize(); |
| 3291 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 3292 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 3292 // | 3293 // |
| 3293 // Parse the source. | 3294 // Parse the source. |
| 3294 // | 3295 // |
| 3295 Parser parser = new Parser(null, listener); | 3296 Parser parser = new Parser(null, listener); |
| 3296 parser.parseFunctionBodies = parseFunctionBodies; | 3297 parser.parseFunctionBodies = parseFunctionBodies; |
| 3298 parser.parseDeferredLibraries = true; |
| 3297 Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStr
eam); | 3299 Object result = invokeParserMethodImpl(parser, methodName, objects, tokenStr
eam); |
| 3298 // | 3300 // |
| 3299 // Partially test the results. | 3301 // Partially test the results. |
| 3300 // | 3302 // |
| 3301 if (!listener.hasErrors) { | 3303 if (!listener.hasErrors) { |
| 3302 JUnitTestCase.assertNotNull(result); | 3304 JUnitTestCase.assertNotNull(result); |
| 3303 } | 3305 } |
| 3304 return result; | 3306 return result; |
| 3305 } | 3307 } |
| 3306 | 3308 |
| (...skipping 8652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11959 | 11961 |
| 11960 main() { | 11962 main() { |
| 11961 ComplexParserTest.dartSuite(); | 11963 ComplexParserTest.dartSuite(); |
| 11962 ErrorParserTest.dartSuite(); | 11964 ErrorParserTest.dartSuite(); |
| 11963 IncrementalParserTest.dartSuite(); | 11965 IncrementalParserTest.dartSuite(); |
| 11964 NonErrorParserTest.dartSuite(); | 11966 NonErrorParserTest.dartSuite(); |
| 11965 RecoveryParserTest.dartSuite(); | 11967 RecoveryParserTest.dartSuite(); |
| 11966 ResolutionCopierTest.dartSuite(); | 11968 ResolutionCopierTest.dartSuite(); |
| 11967 SimpleParserTest.dartSuite(); | 11969 SimpleParserTest.dartSuite(); |
| 11968 } | 11970 } |
| OLD | NEW |