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

Unified Diff: dart/pkg/compiler/lib/src/scanner/parser_task.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
Index: dart/pkg/compiler/lib/src/scanner/parser_task.dart
diff --git a/dart/pkg/compiler/lib/src/scanner/parser_task.dart b/dart/pkg/compiler/lib/src/scanner/parser_task.dart
index 0a9b8493e46898aaecf4db6fad817c4a9f678930..af9a013ee54851e2477d638cfeffabcb9a9216c1 100644
--- a/dart/pkg/compiler/lib/src/scanner/parser_task.dart
+++ b/dart/pkg/compiler/lib/src/scanner/parser_task.dart
@@ -16,7 +16,12 @@ class ParserTask extends CompilerTask {
return measure(() {
NodeListener listener = new NodeListener(compiler, null);
Parser parser = new Parser(listener);
- parser.parseUnit(token);
+ try {
+ parser.parseUnit(token);
+ } on ParserError catch (e) {
+ assert(invariant(token, compiler.compilationFailed));
+ return listener.makeNodeList(0, null, null, '\n');
+ }
Node result = listener.popNode();
assert(listener.nodes.isEmpty);
return result;
« no previous file with comments | « dart/pkg/compiler/lib/src/scanner/listener.dart ('k') | dart/pkg/compiler/lib/src/scanner/scanner_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698