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_to_binary; | 4 library kernel.ast_to_binary; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 import '../import_table.dart'; | 7 import '../import_table.dart'; |
8 import 'tag.dart'; | 8 import 'tag.dart'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'dart:typed_data'; | 10 import 'dart:typed_data'; |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 writeOffset(node.bodyOffset); | 962 writeOffset(node.bodyOffset); |
963 writeVariableDeclaration(node.variable); | 963 writeVariableDeclaration(node.variable); |
964 writeNode(node.iterable); | 964 writeNode(node.iterable); |
965 writeNode(node.body); | 965 writeNode(node.body); |
966 _variableIndexer.popScope(); | 966 _variableIndexer.popScope(); |
967 } | 967 } |
968 | 968 |
969 visitSwitchStatement(SwitchStatement node) { | 969 visitSwitchStatement(SwitchStatement node) { |
970 _switchCaseIndexer.enter(node); | 970 _switchCaseIndexer.enter(node); |
971 writeByte(Tag.SwitchStatement); | 971 writeByte(Tag.SwitchStatement); |
| 972 writeOffset(node.fileOffset); |
972 writeNode(node.expression); | 973 writeNode(node.expression); |
973 writeNodeList(node.cases); | 974 writeNodeList(node.cases); |
974 _switchCaseIndexer.exit(node); | 975 _switchCaseIndexer.exit(node); |
975 } | 976 } |
976 | 977 |
977 visitSwitchCase(SwitchCase node) { | 978 visitSwitchCase(SwitchCase node) { |
978 // Note: there is no tag on SwitchCase. | 979 // Note: there is no tag on SwitchCase. |
979 int length = node.expressions.length; | 980 int length = node.expressions.length; |
980 writeUInt30(length); | 981 writeUInt30(length); |
981 for (int i = 0; i < length; ++i) { | 982 for (int i = 0; i < length; ++i) { |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 _sink.add(_buffer.sublist(0, length)); | 1552 _sink.add(_buffer.sublist(0, length)); |
1552 _buffer = new Uint8List(SIZE); | 1553 _buffer = new Uint8List(SIZE); |
1553 flushedLength += length; | 1554 flushedLength += length; |
1554 length = 0; | 1555 length = 0; |
1555 } | 1556 } |
1556 | 1557 |
1557 void flushAndDestroy() { | 1558 void flushAndDestroy() { |
1558 _sink.add(_buffer.sublist(0, length)); | 1559 _sink.add(_buffer.sublist(0, length)); |
1559 } | 1560 } |
1560 } | 1561 } |
OLD | NEW |