| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 library kernel.ast_from_binary; | 4 library kernel.ast_from_binary; |
| 5 | 5 |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 8 | 8 |
| 9 import '../ast.dart'; | 9 import '../ast.dart'; |
| 10 import '../transformations/flags.dart'; | 10 import '../transformations/flags.dart'; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 } | 380 } |
| 381 | 381 |
| 382 debugPath.add(library.name ?? library.importUri?.toString() ?? 'library'); | 382 debugPath.add(library.name ?? library.importUri?.toString() ?? 'library'); |
| 383 | 383 |
| 384 if (shouldWriteData) { | 384 if (shouldWriteData) { |
| 385 _fillTreeNodeList(library.annotations, readExpression, library); | 385 _fillTreeNodeList(library.annotations, readExpression, library); |
| 386 } else { | 386 } else { |
| 387 _skipNodeList(readExpression); | 387 _skipNodeList(readExpression); |
| 388 } | 388 } |
| 389 _readLibraryDependencies(library); | 389 _readLibraryDependencies(library); |
| 390 _readAdditionalExports(library); |
| 390 _readLibraryParts(library); | 391 _readLibraryParts(library); |
| 391 _mergeNamedNodeList(library.typedefs, readTypedef, library); | 392 _mergeNamedNodeList(library.typedefs, readTypedef, library); |
| 392 _mergeNamedNodeList(library.classes, readClass, library); | 393 _mergeNamedNodeList(library.classes, readClass, library); |
| 393 _mergeNamedNodeList(library.fields, readField, library); | 394 _mergeNamedNodeList(library.fields, readField, library); |
| 394 _mergeNamedNodeList(library.procedures, readProcedure, library); | 395 _mergeNamedNodeList(library.procedures, readProcedure, library); |
| 395 | 396 |
| 396 debugPath.removeLast(); | 397 debugPath.removeLast(); |
| 397 _currentLibrary = null; | 398 _currentLibrary = null; |
| 398 return library; | 399 return library; |
| 399 } | 400 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 410 var annotations = readExpressionList(); | 411 var annotations = readExpressionList(); |
| 411 var targetLibrary = readLibraryReference(); | 412 var targetLibrary = readLibraryReference(); |
| 412 var prefixName = readStringOrNullIfEmpty(); | 413 var prefixName = readStringOrNullIfEmpty(); |
| 413 var names = readCombinatorList(); | 414 var names = readCombinatorList(); |
| 414 library.dependencies[i] = new LibraryDependency.byReference( | 415 library.dependencies[i] = new LibraryDependency.byReference( |
| 415 flags, annotations, targetLibrary, prefixName, names) | 416 flags, annotations, targetLibrary, prefixName, names) |
| 416 ..parent = library; | 417 ..parent = library; |
| 417 } | 418 } |
| 418 } | 419 } |
| 419 | 420 |
| 421 void _readAdditionalExports(Library library) { |
| 422 int numExportedReference = readUInt(); |
| 423 if (numExportedReference != 0) { |
| 424 for (int i = 0; i < numExportedReference; i++) { |
| 425 CanonicalName exportedName = readCanonicalNameReference(); |
| 426 Reference reference = exportedName.getReference(); |
| 427 library.additionalExports.add(reference); |
| 428 } |
| 429 } |
| 430 } |
| 431 |
| 420 Combinator readCombinator() { | 432 Combinator readCombinator() { |
| 421 var isShow = readUInt() == 1; | 433 var isShow = readUInt() == 1; |
| 422 var names = readStringReferenceList(); | 434 var names = readStringReferenceList(); |
| 423 return new Combinator(isShow, names); | 435 return new Combinator(isShow, names); |
| 424 } | 436 } |
| 425 | 437 |
| 426 List<Combinator> readCombinatorList() { | 438 List<Combinator> readCombinatorList() { |
| 427 return new List<Combinator>.generate(readUInt(), (i) => readCombinator()); | 439 return new List<Combinator>.generate(readUInt(), (i) => readCombinator()); |
| 428 } | 440 } |
| 429 | 441 |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 ..fileOffset = offset | 1293 ..fileOffset = offset |
| 1282 ..fileEqualsOffset = fileEqualsOffset; | 1294 ..fileEqualsOffset = fileEqualsOffset; |
| 1283 } | 1295 } |
| 1284 | 1296 |
| 1285 int readOffset() { | 1297 int readOffset() { |
| 1286 // Offset is saved as unsigned, | 1298 // Offset is saved as unsigned, |
| 1287 // but actually ranges from -1 and up (thus the -1) | 1299 // but actually ranges from -1 and up (thus the -1) |
| 1288 return readUInt() - 1; | 1300 return readUInt() - 1; |
| 1289 } | 1301 } |
| 1290 } | 1302 } |
| OLD | NEW |