| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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/token.dart' as analyzer; | 6 import 'package:analyzer/dart/ast/token.dart' as analyzer; |
| 7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/error/error.dart'; | 8 import 'package:analyzer/error/error.dart'; |
| 9 import 'package:analyzer/src/fasta/ast_builder.dart'; | 9 import 'package:analyzer/src/fasta/ast_builder.dart'; |
| 10 import 'package:analyzer/src/fasta/element_store.dart'; | 10 import 'package:analyzer/src/fasta/element_store.dart'; |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 | 673 |
| 674 @override | 674 @override |
| 675 @failingTest | 675 @failingTest |
| 676 void test_parseFormalParameterList_prefixedType_partial2() { | 676 void test_parseFormalParameterList_prefixedType_partial2() { |
| 677 // TODO(scheglov): Unimplemented: errors | 677 // TODO(scheglov): Unimplemented: errors |
| 678 super.test_parseFormalParameterList_prefixedType_partial2(); | 678 super.test_parseFormalParameterList_prefixedType_partial2(); |
| 679 } | 679 } |
| 680 | 680 |
| 681 @override | 681 @override |
| 682 @failingTest | 682 @failingTest |
| 683 void test_parseNormalFormalParameter_field_const_noType() { |
| 684 super.test_parseNormalFormalParameter_field_const_noType(); |
| 685 } |
| 686 |
| 687 @override |
| 688 @failingTest |
| 689 void test_parseNormalFormalParameter_field_const_type() { |
| 690 super.test_parseNormalFormalParameter_field_const_type(); |
| 691 } |
| 692 |
| 693 @override |
| 694 @failingTest |
| 683 void test_parseNormalFormalParameter_function_noType_nullable() { | 695 void test_parseNormalFormalParameter_function_noType_nullable() { |
| 684 // TODO(scheglov): Not implemented: Nnbd | 696 // TODO(scheglov): Not implemented: Nnbd |
| 685 super.test_parseNormalFormalParameter_function_noType_nullable(); | 697 super.test_parseNormalFormalParameter_function_noType_nullable(); |
| 686 } | 698 } |
| 687 | 699 |
| 688 @override | 700 @override |
| 689 @failingTest | 701 @failingTest |
| 690 void | 702 void |
| 691 test_parseNormalFormalParameter_function_noType_typeParameters_nullable()
{ | 703 test_parseNormalFormalParameter_function_noType_typeParameters_nullable()
{ |
| 692 // TODO(scheglov): Not implemented: Nnbd | 704 // TODO(scheglov): Not implemented: Nnbd |
| (...skipping 26 matching lines...) Expand all Loading... |
| 719 @override | 731 @override |
| 720 @failingTest | 732 @failingTest |
| 721 void test_parseNormalFormalParameter_function_void_typeParameters_nullable() { | 733 void test_parseNormalFormalParameter_function_void_typeParameters_nullable() { |
| 722 // TODO(scheglov): Not implemented: Nnbd | 734 // TODO(scheglov): Not implemented: Nnbd |
| 723 super | 735 super |
| 724 .test_parseNormalFormalParameter_function_void_typeParameters_nullable()
; | 736 .test_parseNormalFormalParameter_function_void_typeParameters_nullable()
; |
| 725 } | 737 } |
| 726 | 738 |
| 727 @override | 739 @override |
| 728 @failingTest | 740 @failingTest |
| 729 void test_parseNormalFormalParameter_field_const_noType() { | |
| 730 super.test_parseNormalFormalParameter_field_const_noType(); | |
| 731 } | |
| 732 | |
| 733 @override | |
| 734 @failingTest | |
| 735 void test_parseNormalFormalParameter_field_const_type() { | |
| 736 super.test_parseNormalFormalParameter_field_const_type(); | |
| 737 } | |
| 738 | |
| 739 @override | |
| 740 @failingTest | |
| 741 void test_parseNormalFormalParameter_simple_const_noType() { | 741 void test_parseNormalFormalParameter_simple_const_noType() { |
| 742 super.test_parseNormalFormalParameter_simple_const_noType(); | 742 super.test_parseNormalFormalParameter_simple_const_noType(); |
| 743 } | 743 } |
| 744 | 744 |
| 745 @override | 745 @override |
| 746 @failingTest | 746 @failingTest |
| 747 void test_parseNormalFormalParameter_simple_const_type() { | 747 void test_parseNormalFormalParameter_simple_const_type() { |
| 748 super.test_parseNormalFormalParameter_simple_const_type(); | 748 super.test_parseNormalFormalParameter_simple_const_type(); |
| 749 } | 749 } |
| 750 } | 750 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 763 * Proxy implementation of [KernelLibraryBuilderProxy] used by Fasta parser | 763 * Proxy implementation of [KernelLibraryBuilderProxy] used by Fasta parser |
| 764 * tests. | 764 * tests. |
| 765 */ | 765 */ |
| 766 class KernelLibraryBuilderProxy implements KernelLibraryBuilder { | 766 class KernelLibraryBuilderProxy implements KernelLibraryBuilder { |
| 767 @override | 767 @override |
| 768 final uri = Uri.parse('file:///test.dart'); | 768 final uri = Uri.parse('file:///test.dart'); |
| 769 | 769 |
| 770 @override | 770 @override |
| 771 Uri get fileUri => uri; | 771 Uri get fileUri => uri; |
| 772 | 772 |
| 773 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | |
| 774 | |
| 775 @override | 773 @override |
| 776 void addCompileTimeError(int charOffset, Object message, | 774 void addCompileTimeError(int charOffset, Object message, |
| 777 {Uri fileUri, bool silent: false}) { | 775 {Uri fileUri, bool silent: false}) { |
| 778 fail('$message'); | 776 fail('$message'); |
| 779 } | 777 } |
| 778 |
| 779 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 780 } | 780 } |
| 781 | 781 |
| 782 /** | 782 /** |
| 783 * Proxy implementation of the analyzer parser, implemented in terms of the | 783 * Proxy implementation of the analyzer parser, implemented in terms of the |
| 784 * Fasta parser. | 784 * Fasta parser. |
| 785 * | 785 * |
| 786 * This allows many of the analyzer parser tests to be run on Fasta, even if | 786 * This allows many of the analyzer parser tests to be run on Fasta, even if |
| 787 * they call into the analyzer parser class directly. | 787 * they call into the analyzer parser class directly. |
| 788 */ | 788 */ |
| 789 class ParserProxy implements analyzer.Parser { | 789 class ParserProxy implements analyzer.Parser { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 /** | 853 /** |
| 854 * Proxy implementation of [Scope] used by Fasta parser tests. | 854 * Proxy implementation of [Scope] used by Fasta parser tests. |
| 855 * | 855 * |
| 856 * Any name lookup request is satisfied by creating an instance of | 856 * Any name lookup request is satisfied by creating an instance of |
| 857 * [BuilderProxy]. | 857 * [BuilderProxy]. |
| 858 */ | 858 */ |
| 859 class ScopeProxy implements Scope { | 859 class ScopeProxy implements Scope { |
| 860 final _locals = <String, Builder>{}; | 860 final _locals = <String, Builder>{}; |
| 861 | 861 |
| 862 @override | 862 @override |
| 863 Scope createNestedScope({bool isModifiable: true}) { |
| 864 return new Scope.nested(this, isModifiable: isModifiable); |
| 865 } |
| 866 |
| 867 @override |
| 863 declare(String name, Builder builder, int charOffset, Uri fileUri) { | 868 declare(String name, Builder builder, int charOffset, Uri fileUri) { |
| 864 _locals[name] = builder; | 869 _locals[name] = builder; |
| 865 return null; | 870 return null; |
| 866 } | 871 } |
| 867 | 872 |
| 868 @override | 873 @override |
| 869 Scope createNestedScope({bool isModifiable: true}) { | |
| 870 return new Scope.nested(this, isModifiable: isModifiable); | |
| 871 } | |
| 872 | |
| 873 @override | |
| 874 Builder lookup(String name, int charOffset, Uri fileUri, | 874 Builder lookup(String name, int charOffset, Uri fileUri, |
| 875 {bool isInstanceScope: true}) => | 875 {bool isInstanceScope: true}) => |
| 876 _locals.putIfAbsent(name, () => new BuilderProxy()); | 876 _locals.putIfAbsent(name, () => new BuilderProxy()); |
| 877 | 877 |
| 878 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 878 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 879 } | 879 } |
| 880 | 880 |
| 881 /** | 881 /** |
| 882 * Tests of the fasta parser based on [StatementParserTestMixin]. | 882 * Tests of the fasta parser based on [StatementParserTestMixin]. |
| 883 */ | 883 */ |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 with TopLevelParserTestMixin { | 935 with TopLevelParserTestMixin { |
| 936 @override | 936 @override |
| 937 @failingTest | 937 @failingTest |
| 938 void test_parseClassDeclaration_native() { | 938 void test_parseClassDeclaration_native() { |
| 939 // TODO(paulberry): TODO(paulberry,ahe): Fasta parser doesn't appear to supp
ort "native" syntax yet. | 939 // TODO(paulberry): TODO(paulberry,ahe): Fasta parser doesn't appear to supp
ort "native" syntax yet. |
| 940 super.test_parseClassDeclaration_native(); | 940 super.test_parseClassDeclaration_native(); |
| 941 } | 941 } |
| 942 | 942 |
| 943 @override | 943 @override |
| 944 @failingTest | 944 @failingTest |
| 945 void test_parseCompilationUnit_abstractAsPrefix_parameterized() { |
| 946 super.test_parseCompilationUnit_abstractAsPrefix_parameterized(); |
| 947 } |
| 948 |
| 949 @override |
| 950 @failingTest |
| 945 void test_parseCompilationUnit_builtIn_asFunctionName() { | 951 void test_parseCompilationUnit_builtIn_asFunctionName() { |
| 946 // TODO(paulberry,ahe): Fasta's parser is confused when one of the built-in | 952 // TODO(paulberry,ahe): Fasta's parser is confused when one of the built-in |
| 947 // identifiers `export`, `import`, `library`, `part`, or `typedef` appears | 953 // identifiers `export`, `import`, `library`, `part`, or `typedef` appears |
| 948 // as the name of a top level function with an implicit return type. | 954 // as the name of a top level function with an implicit return type. |
| 949 super.test_parseCompilationUnit_builtIn_asFunctionName(); | 955 super.test_parseCompilationUnit_builtIn_asFunctionName(); |
| 950 } | 956 } |
| 951 | 957 |
| 952 @override | 958 @override |
| 953 @failingTest | 959 @failingTest |
| 954 void test_parseCompilationUnit_exportAsPrefix() { | 960 void test_parseCompilationUnit_exportAsPrefix() { |
| 955 // TODO(paulberry): As of commit 5de9108 this syntax is invalid. | 961 // TODO(paulberry): As of commit 5de9108 this syntax is invalid. |
| 956 super.test_parseCompilationUnit_exportAsPrefix(); | 962 super.test_parseCompilationUnit_exportAsPrefix(); |
| 957 } | 963 } |
| 958 | 964 |
| 959 @override | 965 @override |
| 960 @failingTest | 966 @failingTest |
| 961 void test_parseCompilationUnit_exportAsPrefix_parameterized() { | 967 void test_parseCompilationUnit_exportAsPrefix_parameterized() { |
| 962 // TODO(paulberry): As of commit 5de9108 this syntax is invalid. | 968 // TODO(paulberry): As of commit 5de9108 this syntax is invalid. |
| 963 super.test_parseCompilationUnit_exportAsPrefix_parameterized(); | 969 super.test_parseCompilationUnit_exportAsPrefix_parameterized(); |
| 964 } | 970 } |
| 965 | 971 |
| 966 @override | 972 @override |
| 967 @failingTest | 973 @failingTest |
| 974 void test_parseCompilationUnit_operatorAsPrefix_parameterized() { |
| 975 super.test_parseCompilationUnit_operatorAsPrefix_parameterized(); |
| 976 } |
| 977 |
| 978 @override |
| 979 @failingTest |
| 968 void test_parseDirectives_mixed() { | 980 void test_parseDirectives_mixed() { |
| 969 // TODO(paulberry,ahe): This test verifies the analyzer parser's ability to | 981 // TODO(paulberry,ahe): This test verifies the analyzer parser's ability to |
| 970 // stop parsing as soon as the first non-directive is encountered; this is | 982 // stop parsing as soon as the first non-directive is encountered; this is |
| 971 // useful for quickly traversing an import graph. Consider adding a similar | 983 // useful for quickly traversing an import graph. Consider adding a similar |
| 972 // ability to Fasta's parser. | 984 // ability to Fasta's parser. |
| 973 super.test_parseDirectives_mixed(); | 985 super.test_parseDirectives_mixed(); |
| 974 } | 986 } |
| 975 | 987 |
| 976 @override | 988 @override |
| 977 @failingTest | 989 @failingTest |
| 978 void test_parsePartOfDirective_name() { | 990 void test_parsePartOfDirective_name() { |
| 979 // TODO(paulberry,ahe): Thes test verifies that even if URIs in "part of" | 991 // TODO(paulberry,ahe): Thes test verifies that even if URIs in "part of" |
| 980 // declarations are enabled, a construct of the form "part of identifier;" | 992 // declarations are enabled, a construct of the form "part of identifier;" |
| 981 // is still properly handled. URIs in "part of" declarations are not | 993 // is still properly handled. URIs in "part of" declarations are not |
| 982 // supported by Fasta yet. | 994 // supported by Fasta yet. |
| 983 super.test_parsePartOfDirective_name(); | 995 super.test_parsePartOfDirective_name(); |
| 984 } | 996 } |
| 985 | 997 |
| 986 @override | 998 @override |
| 987 @failingTest | 999 @failingTest |
| 988 void test_parsePartOfDirective_uri() { | 1000 void test_parsePartOfDirective_uri() { |
| 989 // TODO(paulberry,ahe): URIs in "part of" declarations are not supported by | 1001 // TODO(paulberry,ahe): URIs in "part of" declarations are not supported by |
| 990 // Fasta. | 1002 // Fasta. |
| 991 super.test_parsePartOfDirective_uri(); | 1003 super.test_parsePartOfDirective_uri(); |
| 992 } | 1004 } |
| 993 | |
| 994 @override | |
| 995 @failingTest | |
| 996 void test_parseCompilationUnit_operatorAsPrefix_parameterized() { | |
| 997 super.test_parseCompilationUnit_operatorAsPrefix_parameterized(); | |
| 998 } | |
| 999 | |
| 1000 @override | |
| 1001 @failingTest | |
| 1002 void test_parseCompilationUnit_abstractAsPrefix_parameterized() { | |
| 1003 super.test_parseCompilationUnit_abstractAsPrefix_parameterized(); | |
| 1004 } | |
| 1005 } | 1005 } |
| OLD | NEW |