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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 for (int i = 0; i < length; ++i) { | 1060 for (int i = 0; i < length; ++i) { |
1061 caseNode.expressionOffsets[i] = readOffset(); | 1061 caseNode.expressionOffsets[i] = readOffset(); |
1062 caseNode.expressions[i] = readExpression()..parent = caseNode; | 1062 caseNode.expressions[i] = readExpression()..parent = caseNode; |
1063 } | 1063 } |
1064 caseNode.isDefault = readByte() == 1; | 1064 caseNode.isDefault = readByte() == 1; |
1065 caseNode.body = readStatement()..parent = caseNode; | 1065 caseNode.body = readStatement()..parent = caseNode; |
1066 } | 1066 } |
1067 switchCaseStack.length -= count; | 1067 switchCaseStack.length -= count; |
1068 return new SwitchStatement(expression, cases)..fileOffset = offset; | 1068 return new SwitchStatement(expression, cases)..fileOffset = offset; |
1069 case Tag.ContinueSwitchStatement: | 1069 case Tag.ContinueSwitchStatement: |
| 1070 int offset = readOffset(); |
1070 int index = readUInt(); | 1071 int index = readUInt(); |
1071 return new ContinueSwitchStatement(switchCaseStack[index]); | 1072 return new ContinueSwitchStatement(switchCaseStack[index]) |
| 1073 ..fileOffset = offset; |
1072 case Tag.IfStatement: | 1074 case Tag.IfStatement: |
1073 return new IfStatement( | 1075 return new IfStatement( |
1074 readExpression(), readStatement(), readStatementOrNullIfEmpty()); | 1076 readExpression(), readStatement(), readStatementOrNullIfEmpty()); |
1075 case Tag.ReturnStatement: | 1077 case Tag.ReturnStatement: |
1076 int offset = readOffset(); | 1078 int offset = readOffset(); |
1077 return new ReturnStatement(readExpressionOption())..fileOffset = offset; | 1079 return new ReturnStatement(readExpressionOption())..fileOffset = offset; |
1078 case Tag.TryCatch: | 1080 case Tag.TryCatch: |
1079 Statement body = readStatement(); | 1081 Statement body = readStatement(); |
1080 readByte(); // whether any catch needs a stacktrace. | 1082 readByte(); // whether any catch needs a stacktrace. |
1081 return new TryCatch(body, readCatchList()); | 1083 return new TryCatch(body, readCatchList()); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 ..fileOffset = offset | 1280 ..fileOffset = offset |
1279 ..fileEqualsOffset = fileEqualsOffset; | 1281 ..fileEqualsOffset = fileEqualsOffset; |
1280 } | 1282 } |
1281 | 1283 |
1282 int readOffset() { | 1284 int readOffset() { |
1283 // Offset is saved as unsigned, | 1285 // Offset is saved as unsigned, |
1284 // but actually ranges from -1 and up (thus the -1) | 1286 // but actually ranges from -1 and up (thus the -1) |
1285 return readUInt() - 1; | 1287 return readUInt() - 1; |
1286 } | 1288 } |
1287 } | 1289 } |
OLD | NEW |