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

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

Issue 1585503002: dart2js: CPS translation of switches with continue to their labels. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase. 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 | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | tests/co19/co19-dart2js.status » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 4
5 library dart2js.ir_nodes_sexpr; 5 library dart2js.ir_nodes_sexpr;
6 6
7 import '../constants/values.dart'; 7 import '../constants/values.dart';
8 import '../util/util.dart'; 8 import '../util/util.dart';
9 import 'cps_ir_nodes.dart'; 9 import 'cps_ir_nodes.dart';
10 import '../universe/call_structure.dart' show 10 import '../universe/call_structure.dart' show
(...skipping 12 matching lines...) Expand all
23 String newContinuationName(Continuation node) => namer.nameContinuation(node); 23 String newContinuationName(Continuation node) => namer.nameContinuation(node);
24 Decorator decorator; 24 Decorator decorator;
25 25
26 SExpressionStringifier([this.decorator]) { 26 SExpressionStringifier([this.decorator]) {
27 if (this.decorator == null) { 27 if (this.decorator == null) {
28 this.decorator = (node, String s) => s; 28 this.decorator = (node, String s) => s;
29 } 29 }
30 } 30 }
31 31
32 String access(Reference<Definition> r) { 32 String access(Reference<Definition> r) {
33 if (r == null) return '**** NULL ****';
33 return decorator(r, namer.getName(r.definition)); 34 return decorator(r, namer.getName(r.definition));
34 } 35 }
35 36
36 String optionalAccess(Reference<Definition> reference) { 37 String optionalAccess(Reference<Definition> reference) {
37 return reference == null ? '()' : '(${access(reference)})'; 38 return reference == null ? '()' : '(${access(reference)})';
38 } 39 }
39 40
40 String visitParameter(Parameter node) { 41 String visitParameter(Parameter node) {
41 return namer.nameParameter(node); 42 return namer.nameParameter(node);
42 } 43 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if (!node.target.name.isEmpty) { 186 if (!node.target.name.isEmpty) {
186 name = '${name}.${node.target.name}'; 187 name = '${name}.${node.target.name}';
187 } 188 }
188 String args = formatArguments(node.selector.callStructure, node.arguments); 189 String args = formatArguments(node.selector.callStructure, node.arguments);
189 return '(InvokeConstructor $name $args)'; 190 return '(InvokeConstructor $name $args)';
190 } 191 }
191 192
192 String visitInvokeContinuation(InvokeContinuation node) { 193 String visitInvokeContinuation(InvokeContinuation node) {
193 String name = access(node.continuation); 194 String name = access(node.continuation);
194 if (node.isRecursive) name = 'rec $name'; 195 if (node.isRecursive) name = 'rec $name';
195 String args = node.arguments.map(access).join(' '); 196 String args = node.arguments == null
197 ? '**** NULL ****'
198 » : node.arguments.map(access).join(' ');
196 String escaping = node.isEscapingTry ? ' escape' : ''; 199 String escaping = node.isEscapingTry ? ' escape' : '';
197 return '$indentation(InvokeContinuation $name ($args)$escaping)'; 200 return '$indentation(InvokeContinuation $name ($args)$escaping)';
198 } 201 }
199 202
200 String visitThrow(Throw node) { 203 String visitThrow(Throw node) {
201 String value = access(node.value); 204 String value = access(node.value);
202 return '$indentation(Throw $value)'; 205 return '$indentation(Throw $value)';
203 } 206 }
204 207
205 String visitRethrow(Rethrow node) { 208 String visitRethrow(Rethrow node) {
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 void setReturnContinuation(Continuation node) { 515 void setReturnContinuation(Continuation node) {
513 assert(!_names.containsKey(node) || _names[node] == 'return'); 516 assert(!_names.containsKey(node) || _names[node] == 'return');
514 _names[node] = 'return'; 517 _names[node] = 'return';
515 } 518 }
516 519
517 String getName(Node node) { 520 String getName(Node node) {
518 if (!_names.containsKey(node)) return 'MISSING_NAME'; 521 if (!_names.containsKey(node)) return 'MISSING_NAME';
519 return _names[node]; 522 return _names[node];
520 } 523 }
521 } 524 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698