Index: pkg/compiler/lib/src/compiler.dart |
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart |
index 65d269cb85c32d5bfd6c39cf2e3f5805f38b99a4..a81be046d9dcd216349423a59870c8643ee5ba82 100644 |
--- a/pkg/compiler/lib/src/compiler.dart |
+++ b/pkg/compiler/lib/src/compiler.dart |
@@ -1927,11 +1927,14 @@ abstract class Compiler implements DiagnosticListener { |
} |
SourceSpan spanFromElement(Element element) { |
+ if (element != null && element.sourcePosition != null) { |
+ return element.sourcePosition; |
+ } |
while (element != null && element.isSynthesized) { |
element = element.enclosingElement; |
} |
if (element != null && |
- element.position == null && |
+ element.sourcePosition == null && |
!element.isLibrary && |
!element.isCompilationUnit) { |
// Sometimes, the backend fakes up elements that have no |
@@ -1945,6 +1948,9 @@ abstract class Compiler implements DiagnosticListener { |
if (element == null) { |
element = currentElement; |
} |
+ if (element.sourcePosition != null) { |
+ return element.sourcePosition; |
+ } |
Token position = element.position; |
Uri uri = element.compilationUnit.script.readableUri; |
return (position == null) |