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_to_binary; | 4 library kernel.ast_to_binary; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 import '../import_table.dart'; | 7 import '../import_table.dart'; |
8 import 'tag.dart'; | 8 import 'tag.dart'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'dart:typed_data'; | 10 import 'dart:typed_data'; |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 visitClass(Class node) { | 372 visitClass(Class node) { |
373 int flags = _encodeClassFlags(node.isAbstract, node.level); | 373 int flags = _encodeClassFlags(node.isAbstract, node.level); |
374 if (node.canonicalName == null) { | 374 if (node.canonicalName == null) { |
375 throw 'Missing canonical name for $node'; | 375 throw 'Missing canonical name for $node'; |
376 } | 376 } |
377 node.binaryOffset = _sink.flushedLength + _sink.length; | 377 node.binaryOffset = _sink.flushedLength + _sink.length; |
378 writeByte(Tag.Class); | 378 writeByte(Tag.Class); |
379 writeCanonicalNameReference(getCanonicalNameOfClass(node)); | 379 writeCanonicalNameReference(getCanonicalNameOfClass(node)); |
380 writeOffset(node.fileOffset); | 380 writeOffset(node.fileOffset); |
| 381 writeOffset(node.fileEndOffset); |
381 writeByte(flags); | 382 writeByte(flags); |
382 writeStringReference(node.name ?? ''); | 383 writeStringReference(node.name ?? ''); |
383 writeUriReference(node.fileUri ?? ''); | 384 writeUriReference(node.fileUri ?? ''); |
384 writeAnnotationList(node.annotations); | 385 writeAnnotationList(node.annotations); |
385 _typeParameterIndexer.enter(node.typeParameters); | 386 _typeParameterIndexer.enter(node.typeParameters); |
386 writeNodeList(node.typeParameters); | 387 writeNodeList(node.typeParameters); |
387 writeOptionalNode(node.supertype); | 388 writeOptionalNode(node.supertype); |
388 writeOptionalNode(node.mixedInType); | 389 writeOptionalNode(node.mixedInType); |
389 writeNodeList(node.implementedTypes); | 390 writeNodeList(node.implementedTypes); |
390 writeNodeList(node.fields); | 391 writeNodeList(node.fields); |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 _sink.add(_buffer.sublist(0, length)); | 1503 _sink.add(_buffer.sublist(0, length)); |
1503 _buffer = new Uint8List(SIZE); | 1504 _buffer = new Uint8List(SIZE); |
1504 flushedLength += length; | 1505 flushedLength += length; |
1505 length = 0; | 1506 length = 0; |
1506 } | 1507 } |
1507 | 1508 |
1508 void flushAndDestroy() { | 1509 void flushAndDestroy() { |
1509 _sink.add(_buffer.sublist(0, length)); | 1510 _sink.add(_buffer.sublist(0, length)); |
1510 } | 1511 } |
1511 } | 1512 } |
OLD | NEW |