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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1626603002: Add missing parent pointers in CopyingVisitor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.ir_nodes; 4 library dart2js.ir_nodes;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'cps_fragment.dart' show CpsFragment; 7 import 'cps_fragment.dart' show CpsFragment;
8 import '../constants/values.dart' as values; 8 import '../constants/values.dart' as values;
9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 2657 matching lines...) Expand 10 before | Expand all | Expand 10 after
2668 Expression _first = null; 2668 Expression _first = null;
2669 Expression _current = null; 2669 Expression _current = null;
2670 2670
2671 void plug(Expression body) { 2671 void plug(Expression body) {
2672 if (_first == null) { 2672 if (_first == null) {
2673 _first = body; 2673 _first = body;
2674 } else { 2674 } else {
2675 assert(_current != null); 2675 assert(_current != null);
2676 InteriorExpression interior = _current; 2676 InteriorExpression interior = _current;
2677 interior.body = body; 2677 interior.body = body;
2678 body.parent = interior;
2678 } 2679 }
2679 _current = body; 2680 _current = body;
2680 } 2681 }
2681 2682
2682 // Continuations are added to the visitor's stack to be visited after copying 2683 // Continuations are added to the visitor's stack to be visited after copying
2683 // the current block is finished. The stack action saves the current block, 2684 // the current block is finished. The stack action saves the current block,
2684 // copies the continuation's body, sets the body on the copy of the 2685 // copies the continuation's body, sets the body on the copy of the
2685 // continuation, and restores the current block. 2686 // continuation, and restores the current block.
2686 // 2687 //
2687 // Note that continuations are added to the copy map before the stack action 2688 // Note that continuations are added to the copy map before the stack action
2688 // to visit them is performed. 2689 // to visit them is performed.
2689 void push(Continuation cont) { 2690 void push(Continuation cont) {
2690 assert(!cont.isReturnContinuation); 2691 assert(!cont.isReturnContinuation);
2691 _stack.add(() { 2692 _stack.add(() {
2692 Expression savedFirst = _first; 2693 Expression savedFirst = _first;
2693 _first = _current = null; 2694 _first = _current = null;
2694 _processBlock(cont.body); 2695 _processBlock(cont.body);
2695 _copies[cont].body = _first; 2696 Continuation contCopy = _copies[cont];
2697 contCopy.body = _first;
2698 _first.parent = contCopy;
2696 _first = savedFirst; 2699 _first = savedFirst;
2697 _current = null; 2700 _current = null;
2698 }); 2701 });
2699 } 2702 }
2700 2703
2701 FunctionDefinition copy(FunctionDefinition node) { 2704 FunctionDefinition copy(FunctionDefinition node) {
2702 assert(_first == null && _current == null); 2705 assert(_first == null && _current == null);
2703 _first = _current = null; 2706 _first = _current = null;
2704 // Definitions are copied where they are bound, before processing 2707 // Definitions are copied where they are bound, before processing
2705 // expressions in the scope of their binding. 2708 // expressions in the scope of their binding.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 plug(new Branch.loose(_definitions.getCopy(node.condition), 2787 plug(new Branch.loose(_definitions.getCopy(node.condition),
2785 _copies[node.trueContinuation.definition], 2788 _copies[node.trueContinuation.definition],
2786 _copies[node.falseContinuation.definition]) 2789 _copies[node.falseContinuation.definition])
2787 ..isStrictCheck = node.isStrictCheck); 2790 ..isStrictCheck = node.isStrictCheck);
2788 } 2791 }
2789 2792
2790 visitUnreachable(Unreachable node) { 2793 visitUnreachable(Unreachable node) {
2791 plug(new Unreachable()); 2794 plug(new Unreachable());
2792 } 2795 }
2793 } 2796 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698