Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * If true, print a warning for each method that was resolved, but not | 7 * If true, print a warning for each method that was resolved, but not |
| 8 * compiled. | 8 * compiled. |
| 9 */ | 9 */ |
| 10 const bool REPORT_EXCESS_RESOLUTION = false; | 10 const bool REPORT_EXCESS_RESOLUTION = false; |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 817 } | 817 } |
| 818 return SourceSpan.withCharacterOffsets(begin, end, | 818 return SourceSpan.withCharacterOffsets(begin, end, |
| 819 (beginOffset, endOffset) => new SourceSpan(uri, beginOffset, endOffset)); | 819 (beginOffset, endOffset) => new SourceSpan(uri, beginOffset, endOffset)); |
| 820 } | 820 } |
| 821 | 821 |
| 822 SourceSpan spanFromNode(Node node, [Uri uri]) { | 822 SourceSpan spanFromNode(Node node, [Uri uri]) { |
| 823 return spanFromTokens(node.getBeginToken(), node.getEndToken(), uri); | 823 return spanFromTokens(node.getBeginToken(), node.getEndToken(), uri); |
| 824 } | 824 } |
| 825 | 825 |
| 826 SourceSpan spanFromElement(Element element) { | 826 SourceSpan spanFromElement(Element element) { |
| 827 if (Element.isErroneousElement(element)) { | |
|
ngeoffray
2012/09/07 08:12:46
Instead of special casing here, could you implemen
karlklose
2012/09/07 09:24:01
I wanted it to be similar to the case for the othe
ahe
2012/09/07 12:18:53
I don't think you're supposed to call spanFromElem
| |
| 828 element = element.enclosingElement; | |
| 829 } | |
| 827 if (element.position() === null) { | 830 if (element.position() === null) { |
| 828 // Sometimes, the backend fakes up elements that have no | 831 // Sometimes, the backend fakes up elements that have no |
| 829 // position. So we use the enclosing element instead. It is | 832 // position. So we use the enclosing element instead. It is |
| 830 // not a good error location, but cancel really is "internal | 833 // not a good error location, but cancel really is "internal |
| 831 // error" or "not implemented yet", so the vicinity is good | 834 // error" or "not implemented yet", so the vicinity is good |
| 832 // enough for now. | 835 // enough for now. |
| 833 element = element.enclosingElement; | 836 element = element.enclosingElement; |
| 834 // TODO(ahe): I plan to overhaul this infrastructure anyways. | 837 // TODO(ahe): I plan to overhaul this infrastructure anyways. |
| 835 } | 838 } |
| 836 if (element === null) { | 839 if (element === null) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 928 final endOffset = end.charOffset + end.slowCharCount; | 931 final endOffset = end.charOffset + end.slowCharCount; |
| 929 | 932 |
| 930 // [begin] and [end] might be the same for the same empty token. This | 933 // [begin] and [end] might be the same for the same empty token. This |
| 931 // happens for instance when scanning '$$'. | 934 // happens for instance when scanning '$$'. |
| 932 assert(endOffset >= beginOffset); | 935 assert(endOffset >= beginOffset); |
| 933 return f(beginOffset, endOffset); | 936 return f(beginOffset, endOffset); |
| 934 } | 937 } |
| 935 | 938 |
| 936 String toString() => 'SourceSpan($uri, $begin, $end)'; | 939 String toString() => 'SourceSpan($uri, $begin, $end)'; |
| 937 } | 940 } |
| OLD | NEW |