| 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/dart/scanner/scanner.dart'; | 9 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
| 10 import 'package:analyzer/src/fasta/ast_builder.dart'; | 10 import 'package:analyzer/src/fasta/ast_builder.dart'; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 implements AbstractParserTestCase { | 276 implements AbstractParserTestCase { |
| 277 ParserProxy _parserProxy; | 277 ParserProxy _parserProxy; |
| 278 analyzer.Token _fastaTokens; | 278 analyzer.Token _fastaTokens; |
| 279 | 279 |
| 280 /** | 280 /** |
| 281 * Whether generic method comments should be enabled for the test. | 281 * Whether generic method comments should be enabled for the test. |
| 282 */ | 282 */ |
| 283 bool enableGenericMethodComments = false; | 283 bool enableGenericMethodComments = false; |
| 284 | 284 |
| 285 @override | 285 @override |
| 286 bool get usingFasta => true; |
| 287 |
| 288 @override |
| 286 set enableAssertInitializer(bool value) { | 289 set enableAssertInitializer(bool value) { |
| 287 if (value == true) { | 290 if (value == true) { |
| 288 // TODO(paulberry,ahe): it looks like asserts in initializer lists are not | 291 // TODO(paulberry,ahe): it looks like asserts in initializer lists are not |
| 289 // supported by Fasta. | 292 // supported by Fasta. |
| 290 throw new UnimplementedError(); | 293 throw new UnimplementedError(); |
| 291 } | 294 } |
| 292 } | 295 } |
| 293 | 296 |
| 294 @override | 297 @override |
| 295 set enableLazyAssignmentOperators(bool value) { | 298 set enableLazyAssignmentOperators(bool value) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 scanner.scanGenericMethodComments = enableGenericMethodComments; | 402 scanner.scanGenericMethodComments = enableGenericMethodComments; |
| 400 _fastaTokens = scanner.tokenize(); | 403 _fastaTokens = scanner.tokenize(); |
| 401 | 404 |
| 402 // Run parser | 405 // Run parser |
| 403 analyzer.Parser parser = | 406 analyzer.Parser parser = |
| 404 new analyzer.Parser(source, listener, useFasta: true); | 407 new analyzer.Parser(source, listener, useFasta: true); |
| 405 CompilationUnit unit = parser.parseCompilationUnit(_fastaTokens); | 408 CompilationUnit unit = parser.parseCompilationUnit(_fastaTokens); |
| 406 | 409 |
| 407 // Assert and return result | 410 // Assert and return result |
| 408 listener.assertErrorsWithCodes(expectedErrorCodes); | 411 listener.assertErrorsWithCodes(expectedErrorCodes); |
| 412 expect(unit, isNotNull); |
| 409 return unit; | 413 return unit; |
| 410 } | 414 } |
| 411 | 415 |
| 412 @override | 416 @override |
| 413 ConditionalExpression parseConditionalExpression(String code) { | 417 ConditionalExpression parseConditionalExpression(String code) { |
| 414 return _parseExpression(code); | 418 return _parseExpression(code); |
| 415 } | 419 } |
| 416 | 420 |
| 417 @override | 421 @override |
| 418 Expression parseConstExpression(String code) { | 422 Expression parseConstExpression(String code) { |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 with TopLevelParserTestMixin { | 955 with TopLevelParserTestMixin { |
| 952 @override | 956 @override |
| 953 @failingTest | 957 @failingTest |
| 954 void test_parseClassDeclaration_native() { | 958 void test_parseClassDeclaration_native() { |
| 955 // TODO(paulberry): TODO(paulberry,ahe): Fasta parser doesn't appear to supp
ort "native" syntax yet. | 959 // TODO(paulberry): TODO(paulberry,ahe): Fasta parser doesn't appear to supp
ort "native" syntax yet. |
| 956 super.test_parseClassDeclaration_native(); | 960 super.test_parseClassDeclaration_native(); |
| 957 } | 961 } |
| 958 | 962 |
| 959 @override | 963 @override |
| 960 @failingTest | 964 @failingTest |
| 961 void test_parseCompilationUnit_abstractAsPrefix_parameterized() { | |
| 962 super.test_parseCompilationUnit_abstractAsPrefix_parameterized(); | |
| 963 } | |
| 964 | |
| 965 @override | |
| 966 @failingTest | |
| 967 void test_parseCompilationUnit_builtIn_asFunctionName() { | 965 void test_parseCompilationUnit_builtIn_asFunctionName() { |
| 968 // TODO(paulberry,ahe): Fasta's parser is confused when one of the built-in | 966 // TODO(paulberry,ahe): Fasta's parser is confused when one of the built-in |
| 969 // identifiers `export`, `import`, `library`, `part`, or `typedef` appears | 967 // identifiers `export`, `import`, `library`, `part`, or `typedef` appears |
| 970 // as the name of a top level function with an implicit return type. | 968 // as the name of a top level function with an implicit return type. |
| 971 super.test_parseCompilationUnit_builtIn_asFunctionName(); | 969 super.test_parseCompilationUnit_builtIn_asFunctionName(); |
| 972 } | 970 } |
| 973 | 971 |
| 974 @override | 972 @override |
| 975 @failingTest | 973 @failingTest |
| 976 void test_parseCompilationUnit_exportAsPrefix() { | 974 void test_parseCompilationUnit_exportAsPrefix() { |
| 977 // TODO(paulberry): As of commit 5de9108 this syntax is invalid. | 975 // TODO(paulberry): As of commit 5de9108 this syntax is invalid. |
| 978 super.test_parseCompilationUnit_exportAsPrefix(); | 976 super.test_parseCompilationUnit_exportAsPrefix(); |
| 979 } | 977 } |
| 980 | 978 |
| 981 @override | 979 @override |
| 982 @failingTest | 980 @failingTest |
| 983 void test_parseCompilationUnit_exportAsPrefix_parameterized() { | 981 void test_parseCompilationUnit_exportAsPrefix_parameterized() { |
| 984 // TODO(paulberry): As of commit 5de9108 this syntax is invalid. | 982 // TODO(paulberry): As of commit 5de9108 this syntax is invalid. |
| 985 super.test_parseCompilationUnit_exportAsPrefix_parameterized(); | 983 super.test_parseCompilationUnit_exportAsPrefix_parameterized(); |
| 986 } | 984 } |
| 987 | 985 |
| 988 @override | 986 @override |
| 989 @failingTest | 987 @failingTest |
| 990 void test_parseCompilationUnit_operatorAsPrefix_parameterized() { | |
| 991 super.test_parseCompilationUnit_operatorAsPrefix_parameterized(); | |
| 992 } | |
| 993 | |
| 994 @override | |
| 995 @failingTest | |
| 996 void test_parseDirectives_mixed() { | 988 void test_parseDirectives_mixed() { |
| 997 // TODO(paulberry,ahe): This test verifies the analyzer parser's ability to | 989 // TODO(paulberry,ahe): This test verifies the analyzer parser's ability to |
| 998 // stop parsing as soon as the first non-directive is encountered; this is | 990 // stop parsing as soon as the first non-directive is encountered; this is |
| 999 // useful for quickly traversing an import graph. Consider adding a similar | 991 // useful for quickly traversing an import graph. Consider adding a similar |
| 1000 // ability to Fasta's parser. | 992 // ability to Fasta's parser. |
| 1001 super.test_parseDirectives_mixed(); | 993 super.test_parseDirectives_mixed(); |
| 1002 } | 994 } |
| 1003 | 995 |
| 1004 @override | 996 @override |
| 1005 @failingTest | 997 @failingTest |
| 1006 void test_parsePartOfDirective_name() { | 998 void test_parsePartOfDirective_name() { |
| 1007 // TODO(paulberry,ahe): Thes test verifies that even if URIs in "part of" | 999 // TODO(paulberry,ahe): Thes test verifies that even if URIs in "part of" |
| 1008 // declarations are enabled, a construct of the form "part of identifier;" | 1000 // declarations are enabled, a construct of the form "part of identifier;" |
| 1009 // is still properly handled. URIs in "part of" declarations are not | 1001 // is still properly handled. URIs in "part of" declarations are not |
| 1010 // supported by Fasta yet. | 1002 // supported by Fasta yet. |
| 1011 super.test_parsePartOfDirective_name(); | 1003 super.test_parsePartOfDirective_name(); |
| 1012 } | 1004 } |
| 1013 | 1005 |
| 1014 @override | 1006 @override |
| 1015 @failingTest | 1007 @failingTest |
| 1016 void test_parsePartOfDirective_uri() { | 1008 void test_parsePartOfDirective_uri() { |
| 1017 // TODO(paulberry,ahe): URIs in "part of" declarations are not supported by | 1009 // TODO(paulberry,ahe): URIs in "part of" declarations are not supported by |
| 1018 // Fasta. | 1010 // Fasta. |
| 1019 super.test_parsePartOfDirective_uri(); | 1011 super.test_parsePartOfDirective_uri(); |
| 1020 } | 1012 } |
| 1021 } | 1013 } |
| OLD | NEW |