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 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 namedParameters: named, | 1173 namedParameters: named, |
1174 positionalParameterNames: positionalNames); | 1174 positionalParameterNames: positionalNames); |
1175 case Tag.SimpleFunctionType: | 1175 case Tag.SimpleFunctionType: |
1176 var positional = readDartTypeList(); | 1176 var positional = readDartTypeList(); |
1177 var positionalNames = readStringReferenceList(); | 1177 var positionalNames = readStringReferenceList(); |
1178 var returnType = readDartType(); | 1178 var returnType = readDartType(); |
1179 return new FunctionType(positional, returnType, | 1179 return new FunctionType(positional, returnType, |
1180 positionalParameterNames: positionalNames); | 1180 positionalParameterNames: positionalNames); |
1181 case Tag.TypeParameterType: | 1181 case Tag.TypeParameterType: |
1182 int index = readUInt(); | 1182 int index = readUInt(); |
1183 readUInt(); // offset of parameter list in the binary. | |
1184 readUInt(); // index in the list. | |
1185 var bound = readDartTypeOption(); | 1183 var bound = readDartTypeOption(); |
1186 return new TypeParameterType(typeParameterStack[index], bound); | 1184 return new TypeParameterType(typeParameterStack[index], bound); |
1187 default: | 1185 default: |
1188 throw fail('Invalid dart type tag: $tag'); | 1186 throw fail('Invalid dart type tag: $tag'); |
1189 } | 1187 } |
1190 } | 1188 } |
1191 | 1189 |
1192 List<TypeParameter> readAndPushTypeParameterList( | 1190 List<TypeParameter> readAndPushTypeParameterList( |
1193 [List<TypeParameter> list, TreeNode parent]) { | 1191 [List<TypeParameter> list, TreeNode parent]) { |
1194 int length = readUInt(); | 1192 int length = readUInt(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 ..fileOffset = offset | 1257 ..fileOffset = offset |
1260 ..fileEqualsOffset = fileEqualsOffset; | 1258 ..fileEqualsOffset = fileEqualsOffset; |
1261 } | 1259 } |
1262 | 1260 |
1263 int readOffset() { | 1261 int readOffset() { |
1264 // Offset is saved as unsigned, | 1262 // Offset is saved as unsigned, |
1265 // but actually ranges from -1 and up (thus the -1) | 1263 // but actually ranges from -1 and up (thus the -1) |
1266 return readUInt() - 1; | 1264 return readUInt() - 1; |
1267 } | 1265 } |
1268 } | 1266 } |
OLD | NEW |