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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 node.fileEndOffset = readOffset(); | 463 node.fileEndOffset = readOffset(); |
464 int flags = readByte(); | 464 int flags = readByte(); |
465 node.isAbstract = flags & 0x1 != 0; | 465 node.isAbstract = flags & 0x1 != 0; |
466 int levelIndex = (flags >> 1) & 0x3; | 466 int levelIndex = (flags >> 1) & 0x3; |
467 var level = ClassLevel.values[levelIndex + 1]; | 467 var level = ClassLevel.values[levelIndex + 1]; |
468 if (level.index >= node.level.index) { | 468 if (level.index >= node.level.index) { |
469 node.level = level; | 469 node.level = level; |
470 } | 470 } |
471 var name = readStringOrNullIfEmpty(); | 471 var name = readStringOrNullIfEmpty(); |
472 var fileUri = readUriReference(); | 472 var fileUri = readUriReference(); |
| 473 var documentationComment = readStringOrNullIfEmpty(); |
473 var annotations = readAnnotationList(node); | 474 var annotations = readAnnotationList(node); |
474 debugPath.add(node.name ?? 'normal-class'); | 475 debugPath.add(node.name ?? 'normal-class'); |
475 readAndPushTypeParameterList(node.typeParameters, node); | 476 readAndPushTypeParameterList(node.typeParameters, node); |
476 var supertype = readSupertypeOption(); | 477 var supertype = readSupertypeOption(); |
477 var mixedInType = readSupertypeOption(); | 478 var mixedInType = readSupertypeOption(); |
478 if (shouldWriteData) { | 479 if (shouldWriteData) { |
479 _fillNonTreeNodeList(node.implementedTypes, readSupertype); | 480 _fillNonTreeNodeList(node.implementedTypes, readSupertype); |
480 } else { | 481 } else { |
481 _skipNodeList(readSupertype); | 482 _skipNodeList(readSupertype); |
482 } | 483 } |
483 _mergeNamedNodeList(node.fields, readField, node); | 484 _mergeNamedNodeList(node.fields, readField, node); |
484 _mergeNamedNodeList(node.constructors, readConstructor, node); | 485 _mergeNamedNodeList(node.constructors, readConstructor, node); |
485 _mergeNamedNodeList(node.procedures, readProcedure, node); | 486 _mergeNamedNodeList(node.procedures, readProcedure, node); |
486 typeParameterStack.length = 0; | 487 typeParameterStack.length = 0; |
487 debugPath.removeLast(); | 488 debugPath.removeLast(); |
488 if (shouldWriteData) { | 489 if (shouldWriteData) { |
489 node.name = name; | 490 node.name = name; |
490 node.fileUri = fileUri; | 491 node.fileUri = fileUri; |
| 492 node.documentationComment = documentationComment; |
491 node.annotations = annotations; | 493 node.annotations = annotations; |
492 node.supertype = supertype; | 494 node.supertype = supertype; |
493 node.mixedInType = mixedInType; | 495 node.mixedInType = mixedInType; |
494 } | 496 } |
495 return node; | 497 return node; |
496 } | 498 } |
497 | 499 |
498 int getAndResetTransformerFlags() { | 500 int getAndResetTransformerFlags() { |
499 int flags = _transformerFlags; | 501 int flags = _transformerFlags; |
500 _transformerFlags = 0; | 502 _transformerFlags = 0; |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 ..fileOffset = offset | 1241 ..fileOffset = offset |
1240 ..fileEqualsOffset = fileEqualsOffset; | 1242 ..fileEqualsOffset = fileEqualsOffset; |
1241 } | 1243 } |
1242 | 1244 |
1243 int readOffset() { | 1245 int readOffset() { |
1244 // Offset is saved as unsigned, | 1246 // Offset is saved as unsigned, |
1245 // but actually ranges from -1 and up (thus the -1) | 1247 // but actually ranges from -1 and up (thus the -1) |
1246 return readUInt() - 1; | 1248 return readUInt() - 1; |
1247 } | 1249 } |
1248 } | 1250 } |
OLD | NEW |