| 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 library engine.parser_test; | 5 library engine.parser_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| (...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2500 expect(AstComparator.equalNodes(modifiedUnit, incrementalUnit), isTrue); | 2500 expect(AstComparator.equalNodes(modifiedUnit, incrementalUnit), isTrue); |
| 2501 // TODO(brianwilkerson) Verify that the errors are correct? | 2501 // TODO(brianwilkerson) Verify that the errors are correct? |
| 2502 } | 2502 } |
| 2503 } | 2503 } |
| 2504 | 2504 |
| 2505 @reflectiveTest | 2505 @reflectiveTest |
| 2506 class NonErrorParserTest extends ParserTestCase { | 2506 class NonErrorParserTest extends ParserTestCase { |
| 2507 void test_constFactory_external() { | 2507 void test_constFactory_external() { |
| 2508 parse("parseClassMember", <Object>["C"], "external const factory C();"); | 2508 parse("parseClassMember", <Object>["C"], "external const factory C();"); |
| 2509 } | 2509 } |
| 2510 |
| 2511 void test_staticMethod_notParsingFunctionBodies() { |
| 2512 ParserTestCase.parseFunctionBodies = false; |
| 2513 try { |
| 2514 parse4("parseCompilationUnit", "class C { static void m() {} }"); |
| 2515 } finally { |
| 2516 ParserTestCase.parseFunctionBodies = true; |
| 2517 } |
| 2518 } |
| 2510 } | 2519 } |
| 2511 | 2520 |
| 2512 class ParserTestCase extends EngineTestCase { | 2521 class ParserTestCase extends EngineTestCase { |
| 2513 /** | 2522 /** |
| 2514 * An empty list of objects used as arguments to zero-argument methods. | 2523 * An empty list of objects used as arguments to zero-argument methods. |
| 2515 */ | 2524 */ |
| 2516 static const List<Object> _EMPTY_ARGUMENTS = const <Object>[]; | 2525 static const List<Object> _EMPTY_ARGUMENTS = const <Object>[]; |
| 2517 | 2526 |
| 2518 /** | 2527 /** |
| 2519 * A flag indicating whether parser is to parse function bodies. | 2528 * A flag indicating whether parser is to parse function bodies. |
| (...skipping 7731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10251 new Scanner(null, new CharSequenceReader(source), listener); | 10260 new Scanner(null, new CharSequenceReader(source), listener); |
| 10252 Token tokenStream = scanner.tokenize(); | 10261 Token tokenStream = scanner.tokenize(); |
| 10253 // | 10262 // |
| 10254 // Parse the source. | 10263 // Parse the source. |
| 10255 // | 10264 // |
| 10256 Parser parser = new Parser(null, listener); | 10265 Parser parser = new Parser(null, listener); |
| 10257 return invokeParserMethodImpl( | 10266 return invokeParserMethodImpl( |
| 10258 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 10267 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
| 10259 } | 10268 } |
| 10260 } | 10269 } |
| OLD | NEW |