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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 return new FunctionType(positional, returnType, | 1129 return new FunctionType(positional, returnType, |
1130 typeParameters: typeParameters, | 1130 typeParameters: typeParameters, |
1131 requiredParameterCount: requiredParameterCount, | 1131 requiredParameterCount: requiredParameterCount, |
1132 namedParameters: named); | 1132 namedParameters: named); |
1133 case Tag.SimpleFunctionType: | 1133 case Tag.SimpleFunctionType: |
1134 var positional = readDartTypeList(); | 1134 var positional = readDartTypeList(); |
1135 var returnType = readDartType(); | 1135 var returnType = readDartType(); |
1136 return new FunctionType(positional, returnType); | 1136 return new FunctionType(positional, returnType); |
1137 case Tag.TypeParameterType: | 1137 case Tag.TypeParameterType: |
1138 int index = readUInt(); | 1138 int index = readUInt(); |
1139 readUInt(); // offset of parameter list in the binary. | |
1140 readUInt(); // index in the list. | |
1141 var bound = readDartTypeOption(); | 1139 var bound = readDartTypeOption(); |
1142 return new TypeParameterType(typeParameterStack[index], bound); | 1140 return new TypeParameterType(typeParameterStack[index], bound); |
1143 default: | 1141 default: |
1144 throw fail('Invalid dart type tag: $tag'); | 1142 throw fail('Invalid dart type tag: $tag'); |
1145 } | 1143 } |
1146 } | 1144 } |
1147 | 1145 |
1148 List<TypeParameter> readAndPushTypeParameterList( | 1146 List<TypeParameter> readAndPushTypeParameterList( |
1149 [List<TypeParameter> list, TreeNode parent]) { | 1147 [List<TypeParameter> list, TreeNode parent]) { |
1150 int length = readUInt(); | 1148 int length = readUInt(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 ..fileOffset = offset | 1213 ..fileOffset = offset |
1216 ..fileEqualsOffset = fileEqualsOffset; | 1214 ..fileEqualsOffset = fileEqualsOffset; |
1217 } | 1215 } |
1218 | 1216 |
1219 int readOffset() { | 1217 int readOffset() { |
1220 // Offset is saved as unsigned, | 1218 // Offset is saved as unsigned, |
1221 // but actually ranges from -1 and up (thus the -1) | 1219 // but actually ranges from -1 and up (thus the -1) |
1222 return readUInt() - 1; | 1220 return readUInt() - 1; |
1223 } | 1221 } |
1224 } | 1222 } |
OLD | NEW |