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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 case Tag.ConstMapLiteral: | 919 case Tag.ConstMapLiteral: |
920 int offset = readOffset(); | 920 int offset = readOffset(); |
921 var keyType = readDartType(); | 921 var keyType = readDartType(); |
922 var valueType = readDartType(); | 922 var valueType = readDartType(); |
923 return new MapLiteral(readMapEntryList(), | 923 return new MapLiteral(readMapEntryList(), |
924 keyType: keyType, valueType: valueType, isConst: true) | 924 keyType: keyType, valueType: valueType, isConst: true) |
925 ..fileOffset = offset; | 925 ..fileOffset = offset; |
926 case Tag.AwaitExpression: | 926 case Tag.AwaitExpression: |
927 return new AwaitExpression(readExpression()); | 927 return new AwaitExpression(readExpression()); |
928 case Tag.FunctionExpression: | 928 case Tag.FunctionExpression: |
929 return new FunctionExpression(readFunctionNode()); | 929 int offset = readOffset(); |
| 930 return new FunctionExpression(readFunctionNode())..fileOffset = offset; |
930 case Tag.Let: | 931 case Tag.Let: |
931 var variable = readVariableDeclaration(); | 932 var variable = readVariableDeclaration(); |
932 int stackHeight = variableStack.length; | 933 int stackHeight = variableStack.length; |
933 pushVariableDeclaration(variable); | 934 pushVariableDeclaration(variable); |
934 var body = readExpression(); | 935 var body = readExpression(); |
935 variableStack.length = stackHeight; | 936 variableStack.length = stackHeight; |
936 return new Let(variable, body); | 937 return new Let(variable, body); |
937 case Tag.VectorCreation: | 938 case Tag.VectorCreation: |
938 var length = readUInt(); | 939 var length = readUInt(); |
939 return new VectorCreation(length); | 940 return new VectorCreation(length); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 ..fileOffset = offset | 1277 ..fileOffset = offset |
1277 ..fileEqualsOffset = fileEqualsOffset; | 1278 ..fileEqualsOffset = fileEqualsOffset; |
1278 } | 1279 } |
1279 | 1280 |
1280 int readOffset() { | 1281 int readOffset() { |
1281 // Offset is saved as unsigned, | 1282 // Offset is saved as unsigned, |
1282 // but actually ranges from -1 and up (thus the -1) | 1283 // but actually ranges from -1 and up (thus the -1) |
1283 return readUInt() - 1; | 1284 return readUInt() - 1; |
1284 } | 1285 } |
1285 } | 1286 } |
OLD | NEW |