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 engine.parser_test; | 5 library engine.parser_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
(...skipping 6936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6947 expect(declaration.propertyKeyword, isNull); | 6947 expect(declaration.propertyKeyword, isNull); |
6948 } | 6948 } |
6949 | 6949 |
6950 void test_parseCompilationUnitMember_function_type() { | 6950 void test_parseCompilationUnitMember_function_type() { |
6951 FunctionDeclaration declaration = parse("parseCompilationUnitMember", | 6951 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
6952 <Object>[emptyCommentAndMetadata()], "int f() {}"); | 6952 <Object>[emptyCommentAndMetadata()], "int f() {}"); |
6953 expect(declaration.functionExpression, isNotNull); | 6953 expect(declaration.functionExpression, isNotNull); |
6954 expect(declaration.propertyKeyword, isNull); | 6954 expect(declaration.propertyKeyword, isNull); |
6955 } | 6955 } |
6956 | 6956 |
| 6957 void test_parseCompilationUnitMember_function_withTypeParameters() { |
| 6958 enableGenericMethods = true; |
| 6959 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
| 6960 <Object>[emptyCommentAndMetadata()], "void f<T>(T t) {}"); |
| 6961 expect(declaration.functionExpression, isNotNull); |
| 6962 expect(declaration.propertyKeyword, isNull); |
| 6963 } |
| 6964 |
6957 void test_parseCompilationUnitMember_function_void() { | 6965 void test_parseCompilationUnitMember_function_void() { |
6958 FunctionDeclaration declaration = parse("parseCompilationUnitMember", | 6966 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
6959 <Object>[emptyCommentAndMetadata()], "void f() {}"); | 6967 <Object>[emptyCommentAndMetadata()], "void f() {}"); |
6960 expect(declaration.returnType, isNotNull); | 6968 expect(declaration.returnType, isNotNull); |
6961 } | 6969 } |
6962 | 6970 |
6963 void test_parseCompilationUnitMember_getter_external_noType() { | 6971 void test_parseCompilationUnitMember_getter_external_noType() { |
6964 FunctionDeclaration declaration = parse("parseCompilationUnitMember", | 6972 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
6965 <Object>[emptyCommentAndMetadata()], "external get p;"); | 6973 <Object>[emptyCommentAndMetadata()], "external get p;"); |
6966 expect(declaration.externalKeyword, isNotNull); | 6974 expect(declaration.externalKeyword, isNotNull); |
(...skipping 4142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11109 new Scanner(null, new CharSequenceReader(source), listener); | 11117 new Scanner(null, new CharSequenceReader(source), listener); |
11110 Token tokenStream = scanner.tokenize(); | 11118 Token tokenStream = scanner.tokenize(); |
11111 // | 11119 // |
11112 // Parse the source. | 11120 // Parse the source. |
11113 // | 11121 // |
11114 Parser parser = new Parser(null, listener); | 11122 Parser parser = new Parser(null, listener); |
11115 return invokeParserMethodImpl( | 11123 return invokeParserMethodImpl( |
11116 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 11124 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
11117 } | 11125 } |
11118 } | 11126 } |
OLD | NEW |