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

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

Issue 1185633003: cps-ir: Support foreign code. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Status file updates. Created 5 years, 6 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 String visitNonTailThrow(NonTailThrow node) { 331 String visitNonTailThrow(NonTailThrow node) {
332 String value = access(node.value); 332 String value = access(node.value);
333 return '(NonTailThrow $value)'; 333 return '(NonTailThrow $value)';
334 } 334 }
335 335
336 String visitCreateInvocationMirror(CreateInvocationMirror node) { 336 String visitCreateInvocationMirror(CreateInvocationMirror node) {
337 String selector = node.selector.name; 337 String selector = node.selector.name;
338 String args = node.arguments.map(access).join(', '); 338 String args = node.arguments.map(access).join(', ');
339 return '(CreateInvocationMirror $selector $args)'; 339 return '(CreateInvocationMirror $selector $args)';
340 } 340 }
341
342 @override
343 String visitForeignCode(ForeignCode node) {
344 String arguments = node.arguments.map(access).join(', ');
Kevin Millikin (Google) 2015/06/16 11:23:10 Arguments are just space separated.
karlklose 2015/06/18 09:38:14 Done.
345 String continuation = access(node.continuation);
346 return '(JS ${node.type} ${node.codeTemplate} $arguments $continuation)';
Kevin Millikin (Google) 2015/06/16 11:23:10 Arguments are enclosed in parentheses '($arguments
karlklose 2015/06/18 09:38:14 Done.
347 }
341 } 348 }
342 349
343 class ConstantStringifier extends ConstantValueVisitor<String, Null> { 350 class ConstantStringifier extends ConstantValueVisitor<String, Null> {
344 // Some of these methods are unimplemented because we haven't had a need 351 // Some of these methods are unimplemented because we haven't had a need
345 // to print such constants. When printing is implemented, the corresponding 352 // to print such constants. When printing is implemented, the corresponding
346 // parsing support should be added to SExpressionUnstringifier.parseConstant 353 // parsing support should be added to SExpressionUnstringifier.parseConstant
347 // in the dart2js tests (currently in the file 354 // in the dart2js tests (currently in the file
348 // tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart). 355 // tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart).
349 356
350 String _failWith(ConstantValue constant) { 357 String _failWith(ConstantValue constant) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 void setReturnContinuation(Continuation node) { 452 void setReturnContinuation(Continuation node) {
446 assert(!_names.containsKey(node) || _names[node] == 'return'); 453 assert(!_names.containsKey(node) || _names[node] == 'return');
447 _names[node] = 'return'; 454 _names[node] = 'return';
448 } 455 }
449 456
450 String getName(Node node) { 457 String getName(Node node) {
451 if (!_names.containsKey(node)) return 'MISSING_NAME'; 458 if (!_names.containsKey(node)) return 'MISSING_NAME';
452 return _names[node]; 459 return _names[node];
453 } 460 }
454 } 461 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698