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 int levelIndex = (flags >> 1) & 0x3; | 466 node.isSyntheticMixinImplementation = flags & 0x2 != 0; |
467 int levelIndex = (flags >> 2) & 0x3; | |
Siggi Cherem (dart-lang)
2017/07/21 16:46:43
just to double check - in C++ they don't need to d
scheglov
2017/07/21 16:49:37
Correct. In C++ the code reads the byte and uses j
| |
467 var level = ClassLevel.values[levelIndex + 1]; | 468 var level = ClassLevel.values[levelIndex + 1]; |
468 if (level.index >= node.level.index) { | 469 if (level.index >= node.level.index) { |
469 node.level = level; | 470 node.level = level; |
470 } | 471 } |
471 var name = readStringOrNullIfEmpty(); | 472 var name = readStringOrNullIfEmpty(); |
472 var fileUri = readUriReference(); | 473 var fileUri = readUriReference(); |
473 var documentationComment = readStringOrNullIfEmpty(); | 474 var documentationComment = readStringOrNullIfEmpty(); |
474 var annotations = readAnnotationList(node); | 475 var annotations = readAnnotationList(node); |
475 debugPath.add(node.name ?? 'normal-class'); | 476 debugPath.add(node.name ?? 'normal-class'); |
476 readAndPushTypeParameterList(node.typeParameters, node); | 477 readAndPushTypeParameterList(node.typeParameters, node); |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1241 ..fileOffset = offset | 1242 ..fileOffset = offset |
1242 ..fileEqualsOffset = fileEqualsOffset; | 1243 ..fileEqualsOffset = fileEqualsOffset; |
1243 } | 1244 } |
1244 | 1245 |
1245 int readOffset() { | 1246 int readOffset() { |
1246 // Offset is saved as unsigned, | 1247 // Offset is saved as unsigned, |
1247 // but actually ranges from -1 and up (thus the -1) | 1248 // but actually ranges from -1 and up (thus the -1) |
1248 return readUInt() - 1; | 1249 return readUInt() - 1; |
1249 } | 1250 } |
1250 } | 1251 } |
OLD | NEW |