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

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

Issue 2931773005: [kernel] Delete most of the AST (Closed)
Patch Set: Remove getMainClosure handeling as it no longer exists Created 3 years, 6 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_from_binary.dart
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index f0c34cd1dab49c9515f8e8d54d17baa8b22fc2a0..3f4d454bea920b509248031006af78cd77553f1f 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -68,7 +68,7 @@ class BinaryBuilder {
}
}
- int readMagicWord() {
+ int readUint32() {
return (readByte() << 24) |
(readByte() << 16) |
(readByte() << 8) |
@@ -237,7 +237,7 @@ class BinaryBuilder {
_readOneProgram(program);
if (_byteIndex < _bytes.length) {
if (_byteIndex + 3 < _bytes.length) {
- int magic = readMagicWord();
+ int magic = readUint32();
if (magic == Tag.ProgramFile) {
throw 'Concatenated program file given when a single program '
'was expected.';
@@ -248,7 +248,7 @@ class BinaryBuilder {
}
void _readOneProgram(Program program) {
- int magic = readMagicWord();
+ int magic = readUint32();
if (magic != Tag.ProgramFile) {
throw fail('This is not a binary dart file. '
'Magic number was: ${magic.toRadixString(16)}');
@@ -264,6 +264,16 @@ class BinaryBuilder {
}
var mainMethod = readMemberReference(allowNull: true);
program.mainMethodName ??= mainMethod;
+ readUint32(); // binary offset for source table.
+ readUint32(); // binary offset for link table.
+ readUint32(); // main
+ for (int i = 0; i < numberOfLibraries; i++) {
+ readUint32(); // binary offset for library #i.
+ }
+ int numberOfLibrariesCheck = readUint32();
+ if (numberOfLibraries != numberOfLibrariesCheck) {
+ throw "Expected number of libraries to match!";
Kevin Millikin (Google) 2017/06/29 12:27:36 Even if you're just throwing a string and not some
jensj 2017/06/30 05:51:17 I'm not sure about throwing if we're not at the en
+ }
}
Map<String, Source> readUriToSource() {

Powered by Google App Engine
This is Rietveld 408576698