Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: pkg/analyzer/test/generated/parser_fasta_test.dart

Issue 2802753002: Include ':' before constructor separators into AST with Fasta. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 */ 47 */
48 class BuilderProxy implements Builder { 48 class BuilderProxy implements Builder {
49 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 49 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
50 } 50 }
51 51
52 @reflectiveTest 52 @reflectiveTest
53 class ClassMemberParserTest_Fasta extends FastaParserTestCase 53 class ClassMemberParserTest_Fasta extends FastaParserTestCase
54 with ClassMemberParserTestMixin { 54 with ClassMemberParserTestMixin {
55 @override 55 @override
56 @failingTest 56 @failingTest
57 void test_parseClassMember_constructor_withInitializers() {
58 // TODO(paulberry): 'this' can't be used here.
59 super.test_parseClassMember_constructor_withInitializers();
60 }
61
62 @override
63 @failingTest
64 void test_parseClassMember_method_generic_comment_returnType() { 57 void test_parseClassMember_method_generic_comment_returnType() {
65 // TODO(paulberry): Fasta doesn't support generic comment syntax 58 // TODO(paulberry): Fasta doesn't support generic comment syntax
66 super.test_parseClassMember_method_generic_comment_returnType(); 59 super.test_parseClassMember_method_generic_comment_returnType();
67 } 60 }
68 61
69 @override 62 @override
70 @failingTest 63 @failingTest
71 void test_parseClassMember_method_generic_comment_returnType_bound() { 64 void test_parseClassMember_method_generic_comment_returnType_bound() {
72 // TODO(paulberry): Fasta doesn't support generic comment syntax 65 // TODO(paulberry): Fasta doesn't support generic comment syntax
73 super.test_parseClassMember_method_generic_comment_returnType_bound(); 66 super.test_parseClassMember_method_generic_comment_returnType_bound();
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 var result = _run((parser) => parser.parseMember) as ClassMember; 818 var result = _run((parser) => parser.parseMember) as ClassMember;
826 _astBuilder.className = null; 819 _astBuilder.className = null;
827 return result; 820 return result;
828 } 821 }
829 822
830 @override 823 @override
831 CompilationUnit parseCompilationUnit2() { 824 CompilationUnit parseCompilationUnit2() {
832 return _run((parser) => parser.parseUnit) as CompilationUnit; 825 return _run((parser) => parser.parseUnit) as CompilationUnit;
833 } 826 }
834 827
835 @override
836 ConstructorFieldInitializer parseConstructorFieldInitializer(bool hasThis) {
837 // Fasta's parser doesn't need the [hasThis] hint, so we ignore it.
838 var colon = new fasta.SymbolToken(fasta.COLON_INFO, 0);
839 colon.next = _currentFastaToken;
840 _currentFastaToken = colon;
841 var initializers = _run((parser) => parser.parseInitializers) as List;
842 return initializers[0] as ConstructorFieldInitializer;
843 }
844
845 /** 828 /**
846 * Runs a single parser function, and returns the result as an analyzer AST. 829 * Runs a single parser function, and returns the result as an analyzer AST.
847 */ 830 */
848 Object _run(ParseFunction getParseFunction(fasta.Parser parser)) { 831 Object _run(ParseFunction getParseFunction(fasta.Parser parser)) {
849 var parseFunction = getParseFunction(_fastaParser); 832 var parseFunction = getParseFunction(_fastaParser);
850 _currentFastaToken = parseFunction(_currentFastaToken); 833 _currentFastaToken = parseFunction(_currentFastaToken);
851 expect(_currentFastaToken.isEof, isTrue); 834 expect(_currentFastaToken.isEof, isTrue);
852 expect(_astBuilder.stack, hasLength(1)); 835 expect(_astBuilder.stack, hasLength(1));
853 return _astBuilder.pop(); 836 return _astBuilder.pop();
854 } 837 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 } 1026 }
1044 1027
1045 @override 1028 @override
1046 @failingTest 1029 @failingTest
1047 void test_parsePartOfDirective_uri() { 1030 void test_parsePartOfDirective_uri() {
1048 // TODO(paulberry,ahe): URIs in "part of" declarations are not supported by 1031 // TODO(paulberry,ahe): URIs in "part of" declarations are not supported by
1049 // Fasta. 1032 // Fasta.
1050 super.test_parsePartOfDirective_uri(); 1033 super.test_parsePartOfDirective_uri();
1051 } 1034 }
1052 } 1035 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/fasta/ast_builder.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698