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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 writeStringReference(node.name ?? ''); | 337 writeStringReference(node.name ?? ''); |
338 writeNodeList(node.combinators); | 338 writeNodeList(node.combinators); |
339 } | 339 } |
340 | 340 |
341 void visitCombinator(Combinator node) { | 341 void visitCombinator(Combinator node) { |
342 writeByte(node.isShow ? 1 : 0); | 342 writeByte(node.isShow ? 1 : 0); |
343 writeStringReferenceList(node.names); | 343 writeStringReferenceList(node.names); |
344 } | 344 } |
345 | 345 |
346 void visitTypedef(Typedef node) { | 346 void visitTypedef(Typedef node) { |
| 347 _variableIndexer = new VariableIndexer(); |
347 writeCanonicalNameReference(getCanonicalNameOfTypedef(node)); | 348 writeCanonicalNameReference(getCanonicalNameOfTypedef(node)); |
348 writeOffset(node.fileOffset); | 349 writeOffset(node.fileOffset); |
349 writeStringReference(node.name); | 350 writeStringReference(node.name); |
350 writeUriReference(node.fileUri ?? ''); | 351 writeUriReference(node.fileUri ?? ''); |
351 _typeParameterIndexer.enter(node.typeParameters); | 352 _typeParameterIndexer.enter(node.typeParameters); |
352 writeNodeList(node.typeParameters); | 353 writeNodeList(node.typeParameters); |
| 354 writeUInt30(node.requiredParameterCount); |
| 355 writeVariableDeclarationList(node.positionalParameters); |
| 356 writeVariableDeclarationList(node.namedParameters); |
353 writeNode(node.type); | 357 writeNode(node.type); |
354 _typeParameterIndexer.exit(node.typeParameters); | 358 _typeParameterIndexer.exit(node.typeParameters); |
| 359 _variableIndexer = null; |
355 } | 360 } |
356 | 361 |
357 void writeAnnotation(Expression annotation) { | 362 void writeAnnotation(Expression annotation) { |
358 _variableIndexer ??= new VariableIndexer(); | 363 _variableIndexer ??= new VariableIndexer(); |
359 writeNode(annotation); | 364 writeNode(annotation); |
360 } | 365 } |
361 | 366 |
362 void writeAnnotationList(List<Expression> annotations) { | 367 void writeAnnotationList(List<Expression> annotations) { |
363 writeList(annotations, writeAnnotation); | 368 writeList(annotations, writeAnnotation); |
364 } | 369 } |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 _sink.add(_buffer.sublist(0, length)); | 1520 _sink.add(_buffer.sublist(0, length)); |
1516 _buffer = new Uint8List(SIZE); | 1521 _buffer = new Uint8List(SIZE); |
1517 flushedLength += length; | 1522 flushedLength += length; |
1518 length = 0; | 1523 length = 0; |
1519 } | 1524 } |
1520 | 1525 |
1521 void flushAndDestroy() { | 1526 void flushAndDestroy() { |
1522 _sink.add(_buffer.sublist(0, length)); | 1527 _sink.add(_buffer.sublist(0, length)); |
1523 } | 1528 } |
1524 } | 1529 } |
OLD | NEW |