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); | |
391 _readLibraryParts(library); | 390 _readLibraryParts(library); |
392 _mergeNamedNodeList(library.typedefs, readTypedef, library); | 391 _mergeNamedNodeList(library.typedefs, readTypedef, library); |
393 _mergeNamedNodeList(library.classes, readClass, library); | 392 _mergeNamedNodeList(library.classes, readClass, library); |
394 _mergeNamedNodeList(library.fields, readField, library); | 393 _mergeNamedNodeList(library.fields, readField, library); |
395 _mergeNamedNodeList(library.procedures, readProcedure, library); | 394 _mergeNamedNodeList(library.procedures, readProcedure, library); |
396 | 395 |
397 debugPath.removeLast(); | 396 debugPath.removeLast(); |
398 _currentLibrary = null; | 397 _currentLibrary = null; |
399 return library; | 398 return library; |
400 } | 399 } |
(...skipping 10 matching lines...) Expand all Loading... |
411 var annotations = readExpressionList(); | 410 var annotations = readExpressionList(); |
412 var targetLibrary = readLibraryReference(); | 411 var targetLibrary = readLibraryReference(); |
413 var prefixName = readStringOrNullIfEmpty(); | 412 var prefixName = readStringOrNullIfEmpty(); |
414 var names = readCombinatorList(); | 413 var names = readCombinatorList(); |
415 library.dependencies[i] = new LibraryDependency.byReference( | 414 library.dependencies[i] = new LibraryDependency.byReference( |
416 flags, annotations, targetLibrary, prefixName, names) | 415 flags, annotations, targetLibrary, prefixName, names) |
417 ..parent = library; | 416 ..parent = library; |
418 } | 417 } |
419 } | 418 } |
420 | 419 |
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 | |
432 Combinator readCombinator() { | 420 Combinator readCombinator() { |
433 var isShow = readUInt() == 1; | 421 var isShow = readUInt() == 1; |
434 var names = readStringReferenceList(); | 422 var names = readStringReferenceList(); |
435 return new Combinator(isShow, names); | 423 return new Combinator(isShow, names); |
436 } | 424 } |
437 | 425 |
438 List<Combinator> readCombinatorList() { | 426 List<Combinator> readCombinatorList() { |
439 return new List<Combinator>.generate(readUInt(), (i) => readCombinator()); | 427 return new List<Combinator>.generate(readUInt(), (i) => readCombinator()); |
440 } | 428 } |
441 | 429 |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 ..fileOffset = offset | 1281 ..fileOffset = offset |
1294 ..fileEqualsOffset = fileEqualsOffset; | 1282 ..fileEqualsOffset = fileEqualsOffset; |
1295 } | 1283 } |
1296 | 1284 |
1297 int readOffset() { | 1285 int readOffset() { |
1298 // Offset is saved as unsigned, | 1286 // Offset is saved as unsigned, |
1299 // but actually ranges from -1 and up (thus the -1) | 1287 // but actually ranges from -1 and up (thus the -1) |
1300 return readUInt() - 1; | 1288 return readUInt() - 1; |
1301 } | 1289 } |
1302 } | 1290 } |
OLD | NEW |