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

Unified Diff: compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java

Issue 10021017: Adds parser recovery for type parameters and type arguments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updates for completion to work Created 8 years, 8 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
Index: compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
index bc775143a5c78b3fc355ff5c68ea70a81056a227..58de1a61b769a4fe0a3a36a81d12c69187ec1d07 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
@@ -232,8 +232,7 @@ public class NegativeParserTest extends CompilerTestCase {
}
/**
- * Type parameters declaration is not finished, stop parsing and restart from next top level
- * element.
+ * Type parameters declaration is not finished.
* <p>
* http://code.google.com/p/dart/issues/detail?id=341
*/
@@ -250,7 +249,8 @@ public class NegativeParserTest extends CompilerTestCase {
assertErrors(
parserRunner.getErrors(),
errEx(ParserErrorCode.EXPECTED_EXTENDS, 3, 11, 1),
- errEx(ParserErrorCode.SKIPPED_SOURCE, 3, 11, 3));
+ errEx(ParserErrorCode.EXPECTED_TOKEN, 4, 1, 1),
+ errEx(ParserErrorCode.EXPECTED_CLASS_DECLARATION_LBRACE, 5, 1, 5));
// check structure of AST
DartUnit dartUnit = parserRunner.getDartUnit();
assertEquals(
@@ -259,6 +259,9 @@ public class NegativeParserTest extends CompilerTestCase {
"class ClassWithLongEnoughName {",
"}",
"",
+ "class B<X> {",
+ "}",
+ "",
"class C {",
"}"),
dartUnit.toSource().trim());
@@ -279,7 +282,9 @@ public class NegativeParserTest extends CompilerTestCase {
"class C {",
"}"));
// check expected errors
- assertErrors(parserRunner.getErrors(), errEx(ParserErrorCode.SKIPPED_SOURCE, 3, 9, 1));
+ assertErrors(parserRunner.getErrors(),
+ errEx(ParserErrorCode.EXPECTED_TOKEN, 4, 1, 5));
+
// check structure of AST
DartUnit dartUnit = parserRunner.getDartUnit();
assertEquals(
@@ -288,6 +293,9 @@ public class NegativeParserTest extends CompilerTestCase {
"class ClassWithLongEnoughName {",
"}",
"",
+ "class B<X> {",
+ "}",
+ "",
"class C {",
"}"),
dartUnit.toSource().trim());
@@ -329,7 +337,7 @@ public class NegativeParserTest extends CompilerTestCase {
errEx(ParserErrorCode.UNEXPECTED_TOKEN_IN_STRING_INTERPOLATION, 7, 11, 1),
errEx(ParserErrorCode.UNEXPECTED_TOKEN_IN_STRING_INTERPOLATION, 8, 1, 1),
errEx(ParserErrorCode.INCOMPLETE_STRING_LITERAL, 8, 1, 1),
- errEx(ParserErrorCode.EXPECTED_SEMICOLON, 8, 2, 0));
+ errEx(ParserErrorCode.EXPECTED_COMMA_OR_RIGHT_PAREN, 8, 2, 0));
}
public void testDeprecatedFactoryInInterface() {

Powered by Google App Engine
This is Rietveld 408576698