Improve class implements/with recovery
Change-Id: I32beebbb9cc5ecec188a5a1557a2ae510d7ba214
Reviewed-on: https://dart-review.googlesource.com/54602
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart
index 5f08265..5041adb 100644
--- a/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart
@@ -68,7 +68,7 @@
ParserErrorCode.MISSING_CLASS_BODY
],
'class A extends B with _s_ {}',
- failing: allExceptEof),
+ failing: ['functionVoid', 'functionNonVoid', 'getter']),
new TestDescriptor(
'extendsNameWithBody',
'class A extends B with {}',
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index cbeb2c5..be5dbe0 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -929,10 +929,10 @@
/// ```
Token parseTypeList(Token token) {
listener.beginTypeList(token.next);
- token = parseType(token);
+ token = computeType(token, true).ensureTypeOrVoid(token, this);
int count = 1;
while (optional(',', token.next)) {
- token = parseType(token.next);
+ token = computeType(token.next, true).ensureTypeOrVoid(token.next, this);
count++;
}
listener.endTypeList(count);
diff --git a/pkg/front_end/lib/src/fasta/parser/type_info.dart b/pkg/front_end/lib/src/fasta/parser/type_info.dart
index 0addae0..4b33354 100644
--- a/pkg/front_end/lib/src/fasta/parser/type_info.dart
+++ b/pkg/front_end/lib/src/fasta/parser/type_info.dart
@@ -150,7 +150,8 @@
if ((!identical('get', value) &&
!identical('set', value) &&
!identical('factory', value) &&
- !identical('operator', value))) {
+ !identical('operator', value) &&
+ !(identical('typedef', value) && next.next.isIdentifier))) {
return new ComplexTypeInfo(token, typeParamOrArg)
.computeBuiltinAsType(required);
}