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

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

Issue 2587673004: Include source in kernel. (Closed)
Patch Set: Fixed some rebase errors Created 3 years, 12 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/ast.dart ('k') | pkg/kernel/lib/binary/ast_to_binary.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/binary/ast_from_binary.dart
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index 39b1b9870c036771d2e10e762ff85e0a0fdf3179..0dee08d44ed19a63acf53af9a77533062490b5a1 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -177,7 +177,7 @@ class BinaryBuilder {
'Magic number was: ${magic.toRadixString(16)}');
}
readStringTable();
- Map<String, List<int>> uriToLineStarts = readUriToLineStarts();
+ Map<String, Source> uriToSource = readUriToSource();
importTable.length = readUInt();
for (int i = 0; i < importTable.length; ++i) {
importTable[i] = new Library(null);
@@ -187,15 +187,17 @@ class BinaryBuilder {
readLibrary();
}
var mainMethod = readMemberReference(allowNull: true);
- return new Program(importTable, uriToLineStarts)..mainMethod = mainMethod;
+ return new Program(importTable, uriToSource)
+ ..mainMethod = mainMethod;
}
- Map<String, List<int>> readUriToLineStarts() {
+ Map<String, Source> readUriToSource() {
readSourceUriTable();
int length = _sourceUriTable.length;
- Map<String, List<int>> uriToLineStarts = {};
+ Map<String, Source> uriToLineStarts = <String, Source>{};
for (int i = 0; i < length; ++i) {
String uri = _sourceUriTable[i];
+ String sourceCode = readStringEntry();
int lineCount = readUInt();
List<int> lineStarts = new List<int>(lineCount);
int previousLineStart = 0;
@@ -204,7 +206,7 @@ class BinaryBuilder {
lineStarts[j] = lineStart;
previousLineStart = lineStart;
}
- uriToLineStarts[uri] = lineStarts;
+ uriToLineStarts[uri] = new Source(lineStarts, sourceCode);
}
return uriToLineStarts;
}
« no previous file with comments | « pkg/kernel/lib/ast.dart ('k') | pkg/kernel/lib/binary/ast_to_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698