| 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/error.dart'; | 9 import 'package:analyzer/src/generated/error.dart'; |
| 10 import 'package:analyzer/src/generated/incremental_scanner.dart'; | 10 import 'package:analyzer/src/generated/incremental_scanner.dart'; |
| (...skipping 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2597 } | 2597 } |
| 2598 | 2598 |
| 2599 void test_insert_final_before_field_declaration() { | 2599 void test_insert_final_before_field_declaration() { |
| 2600 _assertParse('class C { ', '', 'final ', 'int x; }'); | 2600 _assertParse('class C { ', '', 'final ', 'int x; }'); |
| 2601 } | 2601 } |
| 2602 | 2602 |
| 2603 void test_insert_function_parameter() { | 2603 void test_insert_function_parameter() { |
| 2604 _assertParse('class C { void f(', '', 'arg', ') {} }'); | 2604 _assertParse('class C { void f(', '', 'arg', ') {} }'); |
| 2605 } | 2605 } |
| 2606 | 2606 |
| 2607 void test_insert_identifier_inCombinator() { |
| 2608 _assertParse("import 'foo.dart' show x", "", ", y", ";"); |
| 2609 } |
| 2610 |
| 2607 void test_insert_insideClassBody() { | 2611 void test_insert_insideClassBody() { |
| 2608 // "class C {C(); }" | 2612 // "class C {C(); }" |
| 2609 // "class C { C(); }" | 2613 // "class C { C(); }" |
| 2610 _assertParse("class C {", "", " ", "C(); }"); | 2614 _assertParse("class C {", "", " ", "C(); }"); |
| 2611 } | 2615 } |
| 2612 | 2616 |
| 2613 void test_insert_insideIdentifier() { | 2617 void test_insert_insideIdentifier() { |
| 2614 // "f() => cob;" | 2618 // "f() => cob;" |
| 2615 // "f() => cow.b;" | 2619 // "f() => cow.b;" |
| 2616 _assertParse("f() => co", "", "w.", "b;"); | 2620 _assertParse("f() => co", "", "w.", "b;"); |
| (...skipping 3879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6496 expect(classTypeAlias.keyword, isNotNull); | 6500 expect(classTypeAlias.keyword, isNotNull); |
| 6497 expect(classTypeAlias.name.name, "A"); | 6501 expect(classTypeAlias.name.name, "A"); |
| 6498 expect(classTypeAlias.equals, isNotNull); | 6502 expect(classTypeAlias.equals, isNotNull); |
| 6499 expect(classTypeAlias.abstractKeyword, isNull); | 6503 expect(classTypeAlias.abstractKeyword, isNull); |
| 6500 expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B"); | 6504 expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B"); |
| 6501 expect(classTypeAlias.withClause, isNotNull); | 6505 expect(classTypeAlias.withClause, isNotNull); |
| 6502 expect(classTypeAlias.implementsClause, isNotNull); | 6506 expect(classTypeAlias.implementsClause, isNotNull); |
| 6503 expect(classTypeAlias.semicolon, isNotNull); | 6507 expect(classTypeAlias.semicolon, isNotNull); |
| 6504 } | 6508 } |
| 6505 | 6509 |
| 6510 void test_parseCombinator_hide() { |
| 6511 HideCombinator combinator = |
| 6512 ParserTestCase.parse4('parseCombinator', 'hide a;'); |
| 6513 expect(combinator, new isInstanceOf<HideCombinator>()); |
| 6514 expect(combinator.keyword, isNotNull); |
| 6515 expect(combinator.hiddenNames, hasLength(1)); |
| 6516 } |
| 6517 |
| 6518 void test_parseCombinator_show() { |
| 6519 ShowCombinator combinator = |
| 6520 ParserTestCase.parse4('parseCombinator', 'show a;'); |
| 6521 expect(combinator, new isInstanceOf<ShowCombinator>()); |
| 6522 expect(combinator.keyword, isNotNull); |
| 6523 expect(combinator.shownNames, hasLength(1)); |
| 6524 } |
| 6525 |
| 6506 void test_parseCombinators_h() { | 6526 void test_parseCombinators_h() { |
| 6507 List<Combinator> combinators = | 6527 List<Combinator> combinators = |
| 6508 ParserTestCase.parse4("parseCombinators", "hide a;"); | 6528 ParserTestCase.parse4("parseCombinators", "hide a;"); |
| 6509 expect(combinators, hasLength(1)); | 6529 expect(combinators, hasLength(1)); |
| 6510 HideCombinator combinator = combinators[0] as HideCombinator; | 6530 HideCombinator combinator = combinators[0] as HideCombinator; |
| 6511 expect(combinator, isNotNull); | 6531 expect(combinator, isNotNull); |
| 6512 expect(combinator.keyword, isNotNull); | 6532 expect(combinator.keyword, isNotNull); |
| 6513 expect(combinator.hiddenNames, hasLength(1)); | 6533 expect(combinator.hiddenNames, hasLength(1)); |
| 6514 } | 6534 } |
| 6515 | 6535 |
| (...skipping 4322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10838 // Parse the source. | 10858 // Parse the source. |
| 10839 // | 10859 // |
| 10840 Parser parser = new Parser(null, listener); | 10860 Parser parser = new Parser(null, listener); |
| 10841 return invokeParserMethodImpl( | 10861 return invokeParserMethodImpl( |
| 10842 parser, | 10862 parser, |
| 10843 methodName, | 10863 methodName, |
| 10844 <Object>[tokenStream], | 10864 <Object>[tokenStream], |
| 10845 tokenStream) as Token; | 10865 tokenStream) as Token; |
| 10846 } | 10866 } |
| 10847 } | 10867 } |
| OLD | NEW |