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 Expression condition = readExpression(); |
| 939 int conditionStart = readOffset(); |
| 940 int conditionEnd = readOffset(); |
| 941 return new AssertStatement(condition, readExpressionOption()) |
| 942 ..conditionStartOffset = conditionStart |
| 943 ..conditionEndOffset = conditionEnd; |
939 case Tag.LabeledStatement: | 944 case Tag.LabeledStatement: |
940 var label = new LabeledStatement(null); | 945 var label = new LabeledStatement(null); |
941 labelStack.add(label); | 946 labelStack.add(label); |
942 label.body = readStatement()..parent = label; | 947 label.body = readStatement()..parent = label; |
943 labelStack.removeLast(); | 948 labelStack.removeLast(); |
944 return label; | 949 return label; |
945 case Tag.BreakStatement: | 950 case Tag.BreakStatement: |
946 int offset = readOffset(); | 951 int offset = readOffset(); |
947 int index = readUInt(); | 952 int index = readUInt(); |
948 return new BreakStatement(labelStack[labelStackBase + index]) | 953 return new BreakStatement(labelStack[labelStackBase + index]) |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 ..fileOffset = offset | 1202 ..fileOffset = offset |
1198 ..fileEqualsOffset = fileEqualsOffset; | 1203 ..fileEqualsOffset = fileEqualsOffset; |
1199 } | 1204 } |
1200 | 1205 |
1201 int readOffset() { | 1206 int readOffset() { |
1202 // Offset is saved as unsigned, | 1207 // Offset is saved as unsigned, |
1203 // but actually ranges from -1 and up (thus the -1) | 1208 // but actually ranges from -1 and up (thus the -1) |
1204 return readUInt() - 1; | 1209 return readUInt() - 1; |
1205 } | 1210 } |
1206 } | 1211 } |
OLD | NEW |