Index: pkg/analyzer/lib/src/source/source_resource.dart |
diff --git a/pkg/analyzer/lib/src/source/source_resource.dart b/pkg/analyzer/lib/src/source/source_resource.dart |
index 63b906cb3c884cbfc89ea4bf170fce82acc9cb49..b7fb2d0b76f193f94760a9680ec9579ca9663c62 100644 |
--- a/pkg/analyzer/lib/src/source/source_resource.dart |
+++ b/pkg/analyzer/lib/src/source/source_resource.dart |
@@ -9,6 +9,7 @@ import 'dart:collection'; |
import 'package:analyzer/file_system/file_system.dart'; |
import 'package:analyzer/src/generated/engine.dart'; |
import 'package:analyzer/src/generated/source.dart'; |
+import 'package:source_span/source_span.dart' as source_span; |
/** |
* A function that can translate the contents of files on disk as they are read. |
@@ -35,6 +36,8 @@ class FileSource extends Source { |
*/ |
static final Map<String, int> _idTable = new HashMap<String, int>(); |
+ source_span.SourceFile _sourceFile; |
+ |
/** |
* The URI from which this source was originally derived. |
*/ |
@@ -119,6 +122,10 @@ class FileSource extends Source { |
String get shortName => file.shortName; |
@override |
+ source_span.SourceFile get sourceFile => _sourceFile ??= |
+ new source_span.SourceFile(file.readAsStringSync(), url: uri); |
+ |
+ @override |
UriKind get uriKind => UriKind.fromScheme(uri.scheme); |
@override |