Index: pkg/compiler/lib/src/compiler.dart |
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart |
index 234c7e17f18c0257c13e2c37efd79c06ba87af7f..94b573a422ddc5cc9fcc449ebd2af964a4cd4c8f 100644 |
--- a/pkg/compiler/lib/src/compiler.dart |
+++ b/pkg/compiler/lib/src/compiler.dart |
@@ -1658,8 +1658,9 @@ class CompilerDiagnosticReporter extends DiagnosticReporter { |
if (astElement.hasNode) { |
Token from = astElement.node.getBeginToken(); |
Token to = astElement.node.getEndToken(); |
- if (astElement.metadata.isNotEmpty) { |
- from = astElement.metadata.first.beginToken; |
+ if (astElement.metadata.isNotEmpty && |
+ astElement.metadata.first.hasNode) { |
+ from = astElement.metadata.first.node.getBeginToken(); |
} |
return validateToken(from, to); |
} |
@@ -1740,8 +1741,7 @@ class CompilerDiagnosticReporter extends DiagnosticReporter { |
} else if (node is Element) { |
return spanFromElement(node); |
} else if (node is MetadataAnnotation) { |
- Uri uri = node.annotatedElement.compilationUnit.script.resourceUri; |
- return spanFromTokens(node.beginToken, node.endToken, uri); |
+ return node.sourcePosition; |
} else if (node is Local) { |
Local local = node; |
return spanFromElement(local.executableContext); |