| 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 analyzer.test.generated.parser_test; | 5 library analyzer.test.generated.parser_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
| 10 import 'package:analyzer/src/dart/ast/token.dart'; | 10 import 'package:analyzer/src/dart/ast/token.dart'; |
| (...skipping 6103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6114 ShowCombinator combinator = combinators[0] as ShowCombinator; | 6114 ShowCombinator combinator = combinators[0] as ShowCombinator; |
| 6115 expect(combinator, isNotNull); | 6115 expect(combinator, isNotNull); |
| 6116 expect(combinator.keyword, isNotNull); | 6116 expect(combinator.keyword, isNotNull); |
| 6117 expect(combinator.shownNames, hasLength(1)); | 6117 expect(combinator.shownNames, hasLength(1)); |
| 6118 } | 6118 } |
| 6119 | 6119 |
| 6120 void test_parseCommentAndMetadata_c() { | 6120 void test_parseCommentAndMetadata_c() { |
| 6121 CommentAndMetadata commentAndMetadata = | 6121 CommentAndMetadata commentAndMetadata = |
| 6122 parse4("parseCommentAndMetadata", "/** 1 */ void"); | 6122 parse4("parseCommentAndMetadata", "/** 1 */ void"); |
| 6123 expect(commentAndMetadata.comment, isNotNull); | 6123 expect(commentAndMetadata.comment, isNotNull); |
| 6124 expect(commentAndMetadata.metadata, hasLength(0)); | 6124 expect(commentAndMetadata.metadata, isNull); |
| 6125 } | 6125 } |
| 6126 | 6126 |
| 6127 void test_parseCommentAndMetadata_cmc() { | 6127 void test_parseCommentAndMetadata_cmc() { |
| 6128 CommentAndMetadata commentAndMetadata = | 6128 CommentAndMetadata commentAndMetadata = |
| 6129 parse4("parseCommentAndMetadata", "/** 1 */ @A /** 2 */ void"); | 6129 parse4("parseCommentAndMetadata", "/** 1 */ @A /** 2 */ void"); |
| 6130 expect(commentAndMetadata.comment, isNotNull); | 6130 expect(commentAndMetadata.comment, isNotNull); |
| 6131 expect(commentAndMetadata.metadata, hasLength(1)); | 6131 expect(commentAndMetadata.metadata, hasLength(1)); |
| 6132 } | 6132 } |
| 6133 | 6133 |
| 6134 void test_parseCommentAndMetadata_cmcm() { | 6134 void test_parseCommentAndMetadata_cmcm() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6170 CommentAndMetadata commentAndMetadata = | 6170 CommentAndMetadata commentAndMetadata = |
| 6171 parse4("parseCommentAndMetadata", "@A @B(x) void"); | 6171 parse4("parseCommentAndMetadata", "@A @B(x) void"); |
| 6172 expect(commentAndMetadata.comment, isNull); | 6172 expect(commentAndMetadata.comment, isNull); |
| 6173 expect(commentAndMetadata.metadata, hasLength(2)); | 6173 expect(commentAndMetadata.metadata, hasLength(2)); |
| 6174 } | 6174 } |
| 6175 | 6175 |
| 6176 void test_parseCommentAndMetadata_none() { | 6176 void test_parseCommentAndMetadata_none() { |
| 6177 CommentAndMetadata commentAndMetadata = | 6177 CommentAndMetadata commentAndMetadata = |
| 6178 parse4("parseCommentAndMetadata", "void"); | 6178 parse4("parseCommentAndMetadata", "void"); |
| 6179 expect(commentAndMetadata.comment, isNull); | 6179 expect(commentAndMetadata.comment, isNull); |
| 6180 expect(commentAndMetadata.metadata, hasLength(0)); | 6180 expect(commentAndMetadata.metadata, isNull); |
| 6181 } | 6181 } |
| 6182 | 6182 |
| 6183 void test_parseCommentAndMetadata_singleLine() { | 6183 void test_parseCommentAndMetadata_singleLine() { |
| 6184 CommentAndMetadata commentAndMetadata = parse4( | 6184 CommentAndMetadata commentAndMetadata = parse4( |
| 6185 "parseCommentAndMetadata", | 6185 "parseCommentAndMetadata", |
| 6186 r''' | 6186 r''' |
| 6187 /// 1 | 6187 /// 1 |
| 6188 /// 2 | 6188 /// 2 |
| 6189 void'''); | 6189 void'''); |
| 6190 expect(commentAndMetadata.comment, isNotNull); | 6190 expect(commentAndMetadata.comment, isNotNull); |
| 6191 expect(commentAndMetadata.metadata, hasLength(0)); | 6191 expect(commentAndMetadata.metadata, isNull); |
| 6192 } | 6192 } |
| 6193 | 6193 |
| 6194 void test_parseCommentReference_new_prefixed() { | 6194 void test_parseCommentReference_new_prefixed() { |
| 6195 CommentReference reference = | 6195 CommentReference reference = |
| 6196 parse("parseCommentReference", <Object>["new a.b", 7], ""); | 6196 parse("parseCommentReference", <Object>["new a.b", 7], ""); |
| 6197 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf( | 6197 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf( |
| 6198 (obj) => obj is PrefixedIdentifier, | 6198 (obj) => obj is PrefixedIdentifier, |
| 6199 PrefixedIdentifier, | 6199 PrefixedIdentifier, |
| 6200 reference.identifier); | 6200 reference.identifier); |
| 6201 SimpleIdentifier prefix = prefixedIdentifier.prefix; | 6201 SimpleIdentifier prefix = prefixedIdentifier.prefix; |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6992 EngineTestCase.assertInstanceOf( | 6992 EngineTestCase.assertInstanceOf( |
| 6993 (obj) => obj is ParenthesizedExpression, | 6993 (obj) => obj is ParenthesizedExpression, |
| 6994 ParenthesizedExpression, | 6994 ParenthesizedExpression, |
| 6995 (initializer as ConstructorFieldInitializer).expression); | 6995 (initializer as ConstructorFieldInitializer).expression); |
| 6996 EngineTestCase.assertInstanceOf( | 6996 EngineTestCase.assertInstanceOf( |
| 6997 (obj) => obj is BlockFunctionBody, BlockFunctionBody, constructor.body); | 6997 (obj) => obj is BlockFunctionBody, BlockFunctionBody, constructor.body); |
| 6998 } | 6998 } |
| 6999 | 6999 |
| 7000 void test_parseConstructorFieldInitializer_qualified() { | 7000 void test_parseConstructorFieldInitializer_qualified() { |
| 7001 ConstructorFieldInitializer invocation = | 7001 ConstructorFieldInitializer invocation = |
| 7002 parse4("parseConstructorFieldInitializer", "this.a = b"); | 7002 parse2("parseConstructorFieldInitializer", [true], "this.a = b"); |
| 7003 expect(invocation.equals, isNotNull); | 7003 expect(invocation.equals, isNotNull); |
| 7004 expect(invocation.expression, isNotNull); | 7004 expect(invocation.expression, isNotNull); |
| 7005 expect(invocation.fieldName, isNotNull); | 7005 expect(invocation.fieldName, isNotNull); |
| 7006 expect(invocation.thisKeyword, isNotNull); | 7006 expect(invocation.thisKeyword, isNotNull); |
| 7007 expect(invocation.period, isNotNull); | 7007 expect(invocation.period, isNotNull); |
| 7008 } | 7008 } |
| 7009 | 7009 |
| 7010 void test_parseConstructorFieldInitializer_unqualified() { | 7010 void test_parseConstructorFieldInitializer_unqualified() { |
| 7011 ConstructorFieldInitializer invocation = | 7011 ConstructorFieldInitializer invocation = |
| 7012 parse4("parseConstructorFieldInitializer", "a = b"); | 7012 parse2("parseConstructorFieldInitializer", [false], "a = b"); |
| 7013 expect(invocation.equals, isNotNull); | 7013 expect(invocation.equals, isNotNull); |
| 7014 expect(invocation.expression, isNotNull); | 7014 expect(invocation.expression, isNotNull); |
| 7015 expect(invocation.fieldName, isNotNull); | 7015 expect(invocation.fieldName, isNotNull); |
| 7016 expect(invocation.thisKeyword, isNull); | 7016 expect(invocation.thisKeyword, isNull); |
| 7017 expect(invocation.period, isNull); | 7017 expect(invocation.period, isNull); |
| 7018 } | 7018 } |
| 7019 | 7019 |
| 7020 void test_parseConstructorName_named_noPrefix() { | 7020 void test_parseConstructorName_named_noPrefix() { |
| 7021 ConstructorName name = parse4("parseConstructorName", "A.n;"); | 7021 ConstructorName name = parse4("parseConstructorName", "A.n;"); |
| 7022 expect(name.type, isNotNull); | 7022 expect(name.type, isNotNull); |
| (...skipping 2661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9684 expect(literal.literal, isNotNull); | 9684 expect(literal.literal, isNotNull); |
| 9685 expect(literal.value, isTrue); | 9685 expect(literal.value, isTrue); |
| 9686 } | 9686 } |
| 9687 | 9687 |
| 9688 void test_Parser() { | 9688 void test_Parser() { |
| 9689 expect(new Parser(null, null), isNotNull); | 9689 expect(new Parser(null, null), isNotNull); |
| 9690 } | 9690 } |
| 9691 | 9691 |
| 9692 void test_parseRedirectingConstructorInvocation_named() { | 9692 void test_parseRedirectingConstructorInvocation_named() { |
| 9693 RedirectingConstructorInvocation invocation = | 9693 RedirectingConstructorInvocation invocation = |
| 9694 parse4("parseRedirectingConstructorInvocation", "this.a()"); | 9694 parse2("parseRedirectingConstructorInvocation", [true], "this.a()"); |
| 9695 expect(invocation.argumentList, isNotNull); | 9695 expect(invocation.argumentList, isNotNull); |
| 9696 expect(invocation.constructorName, isNotNull); | 9696 expect(invocation.constructorName, isNotNull); |
| 9697 expect(invocation.thisKeyword, isNotNull); | 9697 expect(invocation.thisKeyword, isNotNull); |
| 9698 expect(invocation.period, isNotNull); | 9698 expect(invocation.period, isNotNull); |
| 9699 } | 9699 } |
| 9700 | 9700 |
| 9701 void test_parseRedirectingConstructorInvocation_unnamed() { | 9701 void test_parseRedirectingConstructorInvocation_unnamed() { |
| 9702 RedirectingConstructorInvocation invocation = | 9702 RedirectingConstructorInvocation invocation = |
| 9703 parse4("parseRedirectingConstructorInvocation", "this()"); | 9703 parse2("parseRedirectingConstructorInvocation", [false], "this()"); |
| 9704 expect(invocation.argumentList, isNotNull); | 9704 expect(invocation.argumentList, isNotNull); |
| 9705 expect(invocation.constructorName, isNull); | 9705 expect(invocation.constructorName, isNull); |
| 9706 expect(invocation.thisKeyword, isNotNull); | 9706 expect(invocation.thisKeyword, isNotNull); |
| 9707 expect(invocation.period, isNull); | 9707 expect(invocation.period, isNull); |
| 9708 } | 9708 } |
| 9709 | 9709 |
| 9710 void test_parseRelationalExpression_as() { | 9710 void test_parseRelationalExpression_as() { |
| 9711 AsExpression expression = parse4("parseRelationalExpression", "x as Y"); | 9711 AsExpression expression = parse4("parseRelationalExpression", "x as Y"); |
| 9712 expect(expression.expression, isNotNull); | 9712 expect(expression.expression, isNotNull); |
| 9713 expect(expression.asOperator, isNotNull); | 9713 expect(expression.asOperator, isNotNull); |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11173 new Scanner(null, new CharSequenceReader(source), listener); | 11173 new Scanner(null, new CharSequenceReader(source), listener); |
| 11174 Token tokenStream = scanner.tokenize(); | 11174 Token tokenStream = scanner.tokenize(); |
| 11175 // | 11175 // |
| 11176 // Parse the source. | 11176 // Parse the source. |
| 11177 // | 11177 // |
| 11178 Parser parser = new Parser(null, listener); | 11178 Parser parser = new Parser(null, listener); |
| 11179 return invokeParserMethodImpl( | 11179 return invokeParserMethodImpl( |
| 11180 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 11180 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
| 11181 } | 11181 } |
| 11182 } | 11182 } |
| OLD | NEW |