| 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/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
| 9 import 'package:analyzer/src/dart/element/element.dart'; | 9 import 'package:analyzer/src/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 7020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7031 } | 7031 } |
| 7032 | 7032 |
| 7033 void test_parseCompilationUnitMember_function_external_type() { | 7033 void test_parseCompilationUnitMember_function_external_type() { |
| 7034 FunctionDeclaration declaration = parse("parseCompilationUnitMember", | 7034 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
| 7035 <Object>[emptyCommentAndMetadata()], "external int f();"); | 7035 <Object>[emptyCommentAndMetadata()], "external int f();"); |
| 7036 expect(declaration.externalKeyword, isNotNull); | 7036 expect(declaration.externalKeyword, isNotNull); |
| 7037 expect(declaration.functionExpression, isNotNull); | 7037 expect(declaration.functionExpression, isNotNull); |
| 7038 expect(declaration.propertyKeyword, isNull); | 7038 expect(declaration.propertyKeyword, isNull); |
| 7039 } | 7039 } |
| 7040 | 7040 |
| 7041 void test_parseCompilationUnitMember_function_generic_noReturnType() { |
| 7042 enableGenericMethods = true; |
| 7043 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
| 7044 <Object>[emptyCommentAndMetadata()], "f<E>() {}"); |
| 7045 expect(declaration.returnType, isNull); |
| 7046 expect(declaration.functionExpression.typeParameters, isNotNull); |
| 7047 } |
| 7048 |
| 7049 void test_parseCompilationUnitMember_function_generic_returnType() { |
| 7050 enableGenericMethods = true; |
| 7051 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
| 7052 <Object>[emptyCommentAndMetadata()], "E f<E>() {}"); |
| 7053 expect(declaration.returnType, isNotNull); |
| 7054 expect(declaration.functionExpression.typeParameters, isNotNull); |
| 7055 } |
| 7056 |
| 7057 void test_parseCompilationUnitMember_function_generic_void() { |
| 7058 enableGenericMethods = true; |
| 7059 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
| 7060 <Object>[emptyCommentAndMetadata()], "void f<T>(T t) {}"); |
| 7061 expect(declaration.functionExpression, isNotNull); |
| 7062 expect(declaration.propertyKeyword, isNull); |
| 7063 } |
| 7064 |
| 7041 void test_parseCompilationUnitMember_function_noType() { | 7065 void test_parseCompilationUnitMember_function_noType() { |
| 7042 FunctionDeclaration declaration = parse("parseCompilationUnitMember", | 7066 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
| 7043 <Object>[emptyCommentAndMetadata()], "f() {}"); | 7067 <Object>[emptyCommentAndMetadata()], "f() {}"); |
| 7044 expect(declaration.functionExpression, isNotNull); | 7068 expect(declaration.functionExpression, isNotNull); |
| 7045 expect(declaration.propertyKeyword, isNull); | 7069 expect(declaration.propertyKeyword, isNull); |
| 7046 } | 7070 } |
| 7047 | 7071 |
| 7048 void test_parseCompilationUnitMember_function_type() { | 7072 void test_parseCompilationUnitMember_function_type() { |
| 7049 FunctionDeclaration declaration = parse("parseCompilationUnitMember", | 7073 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
| 7050 <Object>[emptyCommentAndMetadata()], "int f() {}"); | 7074 <Object>[emptyCommentAndMetadata()], "int f() {}"); |
| 7051 expect(declaration.functionExpression, isNotNull); | 7075 expect(declaration.functionExpression, isNotNull); |
| 7052 expect(declaration.propertyKeyword, isNull); | 7076 expect(declaration.propertyKeyword, isNull); |
| 7053 } | 7077 } |
| 7054 | 7078 |
| 7055 void test_parseCompilationUnitMember_function_void() { | 7079 void test_parseCompilationUnitMember_function_void() { |
| 7056 FunctionDeclaration declaration = parse("parseCompilationUnitMember", | 7080 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
| 7057 <Object>[emptyCommentAndMetadata()], "void f() {}"); | 7081 <Object>[emptyCommentAndMetadata()], "void f() {}"); |
| 7058 expect(declaration.returnType, isNotNull); | 7082 expect(declaration.returnType, isNotNull); |
| 7059 } | 7083 } |
| 7060 | 7084 |
| 7061 void test_parseCompilationUnitMember_function_withTypeParameters() { | |
| 7062 enableGenericMethods = true; | |
| 7063 FunctionDeclaration declaration = parse("parseCompilationUnitMember", | |
| 7064 <Object>[emptyCommentAndMetadata()], "void f<T>(T t) {}"); | |
| 7065 expect(declaration.functionExpression, isNotNull); | |
| 7066 expect(declaration.propertyKeyword, isNull); | |
| 7067 } | |
| 7068 | |
| 7069 void test_parseCompilationUnitMember_getter_external_noType() { | 7085 void test_parseCompilationUnitMember_getter_external_noType() { |
| 7070 FunctionDeclaration declaration = parse("parseCompilationUnitMember", | 7086 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
| 7071 <Object>[emptyCommentAndMetadata()], "external get p;"); | 7087 <Object>[emptyCommentAndMetadata()], "external get p;"); |
| 7072 expect(declaration.externalKeyword, isNotNull); | 7088 expect(declaration.externalKeyword, isNotNull); |
| 7073 expect(declaration.functionExpression, isNotNull); | 7089 expect(declaration.functionExpression, isNotNull); |
| 7074 expect(declaration.propertyKeyword, isNotNull); | 7090 expect(declaration.propertyKeyword, isNotNull); |
| 7075 } | 7091 } |
| 7076 | 7092 |
| 7077 void test_parseCompilationUnitMember_getter_external_type() { | 7093 void test_parseCompilationUnitMember_getter_external_type() { |
| 7078 FunctionDeclaration declaration = parse("parseCompilationUnitMember", | 7094 FunctionDeclaration declaration = parse("parseCompilationUnitMember", |
| (...skipping 4275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11354 new Scanner(null, new CharSequenceReader(source), listener); | 11370 new Scanner(null, new CharSequenceReader(source), listener); |
| 11355 Token tokenStream = scanner.tokenize(); | 11371 Token tokenStream = scanner.tokenize(); |
| 11356 // | 11372 // |
| 11357 // Parse the source. | 11373 // Parse the source. |
| 11358 // | 11374 // |
| 11359 Parser parser = new Parser(null, listener); | 11375 Parser parser = new Parser(null, listener); |
| 11360 return invokeParserMethodImpl( | 11376 return invokeParserMethodImpl( |
| 11361 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 11377 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
| 11362 } | 11378 } |
| 11363 } | 11379 } |
| OLD | NEW |