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

Unified Diff: pkg/kernel/lib/binary/ast_to_binary.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/kernel/lib/binary/ast_from_binary.dart ('k') | pkg/kernel/lib/transformations/closure/mock.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/binary/ast_to_binary.dart
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index a2deddb6a43398cb6668ac5931d174a1da6fe9e7..b6121548c9b8ef17d74dffdac30ee1fa6ef1ab43 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -69,6 +69,11 @@ class BinaryPrinter extends Visitor {
writeByte(value & 0xFF);
}
+ void writeUtf8Bytes(List<int> utf8Bytes) {
+ writeUInt30(utf8Bytes.length);
+ writeBytes(utf8Bytes);
+ }
+
void writeStringTableEntry(String string) {
List<int> utf8Bytes = const Utf8Encoder().convert(string);
writeUInt30(utf8Bytes.length);
@@ -171,9 +176,9 @@ class BinaryPrinter extends Visitor {
writeStringTable(_sourceUriIndexer);
for (int i = 0; i < _sourceUriIndexer.entries.length; i++) {
String uri = _sourceUriIndexer.entries[i].value;
- Source source = program.uriToSource[uri] ?? new Source([], '');
- String sourceCode = source.source;
- writeStringTableEntry(sourceCode);
+ Source source =
+ program.uriToSource[uri] ?? new Source(<int>[], const <int>[]);
+ writeUtf8Bytes(source.source);
List<int> lineStarts = source.lineStarts;
writeUInt30(lineStarts.length);
int previousLineStart = 0;
« no previous file with comments | « pkg/kernel/lib/binary/ast_from_binary.dart ('k') | pkg/kernel/lib/transformations/closure/mock.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698