| 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..9923be85526de19f2739f22c1a0673e5ed05b2bc 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,20 @@ class BinaryBuilder {
|
| }
|
| var mainMethod = readMemberReference(allowNull: true);
|
| program.mainMethodName ??= mainMethod;
|
| +
|
| + // Read the program index.
|
| + 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 'Malformed binary: the program index indicates there are '
|
| + '$numberOfLibrariesCheck libraries but the binary contains '
|
| + '$numberOfLibraries.';
|
| + }
|
| }
|
|
|
| Map<String, Source> readUriToSource() {
|
|
|