| 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 12974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12985 _parseAsyncStatement('yield x;', isGenerator: true) as YieldStatement; | 12985 _parseAsyncStatement('yield x;', isGenerator: true) as YieldStatement; |
| 12986 assertNoErrors(); | 12986 assertNoErrors(); |
| 12987 expect(statement.yieldKeyword, isNotNull); | 12987 expect(statement.yieldKeyword, isNotNull); |
| 12988 expect(statement.star, isNull); | 12988 expect(statement.star, isNull); |
| 12989 expect(statement.expression, isNotNull); | 12989 expect(statement.expression, isNotNull); |
| 12990 expect(statement.semicolon, isNotNull); | 12990 expect(statement.semicolon, isNotNull); |
| 12991 } | 12991 } |
| 12992 | 12992 |
| 12993 Statement _parseAsyncStatement(String code, {bool isGenerator: false}) { | 12993 Statement _parseAsyncStatement(String code, {bool isGenerator: false}) { |
| 12994 var star = isGenerator ? '*' : ''; | 12994 var star = isGenerator ? '*' : ''; |
| 12995 var localFunction = parseStatement('wrapper() async$star { $code };') | 12995 var localFunction = parseStatement('wrapper() async$star { $code }') |
| 12996 as FunctionDeclarationStatement; | 12996 as FunctionDeclarationStatement; |
| 12997 var localBody = localFunction.functionDeclaration.functionExpression.body | 12997 var localBody = localFunction.functionDeclaration.functionExpression.body |
| 12998 as BlockFunctionBody; | 12998 as BlockFunctionBody; |
| 12999 return localBody.block.statements.single; | 12999 return localBody.block.statements.single; |
| 13000 } | 13000 } |
| 13001 } | 13001 } |
| 13002 | 13002 |
| 13003 @reflectiveTest | 13003 @reflectiveTest |
| 13004 class TopLevelParserTest extends ParserTestCase with TopLevelParserTestMixin {} | 13004 class TopLevelParserTest extends ParserTestCase with TopLevelParserTestMixin {} |
| 13005 | 13005 |
| (...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14772 expectCommentText(typeVariable.documentationComment, '/// Doc'); | 14772 expectCommentText(typeVariable.documentationComment, '/// Doc'); |
| 14773 } | 14773 } |
| 14774 | 14774 |
| 14775 /** | 14775 /** |
| 14776 * Assert that the given [name] is in declaration context. | 14776 * Assert that the given [name] is in declaration context. |
| 14777 */ | 14777 */ |
| 14778 void _assertIsDeclarationName(SimpleIdentifier name) { | 14778 void _assertIsDeclarationName(SimpleIdentifier name) { |
| 14779 expect(name.inDeclarationContext(), isTrue); | 14779 expect(name.inDeclarationContext(), isTrue); |
| 14780 } | 14780 } |
| 14781 } | 14781 } |
| OLD | NEW |