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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 var reference = canonicalName.getReference(); | 456 var reference = canonicalName.getReference(); |
457 Class node = reference.node; | 457 Class node = reference.node; |
458 bool shouldWriteData = node == null || _isReadingLibraryImplementation; | 458 bool shouldWriteData = node == null || _isReadingLibraryImplementation; |
459 if (node == null) { | 459 if (node == null) { |
460 node = new Class(reference: reference)..level = ClassLevel.Temporary; | 460 node = new Class(reference: reference)..level = ClassLevel.Temporary; |
461 } | 461 } |
462 node.fileOffset = readOffset(); | 462 node.fileOffset = readOffset(); |
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 node.isSyntheticMixinImplementation = flags & 0x2 != 0; | 466 node.isEnum = flags & 0x2 != 0; |
467 int levelIndex = (flags >> 2) & 0x3; | 467 node.isSyntheticMixinImplementation = flags & 0x4 != 0; |
| 468 int levelIndex = (flags >> 3) & 0x3; |
468 var level = ClassLevel.values[levelIndex + 1]; | 469 var level = ClassLevel.values[levelIndex + 1]; |
469 if (level.index >= node.level.index) { | 470 if (level.index >= node.level.index) { |
470 node.level = level; | 471 node.level = level; |
471 } | 472 } |
472 var name = readStringOrNullIfEmpty(); | 473 var name = readStringOrNullIfEmpty(); |
473 var fileUri = readUriReference(); | 474 var fileUri = readUriReference(); |
474 var documentationComment = readStringOrNullIfEmpty(); | 475 var documentationComment = readStringOrNullIfEmpty(); |
475 var annotations = readAnnotationList(node); | 476 var annotations = readAnnotationList(node); |
476 debugPath.add(node.name ?? 'normal-class'); | 477 debugPath.add(node.name ?? 'normal-class'); |
477 readAndPushTypeParameterList(node.typeParameters, node); | 478 readAndPushTypeParameterList(node.typeParameters, node); |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 ..fileOffset = offset | 1255 ..fileOffset = offset |
1255 ..fileEqualsOffset = fileEqualsOffset; | 1256 ..fileEqualsOffset = fileEqualsOffset; |
1256 } | 1257 } |
1257 | 1258 |
1258 int readOffset() { | 1259 int readOffset() { |
1259 // Offset is saved as unsigned, | 1260 // Offset is saved as unsigned, |
1260 // but actually ranges from -1 and up (thus the -1) | 1261 // but actually ranges from -1 and up (thus the -1) |
1261 return readUInt() - 1; | 1262 return readUInt() - 1; |
1262 } | 1263 } |
1263 } | 1264 } |
OLD | NEW |