| 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
| 9 * compiled. | 9 * compiled. |
| 10 */ | 10 */ |
| (...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 return spanFromNode(node); | 1189 return spanFromNode(node); |
| 1190 } else if (node is TokenPair) { | 1190 } else if (node is TokenPair) { |
| 1191 return spanFromTokens(node.begin, node.end); | 1191 return spanFromTokens(node.begin, node.end); |
| 1192 } else if (node is Token) { | 1192 } else if (node is Token) { |
| 1193 return spanFromTokens(node, node); | 1193 return spanFromTokens(node, node); |
| 1194 } else if (node is HInstruction) { | 1194 } else if (node is HInstruction) { |
| 1195 return spanFromHInstruction(node); | 1195 return spanFromHInstruction(node); |
| 1196 } else if (node is Element) { | 1196 } else if (node is Element) { |
| 1197 return spanFromElement(node); | 1197 return spanFromElement(node); |
| 1198 } else if (node is MetadataAnnotation) { | 1198 } else if (node is MetadataAnnotation) { |
| 1199 Uri uri = node.annotatedElement.compilationUnit.script.readableUri; | 1199 Uri uri = node.annotatedElement.compilationUnit.script.resourceUri; |
| 1200 return spanFromTokens(node.beginToken, node.endToken, uri); | 1200 return spanFromTokens(node.beginToken, node.endToken, uri); |
| 1201 } else if (node is Local) { | 1201 } else if (node is Local) { |
| 1202 Local local = node; | 1202 Local local = node; |
| 1203 return spanFromElement(local.executableContext); | 1203 return spanFromElement(local.executableContext); |
| 1204 } else { | 1204 } else { |
| 1205 throw 'No error location.'; | 1205 throw 'No error location.'; |
| 1206 } | 1206 } |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 Element _elementFromHInstruction(HInstruction instruction) { | 1209 Element _elementFromHInstruction(HInstruction instruction) { |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1915 } | 1915 } |
| 1916 | 1916 |
| 1917 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { | 1917 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { |
| 1918 if (begin == null || end == null) { | 1918 if (begin == null || end == null) { |
| 1919 // TODO(ahe): We can almost always do better. Often it is only | 1919 // TODO(ahe): We can almost always do better. Often it is only |
| 1920 // end that is null. Otherwise, we probably know the current | 1920 // end that is null. Otherwise, we probably know the current |
| 1921 // URI. | 1921 // URI. |
| 1922 throw 'Cannot find tokens to produce error message.'; | 1922 throw 'Cannot find tokens to produce error message.'; |
| 1923 } | 1923 } |
| 1924 if (uri == null && currentElement != null) { | 1924 if (uri == null && currentElement != null) { |
| 1925 uri = currentElement.compilationUnit.script.readableUri; | 1925 uri = currentElement.compilationUnit.script.resourceUri; |
| 1926 } | 1926 } |
| 1927 return SourceSpan.withCharacterOffsets(begin, end, | 1927 return SourceSpan.withCharacterOffsets(begin, end, |
| 1928 (beginOffset, endOffset) => new SourceSpan(uri, beginOffset, endOffset)); | 1928 (beginOffset, endOffset) => new SourceSpan(uri, beginOffset, endOffset)); |
| 1929 } | 1929 } |
| 1930 | 1930 |
| 1931 SourceSpan spanFromNode(Node node) { | 1931 SourceSpan spanFromNode(Node node) { |
| 1932 return spanFromTokens(node.getBeginToken(), node.getEndToken()); | 1932 return spanFromTokens(node.getBeginToken(), node.getEndToken()); |
| 1933 } | 1933 } |
| 1934 | 1934 |
| 1935 SourceSpan spanFromElement(Element element) { | 1935 SourceSpan spanFromElement(Element element) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1955 element = currentElement; | 1955 element = currentElement; |
| 1956 } | 1956 } |
| 1957 if (element == null) { | 1957 if (element == null) { |
| 1958 return null; | 1958 return null; |
| 1959 } | 1959 } |
| 1960 | 1960 |
| 1961 if (element.sourcePosition != null) { | 1961 if (element.sourcePosition != null) { |
| 1962 return element.sourcePosition; | 1962 return element.sourcePosition; |
| 1963 } | 1963 } |
| 1964 Token position = element.position; | 1964 Token position = element.position; |
| 1965 Uri uri = element.compilationUnit.script.readableUri; | 1965 Uri uri = element.compilationUnit.script.resourceUri; |
| 1966 return (position == null) | 1966 return (position == null) |
| 1967 ? new SourceSpan(uri, 0, 0) | 1967 ? new SourceSpan(uri, 0, 0) |
| 1968 : spanFromTokens(position, position, uri); | 1968 : spanFromTokens(position, position, uri); |
| 1969 } | 1969 } |
| 1970 | 1970 |
| 1971 SourceSpan spanFromHInstruction(HInstruction instruction) { | 1971 SourceSpan spanFromHInstruction(HInstruction instruction) { |
| 1972 Element element = _elementFromHInstruction(instruction); | 1972 Element element = _elementFromHInstruction(instruction); |
| 1973 if (element == null) element = currentElement; | 1973 if (element == null) element = currentElement; |
| 1974 SourceInformation position = instruction.sourceInformation; | 1974 SourceInformation position = instruction.sourceInformation; |
| 1975 if (position == null) return spanFromElement(element); | 1975 if (position == null) return spanFromElement(element); |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2507 InterfaceType streamType([DartType elementType]) { | 2507 InterfaceType streamType([DartType elementType]) { |
| 2508 InterfaceType type = streamClass.computeType(compiler); | 2508 InterfaceType type = streamClass.computeType(compiler); |
| 2509 if (elementType == null) { | 2509 if (elementType == null) { |
| 2510 return streamClass.rawType; | 2510 return streamClass.rawType; |
| 2511 } | 2511 } |
| 2512 return type.createInstantiation([elementType]); | 2512 return type.createInstantiation([elementType]); |
| 2513 } | 2513 } |
| 2514 } | 2514 } |
| 2515 | 2515 |
| 2516 typedef void InternalErrorFunction(Spannable location, String message); | 2516 typedef void InternalErrorFunction(Spannable location, String message); |
| OLD | NEW |