| 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 '../ast.dart'; | 6 import '../ast.dart'; |
| 7 import 'tag.dart'; | 7 import 'tag.dart'; |
| 8 import 'loader.dart'; | 8 import 'loader.dart'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'package:kernel/transformations/flags.dart'; | 10 import 'package:kernel/transformations/flags.dart'; |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 return new AwaitExpression(readExpression()); | 653 return new AwaitExpression(readExpression()); |
| 654 case Tag.FunctionExpression: | 654 case Tag.FunctionExpression: |
| 655 return new FunctionExpression(readFunctionNode()); | 655 return new FunctionExpression(readFunctionNode()); |
| 656 case Tag.Let: | 656 case Tag.Let: |
| 657 var variable = readVariableDeclaration(); | 657 var variable = readVariableDeclaration(); |
| 658 int stackHeight = variableStack.length; | 658 int stackHeight = variableStack.length; |
| 659 pushVariableDeclaration(variable); | 659 pushVariableDeclaration(variable); |
| 660 var body = readExpression(); | 660 var body = readExpression(); |
| 661 variableStack.length = stackHeight; | 661 variableStack.length = stackHeight; |
| 662 return new Let(variable, body); | 662 return new Let(variable, body); |
| 663 case Tag.BlockExpression: | |
| 664 var body = readBlock(); | |
| 665 var expression = readExpression(); | |
| 666 return new BlockExpression(body, expression); | |
| 667 default: | 663 default: |
| 668 throw fail('Invalid expression tag: $tag'); | 664 throw fail('Invalid expression tag: $tag'); |
| 669 } | 665 } |
| 670 } | 666 } |
| 671 | 667 |
| 672 List<MapEntry> readMapEntryList() { | 668 List<MapEntry> readMapEntryList() { |
| 673 return new List<MapEntry>.generate(readUInt(), (i) => readMapEntry()); | 669 return new List<MapEntry>.generate(readUInt(), (i) => readMapEntry()); |
| 674 } | 670 } |
| 675 | 671 |
| 676 MapEntry readMapEntry() { | 672 MapEntry readMapEntry() { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 isFinal: flags & 0x1 != 0, | 930 isFinal: flags & 0x1 != 0, |
| 935 isConst: flags & 0x2 != 0); | 931 isConst: flags & 0x2 != 0); |
| 936 } | 932 } |
| 937 | 933 |
| 938 int readOffset() { | 934 int readOffset() { |
| 939 // Offset is saved as unsigned, | 935 // Offset is saved as unsigned, |
| 940 // but actually ranges from -1 and up (thus the -1) | 936 // but actually ranges from -1 and up (thus the -1) |
| 941 return readUInt() - 1; | 937 return readUInt() - 1; |
| 942 } | 938 } |
| 943 } | 939 } |
| OLD | NEW |