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

Unified Diff: pkg/kernel/lib/binary/ast_to_binary.dart

Issue 2729913005: [Fasta] include source code in dill (Closed)
Patch Set: Addressed comments Created 3 years, 10 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
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 a242338dfa7465858ffd90a70a722d55a2556579..243277c37037ff3fd87937fb5b24527741400890 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 writeRawString(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,8 @@ 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([], const <int>[]);
+ writeRawString(source.source);
List<int> lineStarts = source.lineStarts;
writeUInt30(lineStarts.length);
int previousLineStart = 0;

Powered by Google App Engine
This is Rietveld 408576698