| 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 5601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5612 expect(expression, isNotNull); | 5612 expect(expression, isNotNull); |
| 5613 assertNoErrors(); | 5613 assertNoErrors(); |
| 5614 var methodInvocation = expression as MethodInvocation; | 5614 var methodInvocation = expression as MethodInvocation; |
| 5615 expect(methodInvocation.target, isNotNull); | 5615 expect(methodInvocation.target, isNotNull); |
| 5616 expect(methodInvocation.operator.type, TokenType.PERIOD); | 5616 expect(methodInvocation.operator.type, TokenType.PERIOD); |
| 5617 expect(methodInvocation.methodName, isNotNull); | 5617 expect(methodInvocation.methodName, isNotNull); |
| 5618 expect(methodInvocation.typeArguments, isNull); | 5618 expect(methodInvocation.typeArguments, isNull); |
| 5619 expect(methodInvocation.argumentList, isNotNull); | 5619 expect(methodInvocation.argumentList, isNotNull); |
| 5620 } | 5620 } |
| 5621 | 5621 |
| 5622 void test_namedArgument() { |
| 5623 var invocation = parseExpression('m(a: 1, b: 2)') as MethodInvocation; |
| 5624 List<Expression> arguments = invocation.argumentList.arguments; |
| 5625 |
| 5626 var a = arguments[0] as NamedExpression; |
| 5627 expect(a.name.label.name, 'a'); |
| 5628 expect(a.expression, isNotNull); |
| 5629 |
| 5630 var b = arguments[1] as NamedExpression; |
| 5631 expect(b.name.label.name, 'b'); |
| 5632 expect(b.expression, isNotNull); |
| 5633 } |
| 5634 |
| 5622 void test_parsePostfixExpression_none_methodInvocation_question_dot() { | 5635 void test_parsePostfixExpression_none_methodInvocation_question_dot() { |
| 5623 Expression expression = parsePostfixExpression('a?.m()'); | 5636 Expression expression = parsePostfixExpression('a?.m()'); |
| 5624 expect(expression, isNotNull); | 5637 expect(expression, isNotNull); |
| 5625 assertNoErrors(); | 5638 assertNoErrors(); |
| 5626 var methodInvocation = expression as MethodInvocation; | 5639 var methodInvocation = expression as MethodInvocation; |
| 5627 expect(methodInvocation.target, isNotNull); | 5640 expect(methodInvocation.target, isNotNull); |
| 5628 expect(methodInvocation.operator.type, TokenType.QUESTION_PERIOD); | 5641 expect(methodInvocation.operator.type, TokenType.QUESTION_PERIOD); |
| 5629 expect(methodInvocation.methodName, isNotNull); | 5642 expect(methodInvocation.methodName, isNotNull); |
| 5630 expect(methodInvocation.typeArguments, isNull); | 5643 expect(methodInvocation.typeArguments, isNull); |
| 5631 expect(methodInvocation.argumentList, isNotNull); | 5644 expect(methodInvocation.argumentList, isNotNull); |
| (...skipping 9135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14767 expectCommentText(typeVariable.documentationComment, '/// Doc'); | 14780 expectCommentText(typeVariable.documentationComment, '/// Doc'); |
| 14768 } | 14781 } |
| 14769 | 14782 |
| 14770 /** | 14783 /** |
| 14771 * Assert that the given [name] is in declaration context. | 14784 * Assert that the given [name] is in declaration context. |
| 14772 */ | 14785 */ |
| 14773 void _assertIsDeclarationName(SimpleIdentifier name) { | 14786 void _assertIsDeclarationName(SimpleIdentifier name) { |
| 14774 expect(name.inDeclarationContext(), isTrue); | 14787 expect(name.inDeclarationContext(), isTrue); |
| 14775 } | 14788 } |
| 14776 } | 14789 } |
| OLD | NEW |