| 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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 expect(constructor.redirectedConstructor, isNull); | 1057 expect(constructor.redirectedConstructor, isNull); |
| 1058 | 1058 |
| 1059 var body = constructor.body as ExpressionFunctionBody; | 1059 var body = constructor.body as ExpressionFunctionBody; |
| 1060 expect(body.keyword, isNull); | 1060 expect(body.keyword, isNull); |
| 1061 expect(body.star, isNull); | 1061 expect(body.star, isNull); |
| 1062 expect(body.functionDefinition.type, TokenType.FUNCTION); | 1062 expect(body.functionDefinition.type, TokenType.FUNCTION); |
| 1063 expect(body.expression, isNotNull); | 1063 expect(body.expression, isNotNull); |
| 1064 expect(body.semicolon, isNotNull); | 1064 expect(body.semicolon, isNotNull); |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 void test_parseConstructor_named() { |
| 1068 createParser('C.foo();'); |
| 1069 var constructor = parser.parseClassMember('C') as ConstructorDeclaration; |
| 1070 assertNoErrors(); |
| 1071 expect(constructor, isNotNull); |
| 1072 expect(constructor.externalKeyword, isNull); |
| 1073 expect(constructor.constKeyword, isNull); |
| 1074 expect(constructor.factoryKeyword, isNull); |
| 1075 expect(constructor.returnType.name, 'C'); |
| 1076 expect(constructor.period.type, TokenType.PERIOD); |
| 1077 expect(constructor.name.name, 'foo'); |
| 1078 expect(constructor.parameters, isNotNull); |
| 1079 expect(constructor.parameters.parameters, isEmpty); |
| 1080 expect(constructor.separator, isNull); |
| 1081 expect(constructor.initializers, isEmpty); |
| 1082 expect(constructor.redirectedConstructor, isNull); |
| 1083 expect(constructor.body, new isInstanceOf<EmptyFunctionBody>()); |
| 1084 } |
| 1085 |
| 1067 void test_parseClassMember_redirectingFactory_nonConst() { | 1086 void test_parseClassMember_redirectingFactory_nonConst() { |
| 1068 createParser('factory C() = B;'); | 1087 createParser('factory C() = B;'); |
| 1069 ClassMember member = parser.parseClassMember('C'); | 1088 ClassMember member = parser.parseClassMember('C'); |
| 1070 expect(member, isNotNull); | 1089 expect(member, isNotNull); |
| 1071 assertNoErrors(); | 1090 assertNoErrors(); |
| 1072 expect(member, new isInstanceOf<ConstructorDeclaration>()); | 1091 expect(member, new isInstanceOf<ConstructorDeclaration>()); |
| 1073 ConstructorDeclaration constructor = member; | 1092 ConstructorDeclaration constructor = member; |
| 1074 expect(constructor.externalKeyword, isNull); | 1093 expect(constructor.externalKeyword, isNull); |
| 1075 expect(constructor.constKeyword, isNull); | 1094 expect(constructor.constKeyword, isNull); |
| 1076 expect(constructor.factoryKeyword.keyword, Keyword.FACTORY); | 1095 expect(constructor.factoryKeyword.keyword, Keyword.FACTORY); |
| (...skipping 13684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14761 expect(functionType.returnType, isNotNull); | 14780 expect(functionType.returnType, isNotNull); |
| 14762 expect(functionType.typeParameters, isNull); | 14781 expect(functionType.typeParameters, isNull); |
| 14763 } | 14782 } |
| 14764 | 14783 |
| 14765 void test_parseTypeAlias_genericFunction_withDocComment() { | 14784 void test_parseTypeAlias_genericFunction_withDocComment() { |
| 14766 createParser('/// Doc\ntypedef F = bool Function();'); | 14785 createParser('/// Doc\ntypedef F = bool Function();'); |
| 14767 var typeAlias = parseFullCompilationUnitMember() as GenericTypeAlias; | 14786 var typeAlias = parseFullCompilationUnitMember() as GenericTypeAlias; |
| 14768 expectCommentText(typeAlias.documentationComment, '/// Doc'); | 14787 expectCommentText(typeAlias.documentationComment, '/// Doc'); |
| 14769 } | 14788 } |
| 14770 } | 14789 } |
| OLD | NEW |