| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 writeOffset(node.fileEndOffset); |
| 382 writeByte(flags); | 382 writeByte(flags); |
| 383 writeStringReference(node.name ?? ''); | 383 writeStringReference(node.name ?? ''); |
| 384 writeUriReference(node.fileUri ?? ''); | 384 writeUriReference(node.fileUri ?? ''); |
| 385 writeStringReference(node.documentationComment ?? ''); |
| 385 writeAnnotationList(node.annotations); | 386 writeAnnotationList(node.annotations); |
| 386 _typeParameterIndexer.enter(node.typeParameters); | 387 _typeParameterIndexer.enter(node.typeParameters); |
| 387 writeNodeList(node.typeParameters); | 388 writeNodeList(node.typeParameters); |
| 388 writeOptionalNode(node.supertype); | 389 writeOptionalNode(node.supertype); |
| 389 writeOptionalNode(node.mixedInType); | 390 writeOptionalNode(node.mixedInType); |
| 390 writeNodeList(node.implementedTypes); | 391 writeNodeList(node.implementedTypes); |
| 391 writeNodeList(node.fields); | 392 writeNodeList(node.fields); |
| 392 writeNodeList(node.constructors); | 393 writeNodeList(node.constructors); |
| 393 writeNodeList(node.procedures); | 394 writeNodeList(node.procedures); |
| 394 _typeParameterIndexer.exit(node.typeParameters); | 395 _typeParameterIndexer.exit(node.typeParameters); |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 visitCombinator(Combinator node) { | 1348 visitCombinator(Combinator node) { |
| 1348 node.names.forEach(put); | 1349 node.names.forEach(put); |
| 1349 } | 1350 } |
| 1350 | 1351 |
| 1351 visitTypedef(Typedef node) { | 1352 visitTypedef(Typedef node) { |
| 1352 put(node.name); | 1353 put(node.name); |
| 1353 node.visitChildren(this); | 1354 node.visitChildren(this); |
| 1354 } | 1355 } |
| 1355 | 1356 |
| 1356 visitClass(Class node) { | 1357 visitClass(Class node) { |
| 1358 putOptional(node.documentationComment); |
| 1357 putOptional(node.name); | 1359 putOptional(node.name); |
| 1358 node.visitChildren(this); | 1360 node.visitChildren(this); |
| 1359 } | 1361 } |
| 1360 | 1362 |
| 1361 visitNamedExpression(NamedExpression node) { | 1363 visitNamedExpression(NamedExpression node) { |
| 1362 put(node.name); | 1364 put(node.name); |
| 1363 node.visitChildren(this); | 1365 node.visitChildren(this); |
| 1364 } | 1366 } |
| 1365 | 1367 |
| 1366 visitStringLiteral(StringLiteral node) { | 1368 visitStringLiteral(StringLiteral node) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 _sink.add(_buffer.sublist(0, length)); | 1505 _sink.add(_buffer.sublist(0, length)); |
| 1504 _buffer = new Uint8List(SIZE); | 1506 _buffer = new Uint8List(SIZE); |
| 1505 flushedLength += length; | 1507 flushedLength += length; |
| 1506 length = 0; | 1508 length = 0; |
| 1507 } | 1509 } |
| 1508 | 1510 |
| 1509 void flushAndDestroy() { | 1511 void flushAndDestroy() { |
| 1510 _sink.add(_buffer.sublist(0, length)); | 1512 _sink.add(_buffer.sublist(0, length)); |
| 1511 } | 1513 } |
| 1512 } | 1514 } |
| OLD | NEW |