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

Unified Diff: dart/frog/leg/compiler.dart

Issue 9692018: Unresolved super-send is not a compile-time error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review coments Created 8 years, 9 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/frog/leg/resolver.dart » ('j') | dart/frog/leg/resolver.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/compiler.dart
diff --git a/dart/frog/leg/compiler.dart b/dart/frog/leg/compiler.dart
index 0322d64718e248aa095974fc1818e3b38edc9616..e171b5b8662fdc8efdc899d2ba21a3af086c2f1d 100644
--- a/dart/frog/leg/compiler.dart
+++ b/dart/frog/leg/compiler.dart
@@ -374,9 +374,15 @@ class Compiler implements DiagnosticListener {
throw 'cannot find tokens to produce error message';
}
final startOffset = begin.charOffset;
- // TODO(ahe): Compute proper end offset.
+ // TODO(ahe): Compute proper end offset in token. Right now we use
+ // the position of the next token. We want to preserve the
+ // invariant that endOffset > startOffset, but for EOF the
+ // charoffset of the next token may be [startOffset]. This can
+ // also happen for synthetized tokens that are produced during
+ // error handling.
final endOffset =
- (end.next !== null) ? end.next.charOffset : startOffset + 1;
+ Math.max((end.next !== null) ? end.next.charOffset : 0, startOffset + 1);
+ assert(endOffset > startOffset);
Uri uri = currentElement.getCompilationUnit().script.uri;
return new SourceSpan(uri, startOffset, endOffset);
}
« no previous file with comments | « no previous file | dart/frog/leg/resolver.dart » ('j') | dart/frog/leg/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698