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_from_binary; | 4 library kernel.ast_from_binary; |
5 | 5 |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
8 | 8 |
9 import '../ast.dart'; | 9 import '../ast.dart'; |
10 import '../transformations/flags.dart'; | 10 import '../transformations/flags.dart'; |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 case Tag.SimpleInterfaceType: | 1155 case Tag.SimpleInterfaceType: |
1156 return new InterfaceType.byReference( | 1156 return new InterfaceType.byReference( |
1157 readClassReference(), const <DartType>[]); | 1157 readClassReference(), const <DartType>[]); |
1158 case Tag.FunctionType: | 1158 case Tag.FunctionType: |
1159 int typeParameterStackHeight = typeParameterStack.length; | 1159 int typeParameterStackHeight = typeParameterStack.length; |
1160 var typeParameters = readAndPushTypeParameterList(); | 1160 var typeParameters = readAndPushTypeParameterList(); |
1161 var requiredParameterCount = readUInt(); | 1161 var requiredParameterCount = readUInt(); |
1162 var totalParameterCount = readUInt(); | 1162 var totalParameterCount = readUInt(); |
1163 var positional = readDartTypeList(); | 1163 var positional = readDartTypeList(); |
1164 var named = readNamedTypeList(); | 1164 var named = readNamedTypeList(); |
| 1165 var positionalNames = readStringReferenceList(); |
1165 assert(positional.length + named.length == totalParameterCount); | 1166 assert(positional.length + named.length == totalParameterCount); |
1166 var returnType = readDartType(); | 1167 var returnType = readDartType(); |
1167 typeParameterStack.length = typeParameterStackHeight; | 1168 typeParameterStack.length = typeParameterStackHeight; |
1168 return new FunctionType(positional, returnType, | 1169 return new FunctionType(positional, returnType, |
1169 typeParameters: typeParameters, | 1170 typeParameters: typeParameters, |
1170 requiredParameterCount: requiredParameterCount, | 1171 requiredParameterCount: requiredParameterCount, |
1171 namedParameters: named); | 1172 namedParameters: named, |
| 1173 positionalParameterNames: positionalNames); |
1172 case Tag.SimpleFunctionType: | 1174 case Tag.SimpleFunctionType: |
1173 var positional = readDartTypeList(); | 1175 var positional = readDartTypeList(); |
| 1176 var positionalNames = readStringReferenceList(); |
1174 var returnType = readDartType(); | 1177 var returnType = readDartType(); |
1175 return new FunctionType(positional, returnType); | 1178 return new FunctionType(positional, returnType, |
| 1179 positionalParameterNames: positionalNames); |
1176 case Tag.TypeParameterType: | 1180 case Tag.TypeParameterType: |
1177 int index = readUInt(); | 1181 int index = readUInt(); |
1178 readUInt(); // offset of parameter list in the binary. | 1182 readUInt(); // offset of parameter list in the binary. |
1179 readUInt(); // index in the list. | 1183 readUInt(); // index in the list. |
1180 var bound = readDartTypeOption(); | 1184 var bound = readDartTypeOption(); |
1181 return new TypeParameterType(typeParameterStack[index], bound); | 1185 return new TypeParameterType(typeParameterStack[index], bound); |
1182 default: | 1186 default: |
1183 throw fail('Invalid dart type tag: $tag'); | 1187 throw fail('Invalid dart type tag: $tag'); |
1184 } | 1188 } |
1185 } | 1189 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 ..fileOffset = offset | 1258 ..fileOffset = offset |
1255 ..fileEqualsOffset = fileEqualsOffset; | 1259 ..fileEqualsOffset = fileEqualsOffset; |
1256 } | 1260 } |
1257 | 1261 |
1258 int readOffset() { | 1262 int readOffset() { |
1259 // Offset is saved as unsigned, | 1263 // Offset is saved as unsigned, |
1260 // but actually ranges from -1 and up (thus the -1) | 1264 // but actually ranges from -1 and up (thus the -1) |
1261 return readUInt() - 1; | 1265 return readUInt() - 1; |
1262 } | 1266 } |
1263 } | 1267 } |
OLD | NEW |