| 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 if (node.typeArguments.isEmpty) { | 863 if (node.typeArguments.isEmpty) { |
| 864 writeByte(Tag.SimpleInterfaceType); | 864 writeByte(Tag.SimpleInterfaceType); |
| 865 writeClassReference(node.classNode); | 865 writeClassReference(node.classNode); |
| 866 } else { | 866 } else { |
| 867 writeByte(Tag.InterfaceType); | 867 writeByte(Tag.InterfaceType); |
| 868 writeClassReference(node.classNode); | 868 writeClassReference(node.classNode); |
| 869 writeNodeList(node.typeArguments); | 869 writeNodeList(node.typeArguments); |
| 870 } | 870 } |
| 871 } | 871 } |
| 872 | 872 |
| 873 visitSupertype(Supertype node) { |
| 874 if (node.typeArguments.isEmpty) { |
| 875 writeByte(Tag.SimpleInterfaceType); |
| 876 writeClassReference(node.classNode); |
| 877 } else { |
| 878 writeByte(Tag.InterfaceType); |
| 879 writeClassReference(node.classNode); |
| 880 writeNodeList(node.typeArguments); |
| 881 } |
| 882 } |
| 883 |
| 873 visitFunctionType(FunctionType node) { | 884 visitFunctionType(FunctionType node) { |
| 874 if (node.requiredParameterCount == node.positionalParameters.length && | 885 if (node.requiredParameterCount == node.positionalParameters.length && |
| 875 node.typeParameters.isEmpty && | 886 node.typeParameters.isEmpty && |
| 876 node.namedParameters.isEmpty) { | 887 node.namedParameters.isEmpty) { |
| 877 writeByte(Tag.SimpleFunctionType); | 888 writeByte(Tag.SimpleFunctionType); |
| 878 writeNodeList(node.positionalParameters); | 889 writeNodeList(node.positionalParameters); |
| 879 writeNode(node.returnType); | 890 writeNode(node.returnType); |
| 880 } else { | 891 } else { |
| 881 writeByte(Tag.FunctionType); | 892 writeByte(Tag.FunctionType); |
| 882 _typeParameterIndexer.push(node.typeParameters); | 893 _typeParameterIndexer.push(node.typeParameters); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 void flush() { | 1250 void flush() { |
| 1240 _sink.add(_buffer.sublist(0, length)); | 1251 _sink.add(_buffer.sublist(0, length)); |
| 1241 _buffer = new Uint8List(SIZE); | 1252 _buffer = new Uint8List(SIZE); |
| 1242 length = 0; | 1253 length = 0; |
| 1243 } | 1254 } |
| 1244 | 1255 |
| 1245 void flushAndDestroy() { | 1256 void flushAndDestroy() { |
| 1246 _sink.add(_buffer.sublist(0, length)); | 1257 _sink.add(_buffer.sublist(0, length)); |
| 1247 } | 1258 } |
| 1248 } | 1259 } |
| OLD | NEW |