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

Unified Diff: dart/pkg/compiler/lib/src/patch_parser.dart

Issue 808953004: Recover from fatal parser errors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r42860. Created 5 years, 11 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 | « no previous file | dart/pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/compiler/lib/src/patch_parser.dart
diff --git a/dart/pkg/compiler/lib/src/patch_parser.dart b/dart/pkg/compiler/lib/src/patch_parser.dart
index 51b5cac215da27ee87e479110c94674c46ec58ee..80bf4c4a888b63f605549712fbaccc0309e087db 100644
--- a/dart/pkg/compiler/lib/src/patch_parser.dart
+++ b/dart/pkg/compiler/lib/src/patch_parser.dart
@@ -170,7 +170,14 @@ class PatchParserTask extends CompilerTask {
Listener patchListener = new PatchElementListener(compiler,
compilationUnit,
idGenerator);
- new PartialParser(patchListener).parseUnit(tokens);
+ try {
+ new PartialParser(patchListener).parseUnit(tokens);
+ } on ParserError catch (e) {
+ // No need to recover from a parser error in platform libraries, user
+ // will never see this if the libraries are tested correctly.
+ compiler.internalError(
+ compilationUnit, "Parser error in patch file: $e");
+ }
});
}
@@ -182,8 +189,15 @@ class PatchParserTask extends CompilerTask {
measure(() => compiler.withCurrentElement(element, () {
MemberListener listener = new MemberListener(compiler, element);
Parser parser = new PatchClassElementParser(listener);
- Token token = parser.parseTopLevelDeclaration(element.beginToken);
- assert(identical(token, element.endToken.next));
+ try {
+ Token token = parser.parseTopLevelDeclaration(element.beginToken);
+ assert(identical(token, element.endToken.next));
+ } on ParserError catch (e) {
+ // No need to recover from a parser error in platform libraries, user
+ // will never see this if the libraries are tested correctly.
+ compiler.internalError(
+ element, "Parser error in patch file: $e");
+ }
element.cachedNode = listener.popNode();
assert(listener.nodes.isEmpty);
« no previous file with comments | « no previous file | dart/pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698