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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 bool insideExternalLibrary = false; | 249 bool insideExternalLibrary = false; |
250 | 250 |
251 visitLibrary(Library node) { | 251 visitLibrary(Library node) { |
252 insideExternalLibrary = node.isExternal; | 252 insideExternalLibrary = node.isExternal; |
253 writeByte(insideExternalLibrary ? 1 : 0); | 253 writeByte(insideExternalLibrary ? 1 : 0); |
254 writeCanonicalNameReference(getCanonicalNameOfLibrary(node)); | 254 writeCanonicalNameReference(getCanonicalNameOfLibrary(node)); |
255 writeStringReference(node.name ?? ''); | 255 writeStringReference(node.name ?? ''); |
256 // TODO(jensj): We save (almost) the same URI twice. | 256 // TODO(jensj): We save (almost) the same URI twice. |
257 writeUriReference(node.fileUri ?? ''); | 257 writeUriReference(node.fileUri ?? ''); |
| 258 writeAnnotationList(node.annotations); |
258 writeLibraryDependencies(node); | 259 writeLibraryDependencies(node); |
259 writeNodeList(node.typedefs); | 260 writeNodeList(node.typedefs); |
260 writeNodeList(node.classes); | 261 writeNodeList(node.classes); |
261 writeNodeList(node.fields); | 262 writeNodeList(node.fields); |
262 writeNodeList(node.procedures); | 263 writeNodeList(node.procedures); |
263 } | 264 } |
264 | 265 |
265 void writeLibraryDependencies(Library library) { | 266 void writeLibraryDependencies(Library library) { |
266 _libraryDependencyIndex = library.dependencies.isEmpty | 267 _libraryDependencyIndex = library.dependencies.isEmpty |
267 ? const <LibraryDependency, int>{} | 268 ? const <LibraryDependency, int>{} |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 _sink.add(_buffer.sublist(0, length)); | 1405 _sink.add(_buffer.sublist(0, length)); |
1405 _buffer = new Uint8List(SIZE); | 1406 _buffer = new Uint8List(SIZE); |
1406 flushedLength += length; | 1407 flushedLength += length; |
1407 length = 0; | 1408 length = 0; |
1408 } | 1409 } |
1409 | 1410 |
1410 void flushAndDestroy() { | 1411 void flushAndDestroy() { |
1411 _sink.add(_buffer.sublist(0, length)); | 1412 _sink.add(_buffer.sublist(0, length)); |
1412 } | 1413 } |
1413 } | 1414 } |
OLD | NEW |