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 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 switch (tag) { | 928 switch (tag) { |
929 case Tag.InvalidStatement: | 929 case Tag.InvalidStatement: |
930 return new InvalidStatement(); | 930 return new InvalidStatement(); |
931 case Tag.ExpressionStatement: | 931 case Tag.ExpressionStatement: |
932 return new ExpressionStatement(readExpression()); | 932 return new ExpressionStatement(readExpression()); |
933 case Tag.Block: | 933 case Tag.Block: |
934 return readBlock(); | 934 return readBlock(); |
935 case Tag.EmptyStatement: | 935 case Tag.EmptyStatement: |
936 return new EmptyStatement(); | 936 return new EmptyStatement(); |
937 case Tag.AssertStatement: | 937 case Tag.AssertStatement: |
938 return new AssertStatement(readExpression(), readExpressionOption()); | 938 return new AssertStatement(readExpression(), |
| 939 conditionStartOffset: readOffset(), |
| 940 conditionEndOffset: readOffset(), |
| 941 message: readExpressionOption()); |
939 case Tag.LabeledStatement: | 942 case Tag.LabeledStatement: |
940 var label = new LabeledStatement(null); | 943 var label = new LabeledStatement(null); |
941 labelStack.add(label); | 944 labelStack.add(label); |
942 label.body = readStatement()..parent = label; | 945 label.body = readStatement()..parent = label; |
943 labelStack.removeLast(); | 946 labelStack.removeLast(); |
944 return label; | 947 return label; |
945 case Tag.BreakStatement: | 948 case Tag.BreakStatement: |
946 int offset = readOffset(); | 949 int offset = readOffset(); |
947 int index = readUInt(); | 950 int index = readUInt(); |
948 return new BreakStatement(labelStack[labelStackBase + index]) | 951 return new BreakStatement(labelStack[labelStackBase + index]) |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 ..fileOffset = offset | 1200 ..fileOffset = offset |
1198 ..fileEqualsOffset = fileEqualsOffset; | 1201 ..fileEqualsOffset = fileEqualsOffset; |
1199 } | 1202 } |
1200 | 1203 |
1201 int readOffset() { | 1204 int readOffset() { |
1202 // Offset is saved as unsigned, | 1205 // Offset is saved as unsigned, |
1203 // but actually ranges from -1 and up (thus the -1) | 1206 // but actually ranges from -1 and up (thus the -1) |
1204 return readUInt() - 1; | 1207 return readUInt() - 1; |
1205 } | 1208 } |
1206 } | 1209 } |
OLD | NEW |