Chromium Code Reviews| Index: lib/compiler/implementation/compiler.dart |
| diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart |
| index 7da90baf06fdd271888a85a5197a9e503fdb9df6..1a96d78e43d0bee975916db0ef1440e0c017b197 100644 |
| --- a/lib/compiler/implementation/compiler.dart |
| +++ b/lib/compiler/implementation/compiler.dart |
| @@ -781,8 +781,8 @@ class Compiler implements DiagnosticListener { |
| new SourceSpan(uri, beginOffset, endOffset)); |
| } |
| - SourceSpan spanFromNode(Node node) { |
| - return spanFromTokens(node.getBeginToken(), node.getEndToken()); |
| + SourceSpan spanFromNode(Node node, [Uri uri]) { |
| + return spanFromTokens(node.getBeginToken(), node.getEndToken(), uri); |
| } |
| SourceSpan spanFromElement(Element element) { |
| @@ -879,15 +879,11 @@ class SourceSpan { |
| static withOffsets(Token begin, Token end, |
|
Lasse Reichstein Nielsen
2012/06/27 09:22:16
withOffsets -> withCharacterOffsets ?
|
| f(int beginOffset, int endOffset)) { |
| final beginOffset = begin.charOffset; |
| - // 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 > beginOffset, but for EOF the |
| - // charoffset of the next token may be [beginOffset]. This can |
| - // also happen for synthetized tokens that are produced during |
| - // error handling. |
| - final endOffset = |
| - Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1); |
| - assert(endOffset > beginOffset); |
| + final endOffset = end.charOffset + end.slowCharLength; |
|
Lasse Reichstein Nielsen
2012/06/27 09:22:16
slowCharLength -> slowCharCount
|
| + |
| + // [begin] and [end] might be the same empty token. This happens for |
|
Lasse Reichstein Nielsen
2012/06/27 09:22:16
"the same empty token" -> "the same for the empty
|
| + // instance when parsing '$$'. |
|
Lasse Reichstein Nielsen
2012/06/27 09:22:16
parsing -> scanning.
|
| + assert(endOffset >= beginOffset); |
| return f(beginOffset, endOffset); |
| } |
| } |