Index: pkg/analyzer/lib/src/dart/scanner/scanner.dart |
diff --git a/pkg/analyzer/lib/src/dart/scanner/scanner.dart b/pkg/analyzer/lib/src/dart/scanner/scanner.dart |
index fba9b6321c3808347ae41cd25b5cb5401617043c..ad20ed23f7f29cb16712b176f04d3aba5d6bbb2e 100644 |
--- a/pkg/analyzer/lib/src/dart/scanner/scanner.dart |
+++ b/pkg/analyzer/lib/src/dart/scanner/scanner.dart |
@@ -48,10 +48,16 @@ class Scanner extends fe.Scanner { |
factory Scanner(Source source, CharacterReader reader, |
AnalysisErrorListener errorListener) => |
fe.Scanner.useFasta |
- ? new _Scanner2( |
- source, reader.getContents(), reader.offset, errorListener) |
+ ? new Scanner.fasta(source, errorListener, |
+ contents: reader.getContents(), offset: reader.offset) |
: new Scanner._(source, reader, errorListener); |
+ factory Scanner.fasta(Source source, AnalysisErrorListener errorListener, |
+ {String contents, int offset: 0}) { |
+ return new _Scanner2( |
+ source, contents ?? source.contents.data, offset, errorListener); |
+ } |
+ |
Scanner._(this.source, CharacterReader reader, this._errorListener) |
: super.create(reader); |