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 import 'package:analyzer/dart/ast/ast.dart'; | 5 import 'package:analyzer/dart/ast/ast.dart'; |
6 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; | 6 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
7 import 'package:analyzer/dart/ast/token.dart'; | 7 import 'package:analyzer/dart/ast/token.dart'; |
8 import 'package:analyzer/dart/ast/visitor.dart'; | 8 import 'package:analyzer/dart/ast/visitor.dart'; |
9 import 'package:analyzer/error/error.dart'; | 9 import 'package:analyzer/error/error.dart'; |
10 import 'package:analyzer/error/listener.dart'; | 10 import 'package:analyzer/error/listener.dart'; |
(...skipping 2878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2889 ParserErrorCode.EXPECTED_TOKEN, | 2889 ParserErrorCode.EXPECTED_TOKEN, |
2890 ParserErrorCode.EXPECTED_TOKEN | 2890 ParserErrorCode.EXPECTED_TOKEN |
2891 ]); | 2891 ]); |
2892 } | 2892 } |
2893 | 2893 |
2894 void test_functionTypedParameter_var() { | 2894 void test_functionTypedParameter_var() { |
2895 parseCompilationUnit( | 2895 parseCompilationUnit( |
2896 "void f(var x()) {}", [ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR]); | 2896 "void f(var x()) {}", [ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR]); |
2897 } | 2897 } |
2898 | 2898 |
| 2899 void test_genericFunctionType_extraLessThan() { |
| 2900 createParser(''' |
| 2901 class Wrong<T> { |
| 2902 T Function(<List<int> foo) bar; |
| 2903 }'''); |
| 2904 CompilationUnit unit = parser.parseCompilationUnit2(); |
| 2905 expectNotNullIfNoErrors(unit); |
| 2906 listener.assertErrorsWithCodes([ParserErrorCode.UNEXPECTED_TOKEN]); |
| 2907 } |
| 2908 |
2899 void test_getterInFunction_block_noReturnType() { | 2909 void test_getterInFunction_block_noReturnType() { |
2900 FunctionDeclarationStatement statement = | 2910 FunctionDeclarationStatement statement = |
2901 parseStatement("get x { return _x; }"); | 2911 parseStatement("get x { return _x; }"); |
2902 assertErrorsWithCodes([ParserErrorCode.GETTER_IN_FUNCTION]); | 2912 assertErrorsWithCodes([ParserErrorCode.GETTER_IN_FUNCTION]); |
2903 expect(statement.functionDeclaration.functionExpression.parameters, isNull); | 2913 expect(statement.functionDeclaration.functionExpression.parameters, isNull); |
2904 } | 2914 } |
2905 | 2915 |
2906 void test_getterInFunction_block_returnType() { | 2916 void test_getterInFunction_block_returnType() { |
2907 parseStatement("int get x { return _x; }"); | 2917 parseStatement("int get x { return _x; }"); |
2908 assertErrorsWithCodes([ParserErrorCode.GETTER_IN_FUNCTION]); | 2918 assertErrorsWithCodes([ParserErrorCode.GETTER_IN_FUNCTION]); |
(...skipping 12246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15155 expectCommentText(typeVariable.documentationComment, '/// Doc'); | 15165 expectCommentText(typeVariable.documentationComment, '/// Doc'); |
15156 } | 15166 } |
15157 | 15167 |
15158 /** | 15168 /** |
15159 * Assert that the given [name] is in declaration context. | 15169 * Assert that the given [name] is in declaration context. |
15160 */ | 15170 */ |
15161 void _assertIsDeclarationName(SimpleIdentifier name) { | 15171 void _assertIsDeclarationName(SimpleIdentifier name) { |
15162 expect(name.inDeclarationContext(), isTrue); | 15172 expect(name.inDeclarationContext(), isTrue); |
15163 } | 15173 } |
15164 } | 15174 } |
OLD | NEW |