Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: pkg/kernel/lib/analyzer/loader.dart

Issue 2729913005: [Fasta] include source code in dill (Closed)
Patch Set: Use Uint8List.view when possible Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/target_implementation.dart ('k') | pkg/kernel/lib/ast.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/analyzer/loader.dart
diff --git a/pkg/kernel/lib/analyzer/loader.dart b/pkg/kernel/lib/analyzer/loader.dart
index 644184bbbb2aeff02242f1f3ac71a25bfbf9f50e..ca502282a71732f7dec6a94bffe4f6a0735e5880 100644
--- a/pkg/kernel/lib/analyzer/loader.dart
+++ b/pkg/kernel/lib/analyzer/loader.dart
@@ -4,6 +4,7 @@
library kernel.analyzer.loader;
import 'dart:async';
+import 'dart:convert';
import 'dart:io' as io;
import 'package:analyzer/analyzer.dart';
@@ -827,12 +828,13 @@ class DartLoader implements ReferenceLevelLoader {
in libraryElement.units) {
var source = compilationUnitElement.source;
LineInfo lineInfo = context.computeLineInfo(source);
- String sourceCode;
+ List<int> sourceCode;
try {
- sourceCode = context.getContents(source).data;
+ sourceCode =
+ const Utf8Encoder().convert(context.getContents(source).data);
} catch (e) {
// The source's contents could not be accessed.
- sourceCode = '';
+ sourceCode = const <int>[];
}
program.uriToSource['${source.uri}'] =
new ast.Source(lineInfo.lineStarts, sourceCode);
« no previous file with comments | « pkg/front_end/lib/src/fasta/target_implementation.dart ('k') | pkg/kernel/lib/ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698