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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 .test_parseInstanceCreationExpression_type_named_typeArgumentComments(); | 222 .test_parseInstanceCreationExpression_type_named_typeArgumentComments(); |
223 } | 223 } |
224 | 224 |
225 @override | 225 @override |
226 @failingTest | 226 @failingTest |
227 void test_parseInstanceCreationExpression_type_typeArguments_nullable() { | 227 void test_parseInstanceCreationExpression_type_typeArguments_nullable() { |
228 super.test_parseInstanceCreationExpression_type_typeArguments_nullable(); | 228 super.test_parseInstanceCreationExpression_type_typeArguments_nullable(); |
229 } | 229 } |
230 | 230 |
231 @override | 231 @override |
232 @failingTest | |
233 void test_parseListLiteral_empty_oneToken_withComment() { | 232 void test_parseListLiteral_empty_oneToken_withComment() { |
234 super.test_parseListLiteral_empty_oneToken_withComment(); | 233 super.test_parseListLiteral_empty_oneToken_withComment(); |
235 } | 234 } |
236 | 235 |
237 @override | 236 @override |
238 @failingTest | 237 @failingTest |
239 void test_parsePrimaryExpression_super() { | 238 void test_parsePrimaryExpression_super() { |
240 super.test_parsePrimaryExpression_super(); | 239 super.test_parsePrimaryExpression_super(); |
241 } | 240 } |
242 | 241 |
(...skipping 23 matching lines...) Expand all Loading... |
266 } | 265 } |
267 | 266 |
268 /** | 267 /** |
269 * Implementation of [AbstractParserTestCase] specialized for testing the | 268 * Implementation of [AbstractParserTestCase] specialized for testing the |
270 * Fasta parser. | 269 * Fasta parser. |
271 */ | 270 */ |
272 class FastaParserTestCase extends Object | 271 class FastaParserTestCase extends Object |
273 with ParserTestHelpers | 272 with ParserTestHelpers |
274 implements AbstractParserTestCase { | 273 implements AbstractParserTestCase { |
275 ParserProxy _parserProxy; | 274 ParserProxy _parserProxy; |
| 275 analyzer.Token _fastaTokens; |
276 | 276 |
277 /** | 277 /** |
278 * Whether generic method comments should be enabled for the test. | 278 * Whether generic method comments should be enabled for the test. |
279 */ | 279 */ |
280 bool enableGenericMethodComments = false; | 280 bool enableGenericMethodComments = false; |
281 | 281 |
282 @override | 282 @override |
283 set enableAssertInitializer(bool value) { | 283 set enableAssertInitializer(bool value) { |
284 if (value == true) { | 284 if (value == true) { |
285 // TODO(paulberry,ahe): it looks like asserts in initializer lists are not | 285 // TODO(paulberry,ahe): it looks like asserts in initializer lists are not |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 @override | 326 @override |
327 void assertNoErrors() { | 327 void assertNoErrors() { |
328 // TODO(paulberry): implement assertNoErrors | 328 // TODO(paulberry): implement assertNoErrors |
329 } | 329 } |
330 | 330 |
331 @override | 331 @override |
332 void createParser(String content) { | 332 void createParser(String content) { |
333 var scanner = new StringScanner(content, includeComments: true); | 333 var scanner = new StringScanner(content, includeComments: true); |
334 scanner.scanGenericMethodComments = enableGenericMethodComments; | 334 scanner.scanGenericMethodComments = enableGenericMethodComments; |
335 _parserProxy = new ParserProxy(scanner.tokenize(), | 335 _fastaTokens = scanner.tokenize(); |
| 336 _parserProxy = new ParserProxy(_fastaTokens, |
336 enableGenericMethodComments: enableGenericMethodComments); | 337 enableGenericMethodComments: enableGenericMethodComments); |
337 } | 338 } |
338 | 339 |
339 @override | 340 @override |
340 Expression parseAdditiveExpression(String code) { | 341 Expression parseAdditiveExpression(String code) { |
341 return _parseExpression(code); | 342 return _parseExpression(code); |
342 } | 343 } |
343 | 344 |
344 @override | 345 @override |
345 Expression parseAssignableExpression(String code, bool primaryAllowed) { | 346 Expression parseAssignableExpression(String code, bool primaryAllowed) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 token, | 470 token, |
470 inFunctionType | 471 inFunctionType |
471 ? fasta.MemberKind.GeneralizedFunctionType | 472 ? fasta.MemberKind.GeneralizedFunctionType |
472 : fasta.MemberKind.NonStaticMethod); | 473 : fasta.MemberKind.NonStaticMethod); |
473 }, | 474 }, |
474 errorCodes) as FormalParameterList; | 475 errorCodes) as FormalParameterList; |
475 } | 476 } |
476 | 477 |
477 @override | 478 @override |
478 CompilationUnitMember parseFullCompilationUnitMember() { | 479 CompilationUnitMember parseFullCompilationUnitMember() { |
479 return _parserProxy._run((parser) => parser.parseTopLevelDeclaration) | 480 return _parserProxy._run((parser) => parser.parseTopLevelDeclaration); |
480 as CompilationUnitMember; | |
481 } | 481 } |
482 | 482 |
483 @override | 483 @override |
484 Directive parseFullDirective() { | 484 Directive parseFullDirective() { |
485 return _parserProxy._run((parser) => parser.parseTopLevelDeclaration) | 485 return _parserProxy._run((parser) => parser.parseTopLevelDeclaration); |
486 as Directive; | |
487 } | 486 } |
488 | 487 |
489 @override | 488 @override |
490 FunctionExpression parseFunctionExpression(String code) { | 489 FunctionExpression parseFunctionExpression(String code) { |
491 return _parseExpression(code); | 490 return _parseExpression(code); |
492 } | 491 } |
493 | 492 |
494 @override | 493 @override |
495 InstanceCreationExpression parseInstanceCreationExpression( | 494 InstanceCreationExpression parseInstanceCreationExpression( |
496 String code, analyzer.Token newToken) { | 495 String code, analyzer.Token newToken) { |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 } | 953 } |
955 | 954 |
956 @override | 955 @override |
957 @failingTest | 956 @failingTest |
958 void test_parsePartOfDirective_uri() { | 957 void test_parsePartOfDirective_uri() { |
959 // TODO(paulberry,ahe): URIs in "part of" declarations are not supported by | 958 // TODO(paulberry,ahe): URIs in "part of" declarations are not supported by |
960 // Fasta. | 959 // Fasta. |
961 super.test_parsePartOfDirective_uri(); | 960 super.test_parsePartOfDirective_uri(); |
962 } | 961 } |
963 } | 962 } |
OLD | NEW |