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

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

Issue 1161683002: dart2js cps: 'is' checks on types with type arguments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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) 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 10
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 283 }
284 284
285 String visitSetMutableVariable(SetMutableVariable node) { 285 String visitSetMutableVariable(SetMutableVariable node) {
286 String value = access(node.value); 286 String value = access(node.value);
287 String body = indentBlock(() => visit(node.body)); 287 String body = indentBlock(() => visit(node.body));
288 return '$indentation(SetMutableVariable ${access(node.variable)} ' 288 return '$indentation(SetMutableVariable ${access(node.variable)} '
289 '$value\n$body)'; 289 '$value\n$body)';
290 } 290 }
291 291
292 String visitTypeOperator(TypeOperator node) { 292 String visitTypeOperator(TypeOperator node) {
293 String receiver = access(node.receiver); 293 String value = access(node.value);
294 String cont = access(node.continuation); 294 String cont = access(node.continuation);
295 String operator = node.isTypeTest ? 'is' : 'as'; 295 String operator = node.isTypeTest ? 'is' : 'as';
296 return '$indentation(TypeOperator $operator $receiver ${node.type} $cont)'; 296 String typeArguments = node.typeArguments.map(access).join(' ');
297 return '$indentation(TypeOperator $operator $value ${node.type} '
298 '($typeArguments) $cont)';
297 } 299 }
298 300
299 String visitLiteralList(LiteralList node) { 301 String visitLiteralList(LiteralList node) {
300 String values = node.values.map(access).join(' '); 302 String values = node.values.map(access).join(' ');
301 return '(LiteralList ($values))'; 303 return '(LiteralList ($values))';
302 } 304 }
303 305
304 String visitLiteralMap(LiteralMap node) { 306 String visitLiteralMap(LiteralMap node) {
305 String keys = node.entries.map((e) => access(e.key)).join(' '); 307 String keys = node.entries.map((e) => access(e.key)).join(' ');
306 String values = node.entries.map((e) => access(e.value)).join(' '); 308 String values = node.entries.map((e) => access(e.value)).join(' ');
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 void setReturnContinuation(Continuation node) { 506 void setReturnContinuation(Continuation node) {
505 assert(!_names.containsKey(node) || _names[node] == 'return'); 507 assert(!_names.containsKey(node) || _names[node] == 'return');
506 _names[node] = 'return'; 508 _names[node] = 'return';
507 } 509 }
508 510
509 String getName(Node node) { 511 String getName(Node node) {
510 if (!_names.containsKey(node)) return 'MISSING_NAME'; 512 if (!_names.containsKey(node)) return 'MISSING_NAME';
511 return _names[node]; 513 return _names[node];
512 } 514 }
513 } 515 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698