| 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/standard_ast_factory.dart'; | 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
| 9 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
| 10 import 'package:analyzer/dart/ast/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 10647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10658 void test_parseConstructorName_unnamed_prefixed() { | 10658 void test_parseConstructorName_unnamed_prefixed() { |
| 10659 createParser('p.A;'); | 10659 createParser('p.A;'); |
| 10660 ConstructorName name = parser.parseConstructorName(); | 10660 ConstructorName name = parser.parseConstructorName(); |
| 10661 expectNotNullIfNoErrors(name); | 10661 expectNotNullIfNoErrors(name); |
| 10662 listener.assertNoErrors(); | 10662 listener.assertNoErrors(); |
| 10663 expect(name.type, isNotNull); | 10663 expect(name.type, isNotNull); |
| 10664 expect(name.period, isNull); | 10664 expect(name.period, isNull); |
| 10665 expect(name.name, isNull); | 10665 expect(name.name, isNull); |
| 10666 } | 10666 } |
| 10667 | 10667 |
| 10668 void test_parseContinueStatement_label() { | |
| 10669 createParser('continue foo;'); | |
| 10670 ContinueStatement statement = parser.parseContinueStatement(); | |
| 10671 expectNotNullIfNoErrors(statement); | |
| 10672 listener.assertErrorsWithCodes([ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]); | |
| 10673 expect(statement.continueKeyword, isNotNull); | |
| 10674 expect(statement.label, isNotNull); | |
| 10675 expect(statement.semicolon, isNotNull); | |
| 10676 } | |
| 10677 | |
| 10678 void test_parseContinueStatement_noLabel() { | |
| 10679 createParser('continue;'); | |
| 10680 ContinueStatement statement = parser.parseContinueStatement(); | |
| 10681 expectNotNullIfNoErrors(statement); | |
| 10682 listener.assertErrorsWithCodes([ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]); | |
| 10683 expect(statement.continueKeyword, isNotNull); | |
| 10684 expect(statement.label, isNull); | |
| 10685 expect(statement.semicolon, isNotNull); | |
| 10686 } | |
| 10687 | |
| 10688 void test_parseDocumentationComment_block() { | 10668 void test_parseDocumentationComment_block() { |
| 10689 createParser('/** */ class'); | 10669 createParser('/** */ class'); |
| 10690 Comment comment = parser | 10670 Comment comment = parser |
| 10691 .parseDocumentationComment(parser.parseDocumentationCommentTokens()); | 10671 .parseDocumentationComment(parser.parseDocumentationCommentTokens()); |
| 10692 expectNotNullIfNoErrors(comment); | 10672 expectNotNullIfNoErrors(comment); |
| 10693 listener.assertNoErrors(); | 10673 listener.assertNoErrors(); |
| 10694 expect(comment.isBlock, isFalse); | 10674 expect(comment.isBlock, isFalse); |
| 10695 expect(comment.isDocumentation, isTrue); | 10675 expect(comment.isDocumentation, isTrue); |
| 10696 expect(comment.isEndOfLine, isFalse); | 10676 expect(comment.isEndOfLine, isFalse); |
| 10697 } | 10677 } |
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12207 } | 12187 } |
| 12208 | 12188 |
| 12209 void test_parseBreakStatement_noLabel() { | 12189 void test_parseBreakStatement_noLabel() { |
| 12210 var statement = parseStatement('break;') as BreakStatement; | 12190 var statement = parseStatement('break;') as BreakStatement; |
| 12211 assertErrorsWithCodes([ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]); | 12191 assertErrorsWithCodes([ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]); |
| 12212 expect(statement.breakKeyword, isNotNull); | 12192 expect(statement.breakKeyword, isNotNull); |
| 12213 expect(statement.label, isNull); | 12193 expect(statement.label, isNull); |
| 12214 expect(statement.semicolon, isNotNull); | 12194 expect(statement.semicolon, isNotNull); |
| 12215 } | 12195 } |
| 12216 | 12196 |
| 12197 void test_parseContinueStatement_label() { |
| 12198 var statement = parseStatement('continue foo;') as ContinueStatement; |
| 12199 assertErrorsWithCodes([ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]); |
| 12200 expect(statement.continueKeyword, isNotNull); |
| 12201 expect(statement.label, isNotNull); |
| 12202 expect(statement.semicolon, isNotNull); |
| 12203 } |
| 12204 |
| 12205 void test_parseContinueStatement_noLabel() { |
| 12206 var statement = parseStatement('continue;') as ContinueStatement; |
| 12207 assertErrorsWithCodes([ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]); |
| 12208 expect(statement.continueKeyword, isNotNull); |
| 12209 expect(statement.label, isNull); |
| 12210 expect(statement.semicolon, isNotNull); |
| 12211 } |
| 12212 |
| 12217 void test_parseDoStatement() { | 12213 void test_parseDoStatement() { |
| 12218 var statement = parseStatement('do {} while (x);') as DoStatement; | 12214 var statement = parseStatement('do {} while (x);') as DoStatement; |
| 12219 assertNoErrors(); | 12215 assertNoErrors(); |
| 12220 expect(statement.doKeyword, isNotNull); | 12216 expect(statement.doKeyword, isNotNull); |
| 12221 expect(statement.body, isNotNull); | 12217 expect(statement.body, isNotNull); |
| 12222 expect(statement.whileKeyword, isNotNull); | 12218 expect(statement.whileKeyword, isNotNull); |
| 12223 expect(statement.leftParenthesis, isNotNull); | 12219 expect(statement.leftParenthesis, isNotNull); |
| 12224 expect(statement.condition, isNotNull); | 12220 expect(statement.condition, isNotNull); |
| 12225 expect(statement.rightParenthesis, isNotNull); | 12221 expect(statement.rightParenthesis, isNotNull); |
| 12226 expect(statement.semicolon, isNotNull); | 12222 expect(statement.semicolon, isNotNull); |
| (...skipping 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14733 expectCommentText(typeAlias.documentationComment, '/// Doc'); | 14729 expectCommentText(typeAlias.documentationComment, '/// Doc'); |
| 14734 } | 14730 } |
| 14735 | 14731 |
| 14736 /** | 14732 /** |
| 14737 * Assert that the given [name] is in declaration context. | 14733 * Assert that the given [name] is in declaration context. |
| 14738 */ | 14734 */ |
| 14739 void _assertIsDeclarationName(SimpleIdentifier name) { | 14735 void _assertIsDeclarationName(SimpleIdentifier name) { |
| 14740 expect(name.inDeclarationContext(), isTrue); | 14736 expect(name.inDeclarationContext(), isTrue); |
| 14741 } | 14737 } |
| 14742 } | 14738 } |
| OLD | NEW |