Index: pkg/analyzer/test/generated/parser_fasta_test.dart |
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart |
index e379dee465c41b049f4ddf349a1d298695a183b7..ca1c58762bc3a5b61345001af10014dab7b3156c 100644 |
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart |
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart |
@@ -6,10 +6,12 @@ import 'package:analyzer/dart/ast/ast.dart'; |
import 'package:analyzer/dart/ast/token.dart' as analyzer; |
import 'package:analyzer/dart/element/element.dart'; |
import 'package:analyzer/error/error.dart'; |
+import 'package:analyzer/src/dart/scanner/scanner.dart'; |
import 'package:analyzer/src/fasta/ast_builder.dart'; |
import 'package:analyzer/src/fasta/element_store.dart'; |
import 'package:analyzer/src/generated/parser.dart' as analyzer; |
import 'package:analyzer/src/generated/utilities_dart.dart'; |
+import 'package:analyzer/src/string_source.dart'; |
import 'package:front_end/src/fasta/kernel/kernel_builder.dart'; |
import 'package:front_end/src/fasta/kernel/kernel_library_builder.dart'; |
import 'package:front_end/src/fasta/parser/identifier_context.dart' |
@@ -21,6 +23,7 @@ import 'package:test/test.dart'; |
import 'package:test_reflective_loader/test_reflective_loader.dart'; |
import 'parser_test.dart'; |
+import 'test_support.dart'; |
main() { |
defineReflectiveSuite(() { |
@@ -387,10 +390,23 @@ class FastaParserTestCase extends Object |
} |
@override |
- CompilationUnit parseCompilationUnit(String source, |
- [List<ErrorCode> errorCodes = const <ErrorCode>[]]) { |
- return _runParser(source, (parser) => parser.parseUnit, errorCodes) |
- as CompilationUnit; |
+ CompilationUnit parseCompilationUnit(String content, |
+ [List<ErrorCode> expectedErrorCodes = const <ErrorCode>[]]) { |
+ // Scan tokens |
+ var source = new StringSource(content, 'parser_test_StringSource.dart'); |
+ GatheringErrorListener listener = new GatheringErrorListener(); |
+ var scanner = new Scanner.fasta(source, listener); |
+ scanner.scanGenericMethodComments = enableGenericMethodComments; |
+ _fastaTokens = scanner.tokenize(); |
+ |
+ // Run parser |
+ analyzer.Parser parser = |
+ new analyzer.Parser(source, listener, useFasta: true); |
+ CompilationUnit unit = parser.parseCompilationUnit(_fastaTokens); |
+ |
+ // Assert and return result |
+ listener.assertErrorsWithCodes(expectedErrorCodes); |
+ return unit; |
} |
@override |