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

Unified Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 1693963002: Fix parsing of generic local functions (issue 25769) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: backout unintended changes Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 2b33566942c71c9950b5b72b37a47b0aa014fa28..f693034f136cd6cfe18e5a518bc23e97178e94ce 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -505,6 +505,16 @@ class C {
BinaryExpression, expression.leftOperand);
}
+ void test_topLevelFunction_nestedGenericFunction() {
+ enableGenericMethods = true;
+ parseCompilationUnitWithOptions('''
+void f() {
+ void g<T>() {
+ }
+}
+''');
+ }
+
void _validate_assignableExpression_arguments_normal_chain_typeArguments(
String code) {
PropertyAccess propertyAccess1 = parseExpression(code);
@@ -2871,6 +2881,30 @@ class ParserTestCase extends EngineTestCase {
parse3(methodName, _EMPTY_ARGUMENTS, source, errorCodes);
/**
+ * Parse the given [source] as a compilation unit. Throw an exception if the
+ * source could not be parsed, if the compilation errors in the source do not
+ * match those that are expected, or if the result would have been `null`.
+ */
+ CompilationUnit parseCompilationUnitWithOptions(String source,
+ [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
+ GatheringErrorListener listener = new GatheringErrorListener();
+ Scanner scanner =
+ new Scanner(null, new CharSequenceReader(source), listener);
+ listener.setLineInfo(new TestSource(), scanner.lineStarts);
+ Token token = scanner.tokenize();
+ Parser parser = createParser(listener);
+ parser.parseAsync = parseAsync;
+ parser.parseFunctionBodies = parseFunctionBodies;
+ parser.parseConditionalDirectives = enableConditionalDirectives;
+ parser.parseGenericMethods = enableGenericMethods;
+ parser.parseGenericMethodComments = enableGenericMethodComments;
+ CompilationUnit unit = parser.parseCompilationUnit(token);
+ expect(unit, isNotNull);
+ listener.assertErrorsWithCodes(errorCodes);
+ return unit;
+ }
+
+ /**
* Parse the given source as an expression.
*
* @param source the source to be parsed
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698