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

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

Issue 2776743002: Parse LabeledStatement and SwitchStatement with Fasta. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « pkg/analyzer/lib/src/fasta/ast_builder.dart ('k') | pkg/front_end/test/fasta/kompile.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 @override 179 @override
180 @failingTest 180 @failingTest
181 void test_logicalOrExpression_precedence_nullableType() { 181 void test_logicalOrExpression_precedence_nullableType() {
182 // TODO(paulberry,ahe): Fasta doesn't support NNBD syntax yet. 182 // TODO(paulberry,ahe): Fasta doesn't support NNBD syntax yet.
183 super.test_logicalOrExpression_precedence_nullableType(); 183 super.test_logicalOrExpression_precedence_nullableType();
184 } 184 }
185 185
186 @override 186 @override
187 @failingTest 187 @failingTest
188 void test_multipleLabels_statement() {
189 // TODO(paulberry,ahe): AstBuilder doesn't implement handleLabel().
190 super.test_multipleLabels_statement();
191 }
192
193 @override
194 @failingTest
195 void test_topLevelFunction_nestedGenericFunction() { 188 void test_topLevelFunction_nestedGenericFunction() {
196 // TODO(paulberry): Implement parseCompilationUnitWithOptions 189 // TODO(paulberry): Implement parseCompilationUnitWithOptions
197 super.test_topLevelFunction_nestedGenericFunction(); 190 super.test_topLevelFunction_nestedGenericFunction();
198 } 191 }
199 } 192 }
200 193
201 /** 194 /**
202 * Proxy implementation of [KernelClassElement] used by Fasta parser tests. 195 * Proxy implementation of [KernelClassElement] used by Fasta parser tests.
203 * 196 *
204 * All undeclared identifiers are presumed to resolve to an instance of this 197 * All undeclared identifiers are presumed to resolve to an instance of this
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 ConditionalExpression parseConditionalExpression(String code) { 586 ConditionalExpression parseConditionalExpression(String code) {
594 return _parseExpression(code); 587 return _parseExpression(code);
595 } 588 }
596 589
597 @override 590 @override
598 Expression parseConstExpression(String code) { 591 Expression parseConstExpression(String code) {
599 return _parseExpression(code); 592 return _parseExpression(code);
600 } 593 }
601 594
602 @override 595 @override
596 ConstructorInitializer parseConstructorInitializer(String code) {
597 String source = 'class __Test { __Test() : $code; }';
598 var unit =
599 _runParser(source, (parser) => parser.parseUnit) as CompilationUnit;
600 var clazz = unit.declarations[0] as ClassDeclaration;
601 var constructor = clazz.members[0] as ConstructorDeclaration;
602 return constructor.initializers.single;
603 }
604
605 @override
603 CompilationUnit parseDirectives(String source, 606 CompilationUnit parseDirectives(String source,
604 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) { 607 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) {
605 return _runParser(source, (parser) => parser.parseUnit, errorCodes); 608 return _runParser(source, (parser) => parser.parseUnit, errorCodes);
606 } 609 }
607 610
608 @override 611 @override
609 BinaryExpression parseEqualityExpression(String code) { 612 BinaryExpression parseEqualityExpression(String code) {
610 return _parseExpression(code); 613 return _parseExpression(code);
611 } 614 }
612 615
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 [bool enableLazyAssignmentOperators]) { 797 [bool enableLazyAssignmentOperators]) {
795 return _runParser(source, (parser) => parser.parseStatement) as Statement; 798 return _runParser(source, (parser) => parser.parseStatement) as Statement;
796 } 799 }
797 800
798 @override 801 @override
799 Expression parseStringLiteral(String code) { 802 Expression parseStringLiteral(String code) {
800 return _parseExpression(code); 803 return _parseExpression(code);
801 } 804 }
802 805
803 @override 806 @override
804 ConstructorInitializer parseConstructorInitializer(String code) {
805 String source = 'class __Test { __Test() : $code; }';
806 var unit =
807 _runParser(source, (parser) => parser.parseUnit) as CompilationUnit;
808 var clazz = unit.declarations[0] as ClassDeclaration;
809 var constructor = clazz.members[0] as ConstructorDeclaration;
810 return constructor.initializers.single;
811 }
812
813 @override
814 SymbolLiteral parseSymbolLiteral(String code) { 807 SymbolLiteral parseSymbolLiteral(String code) {
815 return _parseExpression(code); 808 return _parseExpression(code);
816 } 809 }
817 810
818 @override 811 @override
819 Expression parseThrowExpression(String code) { 812 Expression parseThrowExpression(String code) {
820 return _parseExpression(code); 813 return _parseExpression(code);
821 } 814 }
822 815
823 @override 816 @override
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 } 1138 }
1146 1139
1147 @override 1140 @override
1148 @failingTest 1141 @failingTest
1149 void test_parseStatement_functionDeclaration_returnType_typeParameters() { 1142 void test_parseStatement_functionDeclaration_returnType_typeParameters() {
1150 super.test_parseStatement_functionDeclaration_returnType_typeParameters(); 1143 super.test_parseStatement_functionDeclaration_returnType_typeParameters();
1151 } 1144 }
1152 1145
1153 @override 1146 @override
1154 @failingTest 1147 @failingTest
1155 void test_parseStatement_multipleLabels() {
1156 super.test_parseStatement_multipleLabels();
1157 }
1158
1159 @override
1160 @failingTest
1161 void test_parseStatement_singleLabel() {
1162 super.test_parseStatement_singleLabel();
1163 }
1164
1165 @override
1166 @failingTest
1167 void test_parseSwitchStatement_case() {
1168 super.test_parseSwitchStatement_case();
1169 }
1170
1171 @override
1172 @failingTest
1173 void test_parseSwitchStatement_empty() {
1174 super.test_parseSwitchStatement_empty();
1175 }
1176
1177 @override
1178 @failingTest
1179 void test_parseSwitchStatement_labeledCase() {
1180 super.test_parseSwitchStatement_labeledCase();
1181 }
1182
1183 @override
1184 @failingTest
1185 void test_parseSwitchStatement_labeledDefault() {
1186 super.test_parseSwitchStatement_labeledDefault();
1187 }
1188
1189 @override
1190 @failingTest
1191 void test_parseSwitchStatement_labeledStatementInCase() {
1192 super.test_parseSwitchStatement_labeledStatementInCase();
1193 }
1194
1195 @override
1196 @failingTest
1197 void test_parseTryStatement_catch_finally() { 1148 void test_parseTryStatement_catch_finally() {
1198 super.test_parseTryStatement_catch_finally(); 1149 super.test_parseTryStatement_catch_finally();
1199 } 1150 }
1200 1151
1201 @override 1152 @override
1202 @failingTest 1153 @failingTest
1203 void test_parseTryStatement_on_catch() { 1154 void test_parseTryStatement_on_catch() {
1204 super.test_parseTryStatement_on_catch(); 1155 super.test_parseTryStatement_on_catch();
1205 } 1156 }
1206 1157
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 } 1234 }
1284 1235
1285 @override 1236 @override
1286 @failingTest 1237 @failingTest
1287 void test_parsePartOfDirective_uri() { 1238 void test_parsePartOfDirective_uri() {
1288 // TODO(paulberry,ahe): URIs in "part of" declarations are not supported by 1239 // TODO(paulberry,ahe): URIs in "part of" declarations are not supported by
1289 // Fasta. 1240 // Fasta.
1290 super.test_parsePartOfDirective_uri(); 1241 super.test_parsePartOfDirective_uri();
1291 } 1242 }
1292 } 1243 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/fasta/ast_builder.dart ('k') | pkg/front_end/test/fasta/kompile.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698