Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(869)

Side by Side Diff: pkg/kernel/lib/binary/ast_to_binary.dart

Issue 2999633002: [kernel] Offsets on loops (Closed)
Patch Set: Fix Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 } 940 }
941 941
942 visitBreakStatement(BreakStatement node) { 942 visitBreakStatement(BreakStatement node) {
943 writeByte(Tag.BreakStatement); 943 writeByte(Tag.BreakStatement);
944 writeOffset(node.fileOffset); 944 writeOffset(node.fileOffset);
945 writeUInt30(_labelIndexer[node.target]); 945 writeUInt30(_labelIndexer[node.target]);
946 } 946 }
947 947
948 visitWhileStatement(WhileStatement node) { 948 visitWhileStatement(WhileStatement node) {
949 writeByte(Tag.WhileStatement); 949 writeByte(Tag.WhileStatement);
950 writeOffset(node.fileOffset);
950 writeNode(node.condition); 951 writeNode(node.condition);
951 writeNode(node.body); 952 writeNode(node.body);
952 } 953 }
953 954
954 visitDoStatement(DoStatement node) { 955 visitDoStatement(DoStatement node) {
955 writeByte(Tag.DoStatement); 956 writeByte(Tag.DoStatement);
957 writeOffset(node.fileOffset);
956 writeNode(node.body); 958 writeNode(node.body);
957 writeNode(node.condition); 959 writeNode(node.condition);
958 } 960 }
959 961
960 visitForStatement(ForStatement node) { 962 visitForStatement(ForStatement node) {
961 _variableIndexer.pushScope(); 963 _variableIndexer.pushScope();
962 writeByte(Tag.ForStatement); 964 writeByte(Tag.ForStatement);
965 writeOffset(node.fileOffset);
963 writeVariableDeclarationList(node.variables); 966 writeVariableDeclarationList(node.variables);
964 writeOptionalNode(node.condition); 967 writeOptionalNode(node.condition);
965 writeNodeList(node.updates); 968 writeNodeList(node.updates);
966 writeNode(node.body); 969 writeNode(node.body);
967 _variableIndexer.popScope(); 970 _variableIndexer.popScope();
968 } 971 }
969 972
970 visitForInStatement(ForInStatement node) { 973 visitForInStatement(ForInStatement node) {
971 _variableIndexer.pushScope(); 974 _variableIndexer.pushScope();
972 writeByte(node.isAsync ? Tag.AsyncForInStatement : Tag.ForInStatement); 975 writeByte(node.isAsync ? Tag.AsyncForInStatement : Tag.ForInStatement);
973 writeOffset(node.fileOffset); 976 writeOffset(node.fileOffset);
977 writeOffset(node.bodyOffset);
974 writeVariableDeclaration(node.variable); 978 writeVariableDeclaration(node.variable);
975 writeNode(node.iterable); 979 writeNode(node.iterable);
976 writeNode(node.body); 980 writeNode(node.body);
977 _variableIndexer.popScope(); 981 _variableIndexer.popScope();
978 } 982 }
979 983
980 visitSwitchStatement(SwitchStatement node) { 984 visitSwitchStatement(SwitchStatement node) {
981 _switchCaseIndexer.enter(node); 985 _switchCaseIndexer.enter(node);
982 writeByte(Tag.SwitchStatement); 986 writeByte(Tag.SwitchStatement);
983 writeNode(node.expression); 987 writeNode(node.expression);
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 _sink.add(_buffer.sublist(0, length)); 1574 _sink.add(_buffer.sublist(0, length));
1571 _buffer = new Uint8List(SIZE); 1575 _buffer = new Uint8List(SIZE);
1572 flushedLength += length; 1576 flushedLength += length;
1573 length = 0; 1577 length = 0;
1574 } 1578 }
1575 1579
1576 void flushAndDestroy() { 1580 void flushAndDestroy() {
1577 _sink.add(_buffer.sublist(0, length)); 1581 _sink.add(_buffer.sublist(0, length));
1578 } 1582 }
1579 } 1583 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698